CommonCore: - Constants for inter-program communication introduced
This commit is contained in:
parent
4f2fc66ef2
commit
8aaeb27f17
@ -81,6 +81,7 @@
|
||||
<Link>Properties\SharedAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Consts\ProgramConfig.cs" />
|
||||
<Compile Include="Consts\Constants.cs" />
|
||||
<Compile Include="Consts\SyncMarkRecord.cs" />
|
||||
<Compile Include="Exceptions\DB\PcbIdNotException.cs" />
|
||||
<Compile Include="Exceptions\ICommonException.cs" />
|
||||
|
||||
19
Common/CommonCore/Consts/Constants.cs
Normal file
19
Common/CommonCore/Consts/Constants.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.CommonCore.Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// Constants for inter-program exchange
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Marker for lack of information in strings e.g. for region, size, LutCrc, ...
|
||||
/// </summary>
|
||||
public const String StrUnknown = "?";
|
||||
/// <summary>
|
||||
/// Marker for wildcard in search operations
|
||||
/// </summary>
|
||||
public const String StrWildcard = "*";
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ using System.Management;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
|
||||
|
||||
namespace Xylem.Common.Cryptology.Security
|
||||
@ -86,7 +87,7 @@ namespace Xylem.Common.Cryptology.Security
|
||||
/// </remarks>
|
||||
public static String GetPcNameFromHwId(String hardwareId)
|
||||
{
|
||||
if (!hardwareId.Contains(SeparatorPcFromHwId)) return "?";
|
||||
if (!hardwareId.Contains(SeparatorPcFromHwId)) return Constants.StrUnknown;
|
||||
var hwIdFields = hardwareId.Split(Convert.ToChar(SeparatorPcFromHwId));
|
||||
return hwIdFields[0];
|
||||
}
|
||||
|
||||
@ -79,5 +79,11 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -1200,7 +1200,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
public Int32? CoreRevision;
|
||||
|
||||
/// <summary>
|
||||
/// This is the FLEXNET version which describes the entire packet.
|
||||
/// This is the FLEXNETVERSION version which describes the entire packet.
|
||||
/// </summary>
|
||||
public String FwVersion;
|
||||
|
||||
@ -1215,7 +1215,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
public String MeterSize;
|
||||
|
||||
/// <summary>
|
||||
/// Region (EMEA or NA).
|
||||
/// Region (EMEA, NA or China).
|
||||
/// </summary>
|
||||
public String Region;
|
||||
|
||||
@ -1248,9 +1248,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
LutCrc = $@"0x{lutCrc:X4}";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception)// exception will be thrown if register is not present on versions without LUT
|
||||
{
|
||||
// ignored
|
||||
LutCrc = Constants.StrUnknown;
|
||||
}
|
||||
|
||||
//read meter size
|
||||
@ -1258,7 +1258,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
ReadRegister(Register.Genesisflow.MeterSize)));
|
||||
|
||||
//read radio frequency
|
||||
Region = "NA";
|
||||
Region = Constants.StrUnknown;
|
||||
RadioFrequencyMhz = null;
|
||||
try
|
||||
{
|
||||
@ -1269,18 +1269,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
RadioFrequencyMhz = RegisterConverter.ConvertTo<Int32>(radioFrequencyRaw);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception) // exception will be thrown on uninstalled SENSUSRADIO
|
||||
{
|
||||
// ignored
|
||||
Region = "NA";
|
||||
}
|
||||
|
||||
// check meter size string contains "DN", because if "US" it cannot be an EMEA version
|
||||
if ((Region.Contains("NA") && MeterSize.Contains("DN")) ||
|
||||
(Region.Contains("EMEA") && MeterSize.Contains("US")))
|
||||
{
|
||||
Region = "?";
|
||||
MeterSize = "?";
|
||||
LutCrc = "?";
|
||||
Region = Constants.StrUnknown;
|
||||
MeterSize = Constants.StrUnknown;
|
||||
LutCrc = Constants.StrUnknown;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Properties;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
|
||||
@ -28,7 +29,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <summary>
|
||||
/// PCB ID for post update for comparison
|
||||
/// </summary>
|
||||
private String _pcbIdPostUpdate = "?";
|
||||
private String _pcbIdPostUpdate = Constants.StrUnknown;
|
||||
|
||||
/// <summary>
|
||||
/// Register content before update
|
||||
|
||||
@ -131,6 +131,10 @@
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
||||
<Project>{D0C859D9-D55E-4E85-AC50-0FF31B1CE50D}</Project>
|
||||
<Name>Logic.ProductionToProductMapper</Name>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
|
||||
@ -101,11 +102,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
/// </summary>
|
||||
public const Char StringDelimiter = '\0';
|
||||
|
||||
/// <summary>
|
||||
/// Wildcard for search all.
|
||||
/// </summary>
|
||||
public const String WildcardAll = "*";
|
||||
|
||||
/// <summary>
|
||||
/// Processed bytes counter
|
||||
/// </summary>
|
||||
@ -498,7 +494,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
/// <remarks date="2023-Jan-04" author="Thomas Wiedebusch">
|
||||
/// - Default wildcard.
|
||||
/// </remarks>
|
||||
public Boolean ReadMeterFileCatalog(out List<String> files, String drive, String wildcard = WildcardAll)
|
||||
public Boolean ReadMeterFileCatalog(out List<String> files, String drive, String wildcard = Constants.StrWildcard)
|
||||
{
|
||||
files = new List<String>();
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
|
||||
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
{
|
||||
@ -12,7 +13,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
/// </summary>
|
||||
public static String ConvertMeterSizeEnumToSizeName(MeterSize? meterSizeId)
|
||||
{
|
||||
if (meterSizeId == null) return "*";
|
||||
if (meterSizeId == null) return Constants.StrWildcard;
|
||||
switch (meterSizeId)
|
||||
{
|
||||
case MeterSize.DN40:
|
||||
@ -54,9 +55,9 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
return "US12";
|
||||
|
||||
case MeterSize.DNMAX:
|
||||
return "*";
|
||||
return Constants.StrWildcard;
|
||||
default:
|
||||
return "*";
|
||||
return Constants.StrWildcard;
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
switch (orderMeterSize)
|
||||
{
|
||||
case 0: // All sizes
|
||||
return "*";
|
||||
return Constants.StrWildcard;
|
||||
case 40:
|
||||
return "DN40";
|
||||
case 50 :
|
||||
@ -125,7 +126,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
case 305:
|
||||
return "US12";
|
||||
default:
|
||||
return "*";
|
||||
return Constants.StrWildcard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
|
||||
namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
{
|
||||
@ -12,7 +13,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
/// </summary>
|
||||
public static String ConvertRegionEnumToRegionName(Region? regionId)
|
||||
{
|
||||
if (regionId == null) return "*";
|
||||
if (regionId == null) return Constants.StrWildcard;
|
||||
|
||||
switch (regionId)
|
||||
{
|
||||
@ -26,7 +27,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData
|
||||
return "China";
|
||||
|
||||
default:
|
||||
return "*";
|
||||
return Constants.StrWildcard;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,6 +115,10 @@
|
||||
<Compile Include="Vako\VakoParser.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Hardware\WaterMeter\Genesis\DataPackages\DataPackages.csproj">
|
||||
<Project>{0E524D43-7B66-45CD-AA74-41D51AFC3D99}</Project>
|
||||
<Name>DataPackages</Name>
|
||||
|
||||
@ -7,6 +7,7 @@ using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Logic.ProductionToProductMapper.Files.Fw;
|
||||
using Newtonsoft.Json;
|
||||
using Xylem.Common.CommonCore.Configuration;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.Cryptology.Security;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisPwd;
|
||||
using Xylem.Common.Logic.ProductionOrderCore.FW;
|
||||
@ -674,11 +675,11 @@ namespace Xylem.ServiceFwUpdate.Common.FwUpdateDb
|
||||
/// <remarks date="2021-Mar-31" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public Boolean GetAllCordonelCustomersFromDb(String searchPattern = "*")
|
||||
public Boolean GetAllCordonelCustomersFromDb(String searchPattern = Constants.StrWildcard)
|
||||
{
|
||||
// for the DB interface a specific search pattern will be used, so replace it from the user interface
|
||||
// as there is a "*" the placeholder for "all".
|
||||
searchPattern = searchPattern.Replace("*", "%");
|
||||
// as there is a Constants.StrWildcard the placeholder for "all".
|
||||
searchPattern = searchPattern.Replace(Constants.StrWildcard, "%");
|
||||
if (DbSearchedCordonelCustomers == null)
|
||||
DbSearchedCordonelCustomers = new List<CordonelCustomerInfosDb>();
|
||||
DbSearchedCordonelCustomers.Clear();
|
||||
|
||||
@ -87,6 +87,10 @@
|
||||
<Project>{9eb1f659-6f73-4f65-bcab-4114fd94f5fc}</Project>
|
||||
<Name>CommonCore.Configuration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\CommonCore\CommonCore.csproj">
|
||||
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
|
||||
<Name>CommonCore</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\Cryptology\Security\Cryptology.csproj">
|
||||
<Project>{A25A96FD-604B-43BE-80CD-A953152C2175}</Project>
|
||||
<Name>Cryptology</Name>
|
||||
|
||||
@ -563,7 +563,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
_cordonelProductionSearchInfos.Count != 0 &&
|
||||
_cordonelProductionSearchInfos.Any(x =>
|
||||
x.CustomerSerialNumber.Contains(tbxCordonelProductionOrdersSearch.Text)) &&
|
||||
cbxCordonelProductionOrdersSearch.Text == @"*")
|
||||
cbxCordonelProductionOrdersSearch.Text == Constants.StrWildcard)
|
||||
{
|
||||
_cordonelsPropertyChanged = true;
|
||||
return;
|
||||
@ -602,7 +602,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
|
||||
|
||||
if (cbxCordonelProductionOrdersSearch?.SelectedItem == null ||
|
||||
cbxCordonelProductionOrdersSearch.SelectedItem.ToString() == @"*")
|
||||
cbxCordonelProductionOrdersSearch.SelectedItem.ToString() == Constants.StrWildcard)
|
||||
{
|
||||
_cordonelCustomerOrdersSearch.AddRange(_fwUpdateDbAccess.DbCordonelCustomerOrders);
|
||||
}
|
||||
@ -1478,7 +1478,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
{
|
||||
|
||||
if (cordonel == null)
|
||||
return "?";
|
||||
return Constants.StrUnknown;
|
||||
|
||||
// preset to unknown FW-package
|
||||
cordonel.IsRemoved = true;
|
||||
@ -1487,7 +1487,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
|
||||
if (_fwUpdatePackage?.FwPackageInfo == null || _fwUpdateDbAccess?.DbCordonelFwPackagesInfo == null)
|
||||
{
|
||||
return "?";
|
||||
return Constants.StrUnknown;
|
||||
}
|
||||
|
||||
foreach (var fw in _fwUpdateDbAccess.DbCordonelFwPackagesInfo)
|
||||
@ -1499,7 +1499,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
// assign the unique version for all devices, even if these are having a lack of information
|
||||
cordonel.RequiredReleaseNameVersion = fw.Name;
|
||||
|
||||
if (cordonel.CoreRevision != null && !cordonel.CoreRevision.Contains("?"))
|
||||
if (cordonel.CoreRevision != null && !cordonel.CoreRevision.Contains(Constants.StrUnknown))
|
||||
{
|
||||
|
||||
// extract the Cordonel core version
|
||||
@ -1522,7 +1522,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
return cordonel.RequiredReleaseNameVersion;
|
||||
}
|
||||
|
||||
return "?";
|
||||
return Constants.StrUnknown;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
@ -1708,8 +1708,8 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
_fwUpdateDbAccess.DbCordonelCustomerOrders.Count + 1)
|
||||
{
|
||||
cbxCordonelProductionOrdersSearch.Items.Clear();
|
||||
cbxCordonelProductionOrdersSearch.Text = @"*";
|
||||
cbxCordonelProductionOrdersSearch.Items.Add("*");
|
||||
cbxCordonelProductionOrdersSearch.Text = Constants.StrWildcard;
|
||||
cbxCordonelProductionOrdersSearch.Items.Add(Constants.StrWildcard);
|
||||
foreach (var order in _fwUpdateDbAccess.DbCordonelCustomerOrders)
|
||||
{
|
||||
cbxCordonelProductionOrdersSearch.Items.Add(
|
||||
@ -1831,11 +1831,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (_radioSearchItems.Count + 1 != cbxFwPackageRadioMask.Items.Count)
|
||||
{
|
||||
cbxFwPackageRadioMask.Items.Clear();
|
||||
cbxFwPackageRadioMask.Text = @"*";
|
||||
cbxFwPackageRadioMask.Items.Add("*");
|
||||
cbxFwPackageRadioMask.Text = Constants.StrWildcard;
|
||||
cbxFwPackageRadioMask.Items.Add(Constants.StrWildcard);
|
||||
foreach (var item in _radioSearchItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && item != "?")
|
||||
if (!string.IsNullOrEmpty(item) && item != Constants.StrUnknown)
|
||||
cbxFwPackageRadioMask.Items.Add(item);
|
||||
}
|
||||
}
|
||||
@ -1844,11 +1844,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (_regionSearchItems.Count + 1 != cbxFwPackageRegionMask.Items.Count)
|
||||
{
|
||||
cbxFwPackageRegionMask.Items.Clear();
|
||||
cbxFwPackageRegionMask.Text = @"*";
|
||||
cbxFwPackageRegionMask.Items.Add("*");
|
||||
cbxFwPackageRegionMask.Text = Constants.StrWildcard;
|
||||
cbxFwPackageRegionMask.Items.Add(Constants.StrWildcard);
|
||||
foreach (var item in _regionSearchItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && item != "?")
|
||||
if (!string.IsNullOrEmpty(item) && item != Constants.StrUnknown)
|
||||
cbxFwPackageRegionMask.Items.Add(item);
|
||||
}
|
||||
}
|
||||
@ -1856,11 +1856,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (_sizeSearchItems.Count + 1 != cbxFwPackageSizeMask.Items.Count)
|
||||
{
|
||||
cbxFwPackageSizeMask.Items.Clear();
|
||||
cbxFwPackageSizeMask.Text = @"*";
|
||||
cbxFwPackageSizeMask.Items.Add("*");
|
||||
cbxFwPackageSizeMask.Text = Constants.StrWildcard;
|
||||
cbxFwPackageSizeMask.Items.Add(Constants.StrWildcard);
|
||||
foreach (var item in _sizeSearchItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && item != "?")
|
||||
if (!string.IsNullOrEmpty(item) && item != Constants.StrUnknown)
|
||||
cbxFwPackageSizeMask.Items.Add(item);
|
||||
}
|
||||
}
|
||||
@ -1868,11 +1868,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (_metrologySearchItems.Count + 1 != cbxFwPackageSearchMetrology.Items.Count)
|
||||
{
|
||||
cbxFwPackageSearchMetrology.Items.Clear();
|
||||
cbxFwPackageSearchMetrology.Text = @"*";
|
||||
cbxFwPackageSearchMetrology.Items.Add("*");
|
||||
cbxFwPackageSearchMetrology.Text = Constants.StrWildcard;
|
||||
cbxFwPackageSearchMetrology.Items.Add(Constants.StrWildcard);
|
||||
foreach (var item in _metrologySearchItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && item != "?")
|
||||
if (!string.IsNullOrEmpty(item) && item != Constants.StrUnknown)
|
||||
cbxFwPackageSearchMetrology.Items.Add(item);
|
||||
}
|
||||
}
|
||||
@ -1880,11 +1880,11 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (_coreSearchItems.Count + 1 != cbxFwPackageSearchCore.Items.Count)
|
||||
{
|
||||
cbxFwPackageSearchCore.Items.Clear();
|
||||
cbxFwPackageSearchCore.Text = @"*";
|
||||
cbxFwPackageSearchCore.Items.Add("*");
|
||||
cbxFwPackageSearchCore.Text = Constants.StrWildcard;
|
||||
cbxFwPackageSearchCore.Items.Add(Constants.StrWildcard);
|
||||
foreach (var item in _coreSearchItems)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item) && item != "?")
|
||||
if (!string.IsNullOrEmpty(item) && item != Constants.StrUnknown)
|
||||
cbxFwPackageSearchCore.Items.Add(item);
|
||||
}
|
||||
}
|
||||
@ -1909,7 +1909,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
_cordonelProductionPreSelectInfos.Any(prodCord =>
|
||||
!prodCord.IsApproved && prodCord.IsSelected)) ||
|
||||
_cordonelUpdateList.Any(updCord => string.IsNullOrEmpty(updCord.RequiredRelease) ||
|
||||
updCord.RequiredRelease == "?");
|
||||
updCord.RequiredRelease == Constants.StrUnknown);
|
||||
|
||||
if (updateLocked)
|
||||
{
|
||||
@ -2982,21 +2982,21 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
{
|
||||
// pre-selection of displayed FW packages
|
||||
var requiredCoreVersion = 0;
|
||||
if (cbxFwPackageSearchCore.Text != @"*")
|
||||
if (cbxFwPackageSearchCore.Text != Constants.StrWildcard)
|
||||
{
|
||||
var version = cbxFwPackageSearchCore.Text;
|
||||
version = version.Replace(".", "");
|
||||
Int32.TryParse(version, out requiredCoreVersion);
|
||||
}
|
||||
|
||||
if ((fw.Region != cbxFwPackageRegionMask.Text && cbxFwPackageRegionMask.Text != @"*") ||
|
||||
(fw.RadioFrequencyMhz.ToString() != cbxFwPackageRadioMask.Text && cbxFwPackageRadioMask.Text != @"*") ||
|
||||
(fw.MeterSize != cbxFwPackageSizeMask.Text && cbxFwPackageSizeMask.Text != @"*") ||
|
||||
if ((fw.Region != cbxFwPackageRegionMask.Text && cbxFwPackageRegionMask.Text != Constants.StrWildcard) ||
|
||||
(fw.RadioFrequencyMhz.ToString() != cbxFwPackageRadioMask.Text && cbxFwPackageRadioMask.Text != Constants.StrWildcard) ||
|
||||
(fw.MeterSize != cbxFwPackageSizeMask.Text && cbxFwPackageSizeMask.Text != Constants.StrWildcard) ||
|
||||
(((fw.CoreRevisionMin != null && fw.CoreRevisionMin > requiredCoreVersion) ||
|
||||
(fw.CoreRevisionMax != null && requiredCoreVersion > fw.CoreRevisionMax)) &&
|
||||
cbxFwPackageSearchCore.Text != @"*") ||
|
||||
cbxFwPackageSearchCore.Text != Constants.StrWildcard) ||
|
||||
(fw.MetrologyVersion.ToString() != cbxFwPackageSearchMetrology.Text &&
|
||||
cbxFwPackageSearchMetrology.Text != @"*"))
|
||||
cbxFwPackageSearchMetrology.Text != Constants.StrWildcard))
|
||||
continue;
|
||||
|
||||
var row = _dataTableFwPackages.NewRow();
|
||||
@ -3005,13 +3005,13 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
row[Resources.StrTableCordonelFwToInstall] = fw.Name;
|
||||
row[Resources.StrTableCordonelFwIsReleased] = fw.IsReleased;
|
||||
|
||||
row[Resources.StrTableRegion] = fw.Region ?? "*";
|
||||
row[Resources.StrTableRadioFrequency] = fw.RadioFrequencyMhz == null ? "*" : $@"{fw.RadioFrequencyMhz}";
|
||||
row[Resources.StrTableRegion] = fw.Region ?? Constants.StrWildcard;
|
||||
row[Resources.StrTableRadioFrequency] = fw.RadioFrequencyMhz == null ? Constants.StrWildcard : $@"{fw.RadioFrequencyMhz}";
|
||||
row[Resources.StrTableCordonelMetrology] = MeterFwUpdate.ConvertVersionToString(fw.MetrologyVersion);
|
||||
row[Resources.StrTableFwPackageCoreMin] = MeterFwUpdate.ConvertVersionToString(fw.CoreRevisionMin);
|
||||
row[Resources.StrTableFwPackageCoreMax] = MeterFwUpdate.ConvertVersionToString(fw.CoreRevisionMax);
|
||||
|
||||
row[Resources.StrTableCordonelDiameter] = fw.MeterSize ?? "*";
|
||||
row[Resources.StrTableCordonelDiameter] = fw.MeterSize ?? Constants.StrWildcard;
|
||||
if (fw.ReleaseDate != null)
|
||||
{
|
||||
row[Resources.StrTableReleaseDate] = fw.ReleaseDate;
|
||||
@ -3104,7 +3104,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
row[Resources.StrTableCordonelProductionPos] = orderPos[1];
|
||||
|
||||
row[Resources.StrTableCustomerName] = info[0];
|
||||
var userName = "?";
|
||||
var userName = Constants.StrUnknown;
|
||||
foreach (var user in _fwUpdateDbAccess.DbFullQualifiedUpdateOperators.Where(user =>
|
||||
user.Id == safeInfo.UserId))
|
||||
{
|
||||
@ -3266,7 +3266,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
row[Resources.StrTableCordonelUpdateOrder] = report.OrderNr;
|
||||
row[Resources.StrTableCordonelProductionPos] = report.OrderPos;
|
||||
|
||||
var userName = "?";
|
||||
var userName = Constants.StrUnknown;
|
||||
foreach (var user in _fwUpdateDbAccess.DbFullQualifiedUpdateOperators.Where(user => user.Id == report.UserId))
|
||||
{
|
||||
userName = user.FullName;
|
||||
@ -3524,25 +3524,25 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (!cordonel.IsRemoved && !cordonel.IsApproved)
|
||||
row[Resources.StrTableCordonelFwToInstall] = PreSelectFwPackages(cordonel);
|
||||
else
|
||||
row[Resources.StrTableCordonelFwToInstall] = cordonel.RequiredReleaseNameVersion ?? "?";
|
||||
row[Resources.StrTableCordonelFwToInstall] = cordonel.RequiredReleaseNameVersion ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableSelect] = cordonel.IsSelected;
|
||||
row[Resources.StrTableApprove] = cordonel.IsApproved;
|
||||
row[Resources.StrTableRemove] = cordonel.IsRemoved;
|
||||
|
||||
row[Resources.StrTableCordonelCustomerSerialNumber] = cordonel.CustomerSerialNumber ?? "?";
|
||||
row[Resources.StrTableCordonelPcbId] = cordonel.PcbId ?? "?";
|
||||
row[Resources.StrTableCordonelCustomerSerialNumber] = cordonel.CustomerSerialNumber ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelPcbId] = cordonel.PcbId ?? Constants.StrUnknown;
|
||||
|
||||
|
||||
row[Resources.StrTableCordonelMetrology] = cordonel.Metrology ?? "?";
|
||||
row[Resources.StrTableCordonelMetrology] = cordonel.Metrology ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelMetrologyIsUpdateable] = cordonel.MetrologyIsUpdateable;
|
||||
|
||||
row[Resources.StrTableCordonelCore] = cordonel.CoreRevision ?? "?";
|
||||
row[Resources.StrTableCordonelCore] = cordonel.CoreRevision ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableRegion] = cordonel.Region ?? "?";
|
||||
row[Resources.StrTableRadioFrequency] = cordonel.RadioFrequency ?? "?";
|
||||
row[Resources.StrTableRegion] = cordonel.Region ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableRadioFrequency] = cordonel.RadioFrequency ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableCordonelDiameter] = cordonel.Diameter ?? "?";
|
||||
row[Resources.StrTableCordonelDiameter] = cordonel.Diameter ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableReason] = cordonel.ReasonForUpdateDenial ?? "";
|
||||
|
||||
@ -3602,7 +3602,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
// approved by software or user
|
||||
var requiredRelease = (String)dataGridRow.Cells[Resources.StrTableCordonelFwToInstall].Value;
|
||||
if ((Boolean)dataGridRow.Cells[Resources.StrTableApprove].Value &&
|
||||
!string.IsNullOrEmpty(requiredRelease) && requiredRelease != "?")
|
||||
!string.IsNullOrEmpty(requiredRelease) && requiredRelease != Constants.StrUnknown)
|
||||
{
|
||||
dataGridRow.DefaultCellStyle = _styleInstallationApproved;
|
||||
}
|
||||
@ -3642,7 +3642,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
// approved by software or user
|
||||
var requiredRelease = (String)dataGridRow.Cells[Resources.StrTableCordonelFwToInstall].Value;
|
||||
if ((Boolean)dataGridRow.Cells[Resources.StrTableApprove].Value &&
|
||||
!string.IsNullOrEmpty(requiredRelease) && requiredRelease != "?")
|
||||
!string.IsNullOrEmpty(requiredRelease) && requiredRelease != Constants.StrUnknown)
|
||||
{
|
||||
dataGridRow.DefaultCellStyle = _styleInstallationApproved;
|
||||
}
|
||||
@ -3741,31 +3741,31 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
if (cordSearch.PcbId == cordSelect.PcbId)
|
||||
{
|
||||
// fill search masks for FW package selection
|
||||
if (!string.IsNullOrEmpty(cordSearch.Diameter) && cordSearch.Diameter != "?" &&
|
||||
if (!string.IsNullOrEmpty(cordSearch.Diameter) && cordSearch.Diameter != Constants.StrUnknown &&
|
||||
!_sizeSearchItems.Contains(cordSearch.Diameter))
|
||||
{
|
||||
_sizeSearchItems.Add(cordSearch.Diameter);
|
||||
}
|
||||
// fill search masks for FW package selection
|
||||
if (!string.IsNullOrEmpty(cordSearch.RadioFrequency) && cordSearch.RadioFrequency != "?" &&
|
||||
if (!string.IsNullOrEmpty(cordSearch.RadioFrequency) && cordSearch.RadioFrequency != Constants.StrUnknown &&
|
||||
!_radioSearchItems.Contains(cordSearch.RadioFrequency))
|
||||
{
|
||||
_radioSearchItems.Add(cordSearch.RadioFrequency);
|
||||
}
|
||||
// fill search masks for FW package selection
|
||||
if (!string.IsNullOrEmpty(cordSearch.Region) && cordSearch.Region != "?" &&
|
||||
if (!string.IsNullOrEmpty(cordSearch.Region) && cordSearch.Region != Constants.StrUnknown &&
|
||||
!_regionSearchItems.Contains(cordSearch.Region))
|
||||
{
|
||||
_regionSearchItems.Add(cordSearch.Region);
|
||||
}
|
||||
// fill search masks for FW package selection
|
||||
if (!string.IsNullOrEmpty(cordSearch.CoreRevision) && cordSearch.CoreRevision != "?" &&
|
||||
if (!string.IsNullOrEmpty(cordSearch.CoreRevision) && cordSearch.CoreRevision != Constants.StrUnknown &&
|
||||
!_coreSearchItems.Contains(cordSearch.CoreRevision))
|
||||
{
|
||||
_coreSearchItems.Add(cordSearch.CoreRevision);
|
||||
}
|
||||
// fill search masks for FW package selection
|
||||
if (!string.IsNullOrEmpty(cordSearch.Metrology) && cordSearch.Metrology != "?" &&
|
||||
if (!string.IsNullOrEmpty(cordSearch.Metrology) && cordSearch.Metrology != Constants.StrUnknown &&
|
||||
!_metrologySearchItems.Contains(cordSearch.Metrology))
|
||||
{
|
||||
_metrologySearchItems.Add(cordSearch.Metrology);
|
||||
@ -3872,7 +3872,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
{
|
||||
// pre-selection of displayed production order
|
||||
if (!cordSearch.CustomerSerialNumber.Contains(tbxCordonelProductionOrdersSearch.Text)
|
||||
&& tbxCordonelProductionOrdersSearch.Text != @"*")
|
||||
&& tbxCordonelProductionOrdersSearch.Text != Constants.StrWildcard)
|
||||
continue;
|
||||
|
||||
// search if this Cordonel is already in production pre select list as this is the marker
|
||||
@ -3887,23 +3887,24 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
||||
var row = _dataTableCordonels.NewRow();
|
||||
row[Resources.StrTableSelect] = cordSearch.IsSelected;
|
||||
|
||||
row[Resources.StrTableCordonelCustomerSerialNumber] = cordSearch.CustomerSerialNumber ?? "?";
|
||||
row[Resources.StrTableCordonelPcbId] = cordSearch.PcbId ?? "?";
|
||||
row[Resources.StrTableCordonelCustomerSerialNumber] = cordSearch.CustomerSerialNumber ??
|
||||
Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelPcbId] = cordSearch.PcbId ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableCordonelInstalledFw] = cordSearch.InstalledReleaseNameVersion ?? "?";
|
||||
row[Resources.StrTableCordonelInstalledFw] = cordSearch.InstalledReleaseNameVersion ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableCordonelMetrology] = cordSearch.Metrology ?? "?";
|
||||
row[Resources.StrTableCordonelMetrology] = cordSearch.Metrology ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelMetrologyIsUpdateable] = cordSearch.MetrologyIsUpdateable;
|
||||
|
||||
row[Resources.StrTableCordonelCore] = cordSearch.CoreRevision ?? "?";
|
||||
row[Resources.StrTableRegion] = cordSearch.Region ?? "?";
|
||||
row[Resources.StrTableRadioFrequency] = cordSearch.RadioFrequency ?? "?";
|
||||
row[Resources.StrTableCordonelDiameter] = cordSearch.Diameter ?? "?";
|
||||
row[Resources.StrTableCordonelCore] = cordSearch.CoreRevision ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableRegion] = cordSearch.Region ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableRadioFrequency] = cordSearch.RadioFrequency ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelDiameter] = cordSearch.Diameter ?? Constants.StrUnknown;
|
||||
|
||||
row[Resources.StrTableCordonelProductionOrder] = cordSearch.CustomerOrderNumber;
|
||||
row[Resources.StrTableCordonelProductionPos] = cordSearch.CustomerOrderPos;
|
||||
row[Resources.StrTableCordonelSize] = cordSearch.Length ?? "?";
|
||||
row[Resources.StrTableCordonelCatalogueNumber] = cordSearch.CatalogNumber ?? "?";
|
||||
row[Resources.StrTableCordonelSize] = cordSearch.Length ?? Constants.StrUnknown;
|
||||
row[Resources.StrTableCordonelCatalogueNumber] = cordSearch.CatalogNumber ?? Constants.StrUnknown;
|
||||
|
||||
_dataTableCordonels.Rows.Add(row);
|
||||
}
|
||||
|
||||
@ -1787,7 +1787,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateLoader
|
||||
{
|
||||
var row = _dataTablePcbIds.NewRow();
|
||||
row[Resources.StrTableUpdated] = IsPcbIdProcessed(cordSearch.PcbId, _customerAndOrderInfo);
|
||||
row[Resources.StrTableCordonelPcbId] = cordSearch.PcbId ?? "?";
|
||||
row[Resources.StrTableCordonelPcbId] = cordSearch.PcbId ?? Constants.StrUnknown;
|
||||
|
||||
_dataTablePcbIds.Rows.Add(row);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ using System.Windows.Forms;
|
||||
using Logic.ProductionToProductMapper.Cordonel;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
using Xylem.Common.CommonCore.Consts;
|
||||
using Xylem.Common.CommonCore.ThreadWatcher;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Const;
|
||||
@ -1125,7 +1126,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
_invokerProcessState = ProcessState.CheckMetrology;
|
||||
return;
|
||||
}
|
||||
if (!RegionUpdateCapability())
|
||||
if (!RegionRadioSizeUpdateCapability())
|
||||
{
|
||||
_processState = errorExitState;
|
||||
// overwrite the invoker state to create a message
|
||||
@ -1233,8 +1234,12 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Region radio update capability check. The name of the required FW update package will be checked for _NA_,
|
||||
/// _EMEA_433_ and _EMEA_868_.
|
||||
/// Region, radio, size update capability check. The name of the required FW update package will be checked:
|
||||
/// - Region (NA, EMEA, China),
|
||||
/// - RadioFrequencyMhz (null, 433 MHz, 868 MHz),
|
||||
/// - MeterSize (DN40, DN50,..., DN300, US1_5, US2, US3,..., US12.
|
||||
/// If any information cannot be read from the meter, it will be assumed, that the FwUpdateBuilder operator
|
||||
/// assembled a correct FwUpdateSafe. Otherwise old devices may be unable to update.
|
||||
/// </summary>
|
||||
/// <returns>true if core revision is valid</returns>
|
||||
/// <remarks date="2021-Apr-26" author="Thomas Wiedebusch">
|
||||
@ -1244,24 +1249,25 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
/// - Starting with FW 1.2.* all frequencies will be supported, removed frequency check,
|
||||
/// - Supported China as new region.
|
||||
/// </remarks>
|
||||
/// <remarks date="2023-Feb-17" author="Thomas Wiedebusch">
|
||||
/// - Region taken from fw package info instead of name.
|
||||
/// <remarks date="2023-Feb-18" author="Thomas Wiedebusch">
|
||||
/// - Region, RadioFrequencyMhz, MeterSize taken from fw package info instead of package name.
|
||||
/// </remarks>
|
||||
private Boolean RegionUpdateCapability()
|
||||
private Boolean RegionRadioSizeUpdateCapability()
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
||||
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
||||
|
||||
// check the update capability
|
||||
var region = "?";
|
||||
Boolean retVal = true;
|
||||
// check the update capability for region
|
||||
var region = Constants.StrUnknown;
|
||||
if (!string.IsNullOrEmpty(_cordonelFirmwarePackage.FwPackageInfo.Region))
|
||||
{
|
||||
region = _cordonelFirmwarePackage.FwPackageInfo.Region;
|
||||
|
||||
if (_currentGenesis.Region.Contains(region))
|
||||
if (_currentGenesis.Region.Contains(region) )
|
||||
{
|
||||
InfoProcessSuccess(null, Resources.StrCordonelUpdateCapabilityRegionSucceeded);
|
||||
return true;
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
// set information of required and detected regions radio, check failed!
|
||||
@ -1428,7 +1434,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
/// <summary>
|
||||
/// Activate the radio with logging of success or failed.
|
||||
/// </summary>
|
||||
/// <remarks date="2023-Feb-17" author="Thomas Wiedebusch">
|
||||
/// <remarks date="2023-Feb-18" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
private Boolean ActivateRadio()
|
||||
@ -1439,20 +1445,29 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
Boolean retVal;
|
||||
try
|
||||
{
|
||||
// register to 0xFF means radio active with programmed radio key
|
||||
_currentGenesis.WriteRegister(Register.Sensusradio.SystemState, 0xFF);
|
||||
Thread.Sleep(5000);
|
||||
// register read back of 2 means radio is activated
|
||||
// read initially if radio is already active in customer mode 2
|
||||
if ( 2 == RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
|
||||
{
|
||||
LogSuccessText(Resources.StrRadioActivationSuccess);
|
||||
retVal = true;
|
||||
}
|
||||
else
|
||||
else // switch radio active
|
||||
{
|
||||
LogErrorText(Resources.StrRadioActivationFailed);
|
||||
retVal = false;
|
||||
}
|
||||
// write register to 0xFF means radio activation with programmed radio key to customer mode
|
||||
_currentGenesis.WriteRegister(Register.Sensusradio.SystemState, 0xFF);
|
||||
Thread.Sleep(5000);
|
||||
// read back if radio is active in customer mode 2
|
||||
if (2 == RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
|
||||
{
|
||||
LogSuccessText(Resources.StrRadioActivationSuccess);
|
||||
retVal = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogErrorText(Resources.StrRadioActivationFailed);
|
||||
retVal = false;
|
||||
}
|
||||
} // initially radio active check
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@ -3004,7 +3019,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
{
|
||||
// build a wildcard list and remove wildcard '*'
|
||||
foreach (var meterFileToEraseMask in _meterFilesEraseRestore.Erase.Where(
|
||||
x => x.Contains(MeterFile.WildcardAll)))
|
||||
x => x.Contains(Constants.StrWildcard)))
|
||||
{
|
||||
var wildcardMask = meterFileToEraseMask.Split('*');
|
||||
wildcardList.Add(wildcardMask[0]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user