diff --git a/TBF/Properties/AssemblyInfo.cs b/TBF/Properties/AssemblyInfo.cs
index 7dc263bbb..9b8b89f82 100644
--- a/TBF/Properties/AssemblyInfo.cs
+++ b/TBF/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
-[assembly: AssemblyVersion("2.33.2102.0")]
-[assembly: AssemblyFileVersion("2.33.2102.0")]
+[assembly: AssemblyVersion("2.33.2104.0")]
+[assembly: AssemblyFileVersion("2.33.2104.0")]
diff --git a/TBF/Resources/Strings.Designer.cs b/TBF/Resources/Strings.Designer.cs
index e61570105..a21be3f94 100644
--- a/TBF/Resources/Strings.Designer.cs
+++ b/TBF/Resources/Strings.Designer.cs
@@ -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", "4.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
@@ -2274,6 +2274,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Get number of cycles to bypass.
+ ///
+ internal static string Get_number_of_cycles_to_bypass {
+ get {
+ return ResourceManager.GetString("Get_number_of_cycles_to_bypass", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Grab.
///
@@ -5091,6 +5100,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Set number of cycles to bypass.
+ ///
+ internal static string Set_number_of_cycles_to_bypass {
+ get {
+ return ResourceManager.GetString("Set_number_of_cycles_to_bypass", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Set route.
///
@@ -5424,15 +5442,6 @@ namespace TBF.Resources {
}
}
- ///
- /// Looks up a localized string similar to .
- ///
- internal static string String1 {
- get {
- return ResourceManager.GetString("String1", resourceCulture);
- }
- }
-
///
/// Looks up a localized string similar to Sun.
///
@@ -6273,6 +6282,15 @@ namespace TBF.Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Unlock a bypass.
+ ///
+ internal static string Unlock_bypass {
+ get {
+ return ResourceManager.GetString("Unlock_bypass", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Unlock.
///
diff --git a/TBF/Resources/Strings.cs.resx b/TBF/Resources/Strings.cs.resx
index 71940a2a9..2e96676d4 100644
--- a/TBF/Resources/Strings.cs.resx
+++ b/TBF/Resources/Strings.cs.resx
@@ -1683,4 +1683,13 @@
předvolená tiskárna
+
+ Zjisti počet cyklů bez kontroly
+
+
+ Nastav počet cyklů bez kontroly
+
+
+ Odemknout vypnutí kontroly
+
\ No newline at end of file
diff --git a/TBF/Resources/Strings.resx b/TBF/Resources/Strings.resx
index c4270af68..c1beccb10 100644
--- a/TBF/Resources/Strings.resx
+++ b/TBF/Resources/Strings.resx
@@ -2314,4 +2314,16 @@
default printer
+
+ Get number of cycles to bypass
+
+
+ Set number of cycles to bypass
+
+
+ Unlock a bypass
+
+
+ Error reading configuration database
+
\ No newline at end of file
diff --git a/TBF/Rig/DataChangeArgs.cs b/TBF/Rig/DataChangeArgs.cs
new file mode 100644
index 000000000..25638cf96
--- /dev/null
+++ b/TBF/Rig/DataChangeArgs.cs
@@ -0,0 +1,19 @@
+///
+/// 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;
+ }
+ }
+}
diff --git a/TBF/Rig/Events.cs b/TBF/Rig/Events.cs
index 04b32f428..a0a8b33ec 100644
--- a/TBF/Rig/Events.cs
+++ b/TBF/Rig/Events.cs
@@ -1,5 +1,5 @@
///
-/// Copyright (c) 2013-2020 Sensus Slovensko a.s.
+/// Copyright (c) 2013-2023 Sensus Slovensko a.s.
///
namespace TBF.Rig
{
@@ -31,6 +31,8 @@ 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
diff --git a/TBF/Rig/Output/DB/ProductionTracing/Tracing.cs b/TBF/Rig/Output/DB/ProductionTracing/Tracing.cs
index 4d57bcc6c..b5f35f7ab 100644
--- a/TBF/Rig/Output/DB/ProductionTracing/Tracing.cs
+++ b/TBF/Rig/Output/DB/ProductionTracing/Tracing.cs
@@ -3,7 +3,6 @@
///
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Net;
using log4net;
using FluentNHibernate.Cfg;
@@ -11,9 +10,7 @@ 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
{
@@ -91,7 +88,9 @@ namespace TBF.Rig.Output.DB.ProductionTracing
Workstep verifiedWorkstep;
Part verifiedPart; /// Applicable when verifyReferencePart == false
bool verifyReferencePart;
-
+
+ int CyclesToSkip;
+
public Tracing() {}
@@ -137,6 +136,9 @@ namespace TBF.Rig.Output.DB.ProductionTracing
session.Close();
TracingDB.DB.SessionFactory = sessionFactory;
+
+ CyclesToSkip = 0;
+
log.FatalFormat("{0} initialized: {1}", Name, this);
}
else
@@ -145,6 +147,35 @@ 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 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
///
@@ -242,7 +273,16 @@ namespace TBF.Rig.Output.DB.ProductionTracing
{
log.WarnFormat("{0} : Run() : currentOp = {1}", Name, currentOpState);
opCompleted = true;
- if (CheckPreviousRecords(waterMeters) != Retv.OK) anyError = true;
+
+ if (CyclesToSkip > 0)
+ {
+ CyclesToSkip--;
+ }
+ else if (CheckPreviousRecords(waterMeters) != Retv.OK)
+ {
+ anyError = true;
+ }
+
return anyError ? Event.InfoNotRead : Event.InfoRead;
}
else
diff --git a/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.cs b/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.cs
index c7cb474c0..f2b614858 100644
--- a/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.cs
+++ b/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.cs
@@ -2,18 +2,23 @@
/// 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
{
- public bool ShowMore { get { return false; } }
+ static readonly ILog log = LogManager.GetLogger(typeof(TracingCfgCtrl));
+
+ public bool ShowMore { get { return false; } }
MonitoringCfg config;
public IComponentCfg Config
@@ -34,14 +39,24 @@ 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 Redraw()
+ 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()
{
if (config == null) return; /// Control was not loaded, settings were not changed
@@ -106,9 +121,27 @@ namespace TBF.Rig.Output.DB.ProductionTracing
netAdapterComboBox.Enabled = true;
checkPreviousRecordsCheckBox.Enabled = true;
saveTracingRecordsCheckBox.Enabled = true;
+
+ cyclesToBypassTextBox.Enabled = true;
+ setCyclesToBypassButton.Enabled = true;
+ unlockBypassButton.Enabled = false;
}
- public CfgUpdateFlags VerifyCfg(ref string message)
+ 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)
{
return CfgUpdateFlags.None;
}
@@ -141,5 +174,54 @@ 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 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
+ }
}
diff --git a/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.designer.cs b/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.designer.cs
index 1d0ace09e..db60c52ab 100644
--- a/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.designer.cs
+++ b/TBF/Rig/Output/DB/ProductionTracing/TracingCfgCtrl.designer.cs
@@ -40,6 +40,15 @@ 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
@@ -125,10 +134,90 @@ 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);
@@ -139,8 +228,10 @@ 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, 250);
+ this.Size = new System.Drawing.Size(450, 350);
this.Load += new System.EventHandler(this.WriterCfgCtrl_Load);
+ this.bypassGroupBox.ResumeLayout(false);
+ this.bypassGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -157,5 +248,13 @@ 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;
+ }
}
diff --git a/TBF/TBF.csproj b/TBF/TBF.csproj
index a9969864f..f8d470128 100644
--- a/TBF/TBF.csproj
+++ b/TBF/TBF.csproj
@@ -187,6 +187,7 @@
ComponentCfgCtrl.cs
+