From 0b683319c53b5112ac8c4d1bddfbfbab7b6f2a97 Mon Sep 17 00:00:00 2001 From: Thomas Wiedebusch Date: Wed, 18 Jun 2025 12:03:02 +0200 Subject: [PATCH] ProductionUiCordonel: - meter length --- .../Genesis/GenesisCore/GenesisMeter.cs | 2 +- .../Genesis/GenesisCore/IGenesisMeter.cs | 5 +- .../EolProcesses/CheckProductionState.cs | 51 +++++++++----- .../GenericModules/GenericChecks.cs | 68 +++++++++++++++---- .../PickingProcesses/CheckProductionState.cs | 11 ++- .../ProductionWindow.xaml | 2 + .../ProductionWindow.xaml.cs | 5 ++ .../Properties/Resources.Designer.cs | 9 +++ .../Properties/Resources.de.resx | 3 + .../Properties/Resources.resx | 5 +- 10 files changed, 122 insertions(+), 39 deletions(-) diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs index 5afad7c5..5c0b46ae 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs @@ -236,7 +236,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// public String MeterLength { - protected set; + set; get; } = "?"; diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs index ef4a2715..f5563c77 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs @@ -97,10 +97,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// /// Length of the meter. /// - String MeterLength - { - get; - } + String MeterLength { get; set; } /// /// Pressure sensor assembled to meter. diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckProductionState.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckProductionState.cs index f923459e..3f203e66 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckProductionState.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/EolProcesses/CheckProductionState.cs @@ -28,7 +28,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr /// /// Maximum of expected processing steps for this process to feed the GUI progress bar. /// - private const Int32 MaxActualProgressSteps = 22; + private const Int32 MaxActualProgressSteps = 23; /// /// Successfully test on flow test bench will return this const value. @@ -120,13 +120,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr ActualProcessProgress++; // Get clustered FileId of firmware package for production or on special requirement release candidates - var isSpecialActive = ProductionRequirements.IsSpecialActive != null && + var isSpecialActive = ProductionRequirements.IsSpecialActive != null && (Boolean)ProductionRequirements.IsSpecialActive && - ProductionRequirements.IsSpecialApproved != null && + ProductionRequirements.IsSpecialApproved != null && (Boolean)ProductionRequirements.IsSpecialApproved; if (string.IsNullOrEmpty(ProductionRequirements.FwVersion) || - !MeterFwUpdate.SearchProdFwInDb(ProductionRequirements.FwVersion, out var parentFileId, out error, + !MeterFwUpdate.SearchProdFwInDb(ProductionRequirements.FwVersion, out var parentFileId, out error, !isSpecialActive) || parentFileId == null) { Meter.WriteLog(error); @@ -167,9 +167,22 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Exit if meanwhile cancellation is required if (CancellationToken.IsCancellationRequested) return CancellationProcedure(); - + ActualProcessProgress++; + // Get the meter length from VAKO needed for radio parameter message + if (!GenericChecks.GetMeterLengthFromDb(Meter)) + { + // Meter size unknown + ErrorMsgDispatcher(Resources.StrErrorMsgMeterLengthUnknown); + return StatusReturn.Failed; + } + + // Exit if meanwhile cancellation is required + if (CancellationToken.IsCancellationRequested) + return CancellationProcedure(); + + ActualProcessProgress++; // Check if requirement will force skipping of calibration if (!ProductionRequirements.SkipCalibration) { @@ -185,7 +198,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Exit if meanwhile cancellation is required if (CancellationToken.IsCancellationRequested) return CancellationProcedure(); - + ActualProcessProgress++; // Get the pre- and final flow test state. @@ -201,7 +214,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Exit if meanwhile cancellation is required if (CancellationToken.IsCancellationRequested) return CancellationProcedure(); - + ActualProcessProgress++; // Fill the results to calibration check register restorer which will be used to read the actual @@ -250,6 +263,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr CalibCheckRegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler; }// Not Skip calibration loop + ActualProcessProgress++; + return StatusReturn.Okay; } @@ -545,17 +560,17 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr erroneousSequenceStep = true; } #endregion -------------------------------- Check Calibration Values -------------------------------------- - + #region ----------------------------------- Summarize Check Results --------------------------------------- - + // One or more checks failed if (erroneousSequenceStep) return StatusReturn.Failed; - + // One or more checks generated a warning if (warningSequenceStep) return StatusReturn.Skipped; - + // Here everything went fine SuccessMsgDispatcher(feedbackMsg); @@ -674,11 +689,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr EolProgress.SpecialRequirementId = ProductionRequirements.SpecialId; EolProgress.SpecialRequirementVersion = ProductionRequirements.SpecialVersion; - feedbackMsg = isSpecialActive && - ProductionRequirements.SpecialId != null && - ProductionRequirements.SpecialVersion != null ? - Resources.StrWarningMsgSpecialRequirementActive + - $" Id.Ver: {ProductionRequirements.SpecialId}.{ProductionRequirements.SpecialVersion}" : + feedbackMsg = isSpecialActive && + ProductionRequirements.SpecialId != null && + ProductionRequirements.SpecialVersion != null ? + Resources.StrWarningMsgSpecialRequirementActive + + $" Id.Ver: {ProductionRequirements.SpecialId}.{ProductionRequirements.SpecialVersion}" : Resources.StrSuccessMsgRequirementActive + $" Id.Ver {ProductionRequirements.StandardId}.{ProductionRequirements.StandardVersion}"; @@ -915,7 +930,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr /// private String CheckFwAndApps(out String feedbackMsg) { - var fwCheckMsg = GenericChecks.CheckFwAndApps(Meter, ProductionRequirements, FwUpdatePackage, + var fwCheckMsg = GenericChecks.CheckFwAndApps(Meter, ProductionRequirements, FwUpdatePackage, out feedbackMsg); // Fill the EOL progress @@ -1322,7 +1337,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr // Allow overwriting of calibration successfully checked to okay if (EolProgress.ProductionStatusCalibrationChecked == null) EolProgress.ProductionStatusCalibrationChecked = EOLStatus.OK; - + // Stop logging CalibCheckRegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler; diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericModules/GenericChecks.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericModules/GenericChecks.cs index 45f4a449..37a1a667 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericModules/GenericChecks.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericModules/GenericChecks.cs @@ -3,11 +3,15 @@ using Logic.ProductionToProductMapper.Files.Fw; using System; using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; +using Xylem.Common.CommonCore.Configuration; using Xylem.Common.CommonCore.Consts; using Xylem.Common.Hardware.WaterMeter.Genesis.Applications; using Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Const; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile; +using Xylem.Common.Logic.ProductionOrderCore.Vako; +using Xylem.Common.Logic.SoftwareAccessHelper; using Xylem.Common.Production.ProductionUiCordonel.Properties; namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.GenericModules @@ -28,7 +32,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener /// /// - Import from CheckProductionState for common use. /// - public static StatusReturn CheckKitronRadioSignalLevels(IGenesisMeter meter, RegisterRestorer registerRestorer, + public static StatusReturn CheckKitronRadioSignalLevels(IGenesisMeter meter, RegisterRestorer registerRestorer, Boolean skipRadioCheck, out String feedbackMsg) { feedbackMsg = ""; @@ -38,26 +42,26 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener { return StatusReturn.Failed; } + // The NA region has no radio or radio check should be ignored if (meter.Region.Equals("NA") || skipRadioCheck) { return StatusReturn.Skipped; } - + var pressureSensorAssembled = + meter.PressureSensorAssembled ? $", {Resources.StrLblPressureSensorAssembledTxt}" : ""; + var meterInfo = $"{Resources.StrLblRadioFrequencyTxt}: {meter.RadioFrequencyMhz} MHz," + + $"{Resources.StrLblMeterSizeTxt}: {meter.MeterSize}, " + + $"{Resources.StrLblMeterLengthTxt}: {meter.MeterLength} mm" + + $"{pressureSensorAssembled}"; // On unknown radio signal level parameters from Kitron those are not in the list of the programming parameters if (!registerRestorer.RecoveryRegisters.Any(x => x.RegisterIdent.Equals("SENSUSRADIO_PowerLevel"))) { - var pressureSensorAssembled = meter.PressureSensorAssembled ? - $", {Resources.StrLblPressureSensorAssembledTxt}": - ""; - feedbackMsg = $"{Resources.StrErrorMsgRadioSignalLevels} " + - $"{Resources.StrLblRadioFrequencyTxt}: {meter.RadioFrequencyMhz} MHz," + - $"{Resources.StrLblMeterSizeTxt}: {meter.MeterSize}, " + - $"{Resources.StrLblMeterLengthTxt}: {meter.MeterLength} mm" + - $"{pressureSensorAssembled}"; - return StatusReturn.Failed; + feedbackMsg = Resources.StrErrorMsgRadioSignalLevels + " " + meterInfo; + return StatusReturn.Failed; } - feedbackMsg = Resources.StrSuccessMsgRadioSignalLevels; + + feedbackMsg = Resources.StrSuccessMsgRadioSignalLevels + ". " + meterInfo; return StatusReturn.Okay; } @@ -82,7 +86,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener /// /// - Import from CheckProductionState for common use. /// - public static String CheckFwAndApps(IGenesisMeter meter, CordonelRequirements requirements, + public static String CheckFwAndApps(IGenesisMeter meter, CordonelRequirements requirements, List fwUpdatePackage, out String feedbackMsg) { feedbackMsg = ""; @@ -134,7 +138,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener // ABC (application binary container) fwUpdate.CompareAllMeterAndFileApps(); - if (// Validate package description file with required Apps (fileApps) and build the CORE REVISIONS MIN MAX + if ( // Validate package description file with required Apps (fileApps) and build the CORE REVISIONS MIN MAX !fwUpdate.ValidateFileAppsWithPackageFile() || // Check if any meter Apps is outdated or does contain an un-matching CRC meter.MeterAppListVersion.Any(app => app.Status != MeterAppState.MeterAppUpToDate && @@ -158,8 +162,44 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener feedbackMsg += $"{Resources.StrErrorMsgRequirementFw}\n"; return ""; } + feedbackMsg = $"{Resources.StrSuccessMsgRequirementFw} - Firmware: {meter.FwVersion}"; return meter.FwVersion; } + + /// + /// Get the meter length form database as single VAKO parameter + /// + /// + /// + /// + /// - Initial. + /// + public static Boolean GetMeterLengthFromDb(IGenesisMeter meter) + { + if (meter == null) + return false; + try + { + var a = LocalWebRequest.GetRequest( + $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetSingleVakoKey?ProductionOrderNumber=" + + $"{meter.OrderNumber}&KeyName=C_GEN_BAULAENGE"); + var response = JsonConvert.DeserializeObject(a); + + if (response == null || string.IsNullOrEmpty(response.Value)) + { + // Meter size unknown + return false; + } + + meter.MeterLength = response.Value; + return true; + } + catch (Exception) + { + // Meter size unknown + return false; + } + } } } diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckProductionState.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckProductionState.cs index 1373ced7..7e4efa18 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckProductionState.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/PickingProcesses/CheckProductionState.cs @@ -21,7 +21,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki /// /// Maximum of expected processing steps for this process to feed the GUI progress bar. /// - private const Int32 MaxActualProgressSteps = 13; + private const Int32 MaxActualProgressSteps = 14; /// /// FW update package containing the ABC and the ADF. @@ -122,6 +122,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki ActualProcessProgress++; + // Get the meter length from VAKO needed for radio parameter message + if (!GenericChecks.GetMeterLengthFromDb(Meter)) + { + // Meter size unknown + ErrorMsgDispatcher(Resources.StrErrorMsgMeterLengthUnknown); + return StatusReturn.Failed; + } + ActualProcessProgress++; + return StatusReturn.Okay; } diff --git a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml index fe88c0f9..ddf06466 100644 --- a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml +++ b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml @@ -112,6 +112,7 @@