ProductionUiCordonel: - error messages extended

This commit is contained in:
Thomas Wiedebusch 2025-04-02 15:53:07 +02:00
parent 715adbceb2
commit bb83139a95
8 changed files with 46 additions and 14 deletions

View File

@ -14,4 +14,4 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.6.13.*")]
[assembly: AssemblyVersion("2.6.14.*")]

View File

@ -31,6 +31,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.EventArguments;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Properties;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisPwd;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol.Consts;
@ -510,14 +511,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
nameof(Genesis), configFile);
if (!new FileInfo(configFilePath).Exists)
{
Logger.Fatal($"Slot:{Slot} - Missing register definition file (configuration.json). Search location: {configFilePath}");
throw new ApplicationException("Missing register definition file (configuration.json). Setup is invalid!");
var msg = $"Slot:{Slot} - {Resources.StrErrorMissingConfiguration} {location}";
Logger.Fatal($"Slot:{Slot} - Missing register definition file (configuration.json). Search location: {location}");
throw new ApplicationException(msg);
}
}
try
{
Logger.Trace($"Slot:{Slot} - Registers definitions loaded from {configFilePath}");
Logger.Trace($"Slot:{Slot} - Registers definitions loaded from {location}");
if (Configuration.AutoUpdateFiles)
{
Logger.Trace($"Slot:{Slot} - Check for updates of {configFilePath}");
@ -815,9 +817,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
catch (Exception ex)
{
throw new ApplicationException("Cannot Open Comport. Check TaskManager for other Genesis " +
"relevant programs and close them. " +
$"Also check if the comport is valid! { Environment.NewLine }{ ex.Message}");
var msg = $"Slot:{Slot} - {Resources.StrErrorMsgComPort} { ex.Message}";
Logger.Fatal(msg);
throw new ApplicationException(msg);
}
protocol.OnRecordReadyToSend += delegate (Object o, BasePortDataEventArgs dataToSend)

View File

@ -60,6 +60,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Missing or invalid register definition (configuration.json)! Search in:.
/// </summary>
internal static string StrErrorMissingConfiguration {
get {
return ResourceManager.GetString("StrErrorMissingConfiguration", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot Open Comport. Check TaskManager for other Genesis relevant programs and close them! Also check if the comport is valid!.
/// </summary>
internal static string StrErrorMsgComPort {
get {
return ResourceManager.GetString("StrErrorMsgComPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ERROR: Could not find a CSD parameter in register list!.
/// </summary>

View File

@ -186,4 +186,10 @@
<data name="StrErrorMsgRegisterWrite" xml:space="preserve">
<value>FEHLER: Register konnte nicht geschrieben werden!</value>
</data>
<data name="StrErrorMissingConfiguration" xml:space="preserve">
<value>FEHLER: Konfigurationsdatei (configuration.json) nicht gefunden oder ungültig! Erwartetes Verzeichnis:</value>
</data>
<data name="StrErrorMsgComPort" xml:space="preserve">
<value>Kommunikationsanschluß nicht vorhanden oder von anderer Genesis App blockiert! Bitte TaskManger starten und prüfen!</value>
</data>
</root>

View File

@ -186,4 +186,10 @@
<data name="StrErrorMsgRegisterWrite" xml:space="preserve">
<value>ERROR: Could not write register!</value>
</data>
<data name="StrErrorMissingConfiguration" xml:space="preserve">
<value>ERROR: Missing or invalid register definition (configuration.json)! Search in:</value>
</data>
<data name="StrErrorMsgComPort" xml:space="preserve">
<value>Cannot Open Comport. Check TaskManager for other Genesis relevant programs and close them! Also check if the comport is valid!</value>
</data>
</root>

@ -1 +1 @@
Subproject commit ce1dc26047374fd7a9328914a6c2bd7eb591f012
Subproject commit e7aa3e2723a435f0a714df661dc5d86dfd45a71c

View File

@ -82,7 +82,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
catch (Exception e)
{
msg = Properties.Resources.StrErrorMsgMissingNetworkConnetction + "\n" + e.Message ;
msg = Properties.Resources.StrErrorMsgMissingNetworkConnetction + " " + e.Message ;
_logger.Error(msg);
MessageBox.Show(msg,
Properties.Resources.StrProcessStateError,
@ -93,7 +93,7 @@ namespace Xylem.Common.Production.ProductionUiCordonel
InitializeComponent();
// Log version to files for debug purposes
_strSoftwareNameVersion = $"{Properties.Resources.StrSoftwareNameVersion}{_version}";
_strSoftwareNameVersion = $"{Properties.Resources.StrSoftwareNameVersion} {_version}";
_logger.Info(_strSoftwareNameVersion);
Title = _strSoftwareNameVersion;
@ -181,12 +181,11 @@ namespace Xylem.Common.Production.ProductionUiCordonel
}
catch (Exception ex)
{
var msg = Properties.Resources.StrErrorMsgMissingComPort + $"\nSlot:{Slot}";
_logger.Error(msg);
MessageBox.Show(msg,
_logger.Error(ex.Message);
MessageBox.Show(ex.Message,
Properties.Resources.StrProcessStateError,
MessageBoxButton.OK, MessageBoxImage.Error);
throw new ApplicationException(msg + $"\n{ex.Message}");
throw new ApplicationException(ex.Message);
}
//install the process changed event handler for single processes

@ -0,0 +1 @@
Subproject commit e7aa3e2723a435f0a714df661dc5d86dfd45a71c