diff --git a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs index 2c71a1be7..04b7cf2b3 100644 --- a/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs +++ b/TBF/BenchControl/Output/DB/ProductionTracing/Tracing.cs @@ -92,7 +92,7 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing "1.2.3.4", "", WorkstepName, - DateTime.Now + new TimeSpan(8, 0, 0)); + DateTime.Now + new TimeSpan(15, 0, 0, 0)); /// Test Bench registered for approx. 2. weeks session.Flush(); } } diff --git a/TracingDB/BatteryInfo.cs b/TracingDB/BatteryAndFlowtubeInfo.cs similarity index 54% rename from TracingDB/BatteryInfo.cs rename to TracingDB/BatteryAndFlowtubeInfo.cs index 0e4051462..00f7f6056 100644 --- a/TracingDB/BatteryInfo.cs +++ b/TracingDB/BatteryAndFlowtubeInfo.cs @@ -5,9 +5,9 @@ using TracingDB.Entities; namespace TracingDB { - public class BatteryInfo + public class BatteryAndFlowtubeInfo { - static readonly ILog log = LogManager.GetLogger(typeof(BatteryInfo)); + static readonly ILog log = LogManager.GetLogger(typeof(BatteryAndFlowtubeInfo)); /// Constants public const string VitzrocellBatteryPartNr = "68118221"; @@ -18,16 +18,18 @@ namespace TracingDB public int BattBatchNr; /// Batch number (purchase order) public string BattMMYY; /// Production date public string BattSupplier; /// Supplier - public string PrintedBatteryInfo; /// 'T', 'Vi' or '-' + public string FlowtubeSapPartNr; /// Flowtube SAP part number + public bool IsPorexFlowtube; /// + public string PrintedInfo; /// 'T', 'Vi', '-', 'T/P', 'Vi/P' or '-/P' public DateTime TimeStamp; /// Record creation time bool complete { get { return (PcbNumber != null) && (BattSapPartNr != null) && (BattBatchNr != 0) && (BattMMYY != null) && (BattSupplier != null); } } - public BatteryInfo() + public BatteryAndFlowtubeInfo() { TimeStamp = DateTime.Now; - PrintedBatteryInfo = "-"; + PrintedInfo = "-"; } @@ -35,7 +37,7 @@ namespace TracingDB /// Search MySQL DB and get battery info, add it into the record. /// /// true when successful - public static BatteryInfo GetBatteryInfo(string pcbNumber, IList records) + public static BatteryAndFlowtubeInfo GetBatteryAndFlowtubeInfo(string pcbNumber, IList parts, string porexSapNumbers) { if (string.IsNullOrEmpty(pcbNumber)) { @@ -43,38 +45,43 @@ namespace TracingDB return null; } - BatteryInfo info = new BatteryInfo() { PcbNumber = pcbNumber }; + BatteryAndFlowtubeInfo info = new BatteryAndFlowtubeInfo() { PcbNumber = pcbNumber }; try { bool error = false; - foreach (var rec in records) + foreach (var part in parts) { - if (rec.Part.CodeLocation == CodeLocation.OnPallet) + if (part.CodeLocation == CodeLocation.OnPart) { - if (rec.Part.Name == VitzrocellBatteryPartNr) + if (porexSapNumbers.Contains(part.Name)) { - if (info.BattSapPartNr != null) { error = true; break; } - info.BattSapPartNr = VitzrocellBatteryPartNr; - int battBatchNr; - info.BattBatchNr = int.TryParse(rec.Code, out battBatchNr) ? battBatchNr : 1; - info.BattSupplier = "VITZROCELL"; - } - else if (rec.Part.Name == TadiranBatteryPartNr) - { - if (info.BattSapPartNr != null) { error = true; break; } - info.BattSapPartNr = TadiranBatteryPartNr; - int battBatchNr; - info.BattBatchNr = int.TryParse(rec.Code, out battBatchNr) ? battBatchNr : 1; - info.BattSupplier = "TADIRAN"; + info.IsPorexFlowtube = true; + info.FlowtubeSapPartNr = part.Name; } } - if (rec.Part.CodeType == CodeType.DateMMYY) + if (!string.IsNullOrEmpty(part.OraDBType)) + { + string[] oraItems = part.OraDBType.Split(new char[] { ' ' }); + string oraType = oraItems[0]; + string oraDescr = (oraItems.Length > 1) ? oraItems[1] : string.Empty; + + if ((oraType == "Batt") || (oraType == "Batt1") || (oraType == "Batt2")) + { + if (info.BattSapPartNr != null) { error = true; break; } + info.BattSapPartNr = part.Name; + int battBatchNr; + info.BattBatchNr = int.TryParse(part.Code, out battBatchNr) ? battBatchNr : 1; + info.BattSupplier = oraDescr; /// Should be "TADIRAN" or "VITZROCELL" + } + } + + if (part.CodeType == CodeType.DateMMYY) { if (info.BattMMYY != null) { error = true; break; } - info.BattMMYY = rec.Code; + info.BattMMYY = part.Code; } } @@ -89,13 +96,18 @@ namespace TracingDB /// if (info.BattSupplier == "VITZROCELL") { - info.PrintedBatteryInfo = "Vi"; + info.PrintedInfo = "Vi"; } else if (info.BattSupplier == "TADIRAN") { - info.PrintedBatteryInfo = "T"; + info.PrintedInfo = "T"; } + /// + /// Append Porex flowtube info in case of a Porex flowtube + /// + if (info.IsPorexFlowtube) { info.PrintedInfo += "/P"; } + return info; } catch (Exception exc) @@ -109,7 +121,7 @@ namespace TracingDB public override string ToString() { - return string.Format("PcbNr={0}, Battery={1}/{2}/{3}, Time={4}", PcbNumber, BattBatchNr, BattMMYY, BattSupplier, TimeStamp); + return string.Format("PcbNr={0}, Battery={1}/{2}/{3} {4}, Time={5}", PcbNumber, BattBatchNr, BattMMYY, BattSupplier, (IsPorexFlowtube ? "porex" : ""), TimeStamp); } } } diff --git a/TracingDB/DB.cs b/TracingDB/DB.cs index eaeb9e3b0..7d92cd135 100644 --- a/TracingDB/DB.cs +++ b/TracingDB/DB.cs @@ -6,6 +6,7 @@ using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using log4net; +using TracingDB.Entities; namespace TracingDB { @@ -55,7 +56,7 @@ namespace TracingDB FluentConfiguration cfg = Fluently .Configure() .Database(MySQLConfiguration.Standard.ConnectionString(connectionString)) - .Mappings(m => m.FluentMappings.AddFromAssemblyOf()); + .Mappings(m => m.FluentMappings.AddFromAssemblyOf()); if (createDB) { @@ -114,7 +115,7 @@ namespace TracingDB { //using (var transaction = session.BeginTransaction()) //{ - // var part1 = new TracingDB.Entities.Part("flow tube", CodeType.UniqueNr, CodeForm.QRCode, 0); + // var part1 = new Part("flow tube", CodeType.UniqueNr, CodeForm.QRCode, 0); // session.SaveOrUpdate(part1); // transaction.Commit(); //} diff --git a/TracingDB/Entities/Option1.cs b/TracingDB/Entities/Option1.cs deleted file mode 100644 index 64d72ae5e..000000000 --- a/TracingDB/Entities/Option1.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace TracingDB.Entities -{ - public class Option1 : Interfaces.IOption - { - public virtual int Id { get; protected set; } - public virtual int ItemNr { get; set; } - public virtual string Name { get; set; } - public virtual string OraDBType { get; set; } - public virtual string Description { get; set; } - public virtual CodeType CodeType { get; set; } - public virtual CodeForm CodeForm { get; set; } - public virtual CodeLocation CodeLocation { get; set; } - public virtual LifetimeManagement LifetimeManagement { get; set; } - public virtual bool Enabled { get; set; } - - public Option1() - { - Name = string.Empty; - Description = string.Empty; - } - - /// - /// Create a copy of a part (1) belongig to another process, (2) not assigned to any workstep yet. - /// - /// Process owning the cloned part - /// Cloned part - public virtual Part GetPart(Process owningProcess) - { - Part rslt = new Part(); - - rslt.Name = Name; - rslt.OraDBType = OraDBType; - rslt.Description = Description; - rslt.CodeType = CodeType; - rslt.CodeForm = CodeForm; - rslt.CodeLocation = CodeLocation; - rslt.LifetimeManagement = LifetimeManagement; - - rslt.StepNumber = 0; - rslt.Process = owningProcess; - rslt.Workstep = null; - - return rslt; - } - - public override string ToString() - { - return string.Format("{0}. {1} ({2})", ItemNr, Name, Description); - } - } -} diff --git a/TracingDB/Entities/Option2.cs b/TracingDB/Entities/Option2.cs deleted file mode 100644 index 5cbeb27a7..000000000 --- a/TracingDB/Entities/Option2.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace TracingDB.Entities -{ - public class Option2 : Interfaces.IOption - { - public virtual int Id { get; protected set; } - public virtual int ItemNr { get; set; } - public virtual string Name { get; set; } - public virtual string OraDBType { get; set; } - public virtual string Description { get; set; } - public virtual CodeType CodeType { get; set; } - public virtual CodeForm CodeForm { get; set; } - public virtual CodeLocation CodeLocation { get; set; } - public virtual LifetimeManagement LifetimeManagement { get; set; } - public virtual bool Enabled { get; set; } - - public Option2() - { - Name = string.Empty; - Description = string.Empty; - } - - /// - /// Create a copy of a part (1) belongig to another process, (2) not assigned to any workstep yet. - /// - /// Process owning the cloned part - /// Cloned part - public virtual Part GetPart(Process owningProcess) - { - Part rslt = new Part(); - - rslt.Name = Name; - rslt.OraDBType = OraDBType; - rslt.Description = Description; - rslt.CodeType = CodeType; - rslt.CodeForm = CodeForm; - rslt.CodeLocation = CodeLocation; - rslt.LifetimeManagement = LifetimeManagement; - - rslt.StepNumber = 0; - rslt.Process = owningProcess; - rslt.Workstep = null; - - return rslt; - } - - public override string ToString() - { - return string.Format("{0}. {1} ({2})", ItemNr, Name, Description); - } - } -} diff --git a/TracingDB/Entities/Part.cs b/TracingDB/Entities/Part.cs index 6c740a87b..58a468e92 100644 --- a/TracingDB/Entities/Part.cs +++ b/TracingDB/Entities/Part.cs @@ -25,6 +25,14 @@ namespace TracingDB.Entities Description = string.Empty; } + public Part(string name, Process process, string description) + { + Name = name; + Description = description; + Process = process; + Workstep = null; + } + /// /// Constructor used when the part is added to a process /// @@ -51,9 +59,9 @@ namespace TracingDB.Entities /// /// Process owning the cloned part /// Cloned part - public virtual Part Clone(Process owningProcess) - { - Part rslt = new Part(); + public virtual Part Clone(Process owningProcess) + { + Part rslt = new Part(); rslt.Name = Name; rslt.OraDBType = OraDBType; @@ -61,18 +69,18 @@ namespace TracingDB.Entities rslt.CodeType = CodeType; rslt.CodeForm = CodeForm; rslt.CodeLocation = CodeLocation; - rslt.LifetimeManagement = LifetimeManagement; + rslt.LifetimeManagement = LifetimeManagement; + rslt.StepNumber = StepNumber; - rslt.StepNumber = 0; rslt.Process = owningProcess; rslt.Workstep = null; return rslt; - } + } public override string ToString() { - return string.Format("{0} step={1} ({2})", Name, StepNumber, Description); + return string.Format("{0} ({1}: {2})", Name, StepNumber, Description); } } } diff --git a/TracingDB/Entities/Process.cs b/TracingDB/Entities/Process.cs index 47f73f681..db33b78e3 100644 --- a/TracingDB/Entities/Process.cs +++ b/TracingDB/Entities/Process.cs @@ -20,13 +20,43 @@ namespace TracingDB.Entities public virtual IList Parts { get; set; } public virtual IList Worksteps { get; set; } + #region SubClass utilities /// Wrappers public virtual SubClass GetSubClass() { return (SubClass)SubClass; } public virtual void SetSubClass(SubClass subClass) { SubClass = (int)subClass; } + /// Convert SubClass to string + public static string SubClass2Str(SubClass subClass) + { + return subClass.ToDescription(); + } - /// + /// Convert string to SubClass + public static SubClass Str2SubClass(string str) + { + foreach (SubClass sc in Enum.GetValues(typeof(SubClass))) + { + if ((str == sc.ToDescription()) && (sc != TracingDB.SubClass.Invalid)) return sc; + } + + return TracingDB.SubClass.Invalid; + } + + /// Determine whether string is a valid SubClass name + public static bool IsValidSubClassStr(string str) + { + foreach (SubClass sc in Enum.GetValues(typeof(SubClass))) + { + if ((str == sc.ToDescription()) && (sc != TracingDB.SubClass.Invalid)) return true; + } + + return false; + } + + #endregion SubClass utilities + + /// /// Default (private) constructor inicializing lists /// protected Process() @@ -54,21 +84,30 @@ namespace TracingDB.Entities } /// - /// Create a copy of a process with a new name + /// Create a copy of a process with a new name and original 'Created by' user. /// /// /// - public virtual Process Clone(string name) + public virtual Process Clone(string name) + { + return Clone(name, CreatedBy); + } + + /// + /// Create a copy of a process with a new name. + /// + /// + /// + public virtual Process Clone(string name, string userName) { Process rslt = new Process(name); rslt.SubClass = SubClass; rslt.Description = Description; rslt.ReleaseNotes = ReleaseNotes; - CreatedBy = "admin"; - TimeStamp = DateTime.Now; - ApprovedBy = string.Empty; - TimeStamp2 = DateTime.Now; - ReleaseStatus = ReleaseStatus.In_preparation; + rslt.CreatedBy = userName; + rslt.TimeStamp = DateTime.Now; + rslt.ApprovedBy = string.Empty; + rslt.ReleaseStatus = ReleaseStatus.In_preparation; foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt)); foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt)); @@ -76,9 +115,25 @@ namespace TracingDB.Entities return rslt; } + /// + /// Gets a process with a specified name from a list of processes. + /// + /// List of processes (ReleasedActive processs) + /// Process name + /// Process or null if not found + public static Process GetProcessFromName(IList processes, string processName) + { + foreach (var proc in processes) + { + if (proc.Name == processName) return proc; + } + + return null; + } + public override string ToString() { - return string.IsNullOrEmpty(Name) ? string.Empty : Name; + return string.IsNullOrEmpty(Name) ? string.Empty : ((Id != 0) ? Name : string.Format("{0} ({1})", Name, TracingDB.Resources.Strings.unsaved)); } } } diff --git a/TracingDB/Entities/Record.cs b/TracingDB/Entities/Record.cs index a1a083eb5..0773efc0d 100644 --- a/TracingDB/Entities/Record.cs +++ b/TracingDB/Entities/Record.cs @@ -55,7 +55,11 @@ namespace TracingDB.Entities public override string ToString() { - return string.Format("code={0} part={1} description='{2}'", Code, Part.Name, Part.Description); + return string.Format("code={0} part={1}{2} description={3}", + Code, + Part.Name, + string.IsNullOrEmpty(Part.OraDBType) ? string.Empty : string.Format(" ORACLE='{0}'", Part.OraDBType), + Part.Description); } } } diff --git a/TracingDB/Entities/ReferenceRecord.cs b/TracingDB/Entities/ReferenceRecord.cs index c0bc985b7..c8129b47e 100644 --- a/TracingDB/Entities/ReferenceRecord.cs +++ b/TracingDB/Entities/ReferenceRecord.cs @@ -33,6 +33,7 @@ namespace TracingDB.Entities /// Scanned barcode public ReferenceRecord(Process process, Workstep workstep, string code, string userName, string workplace, int result) + : this() { Process = process; Workstep = workstep; diff --git a/TracingDB/Entities/WorkplaceRegistration.cs b/TracingDB/Entities/WorkplaceRegistration.cs index 244575794..70f5ea52f 100644 --- a/TracingDB/Entities/WorkplaceRegistration.cs +++ b/TracingDB/Entities/WorkplaceRegistration.cs @@ -47,5 +47,10 @@ namespace TracingDB.Entities this.ProcessName = processName; this.WorkstepName = workstepName; } + + public override string ToString() + { + return string.Format("Name={0} User={1}", Workplace, UserName); + } } } diff --git a/TracingDB/Entities/Workstep.cs b/TracingDB/Entities/Workstep.cs index 743b5be68..292633615 100644 --- a/TracingDB/Entities/Workstep.cs +++ b/TracingDB/Entities/Workstep.cs @@ -9,13 +9,47 @@ namespace TracingDB.Entities public virtual int WorkstepNr { get; set; } public virtual string Name { get; set; } public virtual string Description { get; set; } - public virtual int CheckPartNr { get; set; } + public virtual int CheckPartNr { get; set; } /// 0 == No previous part checked public virtual bool AllowRepairs { get; set; } public virtual Process Process { get; set; } public virtual Part ReferencePart { get; set; } public virtual IList Parts { get; set; } + public virtual Workstep Clone(Process owningProcess) + { + Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess); + rslt.Description = Description; + rslt.CheckPartNr = CheckPartNr; + rslt.AllowRepairs = AllowRepairs; + + if (ReferencePart != null) + { + foreach (var p in owningProcess.Parts) + { + if (p.Name == ReferencePart.Name) + { + rslt.ReferencePart = p; + break; + } + } + } + + foreach (var srcP in Parts) + { + foreach (var p in owningProcess.Parts) + { + if ((p.Name == srcP.Name) && (p.StepNumber == srcP.StepNumber)) + { + rslt.Parts.Add(p); + p.Workstep = rslt; + } + } + } + + return rslt; + } + /// /// Default (private) constructor inicializing a list @@ -42,41 +76,9 @@ namespace TracingDB.Entities ReferencePart = null; } - public virtual Workstep Clone(Process owningProcess) - { - Workstep rslt = new Workstep(WorkstepNr, Name, owningProcess); - rslt.Description = Description; - rslt.CheckPartNr = CheckPartNr; - rslt.AllowRepairs = AllowRepairs; - - if (ReferencePart != null) - { - foreach (var p in owningProcess.Parts) - { - if (p.Name == ReferencePart.Name) rslt.ReferencePart = p; - } - } - - foreach (var srcP in Parts) - { - foreach (var p in owningProcess.Parts) - { - if (p.Name == srcP.Name) - { - rslt.Parts.Add(p); - p.StepNumber = srcP.StepNumber; - p.Workstep = rslt; - } - } - } - - return rslt; - } - public override string ToString() { - //return string.Format("{0} {1} ({2}) Ref: {3}", WorkstepNr, Name, Description, (ReferencePart != null) ? ReferencePart.Name : "none"); - return string.Format("{0}: {1}", WorkstepNr, Name); + return Name; /// Displayed in Pracovisko.WorkstepDlg.workstepComboBox, Items are Workstep objects } } } diff --git a/TracingDB/Enums.cs b/TracingDB/Enums.cs index 3a7ca5cc8..25e564c0b 100644 --- a/TracingDB/Enums.cs +++ b/TracingDB/Enums.cs @@ -38,13 +38,13 @@ namespace TracingDB public enum CodeType { - [Description("-")] + [Description("")] UniqueNr, - [Description("PCB")] + [Description("Sap6-8")] FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu - [Description("Flowt.")] + [Description("FT-20")] FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom [Description("1")] @@ -143,7 +143,9 @@ namespace TracingDB Workplace, UserName, Barcode, + RefPartName, PartBarcode, + PartName, TimeStamp2, Workstep2, @@ -156,7 +158,9 @@ namespace TracingDB PurchaseOrder, TestResult, MaxPruefindex, - + MaxTestindexEx, + TestBenchId, + Process, } diff --git a/TracingDB/Forms/ListViewEx.cs b/TracingDB/Forms/ListViewEx.cs index c0ca2e2c4..82b09546d 100644 --- a/TracingDB/Forms/ListViewEx.cs +++ b/TracingDB/Forms/ListViewEx.cs @@ -61,6 +61,10 @@ namespace TracingDB.Forms private const int HDN_ITEMCHANGINGW = (HDN_FIRST-20); #endregion + + public SortOrder SortOrder = SortOrder.None; + public int SortColumn = -1; + /// /// Required designer variable. /// @@ -394,12 +398,18 @@ namespace TracingDB.Forms OnSubItemEndEditing(e); - _editItem.SubItems[_editSubItem].Text = e.DisplayText; + if (_editSubItem >= 0 && _editSubItem < _editItem.SubItems.Count) + { + _editItem.SubItems[_editSubItem].Text = e.DisplayText; + } - _editingControl.Leave -= new EventHandler(_editControl_Leave); - _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress); + if (_editingControl != null) + { + _editingControl.Leave -= new EventHandler(_editControl_Leave); + _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress); - _editingControl.Visible = false; + _editingControl.Visible = false; + } _editingControl = null; _editItem = null; diff --git a/TracingDB/Forms/ListViewExtensions.cs b/TracingDB/Forms/ListViewExtensions.cs new file mode 100644 index 000000000..375f10633 --- /dev/null +++ b/TracingDB/Forms/ListViewExtensions.cs @@ -0,0 +1,104 @@ +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace TracingDB.Forms +{ + [EditorBrowsable(EditorBrowsableState.Never)] + public static class ListViewExtensions + { + [StructLayout(LayoutKind.Sequential)] + public struct HDITEM + { + public Mask mask; + public int cxy; + [MarshalAs(UnmanagedType.LPTStr)] + public string pszText; + public IntPtr hbm; + public int cchTextMax; + public Format fmt; + public IntPtr lParam; + // _WIN32_IE >= 0x0300 + public int iImage; + public int iOrder; + // _WIN32_IE >= 0x0500 + public uint type; + public IntPtr pvFilter; + // _WIN32_WINNT >= 0x0600 + public uint state; + + [Flags] + public enum Mask + { + Format = 0x4, // HDI_FORMAT + }; + + [Flags] + public enum Format + { + SortDown = 0x200, // HDF_SORTDOWN + SortUp = 0x400, // HDF_SORTUP + }; + }; + + public const int LVM_FIRST = 0x1000; + public const int LVM_GETHEADER = LVM_FIRST + 31; + + public const int HDM_FIRST = 0x1200; + public const int HDM_GETITEM = HDM_FIRST + 11; + public const int HDM_SETITEM = HDM_FIRST + 12; + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 msg, IntPtr wParam, ref HDITEM lParam); + + public static void SetSortIcon(this ListViewEx listViewControl, int columnIndex, SortOrder order) + { + IntPtr columnHeader = SendMessage(listViewControl.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero); + for (int columnNumber = 0; columnNumber <= listViewControl.Columns.Count - 1; columnNumber++) + { + var columnPtr = new IntPtr(columnNumber); + var item = new HDITEM + { + mask = HDITEM.Mask.Format + }; + + if (SendMessage(columnHeader, HDM_GETITEM, columnPtr, ref item) == IntPtr.Zero) + { + throw new Win32Exception(); + } + + if (order != SortOrder.None && columnNumber == columnIndex) + { + switch (order) + { + case SortOrder.Ascending: + item.fmt &= ~HDITEM.Format.SortDown; + item.fmt |= HDITEM.Format.SortUp; + break; + + case SortOrder.Descending: + item.fmt &= ~HDITEM.Format.SortUp; + item.fmt |= HDITEM.Format.SortDown; + break; + + default: + break; + } + } + else + { + item.fmt &= ~HDITEM.Format.SortDown & ~HDITEM.Format.SortUp; + } + + if (SendMessage(columnHeader, HDM_SETITEM, columnPtr, ref item) == IntPtr.Zero) + { + throw new Win32Exception(); + } + } + } + } +} diff --git a/TracingDB/Forms/LviIntColumnComparer.cs b/TracingDB/Forms/LviIntColumnComparer.cs new file mode 100644 index 000000000..219a2c910 --- /dev/null +++ b/TracingDB/Forms/LviIntColumnComparer.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections; +using System.Windows.Forms; + +namespace TracingDB.Forms +{ + public class LviIntColumnComparer : IComparer + { + int column; + SortOrder order; + + public LviIntColumnComparer() + { + column = 0; + order = SortOrder.Ascending; + } + + public LviIntColumnComparer(int column, SortOrder order) + { + this.column = column; + this.order = order; + } + + public int Compare(object x, object y) + { + int valX = int.Parse(((ListViewItem)x).SubItems[column].Text); + int valY = int.Parse(((ListViewItem)y).SubItems[column].Text); + return (order == SortOrder.Descending) ? (valY - valX) : (valX - valY); + } + } +} diff --git a/TracingDB/Forms/LviTextColumnComparer.cs b/TracingDB/Forms/LviTextColumnComparer.cs new file mode 100644 index 000000000..d0dd7518c --- /dev/null +++ b/TracingDB/Forms/LviTextColumnComparer.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections; +using System.Windows.Forms; + +namespace TracingDB.Forms +{ + public class LviTextColumnComparer : IComparer + { + private int column; + SortOrder order; + + public LviTextColumnComparer() + { + column = 0; + order = SortOrder.Ascending; + } + + public LviTextColumnComparer(int column, SortOrder order) + { + this.column = column; + this.order = order; + } + + public int Compare(object x, object y) + { + string txtX = ((ListViewItem)x).SubItems[column].Text; + string txtY = ((ListViewItem)y).SubItems[column].Text; + return (order == SortOrder.Descending) ? String.Compare(txtY, txtX) : String.Compare(txtX, txtY); + } + } +} diff --git a/TracingDB/Forms/SettingsDlg.Designer.cs b/TracingDB/Forms/SettingsDlg.Designer.cs deleted file mode 100644 index b011634ec..000000000 --- a/TracingDB/Forms/SettingsDlg.Designer.cs +++ /dev/null @@ -1,351 +0,0 @@ -namespace TracingDB.Forms -{ - partial class SettingsDlg - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.groupBox1 = new System.Windows.Forms.GroupBox(); - this.connectionStringTextBox = new System.Windows.Forms.TextBox(); - this.groupBox2 = new System.Windows.Forms.GroupBox(); - this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.radioButton1 = new System.Windows.Forms.RadioButton(); - this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.workplaceNameTextBox = new System.Windows.Forms.TextBox(); - this.saveButton = new System.Windows.Forms.Button(); - this.cancelButton = new System.Windows.Forms.Button(); - this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.extraBatteryLifetimeTextBox = new System.Windows.Forms.TextBox(); - this.oracleGroupBox = new System.Windows.Forms.GroupBox(); - this.checkPcbIsInOracleCheckBox = new System.Windows.Forms.CheckBox(); - this.oracleBatteryCheckBox = new System.Windows.Forms.CheckBox(); - this.groupBox5 = new System.Windows.Forms.GroupBox(); - this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox(); - this.timeGroupBox = new System.Windows.Forms.GroupBox(); - this.label1 = new System.Windows.Forms.Label(); - this.timePicker3 = new System.Windows.Forms.DateTimePicker(); - this.timePicker2 = new System.Windows.Forms.DateTimePicker(); - this.timePicker1 = new System.Windows.Forms.DateTimePicker(); - this.processFilterGroupBox = new System.Windows.Forms.GroupBox(); - this.processFilterComboBox = new System.Windows.Forms.ComboBox(); - this.groupBox1.SuspendLayout(); - this.groupBox2.SuspendLayout(); - this.groupBox3.SuspendLayout(); - this.groupBox4.SuspendLayout(); - this.oracleGroupBox.SuspendLayout(); - this.groupBox5.SuspendLayout(); - this.timeGroupBox.SuspendLayout(); - this.processFilterGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // groupBox1 - // - this.groupBox1.Controls.Add(this.connectionStringTextBox); - this.groupBox1.Location = new System.Drawing.Point(12, 69); - this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(622, 50); - this.groupBox1.TabIndex = 1; - this.groupBox1.TabStop = false; - this.groupBox1.Text = "Connection string pre záznamy z výroby"; - // - // connectionStringTextBox - // - this.connectionStringTextBox.Location = new System.Drawing.Point(17, 18); - this.connectionStringTextBox.Name = "connectionStringTextBox"; - this.connectionStringTextBox.Size = new System.Drawing.Size(586, 20); - this.connectionStringTextBox.TabIndex = 0; - // - // groupBox2 - // - this.groupBox2.Controls.Add(this.radioButton2); - this.groupBox2.Controls.Add(this.radioButton1); - this.groupBox2.Location = new System.Drawing.Point(12, 250); - this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(222, 70); - this.groupBox2.TabIndex = 4; - this.groupBox2.TabStop = false; - this.groupBox2.Text = "Režim činnosti"; - // - // radioButton2 - // - this.radioButton2.AutoSize = true; - this.radioButton2.Location = new System.Drawing.Point(95, 41); - this.radioButton2.Name = "radioButton2"; - this.radioButton2.Size = new System.Drawing.Size(58, 17); - this.radioButton2.TabIndex = 1; - this.radioButton2.TabStop = true; - this.radioButton2.Text = "Výroba"; - this.radioButton2.UseVisualStyleBackColor = true; - // - // radioButton1 - // - this.radioButton1.AutoSize = true; - this.radioButton1.Location = new System.Drawing.Point(95, 20); - this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(46, 17); - this.radioButton1.TabIndex = 0; - this.radioButton1.TabStop = true; - this.radioButton1.Text = "Test"; - this.radioButton1.UseVisualStyleBackColor = true; - // - // groupBox3 - // - this.groupBox3.Controls.Add(this.workplaceNameTextBox); - this.groupBox3.Location = new System.Drawing.Point(12, 12); - this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(300, 50); - this.groupBox3.TabIndex = 0; - this.groupBox3.TabStop = false; - this.groupBox3.Text = "Meno pracoviska"; - // - // workplaceNameTextBox - // - this.workplaceNameTextBox.Location = new System.Drawing.Point(17, 18); - this.workplaceNameTextBox.Name = "workplaceNameTextBox"; - this.workplaceNameTextBox.Size = new System.Drawing.Size(265, 20); - this.workplaceNameTextBox.TabIndex = 0; - // - // saveButton - // - this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.saveButton.Location = new System.Drawing.Point(400, 270); - this.saveButton.Name = "saveButton"; - this.saveButton.Size = new System.Drawing.Size(104, 42); - this.saveButton.TabIndex = 6; - this.saveButton.Text = "Uložiť"; - this.saveButton.UseVisualStyleBackColor = true; - this.saveButton.Click += new System.EventHandler(this.saveButton_Click); - // - // cancelButton - // - this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.cancelButton.Location = new System.Drawing.Point(523, 270); - this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(104, 42); - this.cancelButton.TabIndex = 7; - this.cancelButton.Text = "Zrušiť"; - this.cancelButton.UseVisualStyleBackColor = true; - this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); - // - // groupBox4 - // - this.groupBox4.Controls.Add(this.extraBatteryLifetimeTextBox); - this.groupBox4.Location = new System.Drawing.Point(12, 182); - this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(222, 62); - this.groupBox4.TabIndex = 3; - this.groupBox4.TabStop = false; - this.groupBox4.Text = "Predĺženie životnosti baterky v mesiacoch"; - // - // extraBatteryLifetimeTextBox - // - this.extraBatteryLifetimeTextBox.Location = new System.Drawing.Point(17, 25); - this.extraBatteryLifetimeTextBox.Name = "extraBatteryLifetimeTextBox"; - this.extraBatteryLifetimeTextBox.Size = new System.Drawing.Size(191, 20); - this.extraBatteryLifetimeTextBox.TabIndex = 0; - // - // oracleGroupBox - // - this.oracleGroupBox.Controls.Add(this.checkPcbIsInOracleCheckBox); - this.oracleGroupBox.Controls.Add(this.oracleBatteryCheckBox); - this.oracleGroupBox.Location = new System.Drawing.Point(384, 182); - this.oracleGroupBox.Name = "oracleGroupBox"; - this.oracleGroupBox.Size = new System.Drawing.Size(249, 74); - this.oracleGroupBox.TabIndex = 5; - this.oracleGroupBox.TabStop = false; - this.oracleGroupBox.Text = "Oracle"; - this.oracleGroupBox.Visible = false; - // - // checkPcbIsInOracleCheckBox - // - this.checkPcbIsInOracleCheckBox.AutoSize = true; - this.checkPcbIsInOracleCheckBox.Location = new System.Drawing.Point(18, 45); - this.checkPcbIsInOracleCheckBox.Name = "checkPcbIsInOracleCheckBox"; - this.checkPcbIsInOracleCheckBox.Size = new System.Drawing.Size(213, 17); - this.checkPcbIsInOracleCheckBox.TabIndex = 0; - this.checkPcbIsInOracleCheckBox.Text = "Skontrolovať či PCB už bola overovaná"; - this.checkPcbIsInOracleCheckBox.UseVisualStyleBackColor = true; - // - // oracleBatteryCheckBox - // - this.oracleBatteryCheckBox.AutoSize = true; - this.oracleBatteryCheckBox.Location = new System.Drawing.Point(18, 19); - this.oracleBatteryCheckBox.Name = "oracleBatteryCheckBox"; - this.oracleBatteryCheckBox.Size = new System.Drawing.Size(193, 17); - this.oracleBatteryCheckBox.TabIndex = 0; - this.oracleBatteryCheckBox.Text = "Uložiť informácie o batérii do Oracle"; - this.oracleBatteryCheckBox.UseVisualStyleBackColor = true; - // - // groupBox5 - // - this.groupBox5.Controls.Add(this.usersDBConnStringTextBox); - this.groupBox5.Location = new System.Drawing.Point(12, 125); - this.groupBox5.Name = "groupBox5"; - this.groupBox5.Size = new System.Drawing.Size(622, 50); - this.groupBox5.TabIndex = 2; - this.groupBox5.TabStop = false; - this.groupBox5.Text = "Connection string pre centrálnu databázu používateľov"; - // - // usersDBConnStringTextBox - // - this.usersDBConnStringTextBox.Location = new System.Drawing.Point(17, 18); - this.usersDBConnStringTextBox.Name = "usersDBConnStringTextBox"; - this.usersDBConnStringTextBox.Size = new System.Drawing.Size(586, 20); - this.usersDBConnStringTextBox.TabIndex = 0; - // - // timeGroupBox - // - this.timeGroupBox.Controls.Add(this.label1); - this.timeGroupBox.Controls.Add(this.timePicker3); - this.timeGroupBox.Controls.Add(this.timePicker2); - this.timeGroupBox.Controls.Add(this.timePicker1); - this.timeGroupBox.Location = new System.Drawing.Point(240, 181); - this.timeGroupBox.Name = "timeGroupBox"; - this.timeGroupBox.Size = new System.Drawing.Size(138, 140); - this.timeGroupBox.TabIndex = 8; - this.timeGroupBox.TabStop = false; - this.timeGroupBox.Text = "Čas odlogovania"; - this.timeGroupBox.Visible = false; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(17, 27); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(106, 13); - this.label1.TabIndex = 3; - this.label1.Text = "00:00 = neodlogovať"; - // - // timePicker3 - // - this.timePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.timePicker3.Location = new System.Drawing.Point(19, 98); - this.timePicker3.Name = "timePicker3"; - this.timePicker3.Size = new System.Drawing.Size(98, 20); - this.timePicker3.TabIndex = 2; - // - // timePicker2 - // - this.timePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.timePicker2.Location = new System.Drawing.Point(19, 72); - this.timePicker2.Name = "timePicker2"; - this.timePicker2.Size = new System.Drawing.Size(98, 20); - this.timePicker2.TabIndex = 1; - // - // timePicker1 - // - this.timePicker1.AllowDrop = true; - this.timePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.timePicker1.Location = new System.Drawing.Point(19, 46); - this.timePicker1.Name = "timePicker1"; - this.timePicker1.Size = new System.Drawing.Size(98, 20); - this.timePicker1.TabIndex = 0; - // - // processFilterGroupBox - // - this.processFilterGroupBox.Controls.Add(this.processFilterComboBox); - this.processFilterGroupBox.Location = new System.Drawing.Point(334, 12); - this.processFilterGroupBox.Name = "processFilterGroupBox"; - this.processFilterGroupBox.Size = new System.Drawing.Size(300, 50); - this.processFilterGroupBox.TabIndex = 9; - this.processFilterGroupBox.TabStop = false; - this.processFilterGroupBox.Text = "Filter procesov"; - this.processFilterGroupBox.Visible = false; - // - // processFilterComboBox - // - this.processFilterComboBox.FormattingEnabled = true; - this.processFilterComboBox.Location = new System.Drawing.Point(20, 17); - this.processFilterComboBox.Name = "processFilterComboBox"; - this.processFilterComboBox.Size = new System.Drawing.Size(261, 21); - this.processFilterComboBox.TabIndex = 0; - // - // SettingsDlg - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(648, 333); - this.Controls.Add(this.processFilterGroupBox); - this.Controls.Add(this.timeGroupBox); - this.Controls.Add(this.groupBox5); - this.Controls.Add(this.oracleGroupBox); - this.Controls.Add(this.groupBox4); - this.Controls.Add(this.cancelButton); - this.Controls.Add(this.saveButton); - this.Controls.Add(this.groupBox3); - this.Controls.Add(this.groupBox2); - this.Controls.Add(this.groupBox1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.Name = "SettingsDlg"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.Text = "SettingsDlg"; - this.groupBox1.ResumeLayout(false); - this.groupBox1.PerformLayout(); - this.groupBox2.ResumeLayout(false); - this.groupBox2.PerformLayout(); - this.groupBox3.ResumeLayout(false); - this.groupBox3.PerformLayout(); - this.groupBox4.ResumeLayout(false); - this.groupBox4.PerformLayout(); - this.oracleGroupBox.ResumeLayout(false); - this.oracleGroupBox.PerformLayout(); - this.groupBox5.ResumeLayout(false); - this.groupBox5.PerformLayout(); - this.timeGroupBox.ResumeLayout(false); - this.timeGroupBox.PerformLayout(); - this.processFilterGroupBox.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.TextBox connectionStringTextBox; - private System.Windows.Forms.GroupBox groupBox2; - private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.TextBox workplaceNameTextBox; - private System.Windows.Forms.Button saveButton; - private System.Windows.Forms.Button cancelButton; - private System.Windows.Forms.RadioButton radioButton2; - private System.Windows.Forms.RadioButton radioButton1; - private System.Windows.Forms.GroupBox groupBox4; - private System.Windows.Forms.TextBox extraBatteryLifetimeTextBox; - private System.Windows.Forms.GroupBox oracleGroupBox; - private System.Windows.Forms.CheckBox oracleBatteryCheckBox; - private System.Windows.Forms.CheckBox checkPcbIsInOracleCheckBox; - private System.Windows.Forms.GroupBox groupBox5; - private System.Windows.Forms.TextBox usersDBConnStringTextBox; - private System.Windows.Forms.GroupBox timeGroupBox; - private System.Windows.Forms.DateTimePicker timePicker3; - private System.Windows.Forms.DateTimePicker timePicker2; - private System.Windows.Forms.DateTimePicker timePicker1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.GroupBox processFilterGroupBox; - private System.Windows.Forms.ComboBox processFilterComboBox; - } -} \ No newline at end of file diff --git a/TracingDB/Forms/SettingsDlg.cs b/TracingDB/Forms/SettingsDlg.cs deleted file mode 100644 index f581b8706..000000000 --- a/TracingDB/Forms/SettingsDlg.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Windows.Forms; - -namespace TracingDB.Forms -{ - public partial class SettingsDlg : Form - { - static readonly DateTime MinTime = new DateTime(1753, 1, 1, 0, 0, 0); - - - - public string WorkplaceName - { - set { workplaceNameTextBox.Text = value; } - get { return workplaceNameTextBox.Text; } - } - - public int ProcessFilter - { - set - { - if ((value & (int)SubClass.Normal) != 0 && - (value & (int)SubClass.FlowTube) != 0 && - (value & (int)SubClass.InheritsFlowTube) != 0) - { - processFilterComboBox.Text = "všetky"; - } - else if ((value & (int)SubClass.FlowTube) != 0) - { - processFilterComboBox.Text = "flowtuby"; - } - else if ((value & (int)SubClass.InheritsFlowTube) != 0) - { - processFilterComboBox.Text = "vodomery odvodene z flowtuby"; - } - else /// if ((value & (int)SubClass.Normal) != 0) - { - processFilterComboBox.Text = "vodomery"; - } - } - - get - { - if (processFilterComboBox.Text == "všetky") - { - return (int)SubClass.Normal + - (int)SubClass.NormalWithoutPCB + - (int)SubClass.FlowTube + - (int)SubClass.InheritsFlowTube + - (int)SubClass.InheritsFlowTubeWithoutPCB; - } - else if (processFilterComboBox.Text == "flowtuby") - { - return (int)SubClass.FlowTube; - } - else if (processFilterComboBox.Text == "vodomery odvodene z flowtuby") - { - return (int)SubClass.InheritsFlowTube; - } - else /// if (processFilterComboBox.Text == "vodomery") - { - return (int)SubClass.Normal; - } - } - } - - public string ConnectionString - { - set { connectionStringTextBox.Text = value; } - get { return connectionStringTextBox.Text; } - } - - public string UsersDBConnString - { - set { usersDBConnStringTextBox.Text = value; } - get { return usersDBConnStringTextBox.Text; } - } - - public bool OracleBattery - { - set { oracleBatteryCheckBox.Checked = value; } - get { return oracleBatteryCheckBox.Checked; } - } - - public bool CheckPcbIsInOracle - { - set { checkPcbIsInOracleCheckBox.Checked = value; } - get { return checkPcbIsInOracleCheckBox.Checked; } - } - - public int ExtraBatterLifetime - { - get - { - int extraLifetime; - if (int.TryParse(extraBatteryLifetimeTextBox.Text, out extraLifetime) && extraLifetime >= 0) return extraLifetime; - return 0; - } - } - - public TracingDB.Mode Mode - { - set - { - radioButton1.Checked = (value == TracingDB.Mode.Test); - radioButton2.Checked = (value == TracingDB.Mode.Production); - } - get - { - return radioButton1.Checked ? TracingDB.Mode.Test : TracingDB.Mode.Production; - } - } - - public DateTime LogoutTime1 - { - get { return timePicker1.Value; } - set { timePicker1.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; } - } - - public DateTime LogoutTime2 - { - get { return timePicker2.Value; } - set { timePicker2.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; } - } - - public DateTime LogoutTime3 - { - get { return timePicker3.Value; } - set { timePicker3.Value = (value.CompareTo(MinTime) < 0) ? MinTime : value; } - } - - - /// - /// Basic configuration dialog - /// - /// false = Konfiguracia pracovisk, true = Pracovisko - public SettingsDlg(bool isWorkplace) - { - InitializeComponent(); - - if (isWorkplace) - { - oracleGroupBox.Visible = true; - timeGroupBox.Visible = true; - processFilterGroupBox.Visible = true; - - processFilterComboBox.Items.Add("všetky"); - processFilterComboBox.Items.Add("vodomery"); - processFilterComboBox.Items.Add("vodomery odvodene z flowtuby"); - processFilterComboBox.Items.Add("flowtuby"); - } - - extraBatteryLifetimeTextBox.Text = "0"; - - timePicker1.Format = DateTimePickerFormat.Custom; - timePicker1.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern; - - timePicker2.Format = DateTimePickerFormat.Custom; - timePicker2.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern; - - timePicker3.Format = DateTimePickerFormat.Custom; - timePicker3.CustomFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern; - } - - private void saveButton_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.OK; - Close(); - } - - private void cancelButton_Click(object sender, EventArgs e) - { - DialogResult = DialogResult.Cancel; - Close(); - } - } -} diff --git a/TracingDB/Interfaces/IOption.cs b/TracingDB/Interfaces/IOption.cs deleted file mode 100644 index e3114ded4..000000000 --- a/TracingDB/Interfaces/IOption.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace TracingDB.Interfaces -{ - public interface IOption - { - int Id { get; } - int ItemNr { get; set; } - string Name { get; set; } - string OraDBType { get; set; } - string Description { get; set; } - CodeType CodeType { get; set; } - CodeForm CodeForm { get; set; } - CodeLocation CodeLocation { get; set; } - LifetimeManagement LifetimeManagement { get; set; } - bool Enabled { get; set; } - Entities.Part GetPart(Entities.Process owningProcess); - } -} diff --git a/TracingDB/ItemSpec.cs b/TracingDB/ItemSpec.cs index 2677765f4..231dd0ba8 100644 --- a/TracingDB/ItemSpec.cs +++ b/TracingDB/ItemSpec.cs @@ -50,6 +50,11 @@ namespace TracingDB Width = 0; } + public override string ToString() + { + return string.Format("uid={0}, name={1}, caption={2}", Uid, Name, Caption); + } + /// Copy constructor public ItemSpec Clone() { @@ -94,26 +99,30 @@ namespace TracingDB { AllItems = new List(); - AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Ref_part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.RefPartName, Strings.Ref_part_name, (x, f, p, w) => FormatStr(f, ((Workstep)x).ReferencePart.Name), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.PartName, Strings.Part_name, (x, f, p, w) => FormatStr(f, ((Part)x).Name), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep + "2", (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace + "2",(x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name + "2",(x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep + "2", (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord)); + AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord)); - AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); - AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); - AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); - AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Max_pruefindex, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Tests_count, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.MaxTestindexEx,Strings.Tests_count_and_rslt,(x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); + AllItems.Add(new ItemSpec(ItemSpecID.TestBenchId, Strings.Test_bench_Id, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery)); AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => FormatStr(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord)); } @@ -155,7 +164,9 @@ namespace TracingDB case ItemSpecID.Workplace: return Projections.Property(() => refRecord.Workplace); case ItemSpecID.UserName: return Projections.Property(() => refRecord.UserName); case ItemSpecID.Barcode: return Projections.Property(() => refRecord.Code); + case ItemSpecID.RefPartName: return Projections.Property(() => refRecord.Workstep); case ItemSpecID.PartBarcode: return Projections.Property(() => record.Code); + case ItemSpecID.PartName: return Projections.Property(() => record.Part); case ItemSpecID.TimeStamp2: return null; case ItemSpecID.Workstep2: return null; @@ -168,6 +179,8 @@ namespace TracingDB case ItemSpecID.PurchaseOrder: return null; case ItemSpecID.TestResult: return null; case ItemSpecID.MaxPruefindex: return null; + case ItemSpecID.MaxTestindexEx: return null; + case ItemSpecID.TestBenchId: return null; case ItemSpecID.Process: return Projections.Property(() => refRecord.Process); @@ -199,6 +212,8 @@ namespace TracingDB case ItemSpecID.PurchaseOrder: return null; case ItemSpecID.TestResult: return null; case ItemSpecID.MaxPruefindex: return null; + case ItemSpecID.MaxTestindexEx: return null; + case ItemSpecID.TestBenchId: return null; case ItemSpecID.Process: return Projections.Property(() => refRecord2.Process); diff --git a/TracingDB/Mappings/Option1Map.cs b/TracingDB/Mappings/Option1Map.cs deleted file mode 100644 index b631e22e2..000000000 --- a/TracingDB/Mappings/Option1Map.cs +++ /dev/null @@ -1,21 +0,0 @@ -using FluentNHibernate.Mapping; - -namespace TracingDB.Mappings -{ - class Option1Map : ClassMap - { - public Option1Map() - { - Id(x => x.Id); - Map(x => x.ItemNr); - Map(x => x.Name); - Map(x => x.OraDBType); - Map(x => x.Description); - Map(x => x.CodeType); - Map(x => x.CodeForm); - Map(x => x.CodeLocation); - Map(x => x.LifetimeManagement); - Map(x => x.Enabled); - } - } -} diff --git a/TracingDB/Mappings/Option2Map.cs b/TracingDB/Mappings/Option2Map.cs deleted file mode 100644 index 05658b979..000000000 --- a/TracingDB/Mappings/Option2Map.cs +++ /dev/null @@ -1,21 +0,0 @@ -using FluentNHibernate.Mapping; - -namespace TracingDB.Mappings -{ - class Option2Map : ClassMap - { - public Option2Map() - { - Id(x => x.Id); - Map(x => x.ItemNr); - Map(x => x.Name); - Map(x => x.OraDBType); - Map(x => x.Description); - Map(x => x.CodeType); - Map(x => x.CodeForm); - Map(x => x.CodeLocation); - Map(x => x.LifetimeManagement); - Map(x => x.Enabled); - } - } -} diff --git a/TracingDB/Mappings/ProcessMap.cs b/TracingDB/Mappings/ProcessMap.cs index 472aae972..66c74871b 100644 --- a/TracingDB/Mappings/ProcessMap.cs +++ b/TracingDB/Mappings/ProcessMap.cs @@ -23,7 +23,7 @@ namespace TracingDB.Mappings Map(x => x.ReleaseStatus); HasMany(x => x.Parts) - .OrderBy("Name") + .OrderBy("StepNumber") .Cascade.All(); HasMany(x => x.Worksteps) diff --git a/TracingDB/Properties/AssemblyInfo.cs b/TracingDB/Properties/AssemblyInfo.cs index d428d293b..60422579d 100644 --- a/TracingDB/Properties/AssemblyInfo.cs +++ b/TracingDB/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.0.65.0")] -[assembly: AssemblyFileVersion("2.0.65.0")] +[assembly: AssemblyVersion("2.0.81.0")] +[assembly: AssemblyFileVersion("2.0.81.0")] diff --git a/TracingDB/Resources/Strings.Designer.cs b/TracingDB/Resources/Strings.Designer.cs index b874b41d5..622fd1662 100644 --- a/TracingDB/Resources/Strings.Designer.cs +++ b/TracingDB/Resources/Strings.Designer.cs @@ -160,7 +160,7 @@ namespace TracingDB.Resources { } /// - /// Looks up a localized string similar to Another part barcode. + /// Looks up a localized string similar to Another part barcode (s/n). /// internal static string Part_barcode { get { @@ -168,6 +168,15 @@ namespace TracingDB.Resources { } } + /// + /// Looks up a localized string similar to Another part name (SAP nr.). + /// + internal static string Part_name { + get { + return ResourceManager.GetString("Part_name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Precision. /// @@ -195,6 +204,24 @@ namespace TracingDB.Resources { } } + /// + /// Looks up a localized string similar to Ref. part barcode (s/n). + /// + internal static string Ref_part_barcode { + get { + return ResourceManager.GetString("Ref_part_barcode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ref. part name (SAP nr.). + /// + internal static string Ref_part_name { + get { + return ResourceManager.GetString("Ref_part_name", resourceCulture); + } + } + /// /// Looks up a localized string similar to Record ID. /// @@ -258,6 +285,15 @@ namespace TracingDB.Resources { } } + /// + /// Looks up a localized string similar to Test bench Id. + /// + internal static string Test_bench_Id { + get { + return ResourceManager.GetString("Test_bench_Id", resourceCulture); + } + } + /// /// Looks up a localized string similar to Test result. /// @@ -267,6 +303,24 @@ namespace TracingDB.Resources { } } + /// + /// Looks up a localized string similar to Tests count. + /// + internal static string Tests_count { + get { + return ResourceManager.GetString("Tests_count", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Tests count (negative when NOK). + /// + internal static string Tests_count_and_rslt { + get { + return ResourceManager.GetString("Tests_count_and_rslt", resourceCulture); + } + } + /// /// Looks up a localized string similar to Text. /// @@ -285,6 +339,15 @@ namespace TracingDB.Resources { } } + /// + /// Looks up a localized string similar to unsaved. + /// + internal static string unsaved { + get { + return ResourceManager.GetString("unsaved", resourceCulture); + } + } + /// /// Looks up a localized string similar to Up. /// diff --git a/TracingDB/Resources/Strings.resx b/TracingDB/Resources/Strings.resx index 48968a012..527b355ad 100644 --- a/TracingDB/Resources/Strings.resx +++ b/TracingDB/Resources/Strings.resx @@ -151,7 +151,7 @@ OK - Another part barcode + Another part barcode (s/n) Precision @@ -192,6 +192,9 @@ Time stamp + + unsaved + Up @@ -207,4 +210,22 @@ Workstep + + Ref. part barcode (s/n) + + + Ref. part name (SAP nr.) + + + Another part name (SAP nr.) + + + Tests count + + + Tests count (negative when NOK) + + + Test bench Id + \ No newline at end of file diff --git a/TracingDB/Forms/SettingsDlg.resx b/TracingDB/Resources/Strings.sk.resx similarity index 87% rename from TracingDB/Forms/SettingsDlg.resx rename to TracingDB/Resources/Strings.sk.resx index 1af7de150..10b789719 100644 --- a/TracingDB/Forms/SettingsDlg.resx +++ b/TracingDB/Resources/Strings.sk.resx @@ -117,4 +117,28 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Kód inej súčiastky (s/n) + + + Meno inej súčiastky (SAP č.) + + + Kód ref. súčiastky (s/n) + + + Meno ref. súčiastky (SAP č.) + + + Počet testovaní + + + Počet testovaní (záporný ak je NOK) + + + ID overovacej stanice + + + neuložený + \ No newline at end of file diff --git a/TracingDB/TracingDB.csproj b/TracingDB/TracingDB.csproj index eaee38869..956000bf2 100644 --- a/TracingDB/TracingDB.csproj +++ b/TracingDB/TracingDB.csproj @@ -61,13 +61,14 @@ - - - + Component + + + Form @@ -80,16 +81,7 @@ ResultsConfigDlg.cs - - Form - - - SettingsDlg.cs - - - - @@ -118,6 +110,7 @@ True Resources.resx + @@ -129,9 +122,6 @@ ResultsConfigDlg.cs - - SettingsDlg.cs - ResXFileCodeGenerator Resources.Designer.cs @@ -140,11 +130,18 @@ ResXFileCodeGenerator Strings.Designer.cs + + + + {67BD7A8F-0FED-4FDE-B875-78D5A2BC9B2C} + RecordProcessing + +