diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs index eb94fff40..c575251a0 100644 --- a/TBF/Properties/AssemblyInfo.cs +++ b/TBF/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Build Number // Revision // -[assembly: AssemblyVersion("2.33.2105.0")] -[assembly: AssemblyFileVersion("2.33.2105.0")] +[assembly: AssemblyVersion("2.33.2110.0")] +[assembly: AssemblyFileVersion("2.33.2110.0")] diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs index a21be3f94..43c6da16c 100644 --- a/TBF/Resources/Strings.Designer.cs +++ b/TBF/Resources/Strings.Designer.cs @@ -294,6 +294,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to All files. + /// + internal static string All_files { + get { + return ResourceManager.GetString("All_files", resourceCulture); + } + } + /// /// Looks up a localized string similar to All tests must be completed. /// @@ -645,6 +654,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to Calibration certificate. + /// + internal static string Calibration_certificate { + get { + return ResourceManager.GetString("Calibration_certificate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Calibration certificate validity expired. /// @@ -3624,6 +3642,15 @@ namespace TBF.Resources { } } + /// + /// Looks up a localized string similar to PDF files. + /// + internal static string PDF_files { + get { + return ResourceManager.GetString("PDF_files", resourceCulture); + } + } + /// /// Looks up a localized string similar to PID. /// diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx index 2e96676d4..ff02d4b41 100644 --- a/TBF/Resources/Strings.cs.resx +++ b/TBF/Resources/Strings.cs.resx @@ -673,7 +673,7 @@ Tiskárna - Prodedura + Procedura Procedury @@ -1177,7 +1177,7 @@ Tisk výsledků - Jméno postupu + Jméno procedury Proces @@ -1692,4 +1692,13 @@ Odemknout vypnutí kontroly + + Všechny soubory + + + Kalibrační certifikát + + + PDF soubory + \ No newline at end of file diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx index c1beccb10..9f35e5fbb 100644 --- a/TBF/Resources/Strings.resx +++ b/TBF/Resources/Strings.resx @@ -2326,4 +2326,13 @@ Error reading configuration database + + All files + + + Calibration certificate + + + PDF files + \ No newline at end of file diff --git a/TBF/Rig/DataContainers/BenchInfo/iPerl/ComponentCfg.cs b/TBF/Rig/DataContainers/BenchInfo/iPerl/ComponentCfg.cs index 8dc60e029..e7eeb0443 100644 --- a/TBF/Rig/DataContainers/BenchInfo/iPerl/ComponentCfg.cs +++ b/TBF/Rig/DataContainers/BenchInfo/iPerl/ComponentCfg.cs @@ -47,6 +47,7 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -88,6 +89,7 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl MaxTestIndex = 4; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } @@ -349,6 +351,10 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl prms.LenghtUnit = this.LenghtUnit; prms.Side = this.Side; prms.MaxTestIndex = this.MaxTestIndex; + prms.CalibCertificateNr = this.CalibCertificateNr; + prms.CertPath = this.CertPath; + prms.CalibDate = this.CalibDate; + prms.CalibValidDate = this.CalibValidDate; } public IParamsProvider Clone() diff --git a/TBF/Rig/DataContainers/Buoyancy/ComponentCfg.cs b/TBF/Rig/DataContainers/Buoyancy/ComponentCfg.cs index bad35d46f..893ca3675 100644 --- a/TBF/Rig/DataContainers/Buoyancy/ComponentCfg.cs +++ b/TBF/Rig/DataContainers/Buoyancy/ComponentCfg.cs @@ -27,6 +27,7 @@ namespace TBF.Rig.DataContainers.Buoyancy /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -50,6 +51,7 @@ namespace TBF.Rig.DataContainers.Buoyancy Buoyancy = 1.00103; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } @@ -112,6 +114,10 @@ namespace TBF.Rig.DataContainers.Buoyancy void CopyContentTo(ComponentCfg prms) { prms.Buoyancy = this.Buoyancy; + prms.CalibCertificateNr = this.CalibCertificateNr; + prms.CertPath = this.CertPath; + prms.CalibDate = this.CalibDate; + prms.CalibValidDate = this.CalibValidDate; } public IParamsProvider Clone() diff --git a/TBF/Rig/DataContainers/Density/ComponentCfg.cs b/TBF/Rig/DataContainers/Density/ComponentCfg.cs index c7c1c64a0..311605da1 100644 --- a/TBF/Rig/DataContainers/Density/ComponentCfg.cs +++ b/TBF/Rig/DataContainers/Density/ComponentCfg.cs @@ -28,6 +28,7 @@ namespace TBF.Rig.DataContainers.Density /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -52,6 +53,7 @@ namespace TBF.Rig.DataContainers.Density AtTemperature = 20.0; /// °C CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } @@ -122,6 +124,10 @@ namespace TBF.Rig.DataContainers.Density { prms.RealDensity = this.RealDensity; prms.AtTemperature = this.AtTemperature; + prms.CalibCertificateNr = this.CalibCertificateNr; + prms.CertPath = this.CertPath; + prms.CalibDate = this.CalibDate; + prms.CalibValidDate = this.CalibValidDate; } public IParamsProvider Clone() diff --git a/TBF/Rig/DataContainers/Evaporation/EvaporationCfg.cs b/TBF/Rig/DataContainers/Evaporation/EvaporationCfg.cs index 124aca8d6..0b53f4511 100644 --- a/TBF/Rig/DataContainers/Evaporation/EvaporationCfg.cs +++ b/TBF/Rig/DataContainers/Evaporation/EvaporationCfg.cs @@ -21,6 +21,7 @@ namespace TBF.Rig.DataContainers.Evaporation /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -42,6 +43,7 @@ namespace TBF.Rig.DataContainers.Evaporation public void InitializeAll() { CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } diff --git a/TBF/Rig/Elde/Diverter/DiverterCfg.cs b/TBF/Rig/Elde/Diverter/DiverterCfg.cs index 241f2d904..9d58f007e 100644 --- a/TBF/Rig/Elde/Diverter/DiverterCfg.cs +++ b/TBF/Rig/Elde/Diverter/DiverterCfg.cs @@ -31,6 +31,7 @@ namespace TBF.Rig.Elde.Diverter /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -53,6 +54,7 @@ namespace TBF.Rig.Elde.Diverter ThresholdHi = 90; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } diff --git a/TBF/Rig/Elde/FlowMeter/FlowMeterCfg.cs b/TBF/Rig/Elde/FlowMeter/FlowMeterCfg.cs index 7ec0f4037..a38864ca7 100644 --- a/TBF/Rig/Elde/FlowMeter/FlowMeterCfg.cs +++ b/TBF/Rig/Elde/FlowMeter/FlowMeterCfg.cs @@ -54,6 +54,12 @@ namespace TBF.Rig.Elde.FlowMeter public string CalibCertificate3; public string CalibCertificate4; public string CalibCertificate5; + public string CertPath; + public string CertPath1; + public string CertPath2; + public string CertPath3; + public string CertPath4; + public string CertPath5; public DateTime CalibDate; public DateTime CalibDate1; public DateTime CalibDate2; @@ -166,6 +172,34 @@ namespace TBF.Rig.Elde.FlowMeter } } + public string GetCertPath(int rangeIx1) + { + switch (rangeIx1) + { + default: + case 0: return CertPath; + case 1: return CertPath1; + case 2: return CertPath2; + case 3: return CertPath3; + case 4: return CertPath4; + case 5: return CertPath5; + } + } + + public void SetCertPath(int rangeIx1, string certificate) + { + switch (rangeIx1) + { + default: + case 0: CertPath = certificate; return; + case 1: CertPath1 = certificate; return; + case 2: CertPath2 = certificate; return; + case 3: CertPath3 = certificate; return; + case 4: CertPath4 = certificate; return; + case 5: CertPath5 = certificate; return; + } + } + public DateTime GetCalibDate(int rangeIx1) { switch (rangeIx1) diff --git a/TBF/Rig/Elde/FlowMeterDewa/FlowMeterCfg.cs b/TBF/Rig/Elde/FlowMeterDewa/FlowMeterCfg.cs index 3c314ece4..c9c5c135b 100644 --- a/TBF/Rig/Elde/FlowMeterDewa/FlowMeterCfg.cs +++ b/TBF/Rig/Elde/FlowMeterDewa/FlowMeterCfg.cs @@ -1,9 +1,8 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; -using System.IO; using System.Xml.Serialization; using TBF.Rig.Generic; @@ -55,6 +54,12 @@ namespace TBF.Rig.Elde.FlowMeterDewa public string CalibCertificate3; public string CalibCertificate4; public string CalibCertificate5; + public string CertPath; + public string CertPath1; + public string CertPath2; + public string CertPath3; + public string CertPath4; + public string CertPath5; public DateTime CalibDate; public DateTime CalibDate1; public DateTime CalibDate2; @@ -167,6 +172,34 @@ namespace TBF.Rig.Elde.FlowMeterDewa } } + public string GetCertPath(int rangeIx1) + { + switch (rangeIx1) + { + default: + case 0: return CertPath; + case 1: return CertPath1; + case 2: return CertPath2; + case 3: return CertPath3; + case 4: return CertPath4; + case 5: return CertPath5; + } + } + + public void SetCertPath(int rangeIx1, string certificate) + { + switch (rangeIx1) + { + default: + case 0: CertPath = certificate; return; + case 1: CertPath1 = certificate; return; + case 2: CertPath2 = certificate; return; + case 3: CertPath3 = certificate; return; + case 4: CertPath4 = certificate; return; + case 5: CertPath5 = certificate; return; + } + } + public DateTime GetCalibDate(int rangeIx1) { switch (rangeIx1) diff --git a/TBF/Rig/Elde/FlowMeterTwins/FlowMeterCfg.cs b/TBF/Rig/Elde/FlowMeterTwins/FlowMeterCfg.cs index 30c41803e..c118d3f41 100644 --- a/TBF/Rig/Elde/FlowMeterTwins/FlowMeterCfg.cs +++ b/TBF/Rig/Elde/FlowMeterTwins/FlowMeterCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; diff --git a/TBF/Rig/Elde/PressureMeter/PressureMeterCfg.cs b/TBF/Rig/Elde/PressureMeter/PressureMeterCfg.cs index 34f4155cc..3e5c83eca 100644 --- a/TBF/Rig/Elde/PressureMeter/PressureMeterCfg.cs +++ b/TBF/Rig/Elde/PressureMeter/PressureMeterCfg.cs @@ -26,6 +26,7 @@ namespace TBF.Rig.Elde.PressureMeter /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } diff --git a/TBF/Rig/Elde/PressureMeterInternal/PressureMeterCfg.cs b/TBF/Rig/Elde/PressureMeterInternal/PressureMeterCfg.cs index 688fd15b7..d3329f36f 100644 --- a/TBF/Rig/Elde/PressureMeterInternal/PressureMeterCfg.cs +++ b/TBF/Rig/Elde/PressureMeterInternal/PressureMeterCfg.cs @@ -29,6 +29,7 @@ namespace TBF.Rig.Elde.PressureMeterInternal /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } diff --git a/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs b/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs index f6bf7ed31..1e26c7836 100644 --- a/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs +++ b/TBF/Rig/Elde/TempMeter/TempMeterCfg.cs @@ -29,6 +29,7 @@ namespace TBF.Rig.Elde.TempMeter /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -51,6 +52,7 @@ namespace TBF.Rig.Elde.TempMeter DefaultTemperature = 20.0; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } diff --git a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs index c5a6a3766..860935e8b 100644 --- a/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs +++ b/TBF/Rig/Elde/TempMeterInternal/TempMeterCfg.cs @@ -29,6 +29,7 @@ namespace TBF.Rig.Elde.TempMeterInternal /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -51,6 +52,7 @@ namespace TBF.Rig.Elde.TempMeterInternal A5 = 0; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } diff --git a/TBF/Rig/Elde/TempMeterMeret/TempMeterCfg.cs b/TBF/Rig/Elde/TempMeterMeret/TempMeterCfg.cs index cc741e8d0..97cdcf1b9 100644 --- a/TBF/Rig/Elde/TempMeterMeret/TempMeterCfg.cs +++ b/TBF/Rig/Elde/TempMeterMeret/TempMeterCfg.cs @@ -44,6 +44,7 @@ namespace TBF.Rig.Elde.TempMeterMeret /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -69,6 +70,7 @@ namespace TBF.Rig.Elde.TempMeterMeret MeretIdx0 = 4; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } @@ -172,6 +174,10 @@ namespace TBF.Rig.Elde.TempMeterMeret prms.TempIdx0 = this.TempIdx0; prms.ModbusAddress = this.ModbusAddress; prms.MeretIdx0 = this.MeretIdx0; + prms.CalibCertificateNr = this.CalibCertificateNr; + prms.CertPath = this.CertPath; + prms.CalibDate = this.CalibDate; + prms.CalibValidDate = this.CalibValidDate; } diff --git a/TBF/Rig/GenericDevices/ICalibInfoCfg.cs b/TBF/Rig/GenericDevices/ICalibInfoCfg.cs index 973896f74..1cb4e7318 100644 --- a/TBF/Rig/GenericDevices/ICalibInfoCfg.cs +++ b/TBF/Rig/GenericDevices/ICalibInfoCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2018 Sensus Metering Systems +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using TBF.Rig.Generic; @@ -11,8 +11,9 @@ namespace TBF.Rig.GenericDevices /// /// Parameters displayed in Metrology tab page /// - string CalibCertificateNr { get; set; } /// calibration certificate number - DateTime CalibDate { get; set; } /// date of calibration - DateTime CalibValidDate { get; set; } /// calibration valid until (date) + string CalibCertificateNr { get; set; } /// Calibration certificate ID + string CertPath { get; set; } /// Path to a calibration certificate PDF document + DateTime CalibDate { get; set; } /// Date of calibration + DateTime CalibValidDate { get; set; } /// Calibration is valid until (date) } } diff --git a/TBF/Rig/GenericDevices/ICalibRangesCfg.cs b/TBF/Rig/GenericDevices/ICalibRangesCfg.cs index 799ec5eac..6cd2cfce9 100644 --- a/TBF/Rig/GenericDevices/ICalibRangesCfg.cs +++ b/TBF/Rig/GenericDevices/ICalibRangesCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2018 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using TBF.Rig.Generic; @@ -20,11 +20,13 @@ namespace TBF.Rig.GenericDevices double GetPressHi(int rangeIx1); string GetCalibCertificate(int rangeIx1); /// Get calibration certificate number + string GetCertPath(int rangeIx1); /// Get path to a calibration certificate PDF document DateTime GetCalibDate(int rangeIx1); /// Get the date of calibration DateTime GetCalibValidDate(int rangeIx1); /// Get calibration valid until (date) void SetCalibCertificate(int rangeIx1, string certificate); /// Set calibration certificate number - void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration - void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date) + void SetCertPath(int rangeIx1, string certPath); /// Set path to a calibration certificate PDF document + void SetCalibDate(int rangeIx1, DateTime date); /// Set the date of calibration + void SetCalibValidDate(int rangeIx1, DateTime date); /// Set calibration valid until (date) } } diff --git a/TBF/Rig/Hart/Nivotrack/NivotrackCfg.cs b/TBF/Rig/Hart/Nivotrack/NivotrackCfg.cs index 824f909b3..6ab1f4ccb 100644 --- a/TBF/Rig/Hart/Nivotrack/NivotrackCfg.cs +++ b/TBF/Rig/Hart/Nivotrack/NivotrackCfg.cs @@ -1,13 +1,10 @@ /// -/// Copyright (c) 2018-2021 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; -using System.IO; using System.Collections.Generic; -using System.IO.Ports; using System.Xml.Serialization; using Common; -using Config.Entities; using TBF.Rig.Generic; namespace TBF.Rig.Hart.Nivotrack @@ -38,6 +35,7 @@ namespace TBF.Rig.Hart.Nivotrack /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -63,6 +61,7 @@ namespace TBF.Rig.Hart.Nivotrack Par2 = 8; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } @@ -179,6 +178,10 @@ namespace TBF.Rig.Hart.Nivotrack prms.Address = this.Address; prms.Par1 = this.Par1; prms.Par2 = this.Par2; + prms.CalibCertificateNr = this.CalibCertificateNr; + prms.CertPath = this.CertPath; + prms.CalibDate = this.CalibDate; + prms.CalibValidDate = this.CalibValidDate; } diff --git a/TBF/Rig/Keithley/TempMeter/TempMeterCfg.cs b/TBF/Rig/Keithley/TempMeter/TempMeterCfg.cs index 6b3cddb0e..3a94c3809 100644 --- a/TBF/Rig/Keithley/TempMeter/TempMeterCfg.cs +++ b/TBF/Rig/Keithley/TempMeter/TempMeterCfg.cs @@ -1,9 +1,8 @@ /// -/// Copyright (c) 2016-2021 Sensus Metering Systems +/// Copyright (c) 2016-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; -using System.IO; using System.Xml.Serialization; using TBF.Rig.Generic; @@ -37,6 +36,7 @@ namespace TBF.Rig.Keithley.TempMeter /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } diff --git a/TBF/Rig/MettlerToledo/Multi/BalanceCfg.cs b/TBF/Rig/MettlerToledo/Multi/BalanceCfg.cs index e93217177..49a11b04b 100644 --- a/TBF/Rig/MettlerToledo/Multi/BalanceCfg.cs +++ b/TBF/Rig/MettlerToledo/Multi/BalanceCfg.cs @@ -1,8 +1,7 @@ /// -/// Copyright (c) 2015-2018 Sensus Slovensko a.s. +/// Copyright (c) 2015-2023 Sensus Slovensko a.s. /// using System; -using System.IO; using System.Collections.Generic; using System.IO.Ports; using System.Xml.Serialization; @@ -48,56 +47,20 @@ namespace TBF.Rig.MettlerToledo.Multi public StopBits StopBits; public Handshake Handshake; - /// - /// Buoyancy related serialized parameters - Displayed in Metrology tab page - /// - float buoyancyTemp; - float buoyancyPress; - float buoyancyHumi; - float weightStandardDensity; - string calibCertificateNr; - DateTime calibDate; - DateTime calibValidDate; - /// - public float BuoyancyTemp - { - get { return buoyancyTemp; } - set { buoyancyTemp = value; } - } - public float BuoyancyPress - { - get { return buoyancyPress; } - set { buoyancyPress = value; } - } - public float BuoyancyHumi - { - get { return buoyancyHumi; } - set { buoyancyHumi = value; } - } - public float WeightStandardDensity - { - get { return weightStandardDensity; } - set { weightStandardDensity = value; } - } - 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; } - } - + /// Buoyancy related serialized parameters displayed in Metrology tab page + public float BuoyancyTemp { get; set; } + public float BuoyancyPress { get; set; } + public float BuoyancyHumi { get; set; } + public float WeightStandardDensity { get; set; } + + public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } + public DateTime CalibDate { get; set; } + public DateTime CalibValidDate { get; set; } + /// Private parameterless constructor invoked by all other (public) constructors - BalanceCfg() + BalanceCfg() { Name = "Balance"; ParentName = string.Empty; @@ -119,6 +82,11 @@ namespace TBF.Rig.MettlerToledo.Multi BuoyancyTemp = 20.0f; BuoyancyPress = 1.0f; BuoyancyHumi = 40.0f; + + CalibCertificateNr = string.Empty; + CertPath = string.Empty; + CalibDate = TBF.UI.Constants.MinDate; + CalibValidDate = TBF.UI.Constants.MaxDate; } public BalanceCfg(IComponentFactory factory) diff --git a/TBF/Rig/MettlerToledo/Standard/BalanceCfg.cs b/TBF/Rig/MettlerToledo/Standard/BalanceCfg.cs index 23d3ae715..1cf165a4c 100644 --- a/TBF/Rig/MettlerToledo/Standard/BalanceCfg.cs +++ b/TBF/Rig/MettlerToledo/Standard/BalanceCfg.cs @@ -1,8 +1,7 @@ /// -/// Copyright (c) 2013-2021 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; -using System.IO; using System.Collections.Generic; using System.IO.Ports; using System.Xml.Serialization; @@ -52,6 +51,7 @@ namespace TBF.Rig.MettlerToledo.Standard /// Calibration info serialized parameters displayed in Metrology tab page public string CalibCertificateNr { get; set; } + public string CertPath { get; set; } public DateTime CalibDate { get; set; } public DateTime CalibValidDate { get; set; } @@ -88,6 +88,7 @@ namespace TBF.Rig.MettlerToledo.Standard BuoyancyHumi = 40.0f; CalibCertificateNr = string.Empty; + CertPath = string.Empty; CalibDate = TBF.UI.Constants.MinDate; CalibValidDate = TBF.UI.Constants.MaxDate; } diff --git a/TBF/Rig/Modbus/PressureMeter/Meret/PressureMeterCfg.cs b/TBF/Rig/Modbus/PressureMeter/Meret/PressureMeterCfg.cs index cd200fc76..37a02cddc 100644 --- a/TBF/Rig/Modbus/PressureMeter/Meret/PressureMeterCfg.cs +++ b/TBF/Rig/Modbus/PressureMeter/Meret/PressureMeterCfg.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2016 Sensus Metering Systems +/// Copyright (c) 2016-2023 Sensus Metering Systems /// using System; using System.Collections.Generic; diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj index f8d470128..f66437d1f 100644 --- a/TBF/TBF.csproj +++ b/TBF/TBF.csproj @@ -2220,6 +2220,12 @@ SelectComponentClassDlg.cs + + UserControl + + + CalibCertificateCtrl.cs + Form @@ -2227,11 +2233,11 @@ MetrologyDlg.cs - + UserControl - - MetrologyDlgBalanceTab.cs + + MetrologyDlgScaleTab.cs UserControl @@ -3432,11 +3438,14 @@ SelectComponentClassDlg.cs + + CalibCertificateCtrl.cs + MetrologyDlg.cs - - MetrologyDlgBalanceTab.cs + + MetrologyDlgScaleTab.cs MetrologyDlgBuoyancyTab.cs diff --git a/TBF/UI/Bench/Metrology/CalibCertificateCtrl.Designer.cs b/TBF/UI/Bench/Metrology/CalibCertificateCtrl.Designer.cs new file mode 100644 index 000000000..669cbabf8 --- /dev/null +++ b/TBF/UI/Bench/Metrology/CalibCertificateCtrl.Designer.cs @@ -0,0 +1,162 @@ +namespace TBF.UI.Bench.Metrology +{ + partial class CalibCertificateCtrl + { + /// + /// 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.groupBox = new System.Windows.Forms.GroupBox(); + this.openCertificateButton = new System.Windows.Forms.Button(); + this.showCertificateButton = new System.Windows.Forms.Button(); + this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibValidDateLabel = new System.Windows.Forms.Label(); + this.calibDateLabel = new System.Windows.Forms.Label(); + this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox(); + this.certIdLabel = new System.Windows.Forms.Label(); + this.groupBox.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox + // + this.groupBox.Controls.Add(this.certIdLabel); + this.groupBox.Controls.Add(this.openCertificateButton); + this.groupBox.Controls.Add(this.showCertificateButton); + this.groupBox.Controls.Add(this.calibExpirationDateTimePicker); + this.groupBox.Controls.Add(this.calibDateTimePicker); + this.groupBox.Controls.Add(this.calibValidDateLabel); + this.groupBox.Controls.Add(this.calibDateLabel); + this.groupBox.Controls.Add(this.calibCertificateNrTextBox); + this.groupBox.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupBox.Location = new System.Drawing.Point(0, 0); + this.groupBox.Name = "groupBox"; + this.groupBox.Size = new System.Drawing.Size(240, 100); + this.groupBox.TabIndex = 0; + this.groupBox.TabStop = false; + this.groupBox.Text = "Calibration certificate"; + // + // openCertificateButton + // + this.openCertificateButton.Enabled = false; + this.openCertificateButton.Location = new System.Drawing.Point(177, 22); + this.openCertificateButton.Name = "openCertificateButton"; + this.openCertificateButton.Size = new System.Drawing.Size(56, 26); + this.openCertificateButton.TabIndex = 28; + this.openCertificateButton.Text = "Path"; + this.openCertificateButton.UseVisualStyleBackColor = true; + this.openCertificateButton.Click += new System.EventHandler(this.openCertificateButton_Click); + // + // showCertificateButton + // + this.showCertificateButton.Location = new System.Drawing.Point(177, 48); + this.showCertificateButton.Name = "showCertificateButton"; + this.showCertificateButton.Size = new System.Drawing.Size(56, 39); + this.showCertificateButton.TabIndex = 27; + this.showCertificateButton.Text = "Show"; + this.showCertificateButton.UseVisualStyleBackColor = true; + this.showCertificateButton.Click += new System.EventHandler(this.showCertificateButton_Click); + // + // 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(74, 67); + this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker"; + this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(97, 20); + this.calibExpirationDateTimePicker.TabIndex = 26; + // + // 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(74, 45); + this.calibDateTimePicker.Name = "calibDateTimePicker"; + this.calibDateTimePicker.Size = new System.Drawing.Size(97, 20); + this.calibDateTimePicker.TabIndex = 25; + // + // calibValidDateLabel + // + this.calibValidDateLabel.AutoSize = true; + this.calibValidDateLabel.Location = new System.Drawing.Point(9, 70); + this.calibValidDateLabel.Name = "calibValidDateLabel"; + this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13); + this.calibValidDateLabel.TabIndex = 24; + this.calibValidDateLabel.Text = "Valid until"; + // + // calibDateLabel + // + this.calibDateLabel.AutoSize = true; + this.calibDateLabel.Location = new System.Drawing.Point(9, 48); + this.calibDateLabel.Name = "calibDateLabel"; + this.calibDateLabel.Size = new System.Drawing.Size(30, 13); + this.calibDateLabel.TabIndex = 23; + this.calibDateLabel.Text = "Date"; + // + // calibCertificateNrTextBox + // + this.calibCertificateNrTextBox.Enabled = false; + this.calibCertificateNrTextBox.Location = new System.Drawing.Point(74, 23); + this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox"; + this.calibCertificateNrTextBox.Size = new System.Drawing.Size(97, 20); + this.calibCertificateNrTextBox.TabIndex = 22; + // + // certIdLabel + // + this.certIdLabel.AutoSize = true; + this.certIdLabel.Location = new System.Drawing.Point(9, 26); + this.certIdLabel.Name = "certIdLabel"; + this.certIdLabel.Size = new System.Drawing.Size(18, 13); + this.certIdLabel.TabIndex = 29; + this.certIdLabel.Text = "ID"; + // + // CalibCertificateCtrl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox); + this.Name = "CalibCertificateCtrl"; + this.Size = new System.Drawing.Size(240, 100); + this.groupBox.ResumeLayout(false); + this.groupBox.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBox; + private System.Windows.Forms.Button openCertificateButton; + private System.Windows.Forms.Button showCertificateButton; + private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; + private System.Windows.Forms.DateTimePicker calibDateTimePicker; + private System.Windows.Forms.Label calibValidDateLabel; + private System.Windows.Forms.Label calibDateLabel; + private System.Windows.Forms.TextBox calibCertificateNrTextBox; + private System.Windows.Forms.Label certIdLabel; + } +} diff --git a/TBF/UI/Bench/Metrology/CalibCertificateCtrl.cs b/TBF/UI/Bench/Metrology/CalibCertificateCtrl.cs new file mode 100644 index 000000000..b2821c293 --- /dev/null +++ b/TBF/UI/Bench/Metrology/CalibCertificateCtrl.cs @@ -0,0 +1,140 @@ +/// +/// Copyright (c) 2023 Sensus Slovensko a.s. +/// +using System; +using System.IO; +using System.Windows.Forms; +using TBF.Resources; +using TBF.Rig.GenericDevices; + +namespace TBF.UI.Bench.Metrology +{ + public partial class CalibCertificateCtrl : UserControl + { + string certPath; /// Path to a calibration certificate PDF document + ToolTip toolTip; + + public CalibCertificateCtrl() + { + InitializeComponent(); + Localize(); + + certPath = string.Empty; + calibDateTimePicker.CustomFormat = Constants.DateFormat; + calibDateTimePicker.MinDate = Constants.MinDate; + calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; + calibExpirationDateTimePicker.MinDate = Constants.MinDate; + + toolTip = new ToolTip(); + toolTip.UseFading = true; + toolTip.UseAnimation = true; + toolTip.IsBalloon = true; + toolTip.ShowAlways = true; + toolTip.AutoPopDelay = 1000; + toolTip.InitialDelay = 1000; + toolTip.ReshowDelay = 500; + toolTip.SetToolTip(showCertificateButton, certPath); + } + + void Localize() + { + groupBox.Text = Strings.Calibration_certificate; + calibDateLabel.Text = Strings.Date; + calibValidDateLabel.Text = Strings.Valid_until; + showCertificateButton.Text = Strings.Show; + } + + public void Unlock() + { + calibCertificateNrTextBox.Enabled = true; + calibDateTimePicker.Enabled = true; + calibExpirationDateTimePicker.Enabled = true; + openCertificateButton.Enabled = true; + showCertificateButton.Enabled = true; + } + + public void Refresh(ICalibInfoCfg calibInfoCfg) + { + calibCertificateNrTextBox.Text = calibInfoCfg.CalibCertificateNr; + certPath = calibInfoCfg.CertPath; + calibDateTimePicker.Value = (calibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : calibInfoCfg.CalibDate; + calibExpirationDateTimePicker.Value = (calibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : calibInfoCfg.CalibValidDate; + + toolTip.SetToolTip(showCertificateButton, certPath); + } + + public void Update(ICalibInfoCfg calibInfoCfg) + { + calibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; + calibInfoCfg.CertPath = certPath; + calibInfoCfg.CalibDate = calibDateTimePicker.Value; + calibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value; + } + + public void Refresh(ICalibRangesCfg calibRangesCfg, int rngIx) + { + calibCertificateNrTextBox.Text = calibRangesCfg.GetCalibCertificate(rngIx); + certPath = calibRangesCfg.GetCertPath(rngIx); + calibDateTimePicker.Value = (calibRangesCfg.GetCalibDate(rngIx) < Constants.MinDate) ? Constants.MinDate : calibRangesCfg.GetCalibDate(rngIx); + calibExpirationDateTimePicker.Value = (calibRangesCfg.GetCalibValidDate(rngIx) < Constants.MinDate) ? Constants.MinDate : calibRangesCfg.GetCalibValidDate(rngIx); + + toolTip.SetToolTip(showCertificateButton, certPath); + } + + public void Update(ICalibRangesCfg calibRangesCfg, int rngIx) + { + calibRangesCfg.SetCalibCertificate(rngIx, calibCertificateNrTextBox.Text); + calibRangesCfg.SetCertPath(rngIx, certPath); + calibRangesCfg.SetCalibDate(rngIx, calibDateTimePicker.Value); + calibRangesCfg.SetCalibValidDate(rngIx, calibExpirationDateTimePicker.Value); + + } + + private void openCertificateButton_Click(object sender, EventArgs e) + { + var openFileDialog = new OpenFileDialog() + { + CheckFileExists = true, + InitialDirectory = @"C:\TBF\Certificates", + Filter = string.Format("{0} (*.pdf)|*.pdf|{1} (*.*)|*.*", Strings.PDF_files, Strings.All_files), + }; + + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + certPath = openFileDialog.FileName; + toolTip.SetToolTip(showCertificateButton, certPath); + } + } + + private void showCertificateButton_Click(object sender, EventArgs e) + { + var apps = new string[] { @"C:\Program Files\Microsoft\Edge\Application\msedge.exe", + @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", + @"C:\Program Files\Mozilla Firefox\firefox.exe", + @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe", + @"C:\Program Files\Google\Chrome\Application\chrome.exe", + @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" }; + + if (!string.IsNullOrEmpty(certPath) && File.Exists(certPath)) + { + foreach (var app in apps) + { + if (File.Exists(app)) + { + using (var process = new System.Diagnostics.Process()) + { + process.StartInfo.FileName = app; + process.StartInfo.Arguments = certPath.Replace(" ", "%20"); ///argument + process.StartInfo.UseShellExecute = false; + process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal; + process.Start(); + } + + break; + } + } + } + } + } +} diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.resx b/TBF/UI/Bench/Metrology/CalibCertificateCtrl.resx similarity index 100% rename from TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.resx rename to TBF/UI/Bench/Metrology/CalibCertificateCtrl.resx diff --git a/TBF/UI/Bench/Metrology/MetrologyDlg.cs b/TBF/UI/Bench/Metrology/MetrologyDlg.cs index 5902d7526..7343b172d 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlg.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlg.cs @@ -105,7 +105,7 @@ namespace TBF.UI.Bench.Metrology { balancesCount++; TabPage tabPage = new TabPage(" " + cmpnt.Name + " "); - MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab(); + MetrologyDlgScaleTab uiControl = new MetrologyDlgScaleTab(); uiControl.MeterEntity = cmpnt; uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as Rig.GenericDevices.IScaleCfg; uiControl.Dock = DockStyle.Fill; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.Designer.cs index 339510762..7c51db7c5 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.cs index 0311dacf1..4aef07327 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgBuoyancyTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2019 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// using System; using System.Collections.Generic; diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs index c0b776197..eef4840cb 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,23 +32,16 @@ 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(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.SuspendLayout(); // // splitContainer1 @@ -61,7 +54,7 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox); this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel); this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox); @@ -69,63 +62,13 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel1.Controls.Add(this.densityTextBox); this.splitContainer1.Panel1.Controls.Add(this.densityLabel); this.splitContainer1.Size = new System.Drawing.Size(554, 300); - this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.SplitterDistance = 112; 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, 81); + this.densityCorrTextBox.Location = new System.Drawing.Point(178, 81); this.densityCorrTextBox.Name = "densityCorrTextBox"; this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20); this.densityCorrTextBox.TabIndex = 5; @@ -133,7 +76,7 @@ namespace TBF.UI.Bench.Metrology // densityCorrLabel // this.densityCorrLabel.AutoSize = true; - this.densityCorrLabel.Location = new System.Drawing.Point(37, 84); + this.densityCorrLabel.Location = new System.Drawing.Point(30, 84); this.densityCorrLabel.Name = "densityCorrLabel"; this.densityCorrLabel.Size = new System.Drawing.Size(132, 13); this.densityCorrLabel.TabIndex = 4; @@ -142,7 +85,7 @@ namespace TBF.UI.Bench.Metrology // temperatureTextBox // this.temperatureTextBox.Enabled = false; - this.temperatureTextBox.Location = new System.Drawing.Point(185, 43); + this.temperatureTextBox.Location = new System.Drawing.Point(178, 43); this.temperatureTextBox.Name = "temperatureTextBox"; this.temperatureTextBox.Size = new System.Drawing.Size(110, 20); this.temperatureTextBox.TabIndex = 3; @@ -151,7 +94,7 @@ namespace TBF.UI.Bench.Metrology // temperatureLabel // this.temperatureLabel.AutoSize = true; - this.temperatureLabel.Location = new System.Drawing.Point(37, 46); + this.temperatureLabel.Location = new System.Drawing.Point(30, 46); this.temperatureLabel.Name = "temperatureLabel"; this.temperatureLabel.Size = new System.Drawing.Size(112, 13); this.temperatureLabel.TabIndex = 2; @@ -160,7 +103,7 @@ namespace TBF.UI.Bench.Metrology // densityTextBox // this.densityTextBox.Enabled = false; - this.densityTextBox.Location = new System.Drawing.Point(185, 17); + this.densityTextBox.Location = new System.Drawing.Point(178, 17); this.densityTextBox.Name = "densityTextBox"; this.densityTextBox.Size = new System.Drawing.Size(110, 20); this.densityTextBox.TabIndex = 1; @@ -169,31 +112,18 @@ namespace TBF.UI.Bench.Metrology // densityLabel // this.densityLabel.AutoSize = true; - this.densityLabel.Location = new System.Drawing.Point(37, 20); + this.densityLabel.Location = new System.Drawing.Point(30, 20); this.densityLabel.Name = "densityLabel"; this.densityLabel.Size = new System.Drawing.Size(82, 13); this.densityLabel.TabIndex = 0; this.densityLabel.Text = "Density [kg/m3]"; // - // calibExpirationDateTimePicker + // calibCertificateCtrl // - 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; + this.calibCertificateCtrl.Location = new System.Drawing.Point(307, 7); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 6; // // MetrologyDlgDensityTab // @@ -207,8 +137,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); this.ResumeLayout(false); } @@ -222,12 +150,6 @@ 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; - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs index af92ed948..fc93c9607 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDensityTab.cs @@ -1,11 +1,12 @@ /// -/// Copyright (c) 2013-2019 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Windows.Forms; using log4net; using Common; +using Config; using Config.Entities; using TBF.Resources; @@ -32,16 +33,11 @@ namespace TBF.UI.Bench.Metrology public IList ToBeRemoved { get; set; } MetrologyDlg parent; - bool unlocked; - bool valuesModified; + bool valuesModified; public MetrologyDlgDensityTab() { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; ToBeRemoved = new List(); valuesModified = false; } @@ -55,9 +51,9 @@ namespace TBF.UI.Bench.Metrology Localize(); /// Panel1 - densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Common.Unit.kgpm3.ToDescription()); - temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Common.Unit.C.ToDescription()); - densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Common.Unit.kgpm3.ToDescription()); + densityLabel.Text = string.Format("{0} [{1}]", Strings.Density, Unit.kgpm3.ToDescription()); + temperatureLabel.Text = string.Format("{0} [{1}]", Strings.At_temperature, Unit.C.ToDescription()); + densityCorrLabel.Text = string.Format("{0} [{1}]", Strings.Density_correction, Unit.kgpm3.ToDescription()); /// Panel2 @@ -66,22 +62,16 @@ namespace TBF.UI.Bench.Metrology void Localize() { - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; } - void RefreshAll() + void RefreshAll() { if (DensityCfg != null) { densityTextBox.Text = DensityCfg.RealDensity.ToString(); temperatureTextBox.Text = DensityCfg.AtTemperature.ToString(); - densityCorrTextBox.Text = Config.Formulas.DensityCorrection(DensityCfg.RealDensity, DensityCfg.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; + densityCorrTextBox.Text = Formulas.DensityCorrection(DensityCfg.RealDensity, DensityCfg.AtTemperature).ToString("F5"); + calibCertificateCtrl.Refresh(DensityCfg); } } @@ -89,9 +79,7 @@ namespace TBF.UI.Bench.Metrology { densityTextBox.Enabled = true; temperatureTextBox.Enabled = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); } public void OkBtnClicked() @@ -106,9 +94,7 @@ namespace TBF.UI.Bench.Metrology Config.Data.AtTemperature = DensityCfg.AtTemperature = Utils.ParseUDouble(temperatureTextBox.Text); } - DensityCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - DensityCfg.CalibDate = calibDateTimePicker.Value.Date; - DensityCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + calibCertificateCtrl.Update(DensityCfg); Component modified = DensityCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; @@ -157,7 +143,7 @@ namespace TBF.UI.Bench.Metrology if (Utils.TryParseUDouble(densityTextBox.Text, out density) && Utils.TryParseUDouble(temperatureTextBox.Text, out temp)) { - densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString(); + densityCorrTextBox.Text = Formulas.DensityCorrection(density, temp).ToString(); } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs index a529308f8..98de66e8e 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2023 Sensus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,11 +32,6 @@ 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.nameGroupBox = new System.Windows.Forms.GroupBox(); this.pressFromToLabel = new System.Windows.Forms.Label(); this.tempFromToLabel = new System.Windows.Forms.Label(); @@ -47,13 +42,11 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Common.Forms.ListViewEx(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.nameGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); this.SuspendLayout(); @@ -68,7 +61,7 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); // @@ -76,59 +69,9 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 400); - this.splitContainer1.SplitterDistance = 102; + this.splitContainer1.SplitterDistance = 112; 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(186, 10); - this.calibrationGroupBox.Name = "calibrationGroupBox"; - this.calibrationGroupBox.Size = new System.Drawing.Size(228, 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(140, 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(69, 13); - this.calibCertificateNrLabel.TabIndex = 10; - this.calibCertificateNrLabel.Text = "Certificate nr."; - // // nameGroupBox // this.nameGroupBox.Controls.Add(this.pressFromToLabel); @@ -136,7 +79,7 @@ namespace TBF.UI.Bench.Metrology 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(160, 86); + this.nameGroupBox.Size = new System.Drawing.Size(160, 99); this.nameGroupBox.TabIndex = 5; this.nameGroupBox.TabStop = false; this.nameGroupBox.Text = "Component"; @@ -172,16 +115,16 @@ namespace TBF.UI.Bench.Metrology 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(424, 10); + this.testGroupBox.Location = new System.Drawing.Point(428, 10); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(170, 88); + this.testGroupBox.Size = new System.Drawing.Size(170, 99); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Correction test"; // // correctedTextBox // - this.correctedTextBox.Location = new System.Drawing.Point(91, 37); + this.correctedTextBox.Location = new System.Drawing.Point(87, 54); this.correctedTextBox.Name = "correctedTextBox"; this.correctedTextBox.ReadOnly = true; this.correctedTextBox.Size = new System.Drawing.Size(73, 20); @@ -189,7 +132,7 @@ namespace TBF.UI.Bench.Metrology // // measuredTextBox // - this.measuredTextBox.Location = new System.Drawing.Point(91, 15); + this.measuredTextBox.Location = new System.Drawing.Point(87, 28); this.measuredTextBox.Name = "measuredTextBox"; this.measuredTextBox.Size = new System.Drawing.Size(73, 20); this.measuredTextBox.TabIndex = 4; @@ -198,7 +141,7 @@ namespace TBF.UI.Bench.Metrology // correctedLabel // this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(17, 40); + this.correctedLabel.Location = new System.Drawing.Point(13, 57); this.correctedLabel.Name = "correctedLabel"; this.correctedLabel.Size = new System.Drawing.Size(53, 13); this.correctedLabel.TabIndex = 3; @@ -207,7 +150,7 @@ namespace TBF.UI.Bench.Metrology // measuredLabel // this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(17, 18); + this.measuredLabel.Location = new System.Drawing.Point(13, 31); this.measuredLabel.Name = "measuredLabel"; this.measuredLabel.Size = new System.Drawing.Size(54, 13); this.measuredLabel.TabIndex = 2; @@ -220,33 +163,21 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 294); + this.listViewEx.Size = new System.Drawing.Size(650, 284); 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 + // calibCertificateCtrl // - 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; + this.calibCertificateCtrl.Location = new System.Drawing.Point(182, 10); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 6; // // MetrologyDlgDiverterTab // @@ -260,8 +191,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); this.nameGroupBox.ResumeLayout(false); this.nameGroupBox.PerformLayout(); this.testGroupBox.ResumeLayout(false); @@ -281,15 +210,8 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; - 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.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; - private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; - private System.Windows.Forms.DateTimePicker calibDateTimePicker; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs index 2c1682f30..463840ed3 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgDiverterTab.cs @@ -1,13 +1,13 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; using log4net; -using Config.Entities; using Common.Forms; +using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -52,10 +52,6 @@ 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; } @@ -97,11 +93,6 @@ namespace TBF.UI.Bench.Metrology { nameGroupBox.Text = Strings.Component; - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; - testGroupBox.Text = Strings.Test_measured_corrected; measuredLabel.Text = Strings.Measured; correctedLabel.Text = Strings.Corrected; @@ -111,9 +102,7 @@ namespace TBF.UI.Bench.Metrology { 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; + calibCertificateCtrl.Refresh(CalibInfoCfg); } listViewEx.Items.Clear(); @@ -209,9 +198,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -228,10 +215,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; - CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; - + calibCertificateCtrl.Update(CalibInfoCfg); Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; } @@ -332,7 +316,7 @@ namespace TBF.UI.Bench.Metrology CultureInfo.InvariantCulture, out measured)) { - double corrected = MeasurementCorrection.CorrectedValue(measured, meterEntity.Corrections); + double corrected = MeasurementCorrection.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs index a7f85f94c..504242844 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2023 Sensus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,11 +32,6 @@ 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.nameGroupBox = new System.Windows.Forms.GroupBox(); this.pressFromToLabel = new System.Windows.Forms.Label(); this.tempFromToLabel = new System.Windows.Forms.Label(); @@ -47,13 +42,11 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Common.Forms.ListViewEx(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.nameGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); this.SuspendLayout(); @@ -68,7 +61,7 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); // @@ -76,59 +69,9 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 400); - this.splitContainer1.SplitterDistance = 102; + this.splitContainer1.SplitterDistance = 112; 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(186, 10); - this.calibrationGroupBox.Name = "calibrationGroupBox"; - this.calibrationGroupBox.Size = new System.Drawing.Size(228, 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(140, 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(69, 13); - this.calibCertificateNrLabel.TabIndex = 10; - this.calibCertificateNrLabel.Text = "Certificate nr."; - // // nameGroupBox // this.nameGroupBox.Controls.Add(this.pressFromToLabel); @@ -136,7 +79,7 @@ namespace TBF.UI.Bench.Metrology 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(160, 86); + this.nameGroupBox.Size = new System.Drawing.Size(160, 99); this.nameGroupBox.TabIndex = 5; this.nameGroupBox.TabStop = false; this.nameGroupBox.Text = "Component"; @@ -172,16 +115,16 @@ namespace TBF.UI.Bench.Metrology 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(424, 10); + this.testGroupBox.Location = new System.Drawing.Point(429, 10); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(170, 88); + this.testGroupBox.Size = new System.Drawing.Size(170, 99); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Correction test"; // // correctedTextBox // - this.correctedTextBox.Location = new System.Drawing.Point(91, 37); + this.correctedTextBox.Location = new System.Drawing.Point(91, 50); this.correctedTextBox.Name = "correctedTextBox"; this.correctedTextBox.ReadOnly = true; this.correctedTextBox.Size = new System.Drawing.Size(73, 20); @@ -189,7 +132,7 @@ namespace TBF.UI.Bench.Metrology // // measuredTextBox // - this.measuredTextBox.Location = new System.Drawing.Point(91, 15); + this.measuredTextBox.Location = new System.Drawing.Point(91, 25); this.measuredTextBox.Name = "measuredTextBox"; this.measuredTextBox.Size = new System.Drawing.Size(73, 20); this.measuredTextBox.TabIndex = 4; @@ -198,7 +141,7 @@ namespace TBF.UI.Bench.Metrology // correctedLabel // this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(17, 40); + this.correctedLabel.Location = new System.Drawing.Point(17, 53); this.correctedLabel.Name = "correctedLabel"; this.correctedLabel.Size = new System.Drawing.Size(53, 13); this.correctedLabel.TabIndex = 3; @@ -207,7 +150,7 @@ namespace TBF.UI.Bench.Metrology // measuredLabel // this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(17, 18); + this.measuredLabel.Location = new System.Drawing.Point(17, 28); this.measuredLabel.Name = "measuredLabel"; this.measuredLabel.Size = new System.Drawing.Size(54, 13); this.measuredLabel.TabIndex = 2; @@ -220,33 +163,21 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 294); + this.listViewEx.Size = new System.Drawing.Size(650, 284); 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 + // calibCertificateCtrl // - 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; + this.calibCertificateCtrl.Location = new System.Drawing.Point(183, 10); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 6; // // MetrologyDlgEvaporationTab // @@ -260,8 +191,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); this.nameGroupBox.ResumeLayout(false); this.nameGroupBox.PerformLayout(); this.testGroupBox.ResumeLayout(false); @@ -281,15 +210,8 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; - 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.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; - private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; - private System.Windows.Forms.DateTimePicker calibDateTimePicker; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs index dc0dd306d..a00c72286 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgEvaporationTab.cs @@ -1,13 +1,13 @@ /// -/// Copyright (c) 2019 Sensus Slovensko a.s. +/// Copyright (c) 2019-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; using log4net; -using Config.Entities; using Common.Forms; +using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -52,10 +52,6 @@ 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; } @@ -97,11 +93,6 @@ namespace TBF.UI.Bench.Metrology { nameGroupBox.Text = Strings.Component; - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; - testGroupBox.Text = Strings.Test_measured_corrected; measuredLabel.Text = Strings.Measured; correctedLabel.Text = Strings.Corrected; @@ -109,12 +100,7 @@ namespace TBF.UI.Bench.Metrology 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; - } + if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg); listViewEx.Items.Clear(); foreach (var corr in MeterEntity.Corrections) @@ -209,9 +195,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -228,10 +212,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; - CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; - + calibCertificateCtrl.Update(CalibInfoCfg); 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 8f05448de..12d91906e 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,15 +32,9 @@ namespace TBF.UI.Bench.Metrology private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); this.unitLabel = new System.Windows.Forms.Label(); this.unitComboBox = new System.Windows.Forms.ComboBox(); - this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); - 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.nameGroupBox = new System.Windows.Forms.GroupBox(); this.pressFromToLabel = new System.Windows.Forms.Label(); this.tempFromToLabel = new System.Windows.Forms.Label(); @@ -55,7 +49,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.nameGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); this.SuspendLayout(); @@ -70,9 +63,9 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.unitLabel); this.splitContainer1.Panel1.Controls.Add(this.unitComboBox); - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); // @@ -80,9 +73,16 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 400); - this.splitContainer1.SplitterDistance = 102; + this.splitContainer1.SplitterDistance = 112; this.splitContainer1.TabIndex = 2; // + // calibCertificateCtrl + // + this.calibCertificateCtrl.Location = new System.Drawing.Point(182, 10); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 11; + // // unitLabel // this.unitLabel.AutoSize = true; @@ -101,76 +101,6 @@ namespace TBF.UI.Bench.Metrology this.unitComboBox.TabIndex = 9; this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged); // - // 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(186, 10); - this.calibrationGroupBox.Name = "calibrationGroupBox"; - this.calibrationGroupBox.Size = new System.Drawing.Size(228, 86); - this.calibrationGroupBox.TabIndex = 7; - this.calibrationGroupBox.TabStop = false; - this.calibrationGroupBox.Text = "Calibration"; - // - // 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; - // - // 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(140, 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(69, 13); - this.calibCertificateNrLabel.TabIndex = 10; - this.calibCertificateNrLabel.Text = "Certificate nr."; - // // nameGroupBox // this.nameGroupBox.Controls.Add(this.pressFromToLabel); @@ -214,9 +144,9 @@ namespace TBF.UI.Bench.Metrology 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(424, 10); + this.testGroupBox.Location = new System.Drawing.Point(428, 10); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(170, 88); + this.testGroupBox.Size = new System.Drawing.Size(170, 99); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Correction test"; @@ -262,9 +192,10 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 294); + this.listViewEx.Size = new System.Drawing.Size(650, 284); this.listViewEx.TabIndex = 0; this.listViewEx.UseCompatibleStateImageBehavior = false; this.listViewEx.View = System.Windows.Forms.View.Details; @@ -283,8 +214,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); this.nameGroupBox.ResumeLayout(false); this.nameGroupBox.PerformLayout(); this.testGroupBox.ResumeLayout(false); @@ -304,17 +233,10 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; - 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.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; - private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; - private System.Windows.Forms.DateTimePicker calibDateTimePicker; private System.Windows.Forms.Label unitLabel; private System.Windows.Forms.ComboBox unitComboBox; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs index 116f0f435..ed73bded7 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgFlowMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2022 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -8,6 +8,7 @@ using System.Windows.Forms; using log4net; using Common; using Common.Forms; +using Config; using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -61,10 +62,6 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgFlowMeterTab(int rangeIx1, bool isLastFlowMeterRange) { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; this.rangeIx = rangeIx1; this.isLastFlowMeterRange = isLastFlowMeterRange; toBeRemoved = new List(); @@ -127,11 +124,6 @@ namespace TBF.UI.Bench.Metrology void Localize() { nameGroupBox.Text = Strings.Component; - - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; testGroupBox.Text = Strings.Test_measured_corrected; } @@ -139,9 +131,7 @@ namespace TBF.UI.Bench.Metrology { if (CalibInfoCfg != null) { - calibCertificateNrTextBox.Text = CalibInfoCfg.GetCalibCertificate(rangeIx1); - calibDateTimePicker.Value = (CalibInfoCfg.GetCalibDate(rangeIx1) < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.GetCalibDate(rangeIx1); - calibExpirationDateTimePicker.Value = (CalibInfoCfg.GetCalibValidDate(rangeIx1) < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.GetCalibValidDate(rangeIx1); + calibCertificateCtrl.Refresh(CalibInfoCfg, rangeIx1); } listViewEx.Items.Clear(); @@ -169,7 +159,7 @@ namespace TBF.UI.Bench.Metrology } else { - double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue); + double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue); lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits)); } @@ -222,7 +212,7 @@ namespace TBF.UI.Bench.Metrology { correction = Units.IsDefaultUnit(currentUnit) ? difference : Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement); - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -244,7 +234,7 @@ namespace TBF.UI.Bench.Metrology /// Update error (if possible) if (measurement != 0) { - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -268,7 +258,7 @@ namespace TBF.UI.Bench.Metrology { if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0) { - correction = Config.Formulas.CorrectionFromError(measurement, error); + correction = Formulas.CorrectionFromError(measurement, error); (item.Tag as MeasurementCorrection).Correction = correction; difference = Units.IsDefaultUnit(currentUnit) ? correction @@ -289,9 +279,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -308,9 +296,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text); - CalibInfoCfg.SetCalibDate(rangeIx, calibDateTimePicker.Value.Date); - CalibInfoCfg.SetCalibValidDate(rangeIx, calibExpirationDateTimePicker.Value.Date); + calibCertificateCtrl.Update(CalibInfoCfg, rangeIx); } catch { diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs index d90381e20..1be0ee2c8 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2018 Senus Slovensko a.s. +/// Copyright (c) 2018-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,11 +32,6 @@ 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.nameGroupBox = new System.Windows.Forms.GroupBox(); this.pressFromToLabel = new System.Windows.Forms.Label(); this.tempFromToLabel = new System.Windows.Forms.Label(); @@ -47,13 +42,11 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Common.Forms.ListViewEx(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.nameGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); this.SuspendLayout(); @@ -68,7 +61,7 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); // @@ -76,59 +69,9 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 400); - this.splitContainer1.SplitterDistance = 102; + this.splitContainer1.SplitterDistance = 112; 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(186, 10); - this.calibrationGroupBox.Name = "calibrationGroupBox"; - this.calibrationGroupBox.Size = new System.Drawing.Size(228, 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(140, 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(69, 13); - this.calibCertificateNrLabel.TabIndex = 10; - this.calibCertificateNrLabel.Text = "Certificate nr."; - // // nameGroupBox // this.nameGroupBox.Controls.Add(this.pressFromToLabel); @@ -136,7 +79,7 @@ namespace TBF.UI.Bench.Metrology 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(160, 86); + this.nameGroupBox.Size = new System.Drawing.Size(160, 99); this.nameGroupBox.TabIndex = 5; this.nameGroupBox.TabStop = false; this.nameGroupBox.Text = "Component"; @@ -172,16 +115,16 @@ namespace TBF.UI.Bench.Metrology 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(424, 10); + this.testGroupBox.Location = new System.Drawing.Point(428, 10); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(170, 88); + this.testGroupBox.Size = new System.Drawing.Size(170, 99); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Correction test"; // // correctedTextBox // - this.correctedTextBox.Location = new System.Drawing.Point(91, 37); + this.correctedTextBox.Location = new System.Drawing.Point(88, 43); this.correctedTextBox.Name = "correctedTextBox"; this.correctedTextBox.ReadOnly = true; this.correctedTextBox.Size = new System.Drawing.Size(73, 20); @@ -189,7 +132,7 @@ namespace TBF.UI.Bench.Metrology // // measuredTextBox // - this.measuredTextBox.Location = new System.Drawing.Point(91, 15); + this.measuredTextBox.Location = new System.Drawing.Point(88, 18); this.measuredTextBox.Name = "measuredTextBox"; this.measuredTextBox.Size = new System.Drawing.Size(73, 20); this.measuredTextBox.TabIndex = 4; @@ -198,7 +141,7 @@ namespace TBF.UI.Bench.Metrology // correctedLabel // this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(17, 40); + this.correctedLabel.Location = new System.Drawing.Point(14, 46); this.correctedLabel.Name = "correctedLabel"; this.correctedLabel.Size = new System.Drawing.Size(53, 13); this.correctedLabel.TabIndex = 3; @@ -207,7 +150,7 @@ namespace TBF.UI.Bench.Metrology // measuredLabel // this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(17, 18); + this.measuredLabel.Location = new System.Drawing.Point(14, 21); this.measuredLabel.Name = "measuredLabel"; this.measuredLabel.Size = new System.Drawing.Size(54, 13); this.measuredLabel.TabIndex = 2; @@ -220,33 +163,21 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 294); + this.listViewEx.Size = new System.Drawing.Size(650, 284); 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 + // calibCertificateCtrl // - 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; + this.calibCertificateCtrl.Location = new System.Drawing.Point(182, 10); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 6; // // MetrologyDlgLevelMeterTab // @@ -260,8 +191,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - this.calibrationGroupBox.ResumeLayout(false); - this.calibrationGroupBox.PerformLayout(); this.nameGroupBox.ResumeLayout(false); this.nameGroupBox.PerformLayout(); this.testGroupBox.ResumeLayout(false); @@ -281,15 +210,8 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label correctedLabel; private System.Windows.Forms.Label measuredLabel; private System.Windows.Forms.GroupBox nameGroupBox; - 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.Label pressFromToLabel; private System.Windows.Forms.Label tempFromToLabel; - private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker; - private System.Windows.Forms.DateTimePicker calibDateTimePicker; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs index fcdd47135..ebdd5afd6 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgLevelMeterTab.cs @@ -1,13 +1,13 @@ /// -/// Copyright (c) 2018 Sensus Slovensko a.s. +/// Copyright (c) 2018-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; using System.Globalization; using System.Windows.Forms; using log4net; -using Config.Entities; using Common.Forms; +using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -52,10 +52,6 @@ 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; } @@ -97,11 +93,6 @@ namespace TBF.UI.Bench.Metrology { nameGroupBox.Text = Strings.Component; - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; - testGroupBox.Text = Strings.Test_measured_corrected; measuredLabel.Text = Strings.Measured; correctedLabel.Text = Strings.Corrected; @@ -109,12 +100,7 @@ namespace TBF.UI.Bench.Metrology 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; - } + if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg); listViewEx.Items.Clear(); foreach (var corr in MeterEntity.Corrections) @@ -209,9 +195,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -228,10 +212,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; - CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; - + calibCertificateCtrl.Update(CalibInfoCfg); Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; } @@ -332,7 +313,7 @@ namespace TBF.UI.Bench.Metrology CultureInfo.InvariantCulture, out measured)) { - double corrected = MeasurementCorrection.CorrectedValue(measured, meterEntity.Corrections); + double corrected = MeasurementCorrection.CorrectedValue(measured, meterEntity.Corrections); correctedTextBox.Text = corrected.ToString(); } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs index 15808ecab..21871917f 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -40,11 +40,6 @@ namespace TBF.UI.Bench.Metrology 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(); @@ -62,13 +57,11 @@ namespace TBF.UI.Bench.Metrology 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(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((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(); @@ -93,21 +86,21 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); 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.Size = new System.Drawing.Size(700, 400); + this.splitContainer1.SplitterDistance = 250; this.splitContainer1.TabIndex = 1; // // radioButton2 // this.radioButton2.AutoSize = true; - this.radioButton2.Location = new System.Drawing.Point(462, 24); + this.radioButton2.Location = new System.Drawing.Point(498, 14); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(187, 17); this.radioButton2.TabIndex = 11; @@ -118,7 +111,7 @@ namespace TBF.UI.Bench.Metrology // radioButton1 // this.radioButton1.AutoSize = true; - this.radioButton1.Location = new System.Drawing.Point(235, 24); + this.radioButton1.Location = new System.Drawing.Point(271, 14); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(187, 17); this.radioButton1.TabIndex = 10; @@ -132,9 +125,9 @@ namespace TBF.UI.Bench.Metrology 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.Location = new System.Drawing.Point(16, 164); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(208, 77); + this.testGroupBox.Size = new System.Drawing.Size(240, 77); this.testGroupBox.TabIndex = 9; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Test"; @@ -173,56 +166,6 @@ namespace TBF.UI.Bench.Metrology 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); @@ -233,7 +176,7 @@ namespace TBF.UI.Bench.Metrology 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.Location = new System.Drawing.Point(266, 40); this.its90CalibrationCoefficientsGroupBox.Name = "its90CalibrationCoefficientsGroupBox"; this.its90CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(220, 140); this.its90CalibrationCoefficientsGroupBox.TabIndex = 5; @@ -313,7 +256,7 @@ namespace TBF.UI.Bench.Metrology 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.Size = new System.Drawing.Size(240, 40); this.nameGroupBox.TabIndex = 4; this.nameGroupBox.TabStop = false; this.nameGroupBox.Text = "Component"; @@ -326,7 +269,7 @@ namespace TBF.UI.Bench.Metrology 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.Location = new System.Drawing.Point(495, 40); this.its27CalibrationCoefficientsGroupBox.Name = "its27CalibrationCoefficientsGroupBox"; this.its27CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(190, 140); this.its27CalibrationCoefficientsGroupBox.TabIndex = 3; @@ -384,25 +327,12 @@ namespace TBF.UI.Bench.Metrology this.label3.TabIndex = 8; this.label3.Text = "R0"; // - // calibDateTimePicker + // calibCertificateCtrl // - 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; + this.calibCertificateCtrl.Location = new System.Drawing.Point(16, 58); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 12; // // MetrologyDlgPlatinumResistanceTMeterTab // @@ -410,7 +340,7 @@ namespace TBF.UI.Bench.Metrology this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); this.Name = "MetrologyDlgPlatinumResistanceTMeterTab"; - this.Size = new System.Drawing.Size(668, 400); + this.Size = new System.Drawing.Size(700, 400); this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel1.PerformLayout(); @@ -418,8 +348,6 @@ namespace TBF.UI.Bench.Metrology 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); @@ -449,11 +377,6 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label r0Label; private System.Windows.Forms.TextBox c7TextBox; private System.Windows.Forms.Label c7Label; - 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.GroupBox testGroupBox; private System.Windows.Forms.TextBox bTextBox; private System.Windows.Forms.Label label1; @@ -463,7 +386,6 @@ 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; - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs index 000bceca0..6a803f253 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPlatinumResistanceTMeterTab.cs @@ -1,11 +1,11 @@ /// -/// Copyright (c) 2016-2020 Senus Slovensko a.s. +/// Copyright (c) 2016-2023 Senus Slovensko a.s. /// using System; using System.Collections.Generic; -using System.Globalization; using System.Windows.Forms; using log4net; +using Config; using Config.Entities; using TBF.Resources; @@ -19,12 +19,7 @@ namespace TBF.UI.Bench.Metrology /// Component entity that has a list of 'measurement-correction' pairs /// to be updated in the database on OK. /// - public Component MeterEntity - { - get { return meterEntity; } - set { meterEntity = value; } - } - Component meterEntity; + public Component MeterEntity { get; set; } /// /// Balance configuration (with buoyancy parameters) @@ -34,30 +29,19 @@ namespace TBF.UI.Bench.Metrology /// /// A list of 'measurement-correction' pairs to be deleted from the database on OK. /// - public IList ToBeRemoved - { - get { return toBeRemoved; } - set { toBeRemoved = value; } - } - IList toBeRemoved; + public IList ToBeRemoved { get; set; } MetrologyDlg parent; - bool unlocked; public MetrologyDlgPlatinumResistanceTMeterTab() { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; - toBeRemoved = new List(); - unlocked = false; + ToBeRemoved = new List(); } private void MetrologyDlgBalanceTab_Load(object sender, System.EventArgs e) { - if (meterEntity == null) return; + if (MeterEntity == null) return; parent = ParentForm as MetrologyDlg; @@ -75,11 +59,6 @@ namespace TBF.UI.Bench.Metrology { nameGroupBox.Text = Strings.Component; - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; - testGroupBox.Text = Strings.Test; resistanceLabel.Text = string.Format("{0} [Ω]", Strings.Resistance); temperatureLabel.Text = string.Format("{0} [°C]", Strings.Temperature); @@ -95,9 +74,7 @@ namespace TBF.UI.Bench.Metrology { if (TempMeterCfg != null) { - calibCertificateNrTextBox.Text = TempMeterCfg.CalibCertificateNr; - calibDateTimePicker.Value = (TempMeterCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : TempMeterCfg.CalibDate; - calibExpirationDateTimePicker.Value = (TempMeterCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : TempMeterCfg.CalibValidDate; + calibCertificateCtrl.Refresh(TempMeterCfg); radioButton1.Checked = TempMeterCfg.UseITS90; radioButton2.Checked = !TempMeterCfg.UseITS90; @@ -115,11 +92,7 @@ namespace TBF.UI.Bench.Metrology public void Unlock() { - unlocked = true; - - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); radioButton1.Enabled = true; radioButton2.Enabled = true; @@ -140,9 +113,7 @@ namespace TBF.UI.Bench.Metrology { try { - TempMeterCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - TempMeterCfg.CalibDate = calibDateTimePicker.Value.Date; - TempMeterCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + calibCertificateCtrl.Update(TempMeterCfg); TempMeterCfg.UseITS90 = radioButton1.Checked; @@ -182,14 +153,14 @@ namespace TBF.UI.Bench.Metrology double a7 = Utils.ParseEDouble(a7TextBox.Text); double b7 = Utils.ParseEDouble(b7TextBox.Text); double c7 = Utils.ParseEDouble(c7TextBox.Text); - temperature = Config.Formulas.PlatinumResistanceTM_ITS90_R2T(resistance, R001C, a7, b7, c7); + temperature = Formulas.PlatinumResistanceTM_ITS90_R2T(resistance, R001C, a7, b7, c7); } else { double R0 = Utils.ParseUDouble(r0TextBox.Text); double a = Utils.ParseEDouble(aTextBox.Text); double b = Utils.ParseEDouble(bTextBox.Text); - temperature = Config.Formulas.PlatinumResistanceTM_ITS27_R2T(resistance, R0, a, b); + temperature = Formulas.PlatinumResistanceTM_ITS27_R2T(resistance, R0, a, b); } temperatureTextBox.Text = temperature.ToString(); } @@ -203,25 +174,11 @@ namespace TBF.UI.Bench.Metrology } } - public void CancelBtnClicked() - { - } - - public void AddOne() - { - } - - public void RemoveSelected() - { - } - - public void MoveUpSelected() - { - } - - public void MoveDownSelected() - { - } + public void CancelBtnClicked() { } + public void AddOne() { } + public void RemoveSelected() { } + public void MoveUpSelected() { } + public void MoveDownSelected() { } public string GetWarningsBeforeSaving(ref Dictionary renmInfo) { diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs index b4f2cb543..e23509bdb 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -34,13 +34,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.unitLabel = new System.Windows.Forms.Label(); this.unitComboBox = new System.Windows.Forms.ComboBox(); - this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); - 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(); @@ -49,11 +42,11 @@ namespace TBF.UI.Bench.Metrology this.componentLabel = new System.Windows.Forms.Label(); this.cmpntNameLabel = new System.Windows.Forms.Label(); this.listViewEx = new Common.Forms.ListViewEx(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((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(); // @@ -67,9 +60,9 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.unitLabel); this.splitContainer1.Panel1.Controls.Add(this.unitComboBox); - 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); @@ -78,7 +71,7 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 300); - this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.SplitterDistance = 112; this.splitContainer1.TabIndex = 2; // // unitLabel @@ -99,85 +92,15 @@ namespace TBF.UI.Bench.Metrology this.unitComboBox.TabIndex = 9; this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged); // - // 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"; - // - // 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(117, 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(117, 37); - this.calibDateTimePicker.Name = "calibDateTimePicker"; - this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); - this.calibDateTimePicker.TabIndex = 18; - // - // 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(117, 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.Location = new System.Drawing.Point(442, 9); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(200, 86); + this.testGroupBox.Size = new System.Drawing.Size(200, 100); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Test"; @@ -241,14 +164,22 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 186); + this.listViewEx.Size = new System.Drawing.Size(650, 184); 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); // + // calibCertificateCtrl + // + this.calibCertificateCtrl.Location = new System.Drawing.Point(196, 9); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 11; + // // MetrologyDlgPressMeterTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -262,8 +193,6 @@ namespace TBF.UI.Bench.Metrology 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); @@ -281,15 +210,8 @@ 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; private System.Windows.Forms.Label unitLabel; private System.Windows.Forms.ComboBox unitComboBox; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs index 7ebc3a23c..0728b486f 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgPressMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2022 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -8,6 +8,7 @@ using System.Windows.Forms; using log4net; using Common; using Common.Forms; +using Config; using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -57,10 +58,6 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgPressMeterTab() { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); unlocked = false; } @@ -113,20 +110,11 @@ namespace TBF.UI.Bench.Metrology { componentLabel.Text = Strings.Component; testGroupBox.Text = Strings.Test_measured_corrected; - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; } - void RefreshAll() + 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; - } + if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg); listViewEx.Items.Clear(); foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr); @@ -150,7 +138,7 @@ namespace TBF.UI.Bench.Metrology } else { - double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue); + double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue); lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits)); } @@ -204,7 +192,7 @@ namespace TBF.UI.Bench.Metrology { correction = Units.IsDefaultUnit(currentUnit) ? difference : Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement); - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -226,7 +214,7 @@ namespace TBF.UI.Bench.Metrology /// Update error (if possible) if (measurement != 0) { - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -250,7 +238,7 @@ namespace TBF.UI.Bench.Metrology { if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0) { - correction = Config.Formulas.CorrectionFromError(measurement, error); + correction = Formulas.CorrectionFromError(measurement, error); (item.Tag as MeasurementCorrection).Correction = correction; difference = Units.IsDefaultUnit(currentUnit) ? correction @@ -271,9 +259,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -290,10 +276,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; - CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; - + calibCertificateCtrl.Update(CalibInfoCfg); Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters; } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.cs similarity index 88% rename from TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs rename to TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.cs index 0baf69d43..12cd6e8d7 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2013-2022 Sensus Slovensko a.s. +/// Copyright (c) 2013-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -8,15 +8,16 @@ using System.Windows.Forms; using log4net; using Common; using Common.Forms; +using Config; using Config.Entities; using TBF.Resources; using TBF.UI.Shared; namespace TBF.UI.Bench.Metrology { - public partial class MetrologyDlgBalanceTab : UserControl, IMetrologyDlgTab + public partial class MetrologyDlgScaleTab : UserControl, IMetrologyDlgTab { - static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBalanceTab)); + static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgScaleTab)); public const int SignifDigits = 5; @@ -54,13 +55,9 @@ namespace TBF.UI.Bench.Metrology Unit currentUnit; - public MetrologyDlgBalanceTab() + public MetrologyDlgScaleTab() { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); unlocked = false; } @@ -112,13 +109,7 @@ namespace TBF.UI.Bench.Metrology void Localize() { nameGroupBox.Text = Strings.Component; - - calibrationGroupBox.Text = Strings.Calibration; - calibCertificateNrLabel.Text = Strings.Certificate; - calibDateLabel.Text = Strings.Date; - calibValidDateLabel.Text = Strings.Valid_until; - - buoyancyTempLabel.Text = string.Format("{0} [°C]", Strings.Ambient_temperature); + buoyancyTempLabel.Text = string.Format("{0} [°C]", Strings.Ambient_temperature); buoyancyPressLabel.Text = string.Format("{0} [mbar]", Strings.Ambient_pressure); buoyancyHumiLabel.Text = string.Format("{0} [%]", Strings.Ambient_humidity); airDensityLabel.Text = Strings.Air_density_kg_m3; @@ -130,9 +121,7 @@ namespace TBF.UI.Bench.Metrology { if (BalanceCfg != null) { - calibCertificateNrTextBox.Text = BalanceCfg.CalibCertificateNr; - calibDateTimePicker.Value = (BalanceCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibDate; - calibExpirationDateTimePicker.Value = (BalanceCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibValidDate; + calibCertificateCtrl.Refresh(BalanceCfg); buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2"); buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4"); @@ -163,7 +152,7 @@ namespace TBF.UI.Bench.Metrology } else { - double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue); + double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue); lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits)); } @@ -216,7 +205,7 @@ namespace TBF.UI.Bench.Metrology { correction = Units.IsDefaultUnit(currentUnit) ? difference : Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement); - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -238,7 +227,7 @@ namespace TBF.UI.Bench.Metrology /// Update error (if possible) if (measurement != 0) { - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -262,7 +251,7 @@ namespace TBF.UI.Bench.Metrology { if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0) { - correction = Config.Formulas.CorrectionFromError(measurement, error); + correction = Formulas.CorrectionFromError(measurement, error); (item.Tag as MeasurementCorrection).Correction = correction; difference = Units.IsDefaultUnit(currentUnit) ? correction @@ -283,9 +272,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); buoyancyTempTextBox.Enabled = true; buoyancyPressTextBox.Enabled = true; @@ -307,9 +294,7 @@ namespace TBF.UI.Bench.Metrology { try { - BalanceCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - BalanceCfg.CalibDate = calibDateTimePicker.Value.Date; - BalanceCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + calibCertificateCtrl.Update(BalanceCfg); BalanceCfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text); BalanceCfg.BuoyancyPress = Utils.ParseUFloat(buoyancyPressTextBox.Text); diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.designer.cs similarity index 73% rename from TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs rename to TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.designer.cs index b493833b1..c0795a59d 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgBalanceTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.designer.cs @@ -1,9 +1,9 @@ /// -/// Copyright (c) 2013-2015 Senus Slovensko a.s. +/// Copyright (c) 2013-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { - partial class MetrologyDlgBalanceTab + partial class MetrologyDlgScaleTab { /// /// Required designer variable. @@ -35,13 +35,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.unitLabel = new System.Windows.Forms.Label(); this.unitComboBox = new System.Windows.Forms.ComboBox(); - this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); - 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.buoancyGroupBox = new System.Windows.Forms.GroupBox(); this.weightStandardDensityTextBox = new System.Windows.Forms.TextBox(); this.weightStandardDensityLabel = new System.Windows.Forms.Label(); @@ -60,11 +53,11 @@ namespace TBF.UI.Bench.Metrology this.correctedLabel = new System.Windows.Forms.Label(); this.measuredLabel = new System.Windows.Forms.Label(); this.listViewEx = new Common.Forms.ListViewEx(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.buoancyGroupBox.SuspendLayout(); this.nameGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); @@ -89,9 +82,9 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.unitLabel); this.splitContainer1.Panel1.Controls.Add(this.unitComboBox); - this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox); this.splitContainer1.Panel1.Controls.Add(this.buoancyGroupBox); this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox); this.splitContainer1.Panel1.Controls.Add(this.testGroupBox); @@ -99,14 +92,14 @@ namespace TBF.UI.Bench.Metrology // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); - this.splitContainer1.Size = new System.Drawing.Size(668, 400); - this.splitContainer1.SplitterDistance = 150; + this.splitContainer1.Size = new System.Drawing.Size(700, 400); + this.splitContainer1.SplitterDistance = 160; this.splitContainer1.TabIndex = 1; // // unitLabel // this.unitLabel.AutoSize = true; - this.unitLabel.Location = new System.Drawing.Point(507, 116); + this.unitLabel.Location = new System.Drawing.Point(537, 121); this.unitLabel.Name = "unitLabel"; this.unitLabel.Size = new System.Drawing.Size(68, 13); this.unitLabel.TabIndex = 12; @@ -115,82 +108,12 @@ namespace TBF.UI.Bench.Metrology // unitComboBox // this.unitComboBox.FormattingEnabled = true; - this.unitComboBox.Location = new System.Drawing.Point(592, 113); + this.unitComboBox.Location = new System.Drawing.Point(622, 118); this.unitComboBox.Name = "unitComboBox"; this.unitComboBox.Size = new System.Drawing.Size(62, 21); this.unitComboBox.TabIndex = 11; this.unitComboBox.SelectedIndexChanged += new System.EventHandler(this.unitComboBox_SelectedIndexChanged); // - // 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, 86); - this.calibrationGroupBox.TabIndex = 6; - this.calibrationGroupBox.TabStop = false; - this.calibrationGroupBox.Text = "Calibration"; - // - // 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 = 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 - // - 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"; - // // buoancyGroupBox // this.buoancyGroupBox.Controls.Add(this.weightStandardDensityTextBox); @@ -203,9 +126,9 @@ namespace TBF.UI.Bench.Metrology this.buoancyGroupBox.Controls.Add(this.buoyancyHumiLabel); this.buoancyGroupBox.Controls.Add(this.buoyancyPressLabel); this.buoancyGroupBox.Controls.Add(this.buoyancyTempLabel); - this.buoancyGroupBox.Location = new System.Drawing.Point(233, 10); + this.buoancyGroupBox.Location = new System.Drawing.Point(262, 10); this.buoancyGroupBox.Name = "buoancyGroupBox"; - this.buoancyGroupBox.Size = new System.Drawing.Size(248, 130); + this.buoancyGroupBox.Size = new System.Drawing.Size(248, 146); this.buoancyGroupBox.TabIndex = 5; this.buoancyGroupBox.TabStop = false; this.buoancyGroupBox.Text = "Buoyancy"; @@ -213,7 +136,7 @@ namespace TBF.UI.Bench.Metrology // weightStandardDensityTextBox // this.weightStandardDensityTextBox.Enabled = false; - this.weightStandardDensityTextBox.Location = new System.Drawing.Point(160, 103); + this.weightStandardDensityTextBox.Location = new System.Drawing.Point(156, 107); this.weightStandardDensityTextBox.Name = "weightStandardDensityTextBox"; this.weightStandardDensityTextBox.Size = new System.Drawing.Size(82, 20); this.weightStandardDensityTextBox.TabIndex = 9; @@ -221,7 +144,7 @@ namespace TBF.UI.Bench.Metrology // weightStandardDensityLabel // this.weightStandardDensityLabel.AutoSize = true; - this.weightStandardDensityLabel.Location = new System.Drawing.Point(17, 106); + this.weightStandardDensityLabel.Location = new System.Drawing.Point(13, 110); this.weightStandardDensityLabel.Name = "weightStandardDensityLabel"; this.weightStandardDensityLabel.Size = new System.Drawing.Size(133, 13); this.weightStandardDensityLabel.TabIndex = 8; @@ -230,7 +153,7 @@ namespace TBF.UI.Bench.Metrology // airDensityTextBox // this.airDensityTextBox.Enabled = false; - this.airDensityTextBox.Location = new System.Drawing.Point(160, 81); + this.airDensityTextBox.Location = new System.Drawing.Point(156, 85); this.airDensityTextBox.Name = "airDensityTextBox"; this.airDensityTextBox.Size = new System.Drawing.Size(82, 20); this.airDensityTextBox.TabIndex = 7; @@ -238,7 +161,7 @@ namespace TBF.UI.Bench.Metrology // airDensityLabel // this.airDensityLabel.AutoSize = true; - this.airDensityLabel.Location = new System.Drawing.Point(17, 84); + this.airDensityLabel.Location = new System.Drawing.Point(13, 88); this.airDensityLabel.Name = "airDensityLabel"; this.airDensityLabel.Size = new System.Drawing.Size(95, 13); this.airDensityLabel.TabIndex = 6; @@ -247,7 +170,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyHumiTextBox // this.buoyancyHumiTextBox.Enabled = false; - this.buoyancyHumiTextBox.Location = new System.Drawing.Point(160, 59); + this.buoyancyHumiTextBox.Location = new System.Drawing.Point(156, 63); this.buoyancyHumiTextBox.Name = "buoyancyHumiTextBox"; this.buoyancyHumiTextBox.Size = new System.Drawing.Size(82, 20); this.buoyancyHumiTextBox.TabIndex = 5; @@ -255,7 +178,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyPressTextBox // this.buoyancyPressTextBox.Enabled = false; - this.buoyancyPressTextBox.Location = new System.Drawing.Point(160, 37); + this.buoyancyPressTextBox.Location = new System.Drawing.Point(156, 41); this.buoyancyPressTextBox.Name = "buoyancyPressTextBox"; this.buoyancyPressTextBox.Size = new System.Drawing.Size(82, 20); this.buoyancyPressTextBox.TabIndex = 4; @@ -263,7 +186,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyTempTextBox // this.buoyancyTempTextBox.Enabled = false; - this.buoyancyTempTextBox.Location = new System.Drawing.Point(160, 15); + this.buoyancyTempTextBox.Location = new System.Drawing.Point(156, 19); this.buoyancyTempTextBox.Name = "buoyancyTempTextBox"; this.buoyancyTempTextBox.Size = new System.Drawing.Size(82, 20); this.buoyancyTempTextBox.TabIndex = 3; @@ -271,7 +194,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyHumiLabel // this.buoyancyHumiLabel.AutoSize = true; - this.buoyancyHumiLabel.Location = new System.Drawing.Point(17, 62); + this.buoyancyHumiLabel.Location = new System.Drawing.Point(13, 66); this.buoyancyHumiLabel.Name = "buoyancyHumiLabel"; this.buoyancyHumiLabel.Size = new System.Drawing.Size(72, 13); this.buoyancyHumiLabel.TabIndex = 2; @@ -280,7 +203,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyPressLabel // this.buoyancyPressLabel.AutoSize = true; - this.buoyancyPressLabel.Location = new System.Drawing.Point(17, 40); + this.buoyancyPressLabel.Location = new System.Drawing.Point(13, 44); this.buoyancyPressLabel.Name = "buoyancyPressLabel"; this.buoyancyPressLabel.Size = new System.Drawing.Size(76, 13); this.buoyancyPressLabel.TabIndex = 1; @@ -289,7 +212,7 @@ namespace TBF.UI.Bench.Metrology // buoyancyTempLabel // this.buoyancyTempLabel.AutoSize = true; - this.buoyancyTempLabel.Location = new System.Drawing.Point(17, 18); + this.buoyancyTempLabel.Location = new System.Drawing.Point(13, 22); this.buoyancyTempLabel.Name = "buoyancyTempLabel"; this.buoyancyTempLabel.Size = new System.Drawing.Size(83, 13); this.buoyancyTempLabel.TabIndex = 0; @@ -300,7 +223,7 @@ namespace TBF.UI.Bench.Metrology 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.Size = new System.Drawing.Size(240, 40); this.nameGroupBox.TabIndex = 4; this.nameGroupBox.TabStop = false; this.nameGroupBox.Text = "Component"; @@ -311,7 +234,7 @@ namespace TBF.UI.Bench.Metrology 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(490, 10); + this.testGroupBox.Location = new System.Drawing.Point(516, 10); this.testGroupBox.Name = "testGroupBox"; this.testGroupBox.Size = new System.Drawing.Size(170, 88); this.testGroupBox.TabIndex = 3; @@ -320,7 +243,7 @@ namespace TBF.UI.Bench.Metrology // // correctedTextBox // - this.correctedTextBox.Location = new System.Drawing.Point(91, 37); + this.correctedTextBox.Location = new System.Drawing.Point(91, 47); this.correctedTextBox.Name = "correctedTextBox"; this.correctedTextBox.ReadOnly = true; this.correctedTextBox.Size = new System.Drawing.Size(73, 20); @@ -328,7 +251,7 @@ namespace TBF.UI.Bench.Metrology // // measuredTextBox // - this.measuredTextBox.Location = new System.Drawing.Point(91, 15); + this.measuredTextBox.Location = new System.Drawing.Point(91, 19); this.measuredTextBox.Name = "measuredTextBox"; this.measuredTextBox.Size = new System.Drawing.Size(73, 20); this.measuredTextBox.TabIndex = 4; @@ -337,7 +260,7 @@ namespace TBF.UI.Bench.Metrology // correctedLabel // this.correctedLabel.AutoSize = true; - this.correctedLabel.Location = new System.Drawing.Point(11, 40); + this.correctedLabel.Location = new System.Drawing.Point(11, 50); this.correctedLabel.Name = "correctedLabel"; this.correctedLabel.Size = new System.Drawing.Size(53, 13); this.correctedLabel.TabIndex = 3; @@ -346,7 +269,7 @@ namespace TBF.UI.Bench.Metrology // measuredLabel // this.measuredLabel.AutoSize = true; - this.measuredLabel.Location = new System.Drawing.Point(11, 18); + this.measuredLabel.Location = new System.Drawing.Point(11, 22); this.measuredLabel.Name = "measuredLabel"; this.measuredLabel.Size = new System.Drawing.Size(54, 13); this.measuredLabel.TabIndex = 2; @@ -359,29 +282,35 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(668, 246); + this.listViewEx.Size = new System.Drawing.Size(700, 236); 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); // - // MetrologyDlgBalanceTab + // calibCertificateCtrl + // + this.calibCertificateCtrl.Location = new System.Drawing.Point(16, 56); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 13; + // + // MetrologyDlgScaleTab // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.splitContainer1); - this.Name = "MetrologyDlgBalanceTab"; - this.Size = new System.Drawing.Size(668, 400); + this.Name = "MetrologyDlgScaleTab"; + this.Size = new System.Drawing.Size(700, 400); this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_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.buoancyGroupBox.ResumeLayout(false); this.buoancyGroupBox.PerformLayout(); this.nameGroupBox.ResumeLayout(false); @@ -414,14 +343,8 @@ namespace TBF.UI.Bench.Metrology private System.Windows.Forms.Label weightStandardDensityLabel; private System.Windows.Forms.TextBox airDensityTextBox; private System.Windows.Forms.Label airDensityLabel; - 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; private System.Windows.Forms.Label unitLabel; private System.Windows.Forms.ComboBox unitComboBox; - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.resx b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TBF/UI/Bench/Metrology/MetrologyDlgScaleTab.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/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs index 1e40e27a9..f1c164cad 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.Designer.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2017 Senus Slovensko a.s. +/// Copyright (c) 2017-2023 Senus Slovensko a.s. /// namespace TBF.UI.Bench.Metrology { @@ -32,15 +32,9 @@ namespace TBF.UI.Bench.Metrology private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl(); this.unitLabel = new System.Windows.Forms.Label(); this.unitComboBox = new System.Windows.Forms.ComboBox(); - this.calibrationGroupBox = new System.Windows.Forms.GroupBox(); - this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker(); - this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker(); - 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(); @@ -53,7 +47,6 @@ namespace TBF.UI.Bench.Metrology this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - this.calibrationGroupBox.SuspendLayout(); this.testGroupBox.SuspendLayout(); this.SuspendLayout(); // @@ -67,9 +60,9 @@ namespace TBF.UI.Bench.Metrology // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl); this.splitContainer1.Panel1.Controls.Add(this.unitLabel); this.splitContainer1.Panel1.Controls.Add(this.unitComboBox); - 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); @@ -78,9 +71,16 @@ namespace TBF.UI.Bench.Metrology // this.splitContainer1.Panel2.Controls.Add(this.listViewEx); this.splitContainer1.Size = new System.Drawing.Size(650, 300); - this.splitContainer1.SplitterDistance = 110; + this.splitContainer1.SplitterDistance = 112; this.splitContainer1.TabIndex = 2; // + // calibCertificateCtrl + // + this.calibCertificateCtrl.Location = new System.Drawing.Point(195, 7); + this.calibCertificateCtrl.Name = "calibCertificateCtrl"; + this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100); + this.calibCertificateCtrl.TabIndex = 9; + // // unitLabel // this.unitLabel.AutoSize = true; @@ -93,90 +93,20 @@ namespace TBF.UI.Bench.Metrology // unitComboBox // this.unitComboBox.FormattingEnabled = true; - this.unitComboBox.Location = new System.Drawing.Point(123, 57); + this.unitComboBox.Location = new System.Drawing.Point(121, 57); this.unitComboBox.Name = "unitComboBox"; this.unitComboBox.Size = new System.Drawing.Size(62, 21); this.unitComboBox.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(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"; - // - // 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(117, 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(117, 37); - this.calibDateTimePicker.Name = "calibDateTimePicker"; - this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20); - this.calibDateTimePicker.TabIndex = 18; - // - // 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(117, 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.Location = new System.Drawing.Point(441, 7); this.testGroupBox.Name = "testGroupBox"; - this.testGroupBox.Size = new System.Drawing.Size(200, 86); + this.testGroupBox.Size = new System.Drawing.Size(200, 100); this.testGroupBox.TabIndex = 4; this.testGroupBox.TabStop = false; this.testGroupBox.Text = "Test"; @@ -240,9 +170,10 @@ namespace TBF.UI.Bench.Metrology this.listViewEx.DoubleClickActivation = false; this.listViewEx.FullRowSelect = true; this.listViewEx.GridLines = true; + this.listViewEx.HideSelection = false; this.listViewEx.Location = new System.Drawing.Point(0, 0); this.listViewEx.Name = "listViewEx"; - this.listViewEx.Size = new System.Drawing.Size(650, 186); + this.listViewEx.Size = new System.Drawing.Size(650, 184); this.listViewEx.TabIndex = 0; this.listViewEx.UseCompatibleStateImageBehavior = false; this.listViewEx.View = System.Windows.Forms.View.Details; @@ -261,8 +192,6 @@ namespace TBF.UI.Bench.Metrology 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); @@ -280,15 +209,8 @@ 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; private System.Windows.Forms.Label unitLabel; private System.Windows.Forms.ComboBox unitComboBox; - - } + private CalibCertificateCtrl calibCertificateCtrl; + } } diff --git a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs index 19040b3fa..6dd728feb 100644 --- a/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs +++ b/TBF/UI/Bench/Metrology/MetrologyDlgTempMeterTab.cs @@ -1,5 +1,5 @@ /// -/// Copyright (c) 2017-2022 Sensus Slovensko a.s. +/// Copyright (c) 2017-2023 Sensus Slovensko a.s. /// using System; using System.Collections.Generic; @@ -8,6 +8,7 @@ using System.Windows.Forms; using log4net; using Common; using Common.Forms; +using Config; using Config.Entities; using TBF.Resources; using TBF.UI.Shared; @@ -57,10 +58,6 @@ namespace TBF.UI.Bench.Metrology public MetrologyDlgTempMeterTab() { InitializeComponent(); - calibDateTimePicker.CustomFormat = Constants.DateFormat; - calibDateTimePicker.MinDate = Constants.MinDate; - calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat; - calibExpirationDateTimePicker.MinDate = Constants.MinDate; toBeRemoved = new List(); unlocked = false; } @@ -113,19 +110,13 @@ namespace TBF.UI.Bench.Metrology { componentLabel.Text = Strings.Component; testGroupBox.Text = Strings.Test_measured_corrected; - 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; + calibCertificateCtrl.Refresh(CalibInfoCfg); } listViewEx.Items.Clear(); @@ -150,7 +141,7 @@ namespace TBF.UI.Bench.Metrology } else { - double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue); + double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue); lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits)); } @@ -203,7 +194,7 @@ namespace TBF.UI.Bench.Metrology { correction = Units.IsDefaultUnit(currentUnit) ? difference : Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement); - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -225,7 +216,7 @@ namespace TBF.UI.Bench.Metrology /// Update error (if possible) if (measurement != 0) { - error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction); + error = Formulas.ErrorFromVolumes(measurement, measurement + correction); item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits); } else @@ -249,7 +240,7 @@ namespace TBF.UI.Bench.Metrology { if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0) { - correction = Config.Formulas.CorrectionFromError(measurement, error); + correction = Formulas.CorrectionFromError(measurement, error); (item.Tag as MeasurementCorrection).Correction = correction; difference = Units.IsDefaultUnit(currentUnit) ? correction @@ -270,9 +261,7 @@ namespace TBF.UI.Bench.Metrology { unlocked = true; - calibCertificateNrTextBox.Enabled = true; - calibDateTimePicker.Enabled = true; - calibExpirationDateTimePicker.Enabled = true; + calibCertificateCtrl.Unlock(); if (listViewEx.SelectedItems.Count == 1) { @@ -289,9 +278,7 @@ namespace TBF.UI.Bench.Metrology { try { - CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text; - CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date; - CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date; + calibCertificateCtrl.Update(CalibInfoCfg); Component modified = CalibInfoCfg.CreateDbEntity(); MeterEntity.Parameters = modified.Parameters;