V 3.4.1 Kleines Update für NSW 4.0

This commit is contained in:
Daniel Schick 2017-03-16 18:03:04 +00:00
parent de8b7de10d
commit 6ad237a7f5
7 changed files with 308 additions and 304 deletions

Binary file not shown.

Binary file not shown.

View File

@ -208,26 +208,29 @@ namespace bsmd.ExcelReadService
internal string ReadNationality(string lookup)
{
string val = this.ReadText(lookup);
if(val.IsNullOrEmpty()) {
if (val.IsNullOrEmpty())
{
this.Conf.ConfirmText(lookup, null, ReadState.FAIL);
}
if(val.Length > 2)
else
{
string isoCode = LocodeDB.CountryCodeFromName(val);
if(isoCode != null)
if (val.Length > 2)
{
this.Conf.ConfirmText(lookup, val, ReadState.OK);
val = isoCode;
} else
{
this.Conf.ConfirmText(lookup, val, ReadState.WARN);
string isoCode = LocodeDB.CountryCodeFromName(val);
if (isoCode != null)
{
this.Conf.ConfirmText(lookup, val, ReadState.OK);
val = isoCode;
}
else
{
this.Conf.ConfirmText(lookup, val, ReadState.WARN);
}
}
if (val.Length == 2)
this.Conf.ConfirmText(lookup, val, ReadState.OK);
}
if (val.Length == 2)
this.Conf.ConfirmText(lookup, val, ReadState.OK);
return val;
}

View File

@ -158,10 +158,10 @@ namespace bsmd.ExcelReadService
ATA ata = ataMessage.Elements[0] as ATA;
Util.ScanMessage(ata, reader);
if(!ata.ATAPortOfCall.HasValue)
{
reader.ReadDateTime("ATA.ATADatePortOfCall", "ATA.ATATimePortOfCall");
}
if(!ata.ATAPortOfCall.HasValue)
{
reader.ReadDateTime("ATA.ATADatePortOfCall", "ATA.ATATimePortOfCall");
}
if (!ata.ATAPortOfCall.HasValue && ataMessage.IsNew)
messages.Remove(ataMessage);
@ -183,12 +183,12 @@ namespace bsmd.ExcelReadService
ATD atd = atdMessage.Elements[0] as ATD;
Util.ScanMessage(atd, reader);
if (!atd.ATDPortOfCall.HasValue)
{
reader.ReadDateTime("ATD.ATDDatePortOfCall", "ATD.ATDTimePortOfCall");
}
if (!atd.ATDPortOfCall.HasValue)
{
reader.ReadDateTime("ATD.ATDDatePortOfCall", "ATD.ATDTimePortOfCall");
}
if (!atd.ATDPortOfCall.HasValue && atdMessage.IsNew)
if (!atd.ATDPortOfCall.HasValue && atdMessage.IsNew)
messages.Remove(atdMessage);
}
@ -210,9 +210,9 @@ namespace bsmd.ExcelReadService
if (!tiefa.DraughtUponArrival_DMT.HasValue && tiefaMessage.IsNew)
messages.Remove(tiefaMessage);
reader.Conf.ConfirmNumber("TIEFA.DraughtUponArrival_DMT_DK", tiefa.DraughtUponArrival_DMT, tiefa.DraughtUponArrival_DMT.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
reader.Conf.ConfirmNumber("TIEFA.DraughtUponArrival_DMT_DK", tiefa.DraughtUponArrival_DMT, tiefa.DraughtUponArrival_DMT.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
}
}
#endregion
@ -232,9 +232,9 @@ namespace bsmd.ExcelReadService
if (!tiefd.DraughtUponDeparture_DMT.HasValue && tiefdMessage.IsNew)
messages.Remove(tiefdMessage);
reader.Conf.ConfirmNumber("TIEFD.DraughtUponDeparture_DMT_DK", tiefd.DraughtUponDeparture_DMT, tiefd.DraughtUponDeparture_DMT.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
reader.Conf.ConfirmNumber("TIEFD.DraughtUponDeparture_DMT_DK", tiefd.DraughtUponDeparture_DMT, tiefd.DraughtUponDeparture_DMT.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
}
}
#endregion
@ -287,9 +287,9 @@ namespace bsmd.ExcelReadService
string bpolName = string.Format("BPOL.PortOfItineraryName_{0}", i);
string bpolLocode = string.Format("BPOL.PortOfItineraryLoCode_{0}", i);
string bpolETADate = string.Format("BPOL.PortOfItineraryETADate_{0}", i);
string bpolETATime = string.Format("BPOL.PortOfItineraryETATime_{0}", i);
string bpolETATime = string.Format("BPOL.PortOfItineraryETATime_{0}", i);
string bpolNameValue = reader.ReadText(bpolName)?.Trim();
string bpolNameValue = reader.ReadText(bpolName)?.Trim();
if (!bpolNameValue.IsNullOrEmpty())
{
PortOfItinerary poi = bpol.GetSublistElementWithIdentifier(i.ToString()) as PortOfItinerary;
@ -307,7 +307,7 @@ namespace bsmd.ExcelReadService
{
reader.Conf.ConfirmText(bpolLocode, poi.PortOfItineraryLocode, ExcelReader.ReadState.WARN);
}
poi.PortOfItineraryETA = reader.ReadDateTime(bpolETADate, bpolETATime);
poi.PortOfItineraryETA = reader.ReadDateTime(bpolETADate, bpolETATime);
}
}
}
@ -331,12 +331,12 @@ namespace bsmd.ExcelReadService
if (((poba.TotalPersonsOnBoardUponArrival ?? 0) == 0) && poba.IsNew)
messages.Remove(pobaMessage);
reader.Conf.ConfirmNumber("POBA.TotalCrewMembersOnBoardUponArrival_DK", poba.TotalCrewMembersOnBoardUponArrival,
(poba.TotalCrewMembersOnBoardUponArrival.HasValue && poba.TotalCrewMembersOnBoardUponArrival > 0) ?
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
reader.Conf.ConfirmNumber("POBA.TotalCrewMembersOnBoardUponArrival_DK", poba.TotalCrewMembersOnBoardUponArrival,
(poba.TotalCrewMembersOnBoardUponArrival.HasValue && poba.TotalCrewMembersOnBoardUponArrival > 0) ?
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
reader.Conf.ConfirmNumber("POBA.TotalPassengersOnBoardUponArrival_DK", poba.TotalPassengersOnBoardUponArrival,
ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber("POBA.TotalPassengersOnBoardUponArrival_DK", poba.TotalPassengersOnBoardUponArrival,
ExcelReader.ReadState.OK);
}
#endregion
@ -358,14 +358,14 @@ namespace bsmd.ExcelReadService
if (((pobd.TotalPersonsOnBoardUponDeparture ?? 0) == 0) && pobd.IsNew)
messages.Remove(pobdMessage);
reader.Conf.ConfirmNumber("POBD.TotalCrewMembersOnBoardUponDeparture_DK", pobd.TotalCrewMembersOnBoardUponDeparture,
(pobd.TotalCrewMembersOnBoardUponDeparture.HasValue && pobd.TotalCrewMembersOnBoardUponDeparture > 0) ?
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
reader.Conf.ConfirmNumber("POBD.TotalCrewMembersOnBoardUponDeparture_DK", pobd.TotalCrewMembersOnBoardUponDeparture,
(pobd.TotalCrewMembersOnBoardUponDeparture.HasValue && pobd.TotalCrewMembersOnBoardUponDeparture > 0) ?
ExcelReader.ReadState.OK : ExcelReader.ReadState.WARN);
reader.Conf.ConfirmNumber("POBD.TotalPassengersOnBoardUponDeparture_DK", pobd.TotalPassengersOnBoardUponDeparture,
ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber("POBD.TotalPassengersOnBoardUponDeparture_DK", pobd.TotalPassengersOnBoardUponDeparture,
ExcelReader.ReadState.OK);
}
}
#endregion
@ -425,10 +425,10 @@ namespace bsmd.ExcelReadService
string imdg_stowagePosition = string.Format("HAZA.IMDG.StowagePosition_{0}", i);
string imdg_portOfLoading = string.Format("HAZA.IMDG.PortOfLoading_{0}", i);
string imdg_portOfDischarge = string.Format("HAZA.IMDG.PortOfDischarge_{0}", i);
string imdg_containerNumber = string.Format("HAZA.IMDG.ContainerNumber_{0}", i);
string imdg_containerNumber = string.Format("HAZA.IMDG.ContainerNumber_{0}", i);
string unNumber = reader.ReadText(imdg_unno);
string unNumber = reader.ReadText(imdg_unno);
if(unNumber.IsNullOrEmpty()) // if unnumber is not set ignore this row
{
reader.Conf.ConfirmText(imdg_unno, null, ExcelReader.ReadState.WARN);
@ -469,9 +469,9 @@ namespace bsmd.ExcelReadService
reader.Conf.ConfirmText(imdg_portOfLoading, imdgPosition.PortOfLoading, imdgPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
reader.Conf.ConfirmText(imdg_portOfDischarge, imdgPosition.PortOfDischarge, imdgPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
}
imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
}
#endregion
@ -705,7 +705,7 @@ namespace bsmd.ExcelReadService
string imdg_stowagePosition = string.Format("HAZD.IMDG.StowagePosition_{0}", i);
string imdg_portOfLoading = string.Format("HAZD.IMDG.PortOfLoading_{0}", i);
string imdg_portOfDischarge = string.Format("HAZD.IMDG.PortOfDischarge_{0}", i);
string imdg_containerNumber = string.Format("HAZD.IMDG.ContainerNumber_{0}", i);
string imdg_containerNumber = string.Format("HAZD.IMDG.ContainerNumber_{0}", i);
string unNumber = reader.ReadText(imdg_unno);
if (unNumber.IsNullOrEmpty()) // if unnumber is not set ignore this row
@ -748,8 +748,8 @@ namespace bsmd.ExcelReadService
reader.Conf.ConfirmText(imdg_portOfLoading, imdgPosition.PortOfLoading, imdgPosition.PortOfLoading.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
imdgPosition.PortOfDischarge = reader.ReadText(imdg_portOfDischarge);
reader.Conf.ConfirmText(imdg_portOfDischarge, imdgPosition.PortOfDischarge, imdgPosition.PortOfDischarge.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
imdgPosition.ContainerNumber = reader.ReadText(imdg_containerNumber);
reader.Conf.ConfirmText(imdg_containerNumber, imdgPosition.ContainerNumber, imdgPosition.ContainerNumber.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
}
#endregion
@ -1020,45 +1020,45 @@ namespace bsmd.ExcelReadService
}
NOA_NOD noa_nod = noa_nodMessage.Elements[0] as NOA_NOD;
if (messageCore.IsTransit)
{
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal;
}
else
{
if (messageCore.IsTransit)
{
noa_nod.ETAToKielCanal = messageCore.ETAKielCanal;
}
else
{
noa_nod.ETAToPortOfCall = messageCore.ETA;
// Zeit muss zurückkonvertiert werden, da toUniversalTime() kodiert
if(noa_nod.ETAToPortOfCall.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK);
noa_nod.ETAToPortOfCall = messageCore.ETA;
// Zeit muss zurückkonvertiert werden, da toUniversalTime() kodiert
if(noa_nod.ETAToPortOfCall.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETAToPortOfCall", noa_nod.ETAToPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK);
for (int i = 1; i <= noa_nod.NumberOfExcelRows; i++)
{
string callPurposeDescriptionKey = string.Format("NOA_NOD.CallPuposeDescription_{0}", i);
string callPurposeCodeKey = string.Format("NOA_NOD.CallPurposeCode_{0}", i);
string callPurposeDescription = reader.ReadText(callPurposeDescriptionKey);
string callPurposeCode = reader.ReadText(callPurposeCodeKey);
for (int i = 1; i <= noa_nod.NumberOfExcelRows; i++)
{
string callPurposeDescriptionKey = string.Format("NOA_NOD.CallPuposeDescription_{0}", i);
string callPurposeCodeKey = string.Format("NOA_NOD.CallPurposeCode_{0}", i);
string callPurposeDescription = reader.ReadText(callPurposeDescriptionKey);
string callPurposeCode = reader.ReadText(callPurposeCodeKey);
if (!callPurposeCode.IsNullOrEmpty())
{
if (!callPurposeCode.IsNullOrEmpty())
{
CallPurpose callPurpose = noa_nod.GetSublistElementWithIdentifier(i.ToString()) as CallPurpose;
if (callPurpose == null)
{
callPurpose = new CallPurpose();
callPurpose.NOA_NOD = noa_nod;
callPurpose.Identifier = i.ToString();
noa_nod.CallPurposes.Add(callPurpose);
}
CallPurpose callPurpose = noa_nod.GetSublistElementWithIdentifier(i.ToString()) as CallPurpose;
if (callPurpose == null)
{
callPurpose = new CallPurpose();
callPurpose.NOA_NOD = noa_nod;
callPurpose.Identifier = i.ToString();
noa_nod.CallPurposes.Add(callPurpose);
}
callPurpose.CallPurposeCode = ((int?)reader.ReadNumber(callPurposeCodeKey)) ?? 0;
callPurpose.CallPurposeDescription = callPurposeDescription;
reader.Conf.ConfirmText(callPurposeDescriptionKey, callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
if (i == 1)
reader.Conf.ConfirmText("NOA_NOD.CallPuposeDescription_1_DK", callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
}
}
}
callPurpose.CallPurposeCode = ((int?)reader.ReadNumber(callPurposeCodeKey)) ?? 0;
callPurpose.CallPurposeDescription = callPurposeDescription;
reader.Conf.ConfirmText(callPurposeDescriptionKey, callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
if (i == 1)
reader.Conf.ConfirmText("NOA_NOD.CallPuposeDescription_1_DK", callPurposeDescription, callPurposeDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
}
}
}
string lastPort = reader.ReadText("NOA_NOD.LastPort");
if (!lastPort.IsNullOrEmpty()) lastPort = lastPort.Trim();
@ -1107,21 +1107,21 @@ namespace bsmd.ExcelReadService
reader.Conf.ConfirmText("NOA_NOD.NextPort", nextPort, noa_nod.NextPort.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
if(messageCore.IsTransit)
{
noa_nod.ETDFromKielCanal = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
if(noa_nod.ETDFromKielCanal.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromKielCanal.Value.ToLocalTime(), ExcelReader.ReadState.OK);
else
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
} else
{
noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
if(noa_nod.ETDFromPortOfCall.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK);
else
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
}
if(messageCore.IsTransit)
{
noa_nod.ETDFromKielCanal = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
if(noa_nod.ETDFromKielCanal.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromKielCanal.Value.ToLocalTime(), ExcelReader.ReadState.OK);
else
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
} else
{
noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
if(noa_nod.ETDFromPortOfCall.HasValue)
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", noa_nod.ETDFromPortOfCall.Value.ToLocalTime(), ExcelReader.ReadState.OK);
else
reader.Conf.ConfirmDate("NOA_NOD.ETDFromPortOfCall", null, ExcelReader.ReadState.FAIL);
}
noa_nod.ETDFromLastPort = reader.ReadDateTime("NOA_NOD.ETDDateFromLastPort", "NOA_NOD.ETDTimeFromLastPort");
noa_nod.ETAToNextPort = reader.ReadDateTime("NOA_NOD.ETADateToNextPort", "NOA_NOD.ETATimeToNextPort");
@ -1214,44 +1214,44 @@ namespace bsmd.ExcelReadService
waste.WasteType = (int?) reader.ReadNumber(wasteCode);
if (reader.Mode == ExcelReader.CountryMode.DE)
{
waste.WasteType = i; // remove for V4
// change for V4
reader.Conf.ConfirmText(wastetype, waste.WasteTypeDisplay, ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber(wasteCode, waste.WasteType, ExcelReader.ReadState.OK);
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
{
reader.Conf.ConfirmText(wastetype, WAS.DKWasteTypes[i - 1], ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber(wasteCode, WAS.DKWasteCodes[i - 1], ExcelReader.ReadState.OK);
}
if (reader.Mode == ExcelReader.CountryMode.DE)
{
// waste.WasteType = i; // remove for V4
// change for V4
reader.Conf.ConfirmText(wastetype, waste.WasteTypeDisplay, ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber(wasteCode, waste.WasteType, ExcelReader.ReadState.OK);
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
{
reader.Conf.ConfirmText(wastetype, WAS.DKWasteTypes[i - 1], ExcelReader.ReadState.OK);
reader.Conf.ConfirmNumber(wasteCode, WAS.DKWasteCodes[i - 1], ExcelReader.ReadState.OK);
}
// Waste description Spezialfälle für DK
// Waste description Spezialfälle für DK
waste.WasteDescription = reader.ReadText(wasteDescription);
if (waste.WasteDescription.IsNullOrEmpty())
{
if (reader.Mode == ExcelReader.CountryMode.DE)
{
waste.WasteDescription = "-";
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
{
waste.WasteDescription = "-";
if (i == 6) waste.WasteDescription = "Domestic waste";
if (i == 9) waste.WasteDescription = "Operational waste";
}
}
else
{
if (reader.Mode == ExcelReader.CountryMode.DK)
{
if (i == 6)
waste.WasteDescription = string.Format("Domestic waste - {0}", waste.WasteDescription);
if (i == 9)
waste.WasteDescription = string.Format("Operational waste - {0}", waste.WasteDescription);
}
}
if (waste.WasteDescription.IsNullOrEmpty())
{
if (reader.Mode == ExcelReader.CountryMode.DE)
{
waste.WasteDescription = "-";
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
{
waste.WasteDescription = "-";
if (i == 6) waste.WasteDescription = "Domestic waste";
if (i == 9) waste.WasteDescription = "Operational waste";
}
}
else
{
if (reader.Mode == ExcelReader.CountryMode.DK)
{
if (i == 6)
waste.WasteDescription = string.Format("Domestic waste - {0}", waste.WasteDescription);
if (i == 9)
waste.WasteDescription = string.Format("Operational waste - {0}", waste.WasteDescription);
}
}
reader.Conf.ConfirmText(wasteDescription, waste.WasteDescription, waste.WasteDescription.IsNullOrEmpty() ? ExcelReader.ReadState.WARN : ExcelReader.ReadState.OK);
waste.WasteDisposalAmount_MTQ = reader.ReadNumberDefaultZero(wasteAmount);
@ -1265,40 +1265,41 @@ namespace bsmd.ExcelReadService
waste.WasteDisposedAtLastPort_MTQ = reader.ReadNumberDefaultZero(wasteDis);
if ((reader.Mode == ExcelReader.CountryMode.DE) &&
((i == 6) || (i == 8) || (i == 9)))
{
waste.WasteDescription = "-";
waste.WasteDisposalAmount_MTQ = 0;
waste.WasteCapacity_MTQ = 0;
waste.WasteAmountRetained_MTQ = 0;
waste.WasteDisposalPort = "ZZUKN";
waste.WasteAmountGeneratedTillNextPort_MTQ = 0;
}
if ((reader.Mode == ExcelReader.CountryMode.DE) &&
((i == 6) || (i == 8) || (i == 9)))
{
waste.WasteDescription = "-";
waste.WasteDisposalAmount_MTQ = 0;
waste.WasteCapacity_MTQ = 0;
waste.WasteAmountRetained_MTQ = 0;
waste.WasteDisposalPort = "ZZUKN";
waste.WasteAmountGeneratedTillNextPort_MTQ = 0;
}
}
try
{
// Übergangsphase: Für "DE" werden nur 9 Positionen verwendet
// EMail Christin mit angehängtem Excel Sheet vom 30.1.2017
if (reader.Mode == ExcelReader.CountryMode.DE)
{
Waste nrSeven = was.GetSublistElementWithIdentifier("7") as Waste;
Waste nrEleven = was.GetSublistElementWithIdentifier("11") as Waste;
nrSeven.WasteDescription = nrEleven.WasteDescription;
nrSeven.WasteDisposalAmount_MTQ = nrEleven.WasteDisposalAmount_MTQ;
nrSeven.WasteCapacity_MTQ = nrEleven.WasteCapacity_MTQ;
nrSeven.WasteAmountRetained_MTQ = nrEleven.WasteAmountRetained_MTQ;
nrSeven.WasteDisposalPort = nrEleven.WasteDisposalPort;
nrSeven.WasteAmountGeneratedTillNextPort_MTQ = nrEleven.WasteAmountGeneratedTillNextPort_MTQ;
was.Waste.RemoveRange(9, 6); // 9-15 entfernen
}
}
catch(Exception ex)
{
_log.ErrorFormat("Error Waste Workaround DE: {0}", ex.Message);
}
}
/*
try
{
// Übergangsphase: Für "DE" werden nur 9 Positionen verwendet
// EMail Christin mit angehängtem Excel Sheet vom 30.1.2017
if (reader.Mode == ExcelReader.CountryMode.DE)
{
Waste nrSeven = was.GetSublistElementWithIdentifier("7") as Waste;
Waste nrEleven = was.GetSublistElementWithIdentifier("11") as Waste;
nrSeven.WasteDescription = nrEleven.WasteDescription;
nrSeven.WasteDisposalAmount_MTQ = nrEleven.WasteDisposalAmount_MTQ;
nrSeven.WasteCapacity_MTQ = nrEleven.WasteCapacity_MTQ;
nrSeven.WasteAmountRetained_MTQ = nrEleven.WasteAmountRetained_MTQ;
nrSeven.WasteDisposalPort = nrEleven.WasteDisposalPort;
nrSeven.WasteAmountGeneratedTillNextPort_MTQ = nrEleven.WasteAmountGeneratedTillNextPort_MTQ;
// was.Waste.RemoveRange(9, 6); // 9-15 entfernen
}
}
catch(Exception ex)
{
_log.ErrorFormat("Error Waste Workaround DE: {0}", ex.Message);
}
*/
}
#endregion
@ -1327,12 +1328,12 @@ namespace bsmd.ExcelReadService
try
{
#region PoC last 30 days
#region PoC last 30 days
// lt. Mail von Christin am 11.10.2016
// "SEC" Mode, die Werte aus last10PortFacilitesCalled (SEC) werden übernommen
// das funktioniert, da SEC vor MDH gelesen wird
if (!kuerzelErsteZelle.IsNullOrEmpty() && kuerzelErsteZelle.Equals("sec", StringComparison.OrdinalIgnoreCase))
// lt. Mail von Christin am 11.10.2016
// "SEC" Mode, die Werte aus last10PortFacilitesCalled (SEC) werden übernommen
// das funktioniert, da SEC vor MDH gelesen wird
if (!kuerzelErsteZelle.IsNullOrEmpty() && kuerzelErsteZelle.Equals("sec", StringComparison.OrdinalIgnoreCase))
{
Message secMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
if (secMessage.Elements.Count == 0) return;
@ -1423,99 +1424,99 @@ namespace bsmd.ExcelReadService
}
}
#endregion
#endregion
#region SanitaryMeasures
#region SanitaryMeasures
if (mdh.SanitaryMeasuresApplied ?? false)
{
for (int i = 1; i <= 3; i++)
{
string smType = string.Format("MDH.SanitaryMeasuresType_{0}", i);
string smLocation = string.Format("MDH.SanitaryMeasuresLocation_{0}", i);
string smDate = string.Format("MDH.SanitaryMeasuresDate_{0}", i);
if (mdh.SanitaryMeasuresApplied ?? false)
{
for (int i = 1; i <= 3; i++)
{
string smType = string.Format("MDH.SanitaryMeasuresType_{0}", i);
string smLocation = string.Format("MDH.SanitaryMeasuresLocation_{0}", i);
string smDate = string.Format("MDH.SanitaryMeasuresDate_{0}", i);
SanitaryMeasuresDetail smd = mdh.GetSanitaryMeasuresDetailWithIdentifier(i.ToString());
if(smd == null)
{
smd = new SanitaryMeasuresDetail();
smd.Identifier = i.ToString();
mdh.SanitaryMeasuresDetails.Add(smd);
smd.MDH = mdh;
}
SanitaryMeasuresDetail smd = mdh.GetSanitaryMeasuresDetailWithIdentifier(i.ToString());
if(smd == null)
{
smd = new SanitaryMeasuresDetail();
smd.Identifier = i.ToString();
mdh.SanitaryMeasuresDetails.Add(smd);
smd.MDH = mdh;
}
smd.SanitaryMeasuresType = reader.ReadText(smType);
reader.Conf.ConfirmText(smType, smd.SanitaryMeasuresType, smd.SanitaryMeasuresType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
smd.SanitaryMeasuresLocation = reader.ReadText(smLocation);
reader.Conf.ConfirmText(smLocation, smd.SanitaryMeasuresLocation, smd.SanitaryMeasuresLocation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
smd.SanitaryMeasuresDate = reader.ReadDate(smDate);
// dont save completely empty structs
if (!smd.SanitaryMeasuresDate.HasValue && smd.SanitaryMeasuresLocation.IsNullOrEmpty() && smd.SanitaryMeasuresType.IsNullOrEmpty())
mdh.SanitaryMeasuresDetails.Remove(smd);
}
}
smd.SanitaryMeasuresType = reader.ReadText(smType);
reader.Conf.ConfirmText(smType, smd.SanitaryMeasuresType, smd.SanitaryMeasuresType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
smd.SanitaryMeasuresLocation = reader.ReadText(smLocation);
reader.Conf.ConfirmText(smLocation, smd.SanitaryMeasuresLocation, smd.SanitaryMeasuresLocation.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
smd.SanitaryMeasuresDate = reader.ReadDate(smDate);
// dont save completely empty structs
if (!smd.SanitaryMeasuresDate.HasValue && smd.SanitaryMeasuresLocation.IsNullOrEmpty() && smd.SanitaryMeasuresType.IsNullOrEmpty())
mdh.SanitaryMeasuresDetails.Remove(smd);
}
}
#endregion
#endregion
#region InfectedArea
#region InfectedArea
if (mdh.InfectedAreaVisited ?? false)
{
for (int i = 1; i <= 3; i++)
{
string iaPort = string.Format("MDH.InfectedAreaPort_{0}", i);
string iaDate = string.Format("MDH.InfectedAreaDate_{0}", i);
InfectedArea ia = mdh.GetInfectedAreaWithIdentifier(i.ToString());
if (ia == null)
{
ia = new InfectedArea();
ia.Identifier = i.ToString();
mdh.InfectedAreas.Add(ia);
ia.MDH = mdh;
}
ia.InfectedAreaPort = reader.ReadText(iaPort);
reader.Conf.ConfirmText(iaPort, ia.InfectedAreaPort, ia.InfectedAreaPort.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
ia.InfectedAreaDate = reader.ReadDate(iaDate);
// dont save completely empty structs
if (!ia.InfectedAreaDate.HasValue && ia.InfectedAreaPort.IsNullOrEmpty())
mdh.InfectedAreas.Remove(ia);
}
}
if (mdh.InfectedAreaVisited ?? false)
{
for (int i = 1; i <= 3; i++)
{
string iaPort = string.Format("MDH.InfectedAreaPort_{0}", i);
string iaDate = string.Format("MDH.InfectedAreaDate_{0}", i);
InfectedArea ia = mdh.GetInfectedAreaWithIdentifier(i.ToString());
if (ia == null)
{
ia = new InfectedArea();
ia.Identifier = i.ToString();
mdh.InfectedAreas.Add(ia);
ia.MDH = mdh;
}
ia.InfectedAreaPort = reader.ReadText(iaPort);
reader.Conf.ConfirmText(iaPort, ia.InfectedAreaPort, ia.InfectedAreaPort.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
ia.InfectedAreaDate = reader.ReadDate(iaDate);
// dont save completely empty structs
if (!ia.InfectedAreaDate.HasValue && ia.InfectedAreaPort.IsNullOrEmpty())
mdh.InfectedAreas.Remove(ia);
}
}
#endregion
#endregion
#region StowawaysJoiningLocation
#region StowawaysJoiningLocation
if(mdh.StowawaysDetected ?? false)
{
for (int i = 1; i <= 3; i++)
{
string sjlLookup = string.Format("MDH.StowawaysJoiningLocation_{0}", i);
StowawaysJoiningLocation sjl = mdh.GetStowawaysJoiningLocationWithIdentifier(i.ToString());
if (sjl == null)
{
sjl = new StowawaysJoiningLocation();
sjl.Identifier = i.ToString();
sjl.MDH = mdh;
mdh.StowawaysJoiningLocations.Add(sjl);
}
if(mdh.StowawaysDetected ?? false)
{
for (int i = 1; i <= 3; i++)
{
string sjlLookup = string.Format("MDH.StowawaysJoiningLocation_{0}", i);
StowawaysJoiningLocation sjl = mdh.GetStowawaysJoiningLocationWithIdentifier(i.ToString());
if (sjl == null)
{
sjl = new StowawaysJoiningLocation();
sjl.Identifier = i.ToString();
sjl.MDH = mdh;
mdh.StowawaysJoiningLocations.Add(sjl);
}
sjl.StowawayJoiningLocation = reader.ReadText(sjlLookup);
if (sjl.StowawayJoiningLocation.IsNullOrEmpty())
{
reader.Conf.ConfirmText(sjlLookup, null, ExcelReader.ReadState.WARN);
mdh.StowawaysJoiningLocations.Remove(sjl);
}
else
{
reader.Conf.ConfirmText(sjlLookup, sjl.StowawayJoiningLocation, ExcelReader.ReadState.OK);
}
}
}
sjl.StowawayJoiningLocation = reader.ReadText(sjlLookup);
if (sjl.StowawayJoiningLocation.IsNullOrEmpty())
{
reader.Conf.ConfirmText(sjlLookup, null, ExcelReader.ReadState.WARN);
mdh.StowawaysJoiningLocations.Remove(sjl);
}
else
{
reader.Conf.ConfirmText(sjlLookup, sjl.StowawayJoiningLocation, ExcelReader.ReadState.OK);
}
}
}
#endregion
#endregion
}
}
catch(Exception ex)
{
_log.ErrorFormat("Crash during reading of MDH message: {0}", ex);
@ -1590,12 +1591,12 @@ namespace bsmd.ExcelReadService
reader.Conf.ConfirmText("SEC.GeneralDescriptionOfCargo", genDescCargo, sec.GeneralDescriptionOfCargo.HasValue ? ExcelReader.ReadState.OK : ExcelReader.ReadState.FAIL);
bool? secKielArrival = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Arrival");
bool? secKielDeparture = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Departure");
bool? secKielArrival = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Arrival");
bool? secKielDeparture = reader.ReadBoolean("SEC.KielCanalPassagePlanned_Departure");
sec.KielCanalPassagePlanned = (secKielArrival ?? false) || (secKielDeparture ?? false);
sec.KielCanalPassagePlannedIncomming = reader.ReadDateTime("SEC.ETADateKielCanalPassagePlannedIncomming", "SEC.ETATimeKielCanalPassagePlannedIncomming");
sec.KielCanalPassagePlannedOutgoing = reader.ReadDateTime("SEC.ETADateKielCanalPassagePlannedOutgoing", "SEC.ETATimeKielCanalPassagePlannedOutgoing");
sec.KielCanalPassagePlanned = (secKielArrival ?? false) || (secKielDeparture ?? false);
sec.KielCanalPassagePlannedIncomming = reader.ReadDateTime("SEC.ETADateKielCanalPassagePlannedIncomming", "SEC.ETATimeKielCanalPassagePlannedIncomming");
sec.KielCanalPassagePlannedOutgoing = reader.ReadDateTime("SEC.ETADateKielCanalPassagePlannedOutgoing", "SEC.ETATimeKielCanalPassagePlannedOutgoing");
// Last10PortFacilitesCalled
@ -1664,7 +1665,7 @@ namespace bsmd.ExcelReadService
string s2sLongitude = string.Format("SEC.ShipToShipActivityLocationCoordinatesLongitude_{0}", i);
string s2sFromDate = string.Format("SEC.ShipToShipActivityDateFrom_{0}", i);
string s2sToDate = string.Format("SEC.ShipToShipActivityDateTo_{0}", i);
string s2sSec = string.Format("SEC.ShipToShipActivitySecurityMattersToReport_{0}", i);
string s2sSec = string.Format("SEC.ShipToShipActivitySecurityMattersToReport_{0}", i);
string s2sActivityString = string.Format("SEC.ShipToShipActivityType_{0}", i);
@ -1697,8 +1698,8 @@ namespace bsmd.ExcelReadService
s2sActivity.ShipToShipActivityDateTo = reader.ReadDate(s2sToDate);
s2sActivity.ShipToShipActivityType = reader.ReadText(s2sActivityString);
reader.Conf.ConfirmText(s2sActivityString, s2sActivity.ShipToShipActivityType, ExcelReader.ReadState.OK);
s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadText(s2sSec);
reader.Conf.ConfirmText(s2sSec, s2sActivity.ShipToShipActivitySecurityMattersToReport, s2sActivity.ShipToShipActivitySecurityMattersToReport.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
s2sActivity.ShipToShipActivitySecurityMattersToReport = reader.ReadText(s2sSec);
reader.Conf.ConfirmText(s2sSec, s2sActivity.ShipToShipActivitySecurityMattersToReport, s2sActivity.ShipToShipActivitySecurityMattersToReport.IsNullOrEmpty() ? ExcelReader.ReadState.NONE : ExcelReader.ReadState.OK);
}
}
@ -1850,8 +1851,8 @@ namespace bsmd.ExcelReadService
// diese Nachricht bleibt auch wenn sie leer ist
pre72h.ConditionCargoBallastTanks = reader.ReadConditionTanks("PRE72H.ConditionCargoBallastTanks");
pre72h.TankerHullConfiguration = reader.ReadHullConfiguration("PRE72H.TankerHullConfiguration");
pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks");
reader.Conf.ConfirmText("PRE72H.PlannedWorks", pre72h.PlannedWorks, pre72h.PlannedWorks.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
pre72h.PlannedWorks = reader.ReadText("PRE72H.PlannedWorks");
reader.Conf.ConfirmText("PRE72H.PlannedWorks", pre72h.PlannedWorks, pre72h.PlannedWorks.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
}
#endregion
@ -1937,7 +1938,7 @@ namespace bsmd.ExcelReadService
ladgMessage.Elements.Add(ladg);
}
ladg.CargoHandlingType = reader.ReadCargoHandlingType(lnCHT);
ladg.CargoHandlingType = reader.ReadCargoHandlingType(lnCHT);
ladg.CargoCodeNST = reader.ReadText(lnType);
// Cargo Type Freitext in DK
@ -2022,7 +2023,7 @@ namespace bsmd.ExcelReadService
crew.CrewMemberDuty = reader.ReadText(crewDuty);
reader.Conf.ConfirmText(crewDuty, crew.CrewMemberDuty, ExcelReader.ReadState.OK);
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
crew.CrewMemberNationality = reader.ReadNationality(crewNationality);
crew.CrewMemberPlaceOfBirth = reader.ReadText(crewPlaceOfBirth);
reader.Conf.ConfirmText(crewPlaceOfBirth, crew.CrewMemberPlaceOfBirth, ExcelReader.ReadState.OK);
@ -2038,9 +2039,9 @@ namespace bsmd.ExcelReadService
}
}
// CREW DEPARTURE
crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREWD);
for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
// CREW DEPARTURE
crewMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.CREWD);
for (int i = 0; i < crewMessage.NumberOfExcelRows; i++)
{
string crewLastName = string.Format("CREWD.CrewMemberLastName_{0}", i + 1);
string crewFirstName = string.Format("CREWD.CrewMemberFirstName_{0}", i + 1);
@ -2148,9 +2149,9 @@ namespace bsmd.ExcelReadService
}
}
// PASSENGER DEPARTURE
pasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PASD);
for (int i = 0; i < pasMessage.NumberOfExcelRows; i++)
// PASSENGER DEPARTURE
pasMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.PASD);
for (int i = 0; i < pasMessage.NumberOfExcelRows; i++)
{
string pasLastName = string.Format("PASD.PassengerLastName_{0}", i + 1);
string pasFirstName = string.Format("PASD.PassengerFirstName_{0}", i + 1);
@ -2311,14 +2312,14 @@ namespace bsmd.ExcelReadService
}
#endregion
#endregion
#region LookupMessageCore
#region LookupMessageCore
/// <summary>
/// Check with cell values if this message core is already in our DB
/// </summary>
private static MessageCore LookupMessageCore(ExcelReader reader, out string message)
/// <summary>
/// Check with cell values if this message core is already in our DB
/// </summary>
private static MessageCore LookupMessageCore(ExcelReader reader, out string message)
{
// lookup using field values
MessageCore result = null;
@ -2355,13 +2356,13 @@ namespace bsmd.ExcelReadService
// copy poc/imo/eta to return sheet
poc = reader.ReadText("Visit.PortOfCall");
reader.Conf.ConfirmText("Visit.PortOfCall", poc, ExcelReader.ReadState.OK);
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.OK);
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.OK);
imo = reader.ReadText("Visit.IMONumber");
reader.Conf.ConfirmText("Visit.IMONumber", imo, ExcelReader.ReadState.OK);
eta = reader.ReadDateTime("NOA_NOD.ETADateToPortOfCall", "NOA_NOD.ETATimeToPortOfCall");
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
}
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
}
else
{
// lookup poc, imo, eta
@ -2441,20 +2442,20 @@ namespace bsmd.ExcelReadService
{
_log.InfoFormat("Core [{3}] found for IMO {0}, ETA {1}, Poc {2}", imo, eta, poc, result.Id);
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
}
}
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
}
}
reader.Conf.ConfirmText("Visit.PortOfCall", poc, ExcelReader.ReadState.OK);
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.OK);
}
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.OK);
}
else
{
reader.Conf.ConfirmText("Visit.PortOfCall", poc, ExcelReader.ReadState.FAIL);
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.FAIL);
}
reader.Conf.ConfirmText("Visit.PortOfCall_DK", poc, ExcelReader.ReadState.FAIL);
}
}
@ -2491,13 +2492,13 @@ namespace bsmd.ExcelReadService
result.Portname = LocodeDB.PortNameFromLocode(poc);
result.HerbergEmailContactReportingVessel = reader.ReadText("ShipMail");
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
result.HerbergReportType = reader.ReadText("ReferenceNumber");
reader.Conf.ConfirmText("ReferenceNumber", result.HerbergReportType, result.HerbergReportType.IsNullOrEmpty() ? ExcelReader.ReadState.FAIL : ExcelReader.ReadState.OK);
if (result.IsTransit)
result.ETAKielCanal = eta;
else
result.ETA = eta;
if (result.IsTransit)
result.ETAKielCanal = eta;
else
result.ETA = eta;
if (result.IMO.Length > 7)
{
@ -2519,10 +2520,10 @@ namespace bsmd.ExcelReadService
return result;
}
#endregion
#endregion
/*
private static DateTime ConstructDate(string etaDateString, string etaTime)
/*
private static DateTime ConstructDate(string etaDateString, string etaTime)
{
DateTime result = DateTime.Now;
if (DateTime.TryParse(etaDateString, out result))
@ -2533,11 +2534,11 @@ namespace bsmd.ExcelReadService
}
return result;
}
*/
*/
#region GetMessageWithType
#region GetMessageWithType
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
private static Message GetMessageWithType(List<Message> messages, MessageCore core, Message.NotificationClass type)
{
foreach(Message message in messages)
if (message.MessageNotificationClass == type) return message;
@ -2550,7 +2551,7 @@ namespace bsmd.ExcelReadService
return newMessage;
}
#endregion
#endregion
}
}
}

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.4.0")]
[assembly: AssemblyInformationalVersion("3.4.1")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")]

View File

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("3.4.0.*")]
[assembly: AssemblyVersion("3.4.1.*")]