Fixed scanning bug in Nationality lookup

This commit is contained in:
Daniel Schick 2022-02-09 07:45:51 +01:00
parent fd34b2b23a
commit 640a0564ab
5 changed files with 18 additions and 20 deletions

View File

@ -37,7 +37,7 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>6.9.17.0</ApplicationVersion> <ApplicationVersion>6.9.18.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -210,21 +210,19 @@ namespace ENI2.Excel
{ {
string val = this.ReadText(lookup).Trim().ToUpper(); string val = this.ReadText(lookup).Trim().ToUpper();
if ((val != null) && (val.Length == 2)) if (val != null)
{ {
string isoCode = LocodeDB.CountryCodeFromName(val); if (val.Length > 2)
if (isoCode == null)
{ {
_log.ErrorFormat("Wrong ISO code {0}", val); // maybe it was entered as name and we can get nationality locode from there..
val = ""; string isoCode = LocodeDB.CountryCodeFromName(val);
if (isoCode == null)
{
_log.ErrorFormat("Wrong ISO code {0}", val);
val = "";
}
} }
} }
else
{
val = "";
_log.ErrorFormat("cannot read nationality {0}", lookup);
}
return val; return val;
} }

View File

@ -981,7 +981,7 @@ namespace ENI2.Excel
} }
} }
string lastPort = reader.ReadText("NOA_NOD.LastPort")?.Trim(); string lastPort = reader.ReadText("NOA_NOD.LastPort")?.Trim().ToUpper();
if (lastPort != null) if (lastPort != null)
{ {
@ -999,7 +999,7 @@ namespace ENI2.Excel
} }
} }
string nextPort = reader.ReadText("NOA_NOD.NextPort")?.Trim(); string nextPort = reader.ReadText("NOA_NOD.NextPort")?.Trim().ToUpper();
if (!nextPort.IsNullOrEmpty() && (nextPort.Length > 5)) if (!nextPort.IsNullOrEmpty() && (nextPort.Length > 5))
nextPort = nextPort.Substring(0, 5); //trunc nextPort = nextPort.Substring(0, 5); //trunc
@ -1643,7 +1643,7 @@ namespace ENI2.Excel
towa.TowageOnArrivalName = towageName; towa.TowageOnArrivalName = towageName;
towa.TowageOnArrivalFlag = reader.ReadText(tFlag); towa.TowageOnArrivalFlag = reader.ReadNationality(tFlag);
towa.TowageOnArrivalPurposeOfCall = reader.ReadText(tPoC); towa.TowageOnArrivalPurposeOfCall = reader.ReadText(tPoC);
towa.TowageOnArrivalDraught_DMT = reader.ReadNumber(tDraft); towa.TowageOnArrivalDraught_DMT = reader.ReadNumber(tDraft);
towa.TowageOnArrivalGrossTonnage = (int?) reader.ReadNumber(tGT); towa.TowageOnArrivalGrossTonnage = (int?) reader.ReadNumber(tGT);
@ -1698,7 +1698,7 @@ namespace ENI2.Excel
} }
towd.TowageOnDepartureName = towageName; towd.TowageOnDepartureName = towageName;
towd.TowageOnDepartureFlag = reader.ReadText(tFlag); towd.TowageOnDepartureFlag = reader.ReadNationality(tFlag);
towd.TowageOnDepartureDraught_DMT = reader.ReadNumber(tDraft); towd.TowageOnDepartureDraught_DMT = reader.ReadNumber(tDraft);
towd.TowageOnDepartureLengthOverall_MTR = reader.ReadNumber(tLen); towd.TowageOnDepartureLengthOverall_MTR = reader.ReadNumber(tLen);
towd.TowageOnDepartureBeam_MTR = reader.ReadNumber(tBeam); towd.TowageOnDepartureBeam_MTR = reader.ReadNumber(tBeam);

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")] [assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")] [assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("6.9.17")] [assembly: AssemblyInformationalVersion("6.9.18")]
[assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")] [assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]

View File

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