diff --git a/Common/Ui/LegacyGenesisControl/ICtlBatch.cs b/Common/Ui/LegacyGenesisControl/ICtlBatch.cs
index 331108ae..4c563681 100644
--- a/Common/Ui/LegacyGenesisControl/ICtlBatch.cs
+++ b/Common/Ui/LegacyGenesisControl/ICtlBatch.cs
@@ -62,17 +62,6 @@ namespace XylemCommonUiLegacyGenCtl
/// Slot (einbauplatz) the meter is attached/installed
void AddMeter(string serialNumber, int slot);
- ///
- /// obsolete
- ///
- ///
- ///
- ///
- ///
- ///
- void PrepareBatch(bool useRequest,bool rawLogging, bool checkAllChannels, bool manualAdjustment, string ControlSrt);
-
-
///
/// Set the meter in the Idle mode with the state from the TestRun (meter failed or Succeed)
///
diff --git a/Common/Ui/LegacyGenesisControl/ctlBatch.Designer.cs b/Common/Ui/LegacyGenesisControl/ctlBatch.Designer.cs
index 80d90e1e..33056c6c 100644
--- a/Common/Ui/LegacyGenesisControl/ctlBatch.Designer.cs
+++ b/Common/Ui/LegacyGenesisControl/ctlBatch.Designer.cs
@@ -40,6 +40,7 @@
this.lblEndTime = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pgbEndTime = new System.Windows.Forms.ProgressBar();
+ this.timStateMachine = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.dgvBatch)).BeginInit();
this.pnlCalibration.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudFactor)).BeginInit();
@@ -300,6 +301,12 @@
this.pgbEndTime.Size = new System.Drawing.Size(529, 22);
this.pgbEndTime.TabIndex = 0;
//
+ // timStateMachine
+ //
+ this.timStateMachine.Enabled = true;
+ this.timStateMachine.Interval = 500;
+ this.timStateMachine.Tick += new System.EventHandler(this.timStateMachine_Tick);
+ //
// ctlBatch
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -357,6 +364,7 @@
private System.Windows.Forms.Label lblEndTime;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ProgressBar pgbEndTime;
+ private System.Windows.Forms.Timer timStateMachine;
}
}
diff --git a/Common/Ui/LegacyGenesisControl/ctlBatch.cs b/Common/Ui/LegacyGenesisControl/ctlBatch.cs
index 008340fd..ed8e0177 100644
--- a/Common/Ui/LegacyGenesisControl/ctlBatch.cs
+++ b/Common/Ui/LegacyGenesisControl/ctlBatch.cs
@@ -63,7 +63,13 @@ namespace XylemCommonUiLegacyGenCtl
PrepareGui,
PrepareMeasurement,
MeasurementActive,
- MeasurementCompleted
+ MeasurementCompleted,
+ TestContainerIsReady,
+ BatchIsReady,
+ AddMeters,
+ MetersAdded,
+ PrepareMeters,
+ MetersPrepared,
}
private BatchState _currentState;
@@ -306,8 +312,8 @@ namespace XylemCommonUiLegacyGenCtl
{
TryInvoke(new Action(() =>
{
- probarBusy.Value = (Int32)Math.Round(
- ProgressCurrent.Value / (Double)ProgressTotal.Value * 100, 0);
+ probarBusy.Value = (Int32)Math.Round(ProgressCurrent.Value /
+ (Double)ProgressTotal.Value * 100, 0);
}));
}
@@ -680,56 +686,65 @@ namespace XylemCommonUiLegacyGenCtl
{
try
{
-
_logger.Trace($"PrepareBatch ControlSrt : {ControlSrt} ");
batch = new MeterBatch();
_useRequest = true;
_rawLogging = true;
_checkAllChannels = TestSetupContainer.AllChanelsRequired;
- //TryInvoke(new Action(() =>
- //{
- // this.RefeshTimer.Enabled = true;
- //}));
+ _currentState = BatchState.BatchIsReady;
}
catch (Exception ex)
{
_logger.Error(ex, $"error at ControlSrt : {ControlSrt}");
+ _currentState = BatchState.Error;
}
}
public void AddAllMeters()
{
+ _currentState = BatchState.AddMeters;
setBusy(true, "alle Zähler hinzufügen");
-
- foreach (var item in TestSetupContainer.meterTestSettings)
+ try
{
-
- if (item != null && (item.FlowAdjustment || item.FlowTesting))
+ if (TestSetupContainer == null)
{
- if (!batch.ListOfMeters.Any(f => f.Slot == item.Slot))
+ _currentState = BatchState.Error;
+ _logger.Error("Test setup container missing");
+ return;
+ }
+ foreach (var item in TestSetupContainer.meterTestSettings)
+ {
+ if (item != null && (item.FlowAdjustment || item.FlowTesting))
{
+ if (batch.ListOfMeters.All(f => f.Slot != item.Slot))
+ {
- var meter = new GenesisMeter();
- meter.SerialNumber = item.SerialNr;
- meter.CurrentActionText = "FlowTest";
- meter.SetupFromConfigFile(item.Slot, false, _useRequest, true);
- meter.LogRawData(_rawLogging);
+ var meter = new GenesisMeter();
+ meter.SerialNumber = item.SerialNr;
+ meter.CurrentActionText = "FlowTest";
+ meter.SetupFromConfigFile(item.Slot, false, _useRequest, true);
+ meter.LogRawData(_rawLogging);
- batch.AddMeter(meter);
- meter.Login();
- meter.EnableAutoLogon();
- meter.WriteLog("Add from AddAllMeters");
+ batch.AddMeter(meter);
+ meter.Login();
+ meter.EnableAutoLogon();
+ meter.WriteLog("Add from AddAllMeters");
+ }
}
}
+ _currentState = BatchState.MetersAdded;
+ setBusy(false);
+ }
+ catch (Exception ex)
+ {
+ setBusy(false);
+ _logger.Error(ex, "Add all meters failed");
+ _currentState = BatchState.Error;
}
-
-
-
- setBusy(false);
-
}
+
public void AddMeter(String serialNumber, Int32 slot, Boolean SkipPrepearation)
{
try
@@ -1738,8 +1753,6 @@ namespace XylemCommonUiLegacyGenCtl
}
if (interResult != null && interResult.Any())
{
-
-
foreach (var channelResult in interResult)
{
@@ -1763,14 +1776,9 @@ namespace XylemCommonUiLegacyGenCtl
"NaN",
getErrorColor(100, _meter.Slot));
}
-
-
-
-
}
}
}
-
}
}
catch (Exception e)
@@ -1784,7 +1792,7 @@ namespace XylemCommonUiLegacyGenCtl
currentMode = Mode.View;
TryInvoke(new Action(() =>
{
- //this.RefeshTimer.Enabled = false;
+ //this.RefreshTimer.Enabled = false;
//this.pnlEndTime.Visible = false;
}));
}
@@ -1795,7 +1803,7 @@ namespace XylemCommonUiLegacyGenCtl
TryInvoke(new Action(() =>
{
- //this.RefeshTimer.Enabled = true;
+ //this.RefreshTimer.Enabled = true;
}));
stopWatch.Start();
@@ -1961,22 +1969,20 @@ namespace XylemCommonUiLegacyGenCtl
{
var r = MessageBox.Show(@"Calibration went wrong", @"Retry", MessageBoxButtons.AbortRetryIgnore);
- foreach (var changesta in CalibrationIsDone.ToList())
+ foreach (var changeState in CalibrationIsDone.ToList())
{
- if (changesta.Value != LegacyCalibrationResult.Good)
+ if (changeState.Value != LegacyCalibrationResult.Good)
{
switch (r)
{
case DialogResult.Abort:
- CalibrationIsDone[changesta.Key] = LegacyCalibrationResult.BadAbort;
+ CalibrationIsDone[changeState.Key] = LegacyCalibrationResult.BadAbort;
break;
case DialogResult.Ignore:
- CalibrationIsDone[changesta.Key] = LegacyCalibrationResult.BadIgnor;
+ CalibrationIsDone[changeState.Key] = LegacyCalibrationResult.BadIgnor;
break;
}
}
-
-
}
}
}
@@ -2077,10 +2083,6 @@ namespace XylemCommonUiLegacyGenCtl
//181
dgvBatch.Width = Width - 181;
}
-
-
-
-
#endregion
///
@@ -2172,12 +2174,18 @@ namespace XylemCommonUiLegacyGenCtl
_logger.Info($"SetTestSetupContainer ({sb}) ");
//MessageBox.Show(sb.ToString());
TestSetupContainer = vbContainer;
+ _currentState = BatchState.TestContainerIsReady;
+ return;
}
+
+ _logger.Error("Test container setup failed");
+ _currentState = BatchState.Error;
}
- public void PrepareBatch(Boolean useRequest, Boolean rawLogging, Boolean checkAllChannels, Boolean manualAdjustment, String ControlSrt)
+ private void timStateMachine_Tick(Object sender, EventArgs e)
{
- throw new NotImplementedException();
+ CtlBatchStateMachine();
}
+
}
}
diff --git a/Common/Ui/LegacyGenesisControl/ctlBatch.resx b/Common/Ui/LegacyGenesisControl/ctlBatch.resx
index 80618e64..b79a6b46 100644
--- a/Common/Ui/LegacyGenesisControl/ctlBatch.resx
+++ b/Common/Ui/LegacyGenesisControl/ctlBatch.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 142, 19
+
\ No newline at end of file