ReSharper: -LegacyGenesisControl\ctlBatch - Part 3
This commit is contained in:
@@ -105,7 +105,10 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
private DataTable dtBatch;
|
private DataTable dtBatch;
|
||||||
#region busy
|
#region busy
|
||||||
public Boolean IsBusy { get; private set; }
|
public Boolean IsBusy
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
private Int32? ProgressTotal;
|
private Int32? ProgressTotal;
|
||||||
private Int32? ProgressCurrent;
|
private Int32? ProgressCurrent;
|
||||||
@@ -114,8 +117,11 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
private Dictionary<Int32, String> slotLut = new Dictionary<Int32, String>();
|
private Dictionary<Int32, String> slotLut = new Dictionary<Int32, String>();
|
||||||
private Dictionary<Int32, Boolean> slotPreadjustment = new Dictionary<Int32, Boolean>();
|
private Dictionary<Int32, Boolean> slotPreadjustment = new Dictionary<Int32, Boolean>();
|
||||||
private Dictionary<String, Tuple<Label, String>> labelValueCollection;
|
private Dictionary<String, Tuple<Label, String>> labelValueCollection;
|
||||||
|
|
||||||
public Boolean IsFlyingStartStop { get; private set; }
|
public Boolean IsFlyingStartStop
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Double StoreRefVolume, StoreTestTimeRef;
|
private Double StoreRefVolume, StoreTestTimeRef;
|
||||||
@@ -128,7 +134,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
{
|
{
|
||||||
|
|
||||||
_logger = NLogHelper.CreateOrGetMultiLogger("ctlBatch", "", "Batch", "", "");
|
_logger = NLogHelper.CreateOrGetMultiLogger("ctlBatch", "", "Batch", "", "");
|
||||||
_logger.Info($"start construct ctlBatch");
|
_logger.Info("start construct ctlBatch");
|
||||||
//RefreshTimerWatch.Enabled = true;
|
//RefreshTimerWatch.Enabled = true;
|
||||||
//RefreshTimerWatch.Interval = 5000;
|
//RefreshTimerWatch.Interval = 5000;
|
||||||
//RefreshTimerWatch.Tick += RefreshTimerWatch_Tick;
|
//RefreshTimerWatch.Tick += RefreshTimerWatch_Tick;
|
||||||
@@ -142,10 +148,10 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
//kick off the state machine
|
//kick off the state machine
|
||||||
_currentState = BatchState.Init;
|
_currentState = BatchState.Init;
|
||||||
_backupState = BatchState.Idle;
|
_backupState = BatchState.Idle;
|
||||||
_logger.Info($"construct ctlBatch end");
|
_logger.Info("construct ctlBatch end");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CtlBatch_Disposed(Object sender, EventArgs e)
|
private void CtlBatch_Disposed(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -155,7 +161,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error at CtlBatch_Disposed");
|
_logger.Error(ex, "error at CtlBatch_Disposed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -297,8 +303,11 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TryInvoke(new Action(() => { probarBusy.Value = (Int32)Math.Round(
|
TryInvoke(new Action(() =>
|
||||||
ProgressCurrent.Value / (Double)ProgressTotal.Value * 100, 0); }));
|
{
|
||||||
|
probarBusy.Value = (Int32)Math.Round(
|
||||||
|
ProgressCurrent.Value / (Double)ProgressTotal.Value * 100, 0);
|
||||||
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@@ -356,7 +365,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error at RefreshTimerWatch_Tick()");
|
_logger.Error(ex, "error at RefreshTimerWatch_Tick()");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -513,7 +522,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
private T getCellValue<T>(String Row, Int32 Slot)
|
private T getCellValue<T>(String Row, Int32 Slot)
|
||||||
{
|
{
|
||||||
if (dgvBatch != null && dgvBatch.Rows.Count > rowIndex.First(k => k.Value == Row).Key
|
if (dgvBatch != null && dgvBatch.Rows.Count > rowIndex.First(k => k.Value == Row).Key
|
||||||
&& dgvBatch.Rows[rowIndex.First(k => k.Value == Row).Key].Cells.Count > Slot)
|
&& dgvBatch.Rows[rowIndex.First(k => k.Value == Row).Key].Cells.Count > Slot)
|
||||||
{
|
{
|
||||||
var currentRowIndex = rowIndex.First(k => k.Value == Row).Key;
|
var currentRowIndex = rowIndex.First(k => k.Value == Row).Key;
|
||||||
@@ -924,7 +933,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
setBusy(true, $"Setze Fehlergrenze");
|
setBusy(true, "Setze Fehlergrenze");
|
||||||
updateCell("Fehlergrenze [%]", slot, errorFrame);
|
updateCell("Fehlergrenze [%]", slot, errorFrame);
|
||||||
|
|
||||||
if (slotErrorFrameDic.ContainsKey(slot))
|
if (slotErrorFrameDic.ContainsKey(slot))
|
||||||
@@ -957,7 +966,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrepareMeters(String meterDn = "-", Double refPulseValence = 0.0, Double predictedQFlow = 0.0,
|
public void PrepareMeters(String meterDn = "-", Double refPulseValence = 0.0, Double predictedQFlow = 0.0,
|
||||||
Double predictedTs = 0.0, Double refError = 0.0, Boolean isAdjustment = false, Boolean isFlyingStartStop = true)
|
Double predictedTs = 0.0, Double refError = 0.0, Boolean isAdjustment = false, Boolean isFlyingStartStop = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -968,7 +977,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
||||||
WarningMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
WarningMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||||
ErrorMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
ErrorMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||||
setBusy(true, $"Bereite Zähler vor");
|
setBusy(true, "Bereite Zähler vor");
|
||||||
|
|
||||||
initAction(meterDn, refPulseValence, predictedQFlow, predictedTs, refError, isFlyingStartStop);
|
initAction(meterDn, refPulseValence, predictedQFlow, predictedTs, refError, isFlyingStartStop);
|
||||||
_isAdjustment = isAdjustment;
|
_isAdjustment = isAdjustment;
|
||||||
@@ -1003,9 +1012,9 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
if (_useRequest)
|
if (_useRequest)
|
||||||
{
|
{
|
||||||
var r = ((GenesisMeter)meter).ReLogin();
|
((GenesisMeter)meter).ReLogin();
|
||||||
((GenesisMeter)meter).WriteLog("Prepare meter for Measurement/Adjustment ");
|
((GenesisMeter)meter).WriteLog("Prepare meter for Measurement/Adjustment ");
|
||||||
_logger.Debug($"Prepare Meters for Measurement/Adjustment");
|
_logger.Debug("Prepare Meters for Measurement/Adjustment");
|
||||||
if (isAdjustment)
|
if (isAdjustment)
|
||||||
{
|
{
|
||||||
((GenesisMeter)meter).InitCalibration();
|
((GenesisMeter)meter).InitCalibration();
|
||||||
@@ -1020,10 +1029,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(UpdateBatch));
|
||||||
{
|
|
||||||
UpdateBatch();
|
|
||||||
}));
|
|
||||||
|
|
||||||
CheckMetersAreReadyForTest();
|
CheckMetersAreReadyForTest();
|
||||||
setBusy(false);
|
setBusy(false);
|
||||||
@@ -1088,16 +1094,16 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
_logger.Info($" Meter {meter.Slot} Meter no update display; loops left {i}; state {state}");
|
_logger.Info($" Meter {meter.Slot} Meter no update display; loops left {i}; state {state}");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.Error(ex, $" Meter {meter.Slot} CheckMetersAreReadyForTest loops {i};delay {sleepTimeS}S");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
updateCell($"Status", meter.Slot, $"Warte auf Zählerstand wechsel ", Color.LightYellow);
|
updateCell("Status", meter.Slot, "Warte auf Zählerstand wechsel ", Color.LightYellow);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1109,7 +1115,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
_logger.Info($" Meter {meter.Slot} Meter has NO! progress");
|
_logger.Info($" Meter {meter.Slot} Meter has NO! progress");
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
updateCell($"Status", meter.Slot, $"Zählerstand wechsel nicht erfasst", Color.LightPink);
|
updateCell("Status", meter.Slot, "Zählerstand wechsel nicht erfasst", Color.LightPink);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1127,10 +1133,10 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
private void CheckMetersAreReadyForTest()
|
private void CheckMetersAreReadyForTest()
|
||||||
{
|
{
|
||||||
_logger.Trace($"CheckMetersAreReadyForTest");
|
_logger.Trace("CheckMetersAreReadyForTest");
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
lblAction.Text = "Warte auf Zählerstand wechsel von allen Zählern";
|
lblAction.Text = @"Warte auf Zählerstand wechsel von allen Zählern";
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -1143,16 +1149,13 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
if (!(meter is GenesisMeter))
|
if (!(meter is GenesisMeter))
|
||||||
{
|
{
|
||||||
if (!(meter is GenesisMeter))
|
continue;
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
|
|
||||||
updateCell($"Status", meter.Slot, $"Warte auf Zählerstand wechsel", Color.LightYellow);
|
updateCell("Status", meter.Slot, "Warte auf Zählerstand wechsel", Color.LightYellow);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
@@ -1170,8 +1173,9 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var r = ((GenesisMeter)meter).GetMainMeasurementResult(null, null, true);
|
var r = ((GenesisMeter)meter).GetMainMeasurementResult(null, null, true);
|
||||||
i = i - sleepTimeS;
|
i -= sleepTimeS;
|
||||||
if (r.DutVolumeCm != 0)
|
|
||||||
|
if (r.DutVolumeCm != 0.0d)
|
||||||
{
|
{
|
||||||
_logger.Info($" Meter {meter.Slot} Meter has progress {r.DutVolumeCm}");
|
_logger.Info($" Meter {meter.Slot} Meter has progress {r.DutVolumeCm}");
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
@@ -1181,13 +1185,11 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
MeterReadyForTest = true;
|
MeterReadyForTest = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
_logger.Info($" Meter {meter.Slot} display frozen {r.DutVolumeCm} ccm; loops left {i} s");
|
||||||
{
|
|
||||||
_logger.Info($" Meter {meter.Slot} Meter no update display {r.DutVolumeCm}; loops left {i}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
_logger.Error(ex, $" Meter {meter.Slot} Meter has progress error");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1195,7 +1197,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
updateCell($"Status", meter.Slot, $"Warte auf Zählerstand wechsel ", Color.LightYellow);
|
updateCell("Status", meter.Slot, "Warte auf Zählerstand wechsel ", Color.LightYellow);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1206,7 +1208,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
_logger.Info($" Meter {meter.Slot} Meter has NO! progress");
|
_logger.Info($" Meter {meter.Slot} Meter has NO! progress");
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
updateCell($"Status", meter.Slot, $"Zählerstand wechsel nicht erfasst", Color.LightPink);
|
updateCell("Status", meter.Slot, "Zählerstand wechsel nicht erfasst", Color.LightPink);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1293,7 +1295,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
{
|
{
|
||||||
if (item is GenesisMeter gm)
|
if (item is GenesisMeter gm)
|
||||||
{
|
{
|
||||||
gm.CurrentActionText = $"FlowTest";
|
gm.CurrentActionText = "FlowTest";
|
||||||
}
|
}
|
||||||
var settings = TestSetupContainer.meterTestSettings.First(f => f != null && f.Slot == item.Slot);
|
var settings = TestSetupContainer.meterTestSettings.First(f => f != null && f.Slot == item.Slot);
|
||||||
|
|
||||||
@@ -1446,7 +1448,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error on GetCalibrationIsDone");
|
_logger.Error(ex, "error on GetCalibrationIsDone");
|
||||||
return LegacyCalibrationResult.CheckAllMeters;
|
return LegacyCalibrationResult.CheckAllMeters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1473,7 +1475,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error on GetCalibrationIsDone");
|
_logger.Error(ex, "error on GetCalibrationIsDone");
|
||||||
return LegacyCalibrationResult.CheckAllMeters;
|
return LegacyCalibrationResult.CheckAllMeters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1526,7 +1528,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
updateCell("Einbauplatz", Slot, Slot.ToString());
|
updateCell("Einbauplatz", Slot, Slot.ToString());
|
||||||
updateCell("Seriennummer", Slot, SerialNumber);
|
updateCell("Seriennummer", Slot, SerialNumber);
|
||||||
updateCell("PcbId", Slot, PcbId);
|
updateCell("PcbId", Slot, PcbId);
|
||||||
|
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
{
|
{
|
||||||
dgvBatch.Columns[Slot].Visible = true;
|
dgvBatch.Columns[Slot].Visible = true;
|
||||||
@@ -1568,7 +1570,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
private void initAction(String meterDn = "-", Double refPulseValence = 0, Double predictedQFlow = 0,
|
private void initAction(String meterDn = "-", Double refPulseValence = 0, Double predictedQFlow = 0,
|
||||||
Double predictedTs = 0, Double refError = 0, Boolean isFlyingStartStop = true)
|
Double predictedTs = 0, Double refError = 0, Boolean isFlyingStartStop = true)
|
||||||
{
|
{
|
||||||
TryInvoke(new Action(() =>
|
TryInvoke(new Action(() =>
|
||||||
@@ -1599,7 +1601,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(String meterDn = "-", Double refPulseValence = 0, Double predictedQFlow = 0, Double predictedTs = 0,
|
public void Init(String meterDn = "-", Double refPulseValence = 0, Double predictedQFlow = 0, Double predictedTs = 0,
|
||||||
Double refError = 0, Boolean isFlyingStartStop = true)
|
Double refError = 0, Boolean isFlyingStartStop = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1664,7 +1666,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
|
|
||||||
if ((_isAdjustment && !settings.FlowAdjustment) || (!_isAdjustment && !settings.FlowTesting))
|
if ((_isAdjustment && !settings.FlowAdjustment) || (!_isAdjustment && !settings.FlowTesting))
|
||||||
{
|
{
|
||||||
updateCell($"Status", item.Slot, "-", Color.Gray);
|
updateCell("Status", item.Slot, "-", Color.Gray);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1696,7 +1698,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCell($"Status", _meter.Slot, textState, statusColor);
|
updateCell("Status", _meter.Slot, textState, statusColor);
|
||||||
Double? testTime = null;
|
Double? testTime = null;
|
||||||
if (IsFlyingStartStop)
|
if (IsFlyingStartStop)
|
||||||
{
|
{
|
||||||
@@ -1818,7 +1820,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error on Clear()");
|
_logger.Error(ex, "error on Clear()");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1852,7 +1854,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error on ManuleUpdate()");
|
_logger.Error(ex, "error on ManuleUpdate()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1981,7 +1983,7 @@ namespace XylemCommonUiLegacyGenCtl
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"error on btnOk_Click()");
|
_logger.Error(ex, "error on btnOk_Click()");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void btnUpdate_Click(Object sender, EventArgs e)
|
private void btnUpdate_Click(Object sender, EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user