diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs index 00e93963..76e5de7f 100644 --- a/ENI2/DetailRootControl.xaml.cs +++ b/ENI2/DetailRootControl.xaml.cs @@ -595,7 +595,7 @@ namespace ENI2 } // NOA_NOD vor ATA vor ATD Versendereihenfolge sicherstellen - if ((this.Core.InitialHIS == Message.NSWProvider.DUDR) || (this.Core.InitialHIS == Message.NSWProvider.DUDR_TEST)) + if (this.Core.InitialHIS == Message.NSWProvider.DUDR) { bool noa_nod_queued_or_sent = false; bool ata_queued_or_sent = false; diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index b4a81828..f273719a 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 0 - 7.0.0.0 + 1 + 7.0.0.1 false true true diff --git a/ENI2/EditControls/CopyDeclarationDialog.xaml.cs b/ENI2/EditControls/CopyDeclarationDialog.xaml.cs index 711d1a06..5ad407cd 100644 --- a/ENI2/EditControls/CopyDeclarationDialog.xaml.cs +++ b/ENI2/EditControls/CopyDeclarationDialog.xaml.cs @@ -76,10 +76,8 @@ namespace ENI2.EditControls this.OKClicked += VisitIdDialog_OKClicked; List> comboDataSource = new List>() { - new KeyValuePair( Message.NSWProvider.DBH, "DBH live" ), - new KeyValuePair( Message.NSWProvider.DBH_TEST, "DBH Testsystem" ), - new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord live" ), - new KeyValuePair( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" ) + new KeyValuePair( Message.NSWProvider.DBH, "DBH" ), + new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord" ), }; this.comboBoxInitialHIS.ItemsSource = comboDataSource; diff --git a/ENI2/EditControls/NewWithIdDialog.xaml.cs b/ENI2/EditControls/NewWithIdDialog.xaml.cs index 3a49b7e0..a8a9f8ba 100644 --- a/ENI2/EditControls/NewWithIdDialog.xaml.cs +++ b/ENI2/EditControls/NewWithIdDialog.xaml.cs @@ -30,8 +30,7 @@ namespace ENI2.EditControls List> comboDataSource = new List>() { - new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord live" ), - new KeyValuePair( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" ), + new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord" ), new KeyValuePair(Message.NSWProvider.DBH, "DBH") }; diff --git a/ENI2/EditControls/VisitIdDialog.xaml.cs b/ENI2/EditControls/VisitIdDialog.xaml.cs index 0a4a574b..72ac4f44 100644 --- a/ENI2/EditControls/VisitIdDialog.xaml.cs +++ b/ENI2/EditControls/VisitIdDialog.xaml.cs @@ -29,10 +29,8 @@ namespace ENI2.EditControls this.OKClicked += VisitIdDialog_OKClicked; List> comboDataSource = new List>() { - new KeyValuePair( Message.NSWProvider.DBH, "DBH live" ), - new KeyValuePair( Message.NSWProvider.DBH_TEST, "DBH Testsystem" ), - new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord live" ), - new KeyValuePair( Message.NSWProvider.DUDR_TEST, "HIS-Nord Testsystem" ) + new KeyValuePair( Message.NSWProvider.DBH, "DBH" ), + new KeyValuePair( Message.NSWProvider.DUDR, "HIS-Nord" ), }; this.comboBoxInitialHIS.ItemsSource = comboDataSource; diff --git a/ENI2/Excel/ExcelWriter.cs b/ENI2/Excel/ExcelWriter.cs index f559a7d8..14b6a540 100644 --- a/ENI2/Excel/ExcelWriter.cs +++ b/ENI2/Excel/ExcelWriter.cs @@ -140,11 +140,19 @@ namespace ENI2.Excel case Message.NotificationClass.STO: this.WriteSTO(message); break; - case Message.NotificationClass.TIEFA: - if (message.Elements[0] is TIEFA tiefa) this.WriteMessage(tiefa); + case Message.NotificationClass.TIEFA: + if (message.Elements[0] is TIEFA tiefa) + { + if (tiefa.DraughtUponArrival_DMT.HasValue) + WriteNumber("TIEFA.DraughtUponArrival_DMT", tiefa.DraughtUponArrival_DMT.Value / 10.0); + } break; case Message.NotificationClass.TIEFD: - if (message.Elements[0] is TIEFD tiefd) this.WriteMessage(tiefd); + if (message.Elements[0] is TIEFD tiefd) + { + if (tiefd.DraughtUponDeparture_DMT.HasValue) + WriteNumber("TIEFD.DraughtUponDeparture_DMT", tiefd.DraughtUponDeparture_DMT.Value / 10.0); + } break; case Message.NotificationClass.TOWA: WriteTOWA(message); @@ -156,7 +164,9 @@ namespace ENI2.Excel if (message.Elements[0] is WAS was) this.WriteMessage(was); WriteWAS(message); break; - + case Message.NotificationClass.WAS_RCPT: + WriteWAS_RCPT(message); + break; default: _log.InfoFormat("skip writing message class {0}", message.MessageNotificationClassDisplay); break; @@ -353,6 +363,13 @@ namespace ENI2.Excel private void WriteCREW(Message crewMessage, bool isArrival) { + + if (crewMessage.Elements.Count > 0) + { + WriteBoolean(string.Format("CREW{0}.NotificationSchengen", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationSchengen); + WriteBoolean(string.Format("CREW{0}.NotificationPAX", isArrival ? "" : "D"), ((CREW)crewMessage.Elements[0]).NotificationPAX); + } + for(int i = 0; i 0) + { + WriteBoolean(string.Format("PAS{0}.NotificationSchengen", isArrival ? "" : "D"), ((PAS)pasMessage.Elements[0]).NotificationSchengen); + WriteBoolean(string.Format("PAS{0}.NotificationPAX", isArrival ? "" : "D"), ((PAS)pasMessage.Elements[0]).NotificationPAX); + } + for(int i = 0; i < Math.Min(pasMessage.NumberOfExcelRows, pasMessage.Elements.Count); i++) { string pasLastName = string.Format("PAS{1}.PassengerLastName_{0}", i + 1, isArrival ? "" : "D"); @@ -709,7 +767,14 @@ namespace ENI2.Excel string pasIdentDocType = string.Format("PAS{1}.PassengerIdentityDocumentType_{0}", i + 1, isArrival ? "" : "D"); string pasIdentDocId = string.Format("PAS{1}.PassengerIdentityDocumentId_{0}", i + 1, isArrival ? "" : "D"); string pasVisaNo = string.Format("PAS{1}.PassengerVisaNumber_{0}", i + 1, isArrival ? "" : "D"); + string pasIssuing = string.Format("PAS{1}.PassengerIdentityDocumentIssuingState_{0}", i + 1, isArrival ? "" : "D"); + string pasExpiry = string.Format("PAS{1}.PassengerIdentityDocumentExpiryDate_{0}", i + 1, isArrival ? "" : "D"); + string pasCountry = string.Format("PAS{1}.CountryOfBirth_{0}", i + 1, isArrival ? "" : "D"); + string pasEmergencyCare = string.Format("PAS{1}.EmergencyCare_{0}", i + 1, isArrival ? "" : "D"); + string pasEmergencyContact = string.Format("PAS{1}.EmergencyContactNumber_{0}", i + 1, isArrival ? "" : "D"); + PAS pas = pasMessage.Elements[i] as PAS; // PASD is derived from PAS daher ok! + WriteText(pasLastName, pas.PassengerLastName); WriteText(pasFirstName, pas.PassengerFirstName); WriteGender(pasGender, pas.PassengerGender); @@ -723,6 +788,11 @@ namespace ENI2.Excel WriteText(pasIdentDocType, pas.PassengerIdentityDocumentTypeDisplay); WriteText(pasIdentDocId, pas.PassengerIdentityDocumentId); WriteText(pasVisaNo, pas.PassengerVisaNumber); + WriteText(pasIssuing, pas.PassengerIdentityDocumentIssuingState); + WriteDate(pasExpiry, pas.PassengerIdentityDocumentExpiryDate); + WriteText(pasCountry, pas.PassengerCountryOfBirth); + WriteText(pasEmergencyCare, pas.EmergencyCare); + WriteText(pasEmergencyContact, pas.EmergencyContactNumber); } } @@ -912,6 +982,7 @@ namespace ENI2.Excel string tLen = string.Format("TOWD.TowageOnDepartureLengthOverall_MTR_{0}", i + 1); string tBeam = string.Format("TOWD.TowageOnDepartureBeam_MTR_{0}", i + 1); string tOp = string.Format("TOWD.TowageOnDepartureOperatorCompanyName_{0}", i + 1); + string tPoc = string.Format("TOWD.TowageOnDeparturePurposeOfCall_{0}", i + 1); TOWD towd = towdMessage.Elements[i] as TOWD; @@ -924,6 +995,7 @@ namespace ENI2.Excel if (towd.TowageOnDepartureBeam_MTR.HasValue) WriteNumber(tBeam, towd.TowageOnDepartureBeam_MTR.Value); WriteText(tOp, towd.TowageOnDepartureOperatorCompanyName); + // WriteText(tPoc, towd.Tow) } } @@ -936,7 +1008,7 @@ namespace ENI2.Excel if (wasMessage.Elements.Count == 0) return; WAS was = wasMessage.Elements[0] as WAS; - if (was.WasteDisposalDelivery.HasValue) + if (was.WasteDisposalDelivery.HasValue) // TODO: CH schreibt für DK erforderlich -> nachfragen { switch (was.WasteDisposalDelivery) { @@ -949,6 +1021,9 @@ namespace ENI2.Excel WriteText("WAS.LastWasteDisposalPort", was.LastWasteDisposalPort); WriteText("WAS.WasteDisposalServiceProviderName", was.WasteDisposalServiceProviderText); + WriteText("WAS.NextWasteDisposalPort", was.NextWasteDisposalPort); + WriteBoolean("WAS.ConfirmationOfCorrectness", true); + WriteBoolean("WAS.ConfirmationOfSufficiency", true); for(int i = 0; i < Math.Min(was.NumberOfExcelRows, was.Waste.Count); i++) { @@ -959,8 +1034,7 @@ namespace ENI2.Excel string wasteCapacity = string.Format("WAS.WasteCapacity_MTQ_{0}", i + 1); string wasteRetained = string.Format("WAS.WasteAmountRetained_MTQ_{0}", i + 1); string wastePort = string.Format("WAS.WasteDisposalPort_{0}", i + 1); - string amountGen = string.Format("WAS.WasteAmountGeneratedTillNextPort_MTQ_{0}", i + 1); - string wasteDis = string.Format("WAS.WasteDisposedAtLastPort_MTQ_{0}", i + 1); + string amountGen = string.Format("WAS.WasteAmountGeneratedTillNextPort_MTQ_{0}", i + 1); Waste waste = was.Waste[i]; @@ -976,11 +1050,49 @@ namespace ENI2.Excel WriteNumber(wasteRetained, waste.WasteAmountRetained_MTQ.Value); WriteText(wastePort, waste.WasteDisposalPort); if (waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) - WriteNumber(amountGen, waste.WasteAmountGeneratedTillNextPort_MTQ.Value); - if (waste.WasteDisposedAtLastPort_MTQ.HasValue) - WriteNumber(wasteDis, waste.WasteDisposedAtLastPort_MTQ.Value); + WriteNumber(amountGen, waste.WasteAmountGeneratedTillNextPort_MTQ.Value); } + } + #endregion + + #region WAS_RCPT + + private void WriteWAS_RCPT(Message wasRcptmessage) + { + for (int i = 1; i <= Math.Min(wasRcptmessage.NumberOfExcelRows, wasRcptmessage.Elements.Count); i++) + { + string ident = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.IdentificationNumber", i); + string prfn = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.PortReceptionFacilityName", i); + string prfpn = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.PortReceptionFacilityProviderName", i); + string tfpn = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.TreatmentFacilityProviderName", i); + string wddfd = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDeliveryDateFromDate", i); + string wddft = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDeliveryDateFromTime", i); + string wddtd = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDeliveryDateToDate", i); + string wddtt = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDeliveryDateToTime", i); + + WAS_RCPT wrcpt = wasRcptmessage.Elements[i-1] as WAS_RCPT; + + WriteText(ident, wrcpt.IdentificationNumber); + WriteText(prfn, wrcpt.PortReceptionFacilityName); + WriteText(prfpn, wrcpt.PortReceptionFacilityProviderName); + WriteText(tfpn, wrcpt.TreatmentFacilityProviderText); + WriteDate(wddfd, wrcpt.WasteDeliveryDateFrom); + WriteTime(wddft, wrcpt.WasteDeliveryDateFrom); + WriteDate(wddtd, wrcpt.WasteDeliveryDateTo); + WriteTime(wddtt, wrcpt.WasteDeliveryDateTo); + + for(int j = 1; j <= Math.Min(wrcpt.NumberOfExcelRows, wrcpt.WasteReceived.Count); j++) + { + string wdesc = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDescription_{1}", i, j); + string wamount = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.AmountWasteReceived_MTQ_{1}", i, j); + + WasteReceived wReceived = wrcpt.WasteReceived[i - 1]; + + WriteText(wdesc, wReceived.WasteDescription); + WriteNumber(wamount, wReceived.AmountWasteReceived_MTQ); + } + } } #endregion @@ -1058,9 +1170,16 @@ namespace ENI2.Excel { bool result = _nameDict.ContainsKey(lookupName); bool? b = (bool?) v; - if (result && b.HasValue) + try { - _nameDict[lookupName].RefersToRange.Value = b.Value ? "Y" : "N"; + if (result && b.HasValue) + { + _nameDict[lookupName].RefersToRange.Value = b.Value ? "Y" : "N"; + } + } + catch(Exception) + { + System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName)); } return result; @@ -1069,10 +1188,16 @@ namespace ENI2.Excel private bool WriteText(string lookupName, object v) { bool result = _nameDict.ContainsKey(lookupName); - - if(result) + try { - _nameDict[lookupName].RefersToRange.Value = v; + if (result) + { + _nameDict[lookupName].RefersToRange.Value = v; + } + } + catch(Exception) + { + System.Diagnostics.Trace.WriteLine(string.Format("Error writing {0} to excel, field missing", lookupName)); } return result; diff --git a/ENI2/MainWindow.xaml.cs b/ENI2/MainWindow.xaml.cs index ba3809c3..e675ba42 100644 --- a/ENI2/MainWindow.xaml.cs +++ b/ENI2/MainWindow.xaml.cs @@ -446,7 +446,7 @@ namespace ENI2 { MessageCore newCore = new MessageCore(); newCore.Incoming = true; - newCore.InitialHIS = Message.NSWProvider.DUDR_TEST; + newCore.InitialHIS = Message.NSWProvider.DUDR; bool alreadyInSystem = false; if (bsmd.database.Util.IsTransitId(newWithIdDialog.VisitTransitId)) diff --git a/bsmd.dakosy/Request.cs b/bsmd.dakosy/Request.cs index f86b71a8..fe6de886 100644 --- a/bsmd.dakosy/Request.cs +++ b/bsmd.dakosy/Request.cs @@ -19,7 +19,7 @@ namespace bsmd.dakosy { public class Request { - private static ILog _log = LogManager.GetLogger(typeof(Request)); + private static readonly ILog _log = LogManager.GetLogger(typeof(Request)); #region send single message diff --git a/bsmd.database/MessageCore.cs b/bsmd.database/MessageCore.cs index 78a9752d..7542b28d 100644 --- a/bsmd.database/MessageCore.cs +++ b/bsmd.database/MessageCore.cs @@ -24,6 +24,7 @@ namespace bsmd.database private string _visitId; private string _transitId; + private Message.NSWProvider _initialHIS; #endregion @@ -207,7 +208,19 @@ namespace bsmd.database public BSMDStatus BSMDStatusInternal { get; set; } [ENI2Validation] - public Message.NSWProvider InitialHIS { get; set; } + public Message.NSWProvider InitialHIS + { + get + { + if ((int)_initialHIS > 3) // pre 7.0 declarations may have "Test-" HIS set + return _initialHIS - 3; + return _initialHIS; + } + set + { + _initialHIS = value; + } + } public Guid? HerbergFormGuid { get; set; } diff --git a/misc/Reference_Sheet_DE.xlsx b/misc/Reference_Sheet_DE.xlsx index 21afd5dc..82ee24ba 100644 Binary files a/misc/Reference_Sheet_DE.xlsx and b/misc/Reference_Sheet_DE.xlsx differ