diff --git a/Stundensheet.xlsx b/Stundensheet.xlsx index fc07fd90..270108f0 100644 Binary files a/Stundensheet.xlsx and b/Stundensheet.xlsx differ diff --git a/nsw/HIS-NORD/Transmitter-Tool/client.log b/nsw/HIS-NORD/Transmitter-Tool/client.log index 84585633..23568ae1 100644 --- a/nsw/HIS-NORD/Transmitter-Tool/client.log +++ b/nsw/HIS-NORD/Transmitter-Tool/client.log @@ -53,3 +53,146 @@ 29.07.2015 21:50:40 PACKETSIZE: 500 29.07.2015 21:50:40 Tiles: 1 29.07.2015 21:50:40 No more Answers + ----------------------------- +14.11.2015 11:21:58 Client started + ----------------------------- +14.11.2015 11:22:00 FileName: IMP\20151114112145-5d584c6f-8988-4925-98d1-32016c996525.xml +14.11.2015 11:22:00 FileSize: 26555(25,93 kB) + ----------------------------- +14.11.2015 11:22:01 No more Answers +14.11.2015 11:22:01 20151114112145-5d584c6f-8988-4925-98d1-32016c996525.xml(26555) - XML file doesnt fit Schema +14.11.2015 11:22:01 XML Document has Error:truecvc-complex-type.2.4.j: The content of element 'Wastes' is not complete. 'Waste' is expected to occur a minimum of '9' times. '8' more instances are required to satisfy this constraint. + ----------------------------- +15.11.2015 09:18:45 Client started + ----------------------------- +15.11.2015 09:18:46 No more Answers +15.11.2015 09:18:47 FileName: IMP\20151115091838-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 09:18:47 FileSize: 26398(25,78 kB) + ----------------------------- +15.11.2015 09:18:48 20151115091838-5d584c6f-8988-4925-98d1-32016c996525.xml(26398) - XML file doesnt fit Schema +15.11.2015 09:18:48 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 11:32:55 Client started + ----------------------------- +15.11.2015 11:32:56 FileName: IMP\20151115113248-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 11:32:56 FileSize: 25915(25,31 kB) + ----------------------------- +15.11.2015 11:32:57 20151115113248-5d584c6f-8988-4925-98d1-32016c996525.xml(25915) - XML file doesnt fit Schema +15.11.2015 11:32:57 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. +15.11.2015 11:32:57 No more Answers + ----------------------------- +15.11.2015 11:39:13 Client started + ----------------------------- +15.11.2015 11:39:14 FileName: IMP\20151115113912-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 11:39:14 FileSize: 25915(25,31 kB) + ----------------------------- +15.11.2015 11:39:15 No more Answers +15.11.2015 11:39:15 20151115113912-5d584c6f-8988-4925-98d1-32016c996525.xml(25915) - XML file doesnt fit Schema +15.11.2015 11:39:15 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 11:57:17 Client started + ----------------------------- +15.11.2015 11:57:19 No more Answers +15.11.2015 11:57:19 FileName: IMP\20151115115712-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 11:57:19 FileSize: 25864(25,26 kB) + ----------------------------- +15.11.2015 11:57:20 20151115115712-5d584c6f-8988-4925-98d1-32016c996525.xml(25864) - XML file doesnt fit Schema +15.11.2015 11:57:20 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 12:00:13 Client started + ----------------------------- +15.11.2015 12:00:14 FileName: IMP\20151115120010-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 12:00:14 FileSize: 25915(25,31 kB) + ----------------------------- +15.11.2015 12:00:15 No more Answers +15.11.2015 12:00:15 20151115120010-5d584c6f-8988-4925-98d1-32016c996525.xml(25915) - XML file doesnt fit Schema +15.11.2015 12:00:15 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 12:03:04 Client started + ----------------------------- +15.11.2015 12:03:05 FileName: IMP\20151115120302-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 12:03:05 FileSize: 26075(25,46 kB) + ----------------------------- +15.11.2015 12:03:06 No more Answers +15.11.2015 12:03:06 20151115120302-5d584c6f-8988-4925-98d1-32016c996525.xml(26075) - XML file doesnt fit Schema +15.11.2015 12:03:06 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 14:35:51 Client started + ----------------------------- +15.11.2015 14:35:52 FileName: IMP\20151115143549-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 14:35:52 FileSize: 26075(25,46 kB) + ----------------------------- +15.11.2015 14:35:54 No more Answers +15.11.2015 14:35:54 20151115143549-5d584c6f-8988-4925-98d1-32016c996525.xml(26075) - XML file doesnt fit Schema +15.11.2015 14:35:54 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +15.11.2015 14:38:52 Client started + ----------------------------- +15.11.2015 14:38:53 FileName: IMP\20151115143851-5d584c6f-8988-4925-98d1-32016c996525.xml +15.11.2015 14:38:53 FileSize: 26075(25,46 kB) + ----------------------------- +15.11.2015 14:38:54 No more Answers +15.11.2015 14:38:54 20151115143851-5d584c6f-8988-4925-98d1-32016c996525.xml(26075) - XML file doesnt fit Schema +15.11.2015 14:38:54 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +17.11.2015 07:49:57 Client started + ----------------------------- +17.11.2015 07:49:59 No more Answers +17.11.2015 07:50:00 FileName: IMP\20151117074953-a6b24c0d-ef7f-4742-852e-512e2b192391.xml +17.11.2015 07:50:00 FileSize: 28641(27,97 kB) + ----------------------------- +17.11.2015 07:50:01 20151117074953-a6b24c0d-ef7f-4742-852e-512e2b192391.xml(28641) - XML file doesnt fit Schema +17.11.2015 07:50:01 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if ((count(NoHazmatOnBoard) eq 1) or (count(HazmatCargoManifestOnBoard) eq 0)) then empty(GeneralCargo/LoadUnit/LocationOnBoard) and empty(GeneralCargo/LoadUnit/PortOfLoadingLocode) and empty(GeneralCargo/LoadUnit/PortOfDischargeLocode) and empty(GeneralCargo/LoadUnit/DGList) else GeneralCargo/LoadUnit and GeneralCargo/LoadUnit/LocationOnBoard and GeneralCargo/LoadUnit/PortOfLoadingLocode and GeneralCargo/LoadUnit/PortOfDischargeLocode and GeneralCargo/LoadUnit/DGList') for element 'conveyance' with type 'conveyance' did not succeed. + ----------------------------- +17.11.2015 07:51:31 Client started + ----------------------------- +17.11.2015 07:51:33 FileName: IMP\20151117075126-a6b24c0d-ef7f-4742-852e-512e2b192391.xml +17.11.2015 07:51:33 FileSize: 28641(27,97 kB) + ----------------------------- +17.11.2015 07:51:35 20151117075126-a6b24c0d-ef7f-4742-852e-512e2b192391.xml(28641) - XML file doesnt fit Schema +17.11.2015 07:51:35 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if ((count(NoHazmatOnBoard) eq 1) or (count(HazmatCargoManifestOnBoard) eq 0)) then empty(GeneralCargo/LoadUnit/LocationOnBoard) and empty(GeneralCargo/LoadUnit/PortOfLoadingLocode) and empty(GeneralCargo/LoadUnit/PortOfDischargeLocode) and empty(GeneralCargo/LoadUnit/DGList) else GeneralCargo/LoadUnit and GeneralCargo/LoadUnit/LocationOnBoard and GeneralCargo/LoadUnit/PortOfLoadingLocode and GeneralCargo/LoadUnit/PortOfDischargeLocode and GeneralCargo/LoadUnit/DGList') for element 'conveyance' with type 'conveyance' did not succeed. +17.11.2015 07:51:36 No more Answers + ----------------------------- +17.11.2015 07:58:00 Client started + ----------------------------- +17.11.2015 07:58:02 No more Answers +17.11.2015 07:58:02 FileName: IMP\20151117075757-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml +17.11.2015 07:58:02 FileSize: 29644(28,95 kB) + ----------------------------- +17.11.2015 07:58:03 20151117075757-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(29644) - XML file doesnt fit Schema +17.11.2015 07:58:03 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (ends-with(@WasteType,'OTHERS') or starts-with(@WasteType,'CARGO')) then WasteDescription else empty(WasteDescription)') for element 'Waste' with type 'waste' did not succeed. + ----------------------------- +18.11.2015 07:24:57 Client started + ----------------------------- +18.11.2015 07:24:58 FileName: IMP\20151118072449-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml +18.11.2015 07:24:58 FileSize: 29484(28,79 kB) + ----------------------------- +18.11.2015 07:24:59 20151118072449-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(29484) - XML file doesnt fit Schema +18.11.2015 07:24:59 No more Answers +18.11.2015 07:24:59 XML Document has Error:truecvc-attribute.3: The value '0' of attribute 'Index' on element 'LastPort' is not valid with respect to its type, 'posint-type'. + ----------------------------- +18.11.2015 07:29:26 Client started + ----------------------------- +18.11.2015 07:29:27 No more Answers +18.11.2015 07:29:27 FileName: IMP\20151118072922-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml +18.11.2015 07:29:27 FileSize: 29485(28,79 kB) + ----------------------------- +18.11.2015 07:29:28 20151118072922-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(29485) - XML file doesnt fit Schema +18.11.2015 07:29:28 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (Tanker eq 'Y') then TankerDetails else empty(TankerDetails)') for element 'Pre72H' with type 'pre72' did not succeed. + ----------------------------- +18.11.2015 07:39:49 Client started + ----------------------------- +18.11.2015 07:39:50 No more Answers +18.11.2015 07:39:50 FileName: IMP\20151118073943-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml +18.11.2015 07:39:50 FileSize: 29295(28,61 kB) + ----------------------------- +18.11.2015 07:39:51 20151118073943-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(29295) - XML file doesnt fit Schema +18.11.2015 07:39:51 XML Document has Error:truecvc-assertion.3.13.4.1: Assertion evaluation ('if (Tanker eq 'Y') then TankerDetails else empty(TankerDetails)') for element 'Pre72H' with type 'pre72' did not succeed. + ----------------------------- +18.11.2015 07:43:29 Client started + ----------------------------- +18.11.2015 07:43:30 FileName: IMP\20151118074325-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml +18.11.2015 07:43:30 FileSize: 29295(28,61 kB) + ----------------------------- +18.11.2015 07:43:31 20151118074325-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(28,61 kB) - Transfer successful +18.11.2015 07:43:31 No more Answers diff --git a/nsw/Source/SendNSWMessageService/NSWSendService.cs b/nsw/Source/SendNSWMessageService/NSWSendService.cs index 150f6537..73f42df3 100644 --- a/nsw/Source/SendNSWMessageService/NSWSendService.cs +++ b/nsw/Source/SendNSWMessageService/NSWSendService.cs @@ -135,8 +135,7 @@ namespace SendNSWMessageService (message.MessageNotificationClass == Message.NotificationClass.PRE72H) || (message.MessageNotificationClass == Message.NotificationClass.TIEFD) || (message.MessageNotificationClass == Message.NotificationClass.NAME) || - (message.MessageNotificationClass == Message.NotificationClass.INFO) || - (message.MessageNotificationClass == Message.NotificationClass.POBD) || + (message.MessageNotificationClass == Message.NotificationClass.INFO) || (message.MessageNotificationClass == Message.NotificationClass.ATA) || (message.MessageNotificationClass == Message.NotificationClass.ATD) || (message.MessageNotificationClass == Message.NotificationClass.LADG) || @@ -167,6 +166,7 @@ namespace SendNSWMessageService } // ATD wird nur gesendet, wenn weniger als 60 Minuten in der Zukunft + // und auch nicht älter als eine Woche if(message.MessageNotificationClass == Message.NotificationClass.ATD) { if (message.Elements.Count > 0) @@ -174,13 +174,24 @@ namespace SendNSWMessageService bsmd.database.ATD atd = message.Elements[0] as bsmd.database.ATD; if (!atd.ATDPortOfCall.HasValue) continue; if ((atd.ATDPortOfCall.Value - DateTime.UtcNow).TotalMinutes > 60) continue; + if ((DateTime.UtcNow - atd.ATDPortOfCall.Value).TotalDays > 7) continue; + } + } + + // ATA älter als eine Woche wird auch nicht versendet + if(message.MessageNotificationClass == Message.NotificationClass.ATA) + { + if(message.Elements.Count > 0) + { + bsmd.database.ATA ata = message.Elements[0] as bsmd.database.ATA; + if (!ata.ATAPortOfCall.HasValue) continue; + if ((DateTime.UtcNow - ata.ATAPortOfCall.Value).TotalDays > 7) continue; } } - if (message.InternalStatus != Message.BSMDStatus.CONFIRMED) - //(message.InternalStatus == Message.BSMDStatus.PREPARE) || - //(message.InternalStatus == Message.BSMDStatus.TOSEND)) + if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) && + (message.InternalStatus != Message.BSMDStatus.SENT)) { if (message.HIS == Message.NSWProvider.UNDEFINED) message.HIS = core.InitialHIS; @@ -246,12 +257,15 @@ namespace SendNSWMessageService _log.ErrorFormat("SENDING message {0}: {1}", message.Id.ToString(), ex.Message); } } + if (toSendMessageList.Count > 0) { - core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT; - DBManager.Instance.Save(core); + core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT; + } else { + core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; } - + DBManager.Instance.Save(core); + } } diff --git a/nsw/Source/bsmd.database/Message.cs b/nsw/Source/bsmd.database/Message.cs index 36ed8ea1..4333a5fb 100644 --- a/nsw/Source/bsmd.database/Message.cs +++ b/nsw/Source/bsmd.database/Message.cs @@ -67,8 +67,33 @@ namespace bsmd.database /// public enum NotificationClass { - VISIT, TRANSIT, NOA_NOD, ATA, ATD, SEC, POBA, POBD, NAME, TIEFA, TIEFD, - BKRA, BKRD, STAT, LADG, INFO, SERV, PRE72H, MDH, WAS, CREW, PAS, BPOL, TOWA, TOWD, HAZA, HAZD + VISIT, // 0 + TRANSIT, // 1 + NOA_NOD, // 2 + ATA, + ATD, + SEC, // 5 + POBA, + POBD, + NAME, + TIEFA, + TIEFD, // 10 + BKRA, + BKRD, + STAT, + LADG, + INFO, // 15 + SERV, + PRE72H, + MDH, + WAS, + CREW, // 20 + PAS, + BPOL, + TOWA, + TOWD, + HAZA, // 25 + HAZD } public enum MessageStatus diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs index fb991122..2a23f5f9 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProductInfo.cs @@ -2,6 +2,6 @@ [assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyProduct("BSMD NSW interface")] -[assembly: AssemblyInformationalVersion("2.4.7")] +[assembly: AssemblyInformationalVersion("2.4.11")] [assembly: AssemblyCopyright("Copyright © 2014-2015 Informatikbüro Daniel Schick. All rights reserved.")] [assembly: AssemblyTrademark("")] \ No newline at end of file diff --git a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs index a5907571..6d1a1d12 100644 --- a/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/nsw/Source/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,9 +1,4 @@ using System.Reflection; -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("2.4.11.*")] -[assembly: AssemblyVersion("2.4.7.*")] -// wenn das nicht auskommentiert wird erhalten wir eine Warnung -// [assembly: AssemblyFileVersion("1.0.0.*")] diff --git a/nsw/Source/bsmd.dbh/Request.cs b/nsw/Source/bsmd.dbh/Request.cs index 5677ee84..fde9629c 100644 --- a/nsw/Source/bsmd.dbh/Request.cs +++ b/nsw/Source/bsmd.dbh/Request.cs @@ -64,7 +64,7 @@ namespace bsmd.dbh object item = null; string senderReference = message.Id.Value.ToString("N"); - ItemChoiceType2 itemChoiceType2 = ItemChoiceType2.Visit; // ? + ItemChoiceType2 itemChoiceType2 = ItemChoiceType2.Visit; switch (message.MessageNotificationClass) { @@ -99,6 +99,7 @@ namespace bsmd.dbh { RootTransit rootTransit = new RootTransit(); rootType = RootType.TRANSIT; + itemChoiceType2 = ItemChoiceType2.Transit; if (message.MessageCore.IMO != null) { @@ -135,46 +136,51 @@ namespace bsmd.dbh rootNoaNod.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue; rootNoaNod.LastPort = noa_nod.LastPort; - rootNoaNod.NextPort = noa_nod.NextPort; + rootNoaNod.NextPort = noa_nod.NextPort; - int numItems = 2 + noa_nod.CallPurposes.Count; + List choiceList = new List(); + List choices = new List(); - ItemsChoiceType[] choiceArray = new ItemsChoiceType[numItems]; - object[] choices = new object[numItems]; - - if (noa_nod.ETAToKielCanal.HasValue) + if (message.MessageCore.IsTransit) { - choiceArray[0] = ItemsChoiceType.ETAToKielCanal; - choices[0] = noa_nod.ETAToKielCanal.Value; - } - if (noa_nod.ETAToPortOfCall.HasValue) - { - choiceArray[0] = ItemsChoiceType.ETAToPortOfCall; - choices[0] = noa_nod.ETAToPortOfCall.Value; - } - if (noa_nod.ETDFromKielCanal.HasValue) - { - choiceArray[1] = ItemsChoiceType.ETDFromKielCanal; - choices[1] = noa_nod.ETDFromKielCanal.Value; - } - if (noa_nod.ETDFromPortOfCall.HasValue) - { - choiceArray[1] = ItemsChoiceType.ETDFromPortOfCall; - choices[1] = noa_nod.ETDFromPortOfCall.Value; - } + if (noa_nod.ETAToKielCanal.HasValue) + { + choiceList.Add(ItemsChoiceType.ETAToKielCanal); + choices.Add(noa_nod.ETAToKielCanal.Value); + } - for (int i = 0; i < noa_nod.CallPurposes.Count; i++) - { - - choiceArray[i + 2] = ItemsChoiceType.CallPurpose; - RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose(); - rnncp.CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode; - rnncp.CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription; - choices[i+2] = rnncp; + if (noa_nod.ETDFromKielCanal.HasValue) + { + choiceList.Add(ItemsChoiceType.ETDFromKielCanal); + choices.Add(noa_nod.ETDFromKielCanal.Value); + } } + else + { + if (noa_nod.ETAToPortOfCall.HasValue) + { + choiceList.Add(ItemsChoiceType.ETAToPortOfCall); + choices.Add(noa_nod.ETAToPortOfCall.Value); + } - rootNoaNod.Items = choices; - rootNoaNod.ItemsElementName = choiceArray; + if (noa_nod.ETDFromPortOfCall.HasValue) + { + choiceList.Add(ItemsChoiceType.ETDFromPortOfCall); + choices.Add(noa_nod.ETDFromPortOfCall.Value); + } + + for (int i = 0; i < noa_nod.CallPurposes.Count; i++) + { + choiceList.Add(ItemsChoiceType.CallPurpose); + RootNOA_NODCallPurpose rnncp = new RootNOA_NODCallPurpose(); + rnncp.CallPurposeCode = noa_nod.CallPurposes[i].CallPurposeCode; + rnncp.CallPurposeDescription = noa_nod.CallPurposes[i].CallPurposeDescription; + choices.Add(rnncp); + } + } + + rootNoaNod.Items = choices.ToArray(); + rootNoaNod.ItemsElementName = choiceList.ToArray(); item = rootNoaNod; } diff --git a/nsw/Source/bsmd.herberg.FormService/FormService.cs b/nsw/Source/bsmd.herberg.FormService/FormService.cs index 74def239..f47756de 100644 --- a/nsw/Source/bsmd.herberg.FormService/FormService.cs +++ b/nsw/Source/bsmd.herberg.FormService/FormService.cs @@ -135,7 +135,7 @@ namespace bsmd.herberg.FormService } catch (Exception ex) { - _log.ErrorFormat("Exception reading formBody: {0}", ex.ToString()); + _log.ErrorFormat("Exception reading body of form {0}: {1}", dataSet.formGuid, ex.ToString()); successfulGet = false; } if (successfulGet && formResponse.success) diff --git a/nsw/Source/bsmd.herberg.FormService/Util.cs b/nsw/Source/bsmd.herberg.FormService/Util.cs index aed3a222..7c2ec4d9 100644 --- a/nsw/Source/bsmd.herberg.FormService/Util.cs +++ b/nsw/Source/bsmd.herberg.FormService/Util.cs @@ -48,9 +48,13 @@ namespace bsmd.herberg.FormService // nur zum debuggen for (int n = 0; n < formResponse.formDatasets[i].formData.Length; n++) { + _log.Debug(formResponse.formDatasets[i].formData[n].name); + _log.Debug(formResponse.formDatasets[i].formData[n].value); + if (formResponse.formDatasets[i].formData[n].name.Contains("Transmission")) { _log.Info("foundit"); + } } @@ -81,6 +85,7 @@ namespace bsmd.herberg.FormService { case "REGISTRATION_TYPE": _log.InfoFormat("REGISTRATION_TYPE: {0}", formData.value); + aMessageCore.IsTransit = formData.value.Equals("Transit"); // !!! break; case "REPORT_TYPE": @@ -329,10 +334,19 @@ namespace bsmd.herberg.FormService noa_nod.CallPurposes.Add(cp); } - if (subvDict.ContainsKey("CallPurposeCode")) cp.CallPurposeCode = Int32.Parse(subvDict["CallPurposeCode"]); if (subvDict.ContainsKey("CallPurposeDescription")) cp.CallPurposeDescription = subvDict["CallPurposeDescription"]; - saveMessages.Add(cp); + // Code ist Pflichtfeld, daher wird ein Eintrag nur bei vorhandenem Code gespeichert + if (subvDict.ContainsKey("CallPurposeCode")) + { + cp.CallPurposeCode = Int32.Parse(subvDict["CallPurposeCode"]); + saveMessages.Add(cp); + } + else + { + noa_nod.CallPurposes.Remove(cp); + } + } } @@ -1025,7 +1039,15 @@ namespace bsmd.herberg.FormService if (((waste.WasteType ?? 0) == 9) && waste.WasteDescription.IsNullOrEmpty()) waste.WasteDescription = "-"; - saveMessages.Add(waste); + if (waste.WasteType.HasValue) + { + saveMessages.Add(waste); + } + else + { + // wenn nichtmal der WasteType gesetzt ist verwenden wir lieber den default und speichern das nicht + was.Waste.Remove(waste); + } } // fehlende Waste Meldungen als "leer" hinzufügen, der Identifier muss dann zur Kennzeichnung leer sein @@ -1195,8 +1217,7 @@ namespace bsmd.herberg.FormService if (vDict.ContainsKey("PortOfCall")) aMessageCore.PoC = "DE" + vDict["PortOfCall"]; // if (vDict.ContainsKey("TransitKielCanal")) aMessageCore.IsTransit = vDict["TransitKielCanal"].Equals("Y"); if (vDict.ContainsKey("ETAPortOfCall")) aMessageCore.ETA = Extensions.TryParseDateTime(vDict["ETAPortOfCall"]); - if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]); - aMessageCore.IsTransit = false; + if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]); } break; #endregion @@ -1205,8 +1226,7 @@ namespace bsmd.herberg.FormService case "Transit": { theMessage.MessageNotificationClass = Message.NotificationClass.TRANSIT; - if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]); - aMessageCore.IsTransit = true; + if (vDict.ContainsKey("ETAKielCanal")) aMessageCore.ETAKielCanal = Extensions.TryParseDateTime(vDict["ETAKielCanal"]); } break; #endregion diff --git a/nsw/Source/bsmd.hisnord/Request.cs b/nsw/Source/bsmd.hisnord/Request.cs index e58f0de0..216c4a4f 100644 --- a/nsw/Source/bsmd.hisnord/Request.cs +++ b/nsw/Source/bsmd.hisnord/Request.cs @@ -86,16 +86,18 @@ namespace bsmd.hisnord #region NSW message area + Message visitTransitHeader = null; + foreach (Message message in messages) { switch (message.MessageNotificationClass) { case Message.NotificationClass.VISIT: - + if (!messages[0].MessageCore.IsTransit) visitTransitHeader = message; break; case Message.NotificationClass.TRANSIT: - + if (messages[0].MessageCore.IsTransit) visitTransitHeader = message; break; #region ATA/ATD @@ -258,304 +260,312 @@ namespace bsmd.hisnord break; #endregion + #region HAZ + case Message.NotificationClass.HAZA: case Message.NotificationClass.HAZD: // abh. von LADG! { - HAZ haz = message.Elements[0] as HAZ; - - #region HAZ header area - - List flagItems = new List(); - if (haz.NoDPGOnBoardOnArrival ?? false) + if (message.Elements.Count > 0) { - flagItems.Add(ytype.Y); - } - else - { - if(haz.DPGManifestOnBoardOnArrival ?? false) - flagItems.Add(yorntype.Y); - else - flagItems.Add(yorntype.N); - if (haz.INFShipClass.HasValue) + HAZ haz = message.Elements[0] as HAZ; + + #region HAZ header area + + List flagItems = new List(); + if (haz.NoDPGOnBoardOnArrival ?? false) { - flagItems.Add((infclasstype)haz.INFShipClass.Value); + flagItems.Add(ytype.Y); + } + else + { + if (haz.DPGManifestOnBoardOnArrival ?? false) + flagItems.Add(yorntype.Y); + else + flagItems.Add(yorntype.N); + if (haz.INFShipClass.HasValue) + { + flagItems.Add((infclasstype)haz.INFShipClass.Value); + } + + dgcodes _dgCodes = new dgcodes(); + List _dgCodeTypes = new List(); + if (haz.DPGClassificationIBC ?? false) + _dgCodeTypes.Add(dgcodetype.IBC); + if (haz.DPGClassificationIGC ?? false) + _dgCodeTypes.Add(dgcodetype.IGC); + if (haz.DPGClassificationIMDG ?? false) + _dgCodeTypes.Add(dgcodetype.IMDG); + // was ist das? dgcodetype.IMDG_MoU + if (haz.DPGClassificationIMSBC ?? false) + _dgCodeTypes.Add(dgcodetype.IMSBC); + if (haz.DPGClassificationMARPOL_ANNEX_I ?? false) + _dgCodeTypes.Add(dgcodetype.MARPOL_ANNEX_I); + _dgCodes.DGCode = _dgCodeTypes.ToArray(); + + flagItems.Add(_dgCodes); + } - dgcodes _dgCodes = new dgcodes(); - List _dgCodeTypes = new List(); - if (haz.DPGClassificationIBC ?? false) - _dgCodeTypes.Add(dgcodetype.IBC); - if (haz.DPGClassificationIGC ?? false) - _dgCodeTypes.Add(dgcodetype.IGC); - if (haz.DPGClassificationIMDG ?? false) - _dgCodeTypes.Add(dgcodetype.IMDG); - // was ist das? dgcodetype.IMDG_MoU - if (haz.DPGClassificationIMSBC ?? false) - _dgCodeTypes.Add(dgcodetype.IMSBC); - if (haz.DPGClassificationMARPOL_ANNEX_I ?? false) - _dgCodeTypes.Add(dgcodetype.MARPOL_ANNEX_I); - _dgCodes.DGCode = _dgCodeTypes.ToArray(); + _nsw.conveyance.Items1 = flagItems.ToArray(); - flagItems.Add(_dgCodes); + #endregion - } - - _nsw.conveyance.Items1 = flagItems.ToArray(); - - #endregion - - // Durch Sortierung nach NotificationClass kommt LADG vor HAZ, daher sollte das Feld - // GeneralCargo nicht leer sein - if (_nsw.conveyance.GeneralCargo == null) - { - _log.Warn("LADG (conveyance.GeneralCargo) is empty. Cannot add HAZ information!"); - } - else - { - List dgList = new List(); - - #region IMDGPositions - - if (haz.IMDGPositions.Count > 0) + // Durch Sortierung nach NotificationClass kommt LADG vor HAZ, daher sollte das Feld + // GeneralCargo nicht leer sein + if (_nsw.conveyance.GeneralCargo == null) { - positionimdg[] imdgPositions = new positionimdg[haz.IMDGPositions.Count]; - for (int i = 0; i < haz.IMDGPositions.Count; i++) - { - IMDGPosition imdgPosition = haz.IMDGPositions[i]; - positionimdg pi = new positionimdg(); + _log.Warn("LADG (conveyance.GeneralCargo) is empty. Cannot add HAZ information!"); + } + else + { + List dgList = new List(); - pi.UNNumber = imdgPosition.UNNumber; - if(imdgPosition.PackingGroup.HasValue) - pi.PackingGroup = (packinggrouptype)imdgPosition.PackingGroup; - pi.ProperShippingName = imdgPosition.ProperShippingName; - pi.IMOClass = imdgPosition.IMOClass; - pi.CompatibilityGroup = imdgPosition.CompatibilityGroup; - pi.TechnicalName = imdgPosition.TechnicalName; - pi.NetMassKGMSpecified = imdgPosition.NetExplosiveMass_KGM.HasValue; - if (imdgPosition.NetExplosiveMass_KGM.HasValue) - pi.NetMassKGM = (float) imdgPosition.NetExplosiveMass_KGM.Value; - pi.FlashpointCEL = imdgPosition.Flashpoint_CEL; - pi.Class7NuclideName = imdgPosition.Class7NuclideName; - pi.Class7MaxActivityBQLSpecified = imdgPosition.Class7MaxActivity_BQL.HasValue; - if (imdgPosition.Class7MaxActivity_BQL.HasValue) - pi.Class7MaxActivityBQL = (float)imdgPosition.Class7MaxActivity_BQL.Value; - pi.Class7CategorySpecified = imdgPosition.Class7Category.HasValue; - if (imdgPosition.Class7Category.HasValue) - pi.Class7Category = (class7cattype)imdgPosition.Class7Category.Value; - pi.Class7TISpecified = imdgPosition.Class7TransportIndex.HasValue; - if (imdgPosition.Class7TransportIndex.HasValue) - pi.Class7TI = (float)imdgPosition.Class7TransportIndex.Value; - pi.Class7CSI = imdgPosition.Class7CSI.HasValue ? imdgPosition.Class7CSI.Value.ToString() : ""; - pi.ControlTempCELSpecified = imdgPosition.ControlTemperature_CEL.HasValue; - if (imdgPosition.ControlTemperature_CEL.HasValue) - pi.ControlTempCEL = (float)imdgPosition.ControlTemperature_CEL.Value; - pi.EmergencyTempCELSpecified = imdgPosition.EmergencyTemperature_CEL.HasValue; - if (imdgPosition.EmergencyTemperature_CEL.HasValue) - pi.EmergencyTempCEL = (float)imdgPosition.EmergencyTemperature_CEL.Value; - if (imdgPosition.SubsidiaryRiskList.Count > 0) + #region IMDGPositions + + if (haz.IMDGPositions.Count > 0) + { + positionimdg[] imdgPositions = new positionimdg[haz.IMDGPositions.Count]; + for (int i = 0; i < haz.IMDGPositions.Count; i++) { - pi.SubsidiaryRisks = new string[imdgPosition.SubsidiaryRiskList.Count]; - for (int j = 0; j < imdgPosition.SubsidiaryRiskList.Count; j++) + IMDGPosition imdgPosition = haz.IMDGPositions[i]; + positionimdg pi = new positionimdg(); + + pi.UNNumber = imdgPosition.UNNumber; + if (imdgPosition.PackingGroup.HasValue) + pi.PackingGroup = (packinggrouptype)imdgPosition.PackingGroup; + pi.ProperShippingName = imdgPosition.ProperShippingName; + pi.IMOClass = imdgPosition.IMOClass; + pi.CompatibilityGroup = imdgPosition.CompatibilityGroup; + pi.TechnicalName = imdgPosition.TechnicalName; + pi.NetMassKGMSpecified = imdgPosition.NetExplosiveMass_KGM.HasValue; + if (imdgPosition.NetExplosiveMass_KGM.HasValue) + pi.NetMassKGM = (float)imdgPosition.NetExplosiveMass_KGM.Value; + pi.FlashpointCEL = imdgPosition.Flashpoint_CEL; + pi.Class7NuclideName = imdgPosition.Class7NuclideName; + pi.Class7MaxActivityBQLSpecified = imdgPosition.Class7MaxActivity_BQL.HasValue; + if (imdgPosition.Class7MaxActivity_BQL.HasValue) + pi.Class7MaxActivityBQL = (float)imdgPosition.Class7MaxActivity_BQL.Value; + pi.Class7CategorySpecified = imdgPosition.Class7Category.HasValue; + if (imdgPosition.Class7Category.HasValue) + pi.Class7Category = (class7cattype)imdgPosition.Class7Category.Value; + pi.Class7TISpecified = imdgPosition.Class7TransportIndex.HasValue; + if (imdgPosition.Class7TransportIndex.HasValue) + pi.Class7TI = (float)imdgPosition.Class7TransportIndex.Value; + pi.Class7CSI = imdgPosition.Class7CSI.HasValue ? imdgPosition.Class7CSI.Value.ToString() : ""; + pi.ControlTempCELSpecified = imdgPosition.ControlTemperature_CEL.HasValue; + if (imdgPosition.ControlTemperature_CEL.HasValue) + pi.ControlTempCEL = (float)imdgPosition.ControlTemperature_CEL.Value; + pi.EmergencyTempCELSpecified = imdgPosition.EmergencyTemperature_CEL.HasValue; + if (imdgPosition.EmergencyTemperature_CEL.HasValue) + pi.EmergencyTempCEL = (float)imdgPosition.EmergencyTemperature_CEL.Value; + if (imdgPosition.SubsidiaryRiskList.Count > 0) { - pi.SubsidiaryRisks[j] = imdgPosition.SubsidiaryRiskList[j].SubsidiaryRisk; + pi.SubsidiaryRisks = new string[imdgPosition.SubsidiaryRiskList.Count]; + for (int j = 0; j < imdgPosition.SubsidiaryRiskList.Count; j++) + { + pi.SubsidiaryRisks[j] = imdgPosition.SubsidiaryRiskList[j].SubsidiaryRisk; + } } + pi.MarinePollutant = (imdgPosition.MarinePollutant ?? false) ? yorntype.Y : yorntype.N; + pi.NumberOfPackages = imdgPosition.NumberOfPackages.HasValue ? imdgPosition.NumberOfPackages.Value.ToString() : ""; + // pi.PackageType = ?? feld nicht vorhanden + pi.LimitedQuantities = (imdgPosition.LimitedQuantities ?? false) ? yorntype.Y : yorntype.N; + pi.ExceptedQuantities = (imdgPosition.ExceptedQuantities ?? false) ? yorntype.Y : yorntype.N; + // pi.NetQuantity ?? feld nicht vorhanden odér ist das NetMassKGM ? + pi.GrossMassKGMSpecified = imdgPosition.GrossQuantity_KGM.HasValue; + if (imdgPosition.GrossQuantity_KGM.HasValue) + pi.GrossMassKGM = (float)imdgPosition.GrossQuantity_KGM.Value; + // pi.Volume_MTQ ?? feld nicht vorhanden + pi.GeneralCargoIBCSpecified = imdgPosition.GeneralCargoIBC.HasValue; + if (imdgPosition.GeneralCargoIBC.HasValue) + pi.GeneralCargoIBC = (imdgPosition.GeneralCargoIBC.Value) ? yorntype.Y : yorntype.N; + pi.ContainerNumber = imdgPosition.ContainerNumber; + pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber; + pi.Remarks = imdgPosition.Remarks; + + // hier fehlt auch StowagePosition, PortOfLoading, PortOfDischarge + // das ist eine Ebene höher und damit ist die Zuordnung falsch, weil es nicht 1:n ist sondern nachfolgende + // abweichende Einträge hier eine Überschreibung verursachen + + if (!imdgPosition.StowagePosition.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].LocationOnBoard = imdgPosition.StowagePosition; + if (!imdgPosition.PortOfLoading.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imdgPosition.PortOfLoading; + if (!imdgPosition.PortOfDischarge.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imdgPosition.PortOfDischarge; + + pi.Index = imdgPosition.Identifier; + + imdgPositions[i] = pi; } - pi.MarinePollutant = (imdgPosition.MarinePollutant ?? false) ? yorntype.Y : yorntype.N; - pi.NumberOfPackages = imdgPosition.NumberOfPackages.HasValue ? imdgPosition.NumberOfPackages.Value.ToString() : ""; - // pi.PackageType = ?? feld nicht vorhanden - pi.LimitedQuantities = (imdgPosition.LimitedQuantities ?? false) ? yorntype.Y : yorntype.N; - pi.ExceptedQuantities = (imdgPosition.ExceptedQuantities ?? false) ? yorntype.Y : yorntype.N; - // pi.NetQuantity ?? feld nicht vorhanden odér ist das NetMassKGM ? - pi.GrossMassKGMSpecified = imdgPosition.GrossQuantity_KGM.HasValue; - if (imdgPosition.GrossQuantity_KGM.HasValue) - pi.GrossMassKGM = (float)imdgPosition.GrossQuantity_KGM.Value; - // pi.Volume_MTQ ?? feld nicht vorhanden - pi.GeneralCargoIBCSpecified = imdgPosition.GeneralCargoIBC.HasValue; - if (imdgPosition.GeneralCargoIBC.HasValue) - pi.GeneralCargoIBC = (imdgPosition.GeneralCargoIBC.Value) ? yorntype.Y : yorntype.N; - pi.ContainerNumber = imdgPosition.ContainerNumber; - pi.VehicleLicenseNumber = imdgPosition.VehicleLicenseNumber; - pi.Remarks = imdgPosition.Remarks; - - // hier fehlt auch StowagePosition, PortOfLoading, PortOfDischarge - // das ist eine Ebene höher und damit ist die Zuordnung falsch, weil es nicht 1:n ist sondern nachfolgende - // abweichende Einträge hier eine Überschreibung verursachen - - if(!imdgPosition.StowagePosition.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].LocationOnBoard = imdgPosition.StowagePosition; - if (!imdgPosition.PortOfLoading.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imdgPosition.PortOfLoading; - if (!imdgPosition.PortOfDischarge.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imdgPosition.PortOfDischarge; - - pi.Index = imdgPosition.Identifier; - - imdgPositions[i] = pi; + dgList.Add(imdgPositions); } - dgList.Add(imdgPositions); - } - #endregion + #endregion - #region IBCPositions + #region IBCPositions - if (haz.IBCPositions.Count > 0) - { - positionibc[] ibcPositions = new positionibc[haz.IBCPositions.Count]; - - for (int i = 0; i < haz.IBCPositions.Count;i++) + if (haz.IBCPositions.Count > 0) { - positionibc pi = new positionibc(); - IBCPosition ibcPosition = haz.IBCPositions[i]; - pi.Name = ibcPosition.ProductName; - if(ibcPosition.PollutionCategory.HasValue) - pi.PollutionCategory = (polcattype)ibcPosition.PollutionCategory.Value; - pi.HazardsSpecified = ibcPosition.Hazards.HasValue; - if (ibcPosition.Hazards.HasValue) - pi.Hazards = (hazardtype)ibcPosition.Hazards.Value; - if (ibcPosition.FlashpointInformation.HasValue) - pi.FlashpointInfo = (flashpointinfotype)ibcPosition.FlashpointInformation.Value; - pi.FlashpointCEL = ibcPosition.Flashpoint_CEL; - if (ibcPosition.Quantity_KGM.HasValue) - pi.NetMassKGM = (float)ibcPosition.Quantity_KGM.Value; - pi.SpecRef15_19Specified = ibcPosition.SpecRef15_19.HasValue; - if (ibcPosition.SpecRef15_19.HasValue) - pi.SpecRef15_19 = ibcPosition.SpecRef15_19.Value ? yorntype.Y : yorntype.N; - pi.Remarks = ibcPosition.Remarks; + positionibc[] ibcPositions = new positionibc[haz.IBCPositions.Count]; - if (!ibcPosition.StowagePosition.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].LocationOnBoard = ibcPosition.StowagePosition; - if (!ibcPosition.PortOfLoading.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = ibcPosition.PortOfLoading; - if (!ibcPosition.PortOfDischarge.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = ibcPosition.PortOfDischarge; + for (int i = 0; i < haz.IBCPositions.Count; i++) + { + positionibc pi = new positionibc(); + IBCPosition ibcPosition = haz.IBCPositions[i]; + pi.Name = ibcPosition.ProductName; + if (ibcPosition.PollutionCategory.HasValue) + pi.PollutionCategory = (polcattype)ibcPosition.PollutionCategory.Value; + pi.HazardsSpecified = ibcPosition.Hazards.HasValue; + if (ibcPosition.Hazards.HasValue) + pi.Hazards = (hazardtype)ibcPosition.Hazards.Value; + if (ibcPosition.FlashpointInformation.HasValue) + pi.FlashpointInfo = (flashpointinfotype)ibcPosition.FlashpointInformation.Value; + pi.FlashpointCEL = ibcPosition.Flashpoint_CEL; + if (ibcPosition.Quantity_KGM.HasValue) + pi.NetMassKGM = (float)ibcPosition.Quantity_KGM.Value; + pi.SpecRef15_19Specified = ibcPosition.SpecRef15_19.HasValue; + if (ibcPosition.SpecRef15_19.HasValue) + pi.SpecRef15_19 = ibcPosition.SpecRef15_19.Value ? yorntype.Y : yorntype.N; + pi.Remarks = ibcPosition.Remarks; - pi.Index = ibcPosition.Identifier; + if (!ibcPosition.StowagePosition.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].LocationOnBoard = ibcPosition.StowagePosition; + if (!ibcPosition.PortOfLoading.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = ibcPosition.PortOfLoading; + if (!ibcPosition.PortOfDischarge.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = ibcPosition.PortOfDischarge; - ibcPositions[i] = pi; + pi.Index = ibcPosition.Identifier; + + ibcPositions[i] = pi; + } + + dgList.Add(ibcPositions); } - dgList.Add(ibcPositions); - } + #endregion - #endregion + #region IGCPositions - #region IGCPositions - - if (haz.IGCPositions.Count > 0) - { - positionigc[] igcPositions = new positionigc[haz.IGCPositions.Count]; - - for (int i = 0; i < haz.IGCPositions.Count; i++) + if (haz.IGCPositions.Count > 0) { - positionigc pi = new positionigc(); - IGCPosition igcPosition = haz.IGCPositions[i]; + positionigc[] igcPositions = new positionigc[haz.IGCPositions.Count]; - pi.UNNumber = igcPosition.UNNumber; - pi.IMOClass = igcPosition.IMOClass; - pi.Name = igcPosition.ProductName; - if (igcPosition.Quantity_KGM.HasValue) - pi.NetMassKGM = (float)igcPosition.Quantity_KGM.Value; - pi.Remarks = igcPosition.Remarks; + for (int i = 0; i < haz.IGCPositions.Count; i++) + { + positionigc pi = new positionigc(); + IGCPosition igcPosition = haz.IGCPositions[i]; - if (!igcPosition.StowagePosition.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].LocationOnBoard = igcPosition.StowagePosition; - if (!igcPosition.PortOfLoading.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = igcPosition.PortOfLoading; - if (!igcPosition.PortOfDischarge.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = igcPosition.PortOfDischarge; + pi.UNNumber = igcPosition.UNNumber; + pi.IMOClass = igcPosition.IMOClass; + pi.Name = igcPosition.ProductName; + if (igcPosition.Quantity_KGM.HasValue) + pi.NetMassKGM = (float)igcPosition.Quantity_KGM.Value; + pi.Remarks = igcPosition.Remarks; - pi.Index = igcPosition.Identifier; + if (!igcPosition.StowagePosition.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].LocationOnBoard = igcPosition.StowagePosition; + if (!igcPosition.PortOfLoading.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = igcPosition.PortOfLoading; + if (!igcPosition.PortOfDischarge.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = igcPosition.PortOfDischarge; - igcPositions[i] = pi; + pi.Index = igcPosition.Identifier; + + igcPositions[i] = pi; + } + + dgList.Add(igcPositions); } - dgList.Add(igcPositions); - } + #endregion - #endregion + #region IMSBCPositions - #region IMSBCPositions - - if (haz.IMSBCPositions.Count > 0) - { - positionimsbc[] imsbcPositions = new positionimsbc[haz.IMSBCPositions.Count]; - - for (int i = 0; i < haz.IMSBCPositions.Count;i++ ) + if (haz.IMSBCPositions.Count > 0) { - positionimsbc pi = new positionimsbc(); - IMSBCPosition imsbcPosition = haz.IMSBCPositions[i]; + positionimsbc[] imsbcPositions = new positionimsbc[haz.IMSBCPositions.Count]; - pi.Name = imsbcPosition.BulkCargoShippingName; - pi.MHB = (imsbcPosition.MHB ?? false) ? yorntype.Y : yorntype.N; - pi.UNNumber = imsbcPosition.UNNumber; - pi.IMOClass = imsbcPosition.IMOClass; - if (imsbcPosition.Quantity_KGM.HasValue) - pi.NetMassKGM = (float)imsbcPosition.Quantity_KGM.Value; - pi.Remarks = imsbcPosition.Remarks; + for (int i = 0; i < haz.IMSBCPositions.Count; i++) + { + positionimsbc pi = new positionimsbc(); + IMSBCPosition imsbcPosition = haz.IMSBCPositions[i]; - if (!imsbcPosition.StowagePosition.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].LocationOnBoard = imsbcPosition.StowagePosition; - if (!imsbcPosition.PortOfLoading.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imsbcPosition.PortOfLoading; - if (!imsbcPosition.PortOfDischarge.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imsbcPosition.PortOfDischarge; + pi.Name = imsbcPosition.BulkCargoShippingName; + pi.MHB = (imsbcPosition.MHB ?? false) ? yorntype.Y : yorntype.N; + pi.UNNumber = imsbcPosition.UNNumber; + pi.IMOClass = imsbcPosition.IMOClass; + if (imsbcPosition.Quantity_KGM.HasValue) + pi.NetMassKGM = (float)imsbcPosition.Quantity_KGM.Value; + pi.Remarks = imsbcPosition.Remarks; - pi.Index = imsbcPosition.Identifier; + if (!imsbcPosition.StowagePosition.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].LocationOnBoard = imsbcPosition.StowagePosition; + if (!imsbcPosition.PortOfLoading.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = imsbcPosition.PortOfLoading; + if (!imsbcPosition.PortOfDischarge.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = imsbcPosition.PortOfDischarge; - imsbcPositions[i] = pi; + pi.Index = imsbcPosition.Identifier; + + imsbcPositions[i] = pi; + } + + dgList.Add(imsbcPositions); } - dgList.Add(imsbcPositions); - } + #endregion - #endregion + #region IMDGPositions - #region IMDGPositions - - if (haz.MARPOLPositions.Count > 0) - { - positionmarpol[] marpolPositions = new positionmarpol[haz.MARPOLPositions.Count]; - - for (int i = 0; i < haz.MARPOLPositions.Count;i++) + if (haz.MARPOLPositions.Count > 0) { - positionmarpol pi = new positionmarpol(); - MARPOL_Annex_I_Position marpolPosition = haz.MARPOLPositions[i]; + positionmarpol[] marpolPositions = new positionmarpol[haz.MARPOLPositions.Count]; - pi.Name = marpolPosition.Name; - if (marpolPosition.FlashpointInformation.HasValue) - pi.FlashpointInformation = (flashpointinfotype) marpolPosition.FlashpointInformation.Value; - pi.Flashpoint_CEL = marpolPosition.Flashpoint_CEL; - if (marpolPosition.Quantity_KGM.HasValue) - pi.NetMassKGM = (float)marpolPosition.Quantity_KGM.Value; - pi.Remarks = marpolPosition.Remarks; + for (int i = 0; i < haz.MARPOLPositions.Count; i++) + { + positionmarpol pi = new positionmarpol(); + MARPOL_Annex_I_Position marpolPosition = haz.MARPOLPositions[i]; - if (!marpolPosition.StowagePosition.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].LocationOnBoard = marpolPosition.StowagePosition; - if (!marpolPosition.PortOfLoading.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = marpolPosition.PortOfLoading; - if (!marpolPosition.PortOfDischarge.IsNullOrEmpty()) - _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = marpolPosition.PortOfDischarge; + pi.Name = marpolPosition.Name; + if (marpolPosition.FlashpointInformation.HasValue) + pi.FlashpointInformation = (flashpointinfotype)marpolPosition.FlashpointInformation.Value; + pi.Flashpoint_CEL = marpolPosition.Flashpoint_CEL; + if (marpolPosition.Quantity_KGM.HasValue) + pi.NetMassKGM = (float)marpolPosition.Quantity_KGM.Value; + pi.Remarks = marpolPosition.Remarks; - pi.Index = marpolPosition.Identifier; + if (!marpolPosition.StowagePosition.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].LocationOnBoard = marpolPosition.StowagePosition; + if (!marpolPosition.PortOfLoading.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfLoadingLocode = marpolPosition.PortOfLoading; + if (!marpolPosition.PortOfDischarge.IsNullOrEmpty()) + _nsw.conveyance.GeneralCargo[0].PortOfDischargeLocode = marpolPosition.PortOfDischarge; - marpolPositions[i] = pi; + pi.Index = marpolPosition.Identifier; + + marpolPositions[i] = pi; + } + + dgList.Add(marpolPositions); } - dgList.Add(marpolPositions); + #endregion + + // HACK! Die erste "vorhandene" Liste. Dieses Format hier setzt voraus dass man immer nur einen Listentyp + // haben kann, das steht aber nirgends im NSW + // alles andere wird bis zur Klärung hier erst einmal ignoriert + if(dgList.Count > 0) + _nsw.conveyance.GeneralCargo[0].DGList = (object[])dgList[0]; //.ToArray(); } - - #endregion - - // HACK! Die erste "vorhandene" Liste. Dieses Format hier setzt voraus dass man immer nur einen Listentyp - // haben kann, das steht aber nirgends im NSW - // alles andere wird bis zur Klärung hier erst einmal ignoriert - _nsw.conveyance.GeneralCargo[0].DGList = (object[]) dgList[0]; //.ToArray(); } } break; + #endregion + #region INFO case Message.NotificationClass.INFO: INFO info = message.Elements[0] as INFO; @@ -610,10 +620,14 @@ namespace bsmd.hisnord mdh _mdh = new mdh(); if (mdh.AwareOfFurtherInfections.HasValue) _mdh.AwareOfConditionsForFurtherInfections = mdh.AwareOfFurtherInfections.Value ? yorntype.Y : yorntype.N; - _mdh.InfectedArea = new infectedarea(); - if (mdh.InfectedAreaDate.HasValue) - _mdh.InfectedArea.InfectedAreaDate = mdh.InfectedAreaDate.Value; - _mdh.InfectedArea.InfectedAreaPort = mdh.InfectedAreaPort; + + if (mdh.InfectedAreaDate.HasValue && !mdh.InfectedAreaPort.IsNullOrEmpty()) + { + _mdh.InfectedArea = new infectedarea(); + if (mdh.InfectedAreaDate.HasValue) + _mdh.InfectedArea.InfectedAreaDate = mdh.InfectedAreaDate.Value; + _mdh.InfectedArea.InfectedAreaPort = mdh.InfectedAreaPort; + } if (mdh.InfectedAreaVisited.HasValue) _mdh.InfectedAreaVisited = mdh.InfectedAreaVisited.Value ? yorntype.Y : yorntype.N; if (mdh.MedicalConsulted.HasValue) @@ -632,7 +646,7 @@ namespace bsmd.hisnord for (int i = 0; i < mdh.PortOfCallLast30Days.Count; i++) { _mdh.PortsOfCallLast30Days[i] = new portofcallmdh(); - _mdh.PortsOfCallLast30Days[i].Index = i.ToString(); + _mdh.PortsOfCallLast30Days[i].Index = (i+1).ToString(); // POSINT = 1-basiert if (mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count > 0) { _mdh.PortsOfCallLast30Days[i].PortOfCallLast30DaysCrewJoinedShip = new string[mdh.PortOfCallLast30Days[i].CrewJoinedShip.Count]; @@ -652,11 +666,14 @@ namespace bsmd.hisnord _mdh.SanitaryControlReinspectionRequired = mdh.SanitaryControlReinspectionRequired.Value ? yorntype.Y : yorntype.N; if (mdh.SanitaryMeasuresApplied.HasValue) _mdh.SanitaryMeasuresApplied = mdh.SanitaryMeasuresApplied.Value ? yorntype.Y : yorntype.N; - _mdh.SanitaryMeasuresDetails = new sanitarydetails(); - if (mdh.SanitaryMeasuresDate.HasValue) - _mdh.SanitaryMeasuresDetails.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value; - _mdh.SanitaryMeasuresDetails.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation; - _mdh.SanitaryMeasuresDetails.SanitaryMeasuresType = mdh.SanitaryMeasuresType; + if (mdh.SanitaryMeasuresDate.HasValue && !mdh.SanitaryMeasuresLocation.IsNullOrEmpty() && !mdh.SanitaryMeasuresType.IsNullOrEmpty()) + { + _mdh.SanitaryMeasuresDetails = new sanitarydetails(); + if (mdh.SanitaryMeasuresDate.HasValue) + _mdh.SanitaryMeasuresDetails.SanitaryMeasuresDate = mdh.SanitaryMeasuresDate.Value; + _mdh.SanitaryMeasuresDetails.SanitaryMeasuresLocation = mdh.SanitaryMeasuresLocation; + _mdh.SanitaryMeasuresDetails.SanitaryMeasuresType = mdh.SanitaryMeasuresType; + } if (mdh.SickAnimalOrPetOnBoard.HasValue) _mdh.SickAnimalOrPetOnBoard = mdh.SickAnimalOrPetOnBoard.Value ? yorntype.Y : yorntype.N; if (mdh.SickPersonsOnBoard.HasValue) @@ -836,17 +853,25 @@ namespace bsmd.hisnord if (pre72h.PlannedPeriodOfStay_HUR.HasValue) _nsw.conveyance.Pre72H.PlannedPeriodOfStay_HUR = (float)pre72h.PlannedPeriodOfStay_HUR.Value; _nsw.conveyance.Pre72H.PlannedWorks = pre72h.PlannedWorks; - if (pre72h.Tanker.HasValue) - _nsw.conveyance.Pre72H.Tanker = pre72h.Tanker.Value ? yorntype.Y : yorntype.N; - _nsw.conveyance.Pre72H.TankerDetails = new tankerdetails(); - if (pre72h.ConditionCargoBallastTanks.HasValue) - _nsw.conveyance.Pre72H.TankerDetails.ConditionCargoBallastTanks = (cargoconditiontype)pre72h.ConditionCargoBallastTanks.Value; - _nsw.conveyance.Pre72H.TankerDetails.NatureOfCargo = pre72h.NatureOfCargo; - if (pre72h.TankerHullConfiguration.HasValue) - _nsw.conveyance.Pre72H.TankerDetails.TankerHullConfiguration = (hullconfigtype)pre72h.TankerHullConfiguration.Value; - if (pre72h.VolumeOfCargo.HasValue) - _nsw.conveyance.Pre72H.TankerDetails.VolumeOfCargo_TNE = (float)pre72h.VolumeOfCargo.Value; - _nsw.conveyance.Pre72H.TankerDetails.VolumeOfCargo_TNESpecified = pre72h.VolumeOfCargo.HasValue; + + _nsw.conveyance.Pre72H.Tanker = (pre72h.Tanker ?? false) ? yorntype.Y : yorntype.N; + + if (pre72h.Tanker ?? false) + { + _nsw.conveyance.Pre72H.TankerDetails = new tankerdetails(); + if (pre72h.ConditionCargoBallastTanks.HasValue) + _nsw.conveyance.Pre72H.TankerDetails.ConditionCargoBallastTanks = (cargoconditiontype)pre72h.ConditionCargoBallastTanks.Value; + _nsw.conveyance.Pre72H.TankerDetails.NatureOfCargo = pre72h.NatureOfCargo; + if (pre72h.TankerHullConfiguration.HasValue) + _nsw.conveyance.Pre72H.TankerDetails.TankerHullConfiguration = (hullconfigtype)pre72h.TankerHullConfiguration.Value; + if (pre72h.VolumeOfCargo.HasValue) + _nsw.conveyance.Pre72H.TankerDetails.VolumeOfCargo_TNE = (float)pre72h.VolumeOfCargo.Value; + _nsw.conveyance.Pre72H.TankerDetails.VolumeOfCargo_TNESpecified = pre72h.VolumeOfCargo.HasValue; + } + else + { + _nsw.conveyance.Pre72H.TankerDetails = null; + } break; #endregion @@ -893,7 +918,7 @@ namespace bsmd.hisnord for (int i = 0; i < sec.LastTenPortFacilitesCalled.Count; i++) { _sec.Last10Ports[i] = new last10port(); - _sec.Last10Ports[i].Index = i.ToString(); + _sec.Last10Ports[i].Index = (i+1).ToString(); if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.HasValue) _sec.Last10Ports[i].PortFacilityDateOfArrival = sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfArrival.Value; if (sec.LastTenPortFacilitesCalled[i].PortFacilityDateOfDeparture.HasValue) @@ -1111,7 +1136,12 @@ namespace bsmd.hisnord for (int i = 0; i < was.Waste.Count; i++) { waste _aWaste = new waste(); - _aWaste.WasteDescription = was.Waste[i].WasteDescription; + string tempWasteType = was.Waste[i].WasteTypeDisplay ?? ""; + // im Gegensatz zu Spec gibt überfl. Description einen Parse-Fehler :( + if (tempWasteType.Equals("WASTE_OILS-OTHERS") || tempWasteType.Equals("GARBAGE-OTHER") || tempWasteType.Equals("CARGO-RESIDUES") || tempWasteType.Equals("CARGO-ASSOSIATED_WASTE")) + _aWaste.WasteDescription = was.Waste[i].WasteDescription; + else + _aWaste.WasteDescription = null; _aWaste.WasteDetails = new wastedetails(); _aWaste.WasteDetails.WasteAmountGeneratedTillNextPort_MTQSpecified = was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.HasValue; if (was.Waste[i].WasteAmountGeneratedTillNextPort_MTQ.HasValue) @@ -1126,7 +1156,7 @@ namespace bsmd.hisnord if (was.Waste[i].WasteDisposalAmount_MTQ.HasValue) _aWaste.WasteDisposalAmount_MTQ = (float)was.Waste[i].WasteDisposalAmount_MTQ.Value; if (was.Waste[i].WasteType.HasValue) - _aWaste.WasteType = (wastetype)was.Waste[i].WasteType.Value; + _aWaste.WasteType = (wastetype)(was.Waste[i].WasteType.Value - 1); // im XSD scheint das 0-basiert zu sein (falsch?) _waste.Wastes[i] = _aWaste; } } @@ -1155,7 +1185,28 @@ namespace bsmd.hisnord #region send message and store result - transmitter.result theResult = transmitter.UseHisNordTransmitter(filePath); + transmitter.result theResult = transmitter.UseHisNordTransmitter(filePath); + if (theResult != null) + { + _log.InfoFormat("Result: Code {0} Detail {1} Message {2}", theResult.code, theResult.detail, theResult.message); + + if (visitTransitHeader != null) + { + if (theResult.code > 0) + { + MessageError error = new MessageError(); + error.MessageHeaderId = visitTransitHeader.Id.Value; + error.ErrorCode = theResult.code; + + if ((theResult.detail != null) && (theResult.detail.Length > 255)) + error.ErrorText = theResult.detail.Substring(0, 255); + else + error.ErrorText = theResult.detail; + + DBManager.Instance.Save(error); + } + } + } #endregion diff --git a/nsw/Source/bsmd.hisnord/transmitter.cs b/nsw/Source/bsmd.hisnord/transmitter.cs index e856b938..35d52d4f 100644 --- a/nsw/Source/bsmd.hisnord/transmitter.cs +++ b/nsw/Source/bsmd.hisnord/transmitter.cs @@ -28,6 +28,7 @@ namespace bsmd.hisnord { Process process = new Process(); process.StartInfo.FileName = Properties.Settings.Default.Transmitter; + process.StartInfo.WorkingDirectory = Path.GetDirectoryName(Properties.Settings.Default.Transmitter); process.StartInfo.RedirectStandardError = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardInput = false;