Compare commits

..
122 changed files with 2309 additions and 4392 deletions
-22
View File
@@ -54,28 +54,6 @@ Users/bin/
Users/obj/
UserManagement/bin/
UserManagement/obj/
DataMatrix4Net/bin/
DataMatrix4Net/obj/
GenericTest/bin/
GenericTest/obj/
LabelPrinting/bin/
LabelPrinting/obj/
OrderManagement/bin/
OrderManagement/obj/
ProductionTracing/bin/
ProductionTracing/obj/
RecordProcessing/bin/
RecordProcessing/obj/
S640TestApp/bin/
S640TestApp/obj/
SchematicDrawing/bin/
SchematicDrawing/obj/
SharedDatabase/bin/
SharedDatabase/obj/
WorkflowConfigurator/bin/
WorkflowConfigurator/obj/
Workplace/bin/
Workplace/obj/
.vs/
*.suo
*.bak
+4 -7
View File
@@ -1,7 +1,4 @@
///
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System;
using System.Drawing;
using System.Windows.Forms;
@@ -56,20 +53,20 @@ namespace Common.Forms
public event EventHandler<MessageEventArgs> UpdateMessageHandler;
void OnUpdateMessage(object sender, MessageEventArgs args)
{
if (args != null && args.Message != null) label1.Text = args.Message;
if (args.Message != null) label1.Text = args.Message;
}
/// <summary>
/// Called from the state machine when an operation forces a modeless dialog close.
/// </summary>
public void CloseForm()
public static void CloseForm()
{
if (CloseFormHandler == null) return;
try { CloseFormHandler(null, null); }
catch (Exception) { }
}
public event EventHandler<EventArgs> CloseFormHandler;
static public event EventHandler<EventArgs> CloseFormHandler;
void OnCloseForm(object sender, EventArgs args)
{
DialogResult = DialogResult.Cancel;
+2 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH</DefineConstants>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
-5
View File
@@ -100,7 +100,6 @@ namespace Results.Entities
#endif
public virtual int ProcessId { get; set; } /// Not mapped to DB !!! Tracing DB Process ID
public virtual bool LastRecordIsNok { get; set; } /// Not mapped to DB !!! Previous record verification result
public virtual bool PrintLabel { get; set; } /// Not mapped to DB !!!
public virtual WaterMeterData WaterMeterData { get; set; }
public virtual Batch Batch { get; set; }
@@ -459,7 +458,6 @@ namespace Results.Entities
#endif
ProcessId = 0;
LastRecordIsNok = false;
PrintLabel = true;
}
@@ -521,7 +519,6 @@ namespace Results.Entities
#endif
ProcessId = src.ProcessId; /// Not mapped to DB
LastRecordIsNok = src.LastRecordIsNok; /// Not mapped to DB
PrintLabel = src.PrintLabel; /// Not mapped to DB
foreach (var mtr in MeterTestRslts)
{
@@ -701,7 +698,6 @@ namespace Results.Entities
#endif
writer.Write(ProcessId);
writer.Write(LastRecordIsNok);
writer.Write(PrintLabel);
/// Save WaterMeterData or WaterMeterData.Id
if (WaterMeterData != null && savedWMDatas != null && !savedWMDatas.Contains(WaterMeterData))
@@ -781,7 +777,6 @@ namespace Results.Entities
#endif
ProcessId = reader.ReadInt32();
LastRecordIsNok = reader.ReadBoolean();
PrintLabel = reader.ReadBoolean();
/// Retrieve TestData
if (reader.ReadBoolean())
+10 -24
View File
@@ -29,15 +29,13 @@
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.graphsTabPage = new System.Windows.Forms.TabPage();
this.productionTracingTabPage = new System.Windows.Forms.TabPage();
this.productionTracingSplitContainer = new System.Windows.Forms.SplitContainer();
this.messageLabel = new System.Windows.Forms.Label();
this.tracingResultsListView = new System.Windows.Forms.ListView();
this.oneWMResultsCtrl = new Results.Forms.OneWMResultsRowsCtrl();
this.allResultsTabPage = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.allResultsTabPage.SuspendLayout();
this.productionTracingTabPage.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.productionTracingSplitContainer)).BeginInit();
this.productionTracingSplitContainer.Panel1.SuspendLayout();
@@ -57,17 +55,6 @@
this.tabControl1.Size = new System.Drawing.Size(1195, 448);
this.tabControl1.TabIndex = 0;
//
// allResultsTabPage
//
this.allResultsTabPage.Controls.Add(this.oneWMResultsCtrl);
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
//
// graphsTabPage
//
this.graphsTabPage.Location = new System.Drawing.Point(4, 22);
@@ -126,7 +113,6 @@
//
this.tracingResultsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.tracingResultsListView.GridLines = true;
this.tracingResultsListView.HideSelection = false;
this.tracingResultsListView.Location = new System.Drawing.Point(0, 0);
this.tracingResultsListView.Name = "tracingResultsListView";
this.tracingResultsListView.Size = new System.Drawing.Size(1187, 366);
@@ -134,14 +120,15 @@
this.tracingResultsListView.UseCompatibleStateImageBehavior = false;
this.tracingResultsListView.View = System.Windows.Forms.View.Details;
//
// oneWMResultsRowsCtrl
// allResultsTabPage
//
this.oneWMResultsCtrl.Caption = "---";
this.oneWMResultsCtrl.Dock = System.Windows.Forms.DockStyle.Fill;
this.oneWMResultsCtrl.Location = new System.Drawing.Point(3, 3);
this.oneWMResultsCtrl.Name = "oneWMResultsRowsCtrl";
this.oneWMResultsCtrl.Size = new System.Drawing.Size(1181, 416);
this.oneWMResultsCtrl.TabIndex = 0;
this.allResultsTabPage.Location = new System.Drawing.Point(4, 22);
this.allResultsTabPage.Name = "allResultsTabPage";
this.allResultsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.allResultsTabPage.Size = new System.Drawing.Size(1187, 422);
this.allResultsTabPage.TabIndex = 0;
this.allResultsTabPage.Text = "All results";
this.allResultsTabPage.UseVisualStyleBackColor = true;
//
// MoreWMResultsDlg
//
@@ -153,7 +140,6 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Water meter results";
this.tabControl1.ResumeLayout(false);
this.allResultsTabPage.ResumeLayout(false);
this.productionTracingTabPage.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.ResumeLayout(false);
this.productionTracingSplitContainer.Panel1.PerformLayout();
@@ -167,12 +153,12 @@
#endregion
private System.Windows.Forms.TabControl tabControl1;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
private System.Windows.Forms.TabPage graphsTabPage;
private System.Windows.Forms.TabPage productionTracingTabPage;
private System.Windows.Forms.SplitContainer productionTracingSplitContainer;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.ListView tracingResultsListView;
private System.Windows.Forms.TabPage allResultsTabPage;
private OneWMResultsRowsCtrl oneWMResultsCtrl;
}
}
+45 -45
View File
@@ -59,57 +59,57 @@ namespace Results.Forms
/// <param name="wMtr">Water meter entity</param>
void ShowAllResults(Results.Entities.WaterMeter wMtr)
{
string message;
Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
#if ORACLE_DB
oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", wMtr.SerialNr ?? string.Empty, wMtr.Pruefindex % 100, message);
#else
oneWMResultsCtrl.Caption = string.Format("s/n = {0}", wMtr.SerialNr ?? string.Empty);
#endif
// string message;
// Color commonBackColor = wMtr.GetColorOfResults(false, out message); /// Ony message is used later on
//#if ORACLE_DB
// oneWMResultsCtrl.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
//#else
// oneWMResultsCtrl.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
//#endif
IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
// IList<Results.WMeterRsltItemSpec> items = Results.WMeterRsltItemSpec.AllItems;
// Header
oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
int i = 1;
foreach (var str in wMtr.GetAllDecoratedTestNames())
{
oneWMResultsCtrl.Columns.Add(str, 100);
i++;
}
// // Header
// oneWMResultsCtrl.Columns.Add(wMtr.WMPosition.ToString(), 100);
// int i = 1;
// foreach (var str in wMtr.GetAllDecoratedTestNames())
// {
// oneWMResultsCtrl.Columns.Add(str, 100);
// i++;
// }
foreach (var item in items)
{
ListViewItem lvi = new ListViewItem(item.Name);
// foreach (var item in items)
// {
// ListViewItem lvi = new ListViewItem(item.Name);
foreach (var mtr in wMtr.MeterTestRslts)
{
if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Common.Publish.Never &&
mtr.Publish() != Common.Publish.Internal)
{
string str = item.Print(wMtr, mtr.Name());
// foreach (var mtr in wMtr.MeterTestRslts)
// {
// if (mtr != null && mtr.IsPilotRslt() && mtr.TestDone && mtr.Publish() != Publish.Never &&
// mtr.Publish() != Publish.Internal)
// {
// string str = item.Print(wMtr, mtr.Name());
string[] texts = str.Split(new char[] { '|' });
if (texts.Length == 1)
{
lvi.SubItems.Add(str);
}
else if (texts.Length == 2)
{
Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
lvi.UseItemStyleForSubItems = false;
lvi.SubItems.Add(texts[0]);
lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
}
else
{
lvi.SubItems.Add(string.Empty);
}
}
}
// string[] texts = str.Split(new char[] { '|' });
// if (texts.Length == 1)
// {
// lvi.SubItems.Add(str);
// }
// else if (texts.Length == 2)
// {
// Color color = texts[1].Equals("Green") ? Color.Green : (texts[1].Equals("Red") ? Color.Red : Color.White);
// lvi.UseItemStyleForSubItems = false;
// lvi.SubItems.Add(texts[0]);
// lvi.SubItems[lvi.SubItems.Count - 1].BackColor = color;
// }
// else
// {
// lvi.SubItems.Add(string.Empty);
// }
// }
// }
oneWMResultsCtrl.Items.Add(lvi);
}
// oneWMResultsCtrl.Items.Add(lvi);
// }
}
+4 -7
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Drawing;
@@ -24,16 +24,13 @@ namespace Results.Forms
}
}
public string Caption { set { caption = value; } get { return caption; } }
public ListView.ListViewItemCollection Items { get { return lView.Items; } }
bool disabled;
int wmPosition; /// 1-based water meter position
string caption;
Color bkColor;
int[] columnWidths;
IList<WMeterRsltItemSpec> items;
IList<Results.WMeterRsltItemSpec> items;
public bool Disabled { get { return disabled; } } /// Read only
@@ -48,7 +45,7 @@ namespace Results.Forms
wmPosition = 0;
tBox.Text = caption = "---";
tBox.BackColor = lView.BackColor = bkColor = Color.White;
items = new List<WMeterRsltItemSpec>();
items = new List<Results.WMeterRsltItemSpec>();
columnWidths = new int[0];
}
@@ -65,7 +62,7 @@ namespace Results.Forms
}
}
public void Update(IList<WMeterRsltItemSpec> items)
public void Update(IList<Results.WMeterRsltItemSpec> items)
{
this.items = items;
-5
View File
@@ -343,11 +343,6 @@ namespace Results
X9, /// 291
RadioAddress, /// 292
OriRadioAddress, /// 293
Pls_per_ltr_aux, /// 294 Compound water meter constant (water meter data, not used in calculations)
Pulses_main, /// 295 Compound main meter pulses (recalculated so that the gated ref. pulses for this meter are equal to the total ref. pulses)
Pulses_aux, /// 296 Compound aux meter pulses (recalculated so that the gated ref. pulses for this meter are equal to the total ref. pulses)
Count,
}
+2 -2
View File
@@ -19,7 +19,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
+2 -2
View File
@@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -32,7 +32,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
-14
View File
@@ -96,8 +96,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResultsParser", "ResultsPar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sensus.iPerl.RfidCom", "..\iPerlHead\Sensus.iPerl.RfidCom\Sensus.iPerl.RfidCom.csproj", "{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NfcS5_DLL", "..\NfcS5_DLL\NfcS5_DLL.csproj", "{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -404,18 +402,6 @@ Global
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.ActiveCfg = Release|Any CPU
{A3E14180-7F00-42E5-94A9-8DB62EAD6EE8}.Release|x86.Build.0 = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|x86.ActiveCfg = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Debug|x86.Build.0 = Debug|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|Any CPU.Build.0 = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|x86.ActiveCfg = Release|Any CPU
{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+2 -10
View File
@@ -14,7 +14,6 @@ using Users;
using TBF.Resources;
using TBF.Rig.Sequences;
using TBF.UI.Shared;
using System.Threading;
namespace TBF
{
@@ -70,9 +69,7 @@ namespace TBF
[STAThread]
static void Main()
{
Application.ThreadException += new ThreadExceptionEventHandler(Form1_UIThreadException);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler);
/// Program version string
System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly();
@@ -539,12 +536,7 @@ namespace TBF
log.Info("Exiting application.");
}
private static void Form1_UIThreadException(object sender, ThreadExceptionEventArgs e)
{
LogException(log, "Unhandled thread exception", (Exception)e.Exception);
}
static void MyHandler(object sender, UnhandledExceptionEventArgs args)
static void MyHandler(object sender, UnhandledExceptionEventArgs args)
{
LogException(log, "Unhandled exception", (Exception)args.ExceptionObject);
}
+2 -2
View File
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.33.2140.0")]
[assembly: AssemblyFileVersion("2.33.2140.0")]
[assembly: AssemblyVersion("2.33.2102.0")]
[assembly: AssemblyFileVersion("2.33.2102.0")]
+10 -64
View File
@@ -19,7 +19,7 @@ namespace TBF.Resources {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
@@ -294,15 +294,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to All files.
/// </summary>
internal static string All_files {
get {
return ResourceManager.GetString("All_files", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to All tests must be completed.
/// </summary>
@@ -654,15 +645,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Calibration certificate.
/// </summary>
internal static string Calibration_certificate {
get {
return ResourceManager.GetString("Calibration_certificate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calibration certificate validity expired.
/// </summary>
@@ -1941,15 +1923,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Error when saving and printing results.
/// </summary>
internal static string Error_when_saving_and_printing_results {
get {
return ResourceManager.GetString("Error_when_saving_and_printing_results", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error while creating the database. Reason: .
/// </summary>
@@ -2301,15 +2274,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Get number of cycles to bypass.
/// </summary>
internal static string Get_number_of_cycles_to_bypass {
get {
return ResourceManager.GetString("Get_number_of_cycles_to_bypass", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Grab.
/// </summary>
@@ -3651,15 +3615,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to PDF files.
/// </summary>
internal static string PDF_files {
get {
return ResourceManager.GetString("PDF_files", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to PID.
/// </summary>
@@ -5136,15 +5091,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Set number of cycles to bypass.
/// </summary>
internal static string Set_number_of_cycles_to_bypass {
get {
return ResourceManager.GetString("Set_number_of_cycles_to_bypass", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Set route.
/// </summary>
@@ -5478,6 +5424,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to .
/// </summary>
internal static string String1 {
get {
return ResourceManager.GetString("String1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sun.
/// </summary>
@@ -6318,15 +6273,6 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Unlock a bypass.
/// </summary>
internal static string Unlock_bypass {
get {
return ResourceManager.GetString("Unlock_bypass", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unlock.
/// </summary>
+4 -25
View File
@@ -673,7 +673,7 @@
<value>Tiskárna</value>
</data>
<data name="Procedure" xml:space="preserve">
<value>Procedura</value>
<value>Prodedura</value>
</data>
<data name="Procedures" xml:space="preserve">
<value>Procedury</value>
@@ -1177,7 +1177,7 @@
<value>Tisk výsledků</value>
</data>
<data name="Procedure_name" xml:space="preserve">
<value>Jméno procedury</value>
<value>Jméno postupu</value>
</data>
<data name="Process" xml:space="preserve">
<value>Proces</value>
@@ -1213,7 +1213,7 @@
<value>Objem</value>
</data>
<data name="PrintBtnText" xml:space="preserve">
<value>Tisknout</value>
<value>Vytisknout</value>
</data>
<data name="Do_you_want_to_save_changes" xml:space="preserve">
<value>Chcete uložit změny?</value>
@@ -1675,7 +1675,7 @@
<value>Konfigurace testu {0} : chybí {1}</value>
</data>
<data name="Print" xml:space="preserve">
<value>Tisknout</value>
<value>Vytisknout</value>
</data>
<data name="Printer_selection" xml:space="preserve">
<value>Výběr tiskárny</value>
@@ -1683,25 +1683,4 @@
<data name="default_printer" xml:space="preserve">
<value>předvolená tiskárna</value>
</data>
<data name="Get_number_of_cycles_to_bypass" xml:space="preserve">
<value>Zjisti počet cyklů bez kontroly</value>
</data>
<data name="Set_number_of_cycles_to_bypass" xml:space="preserve">
<value>Nastav počet cyklů bez kontroly</value>
</data>
<data name="Unlock_bypass" xml:space="preserve">
<value>Odemknout vypnutí kontroly</value>
</data>
<data name="All_files" xml:space="preserve">
<value>Všechny soubory</value>
</data>
<data name="Calibration_certificate" xml:space="preserve">
<value>Kalibrační certifikát</value>
</data>
<data name="PDF_files" xml:space="preserve">
<value>PDF soubory</value>
</data>
<data name="Error_when_saving_and_printing_results" xml:space="preserve">
<value>Chyba při ukládání a tisknutí výsledků</value>
</data>
</root>
-24
View File
@@ -2314,28 +2314,4 @@
<data name="default_printer" xml:space="preserve">
<value>default printer</value>
</data>
<data name="Get_number_of_cycles_to_bypass" xml:space="preserve">
<value>Get number of cycles to bypass</value>
</data>
<data name="Set_number_of_cycles_to_bypass" xml:space="preserve">
<value>Set number of cycles to bypass</value>
</data>
<data name="Unlock_bypass" xml:space="preserve">
<value>Unlock a bypass</value>
</data>
<data name="Error_reading_configuration_database" xml:space="preserve">
<value>Error reading configuration database</value>
</data>
<data name="All_files" xml:space="preserve">
<value>All files</value>
</data>
<data name="Calibration_certificate" xml:space="preserve">
<value>Calibration certificate</value>
</data>
<data name="PDF_files" xml:space="preserve">
<value>PDF files</value>
</data>
<data name="Error_when_saving_and_printing_results" xml:space="preserve">
<value>Error when saving and printing results</value>
</data>
</root>
-19
View File
@@ -1,19 +0,0 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using System;
namespace TBF.Rig
{
public class DataChangeArgs : EventArgs
{
public CfgChangeCmd Command;
public object Data;
public DataChangeArgs(CfgChangeCmd command, object data)
{
Command = command;
Data = data;
}
}
}
@@ -47,7 +47,6 @@ 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; }
@@ -89,7 +88,6 @@ namespace TBF.Rig.DataContainers.BenchInfo.iPerl
MaxTestIndex = 4;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -351,10 +349,6 @@ 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()
@@ -27,7 +27,6 @@ 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; }
@@ -51,7 +50,6 @@ namespace TBF.Rig.DataContainers.Buoyancy
Buoyancy = 1.00103;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -114,10 +112,6 @@ 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()
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Rig.Generic;
@@ -14,7 +14,7 @@ namespace TBF.Rig.DataContainers.Buoyancy
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(GetType().Namespace.Substring(23), this); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
@@ -28,7 +28,6 @@ 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; }
@@ -53,7 +52,6 @@ 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;
}
@@ -124,10 +122,6 @@ 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()
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Rig.Generic;
@@ -14,7 +14,7 @@ namespace TBF.Rig.DataContainers.Density
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(GetType().Namespace.Substring(23), this); }
public IComponentCfg DefaultConfig() { return new ComponentCfg(this.GetType().Namespace.Substring(32), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
@@ -21,7 +21,6 @@ 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; }
@@ -43,7 +42,6 @@ namespace TBF.Rig.DataContainers.Evaporation
public void InitializeAll()
{
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2020-2023 Sensus Slovensko a.s.
/// Copyright (c) 2020 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using TBF.Rig.Generic;
@@ -16,7 +16,7 @@ namespace TBF.Rig.DataContainers.Evaporation
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
public IComponentCfg DefaultConfig() { return new EvaporationCfg(GetType().Namespace.Substring(23), this); }
public IComponentCfg DefaultConfig() { return new EvaporationCfg(this.GetType().Namespace.Substring(32), this); }
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
{
+6 -42
View File
@@ -6,22 +6,21 @@ using Common;
namespace TBF.Rig.DataEntry
{
/// <summary>
/// Action of a DataEntry field
/// </summary>
///
/// Ac = Action
///
public enum Ac
{
[Description("Clear")] Clear, /// Clear when the form is open, save on OK
[Description("Last from history")] HistoryLast,
[Description("Load")] Load, /// Load from water meters when the form is open, save on OK
[Description("Load (readonly)")] LoadReadOnly, /// Load from water meters when the form is open, prevent changes, do not save
[Description("Set")] Set, /// Set to 'yes' when the form is open
Count,
}
/// <summary>
/// Content of a DataEntry field
/// </summary>
///
/// Ct = Content
///
public enum Ct
{
[Description("None")] None,
@@ -30,9 +29,7 @@ namespace TBF.Rig.DataEntry
[Description("Radio address")] RadioAddress,
[Description("Year of calibration")] YearOfCalibration,
[Description("Start state")] StartState,
[Description("Start state aux")] StartStateAux,
[Description("End state")] EndState,
[Description("End state aux")] EndStateAux,
[Description("Archive path")] ArchivePath,
[Description("WM Order")] WmOrder,
[Description("Batch order")] BatchOrder,
@@ -40,7 +37,6 @@ namespace TBF.Rig.DataEntry
[Description("WM Remark")] WmRemark,
[Description("Batch remark")] BatchRemark,
[Description("Batch and WM remark")] BatchAndWmRemark,
[Description("Print label")] PrintLabel,
#if ORACLE_DB
[Description("Prefix")] Prefix,
[Description("Suffix")] Suffix,
@@ -48,38 +44,6 @@ namespace TBF.Rig.DataEntry
Count
}
/// <summary>
/// Function of the multi purpose button
/// </summary>
public enum MultiPurposeBtnFunction
{
None,
AutoSN,
PrintLabelsOnOff,
}
///
/// Identifies image instance
///
public enum Tst
{
Start,
End,
Both,
}
///
/// Image rotation
///
public enum Rotation
{
R0,
R90,
R180,
R270,
Count
}
public class DEItem
{
public readonly Ct Content;
+13 -23
View File
@@ -3,7 +3,6 @@
///
using System.Windows.Forms;
using Results.Entities;
using TBF.Resources;
namespace TBF.Rig.DataEntry
{
@@ -16,25 +15,22 @@ namespace TBF.Rig.DataEntry
switch (content)
{
default:
case Ct.None: return string.Empty;
case Ct.SerialNr: return (!wm.Disabled && wm.SerialNr != null) ? wm.SerialNr : string.Empty;
case Ct.SerialNrAux: return (!wm.Disabled && wm.SerialNrAux != null) ? wm.SerialNrAux : string.Empty;
case Ct.RadioAddress: return (!wm.Disabled && wm.RadioAddress != null) ? wm.RadioAddress : string.Empty;
case Ct.None: return string.Empty;
case Ct.SerialNr: return (!wm.Disabled && wm.SerialNr != null) ? wm.SerialNr : string.Empty;
case Ct.SerialNrAux: return (!wm.Disabled && wm.SerialNrAux != null) ? wm.SerialNrAux : string.Empty;
case Ct.RadioAddress: return (!wm.Disabled && wm.RadioAddress != null) ? wm.RadioAddress : string.Empty;
case Ct.YearOfCalibration: return (!wm.Disabled) ? wm.YearOfProduction.ToString() : string.Empty;
case Ct.StartState: return (!wm.Disabled && wm.GetStartState() != null) ? wm.GetStartState() : string.Empty;
case Ct.StartStateAux: return string.Empty;
case Ct.EndState: return (!wm.Disabled && wm.EndState != null) ? wm.EndState : string.Empty;
case Ct.EndStateAux: return (!wm.Disabled && wm.GetEndStateAux() != null) ? wm.GetEndStateAux() : string.Empty;
case Ct.ArchivePath: return (!wm.Disabled && wm.ArchivePath != null) ? wm.ArchivePath : string.Empty;
case Ct.StartState: return (!wm.Disabled && wm.GetStartState() != null) ? wm.GetStartState() : string.Empty;
case Ct.EndState: return (!wm.Disabled && wm.EndState != null) ? wm.EndState : string.Empty;
case Ct.ArchivePath: return (!wm.Disabled && wm.ArchivePath != null) ? wm.ArchivePath : string.Empty;
case Ct.WmOrder: return (!wm.Disabled && wm.PurchaseOrder != null) ? wm.PurchaseOrder : string.Empty;
case Ct.BatchOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
case Ct.BatchAndWmOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
case Ct.WmOrder: return (!wm.Disabled && wm.PurchaseOrder != null) ? wm.PurchaseOrder : string.Empty;
case Ct.BatchOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
case Ct.BatchAndWmOrder: return (wm.Batch != null && wm.Batch.PurchaseOrder != null) ? wm.Batch.PurchaseOrder : string.Empty;
case Ct.WmRemark: return (!wm.Disabled && wm.Remark != null) ? wm.Remark : string.Empty;
case Ct.BatchRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
case Ct.BatchAndWmRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
case Ct.PrintLabel: return wm.PrintLabel ? Strings.yes : Strings.no;
case Ct.WmRemark: return (!wm.Disabled && wm.Remark != null) ? wm.Remark : string.Empty;
case Ct.BatchRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
case Ct.BatchAndWmRemark: return (wm.Batch != null && wm.Batch.Remark != null) ? wm.Batch.Remark : string.Empty;
#if ORACLE_DB
case Ct.Prefix: return (!wm.Disabled && wm.Prefix != null) ? wm.Prefix : string.Empty;
case Ct.Suffix: return (!wm.Disabled && wm.Suffix != null) ? wm.Suffix : string.Empty;
@@ -57,9 +53,7 @@ namespace TBF.Rig.DataEntry
case Ct.RadioAddress: wm.RadioAddress = value; return;
case Ct.YearOfCalibration: if (int.TryParse(value, out year)) wm.YearOfProduction = year; return;
case Ct.StartState: wm.SetStartState(value); return;
case Ct.StartStateAux: return;
case Ct.EndState: wm.EndState = value; return;
case Ct.EndStateAux: wm.SetEndStateAux(value); return;
case Ct.ArchivePath: wm.ArchivePath = value; return;
case Ct.WmOrder:
@@ -79,10 +73,6 @@ namespace TBF.Rig.DataEntry
case Ct.BatchAndWmRemark:
if (wm.Batch != null) wm.Batch.Remark = value;
return;
case Ct.PrintLabel:
wm.PrintLabel = (value == Strings.yes);
return;
#if ORACLE_DB
case Ct.Prefix: wm.Prefix = value; return;
case Ct.Suffix: wm.Suffix = value; return;
+12 -185
View File
@@ -50,9 +50,6 @@ namespace TBF.Rig.DataEntry.Uni
readonly ComboBox[,] comboBoxes; /// Combo boxes for values in columns
readonly CheckBox[] checkBoxes; /// Check boxes for water meter enable/disable
readonly MultiPurposeBtnFunction multiPurposeButtonFn;
bool multiPurposeButtonFlag;
readonly LocalSettings ls;
bool isHandlersEnabled; /// Initially false, set to true after ComboBoxes are filled with data
@@ -127,34 +124,6 @@ namespace TBF.Rig.DataEntry.Uni
comboBoxes = new ComboBox[colItems.Count, wmsCount];
checkBoxes = new CheckBox[wmsCount];
///
/// Determine the multi purpose button function
///
multiPurposeButton.Visible = false;
multiPurposeButtonFn = MultiPurposeBtnFunction.None;
int buttonsWidth = 350;
for (int k = 0; k < colItems.Count; k++)
{
if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly)
{
multiPurposeButton.Visible = true;
multiPurposeButton.Text = "Auto s/n";
multiPurposeButtonFn = MultiPurposeBtnFunction.AutoSN;
buttonsWidth += 147;
break;
}
if (colItems[k].Content == Ct.PrintLabel)
{
multiPurposeButton.Visible = true;
multiPurposeButton.Text = string.Format("{0} ({1}/{2})", Strings.Print, Strings.yes, Strings.no);
multiPurposeButtonFn = MultiPurposeBtnFunction.PrintLabelsOnOff;
multiPurposeButtonFlag = false;
buttonsWidth += 147;
break;
}
}
/// Layout related readonly variables derived from argument 'sz'
switch (sz)
{
@@ -163,7 +132,7 @@ namespace TBF.Rig.DataEntry.Uni
meterHeight = 26; /// Height of a ComboBox control
margin = 20;
spacing = 8;
this.buttonsWidth = buttonsWidth;
buttonsWidth = 350;
hdrHeight = 120;
labelWid = 31;
checkBoxWid = 23;
@@ -175,7 +144,7 @@ namespace TBF.Rig.DataEntry.Uni
meterHeight = 31; /// Height of a ComboBox control
margin = 25;
spacing = 10;
this.buttonsWidth = buttonsWidth;
buttonsWidth = 350;
hdrHeight = 140;
labelWid = 34;
checkBoxWid = 23;
@@ -186,7 +155,7 @@ namespace TBF.Rig.DataEntry.Uni
meterHeight = 37; /// Height of a ComboBox control
margin = 30;
spacing = 12;
this.buttonsWidth = buttonsWidth;
buttonsWidth = 350;
hdrHeight = 160;
labelWid = 40;
checkBoxWid = 23;
@@ -267,8 +236,6 @@ namespace TBF.Rig.DataEntry.Uni
///
/// Table
///
int commonCheckBoxLeft = 0;
int commonCheckBoxTop = 0;
int columnsTop = Math.Max(hdrHeight, groupBoxHeight + 2 * margin + spacing);
for (int j = 0; j < linesCount; j++)
{
@@ -327,22 +294,14 @@ namespace TBF.Rig.DataEntry.Uni
TabIndex = tabIndex++,
Parent = this,
};
comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);
comboBox.TextChanged += new System.EventHandler(this.comboBox_TextChanged);
comboBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox_KeyPress);
if (ci.Content == Ct.PrintLabel)
{
comboBox.Items.Add(Strings.yes);
comboBox.Items.Add(Strings.no);
}
else
{
var lastVals = GetHistoryFromLS(isEnd, k);
comboBox.Items.Add(lastVals.Length > wmPos0 ? lastVals[wmPos0] : string.Empty); /// History in drop-down menu
}
var lastVals = GetHistoryFromLS(isEnd, k);
comboBox.Items.Add(lastVals.Length > wmPos0 ? lastVals[wmPos0] : string.Empty); /// History in drop-down menu
left += ci.Width + spacing;
comboBoxes[k, wmPos0] = comboBox;
this.Controls.Add(comboBox);
@@ -357,26 +316,7 @@ namespace TBF.Rig.DataEntry.Uni
};
checkBoxes[wmPos0] = checkBox;
this.Controls.Add(checkBox);
if (commonCheckBoxLeft == 0)
{
commonCheckBoxLeft = left;
commonCheckBoxTop = columnsTop - meterHeight;
}
}
okButton.TabIndex = tabIndex++;
clearButton.TabIndex = tabIndex++;
var commonCheckBox = new CheckBox
{
Location = new Point(commonCheckBoxLeft, commonCheckBoxTop + 6),
Size = new Size(checkBoxWid, 23),
TabIndex = tabIndex++,
Parent = this,
};
commonCheckBox.CheckedChanged += new System.EventHandler(commonCheckBox_CheckedChanged);
this.Controls.Add(commonCheckBox);
}
///
@@ -502,10 +442,6 @@ namespace TBF.Rig.DataEntry.Uni
case Ac.LoadReadOnly:
commonComboBoxes[ix].Text = DEUtils.GetContent(commonItems[ix].Content, firstValidWM);
break;
case Ac.Set:
commonComboBoxes[ix].Text = Strings.yes;
break;
}
}
@@ -533,13 +469,6 @@ namespace TBF.Rig.DataEntry.Uni
comboBoxes[k, i].Text = DEUtils.GetContent(colItems[k].Content, WaterMeters[i]);
}
break;
case Ac.Set:
for (int i = 0; i < wmsCount; i++)
{
comboBoxes[k, i].Text = (WaterMeters[i] != null && !WaterMeters[i].Disabled) ? Strings.yes : Strings.no;
}
break;
}
}
@@ -645,120 +574,18 @@ namespace TBF.Rig.DataEntry.Uni
}
}
private void commonCheckBox_CheckedChanged(object sender, EventArgs e)
private void clearButton_Click(object sender, EventArgs e)
{
bool state = (sender as CheckBox).Checked;
for (int i = 0; i < wmsCount; i++)
{
checkBoxes[i].Checked = state;
}
InitializeBoxes();
}
private void okButton_Click(object sender, EventArgs e)
private void okButton_Click(object sender, EventArgs e)
{
UpdateWMsFromBoxes();
completed = true;
Close();
}
private void clearButton_Click(object sender, EventArgs e)
{
InitializeBoxes();
}
private void multiPurposeButton_Click(object sender, EventArgs e)
{
if (multiPurposeButtonFn == MultiPurposeBtnFunction.None) return;
if (multiPurposeButtonFn == MultiPurposeBtnFunction.AutoSN)
{
///
/// Find the 1st enabled water meter
///
int firstIx;
for (firstIx = 0; firstIx < wmsCount; firstIx++)
{
if (checkBoxes[firstIx].Checked) break;
}
if (firstIx == wmsCount)
{
return; /// There is not any enabled water meter
}
char[] digits = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
///
/// Find a column with serial numbers
///
for (int k = 0; k < colItems.Count; k++)
{
if ((colItems[k].Content == Ct.SerialNr || colItems[k].Content == Ct.SerialNrAux) && colItems[k].Action != Ac.LoadReadOnly)
{
///
/// Column with serial numbers found => perform an auto s/n assignment
///
string firstSN = comboBoxes[k, firstIx].Text;
int firstSnNr;
int startIx = firstSN.IndexOfAny(digits);
if (startIx >= 0)
{
int lastDigitPosPlus1 = startIx + 1;
var listOfDigits = new List<char>(digits);
while (lastDigitPosPlus1 < firstSN.Length && listOfDigits.Contains(firstSN[lastDigitPosPlus1]))
{
lastDigitPosPlus1++;
}
int digitsCount = lastDigitPosPlus1 - startIx;
if (int.TryParse(firstSN.Substring(startIx, digitsCount), out firstSnNr) && firstSnNr >= 0)
{
for (int ix = firstIx + 1; ix < wmsCount; ix++)
{
if (checkBoxes[ix].Checked)
{
firstSnNr++;
string newSN = firstSnNr.ToString();
int len = newSN.Length;
if (len <= digitsCount)
{
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx + digitsCount - len) + newSN + firstSN.Substring(startIx + digitsCount);
}
else
{
comboBoxes[k, ix].Text = firstSN.Substring(0, startIx) + newSN + firstSN.Substring(startIx + digitsCount); ;
}
}
}
}
}
}
}
}
if (multiPurposeButtonFn == MultiPurposeBtnFunction.PrintLabelsOnOff)
{
///
/// Find a column with Ct.PrintLabel
///
for (int k = 0; k < colItems.Count; k++)
{
if (colItems[k].Content == Ct.PrintLabel)
{
for (int ix = 0; ix < wmsCount; ix++)
{
if (WaterMeters[ix] != null && !WaterMeters[ix].Disabled)
{
comboBoxes[k, ix].Text = multiPurposeButtonFlag ? Strings.yes : Strings.no;
}
}
}
}
multiPurposeButtonFlag = !multiPurposeButtonFlag;
}
}
private void comboBox_SelectedIndexChanged(object sndr, EventArgs e)
{
if (!isHandlersEnabled) return;
@@ -769,7 +596,7 @@ namespace TBF.Rig.DataEntry.Uni
isHandlersEnabled = false;
if (k >= 0 && colItems[k].Content != Ct.PrintLabel && comboBoxes[k, j].Text == comboBoxes[k, j].Items[0].ToString())
if (k >= 0 && comboBoxes[k, j].Text == comboBoxes[k, j].Items[0].ToString())
{
for (int i = 0; i < wmsCount; i++)
{
-11
View File
@@ -34,7 +34,6 @@ namespace TBF.Rig.DataEntry.Uni
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CycleBgEnForm));
this.okButton = new System.Windows.Forms.Button();
this.clearButton = new System.Windows.Forms.Button();
this.multiPurposeButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// okButton
@@ -53,20 +52,11 @@ namespace TBF.Rig.DataEntry.Uni
this.clearButton.UseVisualStyleBackColor = true;
this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
//
// multiPurposeButton
//
resources.ApplyResources(this.multiPurposeButton, "multiPurposeButton");
this.multiPurposeButton.ForeColor = System.Drawing.Color.Black;
this.multiPurposeButton.Name = "multiPurposeButton";
this.multiPurposeButton.UseVisualStyleBackColor = true;
this.multiPurposeButton.Click += new System.EventHandler(this.multiPurposeButton_Click);
//
// CycleBgEnForm
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.DarkGray;
this.Controls.Add(this.multiPurposeButton);
this.Controls.Add(this.clearButton);
this.Controls.Add(this.okButton);
this.ForeColor = System.Drawing.Color.Black;
@@ -81,6 +71,5 @@ namespace TBF.Rig.DataEntry.Uni
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button clearButton;
private System.Windows.Forms.Button multiPurposeButton;
}
}
+1 -37
View File
@@ -148,7 +148,7 @@
<value>$this</value>
</data>
<data name="&gt;&gt;okButton.ZOrder" xml:space="preserve">
<value>2</value>
<value>1</value>
</data>
<data name="clearButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
@@ -181,42 +181,6 @@
<value>$this</value>
</data>
<data name="&gt;&gt;clearButton.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="multiPurposeButton.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Right</value>
</data>
<data name="multiPurposeButton.Font" type="System.Drawing.Font, System.Drawing">
<value>Verdana, 14.25pt</value>
</data>
<data name="multiPurposeButton.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="multiPurposeButton.Location" type="System.Drawing.Point, System.Drawing">
<value>648, 26</value>
</data>
<data name="multiPurposeButton.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 63</value>
</data>
<data name="multiPurposeButton.TabIndex" type="System.Int32, mscorlib">
<value>9</value>
</data>
<data name="multiPurposeButton.Text" xml:space="preserve">
<value>Multi purpose</value>
</data>
<data name="multiPurposeButton.Visible" type="System.Boolean, mscorlib">
<value>False</value>
</data>
<data name="&gt;&gt;multiPurposeButton.Name" xml:space="preserve">
<value>multiPurposeButton</value>
</data>
<data name="&gt;&gt;multiPurposeButton.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;multiPurposeButton.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;multiPurposeButton.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+1 -4
View File
@@ -347,7 +347,7 @@ namespace TBF.Rig.DataEntry.Uni
BgItemContent = new Ct[1] { Ct.BatchAndWmOrder };
BgItemCaption = new string[1] { "Order nr." };
BgItemAction = new Ac[1] { Ac.HistoryLast };
BgItemAction = new Ac[1] { Ac.Clear };
BgItemWidth = new int[1] { 200 };
BgColumnContent = new Ct[1] { Ct.SerialNr };
@@ -539,13 +539,10 @@ namespace TBF.Rig.DataEntry.Uni
Ct.RadioAddress.ToDescription(),
Ct.YearOfCalibration.ToDescription(),
Ct.StartState.ToDescription(),
Ct.StartStateAux.ToDescription(),
Ct.EndState.ToDescription(),
Ct.EndStateAux.ToDescription(),
Ct.ArchivePath.ToDescription(),
Ct.WmOrder.ToDescription(),
Ct.WmRemark.ToDescription(),
Ct.PrintLabel.ToDescription(),
};
}
case 2:
-2
View File
@@ -31,7 +31,6 @@ 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; }
@@ -54,7 +53,6 @@ namespace TBF.Rig.Elde.Diverter
ThresholdHi = 90;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
-34
View File
@@ -54,12 +54,6 @@ 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;
@@ -172,34 +166,6 @@ 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)
+2 -35
View File
@@ -1,8 +1,9 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.Rig.Generic;
@@ -54,12 +55,6 @@ 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;
@@ -172,34 +167,6 @@ 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)
+1 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -26,7 +26,6 @@ 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; }
@@ -29,7 +29,6 @@ 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; }
-2
View File
@@ -29,7 +29,6 @@ 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; }
@@ -52,7 +51,6 @@ namespace TBF.Rig.Elde.TempMeter
DefaultTemperature = 20.0;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -29,7 +29,6 @@ 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; }
@@ -52,7 +51,6 @@ namespace TBF.Rig.Elde.TempMeterInternal
A5 = 0;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -44,7 +44,6 @@ 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; }
@@ -70,7 +69,6 @@ namespace TBF.Rig.Elde.TempMeterMeret
MeretIdx0 = 4;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -174,10 +172,6 @@ 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;
}
+1 -4
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
///
namespace TBF.Rig
{
@@ -31,8 +31,6 @@ namespace TBF.Rig
GetAdc, /// Get regul.valve or diverter ADC
GetAdc1, /// Get regul.valve or diverter ADC feedback value #1
GetAdc2, /// Get regul.valve or diverter ADC feedback value #2
SetData, /// Generic set
GetData, /// Generic get
}
public enum ValveCategory
@@ -77,7 +75,6 @@ namespace TBF.Rig
Starting, /// During initial phase of some process, sending a command to a device, etc.
Busy, /// Useful when waiting in state until at least one is busy (all are done)
Done, /// Useful when waiting in state until the first is done, the rest miht still be busy
Crashed, /// Run() function of an operation crashed
MakeSecondPass, /// Test completed OK but 2nd pass (evaluation) is required
EndSession, /// Test completed OK (similarly to Event.Done), 'End session' button click is automatically invoked
///
+4 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
/// Copyright (c) 2018 Sensus Metering Systems
///
using System;
using TBF.Rig.Generic;
@@ -11,9 +11,8 @@ namespace TBF.Rig.GenericDevices
///
/// Parameters displayed in Metrology tab page
///
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)
string CalibCertificateNr { get; set; } /// calibration certificate number
DateTime CalibDate { get; set; } /// date of calibration
DateTime CalibValidDate { get; set; } /// calibration valid until (date)
}
}
+3 -5
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2018 Sensus Slovensko a.s.
///
using System;
using TBF.Rig.Generic;
@@ -20,13 +20,11 @@ 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 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)
void SetCalibDate(int rangeIx1, DateTime date); /// Get the date of calibration
void SetCalibValidDate(int rangeIx1, DateTime date); /// Get calibration valid until (date)
}
}
+4 -7
View File
@@ -1,10 +1,13 @@
///
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
/// Copyright (c) 2018-2021 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
@@ -35,7 +38,6 @@ 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; }
@@ -61,7 +63,6 @@ namespace TBF.Rig.Hart.Nivotrack
Par2 = 8;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -178,10 +179,6 @@ 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;
}
+2 -2
View File
@@ -1,8 +1,9 @@
///
/// Copyright (c) 2016-2023 Sensus Slovensko a.s.
/// Copyright (c) 2016-2021 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using TBF.Rig.Generic;
@@ -36,7 +37,6 @@ 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; }
+50 -18
View File
@@ -1,7 +1,8 @@
///
/// Copyright (c) 2015-2023 Sensus Slovensko a.s.
/// Copyright (c) 2015-2018 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
@@ -47,20 +48,56 @@ namespace TBF.Rig.MettlerToledo.Multi
public StopBits StopBits;
public Handshake Handshake;
/// 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; }
///
/// 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; }
}
/// Private parameterless constructor invoked by all other (public) constructors
BalanceCfg()
BalanceCfg()
{
Name = "Balance";
ParentName = string.Empty;
@@ -82,11 +119,6 @@ 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)
+2 -3
View File
@@ -1,7 +1,8 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2021 Sensus Slovensko a.s.
///
using System;
using System.IO;
using System.Collections.Generic;
using System.IO.Ports;
using System.Xml.Serialization;
@@ -51,7 +52,6 @@ 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,7 +88,6 @@ namespace TBF.Rig.MettlerToledo.Standard
BuoyancyHumi = 40.0f;
CalibCertificateNr = string.Empty;
CertPath = string.Empty;
CalibDate = TBF.UI.Constants.MinDate;
CalibValidDate = TBF.UI.Constants.MaxDate;
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2016-2023 Sensus Metering Systems
/// Copyright (c) 2016 Sensus Metering Systems
///
using System;
using System.Collections.Generic;
+5 -45
View File
@@ -3,6 +3,7 @@
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using log4net;
using FluentNHibernate.Cfg;
@@ -10,7 +11,9 @@ using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Criterion;
using Common;
using Config.Entities;
using TracingDB.Entities;
using Events.Entities;
namespace TBF.Rig.Output.DB.ProductionTracing
{
@@ -88,9 +91,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
Workstep verifiedWorkstep;
Part verifiedPart; /// Applicable when verifyReferencePart == false
bool verifyReferencePart;
int CyclesToSkip;
public Tracing() {}
@@ -136,9 +137,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
session.Close();
TracingDB.DB.SessionFactory = sessionFactory;
CyclesToSkip = 0;
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
@@ -147,35 +145,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
}
}
#region Configuration Change Handling
public static void OnDataChange(object sender, DataChangeArgs args)
{
if (DataChangeHandler == null) return;
try { DataChangeHandler(sender, args); }
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
}
public static event EventHandler<DataChangeArgs> DataChangeHandler;
public override void StartChangeHandler()
{
DataChangeHandler += delegate (object sender, DataChangeArgs args)
{
var intbox = args.Data as Boxes.IntBox;
if (args.Command == CfgChangeCmd.SetData && intbox != null)
{
CyclesToSkip = intbox.Val;
}
else if (args.Command == CfgChangeCmd.GetData)
{
TracingCfgCtrl.OnCmdResponse(this, new CmdResponseArgs(CfgChangeCmd.GetData, 0, CyclesToSkip));
}
};
}
#endregion Configuration Change Handling
///
/// IDevice interface implementation
///
@@ -273,16 +242,7 @@ namespace TBF.Rig.Output.DB.ProductionTracing
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOpState);
opCompleted = true;
if (CyclesToSkip > 0)
{
CyclesToSkip--;
}
else if (CheckPreviousRecords(waterMeters) != Retv.OK)
{
anyError = true;
}
if (CheckPreviousRecords(waterMeters) != Retv.OK) anyError = true;
return anyError ? Event.InfoNotRead : Event.InfoRead;
}
else
@@ -2,23 +2,18 @@
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using System.Collections.Generic;
using System.Net;
using System.Windows.Forms;
using log4net;
using Common;
using TBF.Resources;
using TBF.Rig.Generic;
using TBF.Rig.Elde.Diverter;
using TBF.Boxes;
namespace TBF.Rig.Output.DB.ProductionTracing
{
public partial class TracingCfgCtrl : Configs.ConfigCtrlUtils, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(TracingCfgCtrl));
public bool ShowMore { get { return false; } }
public bool ShowMore { get { return false; } }
MonitoringCfg config;
public IComponentCfg Config
@@ -39,24 +34,14 @@ namespace TBF.Rig.Output.DB.ProductionTracing
private void WriterCfgCtrl_Load(object sender, EventArgs e)
{
if (config == null) return;
Localize();
Redraw();
StartResponseHandler();
}
}
public void Closing()
public void Closing()
{
StopResponseHandler();
}
}
void Localize()
{
unlockBypassButton.Text = Strings.Unlock_bypass;
setCyclesToBypassButton.Text = Strings.Set_number_of_cycles_to_bypass;
getCyclesToBypassButton.Text = Strings.Get_number_of_cycles_to_bypass;
}
void Redraw()
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -121,27 +106,9 @@ namespace TBF.Rig.Output.DB.ProductionTracing
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
saveTracingRecordsCheckBox.Enabled = true;
cyclesToBypassTextBox.Enabled = true;
setCyclesToBypassButton.Enabled = true;
unlockBypassButton.Enabled = false;
}
private void unlockSkipCyclesButton_Click(object sender, EventArgs e)
{
var reqrdGrpMembership = new GID[] { GID.TraceabilityManagement, GID.HeadOfLab };
if (!Users.CurrentUser.IsMemberOf(reqrdGrpMembership))
{
if (new Users.Forms.LoginDlg(TBF.DB.UserSessionFactories, reqrdGrpMembership, ParentForm).ShowDialog() != DialogResult.OK)
return;
}
cyclesToBypassTextBox.Enabled = true;
setCyclesToBypassButton.Enabled = true;
unlockBypassButton.Enabled = false;
}
public CfgUpdateFlags VerifyCfg(ref string message)
public CfgUpdateFlags VerifyCfg(ref string message)
{
return CfgUpdateFlags.None;
}
@@ -174,54 +141,5 @@ namespace TBF.Rig.Output.DB.ProductionTracing
return flags;
}
private void setCyclesToSkipButton_Click(object sender, EventArgs e)
{
int cyclesToSkip = 0;
if (!int.TryParse(cyclesToBypassTextBox.Text, out cyclesToSkip) || cyclesToSkip < 0 || cyclesToSkip > 20)
{
MessageBox.Show(string.Format(Strings.Invalid_0, "(0..20)"));
return;
}
Tracing.OnDataChange(this, new DataChangeArgs(CfgChangeCmd.SetData, new IntBox(cyclesToSkip)));
}
private void getCyclesToSkipButton_Click(object sender, EventArgs e)
{
Tracing.OnDataChange(this, new DataChangeArgs(CfgChangeCmd.GetData, null));
}
#region Data Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
{
if (CmdResponseHandler == null) return;
try { CmdResponseHandler(sender, args); }
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
}
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
public void StartResponseHandler()
{
CmdResponseHandler += DoCmdResponse;
}
public void StopResponseHandler()
{
CmdResponseHandler -= DoCmdResponse;
}
void DoCmdResponse(object sender, CmdResponseArgs args)
{
if (args.Command == CfgChangeCmd.GetData)
{
cyclesToBypassTextBox2.Text = args.Response.ToString();
}
}
#endregion Configuration Change Handling
}
}
}
+2 -101
View File
@@ -40,15 +40,6 @@ namespace TBF.Rig.Output.DB.ProductionTracing
this.checkPreviousRecordsCheckBox = new System.Windows.Forms.CheckBox();
this.netAdapterLabel = new System.Windows.Forms.Label();
this.netAdapterComboBox = new System.Windows.Forms.ComboBox();
this.cyclesToBypassTextBox = new System.Windows.Forms.TextBox();
this.setCyclesToBypassButton = new System.Windows.Forms.Button();
this.getCyclesToBypassButton = new System.Windows.Forms.Button();
this.cyclesToBypassTextBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.bypassGroupBox = new System.Windows.Forms.GroupBox();
this.unlockBypassButton = new System.Windows.Forms.Button();
this.bypassGroupBox.SuspendLayout();
this.SuspendLayout();
//
// nameTextBox
@@ -134,90 +125,10 @@ namespace TBF.Rig.Output.DB.ProductionTracing
this.netAdapterComboBox.Size = new System.Drawing.Size(435, 21);
this.netAdapterComboBox.TabIndex = 8;
//
// cyclesToBypassTextBox
//
this.cyclesToBypassTextBox.Enabled = false;
this.cyclesToBypassTextBox.Location = new System.Drawing.Point(41, 25);
this.cyclesToBypassTextBox.Name = "cyclesToBypassTextBox";
this.cyclesToBypassTextBox.Size = new System.Drawing.Size(50, 20);
this.cyclesToBypassTextBox.TabIndex = 11;
//
// setCyclesToBypassButton
//
this.setCyclesToBypassButton.Enabled = false;
this.setCyclesToBypassButton.Location = new System.Drawing.Point(113, 23);
this.setCyclesToBypassButton.Name = "setCyclesToBypassButton";
this.setCyclesToBypassButton.Size = new System.Drawing.Size(163, 23);
this.setCyclesToBypassButton.TabIndex = 13;
this.setCyclesToBypassButton.Text = "Set number of cycles to bypass";
this.setCyclesToBypassButton.UseVisualStyleBackColor = true;
this.setCyclesToBypassButton.Click += new System.EventHandler(this.setCyclesToSkipButton_Click);
//
// getCyclesToBypassButton
//
this.getCyclesToBypassButton.Location = new System.Drawing.Point(41, 59);
this.getCyclesToBypassButton.Name = "getCyclesToBypassButton";
this.getCyclesToBypassButton.Size = new System.Drawing.Size(163, 23);
this.getCyclesToBypassButton.TabIndex = 14;
this.getCyclesToBypassButton.Text = "Get number of cycles to bypass";
this.getCyclesToBypassButton.UseVisualStyleBackColor = true;
this.getCyclesToBypassButton.Click += new System.EventHandler(this.getCyclesToSkipButton_Click);
//
// cyclesToBypassTextBox2
//
this.cyclesToBypassTextBox2.Location = new System.Drawing.Point(226, 61);
this.cyclesToBypassTextBox2.Name = "cyclesToBypassTextBox2";
this.cyclesToBypassTextBox2.Size = new System.Drawing.Size(50, 20);
this.cyclesToBypassTextBox2.TabIndex = 15;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(93, 28);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(19, 13);
this.label1.TabIndex = 16;
this.label1.Text = "-->";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(205, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(19, 13);
this.label2.TabIndex = 17;
this.label2.Text = "-->";
//
// bypassGroupBox
//
this.bypassGroupBox.Controls.Add(this.getCyclesToBypassButton);
this.bypassGroupBox.Controls.Add(this.label2);
this.bypassGroupBox.Controls.Add(this.cyclesToBypassTextBox);
this.bypassGroupBox.Controls.Add(this.label1);
this.bypassGroupBox.Controls.Add(this.setCyclesToBypassButton);
this.bypassGroupBox.Controls.Add(this.cyclesToBypassTextBox2);
this.bypassGroupBox.Location = new System.Drawing.Point(118, 222);
this.bypassGroupBox.Name = "bypassGroupBox";
this.bypassGroupBox.Size = new System.Drawing.Size(324, 99);
this.bypassGroupBox.TabIndex = 18;
this.bypassGroupBox.TabStop = false;
//
// unlockBypassButton
//
this.unlockBypassButton.Location = new System.Drawing.Point(8, 228);
this.unlockBypassButton.Name = "unlockBypassButton";
this.unlockBypassButton.Size = new System.Drawing.Size(100, 93);
this.unlockBypassButton.TabIndex = 19;
this.unlockBypassButton.Text = "Unlock a bypass";
this.unlockBypassButton.UseVisualStyleBackColor = true;
this.unlockBypassButton.Click += new System.EventHandler(this.unlockSkipCyclesButton_Click);
//
// TracingCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.unlockBypassButton);
this.Controls.Add(this.bypassGroupBox);
this.Controls.Add(this.netAdapterComboBox);
this.Controls.Add(this.netAdapterLabel);
this.Controls.Add(this.saveTracingRecordsCheckBox);
@@ -228,10 +139,8 @@ namespace TBF.Rig.Output.DB.ProductionTracing
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TracingCfgCtrl";
this.Size = new System.Drawing.Size(450, 350);
this.Size = new System.Drawing.Size(450, 250);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
this.bypassGroupBox.ResumeLayout(false);
this.bypassGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -248,13 +157,5 @@ namespace TBF.Rig.Output.DB.ProductionTracing
private System.Windows.Forms.CheckBox checkPreviousRecordsCheckBox;
private System.Windows.Forms.Label netAdapterLabel;
private System.Windows.Forms.ComboBox netAdapterComboBox;
private System.Windows.Forms.TextBox cyclesToBypassTextBox;
private System.Windows.Forms.Button setCyclesToBypassButton;
private System.Windows.Forms.Button getCyclesToBypassButton;
private System.Windows.Forms.TextBox cyclesToBypassTextBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox bypassGroupBox;
private System.Windows.Forms.Button unlockBypassButton;
}
}
}
+42 -48
View File
@@ -5,14 +5,17 @@ using System;
using System.Collections.Generic;
using System.Linq;
using log4net;
#if MANAGED
using Oracle.ManagedDataAccess.Client;
#else
using Oracle.DataAccess.Client;
#endif
using Common;
using Config;
using Config.Entities;
using Results.Output;
using System.Text;
using Events.Entities;
using Results;
namespace TBF.Rig.Output.DB.SensusOracle
{
@@ -109,10 +112,9 @@ namespace TBF.Rig.Output.DB.SensusOracle
string procedureSignature;
IList<SensusTestInfo> oracleTestInfo; /// Raw incomplete test info from Oracle DB (or null)
LUTestData[] completeTestInfo; /// Complete test info obtained from the procedure
LUTestData[] distinctTestInfo; /// Distinct test info obtained from the procedure - if Q3 is splitted to 2 parts, test info is only for one Q3
public Database() {}
public Database() {}
public Database(Generic.IComponentCfg cfg)
: base(cfg)
@@ -392,46 +394,10 @@ namespace TBF.Rig.Output.DB.SensusOracle
currentOpState = OpState.None;
}
#if ORACLE_DB
void GetTestInfoFromProcedure(string logCaption, Results.Entities.Batch bat = null)
{
///
/// Select or create appropriate test infos
///
IList<LUTestData> testsToSave = new List<LUTestData>();
int maxPruefungsNr = 0;
Results.Entities.Batch batch = Sequences.ProcessData.BatchRslts == null? bat : Sequences.ProcessData.BatchRslts.Batch;
foreach (var td in batch.Tests)
{
for (int repNr = 1; repNr <= td.Repeats; repNr++)
{
int testId = td.OraId + (td.Repeats - repNr) * td.OraIdRepetMulti;
if (testId != 0)
{
testsToSave.Add(new LUTestData(td, repNr));
if (Math.Abs(testId) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testId);
}
}
}
LUTestData[] testsToSaveArr = testsToSave.ToArray();
Array.Sort(testsToSaveArr, new LUTestDataComparer());
completeTestInfo = testsToSaveArr;
distinctTestInfo = testsToSave.GroupBy(x => x.TData.OraId).Select(group => group.First()).ToArray();
Array.Sort(distinctTestInfo, new LUTestDataComparer());
log.WarnFormat("{0} selected test infos:", logCaption);
foreach (var cti in distinctTestInfo)
{
log.WarnFormat(" ID={0} Rev={1} Test={2} PrfNrDB={3} QBzDB={4}",
wmTypeId, wmTypeRevision, cti.TestName, cti.Id, cti.Designation);
}
}
public Retv ReadStartInfoFromDB(OracleConnection conn)
{
GetTestInfoFromProcedure("ReadStartInfoFromDB"); /// Create appropriate test infos
bool anyError = false;
try
{
@@ -454,9 +420,9 @@ namespace TBF.Rig.Output.DB.SensusOracle
return anyError ? Retv.Error : Retv.OK;
}
/// <summary>
/// Read start info of one water meter from the database
/// </summary>
/// <summary>
/// Read start info of one water meter from the database
/// </summary>
/// <param name="conn">Oracke DB connection</param>
/// <param name="wm">Water meter entity</param>
/// <returns>Retv.OK when successful, Retv.Error on error</returns>
@@ -824,7 +790,35 @@ namespace TBF.Rig.Output.DB.SensusOracle
throw new Exception(string.Format("Cannot save batch {0} to Oracle, missing entry in VT_WZTYP_SD", bat.BatchNr));
}
GetTestInfoFromProcedure("SaveBatchData", bat); /// Create appropriate test infos
///
/// Select or create appropriate test infos
///
IList<LUTestData> testsToSave = new List<LUTestData>();
int maxPruefungsNr = 0;
double totalTestTime = 0;
foreach (var td in bat.Tests)
{
for (int repNr = 1; repNr <= td.Repeats; repNr++)
{
int testId = td.OraId + (td.Repeats - repNr) * td.OraIdRepetMulti;
if (testId != 0)
{
testsToSave.Add(new LUTestData(td, repNr));
if (Math.Abs(testId) > maxPruefungsNr) maxPruefungsNr = Math.Abs(testId);
totalTestTime += td.TargetTime;
}
}
}
LUTestData[] testsToSaveArr = testsToSave.ToArray();
Array.Sort(testsToSaveArr, new LUTestDataComparer());
completeTestInfo = testsToSaveArr;
foreach (var cti in completeTestInfo)
{
log.WarnFormat("Selected test info : ID={0} Rev={1} Test={2} PrfNrDB={3} QBzDB={4}",
wmTypeId, wmTypeRevision, cti.TestName, cti.Id, cti.Designation);
}
if (dbCfg.DebugLevel == DebugMode.Normal)
{
@@ -860,7 +854,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
log.WarnFormat("SIM: VT_PRUEFREIHE_PD inserted, BatchNr={0}, TypeId={1}, TypeRev={2}, Start={3}", bat.BatchNr, bat.WaterMeters[0].WaterMeterData.WMTypeId, wmTypeRevision, bat.StartTime);
}
foreach (var testInfo in distinctTestInfo)
foreach (var testInfo in completeTestInfo)
{
if ((testInfo.Id != 0) && (-20 <= testInfo.Id) && (testInfo.Id <= 20)) /// LU PruefungsNr-s are between -20 and 20
{
@@ -1067,7 +1061,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + wm.Batch.TestBenchId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.CalibFactor }); // korrimprate - should be new calib.factor, not wm.OrigCalibFactor
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.OrigCalibFactor });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO: pressure test
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.WMPosition });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Passed ? 1 : 0 });
@@ -1083,7 +1077,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
}
foreach (var testInfo in distinctTestInfo)
foreach (var testInfo in completeTestInfo)
{
if ((testInfo.Id != 0) && (-20 <= testInfo.Id) && (testInfo.Id <= 20)) /// LU PruefungsNr-s are nonzero and between -20 and 20
{
@@ -1300,7 +1294,7 @@ namespace TBF.Rig.Output.DB.SensusOracle
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = dbCfg.TestBenchGroupId + wm.Batch.TestBenchId });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Batch.BatchNr });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = hydr_Pruefung });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.CalibFactor });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Double, Value = wm.OrigCalibFactor });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = 0 }); /// TODO
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.WMPosition });
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = wm.Passed ? 1 : 0 });
+30 -73
View File
@@ -3,10 +3,9 @@
///
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Globalization;
using System.Threading;
using Common;
using Common.Forms;
using Results.Output.Printers.Enhanced;
using log4net;
@@ -32,12 +31,8 @@ namespace TBF.Rig.Output.Printers.Enhanced
IList<Results.WMeterRsltItemSpec> testItems;
string footer;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public Printer() { }
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -48,19 +43,10 @@ namespace TBF.Rig.Output.Printers.Enhanced
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
header = string.IsNullOrEmpty(printerCfg.Header) ? string.Empty : printerCfg.Header.Replace("~", Environment.NewLine);
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.CommonItems);
@@ -146,67 +132,38 @@ namespace TBF.Rig.Output.Printers.Enhanced
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, batch.StartTime, batch.EndTime, batch.BatchNr);
}
catch
{
documentName = string.Format("{0:yyyyMMdd-HHmm}", batch.EndTime);
}
PrintResults(batch, documentName);
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
{
return Event.ResultsPrinted;
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
{
if (statusDlgShown)
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
return Event.ResultsPrinted;
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, batch.StartTime, batch.EndTime, batch.BatchNr);
}
catch
{
documentName = string.Format("{0:yyyyMMdd-HHmm}", batch.EndTime);
}
PrintResults(batch, documentName);
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Stop this operation</summary>
public void Stop()
{
}
@@ -249,7 +206,7 @@ namespace TBF.Rig.Output.Printers.Enhanced
for (int i = 1; i <= printerCfg.NrOfCopies; i++)
{
string docName = string.Format(((printerCfg.NrOfCopies == 1) ? "{0}" : "{0}-{1}"), documentName, i);
var pd = new EnhancedPrintDocument(batch, cfg, docName);
var pd = new Results.Output.Printers.Enhanced.EnhancedPrintDocument(batch, cfg, docName);
if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName;
pd.Print();
}
@@ -74,6 +74,7 @@ namespace TBF.Rig.Output.Printers.Enhanced
void Localize()
{
classNameLabel.Text = config.ClassName;
nameLabel.Text = Strings.Name;
printerLabel.Text = Strings.Printer;
selectPrinterButton.Text = "Select";
@@ -91,9 +92,7 @@ namespace TBF.Rig.Output.Printers.Enhanced
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.ClassName;
nameTextBox.Text = config.Name;
nameTextBox.Text = config.Name;
printerComboBox.Text = string.IsNullOrEmpty(config.PrinterName) ? Strings.default_printer : config.PrinterName;
templateTextBox.Text = config.Template;
orientationComboBox.Text = config.PageOrientation.ToString();
+32 -69
View File
@@ -6,8 +6,6 @@ using System.Collections.Generic;
using log4net;
using System.Globalization;
using System.Threading;
using Common;
using Common.Forms;
using Results.Output.Printers.Label;
namespace TBF.Rig.Output.Printers.Label
@@ -21,13 +19,16 @@ namespace TBF.Rig.Output.Printers.Label
public bool SupressPrinting { get { return (printerCfg.NrOfCopies == 0); } }
Results.Entities.Batch batch; /// Data to print
IList<Results.WMeterRsltItemSpec> commonItems; /// Items to print
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
public Printer() { }
///
/// Items to print
///
IList<Results.WMeterRsltItemSpec> commonItems;
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -38,19 +39,10 @@ namespace TBF.Rig.Output.Printers.Label
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
}
@@ -116,58 +108,29 @@ namespace TBF.Rig.Output.Printers.Label
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
}
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
foreach (var wm in batch.WaterMeters)
{
if (wm != null && (!printerCfg.GoodOnly || wm.Passed))
{
PrintResults(batch, wm, string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition));
}
}
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
{
return Event.ResultsPrinted;
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
{
if (statusDlgShown)
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
foreach (var wm in batch.WaterMeters)
{
if (wm != null && !wm.Disabled && wm.PrintLabel && (!printerCfg.GoodOnly || wm.Passed))
{
PrintResults(batch, wm, string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition));
}
}
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
+22 -66
View File
@@ -3,11 +3,9 @@
///
using System;
using System.Collections.Generic;
using log4net;
using System.Globalization;
using System.Threading;
using log4net;
using Common;
using Common.Forms;
using Results.Output.Printers.MultiLabel;
namespace TBF.Rig.Output.Printers.MultiLabel
@@ -29,12 +27,8 @@ namespace TBF.Rig.Output.Printers.MultiLabel
///
IList<Results.WMeterRsltItemSpec> commonItems;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public Printer() { }
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -45,19 +39,10 @@ namespace TBF.Rig.Output.Printers.MultiLabel
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.ItemsToPrint);
}
@@ -127,56 +112,27 @@ namespace TBF.Rig.Output.Printers.MultiLabel
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
}
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
PrintResults(batch, string.Format("{0}", batch.BatchNr));
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
{
return Event.ResultsPrinted;
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
{
if (statusDlgShown)
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
return Event.ResultsPrinted;
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
PrintResults(batch, string.Format("{0}", batch.BatchNr));
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Stop this operation</summary>
public void Stop()
{
}
+24 -67
View File
@@ -2,12 +2,12 @@
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using log4net;
using Common;
using Common.Forms;
using Results.Output.Printers.Munich;
using System.Globalization;
using System.Threading;
using Config.Entities;
using TBF.Rig;
namespace TBF.Rig.Output.Printers.Munich
{
@@ -24,10 +24,6 @@ namespace TBF.Rig.Output.Printers.Munich
/// <summary> Data to print </summary>
Results.Entities.Batch batch;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public string Version { get { return printerCfg.Version; } }
@@ -41,23 +37,14 @@ namespace TBF.Rig.Output.Printers.Munich
public override void Initialize()
{
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
/// <summary>Events: ResultsPrinted</summary>
/// <param name="benchId">Procedure to print the results of</param>
/// <param name="results">Results to print</param>
/// <returns>Reference to the operation</returns>
/// <summary>Events: ResultsPrinted</summary>
/// <param name="benchId">Procedure to print the results of</param>
/// <param name="results">Results to print</param>
/// <returns>Reference to the operation</returns>
public IOperation ProcessResultsOp(Results.Entities.Batch batch)
{
this.batch = batch;
@@ -67,53 +54,23 @@ namespace TBF.Rig.Output.Printers.Munich
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
}
foreach (var wm in batch.WaterMeters)
{
var pd = new Results.Output.Printers.Munich.MunichPrintDocument(printerCfg.Version, wm, printerCfg.PageOrientation);
if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName;
pd.Print();
}
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
{
return Event.ResultsPrinted;
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
{
if (statusDlgShown)
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
return Event.ResultsPrinted;
}
/// Printer is online => Print results now
foreach (var wm in batch.WaterMeters)
{
var pd = new MunichPrintDocument(printerCfg.Version, wm, printerCfg.PageOrientation);
if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName;
pd.Print();
}
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
+34 -78
View File
@@ -5,11 +5,9 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using log4net;
using Common;
using Common.Forms;
using Results.Entities;
using Results.Output.Printers.OnePerBatch;
using log4net;
namespace TBF.Rig.Output.Printers.OnePerBatch
{
@@ -33,12 +31,8 @@ namespace TBF.Rig.Output.Printers.OnePerBatch
IList<Results.WMeterRsltItemSpec> testItems;
string footer;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public Printer() { }
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -49,19 +43,10 @@ namespace TBF.Rig.Output.Printers.OnePerBatch
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
header = string.IsNullOrEmpty(printerCfg.Header) ? string.Empty : printerCfg.Header.Replace("~", Environment.NewLine);
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.CommonItems1);
@@ -165,78 +150,49 @@ namespace TBF.Rig.Output.Printers.OnePerBatch
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
}
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
if (printerCfg.Culture != Culture.system)
{
return Event.ResultsPrinted;
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
foreach (var wm in batch.WaterMeters)
{
if (statusDlgShown)
if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed))
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
foreach (var wm in batch.WaterMeters)
{
if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed))
string documentName;
try
{
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr);
}
catch
{
documentName = string.Format("{0}", batch.BatchNr, wm.WMPosition);
}
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr);
}
catch
{
documentName = string.Format("{0}", batch.BatchNr, wm.WMPosition);
}
/// The following condition prevents printing empty AutoTest results protocols
if (string.IsNullOrEmpty(printerCfg.AutoTestParam) || wm.AutoMeterTestRslts(printerCfg.AutoTestParam).Count > 0)
{
PrintResults(batch, wm, documentName);
break;
}
/// The following condition prevents printing empty AutoTest results protocols
if (string.IsNullOrEmpty(printerCfg.AutoTestParam) || wm.AutoMeterTestRslts(printerCfg.AutoTestParam).Count > 0)
{
PrintResults(batch, wm, documentName);
break;
}
}
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
+31 -75
View File
@@ -5,11 +5,9 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using log4net;
using Common;
using Common.Forms;
using Results.Entities;
using Results.Output.Printers.OnePerMeter;
using log4net;
namespace TBF.Rig.Output.Printers.OnePerMeter
{
@@ -33,12 +31,8 @@ namespace TBF.Rig.Output.Printers.OnePerMeter
IList<Results.WMeterRsltItemSpec> testItems;
string footer;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public Printer() { }
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -49,19 +43,10 @@ namespace TBF.Rig.Output.Printers.OnePerMeter
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
header = string.IsNullOrEmpty(printerCfg.Header) ? string.Empty : printerCfg.Header.Replace("~", Environment.NewLine);
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.CommonItems1);
@@ -169,74 +154,45 @@ namespace TBF.Rig.Output.Printers.OnePerMeter
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
}
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
if (printerCfg.Culture != Culture.system)
{
return Event.ResultsPrinted;
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
foreach (var wm in batch.WaterMeters)
{
if (statusDlgShown)
if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed))
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
foreach (var wm in batch.WaterMeters)
{
if (wm != null && !wm.Disabled && (!printerCfg.GoodOnly || wm.Passed))
string documentName;
try
{
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr, wm.SerialNrAux);
/// {0} {1} {2} {3} {4} {5}
}
catch
{
documentName = string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition);
}
PrintResults(batch, wm, documentName);
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, wm.StartTime(), wm.EndTime(), wm.BatchNr(), wm.WMPosition, wm.SerialNr, wm.SerialNrAux);
/// {0} {1} {2} {3} {4} {5}
}
catch
{
documentName = string.Format("{0}-{1}", batch.BatchNr, wm.WMPosition);
}
PrintResults(batch, wm, documentName);
}
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
return Event.ResultsPrinted;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
-136
View File
@@ -1,136 +0,0 @@
///
/// Copyright (c) 2023 Sensus Slovensko a.s.
///
using System;
using System.Management;
namespace TBF.Rig.Output.Printers
{
public static class PrinterStatus
{
///
/// See also https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-printer
///
public enum DetectedErrorState : UInt16
{
Unknown = 0,
Other = 1,
No_Error = 2,
Low_Paper = 3,
No_Paper = 4,
Low_Toner = 5,
No_Toner = 6,
Door_Open = 7,
Jammed = 8,
Offline = 9,
Service_Requested = 10,
Output_Bin_Full = 11,
}
public enum ExtendedPrinterStatus : UInt16
{
Other = 1,
Unknown = 2,
Idle = 3,
Printing = 4,
Warming_Up = 5,
Stopped_Printing = 6,
Offline = 7,
Paused = 8,
Error = 9,
Busy = 10,
Not_Aavailable = 11,
Waiting = 12,
Processing = 13,
Initialization = 14,
Power_Save = 15,
Pending_Deletion = 16,
IO_Active = 17,
Manual_Feed = 18,
}
public static void GetStatus(string printerName)
{
/// Perform the search for printers and return the listing as a collection
var mgmtSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
var mgmtCollection = mgmtSearcher.Get();
foreach (ManagementObject wmiObj in mgmtCollection)
{
if (wmiObj["Name"].ToString().ToLower() == printerName.ToLower())
{
/// Management object name fits the printer name
var state = (ExtendedPrinterStatus)int.Parse(wmiObj["ExtendedPrinterStatus"].ToString());
if (state == ExtendedPrinterStatus.Other ||
state == ExtendedPrinterStatus.Unknown ||
state == ExtendedPrinterStatus.Offline ||
state == ExtendedPrinterStatus.Error ||
state == ExtendedPrinterStatus.Not_Aavailable)
{
var message = string.Format("Printer '{0}' state is '{1}'", printerName, state.ToString().Replace('_', ' '));
throw new ApplicationException(message);
}
var error = (DetectedErrorState)int.Parse(wmiObj["DetectedErrorState"].ToString());
if (error != DetectedErrorState.No_Error)
{
var message = string.Format("Printer '{0}' error state is '{1}'", printerName, error.ToString().Replace('_', ' '));
throw new ApplicationException(message);
}
}
}
}
/// <summary>
/// Returns true when printer is online, without errors.
/// </summary>
/// <param name="printerName">Printer name</param>
/// <param name="message">Error message when printer is not online</param>
/// <returns>true when online, false when there are any errors or printer is not online</returns>
public static bool IsOnline(string printerName, out string message)
{
// TODO: Uncomment the following line and resolve problems : Unknown status/error always returned
// if (string.IsNullOrEmpty(printerName))
{
/// Default printer
message = string.Empty;
return true;
}
/// Perform the search for printers and return the listing as a collection
var mgmtSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Printer");
var mgmtCollection = mgmtSearcher.Get();
foreach (ManagementObject wmiObj in mgmtCollection)
{
if (wmiObj["Name"].ToString().ToLower() == printerName.ToLower())
{
/// Management object name fits the printer name
var state = (ExtendedPrinterStatus)int.Parse(wmiObj["ExtendedPrinterStatus"].ToString());
if (state == ExtendedPrinterStatus.Other ||
state == ExtendedPrinterStatus.Unknown ||
state == ExtendedPrinterStatus.Offline ||
state == ExtendedPrinterStatus.Error ||
state == ExtendedPrinterStatus.Not_Aavailable)
{
message = string.Format("Printer '{0}' state is '{1}'", printerName, state.ToString().Replace('_', ' '));
return false;
}
var error = (DetectedErrorState)int.Parse(wmiObj["DetectedErrorState"].ToString());
if (error != DetectedErrorState.No_Error)
{
message = string.Format("Printer '{0}' error state is '{1}'", printerName, error.ToString().Replace('_', ' '));
return false;
}
}
}
message = string.Empty;
return true;
}
}
}
+33 -77
View File
@@ -5,10 +5,8 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using log4net;
using Common;
using Common.Forms;
using Results.Output.Printers.Zapiska;
using log4net;
namespace TBF.Rig.Output.Printers.Zapiska
{
@@ -32,12 +30,8 @@ namespace TBF.Rig.Output.Printers.Zapiska
IList<Results.WMeterRsltItemSpec> testItems;
string footer;
bool printingCompleted = false;
bool statusDlgShown = false;
ModelessForm modelessForm;
public Printer() { }
public Printer() { }
public Printer(Generic.IComponentCfg cfg)
: base(cfg)
@@ -48,19 +42,10 @@ namespace TBF.Rig.Output.Printers.Zapiska
public override void Initialize()
{
ApplyConfig();
if (printerCfg.DebugLevel == DebugMode.Normal)
{
string message;
if (!PrinterStatus.IsOnline(printerCfg.PrinterName, out message)) throw new ApplicationException(message);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
{
log.FatalFormat("{0} simulated: {1}", Name, this);
}
log.FatalFormat("{0} initialized: {1}", Name, this);
}
void ApplyConfig()
void ApplyConfig()
{
header = string.IsNullOrEmpty(printerCfg.Header) ? string.Empty : printerCfg.Header.Replace("~", Environment.NewLine);
commonItems = Results.WMeterRsltItemSpec.FromStrArray(printerCfg.CommonItems1);
@@ -152,67 +137,38 @@ namespace TBF.Rig.Output.Printers.Zapiska
/// <summary>Start this operation</summary>
public void Start()
{
printingCompleted = false;
statusDlgShown = false;
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, batch.StartTime, batch.EndTime, batch.BatchNr);
}
catch
{
documentName = string.Format("{0:yyyyMMdd-HHmm}", batch.EndTime);
}
PrintResults(batch, documentName);
Thread.CurrentThread.CurrentCulture = oriCulture;
}
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
/// <summary>Run this operation</summary>
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
string message;
if (printingCompleted || printerCfg.DebugLevel != DebugMode.Normal)
{
return Event.ResultsPrinted;
}
else if (PrinterStatus.IsOnline(printerCfg.PrinterName, out message))
{
if (statusDlgShown)
{
statusDlgShown = false;
if (modelessForm != null) modelessForm.Close();
}
return Event.ResultsPrinted;
}
/// Printer is online => Print results now
CultureInfo oriCulture = Thread.CurrentThread.CurrentCulture;
if (printerCfg.Culture != Culture.system)
{
Thread.CurrentThread.CurrentCulture = new CultureInfo(printerCfg.Culture.ToString());
}
string documentName;
try
{
if (string.IsNullOrEmpty(printerCfg.DocName)) throw (new Exception());
documentName = string.Format(printerCfg.DocName, batch.StartTime, batch.EndTime, batch.BatchNr);
}
catch
{
documentName = string.Format("{0:yyyyMMdd-HHmm}", batch.EndTime);
}
PrintResults(batch, documentName);
Thread.CurrentThread.CurrentCulture = oriCulture;
printingCompleted = true;
return Event.ResultsPrinted;
}
else
{
if (!statusDlgShown)
{
statusDlgShown = true;
modelessForm = new ModelessForm(message);
new Thread(() => System.Windows.Forms.Application.Run(modelessForm)).Start();
}
return Event.Busy;
}
}
/// <summary>Stop this operation</summary>
public void Stop()
/// <summary>Stop this operation</summary>
public void Stop()
{
}
@@ -259,7 +215,7 @@ namespace TBF.Rig.Output.Printers.Zapiska
Footer = printerCfg.Footer,
};
var pd = new ZapiskaPrintDocument(batch, cfg, documentName);
var pd = new Results.Output.Printers.Zapiska.ZapiskaPrintDocument(batch, cfg, documentName);
if (!string.IsNullOrEmpty(printerCfg.PrinterName)) pd.PrinterSettings.PrinterName = printerCfg.PrinterName;
pd.Print();
}
+9 -19
View File
@@ -434,7 +434,7 @@ namespace TBF.Rig.Sequences
wm.Disabled = true;
}
else if (!wm.Disabled && (Users.CurrentUser.UserName() == "milan" ||
Users.CurrentUser.UserName() == "jau" ||
Users.CurrentUser.UserName() == "augustin" ||
Users.CurrentUser.UserName() == "michal" ||
Users.CurrentUser.UserName() == "michal2"))
{
@@ -1343,17 +1343,21 @@ namespace TBF.Rig.Sequences
printers.CopyTo(rsltProcessors, writers.Length);
eventTriggers.CopyTo(rsltProcessors, writers.Length + printers.Length);
///
State st = State.Create("MainSeq : Saving and printing results");
int rpix = 0; /// Component index in AddOperation() loop
int rpix = 0; /// Component index in AddOperation() loop, afterwards rsltProcessors.Length
try
{
State st = State.Create("MainSeq : Saving and printing results");
for (rpix = 0; rpix < rsltProcessors.Length; rpix++ )
{
var rp = TbfComponents.FindComponent(rsltProcessors[rpix]) as IResultsProcessor;
if (rp != null) st.AddOperation(rp.ProcessResultsOp(ProcessData.BatchRslts.Batch));
}
st.EnterState(); /// Executes operation.Start() functions of result processors, should be inside try-catch
st.EnterState();
do {
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) break;
}
while (e.Contains(Event.Busy));
}
catch (Exception exc)
{
@@ -1362,20 +1366,6 @@ namespace TBF.Rig.Sequences
log.FatalFormat("FileWriter {0} crashed: {1}", rpName, exc.Message);
goto error;
}
do
{
/// Next line executes operation.Run() of result processors, already try-catch protected (generates Event.Crashed)
e = StateMachine.WaitRunDevsRunOps();
if (e.Contains(Event.Error)) break;
}
while (e.Contains(Event.Busy));
if (e.Contains(Event.Crashed))
{
Bridge.OnError(this, Strings.Error_when_saving_and_printing_results);
}
if (e.Contains(Event.Error)) goto error;
///
if (!e.Contains(Event.ErrorProcessingResults))
+4 -14
View File
@@ -2049,7 +2049,7 @@ namespace TBF.Rig.Sequences
/// <returns></returns>
protected bool TestAndLogUiCmdStop(Test test, IList<Event> e)
{
if (e == null || !e.Contains(Event.UiCmdStop)) return false;
if (!e.Contains(Event.UiCmdStop)) return false;
log.FatalFormat("STOP pressed: Procedure={0}, Test={1}, State={2}",
(StateMachine.Procedure == null) ? "?" : StateMachine.Procedure.Name,
@@ -2064,24 +2064,14 @@ namespace TBF.Rig.Sequences
log.FatalFormat(" Feeding path: {0}", (inPath != null) ? inPath.ToString() : "none");
log.FatalFormat(" Bench path: {0}", (benchPath != null) ? benchPath.ToString() : "none");
log.FatalFormat(" Output path: {0}", (outPath != null) ? outPath.ToString() : "none");
if (inPath.Pump is IPump) log.FatalFormat(" Pump power: {0}%", (inPath.Pump as IPump).Power);
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
if (outPath.RegulValve is IRegValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegulValve.Position);
log.FatalFormat(" Flow: {0}", RefFlow);
log.FatalFormat(" Mass: {0}", Mass);
log.FatalFormat(" Start mass: {0}", StartMass);
log.FatalFormat(" Liter/ref.pulse: {0}", LtrPerRefPulse);
log.FatalFormat(" Reference pulses: {0}", RefPulses);
try
{
if (inPath != null)
{
if (inPath.Pump is IPump) log.FatalFormat(" Pump power: {0}%", (inPath.Pump as IPump).Power);
else if (inPath.Pump is IValve) log.FatalFormat(" Feeding valve: {0}", (inPath.Pump as IValve).State ? "open" : "close");
}
if (outPath != null && outPath.RegulValve is IRegValve) log.FatalFormat(" Regulation valve position: {0}%", outPath.RegulValve.Position);
}
catch (Exception ex)
{
log.FatalFormat($" SequenceBase.TestAndLogUiCmdStop error: {ex.Message}");
}
}
return true;
+8 -20
View File
@@ -185,31 +185,19 @@ namespace TBF.Rig
/// <returns>List of Event-s returned from the state operations</returns>
public static IList<Event> RunOperations()
{
IList<Event> events = new List<Event>(); /// List of events from all operation.Run() - initially empty
IList<Event> events = new List<Event>();
foreach (IOperation operation in currentState.Operations)
{
Event evnt;
try
Event evnt = operation.Run();
if (evnt != Event.None)
{
evnt = operation.Run();
}
catch (Exception ex)
log.InfoFormat("Operation {0}.Run() returned {1}", operation, evnt);
events.Add(evnt);
}
else
{
log.FatalFormat("Operation {0}.Run() crashed: {1}", operation, ex);
evnt = Event.Crashed;
events.Add(Event.Crashed);
}
if (evnt == Event.None)
{
/// Do not add Event.None to the list of events
log.DebugFormat("Operation {0}.Run() returned {1}", operation, evnt);
}
else if (evnt != Event.Crashed)
{
events.Add(evnt);
log.InfoFormat("Operation {0}.Run() returned {1}", operation, evnt);
log.DebugFormat("Operation {0}.Run() returned {1}", operation, evnt);
}
}
@@ -4,9 +4,7 @@ using Sensus.iPerl.RfidCom.Services;
using Sensus.iPerl.RfidCom.Structures;
using System;
using System.Threading;
using TBF.Rig.Hart.Common;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
@@ -25,7 +23,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
try
{
byte[] pcb = null;
int readRetVal = iPerlCommunicationForm.ReadRequestPort(iHead, MessageID.Configuration, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.Configuration, 16, 5, out pcb);
int readRetVal = iPerlCommunicationForm.ReadRequestPort(iHead, MessageID.Configuration, 16, 5, out pcb);
if (readRetVal == 0)
{
return RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(BitConverter.ToString(pcb).Replace("-", string.Empty))).ToString();
@@ -41,28 +39,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
internal static string SetActiveMode(IperlHead iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
{
return "OK";
}
else
{
return "Error Set Active Mode";
}
return RfidCommands.SetActiveMode($"COM{iHead.RfidComPortNr}") ? "OK" : "Error Set Active Mode";
}
internal static string SetTestMode(IperlHead iHead)
{
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.Command, StructName.Command, 0, 1, cmd))
{
return "OK";
}
else
{
return "Error Set Test Mode";
}
return RfidCommands.SetTestMode($"COM{iHead.RfidComPortNr}") ? "OK" : "Error Set Test Mode";
}
#if IPERL
@@ -70,8 +52,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{
try
{
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioParams, 0x1898, 1, new byte[] { (byte)3 }); // WakeUpInterval
return 0 == retValue ? "OK" : "Error";
string payload = "03";
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
rfidCommunicationService.RfidWrite(Params.u8_WakeUpInterval, payload);
return rfidCommunicationService.RfidRead<string>(Params.u8_WakeUpInterval).ToString() == payload ? "OK" : "Error";
}
catch (Exception ex)
{
@@ -83,8 +67,11 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{
try
{
int retValue = iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, 1, new byte[] { (byte)1 }); // System Status
return 0 == retValue ? "OK" : "Error";
string payload = "01"; // 1 set the µC to the production mode, radio should not start
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
rfidCommunicationService.RfidWrite(SystemInfo.u8_system_state, payload);
Thread.Sleep(1000); // must be for pass thru params
return rfidCommunicationService.RfidRead<string>(SystemInfo.u8_system_state).ToString() == payload ? "OK" : "Error";
}
catch (Exception ex)
{
@@ -98,7 +85,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
try
{
byte[] cmd = RfidHelper.HexStringToByteArray(custText);
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, Sensus.iPerl.NfcHandler.MCI_Protocol.StructName.RadioParams, 0x1899, 9, cmd))
if (0 == iPerlCommunicationForm.WriteRequestPort(iHead, MessageID.RadioPassthrough, 0x1899, 9, cmd))
{
RfidCommunicationService rfidCommunicationService = new RfidCommunicationService { ComPort = $"COM{iHead.RfidComPortNr}", WaitTimeAfterFailure = 2200, PassThroughWaitTime = 1500, MaxRetries = 3, TimeOut = 5000 };
//rfidCommunicationService.RfidWrite(Params.u8_Customer_Text, custText);
@@ -2,8 +2,6 @@
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using System.Collections.Generic;
using System.IO.Ports;
using System.Threading;
using System.Xml.Serialization;
using Common;
using Config.Entities;
@@ -29,15 +27,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public int NrThreads; /// Numbwr of parallel threads (1, 2 or 4)
public int IperlCheckErrorsToStop;
///
/// NFC S4.5 Combihead params
///
public int MciTimeoutMs;
public int BaudRate;
public int DataBits;
public Parity ParityBit;
public StopBits StopBits;
public int DfltQ2c_15_rl;
public int DfltQ2c_15_lr;
public int DfltQ2c_20_rl;
@@ -76,13 +65,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
PassThroughWaitTime = 1500;
NrThreads = 2; /// 1, 2 or 4 threads
IperlCheckErrorsToStop = 10;
MciTimeoutMs = 4000; // ms, NFC interface
BaudRate = 57600; // NFC Interface
DataBits = 8; // NFC Interface
ParityBit = Parity.None; // NFC Interface
StopBits = StopBits.Two; // NFC Interface
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
}
public TestMethodCfg(IComponentFactory factory)
@@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using log4net;
@@ -17,8 +18,12 @@ using Config.Entities;
using TBF.Resources;
using TBF.Rig.Sequences;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using Results.Entities;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
using Sensus.iPerl.RfidCom;
using Sensus.iPerl.RfidCom.Exceptions;
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom.Model.Enums;
using Sensus.iPerl.RfidCom.Services;
using Sensus.iPerl.RfidCom.Structures;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
@@ -95,7 +100,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public const string DewaReworkLRStr = "DEWA rework L-R";
public const string StartTestingSealedMetersStr = "Start testing sealed meters";
public const string EndTestingSealedMetersStr = "End testing sealed meters";
public const string SimulateCmd = "simulate ";
public static Color DisabledColor = Color.DarkGray;
public static Color OptoAndDirOKColor = Color.Green;
@@ -103,29 +107,115 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public static Color DirNokColor = Color.Red;
#region Simulation / RFID / NFC Interface: ReadRequestPort, WriteRequestPort
#region iPerl_Head_RFID_Interface: ReadRequestPort, WriteRequestPort
/// <summary>
/// Wrapper function with safe interface and unsafe body
/// </summary>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by readRequestPort(...)</returns>
public static int ReadRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, out byte[] buffer)
public static int ReadRequestPort(IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
{
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
if (iperlHead.DebugLevel != DebugMode.Normal) // Simulation
if (iperlHead.DebugLevel != DebugMode.Normal)
{
return SimulationServices.ReadRequest(cfg, iperlHead, messageID, offset, length, out buffer);
///
/// Simulation
///
if ((messageID == MessageID.Configuration) && (offset == 0) && (length == ConfigStruct.Length))
{
buffer = new byte[ConfigStruct.Length] { 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStruct.Length))
{
buffer = new byte[CalibrationStruct.Length] { 3, 0, 150, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0 };
}
else if ((messageID == MessageID.Calibration) && (offset == 0) && (length == CalibrationStructV4.Length))
{
buffer = new byte[CalibrationStructV4.Length] { 3, 0, 150, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 150, 10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 2) && (length == 2))
{
buffer = new byte[2] { 150, 10 };
}
else if ((messageID == MessageID.Calibration) && (offset == 34) && (length == 2))
{
buffer = new byte[2] { 150, 10 };
}
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
{
buffer = new byte[2] { 0, 0 };
}
else
{
buffer = new byte[length];
}
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
}
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
return NfcServices.ReadRequest(cfg, iperlHead, structName, offset, length, out buffer);
}
else // RFID Interface
{
return RfidServices.ReadRequest(cfg, iperlHead, messageID, offset, length, out buffer);
using (RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}"))
{
try
{
byte[] response = writer.ReadRequest((byte)messageID, offset, length, cfg.CommTimeout);
string hexString = RfidHelper.ConvertByteArrayToHexString(response);
string swapHexString = RfidHelper.SwapHexcode(hexString);
string decString = RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(hexString)).ToString();
if (length > 10)
{
//if the result only contains "00"s we are working on the wrong COM port
// or the module just isn't connected
if (Regex.IsMatch(hexString, @"^(00)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No RFID signal.");
throw new RfidValidationException("Error_Rfid_NoSignal");
}
//if the result only contains "03"s the meter did not answer.
// Might be due to the module being positioned incorrectly.
if (Regex.IsMatch(hexString, @"^(03)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No meter signal.");
throw new RfidValidationException("Error_Rfid_NoAnswerFromMeter");
}
}
writer.ClosePort();
buffer = response;
rfidDataLogger.Info($"{iperlHead.Name} ({iperlHead.SerialNr}): ReadRequestPort(COM{iperlHead.RfidComPortNr},...) returned HEX: {hexString}; SwapHexCodeToDecimal: {decString}");
return 0;
}
catch (RfidDataNotAvailableException)
{
if (/*RfidHelper.IsPassThrough(messageID)*/ messageID == MessageID.ASICRegisterReadTest || messageID == MessageID.RadioPassthrough)
{
rfidDataLogger.Info($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {(i > 0 ? "<- Error: Invalid Pass-Through data." : "<- Info: Wait for Pass-Through data.")}");
Thread.Sleep(cfg.PassThroughWaitTime);
}
else
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
catch (RfidValidationException)
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
catch (Exception ex)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
}
rfidDataLogger.Error($"RFID reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
log.Error($"RFID reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
buffer = new byte[length];
return 3;
}
/// <summary>
@@ -133,23 +223,49 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// </summary>
/// <param name="iperlHead">Water meter (iPerlHead) object</param>
/// <returns>Value returned by writeRequestPort(...)</returns>
public static int WriteRequestPort(IperlHead iperlHead, MessageID messageID, StructName structName, int offset, int length, byte[] buffer)
public static int WriteRequestPort(IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
{
Thread.Sleep(Math.Max(250, cfg.DelayBetweenRetries));
if (iperlHead.DebugLevel != DebugMode.Normal) // Simulation
{
return SimulationServices.WriteRequest(cfg, iperlHead, messageID, offset, length, buffer);
}
if (iperlHead.DebugLevel != DebugMode.Normal) return 0;
if (iperlHead.CommInterface == CommunicationInterface.NFC) // NFC Interface
RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}");
string payload = RfidHelper.ConvertByteArrayToHexString(buffer);
//byte messageId = (byte)((int)valueDefinition.MessageType);
//byte[] payloadBytes = RfidHelper.HexStringToByteArray(payload);
for (var i = 0; i < cfg.MaxCommRetries; i++)
{
return NfcServices.WriteRequest(cfg, iperlHead, structName, offset, length, buffer);
}
else // RFID Interface
{
return RfidServices.WriteRequest(cfg, iperlHead, messageID, offset, length, buffer);
try
{
if (writer.ClosePort()) writer.OpenPort();
writer.WriteRequest((byte)messageID, offset, length, buffer, cfg.CommTimeout, false);
writer.ClosePort();
rfidDataLogger.InfoFormat($"{iperlHead.Name}({iperlHead.SerialNr},COM{iperlHead.RfidComPortNr}): WriteRequestPort({messageID}, {offset}, {length}, {payload})");
return 0;
}
catch (Exception ex)
{
if (messageID == MessageID.RadioPassthrough || messageID == MessageID.ASICRegisterReadTest)
{
Thread.Sleep(1500);
}
else
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Error: {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
if (i > 1)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Reopen the com port.");
writer.ClosePort();
}
}
}
}
writer.ClosePort();
rfidDataLogger.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
log.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
return 2;
}
#endregion iPerl_Head_RFID_Interface: ReadRequestPort, WriteRequestPort
@@ -189,7 +305,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// RFID multiplexer PCB / RFID serial port and worker thread related variables
///
static TestMethod testMethod;
public static TestMethodCfg cfg;
static TestMethodCfg cfg;
static IList<Config.Entities.Test> tests;
static IList<iPerlCommunicationParams> multiTestParams;
@@ -630,7 +746,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
int count = 0;
for (int wmNr0 = 0; wmNr0 < iperlHeads.Count; wmNr0++)
{
WaterMeter wm = (ProcessData.BatchRslts.Batch.WaterMeters != null && ProcessData.BatchRslts.Batch.WaterMeters.Count > wmNr0)
Results.Entities.WaterMeter wm = (ProcessData.BatchRslts.Batch.WaterMeters != null && ProcessData.BatchRslts.Batch.WaterMeters.Count > wmNr0)
? ProcessData.BatchRslts.Batch.WaterMeters[wmNr0] : null;
IperlHead ihead = iperlHeads[wmNr0];
@@ -678,7 +794,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
{
wmFound = true;
WaterMeter wm = null;
Results.Entities.WaterMeter wm = null;
if (ProcessData.BatchRslts.Batch.WaterMeters != null)
{
foreach (var w in ProcessData.BatchRslts.Batch.WaterMeters)
@@ -741,7 +857,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
else if (currentActivity.ToLower() == DewaReworkLRStr.ToLower()) error = DewaRework(ihead, wm, FlowDir.L_R, ref resultStr);
else if (currentActivity.ToLower().Contains(StartTestingSealedMetersStr.ToLower())) error = StartTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(EndTestingSealedMetersStr.ToLower())) error = EndTestingSealedMeter(ihead, wm, ref resultStr);
else if (currentActivity.ToLower().Contains(SimulateCmd.ToLower())) error = Simulate(ihead, wm, ref resultStr);
#endif
else
{
@@ -840,7 +955,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadConfiguration(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadConfiguration(IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
///
/// The activity is "Read configuration" (this enables the watermeter, resets error flag)
@@ -860,7 +975,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Read configuration
byte[] config = null;
readRetVal = ReadRequestPort(ihead, MessageID.Configuration, StructName.Configuration, 0, ConfigStruct.Length, out config);
readRetVal = ReadRequestPort(ihead, MessageID.Configuration, 0, ConfigStruct.Length, out config);
if (readRetVal == 0)
{
error = CommErr.None;
@@ -913,7 +1028,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Switch to Active mode in order to change TestModeConfig
error = CommErr.CmdActive;
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
if (0 == WriteRequestPort(ihead, MessageID.Command, StructName.Command, 0, 1, cmd))
if (0 == WriteRequestPort(ihead, MessageID.Command, 0, 1, cmd))
{
error = CommErr.None;
}
@@ -927,7 +1042,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Change the TestModeConfig if necessary
error = CommErr.Write;
byte[] tstMdCfg = new byte[1] { testModeConfig };
if (0 == WriteRequestPort(ihead, MessageID.Configuration, StructName.Configuration, 21, 1, tstMdCfg))
if (0 == WriteRequestPort(ihead, MessageID.Configuration, 21, 1, tstMdCfg))
{
ihead.ConfigStruct.Update(21, tstMdCfg);
error = CommErr.None;
@@ -942,7 +1057,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Switch to test mode
error = CommErr.CmdTest;
byte[] cmd = new byte[1] { (byte)Command.SetTestMode };
if (0 == WriteRequestPort(ihead, MessageID.Command, StructName.Command, 0, 1, cmd))
if (0 == WriteRequestPort(ihead, MessageID.Command, 0, 1, cmd))
{
error = CommErr.None;
}
@@ -955,11 +1070,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
if (error == CommErr.None)
{
/// Verify the configuration
Thread.Sleep(2000); // RFID: 1000 ms is enough, NFC needs min 2000 ms
error = CommErr.Verify;
byte[] config = null;
int retVal = ReadRequestPort(ihead, MessageID.Configuration, StructName.Configuration, 0, ConfigStruct.Length, out config);
if (0 == retVal)
if (0 == ReadRequestPort(ihead, MessageID.Configuration, 0, ConfigStruct.Length, out config))
{
ihead.ConfigStruct = ConfigStruct.FromByteArray(config);
if ((ihead.ConfigStruct.MeterState == MeterState.Test) && (ihead.ConfigStruct.TestModeConfig == testModeConfig))
@@ -987,7 +1100,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Switch to active mode
byte[] cmd = new byte[1] { (byte)Command.SetActiveMode };
if (0 == WriteRequestPort(ihead, MessageID.Command, StructName.Command, 0, 1, cmd))
if (0 == WriteRequestPort(ihead, MessageID.Command, 0, 1, cmd))
{
error = CommErr.None;
}
@@ -1032,7 +1145,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadCalibration(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadCalibration(IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1041,7 +1154,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Read calibration
byte[] calib = null;
readRetVal = ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 0, CalibrationStruct.Length, out calib);
readRetVal = ReadRequestPort(ihead, MessageID.Calibration, 0, CalibrationStruct.Length, out calib);
if (readRetVal == 0)
{
ihead.CalibrationStruct = CalibrationStruct.FromByteArray(calib);
@@ -1066,7 +1179,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadCalibrationV4(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadCalibrationV4(IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1075,7 +1188,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Read calibration
byte[] calib = null;
readRetVal = ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 0, CalibrationStructV4.Length, out calib);
readRetVal = ReadRequestPort(ihead, MessageID.Calibration, 0, CalibrationStructV4.Length, out calib);
if (readRetVal == 0)
{
ihead.CalibrationStructV4 = CalibrationStructV4.FromByteArray(calib);
@@ -1104,7 +1217,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteCalibrationFactor(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteCalibrationFactor(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStruct == null)) return CommErr.CommFailed;
@@ -1204,14 +1317,14 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write the new calibration factor (up to cfg.MaxCommRetries tims)
///
error = CommErr.Write;
if (0 == WriteRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, data))
if (0 == WriteRequestPort(ihead, MessageID.Calibration, 2, 2, data))
{
///
/// Read and verify the calibration factor
///
error = CommErr.ReadAfterWrite;
byte[] calib_2_3 = null;
if (0 == ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, out calib_2_3))
if (0 == ReadRequestPort(ihead, MessageID.Calibration, 2, 2, out calib_2_3))
{
error = CommErr.Verify;
if (calib_2_3 != null && calib_2_3.Length == 2 && data[0] == calib_2_3[0] && data[1] == calib_2_3[1])
@@ -1239,7 +1352,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteCalibrationV4Factors(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteCalibrationV4Factors(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStructV4 == null)) return CommErr.CommFailed;
@@ -1361,8 +1474,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write the new calibration factor (up to cfg.MaxCommRetries tims)
///
error = CommErr.Write;
if (0 == WriteRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, data) &&
0 == WriteRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 34, 2, dataLNA))
if (0 == WriteRequestPort(ihead, MessageID.Calibration, 2, 2, data) &&
0 == WriteRequestPort(ihead, MessageID.Calibration, 34, 2, dataLNA))
{
///
/// Read and verify the calibration factor
@@ -1370,8 +1483,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
error = CommErr.ReadAfterWrite;
byte[] calib_2_3 = null;
byte[] calib_34_35 = null;
if (0 == ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, out calib_2_3) &&
0 == ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 34, 2, out calib_34_35))
if (0 == ReadRequestPort(ihead, MessageID.Calibration, 2, 2, out calib_2_3) &&
0 == ReadRequestPort(ihead, MessageID.Calibration, 34, 2, out calib_34_35))
{
error = CommErr.Verify;
if (calib_2_3 != null && calib_2_3.Length == 2 && data[0] == calib_2_3[0] && data[1] == calib_2_3[1] &&
@@ -1400,7 +1513,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter</param>
/// <param name="testData">TestData (name and repetitions)</param>
/// <returns>(1) selected MeterTestRslt or (2) average of repeated MTR-s or (3) null when at least one MTR is missing</returns>
static Results.Entities.MeterTestRslt GetAverageTestRslt(WaterMeter wm, Results.Entities.TestData testData)
static Results.Entities.MeterTestRslt GetAverageTestRslt(Results.Entities.WaterMeter wm, Results.Entities.TestData testData)
{
Results.Entities.MeterTestRslt avgTestRslt;
@@ -1432,13 +1545,13 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr NormalizeCalibrationFactor(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr NormalizeCalibrationFactor(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStruct == null)) return CommErr.CommFailed;
if (ihead.FactorLimitLo <= ihead.CalibFactor && ihead.CalibFactor <= ihead.FactorLimitHi)
{
resultStr = "Calibration factor is OK";
resultStr = "Calibratin factor is OK";
return CommErr.None; /// No need to update the calibration factor
}
@@ -1471,7 +1584,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
}
byte[] data = new byte[2] { (byte)(defaultCalibFactor & 0x00FF), (byte)((defaultCalibFactor >> 8) & 0x00FF) };
if (0 == WriteRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, data))
if (0 == WriteRequestPort(ihead, MessageID.Calibration, 2, 2, data))
{
error = CommErr.None;
ihead.CalibrationStruct.Update(data, 2);
@@ -1483,7 +1596,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Read calibration
byte[] calib_2_3 = null;
if (0 == ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, out calib_2_3))
if (0 == ReadRequestPort(ihead, MessageID.Calibration, 2, 2, out calib_2_3))
{
error = CommErr.None;
ihead.CalibrationStruct.Update(calib_2_3, 2);
@@ -1501,7 +1614,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr NormalizeCalibrationV4Factors(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr NormalizeCalibrationV4Factors(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed || (ihead.CalibrationStructV4 == null)) return CommErr.CommFailed;
@@ -1540,7 +1653,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
}
byte[] data = new byte[2] { (byte)(defaultCalibFactor & 0x00FF), (byte)((defaultCalibFactor >> 8) & 0x00FF) };
if (0 == WriteRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, data))
if (0 == WriteRequestPort(ihead, MessageID.Calibration, 2, 2, data))
{
error = CommErr.None;
ihead.CalibrationStructV4.Update(data, 2);
@@ -1552,7 +1665,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Read calibration
byte[] calib_2_3 = null;
if (0 == ReadRequestPort(ihead, MessageID.Calibration, StructName.Calibration, 2, 2, out calib_2_3))
if (0 == ReadRequestPort(ihead, MessageID.Calibration, 2, 2, out calib_2_3))
{
error = CommErr.None;
ihead.CalibrationStructV4.Update(calib_2_3, 2);
@@ -1571,7 +1684,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ReadQ2Correction(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ReadQ2Correction(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1580,7 +1693,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write zero Q2 correction
byte[] rdData = null;
///
if (0 == ReadRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, 2, out rdData))
if (0 == ReadRequestPort(ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, 2, out rdData))
{
error = CommErr.None;
}
@@ -1602,7 +1715,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr ResetQ2Correction(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr ResetQ2Correction(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
return WriteQ2Corrections(threadId, ihead, wm, ref resultStr, 0, 0);
}
@@ -1614,7 +1727,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteDefaultQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr WriteDefaultQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1670,7 +1783,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr WriteQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr, int factorLR, int factorRL)
static CommErr WriteQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr, int factorLR, int factorRL)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1679,7 +1792,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write zero Q2 correction
byte[] wrData = new byte[2] { (byte)factorLR, (byte)factorRL };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = factorRL;
wm.Q2CorrLR = ihead.Q2CorrLR = factorLR;
@@ -1715,7 +1828,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
}
static CommErr InitOrReadQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr InitOrReadQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
if (wm.Pruefindex == 0) return CommErr.CommFailed; /// Unknown pruefindex
@@ -1779,7 +1892,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr Reset2HzCorrection(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr Reset2HzCorrection(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -1788,7 +1901,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write zero Q2 correction
byte[] wrData = new byte[1] { 0 };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Hz2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Hz2CorrFactorsAddr, wrData.Length, wrData))
{
error = CommErr.None;
}
@@ -1837,7 +1950,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr CalculateAndWriteQ2Corrections(int threadId, IperlHead ihead, WaterMeter wm,
static CommErr CalculateAndWriteQ2Corrections(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm,
Test test, ref string resultStr, Q2CorrType q2CorrType, string restOfLine)
{
var args = string.IsNullOrEmpty(restOfLine) ? new string[0] : restOfLine.Split(new char[] { ' ' });
@@ -1968,7 +2081,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Do not forget to modify iPerlCommunicationSeq.MakeQ2CorrectedFrom(...)
///
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
q2CorrRL = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget))));
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget));
}
else if (q2CorrType == Q2CorrType.Dewa ||
q2CorrType == Q2CorrType.Dewa_incl_05 ||
@@ -1980,7 +2093,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Do not forget to modify iPerlCommunicationSeq.MakeQ2CorrectedFrom(...)
///
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
q2CorrLR = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom, errorTarget))));
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom, errorTarget));
}
else if (q2CorrType == Q2CorrType.RL ||
q2CorrType == Q2CorrType.RL_incl_05 ||
@@ -1997,7 +2110,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return CommErr.None;
}
q2CorrRL = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom))));
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom));
}
else if (q2CorrType == Q2CorrType.LR ||
q2CorrType == Q2CorrType.LR_incl_05 ||
@@ -2014,7 +2127,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return CommErr.None;
}
q2CorrLR = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom))));
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom));
}
else if (q2CorrType == Q2CorrType.Update || q2CorrType == Q2CorrType.ConditionalUpdate)
{
@@ -2023,8 +2136,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Assuming the 2nd Q2 tests are done afterwards
/// MakeQ2CorrectedFrom(...) is not used
///
q2CorrRL = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom))));
q2CorrLR = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult2, q2adjResult2.Q2CorrLR, q2adjTestData2.Qfrom))));
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom));
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult2, q2adjResult2.Q2CorrLR, q2adjTestData2.Qfrom));
}
else if (q2CorrType == Q2CorrType.Greece || q2CorrType == Q2CorrType.Greece_incl_05 || q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestLRDir)
{
@@ -2037,7 +2150,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return CommErr.None;
}
q2CorrLR = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom))));
q2CorrLR = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrLR, q2adjTestData.Qfrom));
q2CorrRL = q2CorrLR;
}
else if (q2CorrType == Q2CorrType.UpdateBothQ2FactorsTestRLDir)
@@ -2046,7 +2159,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Another strange process
///
double errorTarget = (q3error * q2adjResult.Error < 0) ? (0.1 * q2adjResult.Error) : (-0.1 * q2adjResult.Error);
q2CorrRL = Math.Max(-128, Math.Min(127, Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget))));
q2CorrRL = Convert.ToInt32(ihead.CalculateQ2CorrectionFactor(q2adjResult, q2adjResult.Q2CorrRL, q2adjTestData.Qfrom, errorTarget));
q2CorrLR = q2CorrRL;
}
@@ -2069,7 +2182,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write R-L Q2 correction factor only
///
byte[] wrData = new byte[1] { (byte)q2CorrRL };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddrRL, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddrRL, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
resultStr = string.Format("Q2 correction: RL={0}", q2CorrRL);
@@ -2087,7 +2200,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write L-R Q2 correction factor only
///
byte[] wrData = new byte[1] { (byte)q2CorrLR };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddrLR, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddrLR, wrData.Length, wrData))
{
wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
resultStr = string.Format("Q2 correction: LR={0}", q2CorrLR);
@@ -2100,7 +2213,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// Write both Q2 correction factors
///
byte[] wrData = new byte[2] { (byte)q2CorrLR, (byte)q2CorrRL };
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Q2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Q2CorrFactorsAddr, wrData.Length, wrData))
{
wm.Q2CorrRL = ihead.Q2CorrRL = q2CorrRL;
wm.Q2CorrLR = ihead.Q2CorrLR = q2CorrLR;
@@ -2188,7 +2301,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="ihead">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr Write2HzCorrection(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr Write2HzCorrection(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -2208,7 +2321,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
Byte hz2CorrectionByte = (byte)(hz2CorrectionFactor & 0x000000FF);
byte[] wrData = new byte[1] { hz2CorrectionByte };
///
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, StructName.ProductionInfo, Hz2CorrFactorsAddr, wrData.Length, wrData))
if (0 == WriteRequestPort(ihead, MessageID.MetrologyMemory, Hz2CorrFactorsAddr, wrData.Length, wrData))
{
error = CommErr.None;
wm.Hz2Correction = ihead.Hz2Correction = hz2CorrectionFactor;
@@ -2258,7 +2371,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="flowDir">Arrow direction</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr DewaRework(IperlHead ihead, WaterMeter wm, FlowDir flowDir, ref string resultStr)
static CommErr DewaRework(IperlHead ihead, Results.Entities.WaterMeter wm, FlowDir flowDir, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -2266,42 +2379,42 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
List<iPerlDataWrite> dataToBeWritten = new List<iPerlDataWrite>
{
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), // ?????
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 5:0x1985, new byte[] { arrow }, "Arrow"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 28:0x199C, new byte[5], "Clear S/N"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { (byte)0xA0 }, "Test mode config = A0"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 14:0x198E, new byte[] { (byte)(2510 & 0xFF), (byte)((2510 >> 8) & 0xFF) }, "Receipt mean current")
new iPerlDataWrite(MessageID.MetrologyMemory, 0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"),
new iPerlDataWrite(MessageID.MetrologyMemory, 0x1985, new byte[] { arrow }, "Arrow"),
new iPerlDataWrite(MessageID.MetrologyMemory, 0x199C, new byte[5], "Clear S/N"),
new iPerlDataWrite(MessageID.Configuration, 0x0015, new byte[] { (byte)0xA0 }, "Test mode config = A0"),
new iPerlDataWrite(MessageID.MetrologyMemory, 0x198E, new byte[] { (byte)(2510 & 0xFF), (byte)((2510 >> 8) & 0xFF) }, "Receipt mean current")
};
// check meter status: 1-Idle, 2-Active, 3-Test, 4-End Of Life
if (0 == ReadRequestPort(ihead, MessageID.Configuration, StructName.Configuration, 1, 1, out byte[] rdData))
if (0 == ReadRequestPort(ihead, MessageID.Configuration, 1, 1, out byte[] rdData))
{
int eMeterState = (int)((SByte)rdData[0]);
switch (eMeterState)
{
case 1: // Idle -> Test -> Active
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetTestMode }, "Set test mode"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetTestMode }, "Set test mode"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"));
break;
case 3: // Test Mode -> Active
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"));
break;
}
}
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, new byte[] { (byte)1 }, "System Status"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioParams, 0x1898, new byte[] { (byte)3 }, "WakeUpInterval"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioParams, 0x18A2, new byte[] { (byte)0x4A, (byte)0x53, (byte)0x3B, (byte)0x8F,
(byte)0x70, (byte)0x31, (byte)0xC2, (byte)0x5D,
(byte)0x6F, (byte)0x2D, (byte)0xE8, (byte)0x07,
(byte)0x6E, (byte)0x0F, (byte)0x97, (byte)0xC3, }, "AES Key Crypted"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, 0x1804, new byte[] { (byte)1 }, "System Status"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, 0x1898, new byte[] { (byte)3 }, "WakeUpInterval"));
dataToBeWritten.Add(new iPerlDataWrite(MessageID.RadioPassthrough, 0x18A2, new byte[] { (byte)0x4A, (byte)0x53, (byte)0x3B, (byte)0x8F,
(byte)0x70, (byte)0x31, (byte)0xC2, (byte)0x5D,
(byte)0x6F, (byte)0x2D, (byte)0xE8, (byte)0x07,
(byte)0x6E, (byte)0x0F, (byte)0x97, (byte)0xC3, }, "AES Key Crypted"));
int successfyllyWrittenFlags = 0; /// Ones in this word represent communication failures, LSB represents the first step
int mask = 1;
foreach (var wData in dataToBeWritten)
{
bool isSuccessfullyWritten = false;
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.StructName, wData.Offset, wData.Data.Length, wData.Data))
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.Offset, wData.Data.Length, wData.Data))
{
isSuccessfullyWritten = true;
}
@@ -2340,7 +2453,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr StartTestingSealedMeter(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr StartTestingSealedMeter(IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -2358,10 +2471,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
iPerlDataWrite[] dataToBeWritten = new iPerlDataWrite[]
{
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), /// 0x5A=sealed, 0xA5=unsealed ??????
new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, new byte[] { (byte)1 }, "System Status"),
new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
new iPerlDataWrite(MessageID.MetrologyMemory, 0x19A1, new byte[] { (byte)0xA5 }, "Open Sealing"), /// 0x5A=sealed, 0xA5=unsealed
new iPerlDataWrite(MessageID.RadioPassthrough, 0x1804, new byte[] { (byte)1 }, "System Status"),
new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
};
if (ihead.ConfigStruct != null) ihead.OrigTestModeConfig = ihead.ConfigStruct.TestModeConfig;
@@ -2371,7 +2484,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
foreach (var wData in dataToBeWritten)
{
bool isSuccessfullyWritten = false;
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.StructName, wData.Offset, wData.Data.Length, wData.Data))
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.Offset, wData.Data.Length, wData.Data))
{
isSuccessfullyWritten = true;
}
@@ -2410,7 +2523,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
/// <param name="wm">Water meter object</param>
/// <param name="resultStr">String passed to caller</param>
/// <returns>true on success</returns>
static CommErr EndTestingSealedMeter(IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr EndTestingSealedMeter(IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (ihead.CommFailed) return CommErr.CommFailed;
@@ -2418,10 +2531,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
iPerlDataWrite[] dataToBeWritten = new iPerlDataWrite[]
{
new iPerlDataWrite(MessageID.Command, StructName.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, StructName.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
new iPerlDataWrite(MessageID.RadioPassthrough, StructName.RadioInfo, 0x1804, new byte[] { (byte)0 }, "System Status"),
new iPerlDataWrite(MessageID.MetrologyMemory, StructName.Calibration, ihead.CommInterface == CommunicationInterface.NFC? 33:0x19A1, new byte[] { (byte)0x5A }, "Close Sealing") /// 0x5A=sealed, 0xA5=unsealed ??????
new iPerlDataWrite(MessageID.Command, 0x0000, new byte[] { (byte)Command.SetActiveMode }, "Set active mode"),
new iPerlDataWrite(MessageID.Configuration, 0x0015, new byte[] { testModeConfig }, string.Format("Test mode config = {0:X2}", testModeConfig)),
new iPerlDataWrite(MessageID.RadioPassthrough, 0x1804, new byte[] { (byte)0 }, "System Status"),
new iPerlDataWrite(MessageID.MetrologyMemory, 0x19A1, new byte[] { (byte)0x5A }, "Close Sealing"),
};
int successfyllyWrittenFlags = 0; /// Ones in this word represent communication failures, LSB represents the first step
@@ -2429,7 +2542,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
foreach (var wData in dataToBeWritten)
{
bool isSuccessfullyWritten = false;
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.StructName, wData.Offset, wData.Data.Length, wData.Data))
if (0 == WriteRequestPort(ihead, wData.MessageID, wData.Offset, wData.Data.Length, wData.Data))
{
isSuccessfullyWritten = true;
}
@@ -2461,7 +2574,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
}
}
static CommErr GetQ2PreCorrectionsFormRest(int threadId, IperlHead ihead, WaterMeter wm, ref string resultStr)
static CommErr GetQ2PreCorrectionsFormRest(int threadId, IperlHead ihead, Results.Entities.WaterMeter wm, ref string resultStr)
{
if (!ProcessData.IsQ2PreCorrectionCalculated)
{
@@ -2488,27 +2601,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return CommErr.None;
}
static CommErr Simulate(IperlHead ihead, WaterMeter wm, ref string resultStr)
{
string[] arguments = multiTestParams[currentActivityStep].Activity.Split(new char[] { ' ' });
if (arguments.Length < 2 || arguments[1].ToLower() != "iperls") return CommErr.None;
if (ihead.CommFailed) return CommErr.CommFailed;
string[] pcbNrs = new string[] { "831232435539", "831232435562",
"831232435587", "831232432141",
"831232432497", "831232763641" };
if (wm.WMPosition > 0 && wm.WMPosition <= pcbNrs.Length)
{
ihead.SerialNr = wm.SerialNr = pcbNrs[wm.WMPosition - 1];
}
resultStr = string.Format("PCB Nr. = {0}", wm.SerialNr ?? "<null>");
return CommErr.None;
}
#endif /// IPERL
#endregion
@@ -12,8 +12,6 @@ using TBF.Rig.Sequences;
using TBF.Resources;
using TBF.UiBridge;
using Results;
using Results.Entities;
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
@@ -25,10 +23,9 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
public const string StrictQ2ErrorCheckStr = "Strict Q2 error check ";
public const string Q2correctionCheckCmd = "Q2 correction check ";
public const string IperlCheckCmd = "iPERL_check ";
public const string SimulateCmd = "simulate ";
System.Windows.Forms.Form modelessDlg;
System.Windows.Forms.Form modelessDlg;
///
delegate void iPerlCommFormDlgt(iPerlCommunicationSeq myRef, TestMethod method, Test test, iPerlCommunicationParams testParams);
///
@@ -291,7 +288,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
return new List<Event> { Event.Done };
}
else if (testParams.Activity.ToLower().Contains(cmd = SimulateCmd))
else if (testParams.Activity.ToLower().Contains(cmd = "simulate "))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.JustStarted));
@@ -304,46 +301,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound nok") MakeSimulatedCompound(test, 1, 0, 4.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound rise") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.0f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "compound fall") MakeSimulatedCompound(test, 1, 0, 0.7f, 0.9f);
else if (testParams.Activity.Substring(cmd.Length).ToLower() == "iperls")
{
string[] pcbNrs = new string[] { "831232435539", "831232435562", "831232435587",
"831232432141", "831232432497", "831232763641" };
TestRslt tstRslt = BatchRslts.GetTestRslt(test.Name, test.Part);
if (tstRslt != null)
{
Results.Utils.GetCounterStates(tstRslt, Program.LocalSettings.Counters);
/// Auxiliary results ... not required
/// Main results
tstRslt.MethodClass = TbfComponents.FindComponent(test.Method).ClassName;
tstRslt.TestDone = true;
tstRslt.StartTime = tstRslt.Batch.StartTime;
tstRslt.EndTime = DateTime.Now;
tstRslt.FlowSetTime = 0;
tstRslt.MassOfEvapWater = 0;
tstRslt.TestTime = 1;
for (int i = 0; i < BatchRslts.Batch.WaterMeters.Count; i++)
{
MeterTestRslt meterRslt =
BatchRslts.GetMeterTestRslt(test.Name, i, CompoundMeterId.Single);
if (meterRslt != null)
{
meterRslt.WaterMeter.SerialNr = pcbNrs[i % pcbNrs.Length];
meterRslt.Passed = true;
meterRslt.TestDone = true;
}
//if (iperlHeads[i] != null)
//{
// iperlHeads[i].CommFailed = iperlHeads[i].Disabled = false;
// iperlHeads[i].SerialNr = pcbNrs[i % pcbNrs.Length];
//}
}
}
}
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Progress.Completed));
Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(Common.Utils.GetTestName(test.Name, 1, 1), 0)));
@@ -354,8 +311,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication
//------------------------------------------------
State.Create(string.Format("iPerlCommunicationSeq : {0}", testParams.Activity))
.AddOperation(checkUiOp)
.EnterState();
.AddOperation(checkUiOp)
.EnterState();
e = StateMachine.WaitRunDevsRunOps();
if (TestAndLogUiCmdStop(test, e))
@@ -2,22 +2,19 @@
/// Copyright (c) 2021 Sensus Slovensko a.s.
///
using TBF.Rig.TestMethods.iPerlCommunication.iPerlHead;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication
{
public class iPerlDataWrite
{
public MessageID MessageID;
public StructName StructName;
public int Offset;
public byte[] Data;
public string Description;
public iPerlDataWrite(MessageID mesageID, StructName structName, int offset, byte[] data, string description)
public iPerlDataWrite(MessageID mesageID, int offset, byte[] data, string description)
{
MessageID = mesageID;
StructName = structName;
Offset = offset;
Data = data;
Description = description;
@@ -104,10 +104,4 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
Flush = 0,
ProcessAndSave,
}
public enum CommunicationInterface
{
RFID,
NFC
}
}
@@ -43,7 +43,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public int MuxBoardNrOrGroup14 { get { return iperlHeadCfg.MuxBoardNr; } }
public int Group { get { return iperlHeadCfg.Group; } }
public iPerlHead.MeterType MeterType { get { return iperlHeadCfg.MeterType; } }
public CommunicationInterface CommInterface { get { return iperlHeadCfg.CommunicationInterface; } }
public int Position
{
@@ -69,17 +68,10 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
get
{
if (ConfigStruct != null)
return ConfigStruct.GetPcbNrString();
else if (simulatedPcbNr != null)
return simulatedPcbNr;
else
return string.Empty;
}
set
{
simulatedPcbNr = value;
if (ConfigStruct != null) return ConfigStruct.GetPcbNrString();
else return string.Empty;
}
set { }
}
public bool Disabled;
@@ -160,8 +152,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public double WMVolume { get { return wmVolume; } }
public double WMTestTime { get { return wmTestTime; } }
string simulatedPcbNr = null;
int wmPulses;
int wmRefPulses;
double beginWMState;
@@ -472,8 +462,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
Q2CorrRL = 0;
Q2CorrLR = 0;
simulatedPcbNr = null;
dataStreamState = DataStreamState.Flush;
currentFlowDir = InitFlowDir;
@@ -1009,22 +997,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
}
}
public string ReadOptoData()
{
string received = ".";
lock (this)
{
int nrBytes = optoSerialPort.BytesToRead;
if (nrBytes > 0)
{
char[] buffer = new char[nrBytes];
optoSerialPort.Read(buffer, 0, nrBytes);
received = new string(buffer);
}
}
return received;
}
void OptoTelegramReceived(int currentIx, bool async, Int64 volumeRawExt, Int64 timestampRawExt)
{
@@ -1056,7 +1028,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// <summary>
///
/// Called from the state machine when a test is selected and UI needs to be updated.
/// </summary>
public void OnOptoReceived(object sender, OptoReceivedEventArgs args)
@@ -25,7 +25,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public int RfidComPortNr; /// 0 = use MuxBoardNr
public int MuxBoardNr; /// 0 = use RfidComPort(Nr), otherwise mux. board nr. 1 .. 4
public int Group; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10
public CommunicationInterface CommunicationInterface; /// Communication Interface: RFID or NFC
/// <summary> Procedure parameters </summary>
[XmlIgnore]
@@ -46,7 +45,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
RfidComPortNr = 0; /// = use mux. board
MuxBoardNr = 1;
ProcParams = CreateProcParamsProvider() as ProcParams;
CommunicationInterface = CommunicationInterface.RFID;
}
public IperlHeadCfg(IComponentFactory factory)
@@ -57,13 +55,12 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
public string ToString(int i)
{
return string.Format("{0} Group1 (mux#)={1}, Group2={2}, Opto=Com{3}, RFID=Com{4}, Interface={5}",
return string.Format("{0} Group1 (mux#)={1}, Group2={2}, Opto=Com{3}, RFID=Com{4}",
Name,
MuxBoardNr,
Group,
OptoComPortNr,
RfidComPortNr,
CommunicationInterface);
RfidComPortNr);
}
}
}
@@ -3,14 +3,16 @@
///
using System;
using System.Net;
using System.Net.Sockets;
using System.Windows.Forms;
using Common;
using Config.Entities;
using TBF.Rig.Generic;
using TBF.Resources;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
public partial class IperlHeadCfgCtrl : UserControl, IComponentCfgCtrl
public partial class IperlHeadCfgCtrl : UserControl, IComponentCfgCtrl
{
public bool ShowMore { get { return false; } }
@@ -53,9 +55,7 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
rfidPortNrTextBox.Text = config.RfidComPortNr.ToString();
muxBoardNrTextBox.Text = config.MuxBoardNr.ToString();
groupTextBox.Text = config.Group.ToString();
comboBoxCommunicationInterface.SelectedItem = config.CommunicationInterface.ToString();
tabPage2.Controls.Add(new IperlHeadTestCtrl(config));
}
}
public void Unlock()
{
@@ -68,7 +68,6 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
rfidPortNrTextBox.Enabled = true;
muxBoardNrTextBox.Enabled = true;
groupTextBox.Enabled = true;
comboBoxCommunicationInterface.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@@ -145,9 +144,8 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
config.RfidComPortNr = int.Parse(rfidPortNrTextBox.Text);
config.MuxBoardNr = int.Parse(muxBoardNrTextBox.Text);
config.Group = int.Parse(groupTextBox.Text);
config.CommunicationInterface = (CommunicationInterface)comboBoxCommunicationInterface.SelectedIndex;
return flags;
}
}
}
}
@@ -31,145 +31,149 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBoxCommunicationInterface = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.optoSerialPortTextBox = new System.Windows.Forms.TextBox();
this.optoSerialPortLabel = new System.Windows.Forms.Label();
this.muxBoardNrTextBox = new System.Windows.Forms.TextBox();
this.muxBoardNrLabel = new System.Windows.Forms.Label();
this.groupTextBox = new System.Windows.Forms.TextBox();
this.groupLabel = new System.Windows.Forms.Label();
this.rfidPortNrTextBox = new System.Windows.Forms.TextBox();
this.rfidSerialPortNrLabel = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.optoDataGroupBox = new System.Windows.Forms.GroupBox();
this.tcpipPortLabel = new System.Windows.Forms.Label();
this.tcpipPortTextBox = new System.Windows.Forms.TextBox();
this.ipAddressLabel = new System.Windows.Forms.Label();
this.ipAddressTextBox = new System.Windows.Forms.TextBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.optoSerialPortLabel = new System.Windows.Forms.Label();
this.optoSerialPortTextBox = new System.Windows.Forms.TextBox();
this.groupTextBox = new System.Windows.Forms.TextBox();
this.groupLabel = new System.Windows.Forms.Label();
this.muxBoardNrTextBox = new System.Windows.Forms.TextBox();
this.muxBoardNrLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.optoDataGroupBox.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
// nameTextBox
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(611, 432);
this.tabControl1.TabIndex = 0;
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(135, 40);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(121, 20);
this.nameTextBox.TabIndex = 2;
//
// tabPage1
// nameLabel
//
this.tabPage1.Controls.Add(this.label4);
this.tabPage1.Controls.Add(this.label3);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Controls.Add(this.optoDataGroupBox);
this.tabPage1.Controls.Add(this.groupTextBox);
this.tabPage1.Controls.Add(this.groupLabel);
this.tabPage1.Controls.Add(this.muxBoardNrTextBox);
this.tabPage1.Controls.Add(this.muxBoardNrLabel);
this.tabPage1.Controls.Add(this.nameTextBox);
this.tabPage1.Controls.Add(this.nameLabel);
this.tabPage1.Controls.Add(this.classNameLabel);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(603, 403);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Config";
this.tabPage1.UseVisualStyleBackColor = true;
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(25, 43);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// label4
// classNameLabel
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(208, 101);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.TabIndex = 25;
this.label4.Text = "1 .. 10";
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(132, 16);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ClassName";
//
// label3
// optoSerialPortTextBox
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(208, 72);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(33, 16);
this.label3.TabIndex = 24;
this.label3.Text = "1 .. 4";
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(329, 42);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(34, 20);
this.optoSerialPortTextBox.TabIndex = 7;
//
// groupBox1
// optoSerialPortLabel
//
this.groupBox1.Controls.Add(this.comboBoxCommunicationInterface);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.rfidPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(10, 259);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
this.groupBox1.Size = new System.Drawing.Size(552, 68);
this.groupBox1.TabIndex = 23;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "RFID / NFC communication (in case mux. board is not used)";
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(241, 45);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(72, 13);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
//
// comboBoxCommunicationInterface
// muxBoardNrTextBox
//
this.comboBoxCommunicationInterface.Enabled = false;
this.comboBoxCommunicationInterface.FormattingEnabled = true;
this.comboBoxCommunicationInterface.Items.AddRange(new object[] {
"RFID",
"NFC"});
this.comboBoxCommunicationInterface.Location = new System.Drawing.Point(201, 27);
this.comboBoxCommunicationInterface.Name = "comboBoxCommunicationInterface";
this.comboBoxCommunicationInterface.Size = new System.Drawing.Size(71, 24);
this.comboBoxCommunicationInterface.TabIndex = 9;
this.muxBoardNrTextBox.Enabled = false;
this.muxBoardNrTextBox.Location = new System.Drawing.Point(135, 63);
this.muxBoardNrTextBox.Name = "muxBoardNrTextBox";
this.muxBoardNrTextBox.Size = new System.Drawing.Size(34, 20);
this.muxBoardNrTextBox.TabIndex = 9;
//
// label1
// muxBoardNrLabel
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(41, 30);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(153, 16);
this.label1.TabIndex = 8;
this.label1.Text = "Communication Interface";
this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 66);
this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(106, 13);
this.muxBoardNrLabel.TabIndex = 8;
this.muxBoardNrLabel.Text = "Group 1 (mux. board)";
//
// groupTextBox
//
this.groupTextBox.Enabled = false;
this.groupTextBox.Location = new System.Drawing.Point(135, 86);
this.groupTextBox.Name = "groupTextBox";
this.groupTextBox.Size = new System.Drawing.Size(34, 20);
this.groupTextBox.TabIndex = 11;
//
// groupLabel
//
this.groupLabel.AutoSize = true;
this.groupLabel.Location = new System.Drawing.Point(25, 89);
this.groupLabel.Name = "groupLabel";
this.groupLabel.Size = new System.Drawing.Size(45, 13);
this.groupLabel.TabIndex = 10;
this.groupLabel.Text = "Group 2";
//
// rfidPortNrTextBox
//
this.rfidPortNrTextBox.Enabled = false;
this.rfidPortNrTextBox.Location = new System.Drawing.Point(439, 26);
this.rfidPortNrTextBox.Margin = new System.Windows.Forms.Padding(4);
this.rfidPortNrTextBox.Location = new System.Drawing.Point(329, 21);
this.rfidPortNrTextBox.Name = "rfidPortNrTextBox";
this.rfidPortNrTextBox.Size = new System.Drawing.Size(44, 22);
this.rfidPortNrTextBox.Size = new System.Drawing.Size(34, 20);
this.rfidPortNrTextBox.TabIndex = 7;
//
// rfidSerialPortNrLabel
//
this.rfidSerialPortNrLabel.AutoSize = true;
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(321, 30);
this.rfidSerialPortNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(241, 24);
this.rfidSerialPortNrLabel.Name = "rfidSerialPortNrLabel";
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(88, 16);
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(72, 13);
this.rfidSerialPortNrLabel.TabIndex = 6;
this.rfidSerialPortNrLabel.Text = "Serial port nr.:";
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(22, 19);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(83, 17);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use TCP/IP";
this.radioButton1.UseVisualStyleBackColor = true;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(234, 19);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(92, 17);
this.radioButton2.TabIndex = 1;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "Use serial port";
this.radioButton2.UseVisualStyleBackColor = true;
//
// optoDataGroupBox
//
this.optoDataGroupBox.Controls.Add(this.tcpipPortLabel);
@@ -180,222 +184,125 @@ namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
this.optoDataGroupBox.Controls.Add(this.radioButton2);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortLabel);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortTextBox);
this.optoDataGroupBox.Location = new System.Drawing.Point(10, 131);
this.optoDataGroupBox.Margin = new System.Windows.Forms.Padding(4);
this.optoDataGroupBox.Location = new System.Drawing.Point(28, 114);
this.optoDataGroupBox.Name = "optoDataGroupBox";
this.optoDataGroupBox.Padding = new System.Windows.Forms.Padding(4);
this.optoDataGroupBox.Size = new System.Drawing.Size(552, 119);
this.optoDataGroupBox.TabIndex = 18;
this.optoDataGroupBox.Size = new System.Drawing.Size(414, 97);
this.optoDataGroupBox.TabIndex = 5;
this.optoDataGroupBox.TabStop = false;
this.optoDataGroupBox.Text = "Opto-data";
//
// tcpipPortLabel
//
this.tcpipPortLabel.AutoSize = true;
this.tcpipPortLabel.Location = new System.Drawing.Point(41, 87);
this.tcpipPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.tcpipPortLabel.Location = new System.Drawing.Point(31, 71);
this.tcpipPortLabel.Name = "tcpipPortLabel";
this.tcpipPortLabel.Size = new System.Drawing.Size(54, 16);
this.tcpipPortLabel.Size = new System.Drawing.Size(47, 13);
this.tcpipPortLabel.TabIndex = 4;
this.tcpipPortLabel.Text = "Port nr..:";
//
// tcpipPortTextBox
//
this.tcpipPortTextBox.Enabled = false;
this.tcpipPortTextBox.Location = new System.Drawing.Point(143, 84);
this.tcpipPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.tcpipPortTextBox.Location = new System.Drawing.Point(107, 68);
this.tcpipPortTextBox.Name = "tcpipPortTextBox";
this.tcpipPortTextBox.Size = new System.Drawing.Size(51, 22);
this.tcpipPortTextBox.Size = new System.Drawing.Size(39, 20);
this.tcpipPortTextBox.TabIndex = 5;
//
// ipAddressLabel
//
this.ipAddressLabel.AutoSize = true;
this.ipAddressLabel.Location = new System.Drawing.Point(41, 59);
this.ipAddressLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.ipAddressLabel.Location = new System.Drawing.Point(31, 48);
this.ipAddressLabel.Name = "ipAddressLabel";
this.ipAddressLabel.Size = new System.Drawing.Size(78, 16);
this.ipAddressLabel.Size = new System.Drawing.Size(63, 13);
this.ipAddressLabel.TabIndex = 2;
this.ipAddressLabel.Text = "IP address.:";
//
// ipAddressTextBox
//
this.ipAddressTextBox.Enabled = false;
this.ipAddressTextBox.Location = new System.Drawing.Point(143, 55);
this.ipAddressTextBox.Margin = new System.Windows.Forms.Padding(4);
this.ipAddressTextBox.Location = new System.Drawing.Point(107, 45);
this.ipAddressTextBox.Name = "ipAddressTextBox";
this.ipAddressTextBox.Size = new System.Drawing.Size(129, 22);
this.ipAddressTextBox.Size = new System.Drawing.Size(98, 20);
this.ipAddressTextBox.TabIndex = 3;
//
// radioButton1
// groupBox1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Checked = true;
this.radioButton1.Enabled = false;
this.radioButton1.Location = new System.Drawing.Point(29, 23);
this.radioButton1.Margin = new System.Windows.Forms.Padding(4);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(99, 20);
this.radioButton1.TabIndex = 0;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Use TCP/IP";
this.radioButton1.UseVisualStyleBackColor = true;
this.groupBox1.Controls.Add(this.rfidPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(28, 218);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(414, 55);
this.groupBox1.TabIndex = 12;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "RFID communication (in case mux. board is not used)";
//
// radioButton2
// label3
//
this.radioButton2.AutoSize = true;
this.radioButton2.Enabled = false;
this.radioButton2.Location = new System.Drawing.Point(312, 23);
this.radioButton2.Margin = new System.Windows.Forms.Padding(4);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(115, 20);
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "Use serial port";
this.radioButton2.UseVisualStyleBackColor = true;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(176, 66);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(31, 13);
this.label3.TabIndex = 13;
this.label3.Text = "1 .. 4";
//
// optoSerialPortLabel
// label4
//
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(321, 55);
this.optoSerialPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(88, 16);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(176, 89);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(37, 13);
this.label4.TabIndex = 14;
this.label4.Text = "1 .. 10";
//
// optoSerialPortTextBox
// WaterMeterCfgCtrl
//
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(439, 52);
this.optoSerialPortTextBox.Margin = new System.Windows.Forms.Padding(4);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(44, 22);
this.optoSerialPortTextBox.TabIndex = 7;
//
// groupTextBox
//
this.groupTextBox.Enabled = false;
this.groupTextBox.Location = new System.Drawing.Point(153, 97);
this.groupTextBox.Margin = new System.Windows.Forms.Padding(4);
this.groupTextBox.Name = "groupTextBox";
this.groupTextBox.Size = new System.Drawing.Size(44, 22);
this.groupTextBox.TabIndex = 22;
//
// groupLabel
//
this.groupLabel.AutoSize = true;
this.groupLabel.Location = new System.Drawing.Point(6, 101);
this.groupLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.groupLabel.Name = "groupLabel";
this.groupLabel.Size = new System.Drawing.Size(54, 16);
this.groupLabel.TabIndex = 21;
this.groupLabel.Text = "Group 2";
//
// muxBoardNrTextBox
//
this.muxBoardNrTextBox.Enabled = false;
this.muxBoardNrTextBox.Location = new System.Drawing.Point(153, 69);
this.muxBoardNrTextBox.Margin = new System.Windows.Forms.Padding(4);
this.muxBoardNrTextBox.Name = "muxBoardNrTextBox";
this.muxBoardNrTextBox.Size = new System.Drawing.Size(44, 22);
this.muxBoardNrTextBox.TabIndex = 20;
//
// muxBoardNrLabel
//
this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(6, 72);
this.muxBoardNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(131, 16);
this.muxBoardNrLabel.TabIndex = 19;
this.muxBoardNrLabel.Text = "Group 1 (mux. board)";
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(153, 40);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(160, 22);
this.nameTextBox.TabIndex = 17;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(6, 44);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(44, 16);
this.nameLabel.TabIndex = 16;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(149, 11);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(78, 16);
this.classNameLabel.TabIndex = 15;
this.classNameLabel.Text = "ClassName";
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(603, 403);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Test";
this.tabPage2.UseVisualStyleBackColor = true;
//
// IperlHeadCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tabControl1);
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "IperlHeadCfgCtrl";
this.Size = new System.Drawing.Size(617, 438);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.optoDataGroupBox);
this.Controls.Add(this.groupTextBox);
this.Controls.Add(this.groupLabel);
this.Controls.Add(this.muxBoardNrTextBox);
this.Controls.Add(this.muxBoardNrLabel);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "WaterMeterCfgCtrl";
this.Size = new System.Drawing.Size(500, 300);
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.optoDataGroupBox.ResumeLayout(false);
this.optoDataGroupBox.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ComboBox comboBoxCommunicationInterface;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TextBox optoSerialPortTextBox;
private System.Windows.Forms.Label optoSerialPortLabel;
private System.Windows.Forms.TextBox muxBoardNrTextBox;
private System.Windows.Forms.Label muxBoardNrLabel;
private System.Windows.Forms.TextBox groupTextBox;
private System.Windows.Forms.Label groupLabel;
private System.Windows.Forms.TextBox rfidPortNrTextBox;
private System.Windows.Forms.Label rfidSerialPortNrLabel;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.GroupBox optoDataGroupBox;
private System.Windows.Forms.Label tcpipPortLabel;
private System.Windows.Forms.TextBox tcpipPortTextBox;
private System.Windows.Forms.Label ipAddressLabel;
private System.Windows.Forms.TextBox ipAddressTextBox;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.Label optoSerialPortLabel;
private System.Windows.Forms.TextBox optoSerialPortTextBox;
private System.Windows.Forms.TextBox groupTextBox;
private System.Windows.Forms.Label groupLabel;
private System.Windows.Forms.TextBox muxBoardNrTextBox;
private System.Windows.Forms.Label muxBoardNrLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.TabPage tabPage2;
}
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}
@@ -1,137 +0,0 @@
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
partial class IperlHeadTestCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.optoTestGroupBox = new System.Windows.Forms.GroupBox();
this.optoListBox = new System.Windows.Forms.ListBox();
this.rfidOutputListBox = new System.Windows.Forms.ListBox();
this.RfidTestGroupBox = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.rfidCommandComboBox = new System.Windows.Forms.ComboBox();
this.commandTestButton = new System.Windows.Forms.Button();
this.optoTestGroupBox.SuspendLayout();
this.RfidTestGroupBox.SuspendLayout();
this.SuspendLayout();
//
// optoTestGroupBox
//
this.optoTestGroupBox.Controls.Add(this.optoListBox);
this.optoTestGroupBox.Location = new System.Drawing.Point(5, 4);
this.optoTestGroupBox.Name = "optoTestGroupBox";
this.optoTestGroupBox.Size = new System.Drawing.Size(591, 161);
this.optoTestGroupBox.TabIndex = 2;
this.optoTestGroupBox.TabStop = false;
this.optoTestGroupBox.Text = "Opto-data";
//
// optoListBox
//
this.optoListBox.FormattingEnabled = true;
this.optoListBox.ItemHeight = 16;
this.optoListBox.Location = new System.Drawing.Point(7, 22);
this.optoListBox.Name = "optoListBox";
this.optoListBox.Size = new System.Drawing.Size(573, 132);
this.optoListBox.TabIndex = 0;
//
// rfidOutputListBox
//
this.rfidOutputListBox.FormattingEnabled = true;
this.rfidOutputListBox.ItemHeight = 16;
this.rfidOutputListBox.Location = new System.Drawing.Point(5, 54);
this.rfidOutputListBox.Name = "rfidOutputListBox";
this.rfidOutputListBox.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.rfidOutputListBox.Size = new System.Drawing.Size(575, 164);
this.rfidOutputListBox.TabIndex = 3;
//
// RfidTestGroupBox
//
this.RfidTestGroupBox.Controls.Add(this.rfidOutputListBox);
this.RfidTestGroupBox.Controls.Add(this.label2);
this.RfidTestGroupBox.Controls.Add(this.rfidCommandComboBox);
this.RfidTestGroupBox.Controls.Add(this.commandTestButton);
this.RfidTestGroupBox.Location = new System.Drawing.Point(5, 171);
this.RfidTestGroupBox.Name = "RfidTestGroupBox";
this.RfidTestGroupBox.Size = new System.Drawing.Size(591, 224);
this.RfidTestGroupBox.TabIndex = 3;
this.RfidTestGroupBox.TabStop = false;
this.RfidTestGroupBox.Text = "RFID / NFC data";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(2, 25);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 16);
this.label2.TabIndex = 2;
this.label2.Text = "Command";
//
// rfidCommandComboBox
//
this.rfidCommandComboBox.FormattingEnabled = true;
this.rfidCommandComboBox.Location = new System.Drawing.Point(86, 19);
this.rfidCommandComboBox.Name = "rfidCommandComboBox";
this.rfidCommandComboBox.Size = new System.Drawing.Size(341, 24);
this.rfidCommandComboBox.TabIndex = 1;
//
// commandTestButton
//
this.commandTestButton.Location = new System.Drawing.Point(449, 19);
this.commandTestButton.Name = "commandTestButton";
this.commandTestButton.Size = new System.Drawing.Size(126, 24);
this.commandTestButton.TabIndex = 0;
this.commandTestButton.Text = "Send command";
this.commandTestButton.UseVisualStyleBackColor = true;
this.commandTestButton.MouseClick += new System.Windows.Forms.MouseEventHandler(this.CommandTestButtonClick);
//
// IperlHeadTestCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.optoTestGroupBox);
this.Controls.Add(this.RfidTestGroupBox);
this.Name = "IperlHeadTestCtrl";
this.Size = new System.Drawing.Size(611, 432);
this.Load += new System.EventHandler(this.UserControl_Load);
this.optoTestGroupBox.ResumeLayout(false);
this.RfidTestGroupBox.ResumeLayout(false);
this.RfidTestGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox optoTestGroupBox;
private System.Windows.Forms.ListBox rfidOutputListBox;
private System.Windows.Forms.GroupBox RfidTestGroupBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox rfidCommandComboBox;
private System.Windows.Forms.Button commandTestButton;
private System.Windows.Forms.ListBox optoListBox;
}
}
@@ -1,155 +0,0 @@
using Common;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Forms;
using TBF.Rig.DataEntry.S620.CheckItems;
using TBF.Rig.Generic;
using TBF.Rig.Sequences;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
public partial class IperlHeadTestCtrl : UserControl
{
IperlHeadCfg config;
IperlHead iPerlHead;
Thread optoThread;
private bool stopWorkerThread;
public event EventHandler<OptoReceivedEventArgs> OptoReceivedHandler;
public IperlHeadTestCtrl(IperlHeadCfg config)
{
this.config = config;
InitializeComponent();
if (config == null) return;
iPerlCommunicationForm.cfg = new TestMethodCfg(null); // default values for iPerlCommunication
foreach(var head in ProcessData.IperlHeads)
{
if (head != null && head.Name == config.Name) { iPerlHead = head; }
}
rfidCommandComboBox.DisplayMember = "Name";
rfidCommandComboBox.ValueMember = "Value";
var items = new[]
{
new {Name = "Read PCB", Value = "ReadPCB" },
new {Name = "Set Test Mode", Value = "SetTestMode" },
new {Name = "Set Active Mode", Value = "SetActiveMode" }
};
/*
// CTRL+ALT+double click - hidden poweruser menu
if (((Keyboard.ModifierKeys & Keys.Control) == Keys.Control) && ((Keyboard.ModifierKeys & Keys.Alt) == Keys.Alt) && Users.CurrentUser.AuthorizedAs == AuthorizedAs.PowerUser)
{
Array.Resize(ref items, items.Length + 1);
items[items.Length - 1] = new { Name = "Kluc", Value = "Kluc" };
}
*/
rfidCommandComboBox.DataSource = items;
stopWorkerThread = false;
OptoReceivedHandler += (EventHandler<OptoReceivedEventArgs>)((sndr, args) =>
{
if (this.InvokeRequired)
this.Invoke((Delegate)new EventHandler<OptoReceivedEventArgs>(this.OnOptoReceived2), sndr, (object)args);
else
this.OnOptoReceived2(sndr, args);
});
}
public void OnOptoReceived2(object sender, OptoReceivedEventArgs args)
{
optoListBox.Items.Insert(0,args.Data);
}
private void CommandTestButtonClick(object sender, MouseEventArgs e)
{
rfidOutputListBox.Items.Clear();
using (Tools.LogChecker logChecker = new Tools.LogChecker("RfidData", log4net.Core.Level.Debug))
{
ListItem rfidListItem = new ListItem();
rfidListItem.Attributes.Add("style", "font-weight:bold");
switch (rfidCommandComboBox.SelectedValue)
{
case "ReadPCB":
rfidListItem.Text = $"PCB: {OpticalHeadTest.ReadRequest_PCB(iPerlHead)}";
break;
case "SetTestMode":
rfidListItem.Text = OpticalHeadTest.SetTestMode(iPerlHead);
optoListBox.Items.Clear();
stopWorkerThread = false;
optoThread = new Thread(OptoWorker);
if (!optoThread.IsAlive)
{
optoThread.Start();
}
break;
case "SetActiveMode":
rfidListItem.Text = OpticalHeadTest.SetActiveMode(iPerlHead);
stopWorkerThread = true;
break;
}
rfidOutputListBox.Items.Add(rfidListItem);
rfidOutputListBox.Items.AddRange(logChecker.Messages.ToArray());
}
}
private void OptoWorker()
{
while (!this.stopWorkerThread)
{
Thread.Sleep(250);
if (this.stopWorkerThread)
break;
string buffer = iPerlHead.ReadOptoData();
if (string.IsNullOrEmpty(buffer))
{
this.OnOptoReceived((object)this, new OptoReceivedEventArgs("."));
}
else
OnOptoReceived((object)this, new OptoReceivedEventArgs(buffer));
}
}
public void OnOptoReceived(object sender, OptoReceivedEventArgs args)
{
if (this.OptoReceivedHandler == null)
return;
try
{
this.OptoReceivedHandler(sender, args);
}
catch (Exception ex)
{
}
}
private void UserControl_Load(object sender, EventArgs e)
{
this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing);
}
void ParentForm_FormClosing(object sender, FormClosingEventArgs e)
{
//OnHandleDestroyed(new EventArgs());
stopWorkerThread = true;
if (optoThread != null)
{
optoThread.Abort();
}
}
}
}
@@ -1,293 +0,0 @@
using log4net;
using Sensus.iPerl.NfcHandler;
using System;
using System.Globalization;
using System.Text;
using System.Threading;
using static Sensus.iPerl.NfcHandler.MCI_Protocol;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
internal class NfcServices
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, out byte[] buffer)
{
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
MessageEventHandlers(_nfcDataHandler);
CR95HF_MessageEventHandlers(_nfcDataHandler._CR95HF_Reader);
ST25DV_MessageEventHandlers(_nfcDataHandler._ST25DV_Device);
MCI_MessageEventHandlers(_nfcDataHandler._MCI_Protocol);
NFCHeadConfig_MessageEventHandlers(_nfcDataHandler._NFCHead_Config);
try
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} ReadRequest : {structName}, {offset}, {length}");
OpenConnection(_nfcDataHandler, cfg, iperlHead);
buffer = MciRead(_nfcDataHandler, cfg, structName, (ushort)offset, length);
CloseComPort(_nfcDataHandler);
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} ReadRequest : {structName}, {offset}, {length} ; Response= {ByteArrayToHexString(buffer)} ; Error: {_nfcDataHandler.LastErrorMessage}");
return Convert.ToInt32(_nfcDataHandler.LastErrorCode); //return 0;
}
catch (Exception ex)
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} ReadRequest Error: {ex.Message}");
buffer = new byte[length];
return 3;
}
}
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MCI_Protocol.StructName structName, int offset, int length, byte[] buffer)
{
NfcDataHandler _nfcDataHandler = new NfcDataHandler();
MessageEventHandlers(_nfcDataHandler);
CR95HF_MessageEventHandlers(_nfcDataHandler._CR95HF_Reader);
ST25DV_MessageEventHandlers(_nfcDataHandler._ST25DV_Device);
MCI_MessageEventHandlers(_nfcDataHandler._MCI_Protocol);
NFCHeadConfig_MessageEventHandlers(_nfcDataHandler._NFCHead_Config);
try
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} WriteRequest : {structName}, {offset}, {length}, {ByteArrayToHexString(buffer)}");
OpenConnection(_nfcDataHandler, cfg, iperlHead);
MciWrite(_nfcDataHandler, cfg, structName, (ushort)offset, length, buffer);
CloseComPort(_nfcDataHandler);
return 0;
}
catch (Exception ex)
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} WriteRequest Error: {ex.Message}");
return 3;
}
}
private static void OpenConnection(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, IperlHead iperlHead)
{
string comPort = $"COM{iperlHead.RfidComPortNr}";
int retryCount = 0 ;
Open:
nfcDataHandler.Close();
Thread.Sleep(100);
if (nfcDataHandler.OpenConnection(comPort, cfg.BaudRate, cfg.DataBits, cfg.ParityBit, cfg.StopBits))
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} Port Open");
if (nfcDataHandler.ConnectReader())
{
rfidDataLogger.Info($"NFC COM{iperlHead.RfidComPortNr} Reader connected");
if (!nfcDataHandler.ConnectDevice())
{
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect device.");
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
if (nfcDataHandler.Echo()) break;
}
}
}
else
{
retryCount++;
rfidDataLogger.Error($"NFC COM{iperlHead.RfidComPortNr} Error connect reader. Reconnect comport {retryCount}");
if (retryCount < cfg.MaxCommRetries)
goto Open;
}
}
else
rfidDataLogger.Error($"Open NFC COM{iperlHead.RfidComPortNr} Port Failed");
}
private static void CloseComPort(NfcDataHandler nfcDataHandler)
{
nfcDataHandler.Close();
}
private static byte[] MciRead(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, StructName structName, ushort offset, int length)
{
bool isReadValues = false;
int retryCount = 0;
Read:
try
{
isReadValues = false;
long num1 = (long)length;
int timeoutMs = 4000;
byte payloadlength = Convert.ToByte(num1.ToString("X2"), 16);
if (nfcDataHandler.MCI_Read(structName, offset, payloadlength, timeoutMs))
{
byte[] lastData = nfcDataHandler.LastData;
if ((long)lastData.Length >= num1)
{
rfidDataLogger.Info($"COM: MciRead ({structName},{offset},{length}) = {ByteArrayToHexString(lastData)}");
return lastData;
}
else
rfidDataLogger.Info($"COM: MciRead ({structName},{offset},{length}) = {ByteArrayToHexString(lastData)}");
}
else if (nfcDataHandler.LastErrorCode == (byte)0)
{
rfidDataLogger.Info($"MCI Error: Unidentified");
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
else
{
rfidDataLogger.Info("Last error message: " + nfcDataHandler.LastErrorMessage);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
}
catch (Exception ex)
{
rfidDataLogger.Error("MciRead Last error message: " + ex.Message);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Read;
}
return new byte[length];
}
private static void MciWrite(NfcDataHandler nfcDataHandler, TestMethodCfg cfg, MCI_Protocol.StructName structName, ushort offset, int length, byte[] payload)
{
int retryCount = 0;
Write:
try
{
long num1 = (long)length;
int timeoutMs = 4000;
byte payloadlength = Convert.ToByte(num1);
if ((int)payloadlength != payload.Length)
rfidDataLogger.Error("Insufficient Payload -- Payload lenth : " + (object)payload.Length);
else if (nfcDataHandler.MCI_Write(structName, offset, payloadlength, payload, timeoutMs))
{
// OK
}
else if (nfcDataHandler.LastErrorCode > (byte)0)
{
rfidDataLogger.Error("Last error message: " + nfcDataHandler.LastErrorMessage);
//int num2 = (int)MessageBox.Show(this._nfcDataHandler.LastErrorMessage);
}
}
catch (Exception ex)
{
rfidDataLogger.Error("MciWrite error message: " + ex.Message);
retryCount++;
if (retryCount < cfg.MaxCommRetries)
goto Write;
}
}
private static void MciWriteCommand(NfcDataHandler nfcDataHandler, byte commandcode)
{
try
{
ushort offset = 0;
int timeoutMs = 4000;
byte payloadlength = 1;
byte[] payload = new byte[1] { commandcode };
if (nfcDataHandler.MCI_Write(MCI_Protocol.StructName.Command, offset, payloadlength, payload, timeoutMs) || nfcDataHandler.LastErrorCode <= (byte)0)
return;
rfidDataLogger.Error("MciWriteCommand Last error message: " + nfcDataHandler.LastErrorMessage);
}
catch (Exception ex)
{
rfidDataLogger.Error("MciWriteCommand Last error message: " + ex.Message);
}
}
public static string ByteArrayToHexString(byte[] data)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (byte num in data)
stringBuilder.Append(num.ToString("X2"));
return stringBuilder.ToString();
}
private static byte[] BuildPayLoad(string strPayLoad, int length)
{
byte[] collection;
if (strPayLoad.Split(':').Length > 1)
{
uint timestamp = ConvertDateTimeToTimestamp(Convert.ToDateTime(DateTime.ParseExact(strPayLoad, "HH:mm:ss dd/MM/yyyy", (IFormatProvider)CultureInfo.InvariantCulture)));
byte[] bytes = BitConverter.GetBytes(timestamp);
return bytes;
}
else if (strPayLoad.Split(',').Length > 1)
{
string[] strArray = strPayLoad.Split(',');
collection = new byte[strArray.Length];
for (int index3 = 0; index3 < strArray.Length; ++index3)
collection[index3] = Convert.ToByte(strArray[index3], 16);
return collection;
}
else
{
//int num = strPayLoad.Split(',').Length;
collection = HexStringToByteArray(strPayLoad.Substring(strPayLoad.Length - length * 2).ToUpper());
Array.Reverse((Array)collection);
return collection;
}
}
public static byte[] HexStringToByteArray(string hexString)
{
int length = hexString.Length;
byte[] byteArray = new byte[length / 2];
for (int startIndex = 0; startIndex < length; startIndex += 2)
byteArray[startIndex / 2] = Convert.ToByte(hexString.Substring(startIndex, 2), 16);
return byteArray;
}
private static uint ConvertDateTimeToTimestamp(DateTime datetime)
{
TimeSpan utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
return (uint)((datetime - new DateTime(2000, 1, 1, 0, 0, 0).ToLocalTime()).TotalSeconds + utcOffset.TotalSeconds);
}
#region EventHandlers
public static void MCI_MessageEventHandlers(MCI_Protocol e)
{
DelNfc_MCI_MessageHandler mciMessageHandler = new DelNfc_MCI_MessageHandler(OnHandler);
e.MessageEvent += mciMessageHandler;
}
public static void ST25DV_MessageEventHandlers(ST25DV_Device e)
{
DelNfc_ST25DV_MessageHandler dvMessageHandler = new DelNfc_ST25DV_MessageHandler(OnHandler);
e.MessageEvent += dvMessageHandler;
}
public static void CR95HF_MessageEventHandlers(CR95HF_Reader e)
{
DelNfc_CR95HF_MessageHandler hfMessageHandler = new DelNfc_CR95HF_MessageHandler(OnHandler);
e.MessageEvent += hfMessageHandler;
}
public static void NFCHeadConfig_MessageEventHandlers(NFCHeadConfig e)
{
DelNfc_NFCHeadConfig_MessageHandler configMessageHandler = new DelNfc_NFCHeadConfig_MessageHandler(OnHandler);
e.MessageEvent += configMessageHandler;
}
public static void MessageEventHandlers(NfcDataHandler e)
{
DelNfcMessageHandler nfcMessageHandler = new DelNfcMessageHandler(OnHandler);
e.MessageEvent += nfcMessageHandler;
}
public static void OnHandler(object sender, NfcMessageEventArgs e)
{
if (e.Message == null)
return;
string message = e.Message.Replace("\n", " ").Replace("\r", "");
rfidDataLogger.Debug(message);
}
#endregion
}
}
@@ -1,123 +0,0 @@
using Sensus.iPerl.RfidCom.Exceptions;
using Sensus.iPerl.RfidCom.Helper;
using Sensus.iPerl.RfidCom;
using System;
using System.Text.RegularExpressions;
using System.Threading;
using log4net;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
internal class RfidServices
{
protected static readonly ILog rfidDataLogger = LogManager.GetLogger("RfidData");
private static readonly ILog log = LogManager.GetLogger(typeof(iPerlCommunicationForm));
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
{
for (int i = 0; i < cfg.MaxCommRetries; i++)
{
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} reading: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},{offset}, {length}... timeout {cfg.CommTimeout})");
using (RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}"))
{
try
{
byte[] response = writer.ReadRequest((byte)messageID, offset, length, cfg.CommTimeout);
string hexString = RfidHelper.ConvertByteArrayToHexString(response);
string swapHexString = RfidHelper.SwapHexcode(hexString);
string decString = RfidHelper.HexLiteral2Unsigned(RfidHelper.SwapHexcode(hexString)).ToString();
if (length > 10)
{
//if the result only contains "00"s we are working on the wrong COM port
// or the module just isn't connected
if (Regex.IsMatch(hexString, @"^(00)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No RFID signal.");
throw new RfidValidationException("Error_Rfid_NoSignal");
}
//if the result only contains "03"s the meter did not answer.
// Might be due to the module being positioned incorrectly.
if (Regex.IsMatch(hexString, @"^(03)\1+$"))
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) <- Error: No meter signal.");
throw new RfidValidationException("Error_Rfid_NoAnswerFromMeter");
}
}
writer.ClosePort();
buffer = response;
rfidDataLogger.Info($"{iperlHead.Name} ({iperlHead.SerialNr}): ReadRequestPort(COM{iperlHead.RfidComPortNr},...) returned HEX: {hexString}; SwapHexCodeToDecimal: {decString}");
return 0;
}
catch (RfidDataNotAvailableException)
{
if (/*RfidHelper.IsPassThrough(messageID)*/ messageID == MessageID.ASICRegisterReadTest || messageID == MessageID.RadioPassthrough)
{
rfidDataLogger.Info($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {(i > 0 ? "<- Error: Invalid Pass-Through data." : "<- Info: Wait for Pass-Through data.")}");
Thread.Sleep(cfg.PassThroughWaitTime);
}
else
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
catch (RfidValidationException)
{
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
catch (Exception ex)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...) {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
}
}
}
rfidDataLogger.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
log.Error($"{iperlHead.CommInterface} reading failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: ReadRequestPort ({messageID},...)");
buffer = new byte[length];
return 3;
}
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
{
RfidLogic writer = new RfidLogic($"COM{iperlHead.RfidComPortNr}");
string payload = RfidHelper.ConvertByteArrayToHexString(buffer);
for (var i = 0; i < cfg.MaxCommRetries; i++)
{
rfidDataLogger.Error($"{iperlHead.CommInterface} Start {i} writting: COM{iperlHead.RfidComPortNr}: WriteRequest ({messageID},{offset}, {length}, {payload}... timeout {cfg.CommTimeout})");
try
{
if (writer.ClosePort()) writer.OpenPort();
writer.WriteRequest((byte)messageID, offset, length, buffer, cfg.CommTimeout, false);
writer.ClosePort();
rfidDataLogger.InfoFormat($"{iperlHead.Name}({iperlHead.SerialNr},COM{iperlHead.RfidComPortNr}): WriteRequestPort({messageID}, {offset}, {length}, {payload})");
return 0;
}
catch (Exception ex)
{
if (messageID == MessageID.RadioPassthrough || messageID == MessageID.ASICRegisterReadTest)
{
Thread.Sleep(1500);
}
else
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Error: {ex.Message}");
Thread.Sleep(cfg.WaitTimeAfterFailure);
if (i > 1)
{
rfidDataLogger.Error($"COM{iperlHead.RfidComPortNr}: Reopen the com port.");
writer.ClosePort();
}
}
}
}
writer.ClosePort();
rfidDataLogger.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
log.Error($"RFID writing failed after {cfg.MaxCommRetries} retries: COM{iperlHead.RfidComPortNr}: WriteRequestPort ({messageID},...) {System.Text.Encoding.UTF8.GetString(buffer)}");
return 2;
}
}
}
@@ -1,61 +0,0 @@
using System;
using System.Linq;
namespace TBF.Rig.TestMethods.iPerlCommunication.iPerlHead
{
internal class SimulationServices
{
const int Q2CorrFactorsAddr = 0x1878;
internal static int ReadRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, out byte[] buffer)
{
byte[] configurationBuffer = new byte[ConfigStruct.Length] { 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
byte[] calibrationBuffer = new byte[CalibrationStructV4.Length] { 3, 0, 150, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 150, 10 };
buffer = new byte[length];
if (messageID == MessageID.Configuration)
{
Array.Copy(GetPCB(iperlHead), 0, configurationBuffer, 16, 5); // set PCB Number according to iPerlHead configuration
Array.Copy(configurationBuffer,offset,buffer,0,length);
}
else if (messageID == MessageID.Calibration)
{
Array.Copy(calibrationBuffer, offset, buffer, 0, length);
}
else if ((messageID == MessageID.MetrologyMemory) && (offset == Q2CorrFactorsAddr) && (length == 2))
{
buffer = new byte[2] { 0, 0 };
}
else
{
buffer = new byte[length];
}
return iperlHead.Name.Equals("iPerl13") ? 2 : 0; /// Simulates an error on position 13
}
internal static int WriteRequest(TestMethodCfg cfg, IperlHead iperlHead, MessageID messageID, int offset, int length, byte[] buffer)
{
return 0;
}
private static Array GetPCB(IperlHead iperlHead)
{
string pcbStr = iperlHead.RfidComPortNr.ToString().PadRight(10,'0') + iperlHead.Position.ToString("D2");
long decVal = Convert.ToInt64(pcbStr);
string nHexStr = decVal.ToString("X4");
string hexStr = "";
for (int a = nHexStr.Length; a >= 1; a = a - 2)
{
hexStr = hexStr + nHexStr.Substring(a - 2, 2);
}
return Enumerable.Range(0, hexStr.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hexStr.Substring(x, 2), 16))
.ToArray();
}
}
}
+11 -40
View File
@@ -39,7 +39,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -50,7 +50,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -60,7 +60,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;DEBUG;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@@ -70,7 +70,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;MUNICH;CAMERA</DefineConstants>
<DefineConstants>TRACE;TURA_SPECIAL;IPERL;ORACLE_DB;LANG_SK</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -101,8 +101,8 @@
<SignManifests>false</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="ControlComponent3Munich">
<HintPath>..\packages\ControlBoard\Munich\ControlComponent3Munich.dll</HintPath>
<Reference Include="ControlComponent3U">
<HintPath>..\packages\ControlBoard\iPerlST-special\ControlComponent3U.dll</HintPath>
</Reference>
<Reference Include="FluentNHibernate">
<HintPath>..\packages\FluentNHibernate.2.0.3.0\lib\net40\FluentNHibernate.dll</HintPath>
@@ -145,7 +145,6 @@
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<Reference Include="System.Security" />
@@ -188,7 +187,6 @@
<Compile Include="Rig\Configs\ParamsProvider\ComponentCfgCtrl.designer.cs">
<DependentUpon>ComponentCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\DataChangeArgs.cs" />
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\Component.cs" />
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\ComponentCfg.cs" />
<Compile Include="Rig\DataContainers\BackupAndSecurityOptions\ComponentFactory.cs" />
@@ -1190,7 +1188,6 @@
<Compile Include="Rig\Output\Printers\OnePerMeter\PrinterCfgCtrl.designer.cs">
<DependentUpon>PrinterCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\Output\Printers\PrinterStatus.cs" />
<Compile Include="Rig\Output\Printers\Zapiska\FactoryCompound.cs" />
<Compile Include="Rig\Output\Printers\Zapiska\FactoryHeatMeters.cs" />
<Compile Include="Rig\Output\Printers\Zapiska\FactorySingle.cs" />
@@ -1635,17 +1632,8 @@
<DependentUpon>IperlHeadCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\FlowDirectionDetection.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\IperlHeadTestCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\IperlHeadTestCtrl.Designer.cs">
<DependentUpon>IperlHeadTestCtrl.cs</DependentUpon>
</Compile>
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\NfcServices.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\OptoReceivedEventArgs.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\ProcParams.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\RfidServices.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\SimulationServices.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\iPerlHead\StatusStruct.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\OpticalHeadTest.cs" />
<Compile Include="Rig\TestMethods\iPerlCommunication\SequenceConditionOp.cs" />
@@ -2193,7 +2181,6 @@
<Compile Include="Strings.Designer.cs" />
<Compile Include="Tools\ByteFormatter.cs" />
<Compile Include="Tools\IniUtil.cs" />
<Compile Include="Tools\LogChecker.cs" />
<Compile Include="Tools\XmlTools.cs" />
<Compile Include="UiBridge\ActivityEventArgs.cs" />
<Compile Include="UiBridge\AdjustmentInProgressEventArgs.cs" />
@@ -2232,12 +2219,6 @@
<Compile Include="UI\Bench\Components\SelectComponentClassDlg.designer.cs">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\CalibCertificateCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Metrology\CalibCertificateCtrl.Designer.cs">
<DependentUpon>CalibCertificateCtrl.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\IMetrologyDlgTab.cs" />
<Compile Include="UI\Bench\Metrology\MetrologyDlg.cs">
<SubType>Form</SubType>
@@ -2245,11 +2226,11 @@
<Compile Include="UI\Bench\Metrology\MetrologyDlg.designer.cs">
<DependentUpon>MetrologyDlg.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgScaleTab.cs">
<Compile Include="UI\Bench\Metrology\MetrologyDlgBalanceTab.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgScaleTab.designer.cs">
<DependentUpon>MetrologyDlgScaleTab.cs</DependentUpon>
<Compile Include="UI\Bench\Metrology\MetrologyDlgBalanceTab.designer.cs">
<DependentUpon>MetrologyDlgBalanceTab.cs</DependentUpon>
</Compile>
<Compile Include="UI\Bench\Metrology\MetrologyDlgBuoyancyTab.cs">
<SubType>UserControl</SubType>
@@ -3315,9 +3296,6 @@
<EmbeddedResource Include="Rig\TestMethods\iPerlCommunication\iPerlHead\IperlHeadCfgCtrl.resx">
<DependentUpon>IperlHeadCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\iPerlCommunication\iPerlHead\IperlHeadTestCtrl.resx">
<DependentUpon>IperlHeadTestCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Rig\TestMethods\LiveStream\CfgCtrl.resx">
<DependentUpon>CfgCtrl.cs</DependentUpon>
</EmbeddedResource>
@@ -3453,14 +3431,11 @@
<EmbeddedResource Include="UI\Bench\Components\SelectComponentClassDlg.resx">
<DependentUpon>SelectComponentClassDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\CalibCertificateCtrl.resx">
<DependentUpon>CalibCertificateCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlg.resx">
<DependentUpon>MetrologyDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgScaleTab.resx">
<DependentUpon>MetrologyDlgScaleTab.cs</DependentUpon>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgBalanceTab.resx">
<DependentUpon>MetrologyDlgBalanceTab.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\Bench\Metrology\MetrologyDlgBuoyancyTab.resx">
<DependentUpon>MetrologyDlgBuoyancyTab.cs</DependentUpon>
@@ -3838,10 +3813,6 @@
<Project>{a3e14180-7f00-42e5-94a9-8db62ead6ee8}</Project>
<Name>Sensus.iPerl.RfidCom</Name>
</ProjectReference>
<ProjectReference Include="..\..\NfcS5_DLL\NfcS5_DLL.csproj">
<Project>{34F6AA20-3BEC-44B4-9D18-DC66BAB79A83}</Project>
<Name>NfcS5_DLL</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{c8939821-ba5c-4988-a3d0-bf53b74865c7}</Project>
<Name>Common</Name>
-50
View File
@@ -1,50 +0,0 @@
using log4net.Appender;
using log4net.Core;
using log4net.Repository.Hierarchy;
using log4net;
using System;
using System.Collections.Generic;
namespace TBF.Tools
{
public class LogChecker : IDisposable
{
readonly Logger _logger;
readonly Level _previousLevel;
readonly MemoryAppender _appender = new MemoryAppender();
public LogChecker(string logName, Level levelToCheck)
{
_logger = (Logger)LogManager.GetLogger(logName).Logger;
_logger.AddAppender(_appender);
_previousLevel = _logger.Level;
_logger.Level = levelToCheck;
}
public List<string> Messages
{
get
{
return new List<log4net.Core.LoggingEvent>(_appender.GetEvents())
.ConvertAll(x => x.RenderedMessage);
}
}
public void Dispose()
{
_logger.Level = _previousLevel;
_logger.RemoveAppender(_appender);
}
}
}
// Example of use
//
// using (Tools.LogChecker logChecker = new Tools.LogChecker("RfidData", log4net.Core.Level.Debug))
// {
// Execute query using NHibernate
// ....
//
// MessageBox.Show(String.Join(Environment.NewLine,logChecker.Messages));
// }
//
-162
View File
@@ -1,162 +0,0 @@
namespace TBF.UI.Bench.Metrology
{
partial class CalibCertificateCtrl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}
@@ -1,140 +0,0 @@
///
/// 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;
}
}
}
}
}
}
@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+1 -1
View File
@@ -105,7 +105,7 @@ namespace TBF.UI.Bench.Metrology
{
balancesCount++;
TabPage tabPage = new TabPage(" " + cmpnt.Name + " ");
MetrologyDlgScaleTab uiControl = new MetrologyDlgScaleTab();
MetrologyDlgBalanceTab uiControl = new MetrologyDlgBalanceTab();
uiControl.MeterEntity = cmpnt;
uiControl.BalanceCfg = factory.CmpntCfgFromCmpntEntity(cmpnt) as Rig.GenericDevices.IScaleCfg;
uiControl.Dock = DockStyle.Fill;
@@ -1,9 +1,9 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
partial class MetrologyDlgScaleTab
partial class MetrologyDlgBalanceTab
{
/// <summary>
/// Required designer variable.
@@ -35,6 +35,13 @@ 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();
@@ -53,11 +60,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();
@@ -82,9 +89,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);
@@ -92,14 +99,14 @@ namespace TBF.UI.Bench.Metrology
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(700, 400);
this.splitContainer1.SplitterDistance = 160;
this.splitContainer1.Size = new System.Drawing.Size(668, 400);
this.splitContainer1.SplitterDistance = 150;
this.splitContainer1.TabIndex = 1;
//
// unitLabel
//
this.unitLabel.AutoSize = true;
this.unitLabel.Location = new System.Drawing.Point(537, 121);
this.unitLabel.Location = new System.Drawing.Point(507, 116);
this.unitLabel.Name = "unitLabel";
this.unitLabel.Size = new System.Drawing.Size(68, 13);
this.unitLabel.TabIndex = 12;
@@ -108,12 +115,82 @@ namespace TBF.UI.Bench.Metrology
// unitComboBox
//
this.unitComboBox.FormattingEnabled = true;
this.unitComboBox.Location = new System.Drawing.Point(622, 118);
this.unitComboBox.Location = new System.Drawing.Point(592, 113);
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);
@@ -126,9 +203,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(262, 10);
this.buoancyGroupBox.Location = new System.Drawing.Point(233, 10);
this.buoancyGroupBox.Name = "buoancyGroupBox";
this.buoancyGroupBox.Size = new System.Drawing.Size(248, 146);
this.buoancyGroupBox.Size = new System.Drawing.Size(248, 130);
this.buoancyGroupBox.TabIndex = 5;
this.buoancyGroupBox.TabStop = false;
this.buoancyGroupBox.Text = "Buoyancy";
@@ -136,7 +213,7 @@ namespace TBF.UI.Bench.Metrology
// weightStandardDensityTextBox
//
this.weightStandardDensityTextBox.Enabled = false;
this.weightStandardDensityTextBox.Location = new System.Drawing.Point(156, 107);
this.weightStandardDensityTextBox.Location = new System.Drawing.Point(160, 103);
this.weightStandardDensityTextBox.Name = "weightStandardDensityTextBox";
this.weightStandardDensityTextBox.Size = new System.Drawing.Size(82, 20);
this.weightStandardDensityTextBox.TabIndex = 9;
@@ -144,7 +221,7 @@ namespace TBF.UI.Bench.Metrology
// weightStandardDensityLabel
//
this.weightStandardDensityLabel.AutoSize = true;
this.weightStandardDensityLabel.Location = new System.Drawing.Point(13, 110);
this.weightStandardDensityLabel.Location = new System.Drawing.Point(17, 106);
this.weightStandardDensityLabel.Name = "weightStandardDensityLabel";
this.weightStandardDensityLabel.Size = new System.Drawing.Size(133, 13);
this.weightStandardDensityLabel.TabIndex = 8;
@@ -153,7 +230,7 @@ namespace TBF.UI.Bench.Metrology
// airDensityTextBox
//
this.airDensityTextBox.Enabled = false;
this.airDensityTextBox.Location = new System.Drawing.Point(156, 85);
this.airDensityTextBox.Location = new System.Drawing.Point(160, 81);
this.airDensityTextBox.Name = "airDensityTextBox";
this.airDensityTextBox.Size = new System.Drawing.Size(82, 20);
this.airDensityTextBox.TabIndex = 7;
@@ -161,7 +238,7 @@ namespace TBF.UI.Bench.Metrology
// airDensityLabel
//
this.airDensityLabel.AutoSize = true;
this.airDensityLabel.Location = new System.Drawing.Point(13, 88);
this.airDensityLabel.Location = new System.Drawing.Point(17, 84);
this.airDensityLabel.Name = "airDensityLabel";
this.airDensityLabel.Size = new System.Drawing.Size(95, 13);
this.airDensityLabel.TabIndex = 6;
@@ -170,7 +247,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyHumiTextBox
//
this.buoyancyHumiTextBox.Enabled = false;
this.buoyancyHumiTextBox.Location = new System.Drawing.Point(156, 63);
this.buoyancyHumiTextBox.Location = new System.Drawing.Point(160, 59);
this.buoyancyHumiTextBox.Name = "buoyancyHumiTextBox";
this.buoyancyHumiTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyHumiTextBox.TabIndex = 5;
@@ -178,7 +255,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyPressTextBox
//
this.buoyancyPressTextBox.Enabled = false;
this.buoyancyPressTextBox.Location = new System.Drawing.Point(156, 41);
this.buoyancyPressTextBox.Location = new System.Drawing.Point(160, 37);
this.buoyancyPressTextBox.Name = "buoyancyPressTextBox";
this.buoyancyPressTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyPressTextBox.TabIndex = 4;
@@ -186,7 +263,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyTempTextBox
//
this.buoyancyTempTextBox.Enabled = false;
this.buoyancyTempTextBox.Location = new System.Drawing.Point(156, 19);
this.buoyancyTempTextBox.Location = new System.Drawing.Point(160, 15);
this.buoyancyTempTextBox.Name = "buoyancyTempTextBox";
this.buoyancyTempTextBox.Size = new System.Drawing.Size(82, 20);
this.buoyancyTempTextBox.TabIndex = 3;
@@ -194,7 +271,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyHumiLabel
//
this.buoyancyHumiLabel.AutoSize = true;
this.buoyancyHumiLabel.Location = new System.Drawing.Point(13, 66);
this.buoyancyHumiLabel.Location = new System.Drawing.Point(17, 62);
this.buoyancyHumiLabel.Name = "buoyancyHumiLabel";
this.buoyancyHumiLabel.Size = new System.Drawing.Size(72, 13);
this.buoyancyHumiLabel.TabIndex = 2;
@@ -203,7 +280,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyPressLabel
//
this.buoyancyPressLabel.AutoSize = true;
this.buoyancyPressLabel.Location = new System.Drawing.Point(13, 44);
this.buoyancyPressLabel.Location = new System.Drawing.Point(17, 40);
this.buoyancyPressLabel.Name = "buoyancyPressLabel";
this.buoyancyPressLabel.Size = new System.Drawing.Size(76, 13);
this.buoyancyPressLabel.TabIndex = 1;
@@ -212,7 +289,7 @@ namespace TBF.UI.Bench.Metrology
// buoyancyTempLabel
//
this.buoyancyTempLabel.AutoSize = true;
this.buoyancyTempLabel.Location = new System.Drawing.Point(13, 22);
this.buoyancyTempLabel.Location = new System.Drawing.Point(17, 18);
this.buoyancyTempLabel.Name = "buoyancyTempLabel";
this.buoyancyTempLabel.Size = new System.Drawing.Size(83, 13);
this.buoyancyTempLabel.TabIndex = 0;
@@ -223,7 +300,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(240, 40);
this.nameGroupBox.Size = new System.Drawing.Size(208, 40);
this.nameGroupBox.TabIndex = 4;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
@@ -234,7 +311,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(516, 10);
this.testGroupBox.Location = new System.Drawing.Point(490, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
this.testGroupBox.TabIndex = 3;
@@ -243,7 +320,7 @@ namespace TBF.UI.Bench.Metrology
//
// correctedTextBox
//
this.correctedTextBox.Location = new System.Drawing.Point(91, 47);
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);
@@ -251,7 +328,7 @@ namespace TBF.UI.Bench.Metrology
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(91, 19);
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;
@@ -260,7 +337,7 @@ namespace TBF.UI.Bench.Metrology
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(11, 50);
this.correctedLabel.Location = new System.Drawing.Point(11, 40);
this.correctedLabel.Name = "correctedLabel";
this.correctedLabel.Size = new System.Drawing.Size(53, 13);
this.correctedLabel.TabIndex = 3;
@@ -269,7 +346,7 @@ namespace TBF.UI.Bench.Metrology
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(11, 22);
this.measuredLabel.Location = new System.Drawing.Point(11, 18);
this.measuredLabel.Name = "measuredLabel";
this.measuredLabel.Size = new System.Drawing.Size(54, 13);
this.measuredLabel.TabIndex = 2;
@@ -282,35 +359,29 @@ 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(700, 236);
this.listViewEx.Size = new System.Drawing.Size(668, 246);
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(16, 56);
this.calibCertificateCtrl.Name = "calibCertificateCtrl";
this.calibCertificateCtrl.Size = new System.Drawing.Size(240, 100);
this.calibCertificateCtrl.TabIndex = 13;
//
// MetrologyDlgScaleTab
// MetrologyDlgBalanceTab
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.splitContainer1);
this.Name = "MetrologyDlgScaleTab";
this.Size = new System.Drawing.Size(700, 400);
this.Name = "MetrologyDlgBalanceTab";
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
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);
@@ -343,8 +414,14 @@ 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;
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -8,16 +8,15 @@ 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 MetrologyDlgScaleTab : UserControl, IMetrologyDlgTab
public partial class MetrologyDlgBalanceTab : UserControl, IMetrologyDlgTab
{
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgScaleTab));
static readonly ILog log = LogManager.GetLogger(typeof(MetrologyDlgBalanceTab));
public const int SignifDigits = 5;
@@ -55,9 +54,13 @@ namespace TBF.UI.Bench.Metrology
Unit currentUnit;
public MetrologyDlgScaleTab()
public MetrologyDlgBalanceTab()
{
InitializeComponent();
calibDateTimePicker.CustomFormat = Constants.DateFormat;
calibDateTimePicker.MinDate = Constants.MinDate;
calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat;
calibExpirationDateTimePicker.MinDate = Constants.MinDate;
toBeRemoved = new List<MeasurementCorrection>();
unlocked = false;
}
@@ -109,7 +112,13 @@ namespace TBF.UI.Bench.Metrology
void Localize()
{
nameGroupBox.Text = Strings.Component;
buoyancyTempLabel.Text = string.Format("{0} [°C]", Strings.Ambient_temperature);
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);
buoyancyPressLabel.Text = string.Format("{0} [mbar]", Strings.Ambient_pressure);
buoyancyHumiLabel.Text = string.Format("{0} [%]", Strings.Ambient_humidity);
airDensityLabel.Text = Strings.Air_density_kg_m3;
@@ -121,7 +130,9 @@ namespace TBF.UI.Bench.Metrology
{
if (BalanceCfg != null)
{
calibCertificateCtrl.Refresh(BalanceCfg);
calibCertificateNrTextBox.Text = BalanceCfg.CalibCertificateNr;
calibDateTimePicker.Value = (BalanceCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibDate;
calibExpirationDateTimePicker.Value = (BalanceCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : BalanceCfg.CalibValidDate;
buoyancyTempTextBox.Text = BalanceCfg.BuoyancyTemp.ToString("F2");
buoyancyPressTextBox.Text = BalanceCfg.BuoyancyPress.ToString("F4");
@@ -152,7 +163,7 @@ namespace TBF.UI.Bench.Metrology
}
else
{
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
}
@@ -205,7 +216,7 @@ namespace TBF.UI.Bench.Metrology
{
correction = Units.IsDefaultUnit(currentUnit) ? difference
: Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement);
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction);
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
}
else
@@ -227,7 +238,7 @@ namespace TBF.UI.Bench.Metrology
/// Update error (if possible)
if (measurement != 0)
{
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction);
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
}
else
@@ -251,7 +262,7 @@ namespace TBF.UI.Bench.Metrology
{
if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0)
{
correction = Formulas.CorrectionFromError(measurement, error);
correction = Config.Formulas.CorrectionFromError(measurement, error);
(item.Tag as MeasurementCorrection).Correction = correction;
difference = Units.IsDefaultUnit(currentUnit)
? correction
@@ -272,7 +283,9 @@ namespace TBF.UI.Bench.Metrology
{
unlocked = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
buoyancyTempTextBox.Enabled = true;
buoyancyPressTextBox.Enabled = true;
@@ -294,7 +307,9 @@ namespace TBF.UI.Bench.Metrology
{
try
{
calibCertificateCtrl.Update(BalanceCfg);
BalanceCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
BalanceCfg.CalibDate = calibDateTimePicker.Value.Date;
BalanceCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date;
BalanceCfg.BuoyancyTemp = Utils.ParseSFloat(buoyancyTempTextBox.Text);
BalanceCfg.BuoyancyPress = Utils.ParseUFloat(buoyancyPressTextBox.Text);
+1 -1
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2019 Senus Slovensko a.s.
///
using System;
using System.Collections.Generic;
+95 -17
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -32,16 +32,23 @@ namespace TBF.UI.Bench.Metrology
private void InitializeComponent()
{
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.calibrationGroupBox = new System.Windows.Forms.GroupBox();
this.calibValidDateLabel = new System.Windows.Forms.Label();
this.calibDateLabel = new System.Windows.Forms.Label();
this.calibCertificateNrTextBox = new System.Windows.Forms.TextBox();
this.calibCertificateNrLabel = new System.Windows.Forms.Label();
this.densityCorrTextBox = new System.Windows.Forms.TextBox();
this.densityCorrLabel = new System.Windows.Forms.Label();
this.temperatureTextBox = new System.Windows.Forms.TextBox();
this.temperatureLabel = new System.Windows.Forms.Label();
this.densityTextBox = new System.Windows.Forms.TextBox();
this.densityLabel = new System.Windows.Forms.Label();
this.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl();
this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
@@ -54,7 +61,7 @@ namespace TBF.UI.Bench.Metrology
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl);
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.densityCorrTextBox);
this.splitContainer1.Panel1.Controls.Add(this.densityCorrLabel);
this.splitContainer1.Panel1.Controls.Add(this.temperatureTextBox);
@@ -62,13 +69,63 @@ 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 = 112;
this.splitContainer1.SplitterDistance = 110;
this.splitContainer1.TabIndex = 1;
//
// calibrationGroupBox
//
this.calibrationGroupBox.Controls.Add(this.calibExpirationDateTimePicker);
this.calibrationGroupBox.Controls.Add(this.calibDateTimePicker);
this.calibrationGroupBox.Controls.Add(this.calibValidDateLabel);
this.calibrationGroupBox.Controls.Add(this.calibDateLabel);
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrTextBox);
this.calibrationGroupBox.Controls.Add(this.calibCertificateNrLabel);
this.calibrationGroupBox.Location = new System.Drawing.Point(323, 16);
this.calibrationGroupBox.Name = "calibrationGroupBox";
this.calibrationGroupBox.Size = new System.Drawing.Size(208, 86);
this.calibrationGroupBox.TabIndex = 7;
this.calibrationGroupBox.TabStop = false;
this.calibrationGroupBox.Text = "Calibration";
//
// calibValidDateLabel
//
this.calibValidDateLabel.AutoSize = true;
this.calibValidDateLabel.Location = new System.Drawing.Point(17, 62);
this.calibValidDateLabel.Name = "calibValidDateLabel";
this.calibValidDateLabel.Size = new System.Drawing.Size(52, 13);
this.calibValidDateLabel.TabIndex = 14;
this.calibValidDateLabel.Text = "Valid until";
//
// calibDateLabel
//
this.calibDateLabel.AutoSize = true;
this.calibDateLabel.Location = new System.Drawing.Point(17, 40);
this.calibDateLabel.Name = "calibDateLabel";
this.calibDateLabel.Size = new System.Drawing.Size(30, 13);
this.calibDateLabel.TabIndex = 12;
this.calibDateLabel.Text = "Date";
//
// calibCertificateNrTextBox
//
this.calibCertificateNrTextBox.Enabled = false;
this.calibCertificateNrTextBox.Location = new System.Drawing.Point(120, 15);
this.calibCertificateNrTextBox.Name = "calibCertificateNrTextBox";
this.calibCertificateNrTextBox.Size = new System.Drawing.Size(82, 20);
this.calibCertificateNrTextBox.TabIndex = 11;
//
// calibCertificateNrLabel
//
this.calibCertificateNrLabel.AutoSize = true;
this.calibCertificateNrLabel.Location = new System.Drawing.Point(17, 18);
this.calibCertificateNrLabel.Name = "calibCertificateNrLabel";
this.calibCertificateNrLabel.Size = new System.Drawing.Size(54, 13);
this.calibCertificateNrLabel.TabIndex = 10;
this.calibCertificateNrLabel.Text = "Certificate";
//
// densityCorrTextBox
//
this.densityCorrTextBox.Enabled = false;
this.densityCorrTextBox.Location = new System.Drawing.Point(178, 81);
this.densityCorrTextBox.Location = new System.Drawing.Point(185, 81);
this.densityCorrTextBox.Name = "densityCorrTextBox";
this.densityCorrTextBox.Size = new System.Drawing.Size(110, 20);
this.densityCorrTextBox.TabIndex = 5;
@@ -76,7 +133,7 @@ namespace TBF.UI.Bench.Metrology
// densityCorrLabel
//
this.densityCorrLabel.AutoSize = true;
this.densityCorrLabel.Location = new System.Drawing.Point(30, 84);
this.densityCorrLabel.Location = new System.Drawing.Point(37, 84);
this.densityCorrLabel.Name = "densityCorrLabel";
this.densityCorrLabel.Size = new System.Drawing.Size(132, 13);
this.densityCorrLabel.TabIndex = 4;
@@ -85,7 +142,7 @@ namespace TBF.UI.Bench.Metrology
// temperatureTextBox
//
this.temperatureTextBox.Enabled = false;
this.temperatureTextBox.Location = new System.Drawing.Point(178, 43);
this.temperatureTextBox.Location = new System.Drawing.Point(185, 43);
this.temperatureTextBox.Name = "temperatureTextBox";
this.temperatureTextBox.Size = new System.Drawing.Size(110, 20);
this.temperatureTextBox.TabIndex = 3;
@@ -94,7 +151,7 @@ namespace TBF.UI.Bench.Metrology
// temperatureLabel
//
this.temperatureLabel.AutoSize = true;
this.temperatureLabel.Location = new System.Drawing.Point(30, 46);
this.temperatureLabel.Location = new System.Drawing.Point(37, 46);
this.temperatureLabel.Name = "temperatureLabel";
this.temperatureLabel.Size = new System.Drawing.Size(112, 13);
this.temperatureLabel.TabIndex = 2;
@@ -103,7 +160,7 @@ namespace TBF.UI.Bench.Metrology
// densityTextBox
//
this.densityTextBox.Enabled = false;
this.densityTextBox.Location = new System.Drawing.Point(178, 17);
this.densityTextBox.Location = new System.Drawing.Point(185, 17);
this.densityTextBox.Name = "densityTextBox";
this.densityTextBox.Size = new System.Drawing.Size(110, 20);
this.densityTextBox.TabIndex = 1;
@@ -112,18 +169,31 @@ namespace TBF.UI.Bench.Metrology
// densityLabel
//
this.densityLabel.AutoSize = true;
this.densityLabel.Location = new System.Drawing.Point(30, 20);
this.densityLabel.Location = new System.Drawing.Point(37, 20);
this.densityLabel.Name = "densityLabel";
this.densityLabel.Size = new System.Drawing.Size(82, 13);
this.densityLabel.TabIndex = 0;
this.densityLabel.Text = "Density [kg/m3]";
//
// calibCertificateCtrl
// calibExpirationDateTimePicker
//
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;
this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibExpirationDateTimePicker.Enabled = false;
this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(120, 59);
this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker";
this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibExpirationDateTimePicker.TabIndex = 19;
//
// calibDateTimePicker
//
this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibDateTimePicker.Enabled = false;
this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibDateTimePicker.Location = new System.Drawing.Point(120, 37);
this.calibDateTimePicker.Name = "calibDateTimePicker";
this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibDateTimePicker.TabIndex = 18;
//
// MetrologyDlgDensityTab
//
@@ -137,6 +207,8 @@ 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);
}
@@ -150,6 +222,12 @@ namespace TBF.UI.Bench.Metrology
private System.Windows.Forms.Label densityLabel;
private System.Windows.Forms.TextBox densityCorrTextBox;
private System.Windows.Forms.Label densityCorrLabel;
private CalibCertificateCtrl calibCertificateCtrl;
}
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;
}
}
@@ -1,12 +1,11 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2019 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;
@@ -33,11 +32,16 @@ namespace TBF.UI.Bench.Metrology
public IList<MeasurementCorrection> ToBeRemoved { get; set; }
MetrologyDlg parent;
bool valuesModified;
bool unlocked;
bool valuesModified;
public MetrologyDlgDensityTab()
{
InitializeComponent();
calibDateTimePicker.CustomFormat = Constants.DateFormat;
calibDateTimePicker.MinDate = Constants.MinDate;
calibExpirationDateTimePicker.CustomFormat = Constants.DateFormat;
calibExpirationDateTimePicker.MinDate = Constants.MinDate;
ToBeRemoved = new List<MeasurementCorrection>();
valuesModified = false;
}
@@ -51,9 +55,9 @@ namespace TBF.UI.Bench.Metrology
Localize();
/// Panel1
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());
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());
/// Panel2
@@ -62,16 +66,22 @@ 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 = Formulas.DensityCorrection(DensityCfg.RealDensity, DensityCfg.AtTemperature).ToString("F5");
calibCertificateCtrl.Refresh(DensityCfg);
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;
}
}
@@ -79,7 +89,9 @@ namespace TBF.UI.Bench.Metrology
{
densityTextBox.Enabled = true;
temperatureTextBox.Enabled = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
}
public void OkBtnClicked()
@@ -94,7 +106,9 @@ namespace TBF.UI.Bench.Metrology
Config.Data.AtTemperature = DensityCfg.AtTemperature = Utils.ParseUDouble(temperatureTextBox.Text);
}
calibCertificateCtrl.Update(DensityCfg);
DensityCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
DensityCfg.CalibDate = calibDateTimePicker.Value.Date;
DensityCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date;
Component modified = DensityCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
@@ -143,7 +157,7 @@ namespace TBF.UI.Bench.Metrology
if (Utils.TryParseUDouble(densityTextBox.Text, out density) &&
Utils.TryParseUDouble(temperatureTextBox.Text, out temp))
{
densityCorrTextBox.Text = Formulas.DensityCorrection(density, temp).ToString();
densityCorrTextBox.Text = Config.Formulas.DensityCorrection(density, temp).ToString();
}
}
+98 -20
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -32,6 +32,11 @@ 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();
@@ -42,11 +47,13 @@ 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();
this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
@@ -61,7 +68,7 @@ namespace TBF.UI.Bench.Metrology
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl);
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
//
@@ -69,9 +76,59 @@ namespace TBF.UI.Bench.Metrology
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(650, 400);
this.splitContainer1.SplitterDistance = 112;
this.splitContainer1.SplitterDistance = 102;
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);
@@ -79,7 +136,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, 99);
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
this.nameGroupBox.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
@@ -115,16 +172,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(428, 10);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 99);
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(87, 54);
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);
@@ -132,7 +189,7 @@ namespace TBF.UI.Bench.Metrology
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(87, 28);
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;
@@ -141,7 +198,7 @@ namespace TBF.UI.Bench.Metrology
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(13, 57);
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;
@@ -150,7 +207,7 @@ namespace TBF.UI.Bench.Metrology
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(13, 31);
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;
@@ -163,21 +220,33 @@ 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, 284);
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);
//
// calibCertificateCtrl
// calibExpirationDateTimePicker
//
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;
this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibExpirationDateTimePicker.Enabled = false;
this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59);
this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker";
this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibExpirationDateTimePicker.TabIndex = 19;
//
// calibDateTimePicker
//
this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibDateTimePicker.Enabled = false;
this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37);
this.calibDateTimePicker.Name = "calibDateTimePicker";
this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibDateTimePicker.TabIndex = 18;
//
// MetrologyDlgDiverterTab
//
@@ -191,6 +260,8 @@ 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);
@@ -210,8 +281,15 @@ 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 CalibCertificateCtrl calibCertificateCtrl;
}
private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker;
private System.Windows.Forms.DateTimePicker calibDateTimePicker;
}
}
@@ -1,13 +1,13 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Common.Forms;
using Config.Entities;
using Common.Forms;
using TBF.Resources;
using TBF.UI.Shared;
@@ -52,6 +52,10 @@ 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<MeasurementCorrection>();
unlocked = false;
}
@@ -93,6 +97,11 @@ 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;
@@ -102,7 +111,9 @@ namespace TBF.UI.Bench.Metrology
{
if (CalibInfoCfg != null)
{
calibCertificateCtrl.Refresh(CalibInfoCfg);
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate;
calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate;
}
listViewEx.Items.Clear();
@@ -198,7 +209,9 @@ namespace TBF.UI.Bench.Metrology
{
unlocked = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
@@ -215,7 +228,10 @@ namespace TBF.UI.Bench.Metrology
{
try
{
calibCertificateCtrl.Update(CalibInfoCfg);
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date;
CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date;
Component modified = CalibInfoCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
@@ -316,7 +332,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();
}
}
+98 -20
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -32,6 +32,11 @@ 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();
@@ -42,11 +47,13 @@ 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();
this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
@@ -61,7 +68,7 @@ namespace TBF.UI.Bench.Metrology
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl);
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
//
@@ -69,9 +76,59 @@ namespace TBF.UI.Bench.Metrology
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(650, 400);
this.splitContainer1.SplitterDistance = 112;
this.splitContainer1.SplitterDistance = 102;
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);
@@ -79,7 +136,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, 99);
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
this.nameGroupBox.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
@@ -115,16 +172,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(429, 10);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 99);
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, 50);
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);
@@ -132,7 +189,7 @@ namespace TBF.UI.Bench.Metrology
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(91, 25);
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;
@@ -141,7 +198,7 @@ namespace TBF.UI.Bench.Metrology
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(17, 53);
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;
@@ -150,7 +207,7 @@ namespace TBF.UI.Bench.Metrology
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(17, 28);
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;
@@ -163,21 +220,33 @@ 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, 284);
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);
//
// calibCertificateCtrl
// calibExpirationDateTimePicker
//
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;
this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibExpirationDateTimePicker.Enabled = false;
this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59);
this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker";
this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibExpirationDateTimePicker.TabIndex = 19;
//
// calibDateTimePicker
//
this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibDateTimePicker.Enabled = false;
this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37);
this.calibDateTimePicker.Name = "calibDateTimePicker";
this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibDateTimePicker.TabIndex = 18;
//
// MetrologyDlgEvaporationTab
//
@@ -191,6 +260,8 @@ 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);
@@ -210,8 +281,15 @@ 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 CalibCertificateCtrl calibCertificateCtrl;
}
private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker;
private System.Windows.Forms.DateTimePicker calibDateTimePicker;
}
}
@@ -1,13 +1,13 @@
///
/// Copyright (c) 2019-2023 Sensus Slovensko a.s.
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Common.Forms;
using Config.Entities;
using Common.Forms;
using TBF.Resources;
using TBF.UI.Shared;
@@ -52,6 +52,10 @@ 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<MeasurementCorrection>();
unlocked = false;
}
@@ -93,6 +97,11 @@ 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;
@@ -100,7 +109,12 @@ namespace TBF.UI.Bench.Metrology
void RefreshAll()
{
if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg);
if (CalibInfoCfg != null)
{
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate;
calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate;
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections)
@@ -195,7 +209,9 @@ namespace TBF.UI.Bench.Metrology
{
unlocked = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
@@ -212,7 +228,10 @@ namespace TBF.UI.Bench.Metrology
{
try
{
calibCertificateCtrl.Update(CalibInfoCfg);
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date;
CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date;
Component modified = CalibInfoCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
+95 -17
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -32,9 +32,15 @@ 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();
@@ -49,6 +55,7 @@ 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();
@@ -63,9 +70,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);
//
@@ -73,16 +80,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 = 112;
this.splitContainer1.SplitterDistance = 102;
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,6 +101,76 @@ 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);
@@ -144,9 +214,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(428, 10);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 99);
this.testGroupBox.Size = new System.Drawing.Size(170, 88);
this.testGroupBox.TabIndex = 4;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Correction test";
@@ -192,10 +262,9 @@ 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, 284);
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;
@@ -214,6 +283,8 @@ 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);
@@ -233,10 +304,17 @@ 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;
}
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
/// Copyright (c) 2013-2022 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@@ -8,7 +8,6 @@ using System.Windows.Forms;
using log4net;
using Common;
using Common.Forms;
using Config;
using Config.Entities;
using TBF.Resources;
using TBF.UI.Shared;
@@ -62,6 +61,10 @@ 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<MeasurementCorrection>();
@@ -124,6 +127,11 @@ 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;
}
@@ -131,7 +139,9 @@ namespace TBF.UI.Bench.Metrology
{
if (CalibInfoCfg != null)
{
calibCertificateCtrl.Refresh(CalibInfoCfg, rangeIx1);
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);
}
listViewEx.Items.Clear();
@@ -159,7 +169,7 @@ namespace TBF.UI.Bench.Metrology
}
else
{
double error = Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
double error = Config.Formulas.ErrorFromVolumes(corr.Measurement, trueValue);
lvi.SubItems.Add(Common.Utils.ToNiceString(error, SignifDigits));
}
@@ -212,7 +222,7 @@ namespace TBF.UI.Bench.Metrology
{
correction = Units.IsDefaultUnit(currentUnit) ? difference
: Units.ConvertFrom(currentUnit, oriMeasurement + difference) - Units.ConvertFrom(currentUnit, oriMeasurement);
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction);
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
}
else
@@ -234,7 +244,7 @@ namespace TBF.UI.Bench.Metrology
/// Update error (if possible)
if (measurement != 0)
{
error = Formulas.ErrorFromVolumes(measurement, measurement + correction);
error = Config.Formulas.ErrorFromVolumes(measurement, measurement + correction);
item.SubItems[3].Text = Common.Utils.ToNiceString(error, SignifDigits);
}
else
@@ -258,7 +268,7 @@ namespace TBF.UI.Bench.Metrology
{
if (Utils.TryParseEDouble(item.SubItems[1].Text, out oriMeasurement) && (measurement = Units.ConvertFrom(currentUnit, oriMeasurement)) != 0)
{
correction = Formulas.CorrectionFromError(measurement, error);
correction = Config.Formulas.CorrectionFromError(measurement, error);
(item.Tag as MeasurementCorrection).Correction = correction;
difference = Units.IsDefaultUnit(currentUnit)
? correction
@@ -279,7 +289,9 @@ namespace TBF.UI.Bench.Metrology
{
unlocked = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
@@ -296,7 +308,9 @@ namespace TBF.UI.Bench.Metrology
{
try
{
calibCertificateCtrl.Update(CalibInfoCfg, rangeIx);
CalibInfoCfg.SetCalibCertificate(rangeIx, calibCertificateNrTextBox.Text);
CalibInfoCfg.SetCalibDate(rangeIx, calibDateTimePicker.Value.Date);
CalibInfoCfg.SetCalibValidDate(rangeIx, calibExpirationDateTimePicker.Value.Date);
}
catch
{
+98 -20
View File
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2018-2023 Senus Slovensko a.s.
/// Copyright (c) 2018 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -32,6 +32,11 @@ 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();
@@ -42,11 +47,13 @@ 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();
this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.SuspendLayout();
@@ -61,7 +68,7 @@ namespace TBF.UI.Bench.Metrology
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.calibCertificateCtrl);
this.splitContainer1.Panel1.Controls.Add(this.calibrationGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.nameGroupBox);
this.splitContainer1.Panel1.Controls.Add(this.testGroupBox);
//
@@ -69,9 +76,59 @@ namespace TBF.UI.Bench.Metrology
//
this.splitContainer1.Panel2.Controls.Add(this.listViewEx);
this.splitContainer1.Size = new System.Drawing.Size(650, 400);
this.splitContainer1.SplitterDistance = 112;
this.splitContainer1.SplitterDistance = 102;
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);
@@ -79,7 +136,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, 99);
this.nameGroupBox.Size = new System.Drawing.Size(160, 86);
this.nameGroupBox.TabIndex = 5;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
@@ -115,16 +172,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(428, 10);
this.testGroupBox.Location = new System.Drawing.Point(424, 10);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(170, 99);
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(88, 43);
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);
@@ -132,7 +189,7 @@ namespace TBF.UI.Bench.Metrology
//
// measuredTextBox
//
this.measuredTextBox.Location = new System.Drawing.Point(88, 18);
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;
@@ -141,7 +198,7 @@ namespace TBF.UI.Bench.Metrology
// correctedLabel
//
this.correctedLabel.AutoSize = true;
this.correctedLabel.Location = new System.Drawing.Point(14, 46);
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;
@@ -150,7 +207,7 @@ namespace TBF.UI.Bench.Metrology
// measuredLabel
//
this.measuredLabel.AutoSize = true;
this.measuredLabel.Location = new System.Drawing.Point(14, 21);
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;
@@ -163,21 +220,33 @@ 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, 284);
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);
//
// calibCertificateCtrl
// calibExpirationDateTimePicker
//
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;
this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibExpirationDateTimePicker.Enabled = false;
this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(140, 59);
this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker";
this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibExpirationDateTimePicker.TabIndex = 19;
//
// calibDateTimePicker
//
this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibDateTimePicker.Enabled = false;
this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibDateTimePicker.Location = new System.Drawing.Point(140, 37);
this.calibDateTimePicker.Name = "calibDateTimePicker";
this.calibDateTimePicker.Size = new System.Drawing.Size(82, 20);
this.calibDateTimePicker.TabIndex = 18;
//
// MetrologyDlgLevelMeterTab
//
@@ -191,6 +260,8 @@ 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);
@@ -210,8 +281,15 @@ 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 CalibCertificateCtrl calibCertificateCtrl;
}
private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker;
private System.Windows.Forms.DateTimePicker calibDateTimePicker;
}
}
@@ -1,13 +1,13 @@
///
/// Copyright (c) 2018-2023 Sensus Slovensko a.s.
/// Copyright (c) 2018 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
using log4net;
using Common.Forms;
using Config.Entities;
using Common.Forms;
using TBF.Resources;
using TBF.UI.Shared;
@@ -52,6 +52,10 @@ 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<MeasurementCorrection>();
unlocked = false;
}
@@ -93,6 +97,11 @@ 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;
@@ -100,7 +109,12 @@ namespace TBF.UI.Bench.Metrology
void RefreshAll()
{
if (CalibInfoCfg != null) calibCertificateCtrl.Refresh(CalibInfoCfg);
if (CalibInfoCfg != null)
{
calibCertificateNrTextBox.Text = CalibInfoCfg.CalibCertificateNr;
calibDateTimePicker.Value = (CalibInfoCfg.CalibDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibDate;
calibExpirationDateTimePicker.Value = (CalibInfoCfg.CalibValidDate < Constants.MinDate) ? Constants.MinDate : CalibInfoCfg.CalibValidDate;
}
listViewEx.Items.Clear();
foreach (var corr in MeterEntity.Corrections)
@@ -195,7 +209,9 @@ namespace TBF.UI.Bench.Metrology
{
unlocked = true;
calibCertificateCtrl.Unlock();
calibCertificateNrTextBox.Enabled = true;
calibDateTimePicker.Enabled = true;
calibExpirationDateTimePicker.Enabled = true;
if (listViewEx.SelectedItems.Count == 1)
{
@@ -212,7 +228,10 @@ namespace TBF.UI.Bench.Metrology
{
try
{
calibCertificateCtrl.Update(CalibInfoCfg);
CalibInfoCfg.CalibCertificateNr = calibCertificateNrTextBox.Text;
CalibInfoCfg.CalibDate = calibDateTimePicker.Value.Date;
CalibInfoCfg.CalibValidDate = calibExpirationDateTimePicker.Value.Date;
Component modified = CalibInfoCfg.CreateDbEntity();
MeterEntity.Parameters = modified.Parameters;
}
@@ -313,7 +332,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();
}
}
@@ -1,5 +1,5 @@
///
/// Copyright (c) 2013-2023 Senus Slovensko a.s.
/// Copyright (c) 2013-2015 Senus Slovensko a.s.
///
namespace TBF.UI.Bench.Metrology
{
@@ -40,6 +40,11 @@ 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();
@@ -57,11 +62,13 @@ 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.calibCertificateCtrl = new TBF.UI.Bench.Metrology.CalibCertificateCtrl();
this.calibDateTimePicker = new System.Windows.Forms.DateTimePicker();
this.calibExpirationDateTimePicker = new System.Windows.Forms.DateTimePicker();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.testGroupBox.SuspendLayout();
this.calibrationGroupBox.SuspendLayout();
this.its90CalibrationCoefficientsGroupBox.SuspendLayout();
this.nameGroupBox.SuspendLayout();
this.its27CalibrationCoefficientsGroupBox.SuspendLayout();
@@ -86,21 +93,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(700, 400);
this.splitContainer1.SplitterDistance = 250;
this.splitContainer1.Size = new System.Drawing.Size(668, 400);
this.splitContainer1.SplitterDistance = 300;
this.splitContainer1.TabIndex = 1;
//
// radioButton2
//
this.radioButton2.AutoSize = true;
this.radioButton2.Location = new System.Drawing.Point(498, 14);
this.radioButton2.Location = new System.Drawing.Point(462, 24);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(187, 17);
this.radioButton2.TabIndex = 11;
@@ -111,7 +118,7 @@ namespace TBF.UI.Bench.Metrology
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(271, 14);
this.radioButton1.Location = new System.Drawing.Point(235, 24);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(187, 17);
this.radioButton1.TabIndex = 10;
@@ -125,9 +132,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, 164);
this.testGroupBox.Location = new System.Drawing.Point(16, 155);
this.testGroupBox.Name = "testGroupBox";
this.testGroupBox.Size = new System.Drawing.Size(240, 77);
this.testGroupBox.Size = new System.Drawing.Size(208, 77);
this.testGroupBox.TabIndex = 9;
this.testGroupBox.TabStop = false;
this.testGroupBox.Text = "Test";
@@ -166,6 +173,56 @@ 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);
@@ -176,7 +233,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(266, 40);
this.its90CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(230, 54);
this.its90CalibrationCoefficientsGroupBox.Name = "its90CalibrationCoefficientsGroupBox";
this.its90CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(220, 140);
this.its90CalibrationCoefficientsGroupBox.TabIndex = 5;
@@ -256,7 +313,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(240, 40);
this.nameGroupBox.Size = new System.Drawing.Size(208, 40);
this.nameGroupBox.TabIndex = 4;
this.nameGroupBox.TabStop = false;
this.nameGroupBox.Text = "Component";
@@ -269,7 +326,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(495, 40);
this.its27CalibrationCoefficientsGroupBox.Location = new System.Drawing.Point(459, 54);
this.its27CalibrationCoefficientsGroupBox.Name = "its27CalibrationCoefficientsGroupBox";
this.its27CalibrationCoefficientsGroupBox.Size = new System.Drawing.Size(190, 140);
this.its27CalibrationCoefficientsGroupBox.TabIndex = 3;
@@ -327,12 +384,25 @@ namespace TBF.UI.Bench.Metrology
this.label3.TabIndex = 8;
this.label3.Text = "R0";
//
// calibCertificateCtrl
// calibDateTimePicker
//
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;
this.calibDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibDateTimePicker.Enabled = false;
this.calibDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibDateTimePicker.Location = new System.Drawing.Point(105, 40);
this.calibDateTimePicker.Name = "calibDateTimePicker";
this.calibDateTimePicker.Size = new System.Drawing.Size(95, 20);
this.calibDateTimePicker.TabIndex = 17;
//
// calibExpirationDateTimePicker
//
this.calibExpirationDateTimePicker.CustomFormat = "dd.MM.yyyy";
this.calibExpirationDateTimePicker.Enabled = false;
this.calibExpirationDateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.calibExpirationDateTimePicker.Location = new System.Drawing.Point(105, 64);
this.calibExpirationDateTimePicker.Name = "calibExpirationDateTimePicker";
this.calibExpirationDateTimePicker.Size = new System.Drawing.Size(95, 20);
this.calibExpirationDateTimePicker.TabIndex = 18;
//
// MetrologyDlgPlatinumResistanceTMeterTab
//
@@ -340,7 +410,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(700, 400);
this.Size = new System.Drawing.Size(668, 400);
this.Load += new System.EventHandler(this.MetrologyDlgBalanceTab_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
@@ -348,6 +418,8 @@ 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);
@@ -377,6 +449,11 @@ 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;
@@ -386,6 +463,7 @@ namespace TBF.UI.Bench.Metrology
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.RadioButton radioButton1;
private CalibCertificateCtrl calibCertificateCtrl;
}
private System.Windows.Forms.DateTimePicker calibDateTimePicker;
private System.Windows.Forms.DateTimePicker calibExpirationDateTimePicker;
}
}

Some files were not shown because too many files have changed in this diff Show More