diff --git a/Common/Production/ProductionUiCordonel/App.config b/Common/Production/ProductionUiCordonel/App.config index 374410f9..6d84876c 100644 --- a/Common/Production/ProductionUiCordonel/App.config +++ b/Common/Production/ProductionUiCordonel/App.config @@ -34,7 +34,7 @@ - + diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs index 7fc4b88f..a4e23818 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckOrderNumber.cs @@ -83,10 +83,14 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki ucBarCode.OnBarcodeInput -= UserControlInput_Handler; - if (!string.IsNullOrEmpty(_scan) && _scan.Length > 5) + if (!string.IsNullOrEmpty(_scan) && _scan.Length > 6) { //TODO Roland, Do something with the scanned order - return StatusReturn.Okay; + if (int.TryParse(_scan, out var result)) + { + Meter.OrderNumber = result; + return StatusReturn.Okay; + } } ErrorMsgDispatcher(Resources.StrErrorMsgScanOrderNumber); diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs index 5eae3248..ae1389ce 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/ProcessController.cs @@ -314,12 +314,12 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses } else { + // ATTENTION: Has to be the very first step here! + // Remind backup state to avoid repeated execution and side effects + _lockedStateMachineState = _stateMachineState; + try { - // ATTENTION: Has to be the very first step here! - // Remind backup state to avoid repeated execution and side effects - _lockedStateMachineState = _stateMachineState; - // Signal overall process progress to GUI based on ready processes CalcAndPushOverAllProgress(); @@ -330,15 +330,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses var startProcessState = _processStateDef.GetStateOfFirstProcess(); if (startProcessState == _stateMachineState) { - // This state needs an external state change like user input to go ahead - // Remove cancellation token if idle reached for clean start - if (_cancellationToken.IsCancellationRequested) - { - // Reset the cancellation request - _cancellationTokenSource?.Dispose(); - _cancellationTokenSource = new CancellationTokenSource(); - _cancellationToken = _cancellationTokenSource.Token; - } + ResetCancellationToken(); // Set up the counter for maximum overall process progress bar in GUI CalcAndPushMaxOverAllProcessSteps(); @@ -347,10 +339,10 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses // Get the processStateStruct of this new required stateMachineState var processStateStruct = _processStateDef.GetProcessStateStructOfState(_stateMachineState); - switch (_stateMachineState) + switch (_stateMachineState) { case ProcessState.Idle: - break; + break; case ProcessState.CheckNewMeter: // Detection of Cordonel has to be completed before assigning next state. It has to be checked if @@ -359,7 +351,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses // enter the "ConnectCordonel"! if (processStateStruct.NextStateOnSuccess != null) { - _stateMachineState = CheckForNewMeter() ? (ProcessState)processStateStruct.NextStateOnSuccess : + _stateMachineState = CheckForNewMeter() ? (ProcessState)processStateStruct.NextStateOnSuccess : processStateStruct.ErrorExitState; } else @@ -422,6 +414,24 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses #endregion --------------------------------------- State Machine ---------------------------------------------- #region ------------------------------------------ Tools ------------------------------------------------------ /// + /// Common routine to reset the cancellation token on restart or new meter + /// + /// + /// - Initial + /// + private void ResetCancellationToken() + { + // This state needs an external state change like user input to go ahead + // Remove cancellation token if idle reached for clean start + if (_cancellationToken.IsCancellationRequested) + { + // Reset the cancellation request + _cancellationTokenSource?.Dispose(); + _cancellationTokenSource = new CancellationTokenSource(); + _cancellationToken = _cancellationTokenSource.Token; + } + } + /// /// Returns the currentGenesis information for display /// /// @@ -461,6 +471,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses /// /// - Check _genesisMeter not null before equality with old pcbid. /// + /// + /// - ResetCancellationToken. + /// private Boolean CheckForNewMeter() { if (_genesisMeter == null || @@ -473,6 +486,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses RemoveMeter(); InitNewMeter(); InitProcesses(); + ResetCancellationToken(); // Remind actual genesis _lastPcbId = _genesisMeter?.PcbId; @@ -609,7 +623,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses if (Processes == null) Processes = new List(); - // Get all processes relevant for EOL from table which has to be sorted + // Get all processes relevant for production from table which has to be sorted var processes = _processStateDef.GetAllProductionProcesses(); foreach (var process in processes)