diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 606acd8a..e6910ef1 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -838,7 +838,7 @@ namespace ENI2 { List vViolations = new List(); List vErrors = new List(); - Dictionary counts = new Dictionary(); + Dictionary counts = new Dictionary(); RuleEngine ruleEngine = new RuleEngine(); foreach (Message aMessage in messagesSnapshot) @@ -855,7 +855,7 @@ namespace ENI2 ViolationCount = violations.Count > 0 ? (int?)violations.Count : null, PositionViolationCount = violations.Count > 0 ? (int?)violations.Count(v => !v.Identifier.IsNullOrEmpty()) : null }; - counts[aMessage] = messageCounts; + counts[aMessage] = messageCounts; string messageGroup = this.MessageGroupForMessage(aMessage); @@ -871,7 +871,7 @@ namespace ENI2 vViolations.AddRange(violations); } - #region 12.11.18 / 6.3.21 / 23.5.22 / 26.10.24: globale Plausi-Prüfungen + #region 12.11.18 / 6.3.21 / 23.5.22 / 26.10.24 / 27.1.26: globale Plausi-Prüfungen Message crewaMessage = messagesSnapshot.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWA); Message crewdMessage = messagesSnapshot.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWD); @@ -1243,6 +1243,8 @@ namespace ENI2 #region WAS special max capa rules regarding next port { + string wasMessageGroup = this.MessageGroupForMessage(wasMessage); + // see WAS-Regulation.docx in parent projects misc folder if ((noanodMessage?.Elements.Count > 0) && wasMessage?.Elements.Count > 0) { @@ -1266,7 +1268,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1284,7 +1286,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1293,7 +1295,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.75) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1314,7 +1316,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1322,7 +1324,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1340,7 +1342,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.2) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1349,7 +1351,7 @@ namespace ENI2 if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) { MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Acc. to EU Regulation 2022/89 the amount retained on board is noticeably", null, "WAS", waste.Identifier, "WAS"); - mv.MessageGroupName = Properties.Resources.textPortNotification; + mv.MessageGroupName = wasMessageGroup; vViolations.Add(mv); } break; @@ -1391,20 +1393,20 @@ namespace ENI2 } } - return new ValidationResult(vViolations, vErrors, counts); - } + return new ValidationResult(vViolations, vErrors, counts); + } private void ApplyValidationResult(ValidationResult result, bool showMessages) { // TODO: clear highlighting - foreach (KeyValuePair entry in result.Counts) - { - Message aMessage = entry.Key; - MessageValidationCounts messageCounts = entry.Value; - aMessage.ErrorCount = messageCounts.ErrorCount; - aMessage.ViolationCount = messageCounts.ViolationCount; - aMessage.PositionViolationCount = messageCounts.PositionViolationCount; - } + foreach (KeyValuePair entry in result.Counts) + { + Message aMessage = entry.Key; + MessageValidationCounts messageCounts = entry.Value; + aMessage.ErrorCount = messageCounts.ErrorCount; + aMessage.ViolationCount = messageCounts.ViolationCount; + aMessage.PositionViolationCount = messageCounts.PositionViolationCount; + } foreach (MessageError me in result.Errors) { @@ -1484,17 +1486,17 @@ namespace ENI2 private sealed class ValidationResult { - internal ValidationResult(List violations, List errors, Dictionary counts) - { - Violations = violations; - Errors = errors; - Counts = counts; - } - - internal List Violations { get; } - internal List Errors { get; } - internal Dictionary Counts { get; } - } + internal ValidationResult(List violations, List errors, Dictionary counts) + { + Violations = violations; + Errors = errors; + Counts = counts; + } + + internal List Violations { get; } + internal List Errors { get; } + internal Dictionary Counts { get; } + } private sealed class MessageValidationCounts {