Start implementation of StateMachine ctlBatch
This commit is contained in:
parent
633709b4f9
commit
e65a755954
@ -62,17 +62,6 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
/// <param name="slot">Slot (einbauplatz) the meter is attached/installed </param>
|
||||
void AddMeter(string serialNumber, int slot);
|
||||
|
||||
/// <summary>
|
||||
/// obsolete
|
||||
/// </summary>
|
||||
/// <param name="useRequest"></param>
|
||||
/// <param name="rawLogging"></param>
|
||||
/// <param name="checkAllChannels"></param>
|
||||
/// <param name="manualAdjustment"></param>
|
||||
/// <param name="ControlSrt"></param>
|
||||
void PrepareBatch(bool useRequest,bool rawLogging, bool checkAllChannels, bool manualAdjustment, string ControlSrt);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the meter in the Idle mode with the state from the TestRun (meter failed or Succeed)
|
||||
/// </summary>
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
/// <summary>
|
||||
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,4 +120,7 @@
|
||||
<metadata name="timProgress.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="timStateMachine.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>142, 19</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Loading…
Reference in New Issue
Block a user