From 3cbc845183d591d1f5fb16d071fc7048816e311d Mon Sep 17 00:00:00 2001 From: Milan Hanajik Date: Wed, 6 May 2020 09:45:23 +0200 Subject: [PATCH] Support for certificates, calib. expiration dates and calendar in many components and in TBF.UI.Bench.Metrology --- .../BenchInfo/iPerl/Component.cs | 37 +- .../BenchInfo/iPerl/ComponentCfg.cs | 25 +- .../DataContainers/Buoyancy/Component.cs | 39 +- .../DataContainers/Buoyancy/ComponentCfg.cs | 25 +- .../DataContainers/Density/Component.cs | 39 +- .../DataContainers/Density/ComponentCfg.cs | 25 +- .../DataContainers/Evaporation/Component.cs | 75 ++ .../Evaporation/EvaporationCfg.cs | 58 ++ .../Evaporation/EvaporationCfgCtrl.cs | 69 ++ .../EvaporationCfgCtrl.designer.cs | 86 ++ .../Evaporation/EvaporationCfgCtrl.resx | 120 +++ .../Evaporation/Factory.cs | 9 +- TBF/BenchControl/Elde/Diverter/Diverter.cs | 38 +- TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs | 2 +- .../Elde/PressureMeter/PressureMeter.cs | 37 +- .../Elde/PressureMeter/PressureMeterCfg.cs | 24 +- .../PressureMeterInternal/PressureMeter.cs | 36 +- .../PressureMeterInternal/PressureMeterCfg.cs | 22 +- TBF/BenchControl/Elde/TempMeter/TempMeter.cs | 37 +- .../Elde/TempMeter/TempMeterCfg.cs | 24 +- .../Elde/TempMeterInternal/TempMeter.cs | 36 +- .../Elde/TempMeterInternal/TempMeterCfg.cs | 23 +- .../Elde/TempMeterMeret/TempMeter.cs | 36 +- .../Elde/TempMeterMeret/TempMeterCfg.cs | 23 +- TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs | 37 +- .../Keithley/TempMeter/TempMeter.cs | 39 +- .../MettlerToledo/Standard/BalanceCfgCtrl.cs | 2 +- .../MettlerToledo/Standard/BalanceDev.cs | 2 +- TBF/BenchControl/TbfComponents.cs | 2 +- .../Various/Evaporation/Component.cs | 38 - TBF/Resources/Strings.cs.resx | 3 + TBF/TBF.csproj | 14 +- TBF/UI/Bench/Metrology/MetrologyDlg.cs | 6 +- .../MetrologyDlgBalanceTab.Designer.cs | 44 +- .../Bench/Metrology/MetrologyDlgBalanceTab.cs | 20 +- .../MetrologyDlgDensityTab.Designer.cs | 98 ++- .../Bench/Metrology/MetrologyDlgDensityTab.cs | 36 +- .../MetrologyDlgDiverterTab.Designer.cs | 52 +- .../Metrology/MetrologyDlgDiverterTab.cs | 17 +- .../MetrologyDlgEvaporationTab.Designer.cs | 52 +- .../Metrology/MetrologyDlgEvaporationTab.cs | 17 +- .../MetrologyDlgFlowMeterTab.Designer.cs | 48 +- .../Metrology/MetrologyDlgFlowMeterTab.cs | 17 +- .../MetrologyDlgLevelMeterTab.Designer.cs | 48 +- .../Metrology/MetrologyDlgLevelMeterTab.cs | 17 +- ...DlgPlatinumResistanceTMeterTab.Designer.cs | 792 +++++++++--------- ...MetrologyDlgPlatinumResistanceTMeterTab.cs | 20 +- .../MetrologyDlgPressMeterTab.Designer.cs | 352 +++++--- .../Metrology/MetrologyDlgPressMeterTab.cs | 72 +- .../MetrologyDlgTempMeterTab.Designer.cs | 352 +++++--- .../Metrology/MetrologyDlgTempMeterTab.cs | 74 +- TBF/UI/Constants.cs | 4 +- TBF/UI/Help/AboutDlg.cs | 2 +- TBF/UI/ResultsMI/PreviousResultCtrl.cs | 4 +- 54 files changed, 2295 insertions(+), 931 deletions(-) create mode 100644 TBF/BenchControl/DataContainers/Evaporation/Component.cs create mode 100644 TBF/BenchControl/DataContainers/Evaporation/EvaporationCfg.cs create mode 100644 TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.cs create mode 100644 TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.designer.cs create mode 100644 TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.resx rename TBF/BenchControl/{Various => DataContainers}/Evaporation/Factory.cs (62%) delete mode 100644 TBF/BenchControl/Various/Evaporation/Component.cs diff --git a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs index 730c72b13..568b99e2b 100644 --- a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs +++ b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/Component.cs @@ -8,13 +8,14 @@ using log4net; using Config.Entities; using TBF.BenchControl; using TBF.BenchControl.Generic; +using TBF.Resources; namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl { /// /// Holds information identifying the test bench. /// - public class Component : ComponentBase, GenericDevices.IBenchInfo + public class Component : ComponentBase, GenericDevices.IBenchInfo, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(Component)); public override string ToString() { return string.Format("BenchInfo.iPerl({0})", Cfg.ToString(1)); } @@ -43,5 +44,37 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl Events.DB.SetBenchName(myCfg.TestBenchName); log.Debug(this.ToString()); } - } + + + public IList GetCalendarEvents() + { + DateTime calibrationDue = myCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + } } diff --git a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/ComponentCfg.cs b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/ComponentCfg.cs index 70a583841..b6d9e56b0 100644 --- a/TBF/BenchControl/DataContainers/BenchInfo/iPerl/ComponentCfg.cs +++ b/TBF/BenchControl/DataContainers/BenchInfo/iPerl/ComponentCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2018 Sensus Slovensko a.s. +/// Copyright (c) 2018-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -13,7 +13,7 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl /// /// Holds information identifying the test bench - serializable configuration. /// - public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider + public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -37,6 +37,27 @@ namespace TBF.BenchControl.DataContainers.BenchInfo.iPerl public Side Side; public int MaxTestIndex; /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + /// Private parameterless constructor invoked by all other (public) constructors ComponentCfg() {} diff --git a/TBF/BenchControl/DataContainers/Buoyancy/Component.cs b/TBF/BenchControl/DataContainers/Buoyancy/Component.cs index c44d2de6e..88919670b 100644 --- a/TBF/BenchControl/DataContainers/Buoyancy/Component.cs +++ b/TBF/BenchControl/DataContainers/Buoyancy/Component.cs @@ -1,15 +1,17 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2020 Sensus Slovensko a.s. /// using System; +using System.Collections.Generic; using log4net; +using TBF.Resources; namespace TBF.BenchControl.DataContainers.Buoyancy { /// /// Holds measured (true) buoyancy value. /// - public class Component : ComponentBase + public class Component : ComponentBase, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(Component)); public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); } @@ -35,5 +37,36 @@ namespace TBF.BenchControl.DataContainers.Buoyancy log.Debug(this.ToString()); } - } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = myCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + } } diff --git a/TBF/BenchControl/DataContainers/Buoyancy/ComponentCfg.cs b/TBF/BenchControl/DataContainers/Buoyancy/ComponentCfg.cs index 7e5cbd28b..e3d83c5bd 100644 --- a/TBF/BenchControl/DataContainers/Buoyancy/ComponentCfg.cs +++ b/TBF/BenchControl/DataContainers/Buoyancy/ComponentCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ namespace TBF.BenchControl.DataContainers.Buoyancy /// /// Holds backup and security options - serializable configuration. /// - public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider + public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -24,6 +24,27 @@ namespace TBF.BenchControl.DataContainers.Buoyancy /// public double Buoyancy; + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + /// Private parameterless constructor invoked by all other (public) constructors ComponentCfg() {} diff --git a/TBF/BenchControl/DataContainers/Density/Component.cs b/TBF/BenchControl/DataContainers/Density/Component.cs index ab49cda6d..dc313f612 100644 --- a/TBF/BenchControl/DataContainers/Density/Component.cs +++ b/TBF/BenchControl/DataContainers/Density/Component.cs @@ -1,15 +1,17 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2020 Sensus Slovensko a.s. /// using System; +using System.Collections.Generic; using log4net; +using TBF.Resources; namespace TBF.BenchControl.DataContainers.Density { /// /// Holds measured (true) density value. /// - public class Component : ComponentBase + public class Component : ComponentBase, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(Component)); public override string ToString() { return string.Format("{0}({1})", this.GetType().Namespace.Substring(32), Cfg.ToString(1)); } @@ -38,5 +40,36 @@ namespace TBF.BenchControl.DataContainers.Density log.Debug(this.ToString()); } - } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = myCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + } } diff --git a/TBF/BenchControl/DataContainers/Density/ComponentCfg.cs b/TBF/BenchControl/DataContainers/Density/ComponentCfg.cs index c34b68ea5..231aef355 100644 --- a/TBF/BenchControl/DataContainers/Density/ComponentCfg.cs +++ b/TBF/BenchControl/DataContainers/Density/ComponentCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ namespace TBF.BenchControl.DataContainers.Density /// /// Holds backup and security options - serializable configuration. /// - public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider + public class ComponentCfg : ComponentCfgBase, Generic.IComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ComponentCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -25,6 +25,27 @@ namespace TBF.BenchControl.DataContainers.Density public double RealDensity; public double AtTemperature; + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + /// Private parameterless constructor invoked by all other (public) constructors ComponentCfg() {} diff --git a/TBF/BenchControl/DataContainers/Evaporation/Component.cs b/TBF/BenchControl/DataContainers/Evaporation/Component.cs new file mode 100644 index 000000000..5ca7ab2f0 --- /dev/null +++ b/TBF/BenchControl/DataContainers/Evaporation/Component.cs @@ -0,0 +1,75 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using log4net; +using Config.Entities; +using TBF.BenchControl.GenericDevices; +using TBF.Resources; + +namespace TBF.BenchControl.DataContainers.Evaporation +{ + public class Component : ComponentBase, IEvaporation, GenericDevices.IHasCalendarEvents + { + private static readonly ILog log = LogManager.GetLogger(typeof(Component)); + public override string ToString() + { + return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1)); + } + + readonly EvaporationCfg myCfg; + + + /// + /// For a given temperature in [°C] returns an evaporation rate in [kg/s] + /// + public double EvaporationRate(double temperature) + { + return Config.Formulas.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s + } + + + public Component() + { + } + + public Component(Generic.IComponentCfg cfg) + : base(cfg) + { + myCfg = cfg as EvaporationCfg; + log.Debug(this.ToString()); + } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = myCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + } +} diff --git a/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfg.cs b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfg.cs new file mode 100644 index 000000000..7d627b3fe --- /dev/null +++ b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfg.cs @@ -0,0 +1,58 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System; +using System.Collections.Generic; +using System.Xml.Serialization; +using Config.Entities; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataContainers.Evaporation +{ + /// + /// Holds backup and security options - serializable configuration. + /// + public class EvaporationCfg : ComponentCfgBase, Generic.IComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg + { + public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EvaporationCfg) })[0]; + public override XmlSerializer GetSerializer() { return Serializer; } + + public IComponentCfgCtrl GetControl() { return new EvaporationCfgCtrl(); } + + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + + /// Private parameterless constructor invoked by all other (public) constructors + EvaporationCfg() {} + + public EvaporationCfg(string name, IComponentFactory factory) + : this() + { + Name = name; + Factory = factory; + ParentName = string.Empty; + } + public string ToString(int i) + { + return Name; + } + } +} diff --git a/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.cs b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.cs new file mode 100644 index 000000000..cc0590472 --- /dev/null +++ b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.cs @@ -0,0 +1,69 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +using System; +using System.Windows.Forms; +using Config.Entities; +using TBF.BenchControl.Generic; + +namespace TBF.BenchControl.DataContainers.Evaporation +{ + public partial class EvaporationCfgCtrl : UserControl, IComponentCfgCtrl + { + public bool ShowMore { get { return false; } } + + EvaporationCfg config; + public IComponentCfg Config + { + get { return config as IComponentCfg; } + set + { + config = value as EvaporationCfg; + Redraw(); + } + } + + public EvaporationCfgCtrl() + { + InitializeComponent(); + } + + private void EntryFormCfgCtrl_Load(object sender, EventArgs e) + { + Redraw(); + } + + public void Closing() + { + } + + void Redraw() + { + if (config == null) return; /// Control was not loaded, settings were not changed + classNameLabel.Text = config.Factory.ClassName; + nameTextBox.Text = config.Name; + } + + public void Unlock() + { + nameTextBox.Enabled = true; + } + + public CfgUpdateFlags VerifyCfg(ref string message) + { + CfgUpdateFlags flags = CfgUpdateFlags.None; + return flags; + } + + public CfgUpdateFlags UpdateCfg() + { + CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; + + if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed + + config.Name = nameTextBox.Text; + + return flags; + } + } +} diff --git a/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.designer.cs b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.designer.cs new file mode 100644 index 000000000..1851a482b --- /dev/null +++ b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.designer.cs @@ -0,0 +1,86 @@ +/// +/// Copyright (c) 2020 Sensus Slovensko a.s. +/// +namespace TBF.BenchControl.DataContainers.Evaporation +{ + partial class EvaporationCfgCtrl + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.nameTextBox = new System.Windows.Forms.TextBox(); + this.nameLabel = new System.Windows.Forms.Label(); + this.classNameLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // nameTextBox + // + this.nameTextBox.Enabled = false; + this.nameTextBox.Location = new System.Drawing.Point(137, 57); + this.nameTextBox.Name = "nameTextBox"; + this.nameTextBox.Size = new System.Drawing.Size(130, 20); + this.nameTextBox.TabIndex = 5; + // + // nameLabel + // + this.nameLabel.AutoSize = true; + this.nameLabel.Location = new System.Drawing.Point(27, 60); + this.nameLabel.Name = "nameLabel"; + this.nameLabel.Size = new System.Drawing.Size(35, 13); + this.nameLabel.TabIndex = 4; + this.nameLabel.Text = "Name"; + // + // classNameLabel + // + this.classNameLabel.AutoSize = true; + this.classNameLabel.Location = new System.Drawing.Point(134, 33); + this.classNameLabel.Name = "classNameLabel"; + this.classNameLabel.Size = new System.Drawing.Size(83, 13); + this.classNameLabel.TabIndex = 3; + this.classNameLabel.Text = "ComonentName"; + // + // BasicPrinterCfgCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.nameTextBox); + this.Controls.Add(this.nameLabel); + this.Controls.Add(this.classNameLabel); + this.Name = "BasicPrinterCfgCtrl"; + this.Size = new System.Drawing.Size(300, 200); + this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox nameTextBox; + private System.Windows.Forms.Label nameLabel; + private System.Windows.Forms.Label classNameLabel; + } +} diff --git a/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.resx b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/BenchControl/DataContainers/Evaporation/EvaporationCfgCtrl.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TBF/BenchControl/Various/Evaporation/Factory.cs b/TBF/BenchControl/DataContainers/Evaporation/Factory.cs similarity index 62% rename from TBF/BenchControl/Various/Evaporation/Factory.cs rename to TBF/BenchControl/DataContainers/Evaporation/Factory.cs index ca7a609ef..d8e5ffafe 100644 --- a/TBF/BenchControl/Various/Evaporation/Factory.cs +++ b/TBF/BenchControl/DataContainers/Evaporation/Factory.cs @@ -1,11 +1,10 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2020 Sensus Slovensko a.s. /// using System.Collections.Generic; using TBF.BenchControl.Generic; -using TBF.BenchControl.Configs.NameOnly; -namespace TBF.BenchControl.Various.Evaporation +namespace TBF.BenchControl.DataContainers.Evaporation { public class Factory : IComponentFactory { @@ -17,11 +16,11 @@ namespace TBF.BenchControl.Various.Evaporation public IComponent GetComponent(IComponentCfg cfg, IList components) { return new Component(cfg); } - public IComponentCfg DefaultConfig() { return new TestMethodCfg(this.GetType().Namespace.Substring(25), this); } + public IComponentCfg DefaultConfig() { return new EvaporationCfg(this.GetType().Namespace.Substring(32), this); } public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component) { - return ComponentCfgBase.CreateFromDbEntity(TestMethodCfg.Serializer, component, this); + return ComponentCfgBase.CreateFromDbEntity(EvaporationCfg.Serializer, component, this); } } } diff --git a/TBF/BenchControl/Elde/Diverter/Diverter.cs b/TBF/BenchControl/Elde/Diverter/Diverter.cs index cf8feb0b5..2fbc80510 100644 --- a/TBF/BenchControl/Elde/Diverter/Diverter.cs +++ b/TBF/BenchControl/Elde/Diverter/Diverter.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2018 Sensus Slovensko a.s. +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -11,7 +11,7 @@ using TBF.Resources; namespace TBF.BenchControl.Elde.Diverter { - public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition + public class Diverter : ComponentBase, IDevice, GenericDevices.IDiverter, GenericDevices.ISequenceCondition, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(Diverter)); public override string ToString() { return string.Format("Diverter({0})", Cfg.ToString(1)); } @@ -148,6 +148,40 @@ namespace TBF.BenchControl.Elde.Diverter log.Debug(this.ToString()); } + /// + /// Calendar support + /// + public IList GetCalendarEvents() + { + DateTime calibrationDue = diverterCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + /// /// IDevice interface implementation diff --git a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs index aef7a02c9..06baf94d6 100644 --- a/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs +++ b/TBF/BenchControl/Elde/FlowMeter/FlowMeter.cs @@ -87,7 +87,7 @@ namespace TBF.BenchControl.Elde.FlowMeter DateTime calibrationDue = flowMeterCfg.CalibValidDate; IList calendarEvents = new List(); - if (calibrationDue > DateTime.MinValue.AddDays(36)) + if (calibrationDue > TBF.UI.Constants.MinDate) { /// Calibration due date calendar event calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, diff --git a/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs b/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs index 7ad745978..d6bdf1bde 100644 --- a/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs +++ b/TBF/BenchControl/Elde/PressureMeter/PressureMeter.cs @@ -1,15 +1,16 @@ /// -/// Copyright (c) 2013-2015 Sensus Metering Systems +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using log4net; using TBF.BenchControl.Generic; using TBF.Boxes; +using TBF.Resources; namespace TBF.BenchControl.Elde.PressureMeter { - public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter + public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter)); public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); } @@ -52,6 +53,38 @@ namespace TBF.BenchControl.Elde.PressureMeter } + public IList GetCalendarEvents() + { + DateTime calibrationDue = pressureMeterCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + + /// /// Returns the water pressure /// diff --git a/TBF/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs b/TBF/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs index 912087e1b..dca3e4c95 100644 --- a/TBF/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs +++ b/TBF/BenchControl/Elde/PressureMeter/PressureMeterCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2018 Sensus Metering Systems +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -10,7 +10,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.PressureMeter { - public class PressureMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg + public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -24,6 +24,26 @@ namespace TBF.BenchControl.Elde.PressureMeter public MeretProtocol Protocol; /// Meret or Modbus public byte RS485Address; /// 0..255 + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + /// Private parameterless constructor invoked by all other (public) constructors PressureMeterCfg() { diff --git a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs index f4cb2972a..e4eb21a72 100644 --- a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs +++ b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeter.cs @@ -7,10 +7,11 @@ using System.Collections.Generic; using log4net; using TBF.BenchControl.Generic; using TBF.Boxes; +using TBF.Resources; namespace TBF.BenchControl.Elde.PressureMeterInternal { - public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter + public class PressureMeter : ComponentBase, GenericDevices.IPressureMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(PressureMeter)); public override string ToString() { return string.Format("PressureMeter({0})", Cfg.ToString(1)); } @@ -44,6 +45,39 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal log.Debug(this.ToString()); } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = pressureMeterCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + + /// /// Events: PressureDone, Error /// diff --git a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs index 4e0ecc044..1b57fd845 100644 --- a/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs +++ b/TBF/BenchControl/Elde/PressureMeterInternal/PressureMeterCfg.cs @@ -9,7 +9,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.PressureMeterInternal { - public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg + public class PressureMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(PressureMeterCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -27,6 +27,26 @@ namespace TBF.BenchControl.Elde.PressureMeterInternal public float A4; public float A5; + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + /// Private parameterless constructor invoked by all other (public) constructors PressureMeterCfg() { diff --git a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs index 70ad5775a..0c4e97db7 100644 --- a/TBF/BenchControl/Elde/TempMeter/TempMeter.cs +++ b/TBF/BenchControl/Elde/TempMeter/TempMeter.cs @@ -1,15 +1,16 @@ /// -/// Copyright (c) 2013-2016 Sensus Metering Systems +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using log4net; using TBF.BenchControl.Generic; using TBF.Boxes; +using TBF.Resources; namespace TBF.BenchControl.Elde.TempMeter { - public class TempMeter : ComponentBase, GenericDevices.ITempMeter + public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); } @@ -47,6 +48,38 @@ namespace TBF.BenchControl.Elde.TempMeter log.Debug(this.ToString()); } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = tempMtrCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + public double ReadTemperature() { if (Cfg.DebugLevel == Config.Entities.DebugMode.Normal) diff --git a/TBF/BenchControl/Elde/TempMeter/TempMeterCfg.cs b/TBF/BenchControl/Elde/TempMeter/TempMeterCfg.cs index fbb71ca55..010b09696 100644 --- a/TBF/BenchControl/Elde/TempMeter/TempMeterCfg.cs +++ b/TBF/BenchControl/Elde/TempMeter/TempMeterCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -9,7 +9,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.TempMeter { - public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg + public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -27,6 +27,26 @@ namespace TBF.BenchControl.Elde.TempMeter public double A5; public double DefaultTemperature; + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + /// Private parameterless constructor invoked by all other (public) constructors TempMeterCfg() { diff --git a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs index e16224e22..8c03e0826 100644 --- a/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs +++ b/TBF/BenchControl/Elde/TempMeterInternal/TempMeter.cs @@ -6,10 +6,11 @@ using System.Collections.Generic; using log4net; using TBF.BenchControl.Generic; using TBF.Boxes; +using TBF.Resources; namespace TBF.BenchControl.Elde.TempMeterInternal { - public class TempMeter : ComponentBase, GenericDevices.ITempMeter + public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); } @@ -42,6 +43,39 @@ namespace TBF.BenchControl.Elde.TempMeterInternal log.Debug(this.ToString()); } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = tempMtrCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + + public double ReadTemperature() { return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(Idx0), Corrections); diff --git a/TBF/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs b/TBF/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs index dd75219ea..353f776f8 100644 --- a/TBF/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs +++ b/TBF/BenchControl/Elde/TempMeterInternal/TempMeterCfg.cs @@ -10,7 +10,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.TempMeterInternal { - public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg + public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -28,6 +28,27 @@ namespace TBF.BenchControl.Elde.TempMeterInternal public float A4; public float A5; + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + /// Private parameterless constructor invoked by all other (public) constructors TempMeterCfg() { diff --git a/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs b/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs index 7b19c0f42..96399347b 100644 --- a/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs +++ b/TBF/BenchControl/Elde/TempMeterMeret/TempMeter.cs @@ -5,10 +5,11 @@ using System; using System.Collections.Generic; using log4net; using TBF.Boxes; +using TBF.Resources; namespace TBF.BenchControl.Elde.TempMeterMeret { - public class TempMeter : ComponentBase, GenericDevices.ITempMeter + public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); } @@ -33,6 +34,39 @@ namespace TBF.BenchControl.Elde.TempMeterMeret log.Debug(this.ToString()); } + + public IList GetCalendarEvents() + { + DateTime calibrationDue = tempMtrCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + + public double ReadTemperature() { return Config.Formulas.CorrectedValue((double)ControlBoard.Temperature(tempMtrCfg.TempIdx0), Corrections); diff --git a/TBF/BenchControl/Elde/TempMeterMeret/TempMeterCfg.cs b/TBF/BenchControl/Elde/TempMeterMeret/TempMeterCfg.cs index 9c4d7266e..89a9426a3 100644 --- a/TBF/BenchControl/Elde/TempMeterMeret/TempMeterCfg.cs +++ b/TBF/BenchControl/Elde/TempMeterMeret/TempMeterCfg.cs @@ -10,7 +10,7 @@ using TBF.BenchControl.Generic; namespace TBF.BenchControl.Elde.TempMeterMeret { - public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider + public class TempMeterCfg : ComponentCfgBase, IChildComponentCfg, Config.Entities.IParamsProvider, TBF.BenchControl.GenericDevices.ICalibInfoCfg { public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(TempMeterCfg) })[0]; public override XmlSerializer GetSerializer() { return Serializer; } @@ -41,6 +41,27 @@ namespace TBF.BenchControl.Elde.TempMeterMeret public byte ModbusAddress; /// 1..247 public int MeretIdx0; /// Meter pressure meters count .. (Meter pressure meters count + Meter temperature meters count - 1) + /// Calibration info serialized parameters displayed in Metrology tab page + string calibCertificateNr; + DateTime calibDate; + DateTime calibValidDate; + public string CalibCertificateNr + { + get { return calibCertificateNr; } + set { calibCertificateNr = value; } + } + public DateTime CalibDate + { + get { return calibDate; } + set { calibDate = value; } + } + public DateTime CalibValidDate + { + get { return calibValidDate; } + set { calibValidDate = value; } + } + + /// Private parameterless constructor invoked by all other (public) constructors TempMeterCfg() { diff --git a/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs b/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs index cdd72f98e..0030cb128 100644 --- a/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs +++ b/TBF/BenchControl/Hart/Nivotrack/Nivotrack.cs @@ -9,13 +9,14 @@ using TBF.BenchControl.Generic; using TBF.BenchControl.GenericDevices; using TBF.Boxes; using TBF.BenchControl.Hart.Common; +using TBF.Resources; namespace TBF.BenchControl.Hart.Nivotrack { /// /// Root component for Modbus communication via serial port (RS485) /// - public class Nivotrack : ComponentBase, IDevice, ILevelMeter, IOperation + public class Nivotrack : ComponentBase, IDevice, ILevelMeter, IOperation, GenericDevices.IHasCalendarEvents { const int StableReadingsCount = 9; @@ -71,6 +72,40 @@ namespace TBF.BenchControl.Hart.Nivotrack log.Debug(this.ToString()); } + /// + /// Calendar support + /// + public IList GetCalendarEvents() + { + DateTime calibrationDue = nivotrackCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + public void Initialize() { if (nivotrackCfg.DebugLevel == DebugMode.Simulate) return; diff --git a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs index 0fc76f67e..a34d04bda 100644 --- a/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs +++ b/TBF/BenchControl/Keithley/TempMeter/TempMeter.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2016 Sensus Metering Systems +/// Copyright (c) 2016-2020 Sensus Metering Systems /// using System; using System.Collections.Generic; @@ -7,10 +7,11 @@ using Config; using log4net; using TBF.Boxes; using TBF.BenchControl.Keithley.Multimeter_2010_RS232; +using TBF.Resources; namespace TBF.BenchControl.Keithley.TempMeter { - public class TempMeter : ComponentBase, GenericDevices.ITempMeter + public class TempMeter : ComponentBase, GenericDevices.ITempMeter, GenericDevices.IHasCalendarEvents { private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter)); public override string ToString() { return string.Format("Keithley.TempMeter({0})", Cfg.ToString(1)); } @@ -45,6 +46,40 @@ namespace TBF.BenchControl.Keithley.TempMeter log.Debug(this.ToString()); } + /// + /// Calendar support + /// + public IList GetCalendarEvents() + { + DateTime calibrationDue = tempMtrCfg.CalibValidDate; + IList calendarEvents = new List(); + + if (calibrationDue > TBF.UI.Constants.MinDate) + { + /// Calibration due date calendar event + calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)))); + if (DateTime.Now.Date <= calibrationDue.AddDays(-7)) + { + /// Weekly reminders (last 5 weeks) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.Date.AddDays(-35), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + false)); + } + if (DateTime.Now.Date <= calibrationDue.Date) + { + /// Daily reminders (last 5 days) + calendarEvents.Add(new TBF.UI.Calendar.CalibrationReminderEvent(calibrationDue.AddDays(-5), Name, + string.Format(Strings.Calibration_due_date_is_0, + calibrationDue.Date.ToString(TBF.UI.Constants.DateFormat)), + true)); + } + } + return calendarEvents; + } + public double ReadTemperature() { double resistance = Multimeter.ReadResistance(tempMtrCfg.Channel); diff --git a/TBF/BenchControl/MettlerToledo/Standard/BalanceCfgCtrl.cs b/TBF/BenchControl/MettlerToledo/Standard/BalanceCfgCtrl.cs index 5b864ecd8..7b131f80d 100644 --- a/TBF/BenchControl/MettlerToledo/Standard/BalanceCfgCtrl.cs +++ b/TBF/BenchControl/MettlerToledo/Standard/BalanceCfgCtrl.cs @@ -108,7 +108,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard { drainValveComboBox.Items.Add(cmpnt.Name); } - else if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Various.Evaporation.Factory) + else if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is DataContainers.Evaporation.Factory) { evaporationComboBox.Items.Add(cmpnt.Name); } diff --git a/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs b/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs index d289898fe..260b1079a 100644 --- a/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs +++ b/TBF/BenchControl/MettlerToledo/Standard/BalanceDev.cs @@ -135,7 +135,7 @@ namespace TBF.BenchControl.MettlerToledo.Standard DateTime calibrationDue = balanceCfg.CalibValidDate; IList calendarEvents = new List(); - if (calibrationDue > DateTime.MinValue.AddDays(36)) + if (calibrationDue > TBF.UI.Constants.MinDate) { /// Calibration due date calendar event calendarEvents.Add(new TBF.UI.Calendar.CalibrationDueDateEvent(calibrationDue.Date, Name, diff --git a/TBF/BenchControl/TbfComponents.cs b/TBF/BenchControl/TbfComponents.cs index 20b77989c..fbdc2c389 100644 --- a/TBF/BenchControl/TbfComponents.cs +++ b/TBF/BenchControl/TbfComponents.cs @@ -20,6 +20,7 @@ namespace TBF.BenchControl Factories.Add(new DataContainers.BenchInfo.iPerl.ComponentFactory()); Factories.Add(new DataContainers.Buoyancy.ComponentFactory()); Factories.Add(new DataContainers.Density.ComponentFactory()); + Factories.Add(new DataContainers.Evaporation.Factory()); Factories.Add(new Elde.ControlBoardFactory()); Factories.Add(new Elde.CoverTest.Factory()); Factories.Add(new DataEntry.Combined.EntryFormFactory()); @@ -183,7 +184,6 @@ namespace TBF.BenchControl Factories.Add(new Elde.Valve.ValveFactory()); Factories.Add(new Elde.ValveEx.ValveFactory()); Factories.Add(new Various.ErrorFlags.Factory()); - Factories.Add(new Various.Evaporation.Factory()); Factories.Add(new Various.StatisticsMonitoring.Factory()); Factories.Add(new Various.TankWithLevelMsrmnt.Factory()); Factories.Add(new WaterMeters.Munich.WaterMeterFactory()); /// 'WaterMeters.Munich' diff --git a/TBF/BenchControl/Various/Evaporation/Component.cs b/TBF/BenchControl/Various/Evaporation/Component.cs deleted file mode 100644 index 5db5adc33..000000000 --- a/TBF/BenchControl/Various/Evaporation/Component.cs +++ /dev/null @@ -1,38 +0,0 @@ -/// -/// Copyright (c) 2019 Sensus Slovensko a.s. -/// -using System; -using System.Collections.Generic; -using log4net; -using Config.Entities; -using TBF.BenchControl.GenericDevices; - -namespace TBF.BenchControl.Various.Evaporation -{ - public class Component : ComponentBase, IEvaporation - { - private static readonly ILog log = LogManager.GetLogger(typeof(Component)); - public override string ToString() - { - return string.Format("{0}({1})", this.GetType().Namespace.Substring(17), Cfg.ToString(1)); - } - - public Component() - { - } - - public Component(Generic.IComponentCfg cfg) - : base(cfg) - { - log.Debug(this.ToString()); - } - - /// - /// For a given temperature in [°C] returns an evaporation rate in [kg/s] - /// - public double EvaporationRate(double temperature) - { - return Config.Formulas.GetCorrection(temperature, Corrections) / 3600.0; /// Converted from kg/h to kg/s - } - } -} diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx index 80c31acc7..df59dea5d 100644 --- a/TBF/Resources/Strings.cs.resx +++ b/TBF/Resources/Strings.cs.resx @@ -1638,4 +1638,7 @@ Celý den + + Certifikát + \ No newline at end of file diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index e39503ed1..af54434fa 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -199,6 +199,15 @@ + + + + + UserControl + + + EvaporationCfgCtrl.cs + Form @@ -1573,8 +1582,6 @@ - - @@ -2560,6 +2567,9 @@ PumpCfgCtrl.cs + + EvaporationCfgCtrl.cs + CycleBeginningForm.cs diff --git a/TBF/UI/Bench/Metrology/MetrologyDlg.cs b/TBF/UI/Bench/Metrology/MetrologyDlg.cs index 0f9238d94..6c33eccb4 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlg.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlg.cs @@ -136,7 +136,8 @@ namespace TBF.UI.Bench.Metrology TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); MetrologyDlgPressMeterTab uiControl = new MetrologyDlgPressMeterTab(); uiControl.MeterEntity = cmpnt; - uiControl.Dock = DockStyle.Fill; + uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg; + uiControl.Dock = DockStyle.Fill; tabPage.Tag = uiControl; tabPage.Controls.Add(uiControl); metrologyTabControl.TabPages.Add(tabPage); @@ -150,6 +151,7 @@ namespace TBF.UI.Bench.Metrology TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); MetrologyDlgTempMeterTab uiControl = new MetrologyDlgTempMeterTab(); uiControl.MeterEntity = cmpnt; + uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg; uiControl.Dock = DockStyle.Fill; tabPage.Tag = uiControl; tabPage.Controls.Add(uiControl); @@ -199,7 +201,7 @@ namespace TBF.UI.Bench.Metrology } /// Tab-pages for water tank evaporation rates - if (factory is BenchControl.Various.Evaporation.Factory) + if (factory is BenchControl.DataContainers.Evaporation.Factory) { evaporationsCount++; TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs index 6ef6f371d..480832ab6 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs @@ -34,9 +34,9 @@ namespace TBF.UI.Bench.Metrology this.cmpntNameLabel = new System.Windows.Forms.Label(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); this.calibDateLabel = new System.Windows.Forms.Label(); this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); this.calibCertificateNrLabel = new System.Windows.Forms.Label(); @@ -101,9 +101,9 @@ namespace TBF.UI.Bench.Metrology // // calibrationGroupBox // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); this.calibrationGroupBox.Controls.Add(this.calibDateLabel); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); @@ -114,13 +114,25 @@ namespace TBF.UI.Bench.Metrology this.calibrationGroupBox.TabStop = false; this.calibrationGroupBox.Text = "Calibration"; // - // calibValidDateTextBox + // calibExpirationDateTimePicker // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(120, 59); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibValidDateTextBox.TabIndex = 15; + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(120, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 17; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(120, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 16; // // calibValidDateLabel // @@ -131,14 +143,6 @@ namespace TBF.UI.Bench.Metrology this.calibValidDateLabel.TabIndex = 14; this.calibValidDateLabel.Text = "Valid until"; // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(120, 37); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibDateTextBox.TabIndex = 13; - // // calibDateLabel // this.calibDateLabel.AutoSize = true; @@ -388,11 +392,11 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.TextBox airDensityTextBox; private System.Windows.Forms.Label airDensityLabel; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs index b0c44675d..e733369d7 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -52,7 +52,11 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgBalanceTab() { InitializeComponent(); - toBeRemoved = new List(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + toBeRemoved = new List(); unlocked = false; } @@ -110,8 +114,8 @@ namespace TBF.UI.Bench.Metrology if (BalanceCfg != null) { calibCertificateNrTextBox.Text = BalanceCfg.CalibCertificateNr; - calibDateTextBox.Text = BalanceCfg.CalibDate.ToShortDateString(); - calibValidDateTextBox.Text = BalanceCfg.CalibValidDate.ToShortDateString(); + calibDateTimePicker.Value = (BalanceCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibDate; + calibExpirationDateTimePicker.Value = (BalanceCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibValidDate; buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2"); buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4"); @@ -245,8 +249,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; buoyancyTempTextBox.Enabled = true; buoyancyPressTextBox.Enabled = true; @@ -269,8 +273,8 @@ namespace TBF.UI.Bench.Metrology try { BalanceCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - BalanceCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text); - BalanceCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text); + BalanceCfg.CalibDate = calibDateTimePicker.Value.Date; + BalanceCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; BalanceCfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text); BalanceCfg.BuoyancyPress = Utils.ParseUFloat(buoyancyPressTextBox.Text); diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs index c3b9c4fd1..c0b776197 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs @@ -32,15 +32,23 @@ namespace TBF.UI.Bench.Metrology private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); + this.calibValidDateLabel = new System.Windows.Forms.Label(); + this.calibDateLabel = new System.Windows.Forms.Label(); + this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); + this.calibCertificateNrLabel = new System.Windows.Forms.Label(); this.densityCorrTextBox = new System.Windows.Forms.TextBox(); this.densityCorrLabel = new System.Windows.Forms.Label(); this.temperatureTextBox = new System.Windows.Forms.TextBox(); this.temperatureLabel = new System.Windows.Forms.Label(); this.densityTextBox = new System.Windows.Forms.TextBox(); this.densityLabel = new System.Windows.Forms.Label(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.calibrationGroupBox.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -53,20 +61,71 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox); this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel); this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox); this.splitContainer1.Panel1.Controls.Add(this.temperatureLabel); this.splitContainer1.Panel1.Controls.Add(this.densityTextBox); this.splitContainer1.Panel1.Controls.Add(this.densityLabel); - this.splitContainer1.Size = new System.Drawing.Size(420, 300); - this.splitContainer1.SplitterDistance = 120; + this.splitContainer1.Size = new System.Drawing.Size(554, 300); + this.splitContainer1.SplitterDistance = 110; this.splitContainer1.TabIndex = 1; // + // calibrationGroupBox + // + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); + this.calibrationGroupBox.Location = new System.Drawing.Point(323, 16); + this.calibrationGroupBox.Name = "calibrationGroupBox"; + this.calibrationGroupBox.Size = new System.Drawing.Size(208, 86); + this.calibrationGroupBox.TabIndex = 7; + this.calibrationGroupBox.TabStop = false; + this.calibrationGroupBox.Text = "Calibration"; + // + // calibValidDateLabel + // + this.calibValidDateLabel.AutoSize = true; + this.calibValidDateLabel.Location = new System.Drawing.Point(17, 62); + this.calibValidDateLabel.Name = "calibValidDateLabel"; + this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); + this.calibValidDateLabel.TabIndex = 14; + this.calibValidDateLabel.Text = "Valid until"; + // + // calibDateLabel + // + this.calibDateLabel.AutoSize = true; + this.calibDateLabel.Location = new System.Drawing.Point(17, 40); + this.calibDateLabel.Name = "calibDateLabel"; + this.calibDateLabel.Size = new System.Drawing.Size(30, 13); + this.calibDateLabel.TabIndex = 12; + this.calibDateLabel.Text = "Date"; + // + // calibCertificateNrTextBox + // + this.calibCertificateNrTextBox.Enabled = false; + this.calibCertificateNrTextBox.Location = new System.Drawing.Point(120, 15); + this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; + this.calibCertificateNrTextBox.Size = new System.Drawing.Size(82, 20); + this.calibCertificateNrTextBox.TabIndex = 11; + // + // calibCertificateNrLabel + // + this.calibCertificateNrLabel.AutoSize = true; + this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18); + this.calibCertificateNrLabel.Name = "calibCertificateNrLabel"; + this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13); + this.calibCertificateNrLabel.TabIndex = 10; + this.calibCertificateNrLabel.Text = "Certificate"; + // // densityCorrTextBox // this.densityCorrTextBox.Enabled = false; - this.densityCorrTextBox.Location = new System.Drawing.Point(185, 86); + this.densityCorrTextBox.Location = new System.Drawing.Point(185, 81); this.densityCorrTextBox.Name = "densityCorrTextBox"; this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20); this.densityCorrTextBox.TabIndex = 5; @@ -74,7 +133,7 @@ namespace TBF.UI.Bench.Metrology // densityCorrLabel // this.densityCorrLabel.AutoSize = true; - this.densityCorrLabel.Location = new System.Drawing.Point(37, 89); + this.densityCorrLabel.Location = new System.Drawing.Point(37, 84); this.densityCorrLabel.Name = "densityCorrLabel"; this.densityCorrLabel.Size = new System.Drawing.Size(132, 13); this.densityCorrLabel.TabIndex = 4; @@ -116,18 +175,40 @@ namespace TBF.UI.Bench.Metrology this.densityLabel.TabIndex = 0; this.densityLabel.Text = "Density [kg/m3]"; // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(120, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(120, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // // MetrologyDlgDensityTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); this.Name = "MetrologyDlgDensityTab"; - this.Size = new System.Drawing.Size(420, 300); + this.Size = new System.Drawing.Size(554, 300); this.Load += new System.EventHandler(this.MetrologyDlgDensityTab_Load); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.calibrationGroupBox.ResumeLayout(false); + this.calibrationGroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -141,5 +222,12 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label densityLabel; private System.Windows.Forms.TextBox densityCorrTextBox; private System.Windows.Forms.Label densityCorrLabel; + private System.Windows.Forms.GroupBox calibrationGroupBox; + private System.Windows.Forms.Label calibValidDateLabel; + private System.Windows.Forms.Label calibDateLabel; + private System.Windows.Forms.TextBox calibCertificateNrTextBox; + private System.Windows.Forms.Label calibCertificateNrLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs index d4b840ec7..c49365c21 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs @@ -46,7 +46,11 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgDensityTab() { InitializeComponent(); - toBeRemoved = new List(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + toBeRemoved = new List(); unlocked = false; } @@ -56,6 +60,8 @@ namespace TBF.UI.Bench.Metrology parent = ParentForm as MetrologyDlg; + Localize(); + /// Panel1 densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Config.Unit.kgpm3.ToDescription()); temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Config.Unit.C.ToDescription()); @@ -66,12 +72,26 @@ namespace TBF.UI.Bench.Metrology RefreshAll(); } + void Localize() + { + calibrationGroupBox.Text = Strings.Calibration; + calibCertificateNrLabel.Text = Strings.Certificate; + calibDateLabel.Text = Strings.Date; + calibValidDateLabel.Text = Strings.Valid_until; + } + void RefreshAll() { - densityTextBox.Text = Config.Data.RealDensity.ToString("F4"); - temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2"); - densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5"); - } + if (DensityCfg != null) + { + densityTextBox.Text = Config.Data.RealDensity.ToString("F4"); + temperatureTextBox.Text = Config.Data.AtTemperature.ToString("F2"); + densityCorrTextBox.Text = Config.Formulas.DensityCorrection(Config.Data.RealDensity, Config.Data.AtTemperature).ToString("F5"); + calibCertificateNrTextBox.Text = DensityCfg.CalibCertificateNr; + calibDateTimePicker.Value = (DensityCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibDate; + calibExpirationDateTimePicker.Value = (DensityCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : DensityCfg.CalibValidDate; + } + } public void Unlock() { @@ -79,6 +99,9 @@ namespace TBF.UI.Bench.Metrology densityTextBox.Enabled = true; temperatureTextBox.Enabled = true; + calibCertificateNrTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; } public void OkBtnClicked() @@ -95,6 +118,9 @@ namespace TBF.UI.Bench.Metrology Results.WMeterRsltItemSpec.AtTemperature = Config.Data.AtTemperature = DensityCfg.AtTemperature = atTemperature; + DensityCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; + DensityCfg.CalibDate = calibDateTimePicker.Value.Date; + DensityCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; Component modified = DensityCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs index fadcedb08..c05d22a43 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs @@ -33,9 +33,7 @@ namespace TBF.UI.Bench.Metrology { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); this.calibDateLabel = new System.Windows.Forms.Label(); this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); this.calibCertificateNrLabel = new System.Windows.Forms.Label(); @@ -49,6 +47,8 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -81,9 +81,9 @@ namespace TBF.UI.Bench.Metrology // // calibrationGroupBox // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); this.calibrationGroupBox.Controls.Add(this.calibDateLabel); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); @@ -94,14 +94,6 @@ namespace TBF.UI.Bench.Metrology this.calibrationGroupBox.TabStop = false; this.calibrationGroupBox.Text = "Calibration"; // - // calibValidDateTextBox - // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibValidDateTextBox.TabIndex = 15; - // // calibValidDateLabel // this.calibValidDateLabel.AutoSize = true; @@ -111,14 +103,6 @@ namespace TBF.UI.Bench.Metrology this.calibValidDateLabel.TabIndex = 14; this.calibValidDateLabel.Text = "Valid until"; // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(140, 37); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibDateTextBox.TabIndex = 13; - // // calibDateLabel // this.calibDateLabel.AutoSize = true; @@ -244,12 +228,32 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.View = System.Windows.Forms.View.Details; this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); // - // MetrologyDlgLevelMeterTab + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // + // MetrologyDlgDiverterTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgLevelMeterTab"; + this.Name = "MetrologyDlgDiverterTab"; this.Size = new System.Drawing.Size(650, 400); this.Load += new System.EventHandler(this.MetrologyDlgDiverterTab_Load); this.splitContainer1.Panel1.ResumeLayout(false); @@ -278,14 +282,14 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; private System.Windows.Forms.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs index c55a44d5a..0dc7ab4e3 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs @@ -52,7 +52,12 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgDiverterTab() { InitializeComponent(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); + unlocked = false; } private void MetrologyDlgDiverterTab_Load(object sender, System.EventArgs e) @@ -107,8 +112,8 @@ namespace TBF.UI.Bench.Metrology if (CalibInfoCfg != null) { calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr; - calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString(); - calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString(); + calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate; } listViewEx.Items.Clear(); @@ -205,8 +210,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; if (listViewEx.SelectedItems.Count == 1) { @@ -224,8 +229,8 @@ namespace TBF.UI.Bench.Metrology try { CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text); - CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text); + CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; + CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs index d785bc862..1e6981638 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs @@ -33,9 +33,7 @@ namespace TBF.UI.Bench.Metrology { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); this.calibDateLabel = new System.Windows.Forms.Label(); this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); this.calibCertificateNrLabel = new System.Windows.Forms.Label(); @@ -49,6 +47,8 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -81,9 +81,9 @@ namespace TBF.UI.Bench.Metrology // // calibrationGroupBox // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); this.calibrationGroupBox.Controls.Add(this.calibDateLabel); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); @@ -94,14 +94,6 @@ namespace TBF.UI.Bench.Metrology this.calibrationGroupBox.TabStop = false; this.calibrationGroupBox.Text = "Calibration"; // - // calibValidDateTextBox - // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibValidDateTextBox.TabIndex = 15; - // // calibValidDateLabel // this.calibValidDateLabel.AutoSize = true; @@ -111,14 +103,6 @@ namespace TBF.UI.Bench.Metrology this.calibValidDateLabel.TabIndex = 14; this.calibValidDateLabel.Text = "Valid until"; // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(140, 37); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibDateTextBox.TabIndex = 13; - // // calibDateLabel // this.calibDateLabel.AutoSize = true; @@ -244,12 +228,32 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.View = System.Windows.Forms.View.Details; this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); // - // MetrologyDlgLevelMeterTab + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // + // MetrologyDlgEvaporationTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgLevelMeterTab"; + this.Name = "MetrologyDlgEvaporationTab"; this.Size = new System.Drawing.Size(650, 400); this.Load += new System.EventHandler(this.MetrologyDlgEvaporationTab_Load); this.splitContainer1.Panel1.ResumeLayout(false); @@ -278,14 +282,14 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; private System.Windows.Forms.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs index 841c8d0f3..b3b5025c1 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs @@ -52,7 +52,12 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgEvaporationTab() { InitializeComponent(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); + unlocked = false; } private void MetrologyDlgEvaporationTab_Load(object sender, System.EventArgs e) @@ -107,8 +112,8 @@ namespace TBF.UI.Bench.Metrology if (CalibInfoCfg != null) { calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr; - calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString(); - calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString(); + calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate; } listViewEx.Items.Clear(); @@ -205,8 +210,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; if (listViewEx.SelectedItems.Count == 1) { @@ -224,8 +229,8 @@ namespace TBF.UI.Bench.Metrology try { CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text); - CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text); + CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; + CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs index 53ce610d9..c8f836973 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs @@ -33,9 +33,7 @@ namespace TBF.UI.Bench.Metrology { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); this.calibDateLabel = new System.Windows.Forms.Label(); this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); this.calibCertificateNrLabel = new System.Windows.Forms.Label(); @@ -49,6 +47,8 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -81,9 +81,9 @@ namespace TBF.UI.Bench.Metrology // // calibrationGroupBox // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); this.calibrationGroupBox.Controls.Add(this.calibDateLabel); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); @@ -94,14 +94,6 @@ namespace TBF.UI.Bench.Metrology this.calibrationGroupBox.TabStop = false; this.calibrationGroupBox.Text = "Calibration"; // - // calibValidDateTextBox - // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibValidDateTextBox.TabIndex = 15; - // // calibValidDateLabel // this.calibValidDateLabel.AutoSize = true; @@ -111,14 +103,6 @@ namespace TBF.UI.Bench.Metrology this.calibValidDateLabel.TabIndex = 14; this.calibValidDateLabel.Text = "Valid until"; // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(140, 37); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibDateTextBox.TabIndex = 13; - // // calibDateLabel // this.calibDateLabel.AutoSize = true; @@ -244,6 +228,26 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.View = System.Windows.Forms.View.Details; this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // // MetrologyDlgFlowMeterTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -278,14 +282,14 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; private System.Windows.Forms.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs index 989991223..e6eae57fb 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs @@ -56,8 +56,13 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgFlowMeterTab(int rangeIx1) { InitializeComponent(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; this.rangeIx = rangeIx1; toBeRemoved = new List(); + unlocked = false; } private void MetrologyDlgFlowMeterTab_Load(object sender, System.EventArgs e) @@ -121,8 +126,8 @@ namespace TBF.UI.Bench.Metrology if (CalibInfoCfg != null) { calibCertificateNrTextBox.Text = CalibInfoCfg.GetCalibCertificate(rangeIx1); - calibDateTextBox.Text = CalibInfoCfg.GetCalibDate(rangeIx1).ToShortDateString(); - calibValidDateTextBox.Text = CalibInfoCfg.GetCalibValidDate(rangeIx1).ToShortDateString(); + calibDateTimePicker.Value = (CalibInfoCfg.GetCalibDate(rangeIx1) < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.GetCalibDate(rangeIx1); + calibExpirationDateTimePicker.Value = (CalibInfoCfg.GetCalibValidDate(rangeIx1) < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.GetCalibValidDate(rangeIx1); } listViewEx.Items.Clear(); @@ -253,8 +258,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; if (listViewEx.SelectedItems.Count == 1) { @@ -272,8 +277,8 @@ namespace TBF.UI.Bench.Metrology try { CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text); - CalibInfoCfg.SetCalibDate(rangeIx, DateTime.Parse(calibDateTextBox.Text)); - CalibInfoCfg.SetCalibValidDate(rangeIx, DateTime.Parse(calibValidDateTextBox.Text)); + CalibInfoCfg.SetCalibDate(rangeIx, calibDateTimePicker.Value.Date); + CalibInfoCfg.SetCalibValidDate(rangeIx, calibExpirationDateTimePicker.Value.Date); Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs index a69a34ce2..50dbfaaf6 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs @@ -33,9 +33,7 @@ namespace TBF.UI.Bench.Metrology { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); this.calibDateLabel = new System.Windows.Forms.Label(); this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); this.calibCertificateNrLabel = new System.Windows.Forms.Label(); @@ -49,6 +47,8 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -81,9 +81,9 @@ namespace TBF.UI.Bench.Metrology // // calibrationGroupBox // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); this.calibrationGroupBox.Controls.Add(this.calibDateLabel); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); @@ -94,14 +94,6 @@ namespace TBF.UI.Bench.Metrology this.calibrationGroupBox.TabStop = false; this.calibrationGroupBox.Text = "Calibration"; // - // calibValidDateTextBox - // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibValidDateTextBox.TabIndex = 15; - // // calibValidDateLabel // this.calibValidDateLabel.AutoSize = true; @@ -111,14 +103,6 @@ namespace TBF.UI.Bench.Metrology this.calibValidDateLabel.TabIndex = 14; this.calibValidDateLabel.Text = "Valid until"; // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(140, 37); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(82, 20); - this.calibDateTextBox.TabIndex = 13; - // // calibDateLabel // this.calibDateLabel.AutoSize = true; @@ -244,6 +228,26 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.View = System.Windows.Forms.View.Details; this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // // MetrologyDlgLevelMeterTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -278,14 +282,14 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; private System.Windows.Forms.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs index 6c4ecc7b2..3eedec348 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs @@ -52,7 +52,12 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgLevelMeterTab() { InitializeComponent(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); + unlocked = false; } private void MetrologyDlgLevelMeterTab_Load(object sender, System.EventArgs e) @@ -107,8 +112,8 @@ namespace TBF.UI.Bench.Metrology if (CalibInfoCfg != null) { calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr; - calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString(); - calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString(); + calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate; } listViewEx.Items.Clear(); @@ -205,8 +210,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; if (listViewEx.SelectedItems.Count == 1) { @@ -224,8 +229,8 @@ namespace TBF.UI.Bench.Metrology try { CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text); - CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text); + CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; + CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs index d0771dc7d..15808ecab 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs @@ -31,398 +31,402 @@ namespace TBF.UI.Bench.Metrology /// private void InitializeComponent() { - this.cmpntNameLabel = new System.Windows.Forms.Label(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.radioButton2 = new System.Windows.Forms.RadioButton(); - this.radioButton1 = new System.Windows.Forms.RadioButton(); - this.testGroupBox = new System.Windows.Forms.GroupBox(); - this.temperatureTextBox = new System.Windows.Forms.TextBox(); - this.resistanceLabel = new System.Windows.Forms.Label(); - this.temperatureLabel = new System.Windows.Forms.Label(); - this.resistanceTextBox = new System.Windows.Forms.TextBox(); - this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibValidDateTextBox = new System.Windows.Forms.TextBox(); - this.calibValidDateLabel = new System.Windows.Forms.Label(); - this.calibDateTextBox = new System.Windows.Forms.TextBox(); - this.calibDateLabel = new System.Windows.Forms.Label(); - this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); - this.calibCertificateNrLabel = new System.Windows.Forms.Label(); - this.its90CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox(); - this.c7TextBox = new System.Windows.Forms.TextBox(); - this.c7Label = new System.Windows.Forms.Label(); - this.b7TextBox = new System.Windows.Forms.TextBox(); - this.a7TextBox = new System.Windows.Forms.TextBox(); - this.r001cTextBox = new System.Windows.Forms.TextBox(); - this.b7Label = new System.Windows.Forms.Label(); - this.a7Label = new System.Windows.Forms.Label(); - this.r0Label = new System.Windows.Forms.Label(); - this.nameGroupBox = new System.Windows.Forms.GroupBox(); - this.its27CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox(); - this.bTextBox = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.aTextBox = new System.Windows.Forms.TextBox(); - this.r0TextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.testGroupBox.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); - this.its90CalibrationCoefficientsGroupBox.SuspendLayout(); - this.nameGroupBox.SuspendLayout(); - this.its27CalibrationCoefficientsGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // cmpntNameLabel - // - this.cmpntNameLabel.AutoSize = true; - this.cmpntNameLabel.Location = new System.Drawing.Point(69, 16); - this.cmpntNameLabel.Name = "cmpntNameLabel"; - this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13); - this.cmpntNameLabel.TabIndex = 0; - this.cmpntNameLabel.Text = "cmpntName"; - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.radioButton2); - this.splitContainer1.Panel1.Controls.Add(this.radioButton1); - this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.its90CalibrationCoefficientsGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.its27CalibrationCoefficientsGroupBox); - this.splitContainer1.Size = new System.Drawing.Size(668, 400); - this.splitContainer1.SplitterDistance = 300; - this.splitContainer1.TabIndex = 1; - // - // radioButton2 - // - this.radioButton2.AutoSize = true; - this.radioButton2.Location = new System.Drawing.Point(462, 24); - this.radioButton2.Name = "radioButton2"; - this.radioButton2.Size = new System.Drawing.Size(187, 17); - this.radioButton2.TabIndex = 11; - this.radioButton2.TabStop = true; - this.radioButton2.Text = "Use ITS-27 calibration coefficients"; - this.radioButton2.UseVisualStyleBackColor = true; - // - // radioButton1 - // - this.radioButton1.AutoSize = true; - this.radioButton1.Location = new System.Drawing.Point(235, 24); - this.radioButton1.Name = "radioButton1"; - this.radioButton1.Size = new System.Drawing.Size(187, 17); - this.radioButton1.TabIndex = 10; - this.radioButton1.TabStop = true; - this.radioButton1.Text = "Use ITS-90 calibration coefficients"; - this.radioButton1.UseVisualStyleBackColor = true; - // - // testGroupBox - // - this.testGroupBox.Controls.Add(this.temperatureTextBox); - this.testGroupBox.Controls.Add(this.resistanceLabel); - this.testGroupBox.Controls.Add(this.temperatureLabel); - this.testGroupBox.Controls.Add(this.resistanceTextBox); - this.testGroupBox.Location = new System.Drawing.Point(16, 155); - this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(208, 77); - this.testGroupBox.TabIndex = 9; - this.testGroupBox.TabStop = false; - this.testGroupBox.Text = "Test"; - // - // temperatureTextBox - // - this.temperatureTextBox.Location = new System.Drawing.Point(121, 46); - this.temperatureTextBox.Name = "temperatureTextBox"; - this.temperatureTextBox.ReadOnly = true; - this.temperatureTextBox.Size = new System.Drawing.Size(79, 20); - this.temperatureTextBox.TabIndex = 5; - // - // resistanceLabel - // - this.resistanceLabel.AutoSize = true; - this.resistanceLabel.Location = new System.Drawing.Point(16, 23); - this.resistanceLabel.Name = "resistanceLabel"; - this.resistanceLabel.Size = new System.Drawing.Size(78, 13); - this.resistanceLabel.TabIndex = 2; - this.resistanceLabel.Text = "Resistance [Ω]"; - // - // temperatureLabel - // - this.temperatureLabel.AutoSize = true; - this.temperatureLabel.Location = new System.Drawing.Point(16, 49); - this.temperatureLabel.Name = "temperatureLabel"; - this.temperatureLabel.Size = new System.Drawing.Size(87, 13); - this.temperatureLabel.TabIndex = 3; - this.temperatureLabel.Text = "Temperature [°C]"; - // - // resistanceTextBox - // - this.resistanceTextBox.Location = new System.Drawing.Point(121, 20); - this.resistanceTextBox.Name = "resistanceTextBox"; - this.resistanceTextBox.Size = new System.Drawing.Size(79, 20); - this.resistanceTextBox.TabIndex = 4; - this.resistanceTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); - // - // calibrationGroupBox - // - this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox); - this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibDateTextBox); - this.calibrationGroupBox.Controls.Add(this.calibDateLabel); - this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); - this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); - this.calibrationGroupBox.Location = new System.Drawing.Point(16, 54); - this.calibrationGroupBox.Name = "calibrationGroupBox"; - this.calibrationGroupBox.Size = new System.Drawing.Size(208, 95); - this.calibrationGroupBox.TabIndex = 6; - this.calibrationGroupBox.TabStop = false; - this.calibrationGroupBox.Text = "Calibration"; - // - // calibValidDateTextBox - // - this.calibValidDateTextBox.Enabled = false; - this.calibValidDateTextBox.Location = new System.Drawing.Point(105, 65); - this.calibValidDateTextBox.Name = "calibValidDateTextBox"; - this.calibValidDateTextBox.Size = new System.Drawing.Size(95, 20); - this.calibValidDateTextBox.TabIndex = 15; - // - // calibValidDateLabel - // - this.calibValidDateLabel.AutoSize = true; - this.calibValidDateLabel.Location = new System.Drawing.Point(17, 68); - this.calibValidDateLabel.Name = "calibValidDateLabel"; - this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); - this.calibValidDateLabel.TabIndex = 14; - this.calibValidDateLabel.Text = "Valid until"; - // - // calibDateTextBox - // - this.calibDateTextBox.Enabled = false; - this.calibDateTextBox.Location = new System.Drawing.Point(105, 40); - this.calibDateTextBox.Name = "calibDateTextBox"; - this.calibDateTextBox.Size = new System.Drawing.Size(95, 20); - this.calibDateTextBox.TabIndex = 13; - // - // calibDateLabel - // - this.calibDateLabel.AutoSize = true; - this.calibDateLabel.Location = new System.Drawing.Point(17, 43); - this.calibDateLabel.Name = "calibDateLabel"; - this.calibDateLabel.Size = new System.Drawing.Size(30, 13); - this.calibDateLabel.TabIndex = 12; - this.calibDateLabel.Text = "Date"; - // - // calibCertificateNrTextBox - // - this.calibCertificateNrTextBox.Enabled = false; - this.calibCertificateNrTextBox.Location = new System.Drawing.Point(105, 15); - this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; - this.calibCertificateNrTextBox.Size = new System.Drawing.Size(95, 20); - this.calibCertificateNrTextBox.TabIndex = 11; - // - // calibCertificateNrLabel - // - this.calibCertificateNrLabel.AutoSize = true; - this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18); - this.calibCertificateNrLabel.Name = "calibCertificateNrLabel"; - this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13); - this.calibCertificateNrLabel.TabIndex = 10; - this.calibCertificateNrLabel.Text = "Certificate"; - // - // its90CalibrationCoefficientsGroupBox - // - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7TextBox); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7Label); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7TextBox); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7TextBox); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r001cTextBox); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7Label); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7Label); - this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r0Label); - this.its90CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(230, 54); - this.its90CalibrationCoefficientsGroupBox.Name = "its90CalibrationCoefficientsGroupBox"; - this.its90CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(220, 140); - this.its90CalibrationCoefficientsGroupBox.TabIndex = 5; - this.its90CalibrationCoefficientsGroupBox.TabStop = false; - this.its90CalibrationCoefficientsGroupBox.Text = "ITS-90 calibration coefficients"; - // - // c7TextBox - // - this.c7TextBox.Enabled = false; - this.c7TextBox.Location = new System.Drawing.Point(82, 104); - this.c7TextBox.Name = "c7TextBox"; - this.c7TextBox.Size = new System.Drawing.Size(124, 20); - this.c7TextBox.TabIndex = 7; - // - // c7Label - // - this.c7Label.AutoSize = true; - this.c7Label.Location = new System.Drawing.Point(20, 107); - this.c7Label.Name = "c7Label"; - this.c7Label.Size = new System.Drawing.Size(19, 13); - this.c7Label.TabIndex = 6; - this.c7Label.Text = "c7"; - // - // b7TextBox - // - this.b7TextBox.Enabled = false; - this.b7TextBox.Location = new System.Drawing.Point(82, 79); - this.b7TextBox.Name = "b7TextBox"; - this.b7TextBox.Size = new System.Drawing.Size(124, 20); - this.b7TextBox.TabIndex = 5; - // - // a7TextBox - // - this.a7TextBox.Enabled = false; - this.a7TextBox.Location = new System.Drawing.Point(82, 54); - this.a7TextBox.Name = "a7TextBox"; - this.a7TextBox.Size = new System.Drawing.Size(124, 20); - this.a7TextBox.TabIndex = 4; - // - // r001cTextBox - // - this.r001cTextBox.Enabled = false; - this.r001cTextBox.Location = new System.Drawing.Point(82, 29); - this.r001cTextBox.Name = "r001cTextBox"; - this.r001cTextBox.Size = new System.Drawing.Size(124, 20); - this.r001cTextBox.TabIndex = 3; - // - // b7Label - // - this.b7Label.AutoSize = true; - this.b7Label.Location = new System.Drawing.Point(20, 82); - this.b7Label.Name = "b7Label"; - this.b7Label.Size = new System.Drawing.Size(19, 13); - this.b7Label.TabIndex = 2; - this.b7Label.Text = "b7"; - // - // a7Label - // - this.a7Label.AutoSize = true; - this.a7Label.Location = new System.Drawing.Point(20, 57); - this.a7Label.Name = "a7Label"; - this.a7Label.Size = new System.Drawing.Size(19, 13); - this.a7Label.TabIndex = 1; - this.a7Label.Text = "a7"; - // - // r0Label - // - this.r0Label.AutoSize = true; - this.r0Label.Location = new System.Drawing.Point(20, 32); - this.r0Label.Name = "r0Label"; - this.r0Label.Size = new System.Drawing.Size(53, 13); - this.r0Label.TabIndex = 0; - this.r0Label.Text = "R(0.01°C)"; - // - // nameGroupBox - // - this.nameGroupBox.Controls.Add(this.cmpntNameLabel); - this.nameGroupBox.Location = new System.Drawing.Point(16, 10); - this.nameGroupBox.Name = "nameGroupBox"; - this.nameGroupBox.Size = new System.Drawing.Size(208, 40); - this.nameGroupBox.TabIndex = 4; - this.nameGroupBox.TabStop = false; - this.nameGroupBox.Text = "Component"; - // - // its27CalibrationCoefficientsGroupBox - // - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.bTextBox); - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label1); - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.aTextBox); - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.r0TextBox); - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label2); - this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label3); - this.its27CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(459, 54); - this.its27CalibrationCoefficientsGroupBox.Name = "its27CalibrationCoefficientsGroupBox"; - this.its27CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(190, 140); - this.its27CalibrationCoefficientsGroupBox.TabIndex = 3; - this.its27CalibrationCoefficientsGroupBox.TabStop = false; - this.its27CalibrationCoefficientsGroupBox.Text = "ITS-27 calibration coefficients"; - // - // bTextBox - // - this.bTextBox.Enabled = false; - this.bTextBox.Location = new System.Drawing.Point(52, 79); - this.bTextBox.Name = "bTextBox"; - this.bTextBox.Size = new System.Drawing.Size(124, 20); - this.bTextBox.TabIndex = 13; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(22, 82); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(14, 13); - this.label1.TabIndex = 12; - this.label1.Text = "B"; - // - // aTextBox - // - this.aTextBox.Enabled = false; - this.aTextBox.Location = new System.Drawing.Point(52, 54); - this.aTextBox.Name = "aTextBox"; - this.aTextBox.Size = new System.Drawing.Size(124, 20); - this.aTextBox.TabIndex = 11; - // - // r0TextBox - // - this.r0TextBox.Enabled = false; - this.r0TextBox.Location = new System.Drawing.Point(52, 29); - this.r0TextBox.Name = "r0TextBox"; - this.r0TextBox.Size = new System.Drawing.Size(124, 20); - this.r0TextBox.TabIndex = 10; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(22, 57); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(14, 13); - this.label2.TabIndex = 9; - this.label2.Text = "A"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(22, 32); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(21, 13); - this.label3.TabIndex = 8; - this.label3.Text = "R0"; - // - // MetrologyDlgPlatinumResistanceTMeterTab - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgPlatinumResistanceTMeterTab"; - this.Size = new System.Drawing.Size(668, 400); - this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.testGroupBox.ResumeLayout(false); - this.testGroupBox.PerformLayout(); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); - this.its90CalibrationCoefficientsGroupBox.ResumeLayout(false); - this.its90CalibrationCoefficientsGroupBox.PerformLayout(); - this.nameGroupBox.ResumeLayout(false); - this.nameGroupBox.PerformLayout(); - this.its27CalibrationCoefficientsGroupBox.ResumeLayout(false); - this.its27CalibrationCoefficientsGroupBox.PerformLayout(); - this.ResumeLayout(false); + this.cmpntNameLabel = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.radioButton2 = new System.Windows.Forms.RadioButton(); + this.radioButton1 = new System.Windows.Forms.RadioButton(); + this.testGroupBox = new System.Windows.Forms.GroupBox(); + this.temperatureTextBox = new System.Windows.Forms.TextBox(); + this.resistanceLabel = new System.Windows.Forms.Label(); + this.temperatureLabel = new System.Windows.Forms.Label(); + this.resistanceTextBox = new System.Windows.Forms.TextBox(); + this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); + this.calibValidDateLabel = new System.Windows.Forms.Label(); + this.calibDateLabel = new System.Windows.Forms.Label(); + this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); + this.calibCertificateNrLabel = new System.Windows.Forms.Label(); + this.its90CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox(); + this.c7TextBox = new System.Windows.Forms.TextBox(); + this.c7Label = new System.Windows.Forms.Label(); + this.b7TextBox = new System.Windows.Forms.TextBox(); + this.a7TextBox = new System.Windows.Forms.TextBox(); + this.r001cTextBox = new System.Windows.Forms.TextBox(); + this.b7Label = new System.Windows.Forms.Label(); + this.a7Label = new System.Windows.Forms.Label(); + this.r0Label = new System.Windows.Forms.Label(); + this.nameGroupBox = new System.Windows.Forms.GroupBox(); + this.its27CalibrationCoefficientsGroupBox = new System.Windows.Forms.GroupBox(); + this.bTextBox = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.aTextBox = new System.Windows.Forms.TextBox(); + this.r0TextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.testGroupBox.SuspendLayout(); + this.calibrationGroupBox.SuspendLayout(); + this.its90CalibrationCoefficientsGroupBox.SuspendLayout(); + this.nameGroupBox.SuspendLayout(); + this.its27CalibrationCoefficientsGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // cmpntNameLabel + // + this.cmpntNameLabel.AutoSize = true; + this.cmpntNameLabel.Location = new System.Drawing.Point(69, 16); + this.cmpntNameLabel.Name = "cmpntNameLabel"; + this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13); + this.cmpntNameLabel.TabIndex = 0; + this.cmpntNameLabel.Text = "cmpntName"; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.radioButton2); + this.splitContainer1.Panel1.Controls.Add(this.radioButton1); + this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.its90CalibrationCoefficientsGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.its27CalibrationCoefficientsGroupBox); + this.splitContainer1.Size = new System.Drawing.Size(668, 400); + this.splitContainer1.SplitterDistance = 300; + this.splitContainer1.TabIndex = 1; + // + // radioButton2 + // + this.radioButton2.AutoSize = true; + this.radioButton2.Location = new System.Drawing.Point(462, 24); + this.radioButton2.Name = "radioButton2"; + this.radioButton2.Size = new System.Drawing.Size(187, 17); + this.radioButton2.TabIndex = 11; + this.radioButton2.TabStop = true; + this.radioButton2.Text = "Use ITS-27 calibration coefficients"; + this.radioButton2.UseVisualStyleBackColor = true; + // + // radioButton1 + // + this.radioButton1.AutoSize = true; + this.radioButton1.Location = new System.Drawing.Point(235, 24); + this.radioButton1.Name = "radioButton1"; + this.radioButton1.Size = new System.Drawing.Size(187, 17); + this.radioButton1.TabIndex = 10; + this.radioButton1.TabStop = true; + this.radioButton1.Text = "Use ITS-90 calibration coefficients"; + this.radioButton1.UseVisualStyleBackColor = true; + // + // testGroupBox + // + this.testGroupBox.Controls.Add(this.temperatureTextBox); + this.testGroupBox.Controls.Add(this.resistanceLabel); + this.testGroupBox.Controls.Add(this.temperatureLabel); + this.testGroupBox.Controls.Add(this.resistanceTextBox); + this.testGroupBox.Location = new System.Drawing.Point(16, 155); + this.testGroupBox.Name = "testGroupBox"; + this.testGroupBox.Size = new System.Drawing.Size(208, 77); + this.testGroupBox.TabIndex = 9; + this.testGroupBox.TabStop = false; + this.testGroupBox.Text = "Test"; + // + // temperatureTextBox + // + this.temperatureTextBox.Location = new System.Drawing.Point(121, 46); + this.temperatureTextBox.Name = "temperatureTextBox"; + this.temperatureTextBox.ReadOnly = true; + this.temperatureTextBox.Size = new System.Drawing.Size(79, 20); + this.temperatureTextBox.TabIndex = 5; + // + // resistanceLabel + // + this.resistanceLabel.AutoSize = true; + this.resistanceLabel.Location = new System.Drawing.Point(16, 23); + this.resistanceLabel.Name = "resistanceLabel"; + this.resistanceLabel.Size = new System.Drawing.Size(78, 13); + this.resistanceLabel.TabIndex = 2; + this.resistanceLabel.Text = "Resistance [Ω]"; + // + // temperatureLabel + // + this.temperatureLabel.AutoSize = true; + this.temperatureLabel.Location = new System.Drawing.Point(16, 49); + this.temperatureLabel.Name = "temperatureLabel"; + this.temperatureLabel.Size = new System.Drawing.Size(87, 13); + this.temperatureLabel.TabIndex = 3; + this.temperatureLabel.Text = "Temperature [°C]"; + // + // resistanceTextBox + // + this.resistanceTextBox.Location = new System.Drawing.Point(121, 20); + this.resistanceTextBox.Name = "resistanceTextBox"; + this.resistanceTextBox.Size = new System.Drawing.Size(79, 20); + this.resistanceTextBox.TabIndex = 4; + this.resistanceTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); + // + // calibrationGroupBox + // + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); + this.calibrationGroupBox.Location = new System.Drawing.Point(16, 54); + this.calibrationGroupBox.Name = "calibrationGroupBox"; + this.calibrationGroupBox.Size = new System.Drawing.Size(208, 95); + this.calibrationGroupBox.TabIndex = 6; + this.calibrationGroupBox.TabStop = false; + this.calibrationGroupBox.Text = "Calibration"; + // + // calibValidDateLabel + // + this.calibValidDateLabel.AutoSize = true; + this.calibValidDateLabel.Location = new System.Drawing.Point(17, 68); + this.calibValidDateLabel.Name = "calibValidDateLabel"; + this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); + this.calibValidDateLabel.TabIndex = 14; + this.calibValidDateLabel.Text = "Valid until"; + // + // calibDateLabel + // + this.calibDateLabel.AutoSize = true; + this.calibDateLabel.Location = new System.Drawing.Point(17, 43); + this.calibDateLabel.Name = "calibDateLabel"; + this.calibDateLabel.Size = new System.Drawing.Size(30, 13); + this.calibDateLabel.TabIndex = 12; + this.calibDateLabel.Text = "Date"; + // + // calibCertificateNrTextBox + // + this.calibCertificateNrTextBox.Enabled = false; + this.calibCertificateNrTextBox.Location = new System.Drawing.Point(105, 15); + this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; + this.calibCertificateNrTextBox.Size = new System.Drawing.Size(95, 20); + this.calibCertificateNrTextBox.TabIndex = 11; + // + // calibCertificateNrLabel + // + this.calibCertificateNrLabel.AutoSize = true; + this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18); + this.calibCertificateNrLabel.Name = "calibCertificateNrLabel"; + this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13); + this.calibCertificateNrLabel.TabIndex = 10; + this.calibCertificateNrLabel.Text = "Certificate"; + // + // its90CalibrationCoefficientsGroupBox + // + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7TextBox); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.c7Label); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7TextBox); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7TextBox); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r001cTextBox); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.b7Label); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.a7Label); + this.its90CalibrationCoefficientsGroupBox.Controls.Add(this.r0Label); + this.its90CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(230, 54); + this.its90CalibrationCoefficientsGroupBox.Name = "its90CalibrationCoefficientsGroupBox"; + this.its90CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(220, 140); + this.its90CalibrationCoefficientsGroupBox.TabIndex = 5; + this.its90CalibrationCoefficientsGroupBox.TabStop = false; + this.its90CalibrationCoefficientsGroupBox.Text = "ITS-90 calibration coefficients"; + // + // c7TextBox + // + this.c7TextBox.Enabled = false; + this.c7TextBox.Location = new System.Drawing.Point(82, 104); + this.c7TextBox.Name = "c7TextBox"; + this.c7TextBox.Size = new System.Drawing.Size(124, 20); + this.c7TextBox.TabIndex = 7; + // + // c7Label + // + this.c7Label.AutoSize = true; + this.c7Label.Location = new System.Drawing.Point(20, 107); + this.c7Label.Name = "c7Label"; + this.c7Label.Size = new System.Drawing.Size(19, 13); + this.c7Label.TabIndex = 6; + this.c7Label.Text = "c7"; + // + // b7TextBox + // + this.b7TextBox.Enabled = false; + this.b7TextBox.Location = new System.Drawing.Point(82, 79); + this.b7TextBox.Name = "b7TextBox"; + this.b7TextBox.Size = new System.Drawing.Size(124, 20); + this.b7TextBox.TabIndex = 5; + // + // a7TextBox + // + this.a7TextBox.Enabled = false; + this.a7TextBox.Location = new System.Drawing.Point(82, 54); + this.a7TextBox.Name = "a7TextBox"; + this.a7TextBox.Size = new System.Drawing.Size(124, 20); + this.a7TextBox.TabIndex = 4; + // + // r001cTextBox + // + this.r001cTextBox.Enabled = false; + this.r001cTextBox.Location = new System.Drawing.Point(82, 29); + this.r001cTextBox.Name = "r001cTextBox"; + this.r001cTextBox.Size = new System.Drawing.Size(124, 20); + this.r001cTextBox.TabIndex = 3; + // + // b7Label + // + this.b7Label.AutoSize = true; + this.b7Label.Location = new System.Drawing.Point(20, 82); + this.b7Label.Name = "b7Label"; + this.b7Label.Size = new System.Drawing.Size(19, 13); + this.b7Label.TabIndex = 2; + this.b7Label.Text = "b7"; + // + // a7Label + // + this.a7Label.AutoSize = true; + this.a7Label.Location = new System.Drawing.Point(20, 57); + this.a7Label.Name = "a7Label"; + this.a7Label.Size = new System.Drawing.Size(19, 13); + this.a7Label.TabIndex = 1; + this.a7Label.Text = "a7"; + // + // r0Label + // + this.r0Label.AutoSize = true; + this.r0Label.Location = new System.Drawing.Point(20, 32); + this.r0Label.Name = "r0Label"; + this.r0Label.Size = new System.Drawing.Size(53, 13); + this.r0Label.TabIndex = 0; + this.r0Label.Text = "R(0.01°C)"; + // + // nameGroupBox + // + this.nameGroupBox.Controls.Add(this.cmpntNameLabel); + this.nameGroupBox.Location = new System.Drawing.Point(16, 10); + this.nameGroupBox.Name = "nameGroupBox"; + this.nameGroupBox.Size = new System.Drawing.Size(208, 40); + this.nameGroupBox.TabIndex = 4; + this.nameGroupBox.TabStop = false; + this.nameGroupBox.Text = "Component"; + // + // its27CalibrationCoefficientsGroupBox + // + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.bTextBox); + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label1); + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.aTextBox); + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.r0TextBox); + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label2); + this.its27CalibrationCoefficientsGroupBox.Controls.Add(this.label3); + this.its27CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(459, 54); + this.its27CalibrationCoefficientsGroupBox.Name = "its27CalibrationCoefficientsGroupBox"; + this.its27CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(190, 140); + this.its27CalibrationCoefficientsGroupBox.TabIndex = 3; + this.its27CalibrationCoefficientsGroupBox.TabStop = false; + this.its27CalibrationCoefficientsGroupBox.Text = "ITS-27 calibration coefficients"; + // + // bTextBox + // + this.bTextBox.Enabled = false; + this.bTextBox.Location = new System.Drawing.Point(52, 79); + this.bTextBox.Name = "bTextBox"; + this.bTextBox.Size = new System.Drawing.Size(124, 20); + this.bTextBox.TabIndex = 13; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(22, 82); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(14, 13); + this.label1.TabIndex = 12; + this.label1.Text = "B"; + // + // aTextBox + // + this.aTextBox.Enabled = false; + this.aTextBox.Location = new System.Drawing.Point(52, 54); + this.aTextBox.Name = "aTextBox"; + this.aTextBox.Size = new System.Drawing.Size(124, 20); + this.aTextBox.TabIndex = 11; + // + // r0TextBox + // + this.r0TextBox.Enabled = false; + this.r0TextBox.Location = new System.Drawing.Point(52, 29); + this.r0TextBox.Name = "r0TextBox"; + this.r0TextBox.Size = new System.Drawing.Size(124, 20); + this.r0TextBox.TabIndex = 10; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(22, 57); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(14, 13); + this.label2.TabIndex = 9; + this.label2.Text = "A"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(22, 32); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(21, 13); + this.label3.TabIndex = 8; + this.label3.Text = "R0"; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(105, 40); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(95, 20); + this.calibDateTimePicker.TabIndex = 17; + // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(105, 64); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(95, 20); + this.calibExpirationDateTimePicker.TabIndex = 18; + // + // MetrologyDlgPlatinumResistanceTMeterTab + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "MetrologyDlgPlatinumResistanceTMeterTab"; + this.Size = new System.Drawing.Size(668, 400); + this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.testGroupBox.ResumeLayout(false); + this.testGroupBox.PerformLayout(); + this.calibrationGroupBox.ResumeLayout(false); + this.calibrationGroupBox.PerformLayout(); + this.its90CalibrationCoefficientsGroupBox.ResumeLayout(false); + this.its90CalibrationCoefficientsGroupBox.PerformLayout(); + this.nameGroupBox.ResumeLayout(false); + this.nameGroupBox.PerformLayout(); + this.its27CalibrationCoefficientsGroupBox.ResumeLayout(false); + this.its27CalibrationCoefficientsGroupBox.PerformLayout(); + this.ResumeLayout(false); } @@ -446,9 +450,7 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.TextBox c7TextBox; private System.Windows.Forms.Label c7Label; private System.Windows.Forms.GroupBox calibrationGroupBox; - private System.Windows.Forms.TextBox calibValidDateTextBox; private System.Windows.Forms.Label calibValidDateLabel; - private System.Windows.Forms.TextBox calibDateTextBox; private System.Windows.Forms.Label calibDateLabel; private System.Windows.Forms.TextBox calibCertificateNrTextBox; private System.Windows.Forms.Label calibCertificateNrLabel; @@ -461,5 +463,7 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label label3; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs index 4be2c49de..3d7e3d336 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2016 Senus Slovensko a.s. +/// Copyright (c) 2016-2020 Senus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -47,7 +47,11 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgPlatinumResistanceTMeterTab() { InitializeComponent(); - toBeRemoved = new List(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + toBeRemoved = new List(); unlocked = false; } @@ -92,8 +96,8 @@ namespace TBF.UI.Bench.Metrology if (TempMeterCfg != null) { calibCertificateNrTextBox.Text = TempMeterCfg.CalibCertificateNr; - calibDateTextBox.Text = TempMeterCfg.CalibDate.ToShortDateString(); - calibValidDateTextBox.Text = TempMeterCfg.CalibValidDate.ToShortDateString(); + calibDateTimePicker.Value = (TempMeterCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : TempMeterCfg.CalibDate; + calibExpirationDateTimePicker.Value = (TempMeterCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : TempMeterCfg.CalibValidDate; radioButton1.Checked = TempMeterCfg.UseITS90; radioButton2.Checked = !TempMeterCfg.UseITS90; @@ -114,8 +118,8 @@ namespace TBF.UI.Bench.Metrology unlocked = true; calibCertificateNrTextBox.Enabled = true; - calibDateTextBox.Enabled = true; - calibValidDateTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; radioButton1.Enabled = true; radioButton2.Enabled = true; @@ -137,8 +141,8 @@ namespace TBF.UI.Bench.Metrology try { TempMeterCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - TempMeterCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text); - TempMeterCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text); + TempMeterCfg.CalibDate = calibDateTimePicker.Value.Date; + TempMeterCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; TempMeterCfg.UseITS90 = radioButton1.Checked; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs index 746f46d0d..2c41d97e1 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs @@ -31,139 +31,220 @@ namespace TBF.UI.Bench.Metrology /// private void InitializeComponent() { - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.testGroupBox = new System.Windows.Forms.GroupBox(); - this.correctedTextBox = new System.Windows.Forms.TextBox(); - this.measuredTextBox = new System.Windows.Forms.TextBox(); - this.correctedLabel = new System.Windows.Forms.Label(); - this.measuredLabel = new System.Windows.Forms.Label(); - this.componentLabel = new System.Windows.Forms.Label(); - this.cmpntNameLabel = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); + this.calibValidDateLabel = new System.Windows.Forms.Label(); + this.calibDateLabel = new System.Windows.Forms.Label(); + this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); + this.calibCertificateNrLabel = new System.Windows.Forms.Label(); + this.testGroupBox = new System.Windows.Forms.GroupBox(); + this.correctedTextBox = new System.Windows.Forms.TextBox(); + this.measuredTextBox = new System.Windows.Forms.TextBox(); + this.correctedLabel = new System.Windows.Forms.Label(); + this.measuredLabel = new System.Windows.Forms.Label(); + this.componentLabel = new System.Windows.Forms.Label(); + this.cmpntNameLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.testGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.componentLabel); - this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.listViewEx); - this.splitContainer1.Size = new System.Drawing.Size(420, 300); - this.splitContainer1.SplitterDistance = 80; - this.splitContainer1.TabIndex = 2; - // - // testGroupBox - // - this.testGroupBox.Controls.Add(this.correctedTextBox); - this.testGroupBox.Controls.Add(this.measuredTextBox); - this.testGroupBox.Controls.Add(this.correctedLabel); - this.testGroupBox.Controls.Add(this.measuredLabel); - this.testGroupBox.Location = new System.Drawing.Point(245, 7); - this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(157, 64); - this.testGroupBox.TabIndex = 4; - this.testGroupBox.TabStop = false; - this.testGroupBox.Text = "Test"; - // - // correctedTextBox - // - this.correctedTextBox.Location = new System.Drawing.Point(74, 38); - this.correctedTextBox.Name = "correctedTextBox"; - this.correctedTextBox.ReadOnly = true; - this.correctedTextBox.Size = new System.Drawing.Size(73, 20); - this.correctedTextBox.TabIndex = 5; - // - // measuredTextBox - // - this.measuredTextBox.Location = new System.Drawing.Point(74, 13); - this.measuredTextBox.Name = "measuredTextBox"; - this.measuredTextBox.Size = new System.Drawing.Size(73, 20); - this.measuredTextBox.TabIndex = 4; - this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); - // - // correctedLabel - // - this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(7, 41); - this.correctedLabel.Name = "correctedLabel"; - this.correctedLabel.Size = new System.Drawing.Size(53, 13); - this.correctedLabel.TabIndex = 3; - this.correctedLabel.Text = "Corrected"; - // - // measuredLabel - // - this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(6, 20); - this.measuredLabel.Name = "measuredLabel"; - this.measuredLabel.Size = new System.Drawing.Size(54, 13); - this.measuredLabel.TabIndex = 2; - this.measuredLabel.Text = "Measured"; - // - // componentLabel - // - this.componentLabel.AutoSize = true; - this.componentLabel.Location = new System.Drawing.Point(14, 12); - this.componentLabel.Name = "componentLabel"; - this.componentLabel.Size = new System.Drawing.Size(64, 13); - this.componentLabel.TabIndex = 1; - this.componentLabel.Text = "Component:"; - // - // cmpntNameLabel - // - this.cmpntNameLabel.AutoSize = true; - this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12); - this.cmpntNameLabel.Name = "cmpntNameLabel"; - this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13); - this.cmpntNameLabel.TabIndex = 0; - this.cmpntNameLabel.Text = "componentName"; - // - // listViewEx - // - this.listViewEx.AllowColumnReorder = true; - this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; - this.listViewEx.DoubleClickActivation = false; - this.listViewEx.FullRowSelect = true; - this.listViewEx.GridLines = true; - this.listViewEx.Location = new System.Drawing.Point(0, 0); - this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(420, 216); - this.listViewEx.TabIndex = 0; - this.listViewEx.UseCompatibleStateImageBehavior = false; - this.listViewEx.View = System.Windows.Forms.View.Details; - this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); - // - // MetrologyDlgPressMeterTab - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgPressMeterTab"; - this.Size = new System.Drawing.Size(420, 300); - this.Load += new System.EventHandler(this.MetrologyDlgPressMeterTab_Load); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.testGroupBox.ResumeLayout(false); - this.testGroupBox.PerformLayout(); - this.ResumeLayout(false); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.calibrationGroupBox.SuspendLayout(); + this.testGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.componentLabel); + this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.listViewEx); + this.splitContainer1.Size = new System.Drawing.Size(600, 300); + this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.TabIndex = 2; + // + // calibrationGroupBox + // + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); + this.calibrationGroupBox.Location = new System.Drawing.Point(204, 12); + this.calibrationGroupBox.Name = "calibrationGroupBox"; + this.calibrationGroupBox.Size = new System.Drawing.Size(208, 86); + this.calibrationGroupBox.TabIndex = 7; + this.calibrationGroupBox.TabStop = false; + this.calibrationGroupBox.Text = "Calibration"; + // + // calibValidDateLabel + // + this.calibValidDateLabel.AutoSize = true; + this.calibValidDateLabel.Location = new System.Drawing.Point(17, 62); + this.calibValidDateLabel.Name = "calibValidDateLabel"; + this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); + this.calibValidDateLabel.TabIndex = 14; + this.calibValidDateLabel.Text = "Valid until"; + // + // calibDateLabel + // + this.calibDateLabel.AutoSize = true; + this.calibDateLabel.Location = new System.Drawing.Point(17, 40); + this.calibDateLabel.Name = "calibDateLabel"; + this.calibDateLabel.Size = new System.Drawing.Size(30, 13); + this.calibDateLabel.TabIndex = 12; + this.calibDateLabel.Text = "Date"; + // + // calibCertificateNrTextBox + // + this.calibCertificateNrTextBox.Enabled = false; + this.calibCertificateNrTextBox.Location = new System.Drawing.Point(120, 15); + this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; + this.calibCertificateNrTextBox.Size = new System.Drawing.Size(82, 20); + this.calibCertificateNrTextBox.TabIndex = 11; + // + // calibCertificateNrLabel + // + this.calibCertificateNrLabel.AutoSize = true; + this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18); + this.calibCertificateNrLabel.Name = "calibCertificateNrLabel"; + this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13); + this.calibCertificateNrLabel.TabIndex = 10; + this.calibCertificateNrLabel.Text = "Certificate"; + // + // testGroupBox + // + this.testGroupBox.Controls.Add(this.correctedTextBox); + this.testGroupBox.Controls.Add(this.measuredTextBox); + this.testGroupBox.Controls.Add(this.correctedLabel); + this.testGroupBox.Controls.Add(this.measuredLabel); + this.testGroupBox.Location = new System.Drawing.Point(428, 12); + this.testGroupBox.Name = "testGroupBox"; + this.testGroupBox.Size = new System.Drawing.Size(157, 86); + this.testGroupBox.TabIndex = 4; + this.testGroupBox.TabStop = false; + this.testGroupBox.Text = "Test"; + // + // correctedTextBox + // + this.correctedTextBox.Location = new System.Drawing.Point(74, 48); + this.correctedTextBox.Name = "correctedTextBox"; + this.correctedTextBox.ReadOnly = true; + this.correctedTextBox.Size = new System.Drawing.Size(73, 20); + this.correctedTextBox.TabIndex = 5; + // + // measuredTextBox + // + this.measuredTextBox.Location = new System.Drawing.Point(74, 23); + this.measuredTextBox.Name = "measuredTextBox"; + this.measuredTextBox.Size = new System.Drawing.Size(73, 20); + this.measuredTextBox.TabIndex = 4; + this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); + // + // correctedLabel + // + this.correctedLabel.AutoSize = true; + this.correctedLabel.Location = new System.Drawing.Point(7, 51); + this.correctedLabel.Name = "correctedLabel"; + this.correctedLabel.Size = new System.Drawing.Size(53, 13); + this.correctedLabel.TabIndex = 3; + this.correctedLabel.Text = "Corrected"; + // + // measuredLabel + // + this.measuredLabel.AutoSize = true; + this.measuredLabel.Location = new System.Drawing.Point(6, 30); + this.measuredLabel.Name = "measuredLabel"; + this.measuredLabel.Size = new System.Drawing.Size(54, 13); + this.measuredLabel.TabIndex = 2; + this.measuredLabel.Text = "Measured"; + // + // componentLabel + // + this.componentLabel.AutoSize = true; + this.componentLabel.Location = new System.Drawing.Point(14, 17); + this.componentLabel.Name = "componentLabel"; + this.componentLabel.Size = new System.Drawing.Size(64, 13); + this.componentLabel.TabIndex = 1; + this.componentLabel.Text = "Component:"; + // + // cmpntNameLabel + // + this.cmpntNameLabel.AutoSize = true; + this.cmpntNameLabel.Location = new System.Drawing.Point(97, 17); + this.cmpntNameLabel.Name = "cmpntNameLabel"; + this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13); + this.cmpntNameLabel.TabIndex = 0; + this.cmpntNameLabel.Text = "componentName"; + // + // listViewEx + // + this.listViewEx.AllowColumnReorder = true; + this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewEx.DoubleClickActivation = false; + this.listViewEx.FullRowSelect = true; + this.listViewEx.GridLines = true; + this.listViewEx.Location = new System.Drawing.Point(0, 0); + this.listViewEx.Name = "listViewEx"; + this.listViewEx.Size = new System.Drawing.Size(600, 186); + this.listViewEx.TabIndex = 0; + this.listViewEx.UseCompatibleStateImageBehavior = false; + this.listViewEx.View = System.Windows.Forms.View.Details; + this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); + // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(120, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(120, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // + // MetrologyDlgPressMeterTab + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "MetrologyDlgPressMeterTab"; + this.Size = new System.Drawing.Size(600, 300); + this.Load += new System.EventHandler(this.MetrologyDlgPressMeterTab_Load); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.calibrationGroupBox.ResumeLayout(false); + this.calibrationGroupBox.PerformLayout(); + this.testGroupBox.ResumeLayout(false); + this.testGroupBox.PerformLayout(); + this.ResumeLayout(false); } @@ -178,6 +259,13 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.TextBox measuredTextBox; private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; + private System.Windows.Forms.GroupBox calibrationGroupBox; + private System.Windows.Forms.Label calibValidDateLabel; + private System.Windows.Forms.Label calibDateLabel; + private System.Windows.Forms.TextBox calibCertificateNrTextBox; + private System.Windows.Forms.Label calibCertificateNrLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs index e1058b835..0036a7fed 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -28,6 +28,11 @@ namespace TBF.UI.Bench.Metrology set { meterEntity = value; } } + /// + /// Balance configuration (with buoyancy parameters) + /// + public BenchControl.GenericDevices.ICalibInfoCfg CalibInfoCfg; + /// /// A list of 'measurement-correction' pairs to be deleted from the database on OK. /// @@ -47,7 +52,12 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgPressMeterTab() { InitializeComponent(); - toBeRemoved = new List(); + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + toBeRemoved = new List(); + unlocked = false; } private void MetrologyDlgPressMeterTab_Load(object sender, System.EventArgs e) @@ -56,15 +66,10 @@ namespace TBF.UI.Bench.Metrology parent = ParentForm as MetrologyDlg; - /// Panel1 - cmpntNameLabel.Text = meterEntity.Name; + Localize(); - componentLabel.Text = Strings.Component; - testGroupBox.Text = Strings.Test_measured_corrected; - measuredLabel.Text = Strings.Measured; - correctedLabel.Text = Strings.Corrected; - measuredTextBox.Text = string.Empty; - correctedTextBox.Text = string.Empty; + /// Panel1 + cmpntNameLabel.Text = meterEntity.Name; /// Panel2 this.Controls.Add(measurementTextBox = new TextBox()); @@ -82,8 +87,30 @@ namespace TBF.UI.Bench.Metrology RefreshAll(); } + void Localize() + { + componentLabel.Text = Strings.Component; + testGroupBox.Text = Strings.Test_measured_corrected; + measuredLabel.Text = Strings.Measured; + correctedLabel.Text = Strings.Corrected; + measuredTextBox.Text = string.Empty; + correctedTextBox.Text = string.Empty; + + calibrationGroupBox.Text = Strings.Calibration; + calibCertificateNrLabel.Text = Strings.Certificate; + calibDateLabel.Text = Strings.Date; + calibValidDateLabel.Text = Strings.Valid_until; + } + void RefreshAll() { + if (CalibInfoCfg != null) + { + calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr; + calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate; + } + listViewEx.Items.Clear(); foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr); } @@ -208,6 +235,10 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; + calibCertificateNrTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; + if (listViewEx.SelectedItems.Count == 1) { int ix = listViewEx.SelectedIndices[0]; @@ -219,7 +250,26 @@ namespace TBF.UI.Bench.Metrology public void OkBtnClicked() { - } + if (CalibInfoCfg != null) + { + try + { + CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; + CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; + CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + + Component modified = CalibInfoCfg.CreateDbEntity(); + MeterEntity.Parameters = modified.Parameters; + } + catch + { + MessageBox.Show(Strings.Invalid_calib_info_Correct_pls, + Strings.Error, + MessageBoxButtons.OK, + MessageBoxIcon.Exclamation); + } + } + } public void CancelBtnClicked() { diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs index 9f4f746eb..8b3021f10 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs @@ -31,139 +31,220 @@ namespace TBF.UI.Bench.Metrology /// private void InitializeComponent() { - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.testGroupBox = new System.Windows.Forms.GroupBox(); - this.correctedTextBox = new System.Windows.Forms.TextBox(); - this.measuredTextBox = new System.Windows.Forms.TextBox(); - this.correctedLabel = new System.Windows.Forms.Label(); - this.measuredLabel = new System.Windows.Forms.Label(); - this.componentLabel = new System.Windows.Forms.Label(); - this.cmpntNameLabel = new System.Windows.Forms.Label(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); + this.calibValidDateLabel = new System.Windows.Forms.Label(); + this.calibDateLabel = new System.Windows.Forms.Label(); + this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); + this.calibCertificateNrLabel = new System.Windows.Forms.Label(); + this.testGroupBox = new System.Windows.Forms.GroupBox(); + this.correctedTextBox = new System.Windows.Forms.TextBox(); + this.measuredTextBox = new System.Windows.Forms.TextBox(); + this.correctedLabel = new System.Windows.Forms.Label(); + this.measuredLabel = new System.Windows.Forms.Label(); + this.componentLabel = new System.Windows.Forms.Label(); + this.cmpntNameLabel = new System.Windows.Forms.Label(); this.listViewEx = new Results.Forms.ListViewEx(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.testGroupBox.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); - this.splitContainer1.Panel1.Controls.Add(this.componentLabel); - this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.listViewEx); - this.splitContainer1.Size = new System.Drawing.Size(420, 300); - this.splitContainer1.SplitterDistance = 80; - this.splitContainer1.TabIndex = 2; - // - // testGroupBox - // - this.testGroupBox.Controls.Add(this.correctedTextBox); - this.testGroupBox.Controls.Add(this.measuredTextBox); - this.testGroupBox.Controls.Add(this.correctedLabel); - this.testGroupBox.Controls.Add(this.measuredLabel); - this.testGroupBox.Location = new System.Drawing.Point(245, 7); - this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(157, 64); - this.testGroupBox.TabIndex = 4; - this.testGroupBox.TabStop = false; - this.testGroupBox.Text = "Test"; - // - // correctedTextBox - // - this.correctedTextBox.Location = new System.Drawing.Point(74, 38); - this.correctedTextBox.Name = "correctedTextBox"; - this.correctedTextBox.ReadOnly = true; - this.correctedTextBox.Size = new System.Drawing.Size(73, 20); - this.correctedTextBox.TabIndex = 5; - // - // measuredTextBox - // - this.measuredTextBox.Location = new System.Drawing.Point(74, 13); - this.measuredTextBox.Name = "measuredTextBox"; - this.measuredTextBox.Size = new System.Drawing.Size(73, 20); - this.measuredTextBox.TabIndex = 4; - this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); - // - // correctedLabel - // - this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(7, 41); - this.correctedLabel.Name = "correctedLabel"; - this.correctedLabel.Size = new System.Drawing.Size(53, 13); - this.correctedLabel.TabIndex = 3; - this.correctedLabel.Text = "Corrected"; - // - // measuredLabel - // - this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(6, 20); - this.measuredLabel.Name = "measuredLabel"; - this.measuredLabel.Size = new System.Drawing.Size(54, 13); - this.measuredLabel.TabIndex = 2; - this.measuredLabel.Text = "Measured"; - // - // componentLabel - // - this.componentLabel.AutoSize = true; - this.componentLabel.Location = new System.Drawing.Point(14, 12); - this.componentLabel.Name = "componentLabel"; - this.componentLabel.Size = new System.Drawing.Size(64, 13); - this.componentLabel.TabIndex = 1; - this.componentLabel.Text = "Component:"; - // - // cmpntNameLabel - // - this.cmpntNameLabel.AutoSize = true; - this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12); - this.cmpntNameLabel.Name = "cmpntNameLabel"; - this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13); - this.cmpntNameLabel.TabIndex = 0; - this.cmpntNameLabel.Text = "componentName"; - // - // listViewEx - // - this.listViewEx.AllowColumnReorder = true; - this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; - this.listViewEx.DoubleClickActivation = false; - this.listViewEx.FullRowSelect = true; - this.listViewEx.GridLines = true; - this.listViewEx.Location = new System.Drawing.Point(0, 0); - this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(420, 216); - this.listViewEx.TabIndex = 0; - this.listViewEx.UseCompatibleStateImageBehavior = false; - this.listViewEx.View = System.Windows.Forms.View.Details; - this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); - // - // MetrologyDlgTempMeterTab - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgTempMeterTab"; - this.Size = new System.Drawing.Size(420, 300); - this.Load += new System.EventHandler(this.MetrologyDlgTempMeterTab_Load); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel1.PerformLayout(); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - this.testGroupBox.ResumeLayout(false); - this.testGroupBox.PerformLayout(); - this.ResumeLayout(false); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.calibrationGroupBox.SuspendLayout(); + this.testGroupBox.SuspendLayout(); + this.SuspendLayout(); + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.componentLabel); + this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.listViewEx); + this.splitContainer1.Size = new System.Drawing.Size(600, 300); + this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.TabIndex = 2; + // + // calibrationGroupBox + // + this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker); + this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibDateLabel); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox); + this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel); + this.calibrationGroupBox.Location = new System.Drawing.Point(204, 12); + this.calibrationGroupBox.Name = "calibrationGroupBox"; + this.calibrationGroupBox.Size = new System.Drawing.Size(208, 86); + this.calibrationGroupBox.TabIndex = 7; + this.calibrationGroupBox.TabStop = false; + this.calibrationGroupBox.Text = "Calibration"; + // + // calibValidDateLabel + // + this.calibValidDateLabel.AutoSize = true; + this.calibValidDateLabel.Location = new System.Drawing.Point(17, 62); + this.calibValidDateLabel.Name = "calibValidDateLabel"; + this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); + this.calibValidDateLabel.TabIndex = 14; + this.calibValidDateLabel.Text = "Valid until"; + // + // calibDateLabel + // + this.calibDateLabel.AutoSize = true; + this.calibDateLabel.Location = new System.Drawing.Point(17, 40); + this.calibDateLabel.Name = "calibDateLabel"; + this.calibDateLabel.Size = new System.Drawing.Size(30, 13); + this.calibDateLabel.TabIndex = 12; + this.calibDateLabel.Text = "Date"; + // + // calibCertificateNrTextBox + // + this.calibCertificateNrTextBox.Enabled = false; + this.calibCertificateNrTextBox.Location = new System.Drawing.Point(120, 15); + this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; + this.calibCertificateNrTextBox.Size = new System.Drawing.Size(82, 20); + this.calibCertificateNrTextBox.TabIndex = 11; + // + // calibCertificateNrLabel + // + this.calibCertificateNrLabel.AutoSize = true; + this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18); + this.calibCertificateNrLabel.Name = "calibCertificateNrLabel"; + this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13); + this.calibCertificateNrLabel.TabIndex = 10; + this.calibCertificateNrLabel.Text = "Certificate"; + // + // testGroupBox + // + this.testGroupBox.Controls.Add(this.correctedTextBox); + this.testGroupBox.Controls.Add(this.measuredTextBox); + this.testGroupBox.Controls.Add(this.correctedLabel); + this.testGroupBox.Controls.Add(this.measuredLabel); + this.testGroupBox.Location = new System.Drawing.Point(428, 12); + this.testGroupBox.Name = "testGroupBox"; + this.testGroupBox.Size = new System.Drawing.Size(157, 86); + this.testGroupBox.TabIndex = 4; + this.testGroupBox.TabStop = false; + this.testGroupBox.Text = "Test"; + // + // correctedTextBox + // + this.correctedTextBox.Location = new System.Drawing.Point(74, 49); + this.correctedTextBox.Name = "correctedTextBox"; + this.correctedTextBox.ReadOnly = true; + this.correctedTextBox.Size = new System.Drawing.Size(73, 20); + this.correctedTextBox.TabIndex = 5; + // + // measuredTextBox + // + this.measuredTextBox.Location = new System.Drawing.Point(74, 24); + this.measuredTextBox.Name = "measuredTextBox"; + this.measuredTextBox.Size = new System.Drawing.Size(73, 20); + this.measuredTextBox.TabIndex = 4; + this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged); + // + // correctedLabel + // + this.correctedLabel.AutoSize = true; + this.correctedLabel.Location = new System.Drawing.Point(7, 52); + this.correctedLabel.Name = "correctedLabel"; + this.correctedLabel.Size = new System.Drawing.Size(53, 13); + this.correctedLabel.TabIndex = 3; + this.correctedLabel.Text = "Corrected"; + // + // measuredLabel + // + this.measuredLabel.AutoSize = true; + this.measuredLabel.Location = new System.Drawing.Point(6, 31); + this.measuredLabel.Name = "measuredLabel"; + this.measuredLabel.Size = new System.Drawing.Size(54, 13); + this.measuredLabel.TabIndex = 2; + this.measuredLabel.Text = "Measured"; + // + // componentLabel + // + this.componentLabel.AutoSize = true; + this.componentLabel.Location = new System.Drawing.Point(14, 17); + this.componentLabel.Name = "componentLabel"; + this.componentLabel.Size = new System.Drawing.Size(64, 13); + this.componentLabel.TabIndex = 1; + this.componentLabel.Text = "Component:"; + // + // cmpntNameLabel + // + this.cmpntNameLabel.AutoSize = true; + this.cmpntNameLabel.Location = new System.Drawing.Point(97, 17); + this.cmpntNameLabel.Name = "cmpntNameLabel"; + this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13); + this.cmpntNameLabel.TabIndex = 0; + this.cmpntNameLabel.Text = "componentName"; + // + // listViewEx + // + this.listViewEx.AllowColumnReorder = true; + this.listViewEx.Dock = System.Windows.Forms.DockStyle.Fill; + this.listViewEx.DoubleClickActivation = false; + this.listViewEx.FullRowSelect = true; + this.listViewEx.GridLines = true; + this.listViewEx.Location = new System.Drawing.Point(0, 0); + this.listViewEx.Name = "listViewEx"; + this.listViewEx.Size = new System.Drawing.Size(600, 186); + this.listViewEx.TabIndex = 0; + this.listViewEx.UseCompatibleStateImageBehavior = false; + this.listViewEx.View = System.Windows.Forms.View.Details; + this.listViewEx.SelectedIndexChanged += new System.EventHandler(this.listViewEx_SelectedIndexChanged); + // + // calibExpirationDateTimePicker + // + this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibExpirationDateTimePicker.Enabled = false; + this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(120, 59); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibExpirationDateTimePicker.TabIndex = 19; + // + // calibDateTimePicker + // + this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy"; + this.calibDateTimePicker.Enabled = false; + this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.calibDateTimePicker.Location = new System.Drawing.Point(120, 37); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); + this.calibDateTimePicker.TabIndex = 18; + // + // MetrologyDlgTempMeterTab + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.splitContainer1); + this.Name = "MetrologyDlgTempMeterTab"; + this.Size = new System.Drawing.Size(600, 300); + this.Load += new System.EventHandler(this.MetrologyDlgTempMeterTab_Load); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel1.PerformLayout(); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.calibrationGroupBox.ResumeLayout(false); + this.calibrationGroupBox.PerformLayout(); + this.testGroupBox.ResumeLayout(false); + this.testGroupBox.PerformLayout(); + this.ResumeLayout(false); } @@ -178,6 +259,13 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.TextBox measuredTextBox; private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; + private System.Windows.Forms.GroupBox calibrationGroupBox; + private System.Windows.Forms.Label calibValidDateLabel; + private System.Windows.Forms.Label calibDateLabel; + private System.Windows.Forms.TextBox calibCertificateNrTextBox; + private System.Windows.Forms.Label calibCertificateNrLabel; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs index 694088dfb..bbb0dac36 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2017-2019 Sensus Slovensko a.s. +/// Copyright (c) 2017-2020 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -28,6 +28,11 @@ namespace TBF.UI.Bench.Metrology set { meterEntity = value; } } + /// + /// Balance configuration (with buoyancy parameters) + /// + public BenchControl.GenericDevices.ICalibInfoCfg CalibInfoCfg; + /// /// A list of 'measurement-correction' pairs to be deleted from the database on OK. /// @@ -47,8 +52,13 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgTempMeterTab() { InitializeComponent(); - toBeRemoved = new List(); - } + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + toBeRemoved = new List(); + unlocked = false; + } private void MetrologyDlgTempMeterTab_Load(object sender, System.EventArgs e) { @@ -56,16 +66,11 @@ namespace TBF.UI.Bench.Metrology parent = ParentForm as MetrologyDlg; + Localize(); + /// Panel1 cmpntNameLabel.Text = meterEntity.Name; - componentLabel.Text = Strings.Component; - testGroupBox.Text = Strings.Test_measured_corrected; - measuredLabel.Text = Strings.Measured; - correctedLabel.Text = Strings.Corrected; - measuredTextBox.Text = string.Empty; - correctedTextBox.Text = string.Empty; - /// Panel2 this.Controls.Add(measurementTextBox = new TextBox()); this.Controls.Add(correctionTextBox = new TextBox()); @@ -82,9 +87,31 @@ namespace TBF.UI.Bench.Metrology RefreshAll(); } + void Localize() + { + componentLabel.Text = Strings.Component; + testGroupBox.Text = Strings.Test_measured_corrected; + measuredLabel.Text = Strings.Measured; + correctedLabel.Text = Strings.Corrected; + measuredTextBox.Text = string.Empty; + correctedTextBox.Text = string.Empty; + + calibrationGroupBox.Text = Strings.Calibration; + calibCertificateNrLabel.Text = Strings.Certificate; + calibDateLabel.Text = Strings.Date; + calibValidDateLabel.Text = Strings.Valid_until; + } + void RefreshAll() { - listViewEx.Items.Clear(); + if (CalibInfoCfg != null) + { + calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr; + calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate; + } + + listViewEx.Items.Clear(); foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr); } @@ -208,6 +235,10 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; + calibCertificateNrTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; + if (listViewEx.SelectedItems.Count == 1) { int ix = listViewEx.SelectedIndices[0]; @@ -219,7 +250,26 @@ namespace TBF.UI.Bench.Metrology public void OkBtnClicked() { - } + if (CalibInfoCfg != null) + { + try + { + CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; + CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; + CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + + Component modified = CalibInfoCfg.CreateDbEntity(); + MeterEntity.Parameters = modified.Parameters; + } + catch + { + MessageBox.Show(Strings.Invalid_calib_info_Correct_pls, + Strings.Error, + MessageBoxButtons.OK, + MessageBoxIcon.Exclamation); + } + } + } public void CancelBtnClicked() { diff --git a/TBF/UI/Constants.cs b/TBF/UI/Constants.cs index da1aa039b..a55f4518a 100644 --- a/TBF/UI/Constants.cs +++ b/TBF/UI/Constants.cs @@ -1,4 +1,5 @@ - +using System; + namespace TBF.UI { public static class Constants @@ -6,5 +7,6 @@ namespace TBF.UI public const int Dpi100pct = 96; public const string DateFormat = "dd.MM.yyyy"; public const string DateTimeFormat = "dd.MM.yyyy HH:mm"; + public static readonly DateTime MinDate = new DateTime(1753, 1, 1); } } diff --git a/TBF/UI/Help/AboutDlg.cs b/TBF/UI/Help/AboutDlg.cs index e99f99f91..ab37dad8b 100644 --- a/TBF/UI/Help/AboutDlg.cs +++ b/TBF/UI/Help/AboutDlg.cs @@ -28,7 +28,7 @@ namespace TBF.UI.Help Text = Strings.About_Test_Bench_Framework; copyrightLabel.Text = string.Format(Strings.CopyrightStr, DateTime.Now.Year); versionLabel.Text = String.Format(Strings.VersionStr, Program.Version); - buildDateLabel.Text = String.Format(Strings.BuildDateStr, Program.BuildDateTime.ToShortDateString()); + buildDateLabel.Text = String.Format(Strings.BuildDateStr, Program.BuildDateTime.ToString(Constants.DateFormat)); closeButton.Text = Strings.CloseBtnText; byte[] sha1 = (new SHA1CryptoServiceProvider()).ComputeHash(Encoding.Default.GetBytes("nejaky text")); /// TODO: calculate SHA1 of real data diff --git a/TBF/UI/ResultsMI/PreviousResultCtrl.cs b/TBF/UI/ResultsMI/PreviousResultCtrl.cs index adf8c6f9e..cd73ec34d 100644 --- a/TBF/UI/ResultsMI/PreviousResultCtrl.cs +++ b/TBF/UI/ResultsMI/PreviousResultCtrl.cs @@ -44,8 +44,8 @@ namespace TBF.UI.ResultsMI Sent = sent; batchNrLabel.Text = BatchNr.ToString(); - startTimeLabel.Text = string.Format("{0} {1}", StarTime.ToShortDateString(), StarTime.ToShortTimeString()); - endTimeLabel.Text = string.Format("{0} {1}", EndTime.ToShortDateString(), EndTime.ToShortTimeString()); + startTimeLabel.Text = StarTime.ToString(Constants.DateTimeFormat); + endTimeLabel.Text = EndTime.ToString(Constants.DateTimeFormat); swVerLabel.Text = Ver; procedureLabel.Text = ProcedureName; purchaseOrderLabel.Text = PurchaseOrder;