(1) iperl_check with Continue/Abort (2) MeterTestRslt.ErrorIndicators (not in DB) (3) ErrorFlags.Errors modif. (4) ResultsTabPage commonBackColor, etc.

This commit is contained in:
Milan Hanajik 2019-03-11 13:39:11 +01:00
parent d45c3f96d6
commit 70cba76ffd
22 changed files with 650 additions and 584 deletions

View File

@ -498,4 +498,75 @@ namespace Config.Entities
#endif
Count
}
public enum ErrorFlagShift
{
E1 = 0,
E2,
E3,
E4,
E5,
E6,
E7,
E8,
E9,
E10,
E11,
E12,
E13,
E14,
E15,
E16,
E17,
E18,
E19,
E20,
E21,
E22,
E23,
E24,
E25,
E26,
E27,
E28,
E29,
E30,
E31,
}
public enum ErrorFlagMask
{
E1 = (1 << (int)ErrorFlagShift.E1),
E2 = (1 << (int)ErrorFlagShift.E2),
E3 = (1 << (int)ErrorFlagShift.E3),
E4 = (1 << (int)ErrorFlagShift.E4),
E5 = (1 << (int)ErrorFlagShift.E5),
E6 = (1 << (int)ErrorFlagShift.E6),
E7 = (1 << (int)ErrorFlagShift.E7),
E8 = (1 << (int)ErrorFlagShift.E8),
E9 = (1 << (int)ErrorFlagShift.E9),
E10 = (1 << (int)ErrorFlagShift.E10),
E11 = (1 << (int)ErrorFlagShift.E11),
E12 = (1 << (int)ErrorFlagShift.E12),
E13 = (1 << (int)ErrorFlagShift.E13),
E14 = (1 << (int)ErrorFlagShift.E14),
E15 = (1 << (int)ErrorFlagShift.E15),
E16 = (1 << (int)ErrorFlagShift.E16),
E17 = (1 << (int)ErrorFlagShift.E17),
E18 = (1 << (int)ErrorFlagShift.E18),
E19 = (1 << (int)ErrorFlagShift.E19),
E20 = (1 << (int)ErrorFlagShift.E20),
E21 = (1 << (int)ErrorFlagShift.E21),
E22 = (1 << (int)ErrorFlagShift.E22),
E23 = (1 << (int)ErrorFlagShift.E23),
E24 = (1 << (int)ErrorFlagShift.E24),
E25 = (1 << (int)ErrorFlagShift.E25),
E26 = (1 << (int)ErrorFlagShift.E26),
E27 = (1 << (int)ErrorFlagShift.E27),
E28 = (1 << (int)ErrorFlagShift.E28),
E29 = (1 << (int)ErrorFlagShift.E29),
E30 = (1 << (int)ErrorFlagShift.E30),
E31 = (1 << (int)ErrorFlagShift.E31),
}
}

View File

@ -25,6 +25,7 @@ namespace Results.Entities
/// Main result
public virtual double Error { get; set; } /// [%]
public virtual int ErrorIndicators { get; set; } /// Not mapped to DB !!!, bit24=E25, bit25=E26, bit26=E27, bit27=E28
public virtual double KorrErrQ { get; set; } /// [%] not mapped to results DB, saved to Oracle DB
public virtual bool TestDone { get; set; } /// true = test was completed
public virtual bool Passed { get; set; } /// true = test passed, water meter is OK

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.18.1161.0")]
[assembly: AssemblyFileVersion("2.18.1161.0")]
[assembly: AssemblyVersion("2.18.1162.0")]
[assembly: AssemblyFileVersion("2.18.1162.0")]

View File

@ -169,6 +169,7 @@ namespace TBF.BenchControl
Next, /// To move to the next state when debugging
OK,
Retry,
Continue,
Abort,
TimerBusy,
SetOutputsDone,

View File

@ -31,26 +31,27 @@ namespace TBF.BenchControl.Operations
/// </summary>
private void InitializeComponent()
{
this.okButton = new System.Windows.Forms.Button();
this.continueButton = new System.Windows.Forms.Button();
this.messageLabel = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.abortButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// okButton
// continueButton
//
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.okButton.ForeColor = System.Drawing.Color.Black;
this.okButton.Location = new System.Drawing.Point(450, 23);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(98, 63);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
this.continueButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.continueButton.ForeColor = System.Drawing.Color.Black;
this.continueButton.Location = new System.Drawing.Point(224, 23);
this.continueButton.Name = "continueButton";
this.continueButton.Size = new System.Drawing.Size(254, 63);
this.continueButton.TabIndex = 1;
this.continueButton.Text = "Continue";
this.continueButton.UseVisualStyleBackColor = true;
this.continueButton.Click += new System.EventHandler(this.continueButton_Click);
//
// messageLabel
//
@ -78,12 +79,25 @@ namespace TBF.BenchControl.Operations
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.BackColor = System.Drawing.Color.OrangeRed;
this.splitContainer1.Panel2.Controls.Add(this.okButton);
this.splitContainer1.Panel2.Controls.Add(this.abortButton);
this.splitContainer1.Panel2.Controls.Add(this.continueButton);
this.splitContainer1.Size = new System.Drawing.Size(1002, 617);
this.splitContainer1.SplitterDistance = 508;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 5;
//
// abortButton
//
this.abortButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.abortButton.ForeColor = System.Drawing.Color.Black;
this.abortButton.Location = new System.Drawing.Point(510, 23);
this.abortButton.Name = "abortButton";
this.abortButton.Size = new System.Drawing.Size(254, 63);
this.abortButton.TabIndex = 2;
this.abortButton.Text = "Abort cycle";
this.abortButton.UseVisualStyleBackColor = true;
this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
//
// LargeMessageBoxForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -110,8 +124,9 @@ namespace TBF.BenchControl.Operations
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button continueButton;
private System.Windows.Forms.Label messageLabel;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button abortButton;
}
}

