2.3.17+18

kleine Fehler in MDH etc behoben
This commit is contained in:
Daniel Schick 2016-10-31 07:49:16 +00:00
parent c9175416da
commit ae98ea27fb
5 changed files with 83 additions and 75 deletions

Binary file not shown.

View File

@ -405,7 +405,7 @@ namespace bsmd.ExcelReadService
return date;
}
if (result == null)
if ((result == null) && (val != null))
{
CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = val.ToString();

View File

@ -539,89 +539,97 @@ namespace bsmd.ExcelReadService
string kuerzelErsteZelle = reader.ReadText("MDH.PortOfCallLast30DaysLocode_1");
// 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;
SEC sec = secMessage.Elements[0] as SEC;
int i = 1;
foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
{
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
if (poc30d == null)
{
poc30d = new PortOfCallLast30Days();
poc30d.Identifier = (i + 1).ToString();
poc30d.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30d);
}
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
poc30d.PortOfCallLast30DaysLocode = ltpfc.PortFacilityPortLoCode;
poc30d.PortOfCallLast30DaysDateOfDeparture = ltpfc.PortFacilityDateOfDeparture;
i++;
}
}
else // "normal mode", aus den Zellen lesen
try
{
// POC last 30 days
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
// 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))
{
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
if (poc30d == null)
Message secMessage = Util.GetMessageWithType(messages, messageCore, Message.NotificationClass.SEC);
if (secMessage.Elements.Count == 0) return;
SEC sec = secMessage.Elements[0] as SEC;
int i = 1;
foreach (LastTenPortFacilitiesCalled ltpfc in sec.LastTenPortFacilitesCalled)
{
poc30d = new PortOfCallLast30Days();
poc30d.Identifier = (i + 1).ToString();
poc30d.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30d);
}
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
poc30d.PortOfCallLast30DaysLocode = reader.ReadTextNoWhitespace(locode);
poc30d.PortOfCallLast30DaysCrewMembersJoined = reader.ReadBoolean(crewJoined);
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
{
string crewNameString = reader.ReadText(crewName);
if (!crewName.IsNullOrEmpty())
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
if (poc30d == null)
{
// try different separators
string[] crew = crewNameString.Split(';');
if (crew.Length == 1)
crew = crewNameString.Split(',');
poc30d = new PortOfCallLast30Days();
poc30d.Identifier = (i + 1).ToString();
poc30d.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30d);
}
for (int j = 0; j < crew.Length; j++)
poc30d.PortOfCallLast30DaysCrewMembersJoined = false;
poc30d.PortOfCallLast30DaysLocode = ltpfc.PortFacilityPortLoCode;
poc30d.PortOfCallLast30DaysDateOfDeparture = ltpfc.PortFacilityDateOfDeparture;
i++;
}
}
else // "normal mode", aus den Zellen lesen
{
// POC last 30 days
for (int i = 0; i < mdh.NumberOfExcelRows; i++)
{
string portName = string.Format("MDH.PortOfCallLast30DaysPort_{0}", i + 1);
string portCountry = string.Format("MDH.PortOfCallLast30DaysCountry_{0}", i + 1);
string locode = string.Format("MDH.PortOfCallLast30DaysLocode_{0}", i + 1);
string crewJoined = string.Format("MDH.PortOfCallLast30DaysCrewMembersJoined_{0}", i + 1);
string crewName = string.Format("MDH.PortOfCallLast30DaysCrewJoinedShipName_{0}", i + 1);
string depDate = string.Format("MDH.PortOfCallLast30DaysDateOfDeparture_{0}", i + 1);
PortOfCallLast30Days poc30d = mdh.GetSublistElementWithIdentifier((i + 1).ToString()) as PortOfCallLast30Days;
if (poc30d == null)
{
poc30d = new PortOfCallLast30Days();
poc30d.Identifier = (i + 1).ToString();
poc30d.MDH = mdh;
mdh.PortOfCallLast30Days.Add(poc30d);
}
poc30d.PortOfCallLast30DaysDateOfDeparture = reader.ReadDate(depDate);
poc30d.PortOfCallLast30DaysLocode = reader.ReadTextNoWhitespace(locode);
poc30d.PortOfCallLast30DaysCrewMembersJoined = reader.ReadBoolean(crewJoined);
if (poc30d.PortOfCallLast30DaysCrewMembersJoined ?? false)
{
string crewNameString = reader.ReadText(crewName);
if (!crewNameString.IsNullOrEmpty())
{
PortOfCallLast30DaysCrewJoinedShip poc30dCrew = poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) as PortOfCallLast30DaysCrewJoinedShip;
if (poc30dCrew == null)
{
poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
poc30dCrew.Identifier = (j + 1).ToString();
poc30dCrew.PortOfCallLast30Days = poc30d;
poc30d.CrewJoinedShip.Add(poc30dCrew);
}
// try different separators
string[] crew = crewNameString.Split(';');
if (crew.Length == 1)
crew = crewNameString.Split(',');
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
for (int j = 0; j < crew.Length; j++)
{
PortOfCallLast30DaysCrewJoinedShip poc30dCrew = poc30d.GetSublistElementWithIdentifier((j + 1).ToString()) as PortOfCallLast30DaysCrewJoinedShip;
if (poc30dCrew == null)
{
poc30dCrew = new PortOfCallLast30DaysCrewJoinedShip();
poc30dCrew.Identifier = (j + 1).ToString();
poc30dCrew.PortOfCallLast30Days = poc30d;
poc30d.CrewJoinedShip.Add(poc30dCrew);
}
poc30dCrew.PortOfCallLast30DaysCrewJoinedShipName = crew[j];
}
}
}
}
// Leer/def. Zeilen entfernen
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
mdh.PortOfCallLast30Days.Remove(poc30d);
// Leer/def. Zeilen entfernen
if (!poc30d.PortOfCallLast30DaysDateOfDeparture.HasValue && (poc30d.PortOfCallLast30DaysLocode == null))
mdh.PortOfCallLast30Days.Remove(poc30d);
}
}
}
catch(Exception ex)
{
_log.ErrorFormat("Crash during reading of MDH message: {0}", ex);
}
// wird nicht wieder entfernt falls keine Daten vorliegen
@ -698,7 +706,7 @@ namespace bsmd.ExcelReadService
l10fc.PortFacilityPortLoCode = reader.ReadTextNoWhitespace(portLocode);
l10fc.PortFacilityDateOfArrival = reader.ReadDate(portDateOfArrival);
l10fc.PortFacilityDateOfDeparture = reader.ReadDate(portDateOfDeparture);
l10fc.PortFacilityShipSecurityLevel = (byte) reader.ReadNumber(portShipSecLevel);
l10fc.PortFacilityShipSecurityLevel = (byte?) reader.ReadNumber(portShipSecLevel);
l10fc.PortFacilityGISISCode = reader.ReadTextNoWhitespace(portGISISCode);
if (l10fc.PortFacilityGISISCode.IsNullOrEmpty() || l10fc.PortFacilityGISISCode == "0")
l10fc.PortFacilityGISISCode = "0000";

View File

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

View File

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