diff --git a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs index 8cf2dbe7..44ae9619 100644 --- a/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs +++ b/ENI-2/ENI2/ENI2/DetailRootControl.xaml.cs @@ -404,6 +404,13 @@ namespace ENI2 DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core); } + if(message.MessageNotificationClass == Message.NotificationClass.STAT) + { + DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl; + currentControl.Core.IsSmallShip = ((STAT)message.Elements[0]).GrossTonnage < 500; + DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core); + } + } } @@ -614,7 +621,11 @@ namespace ENI2 Message crewMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.CREW); Message pasMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.PAS); Message pobaMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.POBA); - + Message secMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.SEC); + Message noanodMessage = _messages.Find(message => message.MessageNotificationClass == Message.NotificationClass.NOA_NOD); + + #region CREW / PAS Count Plausibility + if (pobaMessage.Elements.Count == 1) { POBA poba = pobaMessage.Elements[0] as POBA; @@ -632,11 +643,49 @@ namespace ENI2 mv.MessageGroupName = Properties.Resources.textOverview; vViolations.Add(mv); } - } #endregion + #region Kiel Canal Timing Plausibility + + if(!this.Core.IsTransit && (secMessage?.Elements.Count > 0) && (noanodMessage?.Elements.Count > 0)) + { + SEC sec = secMessage.Elements[0] as SEC; + NOA_NOD noa_nod = noanodMessage.Elements[0] as NOA_NOD; + + if (sec.KielCanalPassagePlanned ?? false) + { + // Überprüfung, ob die eingehende NOK-Durchfahrt auch wirklich innerhalb der eingehenden Reise liegt (bei VISIT) + bool isValidIncoming = (noa_nod.ETDFromLastPort < sec.KielCanalPassagePlannedIncomming) && + (sec.KielCanalPassagePlannedIncomming < noa_nod.ETAToPortOfCall); + if (!sec.KielCanalPassagePlannedIncomming.HasValue) isValidIncoming = true; + + if(!isValidIncoming) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Kiel Canal incoming implausible (ETD / ETA ports)!", null, "Kiel Canal timing", null, "SEC"); + mv.MessageGroupName = Properties.Resources.textOverview; + vViolations.Add(mv); + } + + + bool isValidOutgoing = (noa_nod.ETDFromPortOfCall < sec.KielCanalPassagePlannedOutgoing) && + ((noa_nod.NextPort == "ZZUKN") || (sec.KielCanalPassagePlannedOutgoing < noa_nod.ETAToNextPort)); + if (!sec.KielCanalPassagePlannedOutgoing.HasValue) isValidOutgoing = true; + + if(!isValidOutgoing) + { + MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Kiel Canal outgoing implausible (ETD / ETA ports)!", null, "Kiel Canal timing", null, "SEC"); + mv.MessageGroupName = Properties.Resources.textOverview; + vViolations.Add(mv); + } + } + } + + #endregion + + #endregion + foreach (MessageError me in vErrors) { this.highlightService.HighlightError(me, this.GetContainerForMessageGroupName(me.MessageGroupName)); diff --git a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml index 5ab50c05..b2a4e573 100644 --- a/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml +++ b/ENI-2/ENI2/ENI2/DetailViewControls/MaritimeHealthDeclarationDetailControl.xaml @@ -99,6 +99,8 @@