View File

@ -13,9 +13,9 @@ namespace TBF.BenchControl.Operations
{
static readonly ILog log = LogManager.GetLogger(typeof(LargeMessageBoxForm));
/// Set to 'true' when the form closes
public bool Completed { get { return completed; } }
bool completed;
/// One of the following two variables is 'true' when the form closes
public bool CompletedContinue;
public bool CompletedAbort;
public LargeMessageBoxForm(string message, Color backgroundColor)
@ -34,27 +34,38 @@ namespace TBF.BenchControl.Operations
{
int shift = (rqrdFormWidth - Width) / 2;
Width = rqrdFormWidth;
okButton.Left += shift;
continueButton.Left += shift;
}
completed = false;
CompletedContinue = false;
CompletedAbort = false;
StartForceCloseHandler();
}
void Localize()
{
okButton.Text = Strings.OkBtnText;
continueButton.Text = Strings.Continue;
abortButton.Text = Strings.Abort_cycle;
}
private void okButton_Click(object sender, EventArgs e)
private void continueButton_Click(object sender, EventArgs e)
{
completed = true;
CompletedContinue = true;
Close();
}
private void abortButton_Click(object sender, EventArgs e)
{
CompletedAbort = true;
Close();
}
private void MessageBoxForm_FormClosing(object sender, FormClosingEventArgs e)
{
completed = true;
if (!CompletedContinue && !CompletedAbort)
{
CompletedContinue = true; /// Default action is 'Continue'
}
}
#region Forced close handling

View File

@ -53,14 +53,9 @@ namespace TBF.BenchControl.Operations
/// <returns>Event.ResultsPrinted</returns>
public Event Run()
{
if (completed || form.Completed)
{
completed = true;
form = null;
return Event.OK;
}
return Event.None;
if (form.CompletedContinue) return Event.Continue;
if (form.CompletedAbort) return Event.Abort;
return Event.None;
}
/// <summary>Stop this operation</summary>

View File

@ -28,6 +28,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
public int RfidPortNrBoard2;
public int RfidPortNrBoard3;
public int RfidPortNrBoard4;
public int IperlCheckErrorsToStop;
/// <summary> Test parameters </summary>
@ -53,6 +54,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
RfidPortNrBoard1 = 52;
RfidPortNrBoard1 = 53;
RfidPortNrBoard1 = 54;
IperlCheckErrorsToStop = 10;
TestParams = CreateTestParamsProvider() as iPerlCommunicationParams;
}

View File

@ -5,6 +5,7 @@ using System;
using System.Windows.Forms;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
@ -50,6 +51,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
commTimeoutTextBox.Text = config.CommTimeout.ToString();
maxCommRetriesTextBox.Text = config.MaxCommRetries.ToString();
nrThreadsTextBox.Text = config.NrThreads.ToString();
iperlCheckErrorsToStopTextBox.Text = config.IperlCheckErrorsToStop.ToString();
}
public void Unlock()
@ -62,7 +64,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
rfidPortBoard4TextBox.Enabled = true;
commTimeoutTextBox.Enabled = true;
maxCommRetriesTextBox.Enabled = true;
nrThreadsTextBox.Enabled = true;
nrThreadsTextBox.Enabled = true;
iperlCheckErrorsToStopTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
@ -105,6 +108,12 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Nr. threads' should be 1, 2 or 4";
}
if (!int.TryParse(iperlCheckErrorsToStopTextBox.Text, out dummy) || ((dummy < 1) && (dummy > 40)))
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, iperlCheckErrorsToStopLabel.Text);
}
return flags;
}
@ -139,6 +148,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if (config.UseMuxBoards != useMuxBrdsCheckBox.Checked) { config.UseMuxBoards = useMuxBrdsCheckBox.Checked; flags = CfgUpdateFlags.RestartRqrd; }
tmp = int.Parse(iperlCheckErrorsToStopTextBox.Text);
if (config.IperlCheckErrorsToStop != tmp) { config.IperlCheckErrorsToStop = tmp; flags = CfgUpdateFlags.RestartRqrd; }
return flags;
}
}

View File

@ -51,6 +51,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.nrThreadsLabel = new System.Windows.Forms.Label();
this.useMuxBrdsCheckBox = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.iperlCheckErrorsToStopTextBox = new System.Windows.Forms.TextBox();
this.iperlCheckErrorsToStopLabel = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@ -228,10 +230,29 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Multiplexer boards connected to USB ports";
//
// iperlCheckErrorsToStopTextBox
//
this.iperlCheckErrorsToStopTextBox.Enabled = false;
this.iperlCheckErrorsToStopTextBox.Location = new System.Drawing.Point(239, 267);
this.iperlCheckErrorsToStopTextBox.Name = "iperlCheckErrorsToStopTextBox";
this.iperlCheckErrorsToStopTextBox.Size = new System.Drawing.Size(45, 20);
this.iperlCheckErrorsToStopTextBox.TabIndex = 25;
//
// iperlCheckErrorsToStopLabel
//
this.iperlCheckErrorsToStopLabel.AutoSize = true;
this.iperlCheckErrorsToStopLabel.Location = new System.Drawing.Point(23, 270);
this.iperlCheckErrorsToStopLabel.Name = "iperlCheckErrorsToStopLabel";
this.iperlCheckErrorsToStopLabel.Size = new System.Drawing.Size(202, 13);
this.iperlCheckErrorsToStopLabel.TabIndex = 24;
this.iperlCheckErrorsToStopLabel.Text = "iperl_check errors count to stop the cycle";
//
// TestMethodCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.iperlCheckErrorsToStopTextBox);
this.Controls.Add(this.iperlCheckErrorsToStopLabel);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.nrThreadsTextBox);
this.Controls.Add(this.nrThreadsLabel);
@ -243,7 +264,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "TestMethodCfgCtrl";
this.Size = new System.Drawing.Size(409, 282);
this.Size = new System.Drawing.Size(427, 305);
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
@ -273,5 +294,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
private System.Windows.Forms.Label nrThreadsLabel;
private System.Windows.Forms.CheckBox useMuxBrdsCheckBox;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox iperlCheckErrorsToStopTextBox;
private System.Windows.Forms.Label iperlCheckErrorsToStopLabel;
}
}

