diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index a108449e..bf2eb99b 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -799,9 +799,15 @@ namespace ENI2 else aMessage.ErrorCount = null; if (violations.Count > 0) + { aMessage.ViolationCount = violations.Count; + aMessage.PositionViolationCount = violations.Count(v => !v.Identifier.IsNullOrEmpty()); + } else - aMessage.ViolationCount = null; + { + aMessage.ViolationCount = null; + aMessage.PositionViolationCount = null; + } string messageGroup = this.MessageGroupForMessage(aMessage); diff --git a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs index 25ddadc5..6b1bcd4c 100644 --- a/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/OverViewDetailControl.xaml.cs @@ -836,25 +836,52 @@ namespace ENI2.DetailViewControls { SelectImportClassesDialog sicd = new SelectImportClassesDialog(); List readyToSendMessages = new List(); - + + // Evaluate a number of criteria for messages that should not be preselected for sending + bool addToSend; 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.MessageNotificationClass == Message.NotificationClass.HAZA) && !XtraSendLogic.ShouldSendMessage(message)) continue; - if ((message.MessageNotificationClass == Message.NotificationClass.HAZD) && !XtraSendLogic.ShouldSendMessage(message)) continue; - if (message.MessageNotificationClass == Message.NotificationClass.BPOL) + { + addToSend = true; + + if ((message.ErrorCount ?? 0) > 0) continue; + switch(message.MessageNotificationClass) { - if (message.Elements.Count > 0) - { - if (message.Elements[0] is BPOL bpol) + case NotificationClass.HAZA: + addToSend = XtraSendLogic.ShouldSendMessage(message) && ((message.ViolationCount ?? 0) == 0); break; + case NotificationClass.HAZD: + addToSend = XtraSendLogic.ShouldSendMessage(message) && ((message.ViolationCount ?? 0) == 0); break; + case NotificationClass.BPOL: + if (message.Elements.Count > 0) { - if (bpol.PortOfItineraries.Count == 0) continue; + if (message.Elements[0] is BPOL bpol) + { + if (bpol.PortOfItineraries.Count == 0) addToSend = false; + } + if((message.ViolationCount ?? 0) > 0) addToSend = false; } - } + break; + case NotificationClass.WAS: + if ((message.PositionViolationCount ?? 0) > 0) addToSend = false; + break; + case NotificationClass.WAS_RCPT: + addToSend = false; + break; + case NotificationClass.NOA_NOD: + if ((message.PositionViolationCount ?? 0) > 0) addToSend = false; + break; + case NotificationClass.INFO: + if (Core.PoC == "DEHAM") addToSend = false; + else addToSend = ((message.ViolationCount ?? 0) > 0); + break; + default: + if((message.ViolationCount ?? 0) > 0) addToSend = false; + if(Message.IsListClass(message.MessageNotificationClass) && (message.Elements.Count == 0)) addToSend = false; + + break; } - readyToSendMessages.Add(message.MessageNotificationClass); + + if(addToSend) + readyToSendMessages.Add(message.MessageNotificationClass); } sicd.Messages = this.Messages; diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs index a30426d9..6ba99603 100644 --- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs @@ -94,7 +94,7 @@ namespace ENI2.DetailViewControls } } - public async override void Initialize() + public override void Initialize() { base.Initialize(); @@ -185,7 +185,7 @@ namespace ENI2.DetailViewControls #region Waste receipt grid event handler - private async void DataGridWasteReceipt_CreateRequested() + private void DataGridWasteReceipt_CreateRequested() { EditWasteReceiptDialog epd = new EditWasteReceiptDialog(); epd.WAS_RCPT = new WAS_RCPT(); @@ -236,7 +236,7 @@ namespace ENI2.DetailViewControls } } - private async void DataGridWasteReceipt_EditRequested(DatabaseEntity obj) + private void DataGridWasteReceipt_EditRequested(DatabaseEntity obj) { EditWasteReceiptDialog epd = new EditWasteReceiptDialog(); epd.WAS_RCPT = obj as WAS_RCPT; diff --git a/bsmd.database/Message.cs b/bsmd.database/Message.cs index 1e56b788..8f32a139 100644 --- a/bsmd.database/Message.cs +++ b/bsmd.database/Message.cs @@ -431,6 +431,12 @@ namespace bsmd.database /// public int? ViolationCount { get; set; } + /// + /// Number of violations during last validation that have the "identifier" set and are thus detected violations + /// from underlying list elements + /// + public int? PositionViolationCount { get; set; } + /// /// Number of errors during last validation ///