DataEntry.S620 supports production tracing, S/Ns from OraDB + disp., flash and beep, ver. 2.26.1592
This commit is contained in:
parent
2e75d91adc
commit
3bf8b4fe54
37
Common/BackgroundBeep.cs
Normal file
37
Common/BackgroundBeep.cs
Normal file
@ -0,0 +1,37 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace Common
|
||||
{
|
||||
public class BackgroundBeep
|
||||
{
|
||||
static Thread beepThread;
|
||||
static AutoResetEvent signalBeep;
|
||||
|
||||
static BackgroundBeep()
|
||||
{
|
||||
signalBeep = new AutoResetEvent(false);
|
||||
beepThread = new Thread(() =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
signalBeep.WaitOne(); /// waits for an event
|
||||
Console.Beep(500, 400); /// frequency (Hz), duration (ms)
|
||||
}
|
||||
}, 1);
|
||||
beepThread.IsBackground = true;
|
||||
beepThread.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes one beep in a separate thread (non-blocking function)
|
||||
/// </summary>
|
||||
public static void Beep()
|
||||
{
|
||||
signalBeep.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,6 +41,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BackgroundBeep.cs" />
|
||||
<Compile Include="SerializableDictionary.cs" />
|
||||
<Compile Include="UIControls\CoolButtonCtrl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
|
||||
@ -131,25 +131,6 @@ namespace TBF.BenchControl.DataEntry.S620.CheckItems
|
||||
break;
|
||||
|
||||
case CodeType.DateMMYY:
|
||||
if (part.LifetimeManagement == LifetimeManagement.OneYear)
|
||||
{
|
||||
int mmyy;
|
||||
if (!int.TryParse(scannedCodeTextBox.Text, out mmyy))
|
||||
{
|
||||
error = PartError.WrongPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
int batteryMonthsSince2000 = 12 * (mmyy % 100) + (mmyy / 100);
|
||||
int monthsSince2000 = 12 * (DateTime.Now.Year - 2000) + DateTime.Now.Month;
|
||||
int age = monthsSince2000 - batteryMonthsSince2000;
|
||||
|
||||
if (age < 0 || age > 12 + parent.ExtraBatteryLifetime)
|
||||
{
|
||||
error = PartError.WrongPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,8 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
public bool UsesCameras() { return false; }
|
||||
|
||||
readonly EntryFormCfg entryFormCfg;
|
||||
readonly TBF.BenchControl.Output.DB.ProductionTracing.Tracing tracing;
|
||||
|
||||
IRegReader[] regReaders;
|
||||
|
||||
/// <summary>
|
||||
@ -64,11 +66,14 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
}
|
||||
|
||||
public EntryForm(Generic.IComponentCfg cfg)
|
||||
public EntryForm(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
entryFormCfg = cfg as EntryFormCfg;
|
||||
|
||||
tracing = (TBF.BenchControl.Output.DB.ProductionTracing.Tracing)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (tracing == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
|
||||
disabled = new bool[Config.Data.WMsCount];
|
||||
wmStartState = new double[Config.Data.WMsCount];
|
||||
wmStartStateStr = new string[Config.Data.WMsCount];
|
||||
@ -120,15 +125,29 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
|
||||
delegate void EntryFormDlgt(EntryForm myRef);
|
||||
///
|
||||
void OpenMechanicalMetersDlg(EntryForm myRef)
|
||||
void OnCycleStart(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMeters(waterMeters, entryFormCfg.SkipFailedMeters);
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMeters(waterMeters);
|
||||
}
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
void OpenMechanicalMetersWithTracingDlg(EntryForm myRef)
|
||||
void OnCycleEnd(EntryForm myRef)
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.SkipFailedMeters);
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMeters(waterMeters);
|
||||
}
|
||||
modelessDlg.Show();
|
||||
}
|
||||
///
|
||||
@ -152,17 +171,11 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
default:
|
||||
case CurrentOp.ShowFormAtCycleBeginning:
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OnCycleStart), this);
|
||||
return;
|
||||
|
||||
case CurrentOp.ShowFormAtCycleEnd:
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenMechanicalMetersWithTracingDlg), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OpenMechanicalMetersDlg), this);
|
||||
}
|
||||
Program.MainWnd.Invoke(new EntryFormDlgt(OnCycleEnd), this);
|
||||
break;
|
||||
|
||||
case CurrentOp.EnterTestStartStates:
|
||||
@ -186,11 +199,24 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
|
||||
if (!resultSaved) /// This is to save the result only once
|
||||
{
|
||||
if (currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
if (currentOp == CurrentOp.ShowFormAtCycleBeginning)
|
||||
{
|
||||
if (!entryFormCfg.ProductionTracing)
|
||||
ICycleBeginOrEndForm dlg = (modelessDlg as ICycleBeginOrEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
FormForMechanicalMeters dlg = (modelessDlg as FormForMechanicalMeters);
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.BodyNrText[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (currentOp == CurrentOp.ShowFormAtCycleEnd)
|
||||
{
|
||||
ICycleBeginOrEndForm dlg = (modelessDlg as ICycleBeginOrEndForm);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
@ -210,29 +236,6 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FormForMechanicalMetersWithTracing dlg = (modelessDlg as FormForMechanicalMetersWithTracing);
|
||||
if (dlg != null)
|
||||
{
|
||||
for (int i = 0; i < waterMeters.Count; i++)
|
||||
{
|
||||
if (waterMeters[i] != null)
|
||||
{
|
||||
waterMeters[i].Disabled = disabled[i] = dlg.Disabled[i];
|
||||
waterMeters[i].SerialNr = dlg.BodyNrText[i];
|
||||
#if ORACLE_DB
|
||||
waterMeters[i].AssignedSerialNr = dlg.AssignedSerialNr[i];
|
||||
waterMeters[i].Prefix = dlg.Prefix;
|
||||
waterMeters[i].Suffix = dlg.Suffix;
|
||||
waterMeters[i].CompleteSerialNr = dlg.CompleteSerialNr[i];
|
||||
#endif
|
||||
if (dlg.PurchaseOrder != null) waterMeters[i].PurchaseOrder = dlg.PurchaseOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((modelessDlg is TestStartEndForm) && (currentOp == CurrentOp.EnterTestStartStates))
|
||||
{
|
||||
/// Fixed start test - start
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -9,7 +9,7 @@ using TBF.BenchControl.Generic;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||
public class EntryFormCfg : ComponentCfgBase, Generic.IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(EntryFormCfg) })[0];
|
||||
public override XmlSerializer GetSerializer() { return Serializer; }
|
||||
@ -19,7 +19,8 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
///
|
||||
/// Serialized parameters
|
||||
///
|
||||
public bool SkipFailedMeters;
|
||||
public int MaxWMsCount;
|
||||
public char CloseButton;
|
||||
public bool ProductionTracing;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
@ -29,15 +30,21 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
: this()
|
||||
{
|
||||
Name = name;
|
||||
ParentName = "ProductionMonitoring";
|
||||
Factory = factory;
|
||||
ParentName = string.Empty;
|
||||
SkipFailedMeters = false;
|
||||
ProductionTracing = false;
|
||||
MaxWMsCount = 20;
|
||||
CloseButton = '+';
|
||||
ProductionTracing = true;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, SkipFailedMeters={1}, ProductionTracing={2}", Name, SkipFailedMeters, ProductionTracing);
|
||||
return string.Format("Name={0}, MaxWMsCount={1}, CloseButton={2}, ProductionTracing={3}, Parent={4}",
|
||||
Name,
|
||||
MaxWMsCount,
|
||||
(CloseButton == '+') ? "+" : (CloseButton == '\t') ? "Tab" : "none",
|
||||
ProductionTracing,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
public partial class EntryFormCfgCtrl : UserControl, IComponentCfgCtrl
|
||||
{
|
||||
ComponentParametersDlg parent;
|
||||
|
||||
public bool ShowMore { get { return false; } }
|
||||
|
||||
EntryFormCfg config;
|
||||
@ -32,12 +34,30 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
||||
{
|
||||
Localize();
|
||||
|
||||
parent = ParentForm as ComponentParametersDlg;
|
||||
if (parent == null) return;
|
||||
|
||||
if (parent.TbfComponents != null)
|
||||
{
|
||||
foreach (var cmpnt in parent.TbfComponents)
|
||||
{
|
||||
if (TbfComponents.CmpntFactoryFromClassName(cmpnt.ClassName) is Output.DB.ProductionTracing.Factory)
|
||||
{
|
||||
parentNameComboBox.Items.Add(cmpnt.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closeButtonComboBox.Items.Add("<none>");
|
||||
closeButtonComboBox.Items.Add("Tab");
|
||||
closeButtonComboBox.Items.Add("+");
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
void Localize()
|
||||
{
|
||||
skipFailedMetersCheckBox.Text = "Preskočiť zlé vodomery pri skenovaní";
|
||||
productionTracingCheckBox.Text = "Sledovanie výroby";
|
||||
}
|
||||
|
||||
@ -50,20 +70,40 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||
classNameLabel.Text = config.Factory.ClassName;
|
||||
nameTextBox.Text = config.Name;
|
||||
skipFailedMetersCheckBox.Checked = config.SkipFailedMeters;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
maxWMsCountTextBox.Text = config.MaxWMsCount.ToString();
|
||||
closeButtonComboBox.Text = (config.CloseButton == '+') ? "+" : (config.CloseButton == '\t') ? "Tab" : "<none>";
|
||||
productionTracingCheckBox.Checked = config.ProductionTracing;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
{
|
||||
nameTextBox.Enabled = true;
|
||||
skipFailedMetersCheckBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
maxWMsCountTextBox.Enabled = true;
|
||||
closeButtonComboBox.Enabled = true;
|
||||
productionTracingCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
{
|
||||
int dummy;
|
||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||
if (!parentNameComboBox.Items.Contains(parentNameComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Parent Name'";
|
||||
}
|
||||
if (!int.TryParse(maxWMsCountTextBox.Text, out dummy) || dummy <= 0 || dummy > 40)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Max. water meters count'";
|
||||
}
|
||||
if (!closeButtonComboBox.Items.Contains(closeButtonComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + "Invalid 'Close button'";
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -74,7 +114,9 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||
|
||||
config.Name = nameTextBox.Text;
|
||||
config.SkipFailedMeters = skipFailedMetersCheckBox.Checked;
|
||||
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
config.MaxWMsCount = int.Parse(maxWMsCountTextBox.Text);
|
||||
config.CloseButton = (closeButtonComboBox.Text == "+") ? '+' : (closeButtonComboBox.Text == "Tab") ? '\t' : '\0';
|
||||
config.ProductionTracing = productionTracingCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
|
||||
@ -34,14 +34,19 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.skipFailedMetersCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.productionTracingCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.parentNameLabel = new System.Windows.Forms.Label();
|
||||
this.closeButtonComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.closeButtonLabel = new System.Windows.Forms.Label();
|
||||
this.maxWMsCountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.maxWMsCountLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(93, 57);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(155, 58);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@ -49,7 +54,7 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(35, 60);
|
||||
this.nameLabel.Location = new System.Drawing.Point(18, 61);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
@ -58,45 +63,92 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(90, 33);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(152, 33);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
this.classNameLabel.Text = "ComonentName";
|
||||
//
|
||||
// skipFailedMetersCheckBox
|
||||
//
|
||||
this.skipFailedMetersCheckBox.AutoSize = true;
|
||||
this.skipFailedMetersCheckBox.Enabled = false;
|
||||
this.skipFailedMetersCheckBox.Location = new System.Drawing.Point(93, 89);
|
||||
this.skipFailedMetersCheckBox.Name = "skipFailedMetersCheckBox";
|
||||
this.skipFailedMetersCheckBox.Size = new System.Drawing.Size(182, 17);
|
||||
this.skipFailedMetersCheckBox.TabIndex = 3;
|
||||
this.skipFailedMetersCheckBox.Text = "Skip failed meters while scanning";
|
||||
this.skipFailedMetersCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// productionTracingCheckBox
|
||||
//
|
||||
this.productionTracingCheckBox.AutoSize = true;
|
||||
this.productionTracingCheckBox.Enabled = false;
|
||||
this.productionTracingCheckBox.Location = new System.Drawing.Point(93, 112);
|
||||
this.productionTracingCheckBox.Location = new System.Drawing.Point(155, 169);
|
||||
this.productionTracingCheckBox.Name = "productionTracingCheckBox";
|
||||
this.productionTracingCheckBox.Size = new System.Drawing.Size(112, 17);
|
||||
this.productionTracingCheckBox.TabIndex = 5;
|
||||
this.productionTracingCheckBox.TabIndex = 9;
|
||||
this.productionTracingCheckBox.Text = "Production tracing";
|
||||
this.productionTracingCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// parentNameComboBox
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(155, 84);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
//
|
||||
// parentNameLabel
|
||||
//
|
||||
this.parentNameLabel.AutoSize = true;
|
||||
this.parentNameLabel.Location = new System.Drawing.Point(18, 87);
|
||||
this.parentNameLabel.Name = "parentNameLabel";
|
||||
this.parentNameLabel.Size = new System.Drawing.Size(67, 13);
|
||||
this.parentNameLabel.TabIndex = 3;
|
||||
this.parentNameLabel.Text = "Parent name";
|
||||
//
|
||||
// closeButtonComboBox
|
||||
//
|
||||
this.closeButtonComboBox.Enabled = false;
|
||||
this.closeButtonComboBox.FormattingEnabled = true;
|
||||
this.closeButtonComboBox.Location = new System.Drawing.Point(155, 137);
|
||||
this.closeButtonComboBox.Name = "closeButtonComboBox";
|
||||
this.closeButtonComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.closeButtonComboBox.TabIndex = 8;
|
||||
//
|
||||
// closeButtonLabel
|
||||
//
|
||||
this.closeButtonLabel.AutoSize = true;
|
||||
this.closeButtonLabel.Location = new System.Drawing.Point(18, 140);
|
||||
this.closeButtonLabel.Name = "closeButtonLabel";
|
||||
this.closeButtonLabel.Size = new System.Drawing.Size(66, 13);
|
||||
this.closeButtonLabel.TabIndex = 7;
|
||||
this.closeButtonLabel.Text = "Close button";
|
||||
//
|
||||
// maxWMsCountTextBox
|
||||
//
|
||||
this.maxWMsCountTextBox.Enabled = false;
|
||||
this.maxWMsCountTextBox.Location = new System.Drawing.Point(155, 111);
|
||||
this.maxWMsCountTextBox.Name = "maxWMsCountTextBox";
|
||||
this.maxWMsCountTextBox.Size = new System.Drawing.Size(27, 20);
|
||||
this.maxWMsCountTextBox.TabIndex = 6;
|
||||
//
|
||||
// maxWMsCountLabel
|
||||
//
|
||||
this.maxWMsCountLabel.AutoSize = true;
|
||||
this.maxWMsCountLabel.Location = new System.Drawing.Point(18, 114);
|
||||
this.maxWMsCountLabel.Name = "maxWMsCountLabel";
|
||||
this.maxWMsCountLabel.Size = new System.Drawing.Size(123, 13);
|
||||
this.maxWMsCountLabel.TabIndex = 5;
|
||||
this.maxWMsCountLabel.Text = "Max. water meters count";
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.maxWMsCountTextBox);
|
||||
this.Controls.Add(this.maxWMsCountLabel);
|
||||
this.Controls.Add(this.closeButtonComboBox);
|
||||
this.Controls.Add(this.closeButtonLabel);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
this.Controls.Add(this.productionTracingCheckBox);
|
||||
this.Controls.Add(this.skipFailedMetersCheckBox);
|
||||
this.Controls.Add(this.nameTextBox);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(300, 200);
|
||||
this.Size = new System.Drawing.Size(333, 200);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@ -108,7 +160,12 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
private System.Windows.Forms.TextBox nameTextBox;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.CheckBox skipFailedMetersCheckBox;
|
||||
private System.Windows.Forms.CheckBox productionTracingCheckBox;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.Label parentNameLabel;
|
||||
private System.Windows.Forms.ComboBox closeButtonComboBox;
|
||||
private System.Windows.Forms.Label closeButtonLabel;
|
||||
private System.Windows.Forms.TextBox maxWMsCountTextBox;
|
||||
private System.Windows.Forms.Label maxWMsCountLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
///
|
||||
/// Copyright (c) 2020 Sensus Slovensko a.s.
|
||||
/// Copyright (c) 2020-2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System.Collections.Generic;
|
||||
using TBF.BenchControl.Generic;
|
||||
@ -14,7 +14,7 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
|
||||
public IComponent DummyComponent() { return new EntryForm(); }
|
||||
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg); }
|
||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new EntryForm(cfg, components); }
|
||||
|
||||
public IComponentCfg DefaultConfig() { return new EntryFormCfg(this.GetType().Namespace.Substring(17), this); }
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ using System.Drawing;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
public partial class FormForMechanicalMeters : Form, GenericDevices.IHasCompleted
|
||||
public partial class FormForMechanicalMeters : Form, ICycleBeginOrEndForm, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(FormForMechanicalMeters));
|
||||
|
||||
@ -22,14 +22,29 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
readonly int wmsCount;
|
||||
readonly bool skipFailed;
|
||||
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
public string PurchaseOrder;
|
||||
public string[] BodyNrText;
|
||||
public int[] AssignedSerialNr;
|
||||
public string[] CompleteSerialNr;
|
||||
public bool[] Disabled;
|
||||
public string Prefix; /// S/N prefix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
public string Suffix; /// S/N suffix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
string purchaseOrder;
|
||||
public string PurchaseOrder { get { return purchaseOrder; } set { purchaseOrder = value; } }
|
||||
|
||||
string[] bodyNrText;
|
||||
public string[] BodyNrText { get { return bodyNrText; } set { bodyNrText = value; } }
|
||||
|
||||
int[] assignedSerialNr;
|
||||
public int[] AssignedSerialNr { get { return assignedSerialNr; } set { assignedSerialNr = value; } }
|
||||
|
||||
string[] completeSerialNr;
|
||||
public string[] CompleteSerialNr { get { return completeSerialNr; } set { completeSerialNr = value; } }
|
||||
|
||||
bool[] disabled;
|
||||
public bool[] Disabled { get { return disabled; } set { disabled = value; } }
|
||||
|
||||
string prefix; /// S/N prefix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
public string Prefix { get { return prefix; } set { prefix = value; } }
|
||||
|
||||
string suffix; /// S/N suffix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
public string Suffix { get { return suffix; } set { suffix = value; } }
|
||||
|
||||
|
||||
/// Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
int firstSN; /// First serial number
|
||||
@ -70,8 +85,8 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
firstSN = 0;
|
||||
snDigits = 0;
|
||||
pcsCount = 0;
|
||||
Prefix = null;
|
||||
Suffix = null;
|
||||
prefix = null;
|
||||
suffix = null;
|
||||
|
||||
foundMeters = new List<BodySerNrResult>();
|
||||
foundSNsWithinRange = new List<int>();
|
||||
@ -153,17 +168,17 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public FormForMechanicalMeters(IList<Results.Entities.WaterMeter> waterMeters, bool skipFailed)
|
||||
public FormForMechanicalMeters(IList<Results.Entities.WaterMeter> waterMeters)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
this.wmsCount = waterMeters.Count;
|
||||
this.skipFailed = skipFailed;
|
||||
this.skipFailed = false;
|
||||
|
||||
BodyNrText = new string[wmsCount];
|
||||
AssignedSerialNr = new int[wmsCount];
|
||||
CompleteSerialNr = new string[wmsCount];
|
||||
Disabled = new bool[wmsCount];
|
||||
bodyNrText = new string[wmsCount];
|
||||
assignedSerialNr = new int[wmsCount];
|
||||
completeSerialNr = new string[wmsCount];
|
||||
disabled = new bool[wmsCount];
|
||||
|
||||
ShuffleTextBoxes(wmsCount, Config.Data.LineSize);
|
||||
}
|
||||
@ -286,23 +301,23 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
PurchaseOrder = orderCB.Text;
|
||||
purchaseOrder = orderCB.Text;
|
||||
Program.LocalSettings.UpdateHistory(orderCB.Text, ref Program.LocalSettings.PurchaseOrderHistory);
|
||||
Program.LocalSettings.UpdateHistory(firstSNRangeCB.Text, ref Program.LocalSettings.FirstSNHistory);
|
||||
Program.LocalSettings.UpdateHistory(lastSNRangeCB.Text, ref Program.LocalSettings.LastSNHistory);
|
||||
|
||||
Program.LocalSettings.LastSNTexts = BodyNrText;
|
||||
Program.LocalSettings.LastSNTexts = bodyNrText;
|
||||
|
||||
int itmp;
|
||||
for (int i = 0; i < Math.Min(wmsCount, textBoxesCount); i++)
|
||||
{
|
||||
BodyNrText[i] = bodyNrBoxes[i].Text;
|
||||
AssignedSerialNr[i] = int.TryParse(serialNrBoxes[i].Text, out itmp) ? itmp : 0;
|
||||
CompleteSerialNr[i] = string.Format("{0}{1}{2}",
|
||||
(Prefix != null) ? Prefix : string.Empty,
|
||||
AssignedSerialNr[i].ToString(string.Format("D{0}", Math.Max(snDigits, 1))),
|
||||
(Suffix != null) ? Suffix : string.Empty);
|
||||
Disabled[i] = !checkBoxes[i].Checked;
|
||||
bodyNrText[i] = bodyNrBoxes[i].Text;
|
||||
assignedSerialNr[i] = int.TryParse(serialNrBoxes[i].Text, out itmp) ? itmp : 0;
|
||||
completeSerialNr[i] = string.Format("{0}{1}{2}",
|
||||
(prefix != null) ? prefix : string.Empty,
|
||||
assignedSerialNr[i].ToString(string.Format("D{0}", Math.Max(snDigits, 1))),
|
||||
(suffix != null) ? suffix : string.Empty);
|
||||
disabled[i] = !checkBoxes[i].Checked;
|
||||
}
|
||||
|
||||
completed = true;
|
||||
@ -544,10 +559,10 @@ namespace TBF.BenchControl.DataEntry.S620
|
||||
|
||||
void ProcessPO()
|
||||
{
|
||||
if (ReadPurchaseOrderParamsFromDB(ProcessData.OracleDB.SelectedDB, orderCB.Text, out firstSN, out snDigits, out pcsCount, out Prefix, out Suffix))
|
||||
if (ReadPurchaseOrderParamsFromDB(ProcessData.OracleDB.SelectedDB, orderCB.Text, out firstSN, out snDigits, out pcsCount, out prefix, out suffix))
|
||||
{
|
||||
prefixTextBox.Text = (Prefix != null) ? Prefix : string.Empty;
|
||||
suffixTextBox.Text = (Suffix != null) ? Suffix : string.Empty;
|
||||
prefixTextBox.Text = (prefix != null) ? prefix : string.Empty;
|
||||
suffixTextBox.Text = (suffix != null) ? suffix : string.Empty;
|
||||
snDigitsTextBox.Text = snDigits.ToString();
|
||||
firstSNTextBox.Text = firstSN.ToString(string.Format("D{0}", snDigits));
|
||||
pcsCountTextBox.Text = pcsCount.ToString();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
18
TBF/BenchControl/DataEntry/S620/ICycleBeginOrEndForm.cs
Normal file
18
TBF/BenchControl/DataEntry/S620/ICycleBeginOrEndForm.cs
Normal file
@ -0,0 +1,18 @@
|
||||
///
|
||||
/// Copyright (c) 2021 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
|
||||
namespace TBF.BenchControl.DataEntry.S620
|
||||
{
|
||||
public interface ICycleBeginOrEndForm
|
||||
{
|
||||
string PurchaseOrder { get; set; }
|
||||
string[] BodyNrText { get; set; }
|
||||
int[] AssignedSerialNr { get; set; }
|
||||
string[] CompleteSerialNr { get; set; }
|
||||
bool[] Disabled { get; set; }
|
||||
string Prefix { get; set; } /// S/N prefix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
string Suffix { get; set; } /// S/N suffix - Loaded from Oracle DB table VT_AUFTRAG_PD
|
||||
}
|
||||
}
|
||||
@ -466,20 +466,18 @@ namespace TBF.BenchControl.Output.DB.ProductionTracing
|
||||
|
||||
if (worksteps.Count != 1) return Retv.Error;
|
||||
|
||||
Workstep vWS;
|
||||
Part vP;
|
||||
bool vRP;
|
||||
TracingDB.ScanVerificationInfo info;
|
||||
///
|
||||
if (!TracingDB.DB.AnalyzeProcess(session, processes[0], worksteps[0], out vWS, out vRP, out vP))
|
||||
if (null == (info = TracingDB.DB.AnalyzeProcess(session, processes[0], worksteps[0])))
|
||||
{
|
||||
return Retv.Error; /// Unable to
|
||||
}
|
||||
|
||||
///
|
||||
currentProcess = processes[0];
|
||||
currentWorkstep = worksteps[0];
|
||||
verifiedWorkstep = vWS;
|
||||
verifiedPart = vP;
|
||||
verifyReferencePart = vRP;
|
||||
verifiedWorkstep = info.Workstep;
|
||||
verifiedPart = info.Part;
|
||||
verifyReferencePart = info.VerifyReferencePart;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -293,6 +293,12 @@ namespace TBF
|
||||
/// Backup values of Q2 pre-corrections from REST services (point.X = LR, point.Y = RL)
|
||||
public TracingDB.SerializableDictionary<int, Point> Q2PreCorrections;
|
||||
|
||||
/// Production tracing
|
||||
public string LastWorkflow;
|
||||
public string LastWStep;
|
||||
public TracingDB.SerializableDictionary<string, string> LastData;
|
||||
|
||||
|
||||
[XmlArrayAttribute("RsltsClmnWidths")]
|
||||
public int[] RsltsClmnWidths;
|
||||
[XmlIgnore]
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.26.1588.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1588.0")]
|
||||
[assembly: AssemblyVersion("2.26.1592.0")]
|
||||
[assembly: AssemblyFileVersion("2.26.1592.0")]
|
||||
|
||||
@ -374,6 +374,7 @@
|
||||
<DependentUpon>FormForMechanicalMetersWithTracing.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="BenchControl\DataEntry\S620\ICheckItem.cs" />
|
||||
<Compile Include="BenchControl\DataEntry\S620\ICycleBeginOrEndForm.cs" />
|
||||
<Compile Include="BenchControl\DataEntry\S620\TestStartEndForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
@ -21,9 +21,11 @@ namespace TracingDB
|
||||
|
||||
public static ISession Session;
|
||||
|
||||
/// <summary> Connection string for all sessions </summary>
|
||||
static string connectionString;
|
||||
///
|
||||
|
||||
/// <summary>
|
||||
/// Connection string for all sessions
|
||||
/// </summary>
|
||||
private static string connectionString;
|
||||
public static string ConnectionString
|
||||
{
|
||||
get { return connectionString; }
|
||||
@ -166,20 +168,20 @@ namespace TracingDB
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get process of the last record with the reference part code equal to 'pcbNumber'
|
||||
/// Get process of the last good record with the reference part code equal to 'serialNumber'
|
||||
/// </summary>
|
||||
/// <param name="session">DB session</param>
|
||||
/// <param name="pcbNumber">PCB number (code)</param>
|
||||
/// <returns>Process</returns>
|
||||
public static Process GetProcess(ISession session, string pcbNumber)
|
||||
/// <param name="serialNumber">Serial number</param>
|
||||
/// <returns>Workflow of the specified part</returns>
|
||||
public static Process GetWorkflow(ISession session, string serialNumber)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pcbNumber)) return null;
|
||||
if (string.IsNullOrEmpty(serialNumber)) return null;
|
||||
|
||||
try
|
||||
{
|
||||
/// Read all already existing reference records with Code==pcbNumber, referenceRecords[0] will be the most recent one
|
||||
var referenceRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(rr => (rr.Code == pcbNumber && rr.Result == 0))
|
||||
.Where(rr => ((rr.Code == serialNumber) && (rr.Result == 0)))
|
||||
.OrderBy(rr => rr.TimeStamp).Desc
|
||||
.List();
|
||||
|
||||
@ -234,13 +236,11 @@ namespace TracingDB
|
||||
workflowDict.Add(wf.Id, wf);
|
||||
workflowStepsDict.Add(wf.Id, steps);
|
||||
|
||||
Workstep step;
|
||||
bool verifyRefPart;
|
||||
Part verifiedPart;
|
||||
if (steps.Count == 1 && TracingDB.DB.AnalyzeProcess(session, wf, steps[0], out step, out verifyRefPart, out verifiedPart))
|
||||
ScanVerificationInfo info;
|
||||
if ((steps.Count == 1) && ((info = TracingDB.DB.AnalyzeProcess(session, wf, steps[0])) != null))
|
||||
{
|
||||
verifInfos.Add(wf.Id, new ScanVerificationInfo(step, verifyRefPart, verifiedPart));
|
||||
log.WarnFormat("Workflow {0} :: Verified step={1} part={2} verify ref. part={3}", wf, step, verifiedPart, verifyRefPart);
|
||||
verifInfos.Add(wf.Id, info);
|
||||
log.WarnFormat("Workflow {0} :: Verified step={1} part={2} verify ref. part={3}", wf, info.Workstep, info.Part, info.VerifyReferencePart);
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,23 +257,17 @@ namespace TracingDB
|
||||
/// <param name="process">Process to be analyzed</param>
|
||||
/// <param name="workstep">Workstep to be analyzed</param>
|
||||
/// <returns>true if there is a verified workstep and part</returns>
|
||||
public static bool AnalyzeProcess(ISession dbSession, Process process, Workstep workstep, out Workstep verifiedWorkstep, out bool verifyReferencePart, out Part verifiedPart)
|
||||
public static ScanVerificationInfo AnalyzeProcess(ISession dbSession, Process process, Workstep workstep)
|
||||
{
|
||||
verifiedWorkstep = null; /// Disable any verification
|
||||
verifyReferencePart = true;
|
||||
verifiedPart = null;
|
||||
|
||||
if (process == null || workstep == null) return false;
|
||||
|
||||
try
|
||||
{
|
||||
if (workstep.ReferencePart != null)
|
||||
if (workstep != null && workstep.ReferencePart != null)
|
||||
{
|
||||
IList<Workstep> worksteps = dbSession.QueryOver<Workstep>()
|
||||
.Where(x => (x.Process == process))
|
||||
.Where(x => (x.WorkstepNr < workstep.WorkstepNr))
|
||||
.OrderBy(x => x.WorkstepNr).Asc
|
||||
.List<Workstep>();
|
||||
.List();
|
||||
|
||||
for (int i = worksteps.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@ -281,21 +275,16 @@ namespace TracingDB
|
||||
{
|
||||
if (worksteps[i].ReferencePart.Id == workstep.ReferencePart.Id)
|
||||
{
|
||||
/// Enable checking reference part
|
||||
verifiedWorkstep = worksteps[i];
|
||||
verifiedPart = workstep.ReferencePart;
|
||||
verifyReferencePart = true;
|
||||
return true;
|
||||
/// Compare reference part of the current workstep and reference part of another workstep
|
||||
return new ScanVerificationInfo(worksteps[i], true, workstep.ReferencePart);
|
||||
}
|
||||
|
||||
foreach (var thisStepPart in workstep.Parts)
|
||||
{
|
||||
if (worksteps[i].ReferencePart.Id == thisStepPart.Id)
|
||||
{
|
||||
verifiedWorkstep = worksteps[i];
|
||||
verifiedPart = worksteps[i].ReferencePart;
|
||||
verifyReferencePart = true;
|
||||
return true;
|
||||
/// Compare (non-reference) part of the current workstep and reference part of another workstep
|
||||
return new ScanVerificationInfo(worksteps[i], true, worksteps[i].ReferencePart);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -305,28 +294,19 @@ namespace TracingDB
|
||||
bool isUnique = (part.CodeLocation == CodeLocation.OnPart) && ((part.CodeType == CodeType.UniqueNr)
|
||||
|| (part.CodeType == CodeType.FlowtubeNr)
|
||||
|| (part.CodeType == CodeType.FlowtubeNrLU));
|
||||
|
||||
if (isUnique)
|
||||
{
|
||||
if (part.Id == workstep.ReferencePart.Id)
|
||||
{
|
||||
/// Enable checking reference part
|
||||
verifiedWorkstep = worksteps[i];
|
||||
verifiedPart = part;
|
||||
verifyReferencePart = false;
|
||||
log.ErrorFormat("AnalyzeProcess(session , {0}, {1}) returned 'true' : verWorkstep = {2}, verPart = {3}, verRefPart = {4}",
|
||||
process.Name, workstep.Name);
|
||||
return true;
|
||||
return new ScanVerificationInfo(worksteps[i], false, part); /// !!!!!!!!!!!!!!!!!!
|
||||
}
|
||||
|
||||
foreach (var thisStepPart in workstep.Parts)
|
||||
{
|
||||
if (part.Id == thisStepPart.Id)
|
||||
{
|
||||
verifiedWorkstep = worksteps[i];
|
||||
verifiedPart = part;
|
||||
verifyReferencePart = false;
|
||||
return true;
|
||||
return new ScanVerificationInfo(worksteps[i], false, part);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,13 +314,15 @@ namespace TracingDB
|
||||
}
|
||||
}
|
||||
|
||||
log.ErrorFormat("AnalyzeProcess(session , {0}, {1}) returned 'false'", process.Name, workstep.Name);
|
||||
return false;
|
||||
log.ErrorFormat("AnalyzeProcess(session , {0}, {1}) no ver. info found, returning 'null'",
|
||||
(process != null) ? process.Name : "null",
|
||||
(workstep != null) ? workstep.Name : "null");
|
||||
return null;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("AnalyzeProcess(session , {0}, {1}) failed : {2}", process.Name, workstep.Name, exc.Message);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Resources;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Common")]
|
||||
[assembly: AssemblyTitle("Production Monitoring")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015-2018 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015-2021 Sensus Slovensko, a.s.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@ -34,3 +35,4 @@ using System.Runtime.InteropServices;
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.1.110.0")]
|
||||
[assembly: AssemblyFileVersion("2.1.110.0")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user