View File

@ -59,7 +59,6 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
const string Q2correctedFromCmd = "q2 corrected from ";
const string Q2correctionCheckCmd = "q2 correction check ";
const string IperlCheckCmd = "iperl_check ";
const string Hz2correctedFromCmd = "2Hz corrected from ";
if (testParams.Activity.ToLower().Contains(Q2correctedFromCmd))
{
@ -114,7 +113,7 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
Results.Entities.TestRslt tstRslt = ProcessData.BatchRslts.GetTestRslt(test.Name, 0);
bool anyError = false;
int wrongMetersCount = 0;
string message = string.Empty;
for (int i = 0; i < BatchRslts.WMPositionsCount; i++)
@ -124,7 +123,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if ((wm != null) && (mtr != null))
{
bool anyMeterError = false;
int errorIndicators = 0;
bool anyErrorOfThisMeter = false;
foreach (var arg in args)
{
#if ORACLE_DB
@ -132,9 +132,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
if (wm.Pruefindex > maxTestIndex)
{
anyMeterError = true;
anyError = true;
anyErrorOfThisMeter = true;
message += string.Format("iPerl{0} : Príliš veľa opakovaní testu vodomera{1}", wm.WMPosition, Environment.NewLine);
errorIndicators |= (int)ErrorFlagMask.E25; /// Max pruefindex exceeded
}
}
#endif
@ -144,8 +144,8 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
if ((wm.ProdQ2CorrRL != wm.Q2CorrRL) || (wm.ProdQ2CorrLR != wm.Q2CorrLR))
{
anyMeterError = true;
anyError = true;
message += string.Format("Q2 korekčné faktory vodomera {0} nesedia{1}", wm.WMPosition, Environment.NewLine);
errorIndicators |= (int)ErrorFlagMask.E26; /// Q2 correction factors not valid
}
}
#endif
@ -153,9 +153,9 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
//if (wm.Pruefindex > maxTestIndex)
//{
// anyMeterError = true;
// anyError = true;
// anyErrorOfThisMeter = true;
// message += string.Format("Príliš veľa opakovaní testu vodomera {0}{1}", wm.WMPosition, Environment.NewLine);
// errorIndicators |= (int)ErrorFlagMask.E27; /// Wrong direction (positive/negative counting)
//}
}
@ -163,15 +163,28 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
{
if (!wm.IsLastRecordOk)
{
anyMeterError = true;
anyError = true;
anyErrorOfThisMeter = true;
message += string.Format("iPerl{0} : Predchádzajúci krok nebol zaznamenaný{1}", wm.WMPosition, Environment.NewLine);
errorIndicators |= (int)ErrorFlagMask.E28; /// Previous workstep missing or NOK (production tracing)
}
}
}
mtr.TestDone = true;
mtr.Passed = !anyMeterError;
mtr.ErrorIndicators = errorIndicators;
///
if (anyErrorOfThisMeter)
{
/// This iPerl check did not pass
mtr.Passed = false;
wm.Disabled = true;
wrongMetersCount++;
}
else
{
/// Check passed OK
mtr.Passed = true;
}
}
}
@ -181,52 +194,28 @@ namespace TBF.BenchControl.TestMethods.iPerlCommunication
IList<Event> rList = new List<Event>(1);
if (anyError)
if (wrongMetersCount >= cfg.IperlCheckErrorsToStop)
{
State.Create("iPerlCommunicationSeq : Show check result")
.AddOperation(new Operations.LargeMessageBoxOp(message))
.EnterState();
do { e = StateMachine.WaitRunDevsRunOps(); }
while (!e.Contains(Event.OK));
do
{
e = StateMachine.WaitRunDevsRunOps();
}
while (!e.Contains(Event.Continue) && !e.Contains(Event.Abort));
Bridge.OnError(this, string.Format("Niečo nie je v poriadku !"));
rList.Add(Event.UiCmdStop);
}
else
{
rList.Add(Event.Done);
if (e.Contains(Event.Abort))
{
Bridge.OnError(this, string.Format("Niečo nie je v poriadku !"));
rList.Add(Event.UiCmdStop);
return rList;
}
}
rList.Add(Event.Done);
return rList;
}
//else if (testParams.Activity.ToLower().Contains(Hz2correctedFromCmd))
//{
// TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 });
// Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.JustStarted));
// Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.FlowSetting));
// string fromTestsNames = testParams.Activity.Substring(Hz2correctedFromCmd.Length);
// string[] fromTestsArr = fromTestsNames.Split(new char[] { ' ' });
// if (fromTestsArr.Length == 2)
// {
// //MakeCorrectedFrom(test.Name, fromTestsArr[0], fromTestsArr[1]);
// Bridge.OnTestProgress(this, new TestProgressEventArgs(test, Config.Entities.Progress.Completed));
// Bridge.OnTestCompleted(this, new TestCompletedEventArgs(test.Name, ProcessData.BatchRslts.GetTestRslt(test.Name, 0)));
// allResults.Info(TestResult2CsvLine(test.Name, 0)); /// Append the results to the CSV-file
// IList<Event> rList = new List<Event>(1);
// rList.Add(Event.Done);
// return rList;
// }
// else
// {
// IList<Event> rList = new List<Event>(1);
// rList.Add(Event.Done);
// return rList;
// }
//}
else if (testParams.Activity.ToLower().Contains("simulate "))
{
TestProgressEventArgs.SetEstimatedTimes(new int[] { 0, 0, 0, 30, 0, 30, 0, 0 } );

View File

@ -1,9 +1,10 @@
///
/// Copyright (c) 2017-2018 Sensus Slovensko a.s.
/// Copyright (c) 2017-2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using log4net;
using Config.Entities;
using Results.Entities;
using TBF.BenchControl.Sequences;
@ -103,27 +104,27 @@ namespace TBF.BenchControl.Various.ErrorFlags
|| ProcessData.RefFlowStat.Max > testRslt.Qto();
int ErrorFlags = 0;
if (errorsCfg.TestParams.E1 && E1) ErrorFlags |= 0x0001;
if (errorsCfg.TestParams.E2 && E2) ErrorFlags |= 0x0002;
if (errorsCfg.TestParams.E3 && E3) ErrorFlags |= 0x0004;
if (errorsCfg.TestParams.E4 && E4) ErrorFlags |= 0x0008;
if (errorsCfg.TestParams.E5 && E5) ErrorFlags |= 0x0010;
if (errorsCfg.TestParams.E6 && E6) ErrorFlags |= 0x0020;
if (errorsCfg.TestParams.E7 && E7) ErrorFlags |= 0x0040;
if (errorsCfg.TestParams.E8 && E8) ErrorFlags |= 0x0080;
if (errorsCfg.TestParams.E9 && E9) ErrorFlags |= 0x0100;
if (errorsCfg.TestParams.E10 && E10) ErrorFlags |= 0x0200;
if (errorsCfg.TestParams.E11 && E11) ErrorFlags |= 0x0400;
if (errorsCfg.TestParams.E12 && E12) ErrorFlags |= 0x0800;
if (errorsCfg.TestParams.E13 && E13) ErrorFlags |= 0x1000;
if (errorsCfg.TestParams.E14 && E14) ErrorFlags |= 0x2000;
//E15 0x4000
//E16 0x8000
//E17 0x10000
//E18 0x20000
//E19 0x40000
//E20 0x80000
if (errorsCfg.TestParams.E21 && E21) ErrorFlags |= 0x100000;
if (errorsCfg.TestParams.E1 && E1) ErrorFlags |= (int)ErrorFlagMask.E1;
if (errorsCfg.TestParams.E2 && E2) ErrorFlags |= (int)ErrorFlagMask.E2;
if (errorsCfg.TestParams.E3 && E3) ErrorFlags |= (int)ErrorFlagMask.E3;
if (errorsCfg.TestParams.E4 && E4) ErrorFlags |= (int)ErrorFlagMask.E4;
if (errorsCfg.TestParams.E5 && E5) ErrorFlags |= (int)ErrorFlagMask.E5;
if (errorsCfg.TestParams.E6 && E6) ErrorFlags |= (int)ErrorFlagMask.E6;
if (errorsCfg.TestParams.E7 && E7) ErrorFlags |= (int)ErrorFlagMask.E7;
if (errorsCfg.TestParams.E8 && E8) ErrorFlags |= (int)ErrorFlagMask.E8;
if (errorsCfg.TestParams.E9 && E9) ErrorFlags |= (int)ErrorFlagMask.E9;
if (errorsCfg.TestParams.E10 && E10) ErrorFlags |= (int)ErrorFlagMask.E10;
if (errorsCfg.TestParams.E11 && E11) ErrorFlags |= (int)ErrorFlagMask.E11;
if (errorsCfg.TestParams.E12 && E12) ErrorFlags |= (int)ErrorFlagMask.E12;
if (errorsCfg.TestParams.E13 && E13) ErrorFlags |= (int)ErrorFlagMask.E13;
if (errorsCfg.TestParams.E14 && E14) ErrorFlags |= (int)ErrorFlagMask.E14;
//E15
//E16
//E17
//E18
//E19
//E20
if (errorsCfg.TestParams.E21 && E21) ErrorFlags |= (int)ErrorFlagMask.E21;
return ErrorFlags;
}
@ -149,30 +150,35 @@ namespace TBF.BenchControl.Various.ErrorFlags
/// <returns>Error flags</returns>
public int GetWMtrErrorFlags(IList<MeterTestRslt> meterTestRslts)
{
int errorIndicators = 0;
MeterTestRslt mtrQ3 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q3Names);
MeterTestRslt mtrQ2 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q2Names);
MeterTestRslt mtrQ1 = GetMtrTstRsltFromNames(meterTestRslts, errorsCfg.Q1Names);
if (mtrQ3 == null || !mtrQ3.TestDone || mtrQ2 == null || !mtrQ2.TestDone || mtrQ1 == null || !mtrQ1.TestDone)
{
return 0;
/// No error indicator;
}
else if ((mtrQ3.Error > mtrQ3.ErrLimHi() / 2) &&
(mtrQ2.Error > mtrQ2.ErrLimHi() / 2) &&
(mtrQ1.Error > mtrQ1.ErrLimHi() / 2))
{
return 0x4000; /// E15
errorIndicators |= (int)ErrorFlagMask.E15; /// Set E15
}
else if ((mtrQ3.Error < mtrQ3.ErrLimLo() / 2) &&
(mtrQ2.Error < mtrQ2.ErrLimLo() / 2) &&
(mtrQ1.Error < mtrQ1.ErrLimLo() / 2))
{
return 0x4000; /// E15
errorIndicators |= (int)ErrorFlagMask.E15; /// Set E15
}
else
foreach (var mtr in meterTestRslts)
{
return 0;
errorIndicators |= mtr.ErrorIndicators; /// Set any error flag from mtr.ErrorIndicators (iPerl)
}
return errorIndicators;
}

