From 9ad543e705a850f9dcfcfa755d5c507877054921 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 4 Aug 2025 18:06:47 +0200 Subject: [PATCH] Fixes for things not understood.. ^^ --- .../OverViewDetailControl.xaml.cs | 15 ++++++++++++++- .../SelectImportClassesDialog.xaml.cs | 18 +----------------- ENI2/Excel/ExcelUtil.cs | 11 ++++++----- ENI2/Properties/Resources.Designer.cs | 5 ++++- ENI2/Properties/Resources.resx | 5 ++++- bsmd.database/WAS.cs | 17 ++++++++++------- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index 34267ceb..656e4bcb 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -838,8 +838,21 @@ namespace ENI2.DetailViewControls foreach (Message message in this.Messages) { + // Evaluate a number of criteria for messages that should not be preselected for sending if (((message.ViolationCount ?? 0) > 0) || ((message.ErrorCount ?? 0) > 0)) continue; // these need more work - if (Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) continue; // avoid suspend on empty list classes + if (Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) continue; // avoid suspend on empty list classes + if ((message.MessageNotificationClass == Message.NotificationClass.HAZA) && !XtraSendLogic.ShouldSendMessage(message)) continue; + if ((message.MessageNotificationClass == Message.NotificationClass.HAZD) && !XtraSendLogic.ShouldSendMessage(message)) continue; + if (message.MessageNotificationClass == Message.NotificationClass.BPOL) + { + if (message.Elements.Count > 0) + { + if (message.Elements[0] is BPOL bpol) + { + if (bpol.PortOfItineraries.Count == 0) continue; + } + } + } readyToSendMessages.Add(message.MessageNotificationClass); } diff --git a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs index fabf6a8f..50b9deff 100644 --- a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs +++ b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs @@ -90,23 +90,7 @@ namespace ENI2.EditControls (aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) || (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) || (aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT) - )) continue; - - if(!IsImportMode) - { - // Speziallogik, was außerdem nicht zu Versand vorgeschlagen werden soll - if ((aMessage.MessageNotificationClass == Message.NotificationClass.HAZA) && !XtraSendLogic.ShouldSendMessage(aMessage)) continue; - if ((aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) && !XtraSendLogic.ShouldSendMessage(aMessage)) continue; - if(aMessage.MessageNotificationClass == Message.NotificationClass.BPOL) { - if (aMessage.Elements.Count > 0) - { - if (aMessage.Elements[0] is BPOL bpol) - { - if (bpol.PortOfItineraries.Count == 0) continue; - } - } - } - } + )) continue; SelectClass sc = new SelectClass(); sc.Name = Enum.GetName(typeof(Message.NotificationClass), aMessage.MessageNotificationClass); diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs index ba9653f8..e246182b 100644 --- a/ENI2/Excel/ExcelUtil.cs +++ b/ENI2/Excel/ExcelUtil.cs @@ -1281,17 +1281,18 @@ namespace ENI2.Excel if (waste.WasteType == 3000) waste.WasteType = 401; waste.WasteDisposalAmount_MTQ = reader.ReadNumber(wasteAmount); + if (!waste.WasteDisposalAmount_MTQ.HasValue && reader.ReadText(wasteAmount).IsNullOrEmpty()) waste.WasteDisposalAmount_MTQ = 0; waste.WasteCapacity_MTQ = reader.ReadNumber(wasteCapacity); + if (!waste.WasteCapacity_MTQ.HasValue && reader.ReadText(wasteCapacity).IsNullOrEmpty()) waste.WasteCapacity_MTQ = 0; waste.WasteAmountRetained_MTQ = reader.ReadNumber(wasteRetained); + if (!waste.WasteAmountRetained_MTQ.HasValue && reader.ReadText(wasteRetained).IsNullOrEmpty()) waste.WasteAmountRetained_MTQ = 0; waste.WasteDisposalPort = reader.ReadSSNLocode(wastePort); // aka RemainingWasteDisposalPort - if ((waste.WasteDisposalPort != null) && (waste.WasteDisposalPort == string.Empty)) - { - waste.WasteDisposalPort = "ZZUKN"; - } + if ((waste.WasteDisposalPort == null) && reader.ReadText(wastePort).IsNullOrEmpty()) waste.WasteDisposalPort = "ZZUKN"; waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumber(amountGen); + if (!waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue && reader.ReadText(amountGen).IsNullOrEmpty()) waste.WasteAmountGeneratedTillNextPort_MTQ = 0; if (!waste.WasteType.HasValue || (waste.WasteType > 999)) { @@ -1299,7 +1300,7 @@ namespace ENI2.Excel } } - was.AddMissingWaste(); + was.AddMissingWaste(false); return true; } diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs index 2c4d1999..d9489957 100644 --- a/ENI2/Properties/Resources.Designer.cs +++ b/ENI2/Properties/Resources.Designer.cs @@ -2175,7 +2175,10 @@ namespace ENI2.Properties { /// /// Looks up a localized string similar to The existing value for the waste disposal service provider will be overwritten. - ///Current entry:{0} New entry:{1} + /// + ///Current entry: {0} + ///New entry: {1} + /// ///Proceed?. /// public static string textConfirmWSDPOverwrite { diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx index 1902b39a..9bbac0e5 100644 --- a/ENI2/Properties/Resources.resx +++ b/ENI2/Properties/Resources.resx @@ -2259,7 +2259,10 @@ The existing value for the waste disposal service provider will be overwritten. -Current entry:{0} New entry:{1} + +Current entry: {0} +New entry: {1} + Proceed? \ No newline at end of file diff --git a/bsmd.database/WAS.cs b/bsmd.database/WAS.cs index 1ed77217..11221aa3 100644 --- a/bsmd.database/WAS.cs +++ b/bsmd.database/WAS.cs @@ -502,7 +502,7 @@ namespace bsmd.database /// Convenience Methode, die fehlende Waste Einträge ergänzt. Verbesserte Version, aus ENI-2 herüberkopiert, damit es auch im /// Excel_Reader nutzbar wird /// - public void AddMissingWaste() + public void AddMissingWaste(bool fixExisting = true) { foreach (string wasteCodeString in WAS.WasteCodes) @@ -538,12 +538,15 @@ namespace bsmd.database } else { - if (!foundWaste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) foundWaste.WasteAmountGeneratedTillNextPort_MTQ = 0; - if (!foundWaste.WasteAmountRetained_MTQ.HasValue) foundWaste.WasteAmountRetained_MTQ = 0; - if (!foundWaste.WasteCapacity_MTQ.HasValue) foundWaste.WasteCapacity_MTQ = 0; - if (foundWaste.WasteDescription.IsNullOrEmpty() && foundWaste.IsDashWasteCode) foundWaste.WasteDescription = "-"; - if (!foundWaste.WasteDisposalAmount_MTQ.HasValue) foundWaste.WasteDisposalAmount_MTQ = 0; - if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN"; + if (fixExisting) + { + if (!foundWaste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) foundWaste.WasteAmountGeneratedTillNextPort_MTQ = 0; + if (!foundWaste.WasteAmountRetained_MTQ.HasValue) foundWaste.WasteAmountRetained_MTQ = 0; + if (!foundWaste.WasteCapacity_MTQ.HasValue) foundWaste.WasteCapacity_MTQ = 0; + if (foundWaste.WasteDescription.IsNullOrEmpty() && foundWaste.IsDashWasteCode) foundWaste.WasteDescription = "-"; + if (!foundWaste.WasteDisposalAmount_MTQ.HasValue) foundWaste.WasteDisposalAmount_MTQ = 0; + if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN"; + } } } }