250 lines
8.3 KiB
C#
250 lines
8.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Windows.Controls;
|
|
using LaaPackages.Features.Cordonel.Models;
|
|
using Xylem.Common.CommonCore.Consts;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisPwd;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
|
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
|
|
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EventArgs;
|
|
|
|
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
|
|
{
|
|
public interface IProductionProcess
|
|
{
|
|
/// <summary>
|
|
/// Cancellation token to stop operation
|
|
/// </summary>
|
|
CancellationToken CancellationToken { set; get; }
|
|
|
|
/// <summary>
|
|
/// Event for process list change or state of single process step change from wait to execute to done or error
|
|
/// </summary>
|
|
event EventHandler<SingleProcessStateArgs> OnProcessStateChanged;
|
|
|
|
/// <summary>
|
|
/// Entire process changed status due to state change of process execution
|
|
/// </summary>
|
|
event EventHandler<ProcessStateArgs> OnForceStateMachineStateChange;
|
|
|
|
/// <summary>
|
|
/// Log event to log file and signal to GUI
|
|
/// </summary>
|
|
event EventHandler<ProcessLogArgs> OnProcessLogRequest;
|
|
|
|
/// <summary>
|
|
/// Send progress information to GUI for progress bars
|
|
/// </summary>
|
|
event EventHandler<ProcessProgressArgs> OnProcessProgressChanged;
|
|
|
|
/// <summary>
|
|
/// Send messages to GUI
|
|
/// </summary>
|
|
event EventHandler<GuiMessageArgs> OnGuiMessageDispatcher;
|
|
|
|
/// <summary>
|
|
/// State of single production process
|
|
/// </summary>
|
|
/// <returns>process name</returns>
|
|
SingleProcessState SingleProcessState
|
|
{
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Name of actual production process
|
|
/// </summary>
|
|
/// <returns>process name</returns>
|
|
String ProcessName
|
|
{
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Version of assembly
|
|
/// </summary>
|
|
/// <returns>process name</returns>
|
|
Version Version
|
|
{
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set reference to status of meter
|
|
/// </summary>
|
|
GenesisStatus ProductionStatus
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set reference to end of line (EOL) progress of meter
|
|
/// </summary>
|
|
EOLProgressModel EolProgress
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Set reference to production requirements of meter
|
|
/// </summary>
|
|
CordonelRequirements ProductionRequirements
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Genesis meter
|
|
/// </summary>
|
|
IGenesisMeter Meter
|
|
{
|
|
set;
|
|
get;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Register restorer
|
|
/// </summary>
|
|
RegisterRestorer RegisterRestorer
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sensus radio encryption key as list of string as a single string is defined as object but
|
|
/// cannot be changed in derived classes as "Strings are immutable". But objects of a list can
|
|
/// be changed so the trick is to take a list instead of a strings.
|
|
/// </summary>
|
|
List<String> RadioEncryptionKey
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Password container
|
|
/// </summary>
|
|
MeterPwdDb PwdContainer
|
|
{
|
|
set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get the user control for the GUI and cleans the content.
|
|
/// </summary>
|
|
/// <returns>specific user control for GUI</returns>
|
|
/// <summary>
|
|
/// Update the sand clock on image
|
|
/// </summary>
|
|
/// <remarks date="2023-Feb-14" author="Roland Drabesch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
/// <remarks date="2023-Jun-28" author="Roland Drabesch">
|
|
/// - Clear content, is important for recurrent call on a retry to clean it.
|
|
/// </remarks>
|
|
UserControl GetUserControl();
|
|
|
|
/// <summary>
|
|
/// Production process kick off with all current- and exit states.
|
|
///
|
|
/// ATTENTION: The OverallStateEvent has to be fired before the SingleProcessState event, as the
|
|
/// SingleProcessState event will uninstall the event handlers on finalizing!
|
|
///
|
|
/// </summary>
|
|
/// <param name="successExitState">success exit state, if set to null, leave state as is</param>
|
|
/// <param name="errorExitState"></param>
|
|
/// <param name="breakExitState"></param>
|
|
/// <remarks date="2023-Jan-30" author="Thomas Wiedebusch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
void StartProcess(ProcessState? successExitState, ProcessState errorExitState = ProcessState.Error,
|
|
ProcessState breakExitState = ProcessState.Stop);
|
|
|
|
/// <summary>
|
|
/// Preparation of process in advance to execution routine.
|
|
/// This will set the process state to "SingleProcessState.Waiting"
|
|
/// </summary>
|
|
void InitProcess();
|
|
|
|
/// <summary>
|
|
/// Preparation of process for recurrent run to unblocking this state.
|
|
/// This will set the process state to "SingleProcessState.Idle"
|
|
/// </summary>
|
|
void IdleProcess();
|
|
|
|
/// <summary>
|
|
/// Preparation of process to signal abort request.
|
|
/// This will set the process state to "SingleProcessState.Abort"
|
|
/// </summary>
|
|
void AbortProcess();
|
|
|
|
/// <summary>
|
|
/// Preparation of process to signal retry request.
|
|
/// This will set the process state to "SingleProcessState.Idle"
|
|
/// </summary>
|
|
void RetryProcess();
|
|
|
|
/// <summary>
|
|
/// Pre execution process to isolate database calls from the ExecuteProcess method.
|
|
/// This is useful for unit tests to separate the peripheral calls.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
StatusReturn PreExecuteProcess();
|
|
|
|
/// <summary>
|
|
/// Process execution routine which will be executed in separate thread.
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
StatusReturn ExecuteProcess();
|
|
|
|
/// <summary>
|
|
/// Routine for finalization of each process like cleaning and setting a status or control
|
|
/// Finalization of process.
|
|
/// </summary>
|
|
/// <param name="success">successful execution</param>
|
|
/// <param name="exitProcessStateObjects">objects containing process states sorted success-, error-,
|
|
/// break exit state</param>
|
|
/// <remarks date="2023-Jan-30" author="Thomas Wiedebusch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
void FinalizeProcess(StatusReturn success, IReadOnlyList<Object> exitProcessStateObjects);
|
|
|
|
/// <summary>
|
|
/// Routine for error handling:
|
|
/// - Log success with Genesis write log,
|
|
/// - Color output to GUI in green,
|
|
/// - Dispatch message to UI.
|
|
/// </summary>
|
|
/// <param name="successMsg">message to dispatch</param>
|
|
/// <remarks date="2023-Mar-15" author="Thomas Wiedebusch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
void SuccessMsgDispatcher(String successMsg);
|
|
|
|
/// <summary>
|
|
/// Routine for warning handling:
|
|
/// - Log error with Genesis write log,
|
|
/// - Color output to GUI in orange,
|
|
/// - Dispatch message to UI.
|
|
/// </summary>
|
|
/// <param name="warningMsg">message to dispatch</param>
|
|
/// <remarks date="2023-Mar-15" author="Thomas Wiedebusch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
void WarningMsgDispatcher(String warningMsg);
|
|
|
|
/// <summary>
|
|
/// Routine for error handling:
|
|
/// - Log error with Genesis write log,
|
|
/// - Color output to GUI in red,
|
|
/// - Dispatch message to UI.
|
|
/// </summary>
|
|
/// <param name="errorMsg">message to dispatch</param>
|
|
/// <remarks date="2023-Mar-15" author="Thomas Wiedebusch">
|
|
/// - Initial
|
|
/// </remarks>
|
|
void ErrorMsgDispatcher(String errorMsg);
|
|
}
|
|
}
|