View File

@ -1,18 +1,20 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
/// Copyright (c) 2019 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Config.Entities;
using TBF.BenchControl.Generic;
namespace TBF.BenchControl.Various.ErrorFlags
{
public class ErrorsCfg : ComponentCfgBase, IComponentCfg
public class ErrorsCfg : ComponentCfgBase, IComponentCfg, Config.Entities.IParamsProvider
{
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(ErrorsCfg) })[0];
public override XmlSerializer GetSerializer() { return Serializer; }
public IComponentCfgCtrl GetControl() { return new ErrorsCfgCtrl(); }
public IComponentCfgCtrl GetControl() { return new Configs.ParamsProvider.ComponentCfgCtrl(this, null); }
///
/// Serialized parameters
@ -37,12 +39,97 @@ namespace TBF.BenchControl.Various.ErrorFlags
: this()
{
Name = name;
Factory = factory;
ParentName = string.Empty;
Factory = factory;
InitializeAll();
}
public string ComponentName { get { return Name; } }
public void InitializeAll()
{
Q3Names = "Q3";
Q2Names = "Q2";
Q1Names = "Q1";
}
public string ToString(int i)
string[] paramNames = new string[]
{
return string.Format("{0}", Name);
}
}
"1st test name for E15,E16 (Q3)",
"2nd test name for E15,E16 (Q2)",
"3rd test name for E15,E16 (Q1)",
};
public string ParamName(int i) { return paramNames[i]; }
public int ParamsCount() { return paramNames.Length; }
public IList<string> ParamValues(int i)
{
return null;
}
public string ToString(int i)
{
if (i == -1)
{
return string.Format("{0}", Name);
}
switch (i)
{
case 0: return Q3Names;
case 1: return Q2Names;
case 2: return Q1Names;
default: return string.Empty;
}
}
public CfgUpdateFlags UpdateParam(int i, string strValue)
{
switch (i)
{
case 0: Q3Names = strValue; return CfgUpdateFlags.RestartRqrd;
case 1: Q1Names = strValue; return CfgUpdateFlags.RestartRqrd;
case 2: Q1Names = strValue; return CfgUpdateFlags.RestartRqrd;
default: return CfgUpdateFlags.None;
}
}
public bool ValidateParam(int i, string strValue, out string message)
{
message = string.Empty;
switch (i)
{
case 0:
case 1:
case 2:
return true;
default:
message = "Invalid index";
return false;
}
//message = ParamName(i) + " is invalid";
//return false;
}
void CopyContentTo(ErrorsCfg prms)
{
prms.Q3Names = this.Q3Names;
prms.Q2Names = this.Q2Names;
prms.Q1Names = this.Q1Names;
}
public Config.Entities.IParamsProvider Clone()
{
ErrorsCfg pars = new ErrorsCfg();
CopyContentTo(pars);
return pars;
}
public bool UpdateEmbeddedDbEntity()
{
return true; /// =OK, do nothing
}
}
}

