ProductionUiCordonel: - Assembly: - prepared for mapping check

This commit is contained in:
Thomas Wiedebusch 2025-09-18 17:38:02 +02:00
parent 57ec250abb
commit ebd2625630
14 changed files with 161 additions and 38 deletions

View File

@ -16,7 +16,7 @@ namespace Xylem.Common.CommonCore.Configuration
#endif
private static readonly String DefaultInspectCordonelRequirementInfoUrl =
$"{ServerDns}/LaaProductionWeb/";
$"http://sla12iis01.emea.sensus.net/LaaProductionWeb/";
// return code: 404 not found, 400 Error with text, 200 okay
private static readonly String DefaultEolDataForSentinelServiceUrl =
@ -25,6 +25,9 @@ namespace Xylem.Common.CommonCore.Configuration
private static readonly String DefaultGetPcbIdsFromSafeServiceUrl =
$"{ServerDns}/MeterProcessState/GetPcbIdsFromSafe?ContainerDbId=";
private static readonly String DefaultGetCordonelMappingServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelMapping?PcbId=";
private static readonly String DefaultAddPcbIdsToSafeServiceUrl =
$"{ServerDns}/MeterProcessState/AddPcbIdsToSafe?ContainerDbId=";
@ -237,6 +240,16 @@ namespace Xylem.Common.CommonCore.Configuration
}
/// <summary>
/// Get Cordonel mapping
/// </summary>
/// <returns></returns>
public static String GetCordonelMappingServiceUrl()
{
return ConfigurationManager.AppSettings["GetCordonelMappingServiceUrl"] ??
DefaultGetCordonelMappingServiceUrl;
}
/// <summary>
/// Get Cordonel order overview to check the assignment state
/// </summary>
@ -428,7 +441,7 @@ namespace Xylem.Common.CommonCore.Configuration
/// <returns></returns>
public static String GetCordonelRequirementByFANrInfoServiceUrl(String ponr)
{
return $"{ServerDns}/LaaProductionWeb/api/cordonel/requirements/pono/{ponr}";
return $"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/requirements/pono/{ponr}";
}
/// <summary>
@ -441,7 +454,7 @@ namespace Xylem.Common.CommonCore.Configuration
/// <returns></returns>
public static String GetCordonelRequirementByMeterSizeInfoServiceUrl(Int32 size)
{
return $"{ServerDns}/LaaProductionWeb/api/cordonel/requirements/isize/{size}";
return $"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/requirements/isize/{size}";
}
/// <summary>

View File

@ -46,7 +46,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
/// </summary>
public String CordonelMeterSizeName { get; set; }
/// <summary>
/// Meter size id fro direct programming to meter
/// Meter size id from direct programming to meter
/// </summary>
public Int64 CordonelMeterSizeId { get; set; }
}

View File

@ -0,0 +1,28 @@
using System;
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
{
/// <summary>
/// Cordonel serial numbers
/// </summary>
[Serializable]
public class CordonelMappingDb
{
/// <summary>
/// PcbId
/// </summary>
public String PcbId { get; set; }
/// <summary>
/// Order number picking
/// </summary>
public Int64? CordonelAssignedPicking_FertigungsAuftragsNr { get; set; }
/// <summary>
/// Order number pressure test
/// </summary>
public Int64? CordonelPressureTest_FertigungsAuftragsNr { get; set; }
/// <summary>
/// Mapped serial number
/// </summary>
public Int64? MapPcbIdToSerialNumber_SerialNumber { get; set; }
}
}

View File

