diff --git a/Common/CommonCore.Configuration/ServiceUrlsBackUp_New.cs b/Common/CommonCore.Configuration/ServiceUrlsBackUp_New.cs index f33f55fa..3ac4493b 100644 --- a/Common/CommonCore.Configuration/ServiceUrlsBackUp_New.cs +++ b/Common/CommonCore.Configuration/ServiceUrlsBackUp_New.cs @@ -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 } + /// + /// Get Cordonel mapping + /// + /// + public static String GetCordonelMappingServiceUrl() + { + return ConfigurationManager.AppSettings["GetCordonelMappingServiceUrl"] ?? + DefaultGetCordonelMappingServiceUrl; + } + /// /// Get Cordonel order overview to check the assignment state /// @@ -428,7 +441,7 @@ namespace Xylem.Common.CommonCore.Configuration /// 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}"; } /// @@ -441,7 +454,7 @@ namespace Xylem.Common.CommonCore.Configuration /// 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}"; } /// diff --git a/Common/Logic/ProductionOrderCore/OrderData/CordonelCustomerOrderDb.cs b/Common/Logic/ProductionOrderCore/OrderData/CordonelCustomerOrderDb.cs index 06e90940..811ba937 100644 --- a/Common/Logic/ProductionOrderCore/OrderData/CordonelCustomerOrderDb.cs +++ b/Common/Logic/ProductionOrderCore/OrderData/CordonelCustomerOrderDb.cs @@ -46,7 +46,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData /// public String CordonelMeterSizeName { get; set; } /// - /// Meter size id fro direct programming to meter + /// Meter size id from direct programming to meter /// public Int64 CordonelMeterSizeId { get; set; } } diff --git a/Common/Logic/ProductionOrderCore/OrderData/CordonelMappingDb.cs b/Common/Logic/ProductionOrderCore/OrderData/CordonelMappingDb.cs new file mode 100644 index 00000000..d971f5ce --- /dev/null +++ b/Common/Logic/ProductionOrderCore/OrderData/CordonelMappingDb.cs @@ -0,0 +1,28 @@ +using System; + +namespace Xylem.Common.Logic.ProductionOrderCore.OrderData +{ + /// + /// Cordonel serial numbers + /// + [Serializable] + public class CordonelMappingDb + { + /// + /// PcbId + /// + public String PcbId { get; set; } + /// + /// Order number picking + /// + public Int64? CordonelAssignedPicking_FertigungsAuftragsNr { get; set; } + /// + /// Order number pressure test + /// + public Int64? CordonelPressureTest_FertigungsAuftragsNr { get; set; } + /// + /// Mapped serial number + /// + public Int64? MapPcbIdToSerialNumber_SerialNumber { get; set; } + } +} diff --git a/Common/Logic/ProductionOrderCore/OrderData/OrderDetailsDb.cs b/Common/Logic/ProductionOrderCore/OrderData/OrderDetailsDb.cs index 836a613c..95d95c2c 100644 --- a/Common/Logic/ProductionOrderCore/OrderData/OrderDetailsDb.cs +++ b/Common/Logic/ProductionOrderCore/OrderData/OrderDetailsDb.cs @@ -31,7 +31,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData /// /// - Import from FwUpdateDb. /// - public static Boolean GetAllCordonelSerialNumbersFromDb(Int64 orderNumber, Int64 orderPos, + public static Boolean GetAllCordonelSerialNumbersFromDb(Int64 orderNumber, Int64 orderPos, out List serialNumbers) { try @@ -66,7 +66,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData /// /// - Initial. /// - public static Boolean GetCordonelOrderDetails(Int64 productionOrderNumber, + public static Boolean GetCordonelOrderDetails(Int64 productionOrderNumber, out List orderDetails) { try @@ -105,7 +105,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData /// /// - Initial. /// - 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 } } + /// + /// Get Cordonel mapping. + /// + /// + /// + /// true if successful + /// + /// - Initial. + /// + public static Boolean GetCordonelMapping(String pcbId, out List cordonelMap) + { + try + { + var url = ServiceUrls.GetCordonelMappingServiceUrl() + pcbId; + var requestResponse = LocalWebRequest.GetRequest(url, moderateTimeoutDbRequest); + if (string.IsNullOrEmpty(requestResponse)) + { + cordonelMap = new List(); + return false; + } + cordonelMap = JsonConvert.DeserializeObject>(requestResponse); + return cordonelMap != null && cordonelMap.Count > 0; + } + catch (Exception) + { + cordonelMap = new List(); + return false; + } + } + /// /// 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 /// /// - Import from FwUpdateDb. /// - public static Boolean GetAllCordonelCustomerOrdersFromDb(Int64 customerNumber, + public static Boolean GetAllCordonelCustomerOrdersFromDb(Int64 customerNumber, out List customerOrders) - { + { try { var url = ServiceUrls.ListAllCordonelCustomerOrdersServiceUrl(); diff --git a/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj b/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj index a83ff8fd..a55c74f5 100644 --- a/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj +++ b/Common/Logic/ProductionOrderCore/ProductionOrderCore.csproj @@ -126,6 +126,7 @@ + diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/DetectCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/DetectCordonel.cs new file mode 100644 index 00000000..a2f88dd5 --- /dev/null +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/DetectCordonel.cs @@ -0,0 +1,19 @@ +using System; +using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.GenericProcesses; + +namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolProcesses +{ + public class DetectCordonel : BaseDetectCordonel + { + /// + public DetectCordonel(String name) : base(name) + { + } + + /// + protected override Boolean ValidateProcessAndPublishDataToGui() + { + return true; + } + } +} diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs index 2136da04..138c4c13 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/EolProcessStatesDef.cs @@ -123,14 +123,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr var stateContainer = new List { #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( diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseCheckOrderNumber.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseCheckOrderNumber.cs index 5c32c1ba..c15a81b3 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseCheckOrderNumber.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseCheckOrderNumber.cs @@ -112,10 +112,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener /// Application differences in check result /// /// - /// - protected virtual Boolean ValidateProcessAndPublishDataToGui(OrderOverViewCordonel orderOverview) - { - throw new NotImplementedException(); - } + protected abstract Boolean ValidateProcessAndPublishDataToGui(OrderOverViewCordonel orderOverview); } } diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/DetectCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseDetectCordonel.cs similarity index 79% rename from Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/DetectCordonel.cs rename to Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseDetectCordonel.cs index 0c2d9993..64ffcb16 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/DetectCordonel.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/BaseDetectCordonel.cs @@ -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. /// - public class DetectCordonel : BaseProductionProcess + public abstract class BaseDetectCordonel : BaseProductionProcess { /// /// Ctor /// Setup of name and single process state /// - 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; } + + /// + /// Application differences in check result + /// + /// + protected abstract Boolean ValidateProcessAndPublishDataToGui(); } } diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs index 11a23721..40373aca 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs @@ -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 process has to be completed as the PcbId is needed. + /// - The process has to be completed as the PcbId is needed. /// /// /// diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/GetFinalParametrization.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/GetFinalParametrization.cs index 854de938..ce4b0dba 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/GetFinalParametrization.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/GetFinalParametrization.cs @@ -27,7 +27,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener /// /// Get programming parameters for Cordonel including VAKO and CSD /// Precondition: - /// - The process has to be completed as the PcbId is needed. + /// - The process has to be completed as the PcbId is needed. /// /// /// diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/DetectCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/DetectCordonel.cs new file mode 100644 index 00000000..94d00760 --- /dev/null +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/DetectCordonel.cs @@ -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 + { + /// + public DetectCordonel(String name) : base(name) + { + } + + /// + protected override Boolean ValidateProcessAndPublishDataToGui() + { + // Check mapping information + if (!OrderDetailsDb.GetCordonelMapping(Meter.PcbId, out var cordonelMapping)) + { + return false; + } + // Reserve picking for this device + + return true; + } + } +} diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/PickingProcessStatesDef.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/PickingProcessStatesDef.cs index 8fe63bca..d44bc787 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/PickingProcessStatesDef.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/PickingProcessStatesDef.cs @@ -32,7 +32,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki /// INSTRUCTION FOR PREPARATION: /// ----------------------------- /// STEP 1: Define some states for your processes - /// STEP 2: Implement your processes like + /// STEP 2: Implement your processes like /// STEP 3: Register and chain your states here /// /// @@ -104,15 +104,6 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki var stateContainer = new List { #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( diff --git a/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj b/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj index 2f6558c7..47fdd36f 100644 --- a/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj +++ b/Common/Production/ProductionUiCordonel/ProductionUiCordonel.csproj @@ -168,6 +168,7 @@ + @@ -177,7 +178,7 @@ - + @@ -185,6 +186,7 @@ +