View File

@ -1,129 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using System.Windows.Forms;
using log4net;
using Config.Entities;
using TBF.BenchControl.Generic;
using TBF.Resources;
namespace TBF.BenchControl.Various.ErrorFlags
{
public partial class ErrorsCfgCtrl : UserControl, IComponentCfgCtrl
{
static readonly ILog log = LogManager.GetLogger(typeof(ErrorsCfgCtrl));
ComponentParametersDlg parent;
public bool ShowMore { get { return false; } }
ErrorsCfg config;
public IComponentCfg Config
{
get { return config as IComponentCfg; }
set
{
config = value as ErrorsCfg;
Redraw();
}
}
public ErrorsCfgCtrl()
{
InitializeComponent();
}
private void PumpCfgCtrl_Load(object sender, EventArgs e)
{
parent = ParentForm as ComponentParametersDlg;
if (parent == null) return;
Redraw();
}
public void Closing()
{
}
void Redraw()
{
if (config == null) return; /// Control was not loaded, settings were not changed
classNameLabel.Text = config.Factory.ClassName;
nameTextBox.Text = config.Name;
q3NamesTextBox.Text = config.Q3Names;
q2NamesTextBox.Text = config.Q2Names;
q1NamesTextBox.Text = config.Q1Names;
}
public void Unlock()
{
nameTextBox.Enabled = true;
q3NamesTextBox.Enabled = true;
q2NamesTextBox.Enabled = true;
q1NamesTextBox.Enabled = true;
}
public CfgUpdateFlags VerifyCfg(ref string message)
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
return flags;
}
public CfgUpdateFlags UpdateCfg()
{
CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
if (config.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.Q3Names != q3NamesTextBox.Text)
{
config.Q3Names = q3NamesTextBox.Text;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.Q2Names != q2NamesTextBox.Text)
{
config.Q2Names = q2NamesTextBox.Text;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if (config.Q1Names != q1NamesTextBox.Text)
{
config.Q1Names = q1NamesTextBox.Text;
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
}
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
{
Errors.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, Config));
}
return flags;
}
#region Configuration 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() { }
public void StopResponseHandler() { }
#endregion Configuration Change Handling
}
}

View File

