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; return date;
} }
if (result == null) if ((result == null) && (val != null))
{ {
CultureInfo provider = CultureInfo.InvariantCulture; CultureInfo provider = CultureInfo.InvariantCulture;
string dateString = val.ToString(); string dateString = val.ToString();

View File

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

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")] [assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")] [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: AssemblyCopyright("Copyright © 2014-2016 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

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