Korrekturen für das dbh Format (peinlich, dass mir das zuvor entgangen ist..)

This commit is contained in:
Daniel Schick 2022-12-14 11:58:18 +01:00
parent 964e2aa967
commit f0d3f5cbb1

View File

@ -29,7 +29,8 @@ namespace bsmd.dbh
root.SourceDocumentVersion = "7.1"; root.SourceDocumentVersion = "7.1";
root.Timestamp = DateTime.Now; root.Timestamp = DateTime.Now;
root.Sender = Properties.Settings.Default.Sender; root.Sender = Properties.Settings.Default.Sender;
root.SenderReference = message.Id.ToString(); root.SenderReference = message.Id.Value.ToString("N");
bsmd.database.ReportingParty reportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value]; bsmd.database.ReportingParty reportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value];
Request.ReportingParty rp = new Request.ReportingParty(); Request.ReportingParty rp = new Request.ReportingParty();
rp.RPCity = reportingParty.City; rp.RPCity = reportingParty.City;
@ -47,6 +48,26 @@ namespace bsmd.dbh
rp.RPType = (ReportingPartyRPType)reportingParty.ReportingPartyType.Value; rp.RPType = (ReportingPartyRPType)reportingParty.ReportingPartyType.Value;
root.ReportingParty = rp; root.ReportingParty = rp;
if(!core.VisitId.IsNullOrEmpty())
{
root.Item = core.VisitId;
root.ItemElementName = ItemChoiceType2.VisitId;
}
if(!core.TransitId.IsNullOrEmpty())
{
root.Item = core.TransitId;
root.ItemElementName = ItemChoiceType2.TransitId;
}
if (message.Reset)
{
RootReportingClassesToReset rrctr = new RootReportingClassesToReset();
rrctr.ReportingClassToReset = new string[1];
rrctr.ReportingClassToReset[0] = message.MessageNotificationClassDisplay;
}
else
{
switch (message.MessageNotificationClass) switch (message.MessageNotificationClass)
{ {
@ -142,7 +163,7 @@ namespace bsmd.dbh
NOA_NOD noa_nod = message.Elements[0] as NOA_NOD; NOA_NOD noa_nod = message.Elements[0] as NOA_NOD;
RootNOA_NOD rootNOA_NOD = new RootNOA_NOD(); RootNOA_NOD rootNOA_NOD = new RootNOA_NOD();
rootNOA_NOD.ETAToNextPortSpecified = noa_nod.ETAToNextPort.HasValue; rootNOA_NOD.ETAToNextPortSpecified = noa_nod.ETAToNextPort.HasValue;
if(noa_nod.ETAToNextPort.HasValue) if (noa_nod.ETAToNextPort.HasValue)
rootNOA_NOD.ETAToNextPort = noa_nod.ETAToNextPort.Value; rootNOA_NOD.ETAToNextPort = noa_nod.ETAToNextPort.Value;
rootNOA_NOD.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue; rootNOA_NOD.ETDFromLastPortSpecified = noa_nod.ETDFromLastPort.HasValue;
if (noa_nod.ETDFromLastPort.HasValue) if (noa_nod.ETDFromLastPort.HasValue)
@ -240,7 +261,7 @@ namespace bsmd.dbh
if (message.Elements[0] is ATD atd) if (message.Elements[0] is ATD atd)
{ {
RootATD rootATD = new RootATD(); RootATD rootATD = new RootATD();
if(atd.ATDPortOfCall.HasValue) if (atd.ATDPortOfCall.HasValue)
rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value; rootATD.ATDPortOfCall = atd.ATDPortOfCall.Value;
// rootATD.ReportingParty = rp; // rootATD.ReportingParty = rp;
root.Items = new object[1]; root.Items = new object[1];
@ -927,7 +948,7 @@ namespace bsmd.dbh
choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency); choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency);
wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N"); wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N");
if(was.LastWasteDisposalDate.HasValue) if (was.LastWasteDisposalDate.HasValue)
{ {
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalDate); choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalDate);
wasteItems.Add(was.LastWasteDisposalDate); wasteItems.Add(was.LastWasteDisposalDate);
@ -1109,7 +1130,7 @@ namespace bsmd.dbh
rootIMDG.NetExplosiveMass_KGM = decimal.Round((decimal)imdgPos.NetExplosiveMass_KGM.Value, 3); rootIMDG.NetExplosiveMass_KGM = decimal.Round((decimal)imdgPos.NetExplosiveMass_KGM.Value, 3);
rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL; rootIMDG.Flashpoint_CEL = imdgPos.Flashpoint_CEL;
rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName; rootIMDG.Class7NuclideName = imdgPos.Class7NuclideName;
if(imdgPos.Class7MaxActivity_BQL.HasValue) if (imdgPos.Class7MaxActivity_BQL.HasValue)
{ {
rootIMDG.Class7MaxActivity = new IMDGPositionClass7MaxActivity(); rootIMDG.Class7MaxActivity = new IMDGPositionClass7MaxActivity();
rootIMDG.Class7MaxActivity.MaxActivityValue = decimal.Round((decimal)imdgPos.Class7MaxActivity_BQL.Value, 3); rootIMDG.Class7MaxActivity.MaxActivityValue = decimal.Round((decimal)imdgPos.Class7MaxActivity_BQL.Value, 3);
@ -1598,7 +1619,8 @@ namespace bsmd.dbh
RootWAS_RCPT rootWAS_RCPT = new RootWAS_RCPT(); RootWAS_RCPT rootWAS_RCPT = new RootWAS_RCPT();
rootWAS_RCPT.WasteDeliveryReceipt = new RootWAS_RCPTWasteDeliveryReceipt[message.Elements.Count]; rootWAS_RCPT.WasteDeliveryReceipt = new RootWAS_RCPTWasteDeliveryReceipt[message.Elements.Count];
for(int i = 0; i < message.Elements.Count; i++) { for (int i = 0; i < message.Elements.Count; i++)
{
WAS_RCPT was_rcpt = message.Elements[i] as WAS_RCPT; WAS_RCPT was_rcpt = message.Elements[i] as WAS_RCPT;
RootWAS_RCPTWasteDeliveryReceipt rwr = new RootWAS_RCPTWasteDeliveryReceipt(); RootWAS_RCPTWasteDeliveryReceipt rwr = new RootWAS_RCPTWasteDeliveryReceipt();
@ -1610,9 +1632,9 @@ namespace bsmd.dbh
{ {
rwr.TreatmentFacilityProvider[j] = was_rcpt.TreatmentFacilityProvider[j].TreatmentFacilityProviderName; rwr.TreatmentFacilityProvider[j] = was_rcpt.TreatmentFacilityProvider[j].TreatmentFacilityProviderName;
} }
if(was_rcpt.WasteDeliveryDateFrom.HasValue) if (was_rcpt.WasteDeliveryDateFrom.HasValue)
rwr.WasteDeliveryDateFrom = was_rcpt.WasteDeliveryDateFrom.Value; rwr.WasteDeliveryDateFrom = was_rcpt.WasteDeliveryDateFrom.Value;
if(was_rcpt.WasteDeliveryDateTo.HasValue) if (was_rcpt.WasteDeliveryDateTo.HasValue)
rwr.WasteDeliveryDateTo = was_rcpt.WasteDeliveryDateTo.Value; rwr.WasteDeliveryDateTo = was_rcpt.WasteDeliveryDateTo.Value;
rwr.WasteReceived = new RootWAS_RCPTWasteDeliveryReceiptWasteReceived[was_rcpt.WasteReceived.Count]; rwr.WasteReceived = new RootWAS_RCPTWasteDeliveryReceiptWasteReceived[was_rcpt.WasteReceived.Count];
for (int j = 0; j < was_rcpt.WasteReceived.Count; j++) for (int j = 0; j < was_rcpt.WasteReceived.Count; j++)
@ -1636,6 +1658,7 @@ namespace bsmd.dbh
_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;
} }
}
// serialize output structure to file // serialize output structure to file