From ba2bf9833e2a1dcf42e5dad523d0bb3d585a4da5 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 31 Oct 2022 18:50:30 +0100 Subject: [PATCH] NOA_NOD, AGNT --- bsmd.dbh/MessageController.cs | 5 +- bsmd.dbh/RequestUtil.cs | 99 +++++++++++++++++++++++++++++++++-- bsmd.dbh/ResponseUtil.cs | 5 +- bsmd.dbh/bsmd.dbh.csproj | 3 ++ 4 files changed, 107 insertions(+), 5 deletions(-) diff --git a/bsmd.dbh/MessageController.cs b/bsmd.dbh/MessageController.cs index 0756be72..b9c0fa97 100644 --- a/bsmd.dbh/MessageController.cs +++ b/bsmd.dbh/MessageController.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2020-present schick Informatik +// Description: Manager zum Senden/Empfangen von Daten mit dbh + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/bsmd.dbh/RequestUtil.cs b/bsmd.dbh/RequestUtil.cs index 8f505bb8..68b41126 100644 --- a/bsmd.dbh/RequestUtil.cs +++ b/bsmd.dbh/RequestUtil.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2020-present schick Informatik +// Description: Tooling zum Erzeugen von Nachrichten für dbh Interface + +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -46,6 +49,8 @@ namespace bsmd.dbh switch (message.MessageNotificationClass) { + + #region VISIT case Message.NotificationClass.VISIT: root.Type = RootType.VISIT; RootVisit rootVisit = new RootVisit(); @@ -53,7 +58,7 @@ namespace bsmd.dbh if (core.ETA.HasValue) rootVisit.ETAPortOfCall = core.ETA.Value; rootVisit.ETAPortOfCall = core.ETA.Value; - if(!core.IMO.IsNullOrEmpty()) + if (!core.IMO.IsNullOrEmpty()) { rootVisit.ItemElementName = ItemChoiceType.IMONumber; rootVisit.Item = core.IMO; @@ -66,11 +71,13 @@ namespace bsmd.dbh root.Item = rootVisit; root.ItemElementName = ItemChoiceType2.Visit; break; + #endregion + #region TRANSIT case Message.NotificationClass.TRANSIT: root.Type = RootType.TRANSIT; RootTransit rootTransit = new RootTransit(); - + if (!core.IMO.IsNullOrEmpty()) { rootTransit.ItemElementName = ItemChoiceType1.IMONumber; @@ -86,7 +93,9 @@ namespace bsmd.dbh root.Item = rootTransit; root.ItemElementName = ItemChoiceType2.Transit; break; + #endregion + #region STAT case Message.NotificationClass.STAT: root.Type = RootType.DATA; RootSTAT rootStat = new RootSTAT(); @@ -126,6 +135,90 @@ namespace bsmd.dbh root.Items = new object[1]; root.Items[0] = rootStat; break; + #endregion + + #region NOA_NOD + case Message.NotificationClass.NOA_NOD: + NOA_NOD noa_nod = message.Elements[0] as NOA_NOD; + RootNOA_NOD rootNOA_NOD = new RootNOA_NOD(); + rootNOA_NOD.ETAToNextPortSpecified = noa_nod.ETAToNextPort.HasValue; + if(noa_nod.ETAToNextPort.HasValue) + rootNOA_NOD.ETAToNextPort = noa_nod.ETAToNextPort.Value; + rootNOA_NOD.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue; + if (noa_nod.ETDFromLastPort.HasValue) + rootNOA_NOD.ETDFromLastPort = noa_nod.ETDFromLastPort.Value; + rootNOA_NOD.LastPort = noa_nod.LastPort; + rootNOA_NOD.NextPort = noa_nod.NextPort; + List choiceList = new List(); + List choices = new List(); + if (message.MessageCore.IsTransit) + { + if (noa_nod.ETAToKielCanal.HasValue) + { + choiceList.Add(ItemsChoiceType.ETAToKielCanal); + choices.Add(noa_nod.ETAToKielCanal.Value.ToDBHDateString()); + } + + if (noa_nod.ETDFromKielCanal.HasValue) + { + choiceList.Add(ItemsChoiceType.ETDFromKielCanal); + choices.Add(noa_nod.ETDFromKielCanal.Value.ToDBHDateString()); + } + } + else + { + if (noa_nod.ETAToPortOfCall.HasValue) + { + choiceList.Add(ItemsChoiceType.ETAToPortOfCall); + choices.Add(noa_nod.ETAToPortOfCall.Value.ToDBHDateString()); + } + + if (noa_nod.ETDFromPortOfCall.HasValue) + { + choiceList.Add(ItemsChoiceType.ETDFromPortOfCall); + choices.Add(noa_nod.ETDFromPortOfCall.Value.ToDBHDateString()); + } + + for (int i = 0; i < noa_nod.CallPurposes.Count; i++) + { + choiceList.Add(ItemsChoiceType.CallPurpose); + RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose(); + CallPurpose callPurpose = noa_nod.CallPurposes[i]; + rnncp.CallPurposeCode = callPurpose.CallPurposeCode; + if (callPurpose.CallPurposeDescription != string.Empty) + rnncp.CallPurposeDescription = callPurpose.CallPurposeDescription; + choices.Add(rnncp); + } + } + + rootNOA_NOD.Items = choices.ToArray(); + rootNOA_NOD.ItemsElementName = choiceList.ToArray(); + + root.Items = new object[1]; + root.Items[0] = rootNOA_NOD; + break; + + #endregion + + #region AGNT + case Message.NotificationClass.AGNT: + AGNT agnt = message.Elements[0] as AGNT; + RootAGNT rootAGNT = new RootAGNT(); + rootAGNT.AgentCity = agnt.AgentCity; + rootAGNT.AgentCompanyName = agnt.AgentCompanyName; + rootAGNT.AgentCountry = agnt.AgentCountry; + rootAGNT.AgentEMail = agnt.AgentEMail; + rootAGNT.AgentFax = agnt.AgentFax; + rootAGNT.AgentFirstName = agnt.AgentFirstName; + rootAGNT.AgentLastName = agnt.AgentLastName; + rootAGNT.AgentPhone = agnt.AgentPhone; + rootAGNT.AgentPostalCode = agnt.AgentPostalCode; + rootAGNT.AgentStreetAndNumber = agnt.AgentStreetAndNumber; + root.Items = new object[1]; + root.Items[0] = rootAGNT; + break; + #endregion + default: _log.WarnFormat("Message type {0} not (yet) supported for dbh", message.MessageNotificationClassDisplay); break; diff --git a/bsmd.dbh/ResponseUtil.cs b/bsmd.dbh/ResponseUtil.cs index 88f6b91c..14d856ef 100644 --- a/bsmd.dbh/ResponseUtil.cs +++ b/bsmd.dbh/ResponseUtil.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2020-present schick Informatik +// Description: Verarbeitung von empfangenen Rückmeldungen + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/bsmd.dbh/bsmd.dbh.csproj b/bsmd.dbh/bsmd.dbh.csproj index 0d84335c..d9fb984a 100644 --- a/bsmd.dbh/bsmd.dbh.csproj +++ b/bsmd.dbh/bsmd.dbh.csproj @@ -94,6 +94,9 @@ + + bsmd.database.licenseheader +