@ -31,7 +31,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
/// <remarks date="2024-Mar-13" author="Thomas Wiedebusch">
/// - Import from FwUpdateDb.
/// </remarks>
public static Boolean GetAllCordonelSerialNumbersFromDb(Int64 orderNumber, Int64 orderPos,
public static Boolean GetAllCordonelSerialNumbersFromDb(Int64 orderNumber, Int64 orderPos,
out List<CordonelSerialNumbersDb> serialNumbers)
{
try
@ -66,7 +66,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
/// <remarks date="2024-Mar-13" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
public static Boolean GetCordonelOrderDetails(Int64 productionOrderNumber,
public static Boolean GetCordonelOrderDetails(Int64 productionOrderNumber,
out List<CordonelOrderDetailsDb> orderDetails)
{
try
@ -105,7 +105,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
/// <remarks date="2025-Sep-16" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
public static Boolean GetCordonelOrderOverview(Int64 productionOrderNumber,
public static Boolean GetCordonelOrderOverview(Int64 productionOrderNumber,
out OrderOverViewCordonel orderOverview)
{
try
@ -129,6 +129,36 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
}
}
/// <summary>
/// Get Cordonel mapping.
/// </summary>
/// <param name="pcbId"></param>
/// <param name="cordonelMap"></param>
/// <returns>true if successful</returns>
/// <remarks date="2025-Sep-18" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
public static Boolean GetCordonelMapping(String pcbId, out List<CordonelMappingDb> cordonelMap)
{
try
{
var url = ServiceUrls.GetCordonelMappingServiceUrl() + pcbId;
var requestResponse = LocalWebRequest.GetRequest(url, moderateTimeoutDbRequest);
if (string.IsNullOrEmpty(requestResponse))
{
cordonelMap = new List<CordonelMappingDb>();
return false;
}
cordonelMap = JsonConvert.DeserializeObject<List<CordonelMappingDb>>(requestResponse);
return cordonelMap != null && cordonelMap.Count > 0;
}
catch (Exception)
{
cordonelMap = new List<CordonelMappingDb>();
return false;
}
}
/// <summary>
/// Get all Cordonel customers from DB. The return can be used to select a specific customer and get
/// the customer number which is the base for the order search.
@ -182,9 +212,9 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
/// <remarks date="2024-Mar-13" author="Thomas Wiedebusch">
/// - Import from FwUpdateDb.
/// </remarks>
public static Boolean GetAllCordonelCustomerOrdersFromDb(Int64 customerNumber,
public static Boolean GetAllCordonelCustomerOrdersFromDb(Int64 customerNumber,
out List<CordonelCustomerOrderDb> customerOrders)
{
{
try
{
var url = ServiceUrls.ListAllCordonelCustomerOrdersServiceUrl();

View File

@ -126,6 +126,7 @@
<Compile Include="KitronTestResults\RadioTest.cs" />
<Compile Include="OrderData\CordonelCustomerInfosDb.cs" />
<Compile Include="OrderData\CordonelCustomerOrderDb.cs" />
<Compile Include="OrderData\CordonelMappingDb.cs" />
<Compile Include="OrderData\CordonelProductionInfosDb.cs" />
<Compile Include="OrderData\CordonelOrderDetailsDb.cs" />
<Compile Include="OrderData\CordonelSerialNumbersDb.cs" />

View File

@ -0,0 +1,19 @@
using System;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.GenericProcesses;
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolProcesses
{
public class DetectCordonel : BaseDetectCordonel
{
/// <inheritdoc />
public DetectCordonel(String name) : base(name)
{
}
/// <inheritdoc/>
protected override Boolean ValidateProcessAndPublishDataToGui()
{
return true;
}
}
}

View File

@ -123,14 +123,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
var stateContainer = new List<ProcessStateStruct>
{
#region ----------------------------------- GENERIC-STATES---------------------------------------------
new ProcessStateStruct(
productionProcess: new DetectCordonel(Resources.StrStateDetectCordonel),
processState: ProcessState.DetectCordonel,
processInfo: Resources.StrStateDetectCordonel,
productionProcessNo: 0,
// CheckNewMeter will exit with repeated detect or connect
nextStateOnSuccess: ProcessState.CheckNewMeter),
new ProcessStateStruct(
productionProcess: new ConnectCordonel(Resources.StrStateConnectCordonel),
processState: ProcessState.ConnectCordonel,
@ -161,6 +153,14 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
#endregion -------------------------------- GENERIC-STATES --------------------------------------------
#region ----------------------------------- EOL-STATES ------------------------------------------------
new ProcessStateStruct(
productionProcess: new DetectCordonel(Resources.StrStateDetectCordonel),
processState: ProcessState.DetectCordonel,
processInfo: Resources.StrStateDetectCordonel,
productionProcessNo: 0,
// CheckNewMeter will exit with repeated detect or connect
nextStateOnSuccess: ProcessState.CheckNewMeter),
// Precondition: - A new meter has to be detected
// Create (hidden) EOL progress for sentinel.
new ProcessStateStruct(

View File

@ -112,10 +112,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener
/// Application differences in check result
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
protected virtual Boolean ValidateProcessAndPublishDataToGui(OrderOverViewCordonel orderOverview)
{
throw new NotImplementedException();
}
protected abstract Boolean ValidateProcessAndPublishDataToGui(OrderOverViewCordonel orderOverview);
}
}

View File

@ -9,13 +9,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener
/// Production process detects the serial number of the Cordonel.
/// This is the indication, that a Cordonel is connected to the hardware interface.
/// </summary>
public class DetectCordonel : BaseProductionProcess
public abstract class BaseDetectCordonel : BaseProductionProcess
{
/// <summary>
/// Ctor
/// Setup of name and single process state
/// </summary>
public DetectCordonel(String name) : base( name)
protected BaseDetectCordonel(String name) : base( name)
{
}
@ -43,10 +43,17 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener
// read the PcbId to validate Cordonel is attached
var retVal = !string.IsNullOrEmpty(Meter.GetPcbId());
if (retVal) return StatusReturn.Okay;
if (retVal && ValidateProcessAndPublishDataToGui())
return StatusReturn.Okay;
ErrorMsgDispatcher(Resources.StrErrorMsgCordonelDetection);
return StatusReturn.Failed;
}
/// <summary>
/// Application differences in check result
/// </summary>
/// <returns></returns>
protected abstract Boolean ValidateProcessAndPublishDataToGui();
}
}

View File

@ -18,7 +18,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener
/// Connect initially to Cordonel.
/// Checks the ability to login as it gets the password from DB.
/// Precondition:
/// - The <see cref="DetectCordonel"/> process has to be completed as the PcbId is needed.
/// - The <see cref="BaseDetectCordonel"/> process has to be completed as the PcbId is needed.
/// </summary>
/// <returns></returns>
/// <remarks date="2023-Feb-14" author="Thomas Wiedebusch">

View File

@ -27,7 +27,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener
/// <summary>
/// Get programming parameters for Cordonel including VAKO and CSD
/// Precondition:
/// - The <see cref="DetectCordonel"/> process has to be completed as the PcbId is needed.
/// - The <see cref="BaseDetectCordonel"/> process has to be completed as the PcbId is needed.
/// </summary>
/// <returns></returns>
/// <remarks date="2020-Mai-15" author="Roland Drahbesh">

View File

@ -0,0 +1,27 @@
using System;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.GenericProcesses;
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.PickingProcesses
{
public class DetectCordonel : BaseDetectCordonel
{
/// <inheritdoc />
public DetectCordonel(String name) : base(name)
{
}
/// <inheritdoc/>
protected override Boolean ValidateProcessAndPublishDataToGui()
{
// Check mapping information
if (!OrderDetailsDb.GetCordonelMapping(Meter.PcbId, out var cordonelMapping))
{
return false;
}
// Reserve picking for this device
return true;
}
}
}

View File

@ -32,7 +32,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
/// INSTRUCTION FOR PREPARATION:
/// -----------------------------
/// STEP 1: Define some states for your processes <see cref="ProcessState"/>
/// STEP 2: Implement your processes like <see cref="DetectCordonel"/>
/// STEP 2: Implement your processes like <see cref="BaseDetectCordonel"/>
/// STEP 3: Register and chain your states here
///
///
@ -104,15 +104,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
var stateContainer = new List<ProcessStateStruct>
{
#region ----------------------------------- GENERIC-STATES---------------------------------------------
// Detection of Cordonel has to be completed before assigning next state, so leave to automatic
// to change the state after successfully execution. The detection is the base for all others.
new ProcessStateStruct(
productionProcess: new DetectCordonel(Resources.StrStateDetectCordonel),
processState: ProcessState.DetectCordonel,
processInfo: Resources.StrStateDetectCordonel,
productionProcessNo: 1,
nextStateOnSuccess: ProcessState.CheckCordonelMapping),
// Precondition: - The detection process has to be completed as the PcbId is needed.
new ProcessStateStruct(
productionProcess: new ConnectCordonel(Resources.StrStateConnectCordonel),
@ -143,6 +134,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
productionProcessNo: 0,
nextStateOnSuccess: ProcessState.DetectCordonel),
// Detection of Cordonel has to be completed before assigning next state, so leave to automatic
// to change the state after successfully execution. The detection is the base for all others.
new ProcessStateStruct(
productionProcess: new DetectCordonel(Resources.StrStateDetectCordonel),
processState: ProcessState.DetectCordonel,
processInfo: Resources.StrStateDetectCordonel,
productionProcessNo: 1,
nextStateOnSuccess: ProcessState.CheckCordonelMapping),
// Detection of Cordonel has to be completed before assigning next state, so leave to automatic
// to change the state after successfully execution. The detection is the base for all others.
new ProcessStateStruct(

View File

@ -168,6 +168,7 @@
<Compile Include="Model\EOLHandler.cs" />
<Compile Include="ProductionProcesses\Enum\GuiItem.cs" />
<Compile Include="ProductionProcesses\EolProcesses\CreateEolProgress.cs" />
<Compile Include="ProductionProcesses\EolProcesses\DetectCordonel.cs" />
<Compile Include="ProductionProcesses\EolProcesses\VisualInspection.cs" />
<Compile Include="ProductionProcesses\EventArgs\GuiMessageArgs.cs" />
<Compile Include="ProductionProcesses\GenericModules\GenericChecks.cs" />
@ -177,7 +178,7 @@
<Compile Include="ProductionProcesses\GenericProcesses\ErrorHandler.cs" />
<Compile Include="ProductionProcesses\EolProcesses\ExecStoreConfiguration.cs" />
<Compile Include="ProductionProcesses\GenericProcesses\GetSerialNumberAndRadioAddress.cs" />
<Compile Include="ProductionProcesses\GenericProcesses\DetectCordonel.cs" />
<Compile Include="ProductionProcesses\GenericProcesses\BaseDetectCordonel.cs" />
<Compile Include="ProductionProcesses\EolProcesses\ExecRebootCordonel.cs" />
<Compile Include="ProductionProcesses\EolProcesses\PrepareShipping.cs" />
<Compile Include="ProductionProcesses\Enum\DialogResult.cs" />
@ -185,6 +186,7 @@
<Compile Include="ProductionProcesses\Enum\ProcessState.cs" />
<Compile Include="ProductionProcesses\EventArgs\SingleProcessStateArgs.cs" />
<Compile Include="ProductionProcesses\EolProcesses\EolProcessStatesDef.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\DetectCordonel.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\CheckOrderNumber.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\CheckProductionState.cs" />
<Compile Include="ProductionProcesses\PickingProcesses\CheckCordonelMapping.cs" />