NOA_NOD, AGNT

This commit is contained in:
Daniel Schick 2022-10-31 18:50:30 +01:00
parent c59e9f7e76
commit ba2bf9833e
4 changed files with 107 additions and 5 deletions

View File

@ -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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -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.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -46,6 +49,8 @@ namespace bsmd.dbh
switch (message.MessageNotificationClass) switch (message.MessageNotificationClass)
{ {
#region VISIT
case Message.NotificationClass.VISIT: case Message.NotificationClass.VISIT:
root.Type = RootType.VISIT; root.Type = RootType.VISIT;
RootVisit rootVisit = new RootVisit(); RootVisit rootVisit = new RootVisit();
@ -53,7 +58,7 @@ namespace bsmd.dbh
if (core.ETA.HasValue) if (core.ETA.HasValue)
rootVisit.ETAPortOfCall = core.ETA.Value; rootVisit.ETAPortOfCall = core.ETA.Value;
rootVisit.ETAPortOfCall = core.ETA.Value; rootVisit.ETAPortOfCall = core.ETA.Value;
if(!core.IMO.IsNullOrEmpty()) if (!core.IMO.IsNullOrEmpty())
{ {
rootVisit.ItemElementName = ItemChoiceType.IMONumber; rootVisit.ItemElementName = ItemChoiceType.IMONumber;
rootVisit.Item = core.IMO; rootVisit.Item = core.IMO;
@ -66,7 +71,9 @@ namespace bsmd.dbh
root.Item = rootVisit; root.Item = rootVisit;
root.ItemElementName = ItemChoiceType2.Visit; root.ItemElementName = ItemChoiceType2.Visit;
break; break;
#endregion
#region TRANSIT
case Message.NotificationClass.TRANSIT: case Message.NotificationClass.TRANSIT:
root.Type = RootType.TRANSIT; root.Type = RootType.TRANSIT;
RootTransit rootTransit = new RootTransit(); RootTransit rootTransit = new RootTransit();
@ -86,7 +93,9 @@ namespace bsmd.dbh
root.Item = rootTransit; root.Item = rootTransit;
root.ItemElementName = ItemChoiceType2.Transit; root.ItemElementName = ItemChoiceType2.Transit;
break; break;
#endregion
#region STAT
case Message.NotificationClass.STAT: case Message.NotificationClass.STAT:
root.Type = RootType.DATA; root.Type = RootType.DATA;
RootSTAT rootStat = new RootSTAT(); RootSTAT rootStat = new RootSTAT();
@ -126,6 +135,90 @@ namespace bsmd.dbh
root.Items = new object[1]; root.Items = new object[1];
root.Items[0] = rootStat; root.Items[0] = rootStat;
break; 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<ItemsChoiceType> choiceList = new List<ItemsChoiceType>();
List<object> choices = new List<object>();
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: default:
_log.WarnFormat("Message type {0} not (yet) supported for dbh", message.MessageNotificationClassDisplay); _log.WarnFormat("Message type {0} not (yet) supported for dbh", message.MessageNotificationClassDisplay);
break; break;

View File

@ -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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -94,6 +94,9 @@
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\bsmd.database\bsmd.database.licenseheader">
<Link>bsmd.database.licenseheader</Link>
</None>
<None Include="..\bsmdKey.snk" /> <None Include="..\bsmdKey.snk" />
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />