ProductionUiCordonel: - meter length

This commit is contained in:
Thomas Wiedebusch
2025-06-18 12:03:02 +02:00
parent 1e198570ea
commit 0b683319c5
10 changed files with 122 additions and 39 deletions
@@ -28,7 +28,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
/// <summary>
/// Maximum of expected processing steps for this process to feed the GUI progress bar.
/// </summary>
private const Int32 MaxActualProgressSteps = 22;
private const Int32 MaxActualProgressSteps = 23;
/// <summary>
/// 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
/// </remarks>
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;
@@ -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
/// <remarks date="2025-Mai-28" author="Thomas Wiedebusch">
/// - Import from CheckProductionState for common use.
/// </remarks>
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
/// <remarks date="2025-Mai-28" author="Thomas Wiedebusch">
/// - Import from CheckProductionState for common use.
/// </remarks>
public static String CheckFwAndApps(IGenesisMeter meter, CordonelRequirements requirements,
public static String CheckFwAndApps(IGenesisMeter meter, CordonelRequirements requirements,
List<FilePart> 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;
}
/// <summary>
/// Get the meter length form database as single VAKO parameter
/// </summary>
/// <param name="meter"></param>
/// <returns></returns>
/// <remarks date="2025-Jun-17" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
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<VakoKeyValue>(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;
}
}
}
}
@@ -21,7 +21,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Picki
/// <summary>
/// Maximum of expected processing steps for this process to feed the GUI progress bar.
/// </summary>
private const Int32 MaxActualProgressSteps = 13;
private const Int32 MaxActualProgressSteps = 14;
/// <summary>
/// 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;
}
@@ -112,6 +112,7 @@
<Label Content="Firmware:" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="0" Grid.Column="5"/>
<Label x:Name="lblLutText" Content="LUT CRC:" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="1" Grid.Column="5"/>
<Label x:Name="lblMeterSizeText" Content="Meter Size:" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="2" Grid.Column="5"/>
<Label x:Name="lblMeterLengthText" Content="Meter Length:" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="3" Grid.Column="5"/>
<Label Content="" x:Name="lblSerialNumberValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="0" Grid.Column="3"/>
<Label Content="" x:Name="lblOrderNumberValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="1" Grid.Column="3"/>
@@ -120,6 +121,7 @@
<Label Content="" x:Name="lblFwValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="0" Grid.Column="6"/>
<Label Content="" x:Name="lblLutValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="1" Grid.Column="6"/>
<Label Content="" x:Name="lblMeterSizeValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="2" Grid.Column="6"/>
<Label Content="" x:Name="lblMeterLengthValue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="2,2,2,2" Grid.Row="3" Grid.Column="6"/>
<!--Pictures-->
<Border Grid.Row="0" Grid.RowSpan="4" Grid.Column="0" Margin="2,2,2,2" BorderThickness="1" BorderBrush="Black" Grid.ColumnSpan="2">
@@ -106,6 +106,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
UpdateContentControl(lblRadioAddressText, Properties.Resources.StrLblRadioAddressTxt + ":");
UpdateContentControl(lblOrderNumberText, Properties.Resources.StrLblOrderNumberTxt + ":");
UpdateContentControl(lblMeterSizeText, Properties.Resources.StrLblMeterSizeTxt + ":");
UpdateContentControl(lblMeterLengthText, Properties.Resources.StrLblMeterLengthTxt + ":");
UpdateContentControl(lblSingleProcessText, Properties.Resources.StrLblSingleProcessText + ":");
UpdateContentControl(lblTotalProcessText, Properties.Resources.StrLblTotalProcessText + ":");
optionsMenu.Header = Properties.Resources.StrMenuOptionsText;
@@ -729,6 +730,9 @@ namespace Xylem.Common.Production.ProductionUiCordonel
UpdateContentControl(lblMeterSizeValue,
!string.IsNullOrEmpty(genesisMeter.MeterSize) ? genesisMeter.MeterSize : "?");
UpdateContentControl(lblMeterLengthValue,
!string.IsNullOrEmpty(genesisMeter.MeterLength) ? genesisMeter.MeterLength + " mm": "?");
UpdateContentControl(lblLutValue,
!string.IsNullOrEmpty(genesisMeter.LutCrc) ? genesisMeter.LutCrc : "?");
@@ -821,6 +825,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
UpdateContentControl(lblRadioAddressText, "");
UpdateContentControl(lblFwValue, "?");
UpdateContentControl(lblMeterSizeValue, "?");
UpdateContentControl(lblMeterLengthValue, "?");
UpdateContentControl(lblLutValue, "?");
UpdateContentControl(lblSerialNumberValue, "?");
UpdateContentControl(lblRegionValue, "?");
@@ -519,6 +519,15 @@ namespace Xylem.Common.Production.ProductionUiCordonel.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Cordonel length is unknown.
/// </summary>
internal static string StrErrorMsgMeterLengthUnknown {
get {
return ResourceManager.GetString("StrErrorMsgMeterLengthUnknown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Communication port is in use or not present. The software is going to exit!.
/// </summary>
@@ -366,6 +366,9 @@
</data>
<data name="StrErrorMsgLifeTimeCalculation" xml:space="preserve">
<value>FEHLER: Restlaufzeitberechnung fehlgeschlagen</value>
</data>
<data name="StrErrorMsgMeterLengthUnknown" xml:space="preserve">
<value>FEHLER: Cordonel Baulänge ist unbekannt</value>
</data>
<data name="StrStateFinalTestFailed" xml:space="preserve">
<value>FEHLER: Versandfertigmachen fehlgeschlagen</value>
@@ -364,9 +364,12 @@
<data name="StrErrorMsgRemainingLifeTime" xml:space="preserve">
<value>ERROR: Remaining lifetime too short</value>
</data>
<data name="StrErrorMsgLifeTimeCalculation" xml:space="preserve">
<data name="StrErrorMsgLifeTimeCalculation" xml:space="preserve">
<value>ERROR: Lifetime calculation failed</value>
</data>
<data name="StrErrorMsgMeterLengthUnknown" xml:space="preserve">
<value>ERROR: Cordonel length is unknown</value>
</data>
<data name="StrStateFinalTestFailed" xml:space="preserve">
<value>ERROR: Preparation for shipping failed</value>
</data>