diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs
index 1d11a210..ecb7c037 100644
--- a/ENI2/DetailRootControl.xaml.cs
+++ b/ENI2/DetailRootControl.xaml.cs
@@ -649,7 +649,7 @@ namespace ENI2
{
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = "";
- aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATA");
+ aMessage.StatusInfo = string.Format("Validation error 142: NOA_NOD must be sent before ATA");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
}
@@ -660,7 +660,7 @@ namespace ENI2
{
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = "";
- aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATD");
+ aMessage.StatusInfo = string.Format("Validation error 142: NOA_NOD must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
@@ -668,7 +668,7 @@ namespace ENI2
{
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = "";
- aMessage.StatusInfo = string.Format("Validation error: ATA must be sent before ATD");
+ aMessage.StatusInfo = string.Format("Validation error 143: ATA must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
}
}
diff --git a/ENI2/DetailViewControls/PortCallDetailControl.xaml b/ENI2/DetailViewControls/PortCallDetailControl.xaml
index 12abc521..75e598c0 100644
--- a/ENI2/DetailViewControls/PortCallDetailControl.xaml
+++ b/ENI2/DetailViewControls/PortCallDetailControl.xaml
@@ -47,7 +47,7 @@
-
+
diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index 6da7b2e6..b8a4ae5e 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -36,8 +36,8 @@
5.4.0.0
true
publish.html
- 12
- 7.5.0.%2a
+ 4
+ 7.6.0.%2a
false
true
true
@@ -84,7 +84,7 @@
- F2C2D0164244EC89955EF50201EE24C2A300FF0B
+ 62DE8527C377957850DB503DA52FF66F664BD459
true
diff --git a/ENI2/EditControls/EditCREWDialog.xaml.cs b/ENI2/EditControls/EditCREWDialog.xaml.cs
index c9fcae97..5b1bea43 100644
--- a/ENI2/EditControls/EditCREWDialog.xaml.cs
+++ b/ENI2/EditControls/EditCREWDialog.xaml.cs
@@ -31,13 +31,13 @@ namespace ENI2.EditControls
this.textBoxLastName.Text = this.CREW.CrewMemberLastName;
this.textBoxFirstName.Text = this.CREW.CrewMemberFirstName;
this.comboBoxGender.ItemsSource = GlobalStructures.GenderDict;
- this.comboBoxGender.SelectedValue = (this.CREW.CrewMemberGender == null) ? null : this.CREW.CrewMemberGender.ToString();
+ this.comboBoxGender.SelectedValue = this.CREW.CrewMemberGender?.ToString();
this.textBoxPlaceOfBirth.Text = this.CREW.CrewMemberPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.CREW.CrewMemberNationality;
this.datePickerDateOfBirth.SelectedDate = this.CREW.CrewMemberDateOfBirth;
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
- this.comboBoxIdDocType.SelectedValue = (this.CREW.CrewMemberIdentityDocumentType == null) ? null : this.CREW.CrewMemberIdentityDocumentType.ToString();
+ this.comboBoxIdDocType.SelectedValue = this.CREW.CrewMemberIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.CREW.CrewMemberIdentityDocumentId;
this.textBoxVisaNumber.Text = this.CREW.CrewMemberVisaNumber;
this.comboBoxIssuingState.ItemsSource = bsmd.database.CREW.NationalityDict;
diff --git a/ENI2/EditControls/EditPasDialog.xaml.cs b/ENI2/EditControls/EditPasDialog.xaml.cs
index fee66aac..50ec611e 100644
--- a/ENI2/EditControls/EditPasDialog.xaml.cs
+++ b/ENI2/EditControls/EditPasDialog.xaml.cs
@@ -30,13 +30,13 @@ namespace ENI2.EditControls
this.textBoxLastName.Text = this.PAS.PassengerLastName;
this.textBoxFirstName.Text = this.PAS.PassengerFirstName;
this.comboBoxGender.ItemsSource = GlobalStructures.GenderDict;
- this.comboBoxGender.SelectedValue = this.PAS.PassengerGender ?? -1;
+ this.comboBoxGender.SelectedValue = this.PAS.PassengerGender?.ToString();
this.textBoxPlaceOfBirth.Text = this.PAS.PassengerPlaceOfBirth;
this.comboBoxNationality.ItemsSource = bsmd.database.CREW.NationalityDict;
this.comboBoxNationality.SelectedValue = this.PAS.PassengerNationality;
this.datePickerDateOfBirth.SelectedDate = this.PAS.PassengerDateOfBirth;
this.comboBoxIdDocType.ItemsSource = GlobalStructures.IDDocTypeDict;
- this.comboBoxIdDocType.SelectedValue = this.PAS.PassengerIdentityDocumentType ?? null;
+ this.comboBoxIdDocType.SelectedValue = this.PAS.PassengerIdentityDocumentType?.ToString();
this.textBoxIdDocNumber.Text = this.PAS.PassengerIdentityDocumentId;
this.textBoxVisaNumber.Text = this.PAS.PassengerVisaNumber;
this.locodePortOfEmbarkation.LocodeValue = this.PAS.PassengerPortOfEmbarkation;
diff --git a/ENI2/EditControls/EditWasteDialog.xaml b/ENI2/EditControls/EditWasteDialog.xaml
index 41f3372e..33f929b9 100644
--- a/ENI2/EditControls/EditWasteDialog.xaml
+++ b/ENI2/EditControls/EditWasteDialog.xaml
@@ -41,7 +41,7 @@
-
+
diff --git a/ENI2/Excel/ExcelReader.cs b/ENI2/Excel/ExcelReader.cs
index 49409fa2..55b7ed09 100644
--- a/ENI2/Excel/ExcelReader.cs
+++ b/ENI2/Excel/ExcelReader.cs
@@ -114,6 +114,22 @@ namespace ENI2.Excel
return val;
}
+ internal string ReadSSNLocode(string lookup)
+ {
+ string val = this.ReadText(lookup);
+ if (!val.IsNullOrEmpty())
+ {
+ val = val.ToUpper();
+ string portName = LocodeDB.SSNPortNameFromLocode(val);
+ if (portName.IsNullOrEmpty())
+ {
+ _log.WarnFormat("unknown Locode {0}", val);
+ val = "";
+ }
+ }
+ return val;
+ }
+
internal int? ReadCargoLACode(string lookup)
{
string val = ReadText(lookup);
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index 13647208..70f27daf 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -1077,7 +1077,7 @@ namespace ENI2.Excel
if (lastPort != null)
{
- if (LocodeDB.PortNameFromLocode(lastPort) != null)
+ if (LocodeDB.SSNPortNameFromLocode(lastPort) != null)
{
noa_nod.LastPort = lastPort;
}
@@ -1089,10 +1089,10 @@ namespace ENI2.Excel
else
_log.WarnFormat("{0} results in {1} possible LOCODES", lastPort, lastPorts.Count);
}
- }
+ }
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
noa_nod.NextPort = nextPort;
@@ -1100,7 +1100,7 @@ namespace ENI2.Excel
if(messageCore.IsTransit)
{
noa_nod.ETDFromKielCanal = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
- }
+ }
else
{
noa_nod.ETDFromPortOfCall = reader.ReadDateTime("NOA_NOD.ETDDateFromPortOfCall", "NOA_NOD.ETDTimeFromPortOfCall");
@@ -1152,8 +1152,8 @@ namespace ENI2.Excel
ScanMessage(was, reader);
- was.LastWasteDisposalPort = reader.ReadLoCode("WAS.LastWasteDisposalPort");
- was.NextWasteDisposalPort = reader.ReadLoCode("WAS.NextWasteDisposalPort");
+ was.LastWasteDisposalPort = reader.ReadSSNLocode("WAS.LastWasteDisposalPort");
+ was.NextWasteDisposalPort = reader.ReadSSNLocode("WAS.NextWasteDisposalPort");
was.ConfirmationOfCorrectness = true; // wir haben immer Recht (NSW7.0)
was.ConfirmationOfSufficiency = true;
@@ -1243,7 +1243,7 @@ namespace ENI2.Excel
waste.WasteCapacity_MTQ = reader.ReadNumberDefaultZero(wasteCapacity);
waste.WasteAmountRetained_MTQ = reader.ReadNumberDefaultZero(wasteRetained);
- waste.WasteDisposalPort = reader.ReadLoCode(wastePort); // aka RemainingWasteDisposalPort
+ waste.WasteDisposalPort = reader.ReadSSNLocode(wastePort); // aka RemainingWasteDisposalPort
if (waste.WasteDisposalPort.IsNullOrEmpty())
{
@@ -2111,7 +2111,10 @@ namespace ENI2.Excel
if (!crew.CrewMemberIdentityDocumentExpiryDate.HasValue && isOldVersion)
crew.CrewMemberIdentityDocumentExpiryDate = new DateTime(2100, 12, 31);
- crew.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
+ crew.Effects = reader.ReadCellAsText("2. PORT", string.Format("C{0}", i + 142));
+ if (crew.Effects.Length > 256)
+ crew.Effects = crew.Effects.Substring(0, 256);
+
Util.UIHelper.SetBusyState(); // dialog might reset busy state
}
@@ -2543,13 +2546,13 @@ namespace ENI2.Excel
{
result = "XX";
}
- else if(CREW.NationalityDict.ContainsKey(nationality.ToUpper()))
+ else if(CREW.NationalityDict.ContainsKey(nationality.ToUpper())) // is it already a key
{
result = nationality.ToUpper();
}
- else if(CREW.NationalityDict.ContainsKey(nationality.ToUpper()))
+ else if(CREW.NationalityDict.ContainsValue(nationality.ToUpper()))
{
- result = CREW.NationalityDict[nationality.ToUpper()];
+ result = CREW.NationalityDict.FirstOrDefault(x => x.Value.Substring(3).Equals(nationality, StringComparison.OrdinalIgnoreCase)).Key;
}
else if(_countryImportDict.ContainsKey(nationality))
{
diff --git a/ENI2/Util/GlobalStructures.cs b/ENI2/Util/GlobalStructures.cs
index 589c1754..225688fd 100644
--- a/ENI2/Util/GlobalStructures.cs
+++ b/ENI2/Util/GlobalStructures.cs
@@ -134,18 +134,18 @@ namespace ENI2.Util
{
result = true;
}
- else if (o is string)
+ else if (o is string str)
{
- if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
+ if (str.Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
}
- else if (o is System.Collections.Generic.KeyValuePair)
+ else if (o is System.Collections.Generic.KeyValuePair kvsPair)
{
- if (((System.Collections.Generic.KeyValuePair)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
+ if (kvsPair.Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
result = true;
}
- else if (o is System.Collections.Generic.KeyValuePair)
+ else if (o is System.Collections.Generic.KeyValuePair kviPair)
{
- if (((System.Collections.Generic.KeyValuePair)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
+ if (kviPair.Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
result = true;
}
return result;
diff --git a/bsmd.database/IMDGPosition.cs b/bsmd.database/IMDGPosition.cs
index 1bb638c4..eab170f8 100644
--- a/bsmd.database/IMDGPosition.cs
+++ b/bsmd.database/IMDGPosition.cs
@@ -452,9 +452,9 @@ namespace bsmd.database
if (!(this.GeneralCargoIBC ?? false) && this.ContainerNumber.IsNullOrEmpty() && this.VehicleLicenseNumber.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V808, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD": "HAZA"));
- if((this.NetQuantity_KGM > 100000) ||
- (this.GrossQuantity_KGM > 100000) ||
- (this.Volume_MTQ > 100))
+ if((this.NetQuantity_KGM >= 1000000000) ||
+ (this.GrossQuantity_KGM >= 1000000000) ||
+ (this.Volume_MTQ >= 1000000000))
violations.Add(RuleEngine.CreateViolation(ValidationCode.V809, null, null, this.Title, this.Identifier, this.HAZ.IsDeparture ? "HAZD" : "HAZA"));
diff --git a/bsmd.database/NOA_NOD.cs b/bsmd.database/NOA_NOD.cs
index 46292d32..1a348db2 100644
--- a/bsmd.database/NOA_NOD.cs
+++ b/bsmd.database/NOA_NOD.cs
@@ -59,7 +59,7 @@ namespace bsmd.database
public DateTime? ETDFromKielCanal { get; set; }
[ShowReport]
- [Validation(ValidationCode.NOT_NULL)]
+ [Validation(ValidationCode.LOCODE_SSN)]
[MaxLength(5)]
[ENI2Validation]
[DataMember]
@@ -267,6 +267,11 @@ namespace bsmd.database
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check ETAToPortOfCall: might be implausible", this.ETAToPortOfCall.Value.ToLocalTime().ToString(), this.Title, null, this.Tablename));
}
+ // NSW 7.1 ETDFromLastPort Pflichtfeld, wenn LastPort != ZZUKN
+ if(!this.LastPort.IsNullOrEmpty() && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
+ {
+ errors.Add(RuleEngine.CreateError(ValidationCode.E125, "ETDFromLastPort must be provided for a given last port", "", this.Title, null, this.Tablename));
+ }
if((this.ETDFromLastPort < DateTime.Now.AddDays(-14)) || (this.ETDFromLastPort.HasValue && this.ETDFromLastPort.Value.ToLocalTime().IsTimeEmpty()))
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check ETDFromLastPort: might be implausible", this.ETDFromLastPort.Value.ToLocalTime().ToString(), this.Title, null, this.Tablename));
@@ -307,9 +312,6 @@ namespace bsmd.database
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check ETAToKielCanal: might be implausible", this.ETAToKielCanal.Value.ToLocalTime().ToString(), this.Title, null, this.Tablename));
}
- if((this.LastPort?.Equals("ZZUKN") == false) && !this.ETDFromLastPort.HasValue)
- errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "ETDFromLastPort missing", null, this.Title, null, this.Tablename));
-
if((this.LastPort?.Equals("ZZUKN") == true) && this.ETDFromLastPort.HasValue)
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE_ZZUKN, "ETDFromLastPort cannot be set if ZZUKN", null, this.Title, null, this.Tablename));
diff --git a/bsmd.database/Properties/AssemblyProductInfo.cs b/bsmd.database/Properties/AssemblyProductInfo.cs
index 997e4e5c..b432045f 100644
--- a/bsmd.database/Properties/AssemblyProductInfo.cs
+++ b/bsmd.database/Properties/AssemblyProductInfo.cs
@@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
-[assembly: AssemblyInformationalVersion("7.5.0")]
+[assembly: AssemblyInformationalVersion("7.6.0")]
[assembly: AssemblyCopyright("Copyright © 2014-2022 schick Informatik")]
[assembly: AssemblyTrademark("")]
\ No newline at end of file
diff --git a/bsmd.database/Properties/AssemblyProjectInfo.cs b/bsmd.database/Properties/AssemblyProjectInfo.cs
index 9a036928..61f6ea94 100644
--- a/bsmd.database/Properties/AssemblyProjectInfo.cs
+++ b/bsmd.database/Properties/AssemblyProjectInfo.cs
@@ -1,4 +1,4 @@
using System.Reflection;
-[assembly: AssemblyVersion("7.5.0.*")]
+[assembly: AssemblyVersion("7.6.0.*")]
diff --git a/bsmd.database/ValidationAttribute.cs b/bsmd.database/ValidationAttribute.cs
index 16fa8ff4..2a9baf85 100644
--- a/bsmd.database/ValidationAttribute.cs
+++ b/bsmd.database/ValidationAttribute.cs
@@ -58,6 +58,7 @@ namespace bsmd.database
E123 = 123,
E124 = 124,
E125 = 125,
+ E222 = 222,
V201 = 201,
V202,
V203,
@@ -82,7 +83,7 @@ namespace bsmd.database
V782 = 782,
V783 = 783,
V784 = 784,
- V786 = 786,
+ V786 = 786, // not used any more (7.1)
V801 = 801,
V802 = 802,
V803 = 803,
diff --git a/bsmd.database/WAS.cs b/bsmd.database/WAS.cs
index 2debf224..1b825d2f 100644
--- a/bsmd.database/WAS.cs
+++ b/bsmd.database/WAS.cs
@@ -107,7 +107,7 @@ namespace bsmd.database
public bool? WasteDisposalValidExemption { get; set; }
[ShowReport]
- [Validation2(ValidationCode.LOCODE_SSN)]
+ [Validation2(ValidationCode.LOCODE_SSN)]
[MaxLength(5)]
[ENI2Validation]
public string LastWasteDisposalPort { get; set; }
diff --git a/bsmd.database/WAS_RCPT.cs b/bsmd.database/WAS_RCPT.cs
index c3603513..f76a4595 100644
--- a/bsmd.database/WAS_RCPT.cs
+++ b/bsmd.database/WAS_RCPT.cs
@@ -351,7 +351,7 @@ namespace bsmd.database
string missingType = "";
foreach (string wasteCodeString in WAS.WasteCodes)
- {
+ {
bool codeFound = false;
foreach (WasteReceived wr in this.WasteReceived)
{
diff --git a/bsmd.database/Waste.cs b/bsmd.database/Waste.cs
index b118c2dc..fb4b7ed5 100644
--- a/bsmd.database/Waste.cs
+++ b/bsmd.database/Waste.cs
@@ -108,7 +108,7 @@ namespace bsmd.database
[ShowReport]
[MaxLength(5)]
[ENI2Validation]
- [Validation(ValidationCode.LOCODE)]
+ [Validation(ValidationCode.LOCODE_SSN)]
public string WasteDisposalPort { get; set; }
[ShowReport]