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
@@ -236,7 +236,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <inheritdoc />
public String MeterLength {
protected set;
set;
get;
} = "?";
@@ -97,10 +97,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Length of the meter.
/// </summary>
String MeterLength
{
get;
}
String MeterLength { get; set; }
/// <summary>
/// Pressure sensor assembled to meter.
@@ -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.
@@ -170,6 +170,19 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
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)
{
@@ -250,6 +263,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.EolPr
CalibCheckRegisterRestorer.OnProcessUpdate -= ProcessUpdate_Handler;
}// Not Skip calibration loop
ActualProcessProgress++;
return StatusReturn.Okay;
}
@@ -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
@@ -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;
}
// 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," +
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")))
{
feedbackMsg = Resources.StrErrorMsgRadioSignalLevels + " " + meterInfo;
return StatusReturn.Failed;
}
feedbackMsg = Resources.StrSuccessMsgRadioSignalLevels;
feedbackMsg = Resources.StrSuccessMsgRadioSignalLevels + ". " + meterInfo;
return StatusReturn.Okay;
}
@@ -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>
@@ -367,6 +367,9 @@
<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>