Stand von WE . Prüfung laufen gut
This commit is contained in:
@@ -957,8 +957,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
if (string.IsNullOrEmpty(PcbId))
|
||||
{
|
||||
//GetPcbId fills the PsbId property
|
||||
if (string.IsNullOrEmpty(GetPcbId()))
|
||||
return "";
|
||||
|
||||
if (string.IsNullOrEmpty(GetPcbId()) || string.IsNullOrEmpty(PcbId) || PcbId.Length < 8)
|
||||
{
|
||||
if (string.IsNullOrEmpty(GetPcbId()))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
url += PcbId;
|
||||
@@ -983,12 +991,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
{
|
||||
_logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
|
||||
$"URL({url}), Error({ex.Message})");
|
||||
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(File.ReadAllText(ProgramConfig.OfflineInfoFile));
|
||||
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
|
||||
if (!string.IsNullOrEmpty(password))
|
||||
if (File.Exists(ProgramConfig.OfflineInfoFile))
|
||||
{
|
||||
_logger.Info($"Slot:{Slot} - Got password from password file!");
|
||||
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(File.ReadAllText(ProgramConfig.OfflineInfoFile));
|
||||
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
|
||||
if (!string.IsNullOrEmpty(password))
|
||||
{
|
||||
_logger.Info($"Slot:{Slot} - Got password from password file!");
|
||||
}
|
||||
}
|
||||
|
||||
password = "";
|
||||
|
||||
}
|
||||
|
||||
return password;
|
||||
@@ -1003,7 +1017,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
if (string.IsNullOrEmpty(_password) || string.IsNullOrEmpty(PcbId))
|
||||
{
|
||||
var password = GetPassword();
|
||||
return !string.IsNullOrEmpty(password) && Login(password);
|
||||
if (string.IsNullOrEmpty(password))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Login(password);
|
||||
}
|
||||
|
||||
return Login(_password);
|
||||
|
||||
+58
-4
@@ -31,6 +31,12 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtPcbId = new System.Windows.Forms.TextBox();
|
||||
this.btnLoadHistory = new System.Windows.Forms.Button();
|
||||
@@ -98,6 +104,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvCalibrationResults.AutoGenerateColumns = false;
|
||||
this.dgvCalibrationResults.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvCalibrationResults.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvCalibrationResults.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvCalibrationResults.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.dbIdDataGridViewTextBoxColumn,
|
||||
@@ -118,12 +132,28 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
this.toFTempOffset3DataGridViewTextBoxColumn,
|
||||
this.dateDataGridViewTextBoxColumn});
|
||||
this.dgvCalibrationResults.DataSource = this.calibrationResultBindingSource;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvCalibrationResults.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dgvCalibrationResults.Location = new System.Drawing.Point(12, 45);
|
||||
this.dgvCalibrationResults.MultiSelect = false;
|
||||
this.dgvCalibrationResults.Name = "dgvCalibrationResults";
|
||||
this.dgvCalibrationResults.ReadOnly = true;
|
||||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvCalibrationResults.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
|
||||
this.dgvCalibrationResults.RowHeadersVisible = false;
|
||||
this.dgvCalibrationResults.Size = new System.Drawing.Size(1684, 150);
|
||||
this.dgvCalibrationResults.Size = new System.Drawing.Size(1516, 150);
|
||||
this.dgvCalibrationResults.TabIndex = 6;
|
||||
this.dgvCalibrationResults.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCalibrationResults_CellClick);
|
||||
this.dgvCalibrationResults.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvCalibrationResults_CellContentClick);
|
||||
@@ -266,7 +296,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//
|
||||
// calibrationResultBindingSource
|
||||
//
|
||||
this.calibrationResultBindingSource.DataSource = typeof(CalibrationResult);
|
||||
this.calibrationResultBindingSource.DataSource = typeof(Logic.ProductionToProductMapper.Cordonel.CalibrationResult);
|
||||
//
|
||||
// dgvAdditionalLoginfo
|
||||
//
|
||||
@@ -276,17 +306,41 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
this.dgvAdditionalLoginfo.AllowUserToResizeRows = false;
|
||||
this.dgvAdditionalLoginfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvAdditionalLoginfo.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.dgvAdditionalLoginfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvAdditionalLoginfo.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.ID,
|
||||
this.Key,
|
||||
this.Text});
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvAdditionalLoginfo.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.dgvAdditionalLoginfo.Location = new System.Drawing.Point(15, 212);
|
||||
this.dgvAdditionalLoginfo.MultiSelect = false;
|
||||
this.dgvAdditionalLoginfo.Name = "dgvAdditionalLoginfo";
|
||||
this.dgvAdditionalLoginfo.ReadOnly = true;
|
||||
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dgvAdditionalLoginfo.RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
|
||||
this.dgvAdditionalLoginfo.RowHeadersVisible = false;
|
||||
this.dgvAdditionalLoginfo.Size = new System.Drawing.Size(1681, 150);
|
||||
this.dgvAdditionalLoginfo.Size = new System.Drawing.Size(1513, 150);
|
||||
this.dgvAdditionalLoginfo.TabIndex = 7;
|
||||
//
|
||||
// ID
|
||||
@@ -311,7 +365,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1708, 450);
|
||||
this.ClientSize = new System.Drawing.Size(1540, 450);
|
||||
this.Controls.Add(this.dgvAdditionalLoginfo);
|
||||
this.Controls.Add(this.dgvCalibrationResults);
|
||||
this.Controls.Add(this.btnLoadHistory);
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace GenesisToolBox
|
||||
isMeasurement = false;
|
||||
}
|
||||
|
||||
controlBatch.PrepareMeters("50", 12, 1, 60, 1.7, !isMeasurement, true);
|
||||
//controlBatch.PrepareMeters("50", 12, 1, 60, 1.7, !isMeasurement, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -49,12 +49,22 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
|
||||
/// <summary>
|
||||
/// Add all meters from a TestSetupContainer to the Bach an do general preparations (setup and login)
|
||||
/// Set Meters in test mode an delay till all meters have a flow detected
|
||||
/// First call for every TestPOINT (Prüfpunkt)
|
||||
/// Required that a TestContainer is present <see cref="SetTestSetupContainer"/>
|
||||
/// If no TestSetupContainer is present you could use <see cref="AddMeter"/>
|
||||
///
|
||||
/// </summary>
|
||||
void AddAllMeters();
|
||||
/// <param name="meterDn"> only for GUI -> size of the pipe</param>
|
||||
/// <param name="refPulseValence">only for GUI -> </param>
|
||||
/// <param name="predictedQFlow">only for GUI -> </param>
|
||||
/// <param name="predictedTs">only for GUI -> </param>
|
||||
/// <param name="refError">only for GUI -> </param>
|
||||
/// <param name="isAdjustment">if this test point is an calibration (other test mode) </param>
|
||||
/// <param name="IsFlyingStartStop">Just for logging (Test run against scale or ref meter)</param>
|
||||
void AddAllMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a meter to the batch and control, possibly obsolete (used only on TBF)
|
||||
/// </summary>
|
||||
@@ -101,17 +111,6 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
void SetErrorFrame(int slot, double errorFrame = 0.0);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set Meters in test mode an delay till all meters have a flow detected
|
||||
/// </summary>
|
||||
/// <param name="meterDn"> only for GUI -> size of the pipe</param>
|
||||
/// <param name="refPulseValence">only for GUI -> </param>
|
||||
/// <param name="predictedQFlow">only for GUI -> </param>
|
||||
/// <param name="predictedTs">only for GUI -> </param>
|
||||
/// <param name="refError">only for GUI -> </param>
|
||||
/// <param name="isAdjustment">if this test point is an calibration (other test mode) </param>
|
||||
/// <param name="IsFlyingStartStop">Just for logging (Test run against scale or ref meter)</param>
|
||||
void PrepareMeters(string meterDn = "-", double refPulseValence = 0.0, double predictedQFlow = 0.0, double predictedTs = 0.0, double refError = 0.0, bool isAdjustment = false, bool IsFlyingStartStop = true);
|
||||
|
||||
/// <summary>
|
||||
/// All parameters has pass to the batch and just witing till mesurement can start
|
||||
|
||||
@@ -191,6 +191,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
{
|
||||
// this loop calls the function and assigns the return states on success and error
|
||||
// remind backup state to avoid repeated execution and side effects
|
||||
_logger.Info($"StateMachine has change from {_backupState} to {_currentState}");
|
||||
_backupState = _currentState;
|
||||
switch (_currentState)
|
||||
{
|
||||
@@ -227,7 +228,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
case BatchState.MeasurementActive:
|
||||
// wait for singal that the messuremnt can be stopped
|
||||
break;
|
||||
|
||||
|
||||
case BatchState.StopMesurement:
|
||||
_currentState = StopMeasurement_Internal() ? BatchState.MeasurementCompleted : BatchState.Error;
|
||||
break;
|
||||
@@ -740,17 +741,32 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
{
|
||||
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);
|
||||
try
|
||||
{
|
||||
|
||||
meter.SerialNumber = item.SerialNr;
|
||||
meter.CurrentActionText = "FlowTest";
|
||||
meter.SetupFromConfigFile(item.Slot, false, _useRequest, true);
|
||||
meter.LogRawData(_rawLogging);
|
||||
|
||||
batch.AddMeter(meter);
|
||||
if (!meter.Login())
|
||||
{
|
||||
if (!meter.Login())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
meter.SkipPreparationForTestBench = true;
|
||||
meter.WriteLog("Add from AddAllMeters");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
meter.WriteLog(ex.Message);
|
||||
}
|
||||
|
||||
batch.AddMeter(meter);
|
||||
meter.Login();
|
||||
meter.EnableAutoLogon();
|
||||
meter.WriteLog("Add from AddAllMeters");
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -770,12 +786,37 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
}
|
||||
|
||||
}
|
||||
public void AddAllMeters()
|
||||
public void AddAllMeters(String meterDn = "-", Double refPulseValence = 0.0, Double predictedQFlow = 0.0,
|
||||
Double predictedTs = 0.0, Double refError = 0.0, Boolean isAdjustment = false, Boolean isFlyingStartStop = true)
|
||||
{
|
||||
_currentState = BatchState.AddMeters;
|
||||
setBusy(true, "alle Zähler hinzufügen");
|
||||
try
|
||||
{
|
||||
|
||||
setBusy(true, "alle Zähler hinzufügen");
|
||||
IsFlyingStartStop = isFlyingStartStop;
|
||||
_logger.Trace($"Start PrepareMeters(meterDn={meterDn},refPulseValence={refPulseValence}," +
|
||||
$"predictedQFlow ={predictedQFlow},predictedTs={predictedTs},refError={refError}," +
|
||||
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
||||
WarningMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||
ErrorMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||
|
||||
|
||||
initAction(meterDn, refPulseValence, predictedQFlow, predictedTs, refError, isFlyingStartStop);
|
||||
IsAdjustment = isAdjustment;
|
||||
|
||||
_currentState = BatchState.AddMeters;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, $"error at PrepareMeters(meterDn={meterDn},refPulseValence={refPulseValence}," +
|
||||
$"predictedQFlow ={predictedQFlow},predictedTs={predictedTs},refError={refError}," +
|
||||
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void AddMeter(String serialNumber, Int32 slot, Boolean SkipPrepearation)
|
||||
{
|
||||
try
|
||||
@@ -1016,6 +1057,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
{
|
||||
try
|
||||
{
|
||||
setBusy(true, "Bereite Zähler vor");
|
||||
if (IsAdjustment)
|
||||
{
|
||||
CalibrationIsDone = new Dictionary<Int32, LegacyCalibrationResult>();
|
||||
@@ -1084,133 +1126,129 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
}
|
||||
|
||||
}
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
IsFlyingStartStop = isFlyingStartStop;
|
||||
_logger.Trace($"Start PrepareMeters(meterDn={meterDn},refPulseValence={refPulseValence}," +
|
||||
$"predictedQFlow ={predictedQFlow},predictedTs={predictedTs},refError={refError}," +
|
||||
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
||||
WarningMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||
ErrorMetersAlarms = new ConcurrentDictionary<Int32, GenesisMeter.Alarm>();
|
||||
setBusy(true, "Bereite Zähler vor");
|
||||
|
||||
initAction(meterDn, refPulseValence, predictedQFlow, predictedTs, refError, isFlyingStartStop);
|
||||
IsAdjustment = isAdjustment;
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, $"error at PrepareMeters(meterDn={meterDn},refPulseValence={refPulseValence}," +
|
||||
$"predictedQFlow ={predictedQFlow},predictedTs={predictedTs},refError={refError}," +
|
||||
$"isAdjustment={isAdjustment},IsFlyingStartStop={IsFlyingStartStop}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CheckMetersAreReadyForTest()
|
||||
{
|
||||
_logger.Trace("CheckMetersAreReadyForTest");
|
||||
TryInvoke(new Action(() =>
|
||||
{
|
||||
lblAction.Text = @"Warte auf Zählerstand wechsel von allen Zählern";
|
||||
|
||||
}));
|
||||
|
||||
|
||||
var listOfTasks = new List<Task>();
|
||||
|
||||
foreach (var meter in batch.ListOfMeters)
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
if (!(meter is GenesisMeter))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TryInvoke(new Action(() =>
|
||||
{
|
||||
lblAction.Text = @"Warte auf Zählerstand wechsel von allen Zählern";
|
||||
|
||||
updateCell("Status", meter.Slot, "Warte auf Zählerstand wechsel", Color.LightYellow);
|
||||
}));
|
||||
|
||||
|
||||
|
||||
var listOfTasks = new List<Task>();
|
||||
listOfTasks.Add(new Task(() =>
|
||||
{
|
||||
var i = 120;
|
||||
var SlotsWithoutProgress = new List<int>();
|
||||
|
||||
var TotalTimeForCheck = 65;
|
||||
|
||||
var sleepTimeS = 5;
|
||||
_logger.Debug($" Meter {meter.Slot} CheckMetersAreReadyForTest loops {i};delay {sleepTimeS}S");
|
||||
((GenesisMeter)meter).StartMeasurement();
|
||||
var MeterReadyForTest = false;
|
||||
while (i >= 0)
|
||||
|
||||
foreach (var meter in batch.ListOfMeters)
|
||||
{
|
||||
new System.Threading.ManualResetEvent(false).WaitOne(i * 2000);
|
||||
try
|
||||
if (!(meter is GenesisMeter))
|
||||
{
|
||||
var r = ((GenesisMeter)meter).GetMainMeasurementResult(null, null, true);
|
||||
i -= sleepTimeS;
|
||||
|
||||
//when Start and Stop Record have diffrent Volumes the meter is ready for test
|
||||
if (r.DutStartRecord.GetVolumeCm() != r.DutStopRecord.GetVolumeCm())
|
||||
{
|
||||
_logger.Info($" Meter {meter.Slot} Meter has progress {r.DutVolumeCm}");
|
||||
TryInvoke(new Action(() =>
|
||||
{
|
||||
// updateCell($"Status", meter.Slot, $"Zählerstand wechsel erfasst Von:{r.DutStartRecord.GetVolumeCm()} Auf: {r.DutStopRecord.GetVolumeCm()}", Color.LimeGreen);
|
||||
}));
|
||||
MeterReadyForTest = true;
|
||||
break;
|
||||
}
|
||||
_logger.Info($" Meter {meter.Slot} display frozen {r.DutVolumeCm} ccm; loops left {i} s");
|
||||
continue;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, $" Meter {meter.Slot} Meter has progress error");
|
||||
_logger.Debug($" Meter {meter.Slot} CheckMetersAreReadyForTest loops {TotalTimeForCheck};delay {sleepTimeS}S");
|
||||
((GenesisMeter)meter).StartMeasurement();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
TryInvoke(new Action(() =>
|
||||
{
|
||||
updateCell("Status", meter.Slot, "Warte auf Zählerstand wechsel ", Color.LightYellow);
|
||||
}));
|
||||
SlotsWithoutProgress.Add(((GenesisMeter)meter).Slot);
|
||||
|
||||
}
|
||||
((GenesisMeter)meter).StopMeasurement();
|
||||
|
||||
if (MeterReadyForTest)
|
||||
Thread.Sleep(sleepTimeS * 1000);
|
||||
//Run as long the Checktime is not zero or we dont have a meter left without progress
|
||||
while (TotalTimeForCheck >= 0 && SlotsWithoutProgress.Any())
|
||||
{
|
||||
_logger.Info($" Meter {meter.Slot} Meter has NO! progress");
|
||||
TryInvoke(new Action(() =>
|
||||
Thread.Sleep(sleepTimeS * 1000);
|
||||
TotalTimeForCheck -= sleepTimeS;
|
||||
|
||||
foreach (var meter in batch.ListOfMeters)
|
||||
{
|
||||
updateCell("Status", meter.Slot, "Zählerstand wechsel nicht erfasst", Color.LightPink);
|
||||
}));
|
||||
try
|
||||
{
|
||||
if (SlotsWithoutProgress.Contains(meter.Slot))
|
||||
{
|
||||
try
|
||||
{
|
||||
var r = ((GenesisMeter)meter).GetMainMeasurementResult(null, null, true);
|
||||
|
||||
//when Start and Stop Record have diffrent Volumes the meter is ready for test
|
||||
if (r.DutStartRecord.GetVolumeCm() != r.DutStopRecord.GetVolumeCm())
|
||||
{
|
||||
_logger.Info($" Meter {meter.Slot} Meter has progress {r.DutVolumeCm}");
|
||||
((GenesisMeter)meter).StopMeasurement();
|
||||
SlotsWithoutProgress.Remove(meter.Slot);
|
||||
|
||||
}
|
||||
_logger.Info($" Meter {meter.Slot} display frozen {r.DutVolumeCm} ccm; loops left {TotalTimeForCheck} s");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex is ApplicationException aex && aex.Message.Contains("Measurement records missing"))
|
||||
{
|
||||
_logger.Info($" Meter {meter.Slot} display frozen record is missing; loops left {TotalTimeForCheck} s");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Info($" Meter {meter.Slot} display frozen record is missing; loops left {TotalTimeForCheck} s");
|
||||
_logger.Error(ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, $" Meter {meter.Slot} Meter has progress error");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (SlotsWithoutProgress.Any())
|
||||
{
|
||||
foreach (var item in SlotsWithoutProgress)
|
||||
{
|
||||
_logger.Warn($"Slot {item} has no progress");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug($"All Meters have progress");
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
||||
listOfTasks.ForEach(t => t.Start());
|
||||
Task.WaitAll(listOfTasks.ToArray());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex);
|
||||
//in case something went wrong this check can be skip
|
||||
}
|
||||
listOfTasks.ForEach(t => t.Start());
|
||||
Task.WaitAll(listOfTasks.ToArray());
|
||||
|
||||
}
|
||||
|
||||
public Boolean StartMeasurement_Internal()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
_logger.Debug($"StartMesurment from state machien");
|
||||
var listOfTasks = new List<Task>();
|
||||
foreach (var item in batch.ListOfMeters)
|
||||
{
|
||||
@@ -1246,6 +1284,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
|
||||
public void StartMeasurement()
|
||||
{
|
||||
_logger.Info("Caller start Measurement");
|
||||
_currentState = BatchState.StartMesurement;
|
||||
}
|
||||
public void SetLoggerActionText(String ActionText)
|
||||
@@ -1260,6 +1299,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
}
|
||||
public void StopMeasurement()
|
||||
{
|
||||
_logger.Info("Caller stop Measurement");
|
||||
_currentState = BatchState.StopMesurement;
|
||||
}
|
||||
public Boolean StopMeasurement_Internal()
|
||||
@@ -1267,7 +1307,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
try
|
||||
{
|
||||
var nrOfRetrys = 40;
|
||||
|
||||
_logger.Info("SM Call StopMeasurement_Internal");
|
||||
foreach (var item in batch.ListOfMeters)
|
||||
{
|
||||
var settings = TestSetupContainer.meterTestSettings.First(f => f != null && f.Slot == item.Slot);
|
||||
@@ -1290,6 +1330,7 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
item.StopMeasurement();
|
||||
}
|
||||
}
|
||||
_logger.Info("All Meters Stopped");
|
||||
var listOfTasks = new List<Task>();
|
||||
foreach (var item in batch.ListOfMeters)
|
||||
{
|
||||
@@ -2181,26 +2222,31 @@ namespace XylemCommonUiLegacyGenCtl
|
||||
|
||||
public void SetReadyForMesuremnt()
|
||||
{
|
||||
_logger.Debug($"Caller set batch state to state ReadyForMesuremnt");
|
||||
_currentState = BatchState.ReadyForMesuremnt;
|
||||
}
|
||||
|
||||
public Boolean MeasurementIsActive()
|
||||
{
|
||||
_logger.Debug($"Caller MeasurementIsActive state is{_currentState}");
|
||||
return _currentState == BatchState.MeasurementActive;
|
||||
}
|
||||
|
||||
public Boolean MeasurementIsCompleted()
|
||||
{
|
||||
_logger.Debug($"Caller MeasurementIsCompleted state is{_currentState}");
|
||||
return _currentState == BatchState.MeasurementCompleted;
|
||||
}
|
||||
|
||||
public Boolean MetersArePrepared()
|
||||
{
|
||||
_logger.Debug($"Caller MetersArePrepared state is{_currentState}");
|
||||
return _currentState == BatchState.MetersPrepared;
|
||||
}
|
||||
|
||||
public Boolean IsReadyForMesuremnt()
|
||||
{
|
||||
_logger.Debug($"Caller IsReadyForMesuremnt state is{_currentState}");
|
||||
return _currentState == BatchState.ReadyForMesuremnt;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user