ProductionUiCordonel: - re-organized to support multiple production processes part 5

This commit is contained in:
Thomas Wiedebusch
2025-04-14 17:06:52 +02:00
parent cf8a0b90b4
commit e707304f43
3 changed files with 61 additions and 54 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
@@ -11,7 +12,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// <remarks date="2025-Apr-14" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public class BaseProcessStates : IProcessStates
public class BaseProcessStates
{
/// <summary>
/// Collection of state information
@@ -35,9 +36,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// </remarks>
public IProductionProcess GetProcessOfState(ProcessState stateMachineState)
{
return (from stateContainer in StateContainer
where stateContainer.State == stateMachineState
select stateContainer.Process).FirstOrDefault();
return (from stateContainer in StateContainer
where stateContainer.State == stateMachineState
select stateContainer.Process).FirstOrDefault();
}
/// <summary>
@@ -57,8 +58,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
stateMachineState = ProcessState.Error;
return (from stateContainer in StateContainer
where stateContainer.State == stateMachineState
select stateContainer.Info).FirstOrDefault();
where stateContainer.State == stateMachineState
select stateContainer.Info).FirstOrDefault();
}
/// <summary>
@@ -72,8 +73,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
public String GetStateInfoOfProcess(IProductionProcess process)
{
return (from stateContainer in StateContainer
where stateContainer.Process == process
select stateContainer.Info).FirstOrDefault();
where stateContainer.Process == process
select stateContainer.Info).FirstOrDefault();
}
/// <summary>
@@ -87,8 +88,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
public ProcessState GetStateOfInfoText(String text)
{
return (from stateContainer in StateContainer
where stateContainer.Info == text
select stateContainer.State).FirstOrDefault();
where stateContainer.Info == text
select stateContainer.State).FirstOrDefault();
}
/// <summary>
@@ -102,8 +103,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
public ProcessState GetStateOfProcess(IProductionProcess process)
{
return (from stateContainer in StateContainer
where stateContainer.Process == process
select stateContainer.State).FirstOrDefault();
where stateContainer.Process == process
select stateContainer.State).FirstOrDefault();
}
/// <summary>
@@ -118,9 +119,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// </remarks>
public Int32 GetNumberOfInitializedProcesses()
{
return StateContainer.Count(stateContainer => stateContainer.ProductionRelevant );
return StateContainer.Count(stateContainer => stateContainer.ProductionProcessNo != null);
}
/// <summary>
/// Get all EOL relevant states
/// </summary>
@@ -131,10 +132,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// <remarks date="2024-Sep-01" author="Thomas Wiedebusch">
/// - Used marker for production relevant processes
/// </remarks>
/// <remarks date="2025-Apr-14" author="Thomas Wiedebusch">
/// - Changed to sorted list by production process number
/// </remarks>
public List<IProductionProcess> GetAllEolRelevantProcesses()
{
return (from state in StateContainer where state.ProductionRelevant
select state.Process).ToList();
var sortedList = StateContainer
.Where(y => y.ProductionProcessNo != null)
.OrderBy(x => x.ProductionProcessNo);
return (from state in sortedList select state.Process).ToList();
}
}
}
}
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.GenericProcesses;
using Xylem.Common.Production.ProductionUiCordonel.Properties;
@@ -33,156 +31,156 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
null,
ProcessState.Idle,
Resources.StrStateIdle,
false),
null),
new ProcessStateStruct(
null,
ProcessState.CheckNewMeter,
Resources.StrProcessStateCheckNewMeter,
false),
null),
new ProcessStateStruct(
new ErrorHandler(null),
ProcessState.Error,
Resources.StrProcessStateError,
false),
null),
new ProcessStateStruct(
null,
ProcessState.RepeatFailedTests,
Resources.StrStateRepeatFinalTest,
false),
null),
new ProcessStateStruct(
null,
ProcessState.AbortTest,
Resources.StrStateSkipping,
false),
null),
new ProcessStateStruct(
null,
ProcessState.Stop,
Resources.StrStateUserStop,
false),
null),
new ProcessStateStruct(
null,
ProcessState.TestFailed,
Resources.StrStateFinalTestFailed,
false),
null),
new ProcessStateStruct(
null,
ProcessState.ReadyForShipping,
Resources.StrStateReadyForShipping,
false),
null),
new ProcessStateStruct(
null,
ProcessState.PrintSuccessReport,
Resources.StrStatePrintSuccessReport,
false),
null),
new ProcessStateStruct(
null,
ProcessState.PrintReturnReport,
Resources.StrStatePrintReturnReport,
false),
null),
new ProcessStateStruct(
new DetectCordonel(Resources.StrStateDetectCordonel),
ProcessState.DetectCordonel,
Resources.StrStateDetectCordonel,
true),
0),
new ProcessStateStruct(
new ConnectCordonel(Resources.StrStateConnectCordonel),
ProcessState.ConnectCordonel,
Resources.StrStateConnectCordonel,
true),
1),
new ProcessStateStruct(
new GetSerialNumberAndRadioAddress(Resources.StrStateGetSerialAndRadioAddress),
ProcessState.GetSerialNumberAndRadioAddress,
Resources.StrStateGetSerialAndRadioAddress,
true),
2),
new ProcessStateStruct(
new GetFinalParametrization(Resources.StrStateGetProgrammingParameters),
ProcessState.GetProgrammingParameters,
Resources.StrStateGetProgrammingParameters,
true),
3),
new ProcessStateStruct(
new CheckProductionState(Resources.StrStateCheckProductionState),
ProcessState.CheckProductionState,
Resources.StrStateCheckProductionState,
true),
4),
new ProcessStateStruct(
new ExecPasswordFile(Resources.StrStatePasswordFile),
ProcessState.ProcessPasswordFile,
Resources.StrStatePasswordFile,
true),
5),
new ProcessStateStruct(
new ExecFinalParametrization(Resources.StrStateFinalParametrization),
ProcessState.ExecFinalParametrization,
Resources.StrStateFinalParametrization,
true),
6),
new ProcessStateStruct(
new ExecStoreConfiguration(Resources.StrStateStoreConfiguration),
ProcessState.ExecStoreConfiguration,
Resources.StrStateStoreConfiguration,
true),
7),
new ProcessStateStruct(
new ExecRebootCordonel(Resources.StrStateRebootCordonel),
ProcessState.RebootCordonel,
Resources.StrStateRebootCordonel,
true),
8),
new ProcessStateStruct(
new CheckFinalParametrization(Resources.StrStateCheckParametrization),
ProcessState.CheckFinalParametrization,
Resources.StrStateCheckParametrization,
true),
9),
new ProcessStateStruct(
new CheckRadio(Resources.StrStateRadioCheck),
ProcessState.CheckRadio, Resources.StrStateRadioCheck,
true),
10),
new ProcessStateStruct(
new CheckOrderNumber(Resources.StrStateCheckOrderNumber),
ProcessState.CheckOrderNumber,
Resources.StrStateCheckOrderNumber,
true),
11),
new ProcessStateStruct(
new CheckSerialNumber( Resources.StrStateCheckSerialNumber),
ProcessState.CheckSerialNumber,
Resources.StrStateCheckSerialNumber,
true),
12),
new ProcessStateStruct(
new CheckAttachments(Resources.StrStateCheckAttachments),
ProcessState.CheckAttachments,
Resources.StrStateCheckAttachments,
true),
13),
new ProcessStateStruct(
new VisualInspection(Resources.StrStateVisualInspection),
ProcessState.ExecVisualInspection,
Resources.StrStateVisualInspection,
true),
14),
new ProcessStateStruct(
new PrepareShipping(Resources.StrStatePrepareShipping),
ProcessState.PrepareShippingMode,
Resources.StrStatePrepareShipping,
true)
15)
};
}
}
@@ -11,19 +11,21 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// <summary>
/// Assign process state information
/// </summary>
/// <param name="process">production process</param>
/// <param name="state">assigned state for call of this process</param>
/// <param name="info">name for process to display a message</param>
/// <param name="productionRelevant">all processes which are relevant for the EOL production</param>
/// <param name="process">production process, set to null for "invisible" states</param>
/// <param name="state">assigned state for call of this process used by the state machine</param>
/// <param name="info">name for process to display a message in the GUI</param>
/// <param name="productionProcessNo">set a unique number to sort the table of production processes,
/// set to null for all hidden processes which are not a production process</param>
/// <remarks date="2023-Jan-17" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public ProcessStateStruct(IProductionProcess process, ProcessState state, String info, Boolean productionRelevant)
public ProcessStateStruct(IProductionProcess process, ProcessState state, String info,
UInt32? productionProcessNo)
{
Process = process;
State = state;
Info = info;
ProductionRelevant = productionRelevant;
ProductionProcessNo = productionProcessNo;
}
/// <summary>
/// The state of the final test
@@ -38,8 +40,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
/// </summary>
public String Info { get; }
/// <summary>
/// Processes which are relevant for the EOL production
/// Processes which are relevant for the production have a number for the sequence they should be displayed
/// in the GUI, all hidden (non-)production processes are set to null
/// </summary>
public Boolean ProductionRelevant { get; }
public UInt32? ProductionProcessNo { get; }
}
}