fixed message group name settings in extra WAS validation

This commit is contained in:
Daniel Schick 2026-01-28 07:50:52 +01:00
parent 5932630635
commit 9d4f608383

View File

@ -838,7 +838,7 @@ namespace ENI2
{ {
List<MessageViolation> vViolations = new List<MessageViolation>(); List<MessageViolation> vViolations = new List<MessageViolation>();
List<MessageError> vErrors = new List<MessageError>(); List<MessageError> vErrors = new List<MessageError>();
Dictionary<Message, MessageValidationCounts> counts = new Dictionary<Message, MessageValidationCounts>(); Dictionary<Message, MessageValidationCounts> counts = new Dictionary<Message, MessageValidationCounts>();
RuleEngine ruleEngine = new RuleEngine(); RuleEngine ruleEngine = new RuleEngine();
foreach (Message aMessage in messagesSnapshot) foreach (Message aMessage in messagesSnapshot)
@ -855,7 +855,7 @@ namespace ENI2
ViolationCount = violations.Count > 0 ? (int?)violations.Count : null, ViolationCount = violations.Count > 0 ? (int?)violations.Count : null,
PositionViolationCount = violations.Count > 0 ? (int?)violations.Count(v => !v.Identifier.IsNullOrEmpty()) : null PositionViolationCount = violations.Count > 0 ? (int?)violations.Count(v => !v.Identifier.IsNullOrEmpty()) : null
}; };
counts[aMessage] = messageCounts; counts[aMessage] = messageCounts;
string messageGroup = this.MessageGroupForMessage(aMessage); string messageGroup = this.MessageGroupForMessage(aMessage);
@ -871,7 +871,7 @@ namespace ENI2
vViolations.AddRange(violations); 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 crewaMessage = messagesSnapshot.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWA);
Message crewdMessage = messagesSnapshot.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREWD); 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 #region WAS special max capa rules regarding next port
{ {
string wasMessageGroup = this.MessageGroupForMessage(wasMessage);
// see WAS-Regulation.docx in parent projects misc folder // see WAS-Regulation.docx in parent projects misc folder
if ((noanodMessage?.Elements.Count > 0) && wasMessage?.Elements.Count > 0) if ((noanodMessage?.Elements.Count > 0) && wasMessage?.Elements.Count > 0)
{ {
@ -1266,7 +1268,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1284,7 +1286,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1293,7 +1295,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.75) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1314,7 +1316,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1322,7 +1324,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.5) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1340,7 +1342,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.2) 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"); 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); vViolations.Add(mv);
} }
break; break;
@ -1349,7 +1351,7 @@ namespace ENI2
if (waste.WasteAmountRetained_MTQ > waste.WasteCapacity_MTQ * 0.25) 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"); 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); vViolations.Add(mv);
} }
break; 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) private void ApplyValidationResult(ValidationResult result, bool showMessages)
{ {
// TODO: clear highlighting // TODO: clear highlighting
foreach (KeyValuePair<Message, MessageValidationCounts> entry in result.Counts) foreach (KeyValuePair<Message, MessageValidationCounts> entry in result.Counts)
{ {
Message aMessage = entry.Key; Message aMessage = entry.Key;
MessageValidationCounts messageCounts = entry.Value; MessageValidationCounts messageCounts = entry.Value;
aMessage.ErrorCount = messageCounts.ErrorCount; aMessage.ErrorCount = messageCounts.ErrorCount;
aMessage.ViolationCount = messageCounts.ViolationCount; aMessage.ViolationCount = messageCounts.ViolationCount;
aMessage.PositionViolationCount = messageCounts.PositionViolationCount; aMessage.PositionViolationCount = messageCounts.PositionViolationCount;
} }
foreach (MessageError me in result.Errors) foreach (MessageError me in result.Errors)
{ {
@ -1484,17 +1486,17 @@ namespace ENI2
private sealed class ValidationResult private sealed class ValidationResult
{ {
internal ValidationResult(List<MessageViolation> violations, List<MessageError> errors, Dictionary<Message, MessageValidationCounts> counts) internal ValidationResult(List<MessageViolation> violations, List<MessageError> errors, Dictionary<Message, MessageValidationCounts> counts)
{ {
Violations = violations; Violations = violations;
Errors = errors; Errors = errors;
Counts = counts; Counts = counts;
} }
internal List<MessageViolation> Violations { get; } internal List<MessageViolation> Violations { get; }
internal List<MessageError> Errors { get; } internal List<MessageError> Errors { get; }
internal Dictionary<Message, MessageValidationCounts> Counts { get; } internal Dictionary<Message, MessageValidationCounts> Counts { get; }
} }
private sealed class MessageValidationCounts private sealed class MessageValidationCounts
{ {