@ -1,190 +0,0 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
namespace TBF.BenchControl.Various.ErrorFlags
{
partial class ErrorsCfgCtrl
{
/// <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.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.q3NamesTextBox = new System.Windows.Forms.TextBox();
this.q2NamesTextBox = new System.Windows.Forms.TextBox();
this.q1NamesTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// nameTextBox
//
this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(130, 49);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(174, 20);
this.nameTextBox.TabIndex = 2;
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(20, 52);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name";
//
// classNameLabel
//
this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(127, 26);
this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(114, 13);
this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ComponentClassName";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(-211, -147);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(57, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Arguments";
//
// textBox1
//
this.textBox1.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(-125, -150);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(372, 20);
this.textBox1.TabIndex = 6;
//
// q3NamesTextBox
//
this.q3NamesTextBox.Enabled = false;
this.q3NamesTextBox.Location = new System.Drawing.Point(130, 103);
this.q3NamesTextBox.Name = "q3NamesTextBox";
this.q3NamesTextBox.Size = new System.Drawing.Size(174, 20);
this.q3NamesTextBox.TabIndex = 7;
//
// q2NamesTextBox
//
this.q2NamesTextBox.Enabled = false;
this.q2NamesTextBox.Location = new System.Drawing.Point(130, 129);
this.q2NamesTextBox.Name = "q2NamesTextBox";
this.q2NamesTextBox.Size = new System.Drawing.Size(174, 20);
this.q2NamesTextBox.TabIndex = 8;
//
// q1NamesTextBox
//
this.q1NamesTextBox.Enabled = false;
this.q1NamesTextBox.Location = new System.Drawing.Point(130, 155);
this.q1NamesTextBox.Name = "q1NamesTextBox";
this.q1NamesTextBox.Size = new System.Drawing.Size(174, 20);
this.q1NamesTextBox.TabIndex = 9;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(20, 106);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(93, 13);
this.label2.TabIndex = 10;
this.label2.Text = "1st test name (Q3)";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(20, 132);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(97, 13);
this.label3.TabIndex = 11;
this.label3.Text = "2nd test name (Q2)";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(20, 158);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(94, 13);
this.label4.TabIndex = 12;
this.label4.Text = "3rd test name (Q1)";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(127, 82);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(250, 13);
this.label5.TabIndex = 13;
this.label5.Text = "Test names for E15, E16 evaluation separated by \';\'";
//
// ErrorsCfgCtrl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.q1NamesTextBox);
this.Controls.Add(this.q2NamesTextBox);
this.Controls.Add(this.q3NamesTextBox);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel);
this.Name = "ErrorsCfgCtrl";
this.Size = new System.Drawing.Size(500, 300);
this.Load += new System.EventHandler(this.PumpCfgCtrl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.Label classNameLabel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox q3NamesTextBox;
private System.Windows.Forms.TextBox q2NamesTextBox;
private System.Windows.Forms.TextBox q1NamesTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
}
}

View File

@ -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>

View File

