Calibration certificate nr., date, validity, etc. added to Metrology UI, FlowMeterCfg, ver.2.5.276

This commit is contained in:
Milan Hanajik
2016-04-28 12:47:23 +02:00
parent d516441ff8
commit ca0bcc49ac
14 changed files with 335 additions and 151 deletions
@@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Elde.FlowMeter
{
public class FlowMeterCfg : ComponentCfgBase, Generic.IChildComponentCfg
public class FlowMeterCfg : ComponentCfgBase, GenericDevices.ICalibInfoCfg, IChildComponentCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new FlowMeter(this, components); }
public IComponentCfgCtrl GetControl() { return new FlowMeterCfgCtrl(); }
@@ -20,6 +20,27 @@ namespace TBF.BenchControl.Elde.FlowMeter
public int Idx1; /// 1..5
public float NominalFlow; /// Nominal flow in m3/h at output frequency 2000 Hz
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
set { calibCertificateNr = value; }
}
public DateTime CalibDate
{
get { return calibDate; }
set { calibDate = value; }
}
public DateTime CalibValidDate
{
get { return calibValidDate; }
set { calibValidDate = value; }
}
/// Private parameterless constructor invoked by all other (public) constructors
FlowMeterCfg()
{
@@ -15,6 +15,7 @@ namespace TBF.BenchControl.GenericDevices
float BuoyancyPress { get; set; } /// ambient pressure in [100000 Pa]
float BuoyancyHumi { get; set; } /// ambient relative humidity in [%]
float WeightStandardDensity { get; set; } /// density of the weight standard used to calibrate the scale [kg/m3]
string CalibCertificateNr { get; set; } /// calibration certificate number
DateTime CalibDate { get; set; } /// date of calibration
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
@@ -0,0 +1,19 @@
///
/// Copyright (c) 2013-2016 Sensus Metering Systems
///
using System;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.GenericDevices
{
public interface ICalibInfoCfg : IComponentCfg
{
///
/// Parameters are 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)
}
}
@@ -11,7 +11,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Multi
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg
{
public IComponent GetComponent(IList<IComponent> components) { return new BalanceDev(this); }
public IComponentCfgCtrl GetControl() { return new BalanceCfgCtrl(); }
@@ -10,7 +10,7 @@ using TBF.BenchControl.Generic;
namespace TBF.BenchControl.MettlerToledo.Standard
{
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg
public class BalanceCfg : ComponentCfgBase, GenericDevices.IBalanceCfg, GenericDevices.ICalibInfoCfg
{
public IComponent GetComponent(IList<IComponent> components)
{
@@ -34,17 +34,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
public string Format;
public int EmptyTimeSec; /// s
///
/// Buoyancy related serialized parameters - Displayed in Metrology tab page
///
/// Buoyancy related serialized parameters displayed in Metrology tab page
private float buoyancyTemp;
private float buoyancyPress;
private float buoyancyHumi;
private float weightStandardDensity;
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
///
public float BuoyancyTemp
{
get { return buoyancyTemp; }
@@ -65,6 +59,11 @@ namespace TBF.BenchControl.MettlerToledo.Standard
get { return weightStandardDensity; }
set { weightStandardDensity = value; }
}
/// Calibration info serialized parameters displayed in Metrology tab page
string calibCertificateNr;
DateTime calibDate;
DateTime calibValidDate;
public string CalibCertificateNr
{
get { return calibCertificateNr; }
+1
View File
@@ -90,6 +90,7 @@ namespace TBF
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgFlowMeterTab uiControl = new MetrologyDlgFlowMeterTab();
uiControl.MeterEntity = cmpnt;
uiControl.CalibInfoCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as BenchControl.GenericDevices.ICalibInfoCfg;
uiControl.Dock = DockStyle.Fill;
tabPage.Tag = uiControl;
tabPage.Controls.Add(uiControl);
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.5.275.1")]
[assembly: AssemblyFileVersion("2.5.275.1")]
[assembly: AssemblyVersion("2.5.276.1")]
[assembly: AssemblyFileVersion("2.5.276.1")]
+9
View File
@@ -1221,6 +1221,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid calibration information. Correct it please..
/// </summary>
internal static string Invalid_calib_info_Correct_pls {
get {
return ResourceManager.GetString("Invalid_calib_info_Correct_pls", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid password.
/// </summary>
@@ -1219,4 +1219,7 @@
<data name="Invalid_buoyancy_parameter_Correct_pls" xml:space="preserve">
<value>At least one of Buoyancy parameters is invalid,\r\ncorrect it please.</value>
</data>
<data name="Invalid_calib_info_Correct_pls" xml:space="preserve">
<value>Invalid calibration information. Correct it please.</value>
</data>
</root>
+1
View File
@@ -337,6 +337,7 @@
</Compile>
<Compile Include="BenchControl\Elde\ValveEx\ValveFactory.cs" />
<Compile Include="BenchControl\GenericDevices\IBalanceCfg.cs" />
<Compile Include="BenchControl\GenericDevices\ICalibInfoCfg.cs" />
<Compile Include="BenchControl\GenericDevices\IModbus.cs" />
<Compile Include="BenchControl\GenericDevices\IBenchInfo.cs" />
<Compile Include="BenchControl\GenericDevices\ISimultTestMethod.cs" />
@@ -311,7 +311,7 @@ namespace TBF.UiControls
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(18, 40);
this.correctedLabel.Location = new System.Drawing.Point(17, 40);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
@@ -90,6 +90,7 @@ namespace TBF.UiControls
/// airDensityLabel.Text =
/// weightStandardDensityLabel =
nameGroupBox.Text = Strings.Component;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
@@ -161,6 +162,7 @@ namespace TBF.UiControls
calibCertificateNrTextBox.Enabled = true;
calibDateTextBox.Enabled = true;
calibValidDateTextBox.Enabled = true;
buoyancyTempTextBox.Enabled = true;
buoyancyPressTextBox.Enabled = true;
buoyancyHumiTextBox.Enabled = true;
@@ -32,19 +32,28 @@ namespace TBF.UiControls
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label1 = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new TBF.UiControls.ListViewEx();
this.correctedTextBox = new System.Windows.Forms.TextBox();
this.testGroupBox = new System.Windows.Forms.GroupBox();
this.correctedTextBox = new System.Windows.Forms.TextBox();
this.measuredTextBox = new System.Windows.Forms.TextBox();
this.correctedLabel = new System.Windows.Forms.Label();
this.measuredLabel = new System.Windows.Forms.Label();
this.cmpntNameLabel = new System.Windows.Forms.Label();
this.listViewEx = new TBF.UiControls.ListViewEx();
this.nameGroupBox = new System.Windows.Forms.GroupBox();
this.calibrationGroupBox = new System.Windows.Forms.GroupBox();
this.calibValidDateTextBox = new System.Windows.Forms.TextBox();
this.calibValidDateLabel = new System.Windows.Forms.Label();
this.calibDateTextBox = new System.Windows.Forms.TextBox();
this.calibDateLabel = new System.Windows.Forms.Label();
this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox();
this.calibCertificateNrLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@@ -57,34 +66,72 @@ namespace TBF.UiControls
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.label1);
this.splitContainer1.Panel1.Controls.Add(this.cmpntNameLabel);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(420, 300);
this.splitContainer1.SplitterDistance = 80;
this.splitContainer1.Size = new System.Drawing.Size(650, 400);
this.splitContainer1.SplitterDistance = 102;
this.splitContainer1.TabIndex = 2;
//
// label1
// testGroupBox
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Component:";
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(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
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.Name = "correctedTextBox";
this.correctedTextBox.ReadOnly = true;
this.correctedTextBox.Size = new System.Drawing.Size(73, 20);
this.correctedTextBox.TabIndex = 5;
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(91, 15);
this.measuredTextBox.Name = "measuredTextBox";
this.measuredTextBox.Size = new System.Drawing.Size(73, 20);
this.measuredTextBox.TabIndex = 4;
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
//
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(17, 40);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
this.correctedLabel.Text = "Corrected";
//
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(17, 18);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
//
// cmpntNameLabel
//
this.cmpntNameLabel.AutoSize = true;
this.cmpntNameLabel.Location = new System.Drawing.Point(97, 12);
this.cmpntNameLabel.Location = new System.Drawing.Point(43, 37);
this.cmpntNameLabel.Name = "cmpntNameLabel";
this.cmpntNameLabel.Size = new System.Drawing.Size(88, 13);
this.cmpntNameLabel.Size = new System.Drawing.Size(64, 13);
this.cmpntNameLabel.TabIndex = 0;
this.cmpntNameLabel.Text = "componentName";
this.cmpntNameLabel.Text = "cmpntName";
//
// listViewEx
//
@@ -95,58 +142,87 @@ namespace TBF.UiControls
this.listViewEx.GridLines = true;
this.listViewEx.Location = new System.Drawing.Point(0, 0);
this.listViewEx.Name = "listViewEx";
this.listViewEx.Size = new System.Drawing.Size(420, 216);
this.listViewEx.Size = new System.Drawing.Size(650, 294);
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);
//
// correctedTextBox
// nameGroupBox
//
this.correctedTextBox.Location = new System.Drawing.Point(74, 38);
this.correctedTextBox.Name = "correctedTextBox";
this.correctedTextBox.ReadOnly = true;
this.correctedTextBox.Size = new System.Drawing.Size(73, 20);
this.correctedTextBox.TabIndex = 5;
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.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
//
// testGroupBox
// calibrationGroupBox
//
this.testGroupBox.Controls.Add(this.correctedTextBox);
this.testGroupBox.Controls.Add(this.measuredTextBox);
this.testGroupBox.Controls.Add(this.correctedLabel);
this.testGroupBox.Controls.Add(this.measuredLabel);
this.testGroupBox.Location = new System.Drawing.Point(245, 7);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(157, 64);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
this.calibrationGroupBox.Controls.Add(this.calibValidDateTextBox);
this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel);
this.calibrationGroupBox.Controls.Add(this.calibDateTextBox);
this.calibrationGroupBox.Controls.Add(this.calibDateLabel);
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox);
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel);
this.calibrationGroupBox.Location = new System.Drawing.Point(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";
//
// measuredTextBox
// calibValidDateTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(74, 13);
this.measuredTextBox.Name = "measuredTextBox";
this.measuredTextBox.Size = new System.Drawing.Size(73, 20);
this.measuredTextBox.TabIndex = 4;
this.measuredTextBox.TextChanged += new System.EventHandler(this.measuredTextBox_TextChanged);
this.calibValidDateTextBox.Enabled = false;
this.calibValidDateTextBox.Location = new System.Drawing.Point(140, 59);
this.calibValidDateTextBox.Name = "calibValidDateTextBox";
this.calibValidDateTextBox.Size = new System.Drawing.Size(82, 20);
this.calibValidDateTextBox.TabIndex = 15;
//
// correctedLabel
// calibValidDateLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(7, 41);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
this.correctedLabel.Text = "Corrected";
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";
//
// measuredLabel
// calibDateTextBox
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(6, 20);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
this.measuredLabel.Text = "Measured";
this.calibDateTextBox.Enabled = false;
this.calibDateTextBox.Location = new System.Drawing.Point(140, 37);
this.calibDateTextBox.Name = "calibDateTextBox";
this.calibDateTextBox.Size = new System.Drawing.Size(82, 20);
this.calibDateTextBox.TabIndex = 13;
//
// calibDateLabel
//
this.calibDateLabel.AutoSize = true;
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.";
//
// MetrologyDlgFlowMeterTab
//
@@ -154,15 +230,18 @@ namespace TBF.UiControls
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgFlowMeterTab";
this.Size = new System.Drawing.Size(420, 300);
this.Size = new System.Drawing.Size(650, 400);
this.Load += new System.EventHandler(this.MetrologyDlgFlowMeterTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.testGroupBox.ResumeLayout(false);
this.testGroupBox.PerformLayout();
this.nameGroupBox.ResumeLayout(false);
this.nameGroupBox.PerformLayout();
this.calibrationGroupBox.ResumeLayout(false);
this.calibrationGroupBox.PerformLayout();
this.ResumeLayout(false);
}
@@ -170,7 +249,6 @@ namespace TBF.UiControls
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label cmpntNameLabel;
private ListViewEx listViewEx;
private System.Windows.Forms.GroupBox testGroupBox;
@@ -178,6 +256,14 @@ namespace TBF.UiControls
private System.Windows.Forms.TextBox measuredTextBox;
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.TextBox calibValidDateTextBox;
private System.Windows.Forms.Label calibValidDateLabel;
private System.Windows.Forms.TextBox calibDateTextBox;
private System.Windows.Forms.Label calibDateLabel;
private System.Windows.Forms.TextBox calibCertificateNrTextBox;
private System.Windows.Forms.Label calibCertificateNrLabel;
}
}
@@ -26,6 +26,11 @@ namespace TBF.UiControls
set { meterEntity = value; }
}
/// <summary>
/// Calibration information configuration
/// </summary>
public BenchControl.GenericDevices.ICalibInfoCfg CalibInfoCfg;
/// <summary>
/// A list of 'measurement-correction' pairs to be deleted from the database on OK.
/// </summary>
@@ -53,6 +58,8 @@ namespace TBF.UiControls
parent = ParentForm as MetrologyDlg;
Localize();
/// Panel1
cmpntNameLabel.Text = meterEntity.Name;
@@ -78,8 +85,23 @@ namespace TBF.UiControls
RefreshAll();
}
void Localize()
{
nameGroupBox.Text = Strings.Component;
testGroupBox.Text = Strings.Test_measured_corrected;
measuredLabel.Text = Strings.Measured;
correctedLabel.Text = Strings.Corrected;
}
void RefreshAll()
{
if (CalibInfoCfg != null)
{
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
calibDateTextBox.Text = CalibInfoCfg.CalibDate.ToShortDateString();
calibValidDateTextBox.Text = CalibInfoCfg.CalibValidDate.ToShortDateString();
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections) AddOneLVI(corr);
}
@@ -128,6 +150,10 @@ namespace TBF.UiControls
{
unlocked = true;
calibCertificateNrTextBox.Enabled = true;
calibDateTextBox.Enabled = true;
calibValidDateTextBox.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
int ix = listViewEx.SelectedIndices[0];
@@ -139,6 +165,22 @@ namespace TBF.UiControls
public void OkBtnClicked()
{
if (CalibInfoCfg != null)
{
try
{
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
CalibInfoCfg.CalibDate = DateTime.Parse(calibDateTextBox.Text);
CalibInfoCfg.CalibValidDate = DateTime.Parse(calibValidDateTextBox.Text);
Component modified = CalibInfoCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
catch
{
MessageBox.Show(Strings.Invalid_calib_info_Correct_pls, Strings.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
public void CancelBtnClicked()