@ -141,6 +141,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Abort cycle.
/// </summary>
internal static string Abort_cycle {
get {
return ResourceManager.GetString("Abort_cycle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About Test Bench Framework.
/// </summary>
@ -915,6 +924,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Continue.
/// </summary>
internal static string Continue {
get {
return ResourceManager.GetString("Continue", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Continue in the cycle after this test?.
/// </summary>
@ -2004,6 +2022,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid Q2 correction factors.
/// </summary>
internal static string Invalid_Q2_correction_factors {
get {
return ResourceManager.GetString("Invalid_Q2_correction_factors", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Invalid user, password, or bench.
/// </summary>
@ -3102,6 +3129,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Previous step is missing or NOK.
/// </summary>
internal static string Previous_step_is_missing_or_NOK {
get {
return ResourceManager.GetString("Previous_step_is_missing_or_NOK", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Print again.
/// </summary>
@ -4929,6 +4965,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Test repetition count exceeded upper limit.
/// </summary>
internal static string Test_repetition_count_exceeded_upper_limit {
get {
return ResourceManager.GetString("Test_repetition_count_exceeded_upper_limit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Test start ({0}: step {1}/{2}).
/// </summary>
@ -5508,6 +5553,15 @@ namespace TBF.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Wrong iPerl counting direction.
/// </summary>
internal static string Wrong_iPerl_counting_direction {
get {
return ResourceManager.GetString("Wrong_iPerl_counting_direction", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Year of production.
/// </summary>

View File

@ -1389,4 +1389,22 @@
<data name="Mass_measurement_timeout" xml:space="preserve">
<value>Překročení časového limitu pro vážení</value>
</data>
<data name="Abort_cycle" xml:space="preserve">
<value>Přerušit cyklus</value>
</data>
<data name="Continue" xml:space="preserve">
<value>Pokračovat</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Nesprávne Q2 korekčné faktory</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Predchádzajúci krok chýba alebo neprešiel</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Počet opakovaní testu prekročil dovolené maximum</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Nesprávny smer počítania iPerlu</value>
</data>
</root>

View File

@ -1945,4 +1945,22 @@
<data name="Mass_measurement_timeout" xml:space="preserve">
<value>Mass measurement timeout</value>
</data>
<data name="Abort_cycle" xml:space="preserve">
<value>Abort cycle</value>
</data>
<data name="Continue" xml:space="preserve">
<value>Continue</value>
</data>
<data name="Invalid_Q2_correction_factors" xml:space="preserve">
<value>Invalid Q2 correction factors</value>
</data>
<data name="Previous_step_is_missing_or_NOK" xml:space="preserve">
<value>Previous step is missing or NOK</value>
</data>
<data name="Test_repetition_count_exceeded_upper_limit" xml:space="preserve">
<value>Test repetition count exceeded upper limit</value>
</data>
<data name="Wrong_iPerl_counting_direction" xml:space="preserve">
<value>Wrong iPerl counting direction</value>
</data>
</root>

View File

@ -32,6 +32,16 @@ namespace TBF.Screens
private void InitializeComponent()
{
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.reloadPreviousResultsButton = new System.Windows.Forms.Button();
this.columnWidthsButton = new System.Windows.Forms.Button();
this.showPreviousResultsButton = new System.Windows.Forms.Button();
@ -41,6 +51,11 @@ namespace TBF.Screens
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// splitContainer
@ -55,6 +70,16 @@ namespace TBF.Screens
// splitContainer.Panel1
//
this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Control;
this.splitContainer.Panel1.Controls.Add(this.label5);
this.splitContainer.Panel1.Controls.Add(this.label4);
this.splitContainer.Panel1.Controls.Add(this.label3);
this.splitContainer.Panel1.Controls.Add(this.label2);
this.splitContainer.Panel1.Controls.Add(this.label1);
this.splitContainer.Panel1.Controls.Add(this.pictureBox5);
this.splitContainer.Panel1.Controls.Add(this.pictureBox4);
this.splitContainer.Panel1.Controls.Add(this.pictureBox3);
this.splitContainer.Panel1.Controls.Add(this.pictureBox2);
this.splitContainer.Panel1.Controls.Add(this.pictureBox1);
this.splitContainer.Panel1.Controls.Add(this.reloadPreviousResultsButton);
this.splitContainer.Panel1.Controls.Add(this.columnWidthsButton);
this.splitContainer.Panel1.Controls.Add(this.showPreviousResultsButton);
@ -63,10 +88,101 @@ namespace TBF.Screens
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.flowLayoutPanel);
this.splitContainer.Size = new System.Drawing.Size(1057, 706);
this.splitContainer.Size = new System.Drawing.Size(1222, 706);
this.splitContainer.SplitterDistance = 42;
this.splitContainer.TabIndex = 0;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(1124, 19);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 13);
this.label5.TabIndex = 13;
this.label5.Text = "label5";
this.label5.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(1004, 19);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(35, 13);
this.label4.TabIndex = 12;
this.label4.Text = "label4";
this.label4.Visible = false;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(884, 19);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 11;
this.label3.Text = "label3";
this.label3.Visible = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(739, 19);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 10;
this.label2.Text = "label2";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(644, 19);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 9;
this.label1.Text = "label1";
//
// pictureBox5
//
this.pictureBox5.Location = new System.Drawing.Point(1090, 10);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(28, 29);
this.pictureBox5.TabIndex = 8;
this.pictureBox5.TabStop = false;
this.pictureBox5.Visible = false;
//
// pictureBox4
//
this.pictureBox4.Location = new System.Drawing.Point(970, 10);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(28, 29);
this.pictureBox4.TabIndex = 7;
this.pictureBox4.TabStop = false;
this.pictureBox4.Visible = false;
//
// pictureBox3
//
this.pictureBox3.Location = new System.Drawing.Point(850, 10);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(28, 29);
this.pictureBox3.TabIndex = 6;
this.pictureBox3.TabStop = false;
this.pictureBox3.Visible = false;
//
// pictureBox2
//
this.pictureBox2.Location = new System.Drawing.Point(705, 10);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(28, 29);
this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(610, 10);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(28, 29);
this.pictureBox1.TabIndex = 4;
this.pictureBox1.TabStop = false;
//
// reloadPreviousResultsButton
//
this.reloadPreviousResultsButton.Enabled = false;
@ -115,7 +231,7 @@ namespace TBF.Screens
this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel.Name = "flowLayoutPanel";
this.flowLayoutPanel.Size = new System.Drawing.Size(1057, 660);
this.flowLayoutPanel.Size = new System.Drawing.Size(1222, 660);
this.flowLayoutPanel.TabIndex = 0;
//
// ResultsTabPageCtrl
@ -126,12 +242,18 @@ namespace TBF.Screens
this.Controls.Add(this.splitContainer);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
this.Name = "ResultsTabPageCtrl";
this.Size = new System.Drawing.Size(1057, 706);
this.Size = new System.Drawing.Size(1222, 706);
this.Load += new System.EventHandler(this.ResultsTabPageCtrl_Load);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel1.PerformLayout();
this.splitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
this.splitContainer.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
@ -144,5 +266,15 @@ namespace TBF.Screens
private System.Windows.Forms.Button columnWidthsButton;
private System.Windows.Forms.Button showPreviousResultsButton;
private System.Windows.Forms.Button reloadPreviousResultsButton;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View File

@ -20,6 +20,16 @@ namespace TBF.Screens
{
static readonly ILog log = LogManager.GetLogger(typeof(ResultsTabPageCtrl));
static readonly Color NotCompletedColor = Color.White;
static readonly Color OkColor = Color.LightGreen;
static readonly Color NokColor = Color.LightPink;
static readonly Color RejectColor = Color.Magenta;
static readonly Color ProductionTracing = Color.RoyalBlue;
static readonly Color WrongDirection = Color.Gold;
static readonly Color WrongQ2FactorsColor = Color.Red;
public MetersArrangement MetersArrangement;
public TestsArrangement TestsArrangement;
public int NrMetersInOneGroup;
@ -103,7 +113,31 @@ namespace TBF.Screens
showPreviousResultsButton.Text = Strings.Previous_results;
reloadPreviousResultsButton.Text = Strings.Reload_previous_results;
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
pictureBox1.BackColor = OkColor;
label1.Text = Strings.Passed;
pictureBox2.BackColor = NokColor;
label2.Text = Strings.Failed;
#if TURA_IPERL || TURA_SPECIAL
label2.Text += " (zopakovať)";
pictureBox3.BackColor = RejectColor;
pictureBox3.Visible = true;
label3.Text = "Vyradiť";
label3.Visible = true;
pictureBox4.BackColor = WrongDirection;
pictureBox4.Visible = true;
label4.Text = "Otočiť smer";
label4.Visible = true;
pictureBox5.BackColor = ProductionTracing;
pictureBox5.Visible = true;
label5.Text = "Vrátiť na predch. krok";
label5.Visible = true;
#endif
RedrawAll(TBF.BenchControl.Sequences.ProcessData.BatchRslts);
}
@ -300,6 +334,57 @@ namespace TBF.Screens
return testNames;
}
/// <summary>
/// Get color for highlighting results and an apporpriate text message.
/// </summary>
/// <param name="wMtr">Water meter results entity</param>
/// <param name="message">Appropriate message</param>
/// <returns>Color for results</returns>
Color GetColorOfResults(Results.Entities.WaterMeter wMtr, out string message)
{
bool wmtrCompleted = wMtr.CompletedFromTests();
bool wmtrPassed = wMtr.PassedFromTests();
if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E28) != 0)
{
message = Strings.Previous_step_is_missing_or_NOK;
return ProductionTracing;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E27) != 0)
{
message = Strings.Wrong_iPerl_counting_direction;
return WrongDirection;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E26) != 0)
{
message = Strings.Invalid_Q2_correction_factors;
return WrongQ2FactorsColor;
}
else if ((wMtr.ErrorFlags & (int)ErrorFlagMask.E25) != 0)
{
message = Strings.Test_repetition_count_exceeded_upper_limit;
return RejectColor;
}
else if (wmtrPassed)
{
/// Water meter passed (therefore is was also completed)
message = Strings.Passed;
return OkColor;
}
else if (wmtrCompleted)
{
/// Water meter was completed but did not pass => Failed
message = Strings.Failed;
return NokColor;
}
else
{
/// Water meter was not completed yet => did not pass, did not fail
message = Strings.Test_in_progress;
return NotCompletedColor;
}
}
/// <summary>
/// Get a ListView control filled with results of the meter 'mtr'
@ -309,20 +394,12 @@ namespace TBF.Screens
OneWMResultsCtrl GetResultsTestsAreRows(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
bool wmtrCompleted = wMtr.CompletedFromTests();
bool wmtrPassed = wMtr.PassedFromTests();
Color commonBackColor = wmtrPassed ? Color.LightGreen : (wmtrCompleted ? Color.LightPink : Color.White);
#if ORACLE_DB
if (TBF.BenchControl.Sequences.ProcessData.BenchInfo is TBF.BenchControl.BenchInfo.iPerl.Component)
{
int maxTrials = (TBF.BenchControl.Sequences.ProcessData.BenchInfo as TBF.BenchControl.BenchInfo.iPerl.Component).MaxTestIndex;
if (wmtrCompleted && !wmtrPassed && ((wMtr.Pruefindex % 100) >= maxTrials)) commonBackColor = Color.DarkOrange;
}
#endif
string message = string.Empty;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
#if ORACLE_DB
lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100));
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
@ -395,10 +472,12 @@ namespace TBF.Screens
OneWMResultsCtrl GetResultsTestsAreColumns(Results.Entities.WaterMeter wMtr, int printedWMNr)
{
metersKind = wMtr.Compound() ? MetersKind.Combined : (wMtr.HeatMeter() ? MetersKind.HeatMeter : MetersKind.Single);
Color commonBackColor = wMtr.PassedFromTests() ? Color.LightGreen : (wMtr.CompletedFromTests() ? Color.LightPink : Color.White);
string message;
Color commonBackColor = GetColorOfResults(wMtr, out message);
OneWMResultsCtrl lview = GetListView(commonBackColor);
#if ORACLE_DB
lview.Caption = string.Format("PCB {0} {1} {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), Strings.repetition, (wMtr.Pruefindex % 100));
lview.Caption = string.Format("{0} ({1}) {2}", (string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr), (wMtr.Pruefindex % 100), message);
#else
lview.Caption = string.Format("s/n = {0}", string.IsNullOrEmpty(wMtr.SerialNr) ? string.Empty : wMtr.SerialNr);
#endif
@ -458,9 +537,9 @@ namespace TBF.Screens
return lview;
}
#endregion
#endregion Redraw
private void columnWidthsButton_Click(object sender, EventArgs e)
private void columnWidthsButton_Click(object sender, EventArgs e)
{
if (firstListView == null) return;

View File

@ -1403,12 +1403,6 @@
<Compile Include="BenchControl\Various\ErrorFlags\TestParams.cs" />
<Compile Include="BenchControl\Various\ErrorFlags\Errors.cs" />
<Compile Include="BenchControl\Various\ErrorFlags\ErrorsCfg.cs" />
<Compile Include="BenchControl\Various\ErrorFlags\ErrorsCfgCtrl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="BenchControl\Various\ErrorFlags\ErrorsCfgCtrl.designer.cs">
<DependentUpon>ErrorsCfgCtrl.cs</DependentUpon>
</Compile>
<Compile Include="BenchControl\Various\ManualLevelMsrmnt\ManualLevelMsrmnt.cs" />
<Compile Include="BenchControl\Various\ManualLevelMsrmnt\Factory.cs" />
<Compile Include="BenchControl\Various\ManualLevelMsrmnt\WaterLevelForm.cs">
@ -2824,9 +2818,6 @@
<EmbeddedResource Include="BenchControl\TestMethods\PMaxTest\TestMethodCfgCtrl.resx">
<DependentUpon>TestMethodCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Various\ErrorFlags\ErrorsCfgCtrl.resx">
<DependentUpon>ErrorsCfgCtrl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="BenchControl\Various\ManualLevelMsrmnt\WaterLevelForm.resx">
<DependentUpon>WaterLevelForm.cs</DependentUpon>
</EmbeddedResource>