diff --git a/ENI2/DetailRootControl.xaml.cs b/ENI2/DetailRootControl.xaml.cs
index a96c79ef..941892ec 100644
--- a/ENI2/DetailRootControl.xaml.cs
+++ b/ENI2/DetailRootControl.xaml.cs
@@ -361,11 +361,11 @@ namespace ENI2
if (oldMessage.MessageNotificationClass == Message.NotificationClass.ATD) continue;
if (oldMessage.MessageNotificationClass == Message.NotificationClass.NOA_NOD) continue;
- bool isAndienKlasse = ((oldMessage.MessageNotificationClass == Message.NotificationClass.AGNT) ||
+ bool isAndienKlasse = (oldMessage.MessageNotificationClass == Message.NotificationClass.AGNT) ||
(oldMessage.MessageNotificationClass == Message.NotificationClass.STAT) ||
(oldMessage.MessageNotificationClass == Message.NotificationClass.INFO) ||
(oldMessage.MessageNotificationClass == Message.NotificationClass.HAZA) ||
- (oldMessage.MessageNotificationClass == Message.NotificationClass.HAZD));
+ (oldMessage.MessageNotificationClass == Message.NotificationClass.HAZD);
if (!cdd.CopyAll && !isAndienKlasse) continue;
@@ -679,7 +679,7 @@ namespace ENI2
me.MessageGroupName = messageGroup;
foreach (MessageViolation mv in violations)
mv.MessageGroupName = messageGroup;
- }
+ }
vErrors.AddRange(errors);
vViolations.AddRange(violations);
@@ -1046,7 +1046,7 @@ namespace ENI2
this._errorListDialog.Closed += (o, e) => this._errorListDialog = null;
this._errorListDialog.Loaded += (o, e) => this._errorListDialog.RefreshVisible = true;
this._errorListDialog.ErrorSelected += _errorListDialog_ErrorSelected;
- this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
+ this._errorListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._errorListDialog.Show();
}
this._errorListDialog.Errors = vErrors;
@@ -1060,7 +1060,7 @@ namespace ENI2
this._violationListDialog.Closed += (o, e) => this._violationListDialog = null;
this._violationListDialog.Loaded += (o, e) => this._violationListDialog.RefreshVisible = true;
this._violationListDialog.ViolationSelected += _errorListDialog_ErrorSelected;
- this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
+ this._violationListDialog.RefreshClicked += _errorListDialog_RefreshClicked;
this._violationListDialog.Show();
}
_violationListDialog.Violations = vViolations;
@@ -1157,7 +1157,7 @@ namespace ENI2
return Properties.Resources.textDepartureNotification;
case Message.NotificationClass.MDH:
return Properties.Resources.textMDH;
- case Message.NotificationClass.NOA_NOD:
+ case Message.NotificationClass.NOA_NOD:
case Message.NotificationClass.AGNT:
return Properties.Resources.textPortCall;
case Message.NotificationClass.NAME:
@@ -1175,6 +1175,7 @@ namespace ENI2
case Message.NotificationClass.TOWD:
return Properties.Resources.textTowage;
case Message.NotificationClass.WAS:
+ case Message.NotificationClass.WAS_RCPT:
return Properties.Resources.textWaste;
}
return null;
diff --git a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
index ed52f1ed..92f3fa89 100644
--- a/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
+++ b/ENI2/DetailViewControls/BorderPoliceDetailControl.xaml
@@ -60,9 +60,9 @@
-
+
-
+
@@ -100,9 +100,9 @@
-
+
-
+
@@ -139,9 +139,9 @@
-
+
-
+
@@ -183,9 +183,9 @@
-
+
-
+
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI2/DetailViewControls/WasteDetailControl.xaml
index 2db7b34d..0d192ad6 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml
@@ -38,21 +38,21 @@
-
-
-
+
+
+
-
-
+
+
-
+
@@ -123,18 +123,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
index 75d5cf38..31fca822 100644
--- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
+++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs
@@ -2,6 +2,7 @@
// Description: Detailansicht Müllmeldung
//
+using System.Linq;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
@@ -43,10 +44,10 @@ namespace ENI2.DetailViewControls
{
this.RegisterLocodeChange(this.locodeCtrlLastWastePort, Message.NotificationClass.WAS);
+ this.RegisterLocodeChange(this.locodeCtrlNextWastePort, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxAccurateCorrectDetails, Message.NotificationClass.WAS);
this.RegisterCheckboxChange(this.checkBoxValidExemption, Message.NotificationClass.WAS);
- this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
- this.RegisterComboboxIndexChange(this.comboBoxWasteDisposal, Message.NotificationClass.WAS);
+ this.RegisterDatePickerChange(this.datePickerDateLastDisposal, Message.NotificationClass.WAS);
this.RegisterTextboxChange(this.textBoxWasteDisposalServiceProviders, Message.NotificationClass.WAS);
}
@@ -55,7 +56,7 @@ namespace ENI2.DetailViewControls
{
bool on = !(this.checkBoxValidExemption.IsChecked ?? false);
this.checkBoxAccurateCorrectDetails.IsEnabled = on;
- this.comboBoxWasteDisposal.IsEnabled = on;
+ this.locodeCtrlNextWastePort.IsEnabled = on;
this.textBoxWasteDisposalServiceProviders.IsEnabled = on;
this.dataGridWaste.IsEnabled = on;
this.locodeCtrlLastWastePort.IsEnabled = on;
@@ -77,8 +78,7 @@ namespace ENI2.DetailViewControls
WasteCapacity_MTQ = 0,
WasteDescription = "",
WasteDisposalAmount_MTQ = 0,
- WasteDisposalPort = "ZZUKN",
- WasteDisposedAtLastPort_MTQ = 0
+ WasteDisposalPort = "ZZUKN"
};
this._was.Waste.Add(newWaste);
}
@@ -124,14 +124,22 @@ namespace ENI2.DetailViewControls
was.MessageCore = this.Core;
was.MessageHeader = this._wasMessage;
_wasMessage.Elements.Add(was);
+ }
+ else
+ {
+ // remove "old" Waste Entries from display (not deleted in the DB!)
+ for(int i = (was.Waste.Count - 1); i >= 0; i--)
+ {
+ if (was.Waste[i].WasteType > 999)
+ was.Waste.RemoveAt(i);
+ }
}
this.wasGroupBox.DataContext = was;
this._was = was;
this.dataGridWaste.Initialize();
- this.dataGridWaste.ItemsSource = was.Waste;
- this.comboBoxWasteDisposal.ItemsSource = _wasteDeliveryList;
+ this.dataGridWaste.ItemsSource = was.Waste;
this.dataGridWaste.AddingNewItem += DataGridWaste_AddingNewItem;
this.dataGridWaste.EditRequested += DataGridWaste_EditRequested;
this.dataGridWaste.DeleteRequested += DataGridWaste_DeleteRequested;
diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj
index f0bfda87..cd9abfff 100644
--- a/ENI2/ENI2.csproj
+++ b/ENI2/ENI2.csproj
@@ -36,8 +36,8 @@
5.4.0.0
true
publish.html
- 4
- 7.0.0.4
+ 6
+ 7.0.0.6
false
true
true
diff --git a/ENI2/EditControls/EditWasteDialog.xaml.cs b/ENI2/EditControls/EditWasteDialog.xaml.cs
index a4d1c2c3..6af99de8 100644
--- a/ENI2/EditControls/EditWasteDialog.xaml.cs
+++ b/ENI2/EditControls/EditWasteDialog.xaml.cs
@@ -28,14 +28,12 @@ namespace ENI2.EditControls
private void EditWasteDialog_Loaded(object sender, RoutedEventArgs e)
{
Dictionary codeDict = new Dictionary();
- for (int i = 0; i < WAS.RequiredCodes.Length; i++)
- {
- codeDict[WAS.RequiredCodes[i]] = string.Format("{0} - {1}", WAS.RequiredCodes[i], WAS.RequiredTypes[i]);
- }
+ foreach (string key in WAS.WasteCodeDict.Keys)
+ codeDict.Add(int.Parse(key), string.Format("{0} - {1}", key, WAS.WasteCodeDict[key]));
+
this.comboBoxWasteCode.ItemsSource = codeDict;
this.comboBoxWasteCode.SelectedValue = this.Waste.WasteType;
- this.textBoxDescription.Text = this.Waste.WasteDescription;
- this.doubleUpDownAmountWasteDischargedLastPort.Value = this.Waste.WasteDisposedAtLastPort_MTQ;
+ this.textBoxDescription.Text = this.Waste.WasteDescription;
this.doubleUpDownAmountDisposed.Value = this.Waste.WasteDisposalAmount_MTQ;
this.doubleUpDownAmountGeneratedTilNextPort.Value = this.Waste.WasteAmountGeneratedTillNextPort_MTQ;
this.doubleUpDownAmountRetained.Value = this.Waste.WasteAmountRetained_MTQ;
@@ -52,8 +50,7 @@ namespace ENI2.EditControls
this.Waste.WasteType = (int)this.comboBoxWasteCode.SelectedValue;
else
this.Waste.WasteType = null;
- this.Waste.WasteDescription = this.textBoxDescription.Text?.Trim();
- this.Waste.WasteDisposedAtLastPort_MTQ = this.doubleUpDownAmountWasteDischargedLastPort.Value;
+ this.Waste.WasteDescription = this.textBoxDescription.Text?.Trim();
this.Waste.WasteDisposalAmount_MTQ = this.doubleUpDownAmountDisposed.Value;
this.Waste.WasteAmountGeneratedTillNextPort_MTQ = this.doubleUpDownAmountGeneratedTilNextPort.Value;
this.Waste.WasteAmountRetained_MTQ = this.doubleUpDownAmountRetained.Value;
diff --git a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
index 7ecaa351..49dd9f76 100644
--- a/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
+++ b/ENI2/EditControls/SelectImportClassesDialog.xaml.cs
@@ -55,21 +55,22 @@ namespace ENI2.EditControls
(aMessage.MessageNotificationClass == Message.NotificationClass.HAZD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.INFO) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.LADG) ||
- (aMessage.MessageNotificationClass == Message.NotificationClass.NAME) ||
+ (aMessage.MessageNotificationClass == Message.NotificationClass.NAME) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.PRE72H) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.SERV) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.TIEFD) ||
(aMessage.MessageNotificationClass == Message.NotificationClass.TOWD) ||
- (aMessage.MessageNotificationClass == Message.NotificationClass.WAS)
+ (aMessage.MessageNotificationClass == Message.NotificationClass.WAS) ||
+ (aMessage.MessageNotificationClass == Message.NotificationClass.WAS_RCPT)
)) continue;
SelectClass sc = new SelectClass();
sc.Name = Enum.GetName(typeof(bsmd.database.Message.NotificationClass), aMessage.MessageNotificationClass);
sc.Class = aMessage.MessageNotificationClass;
- sc.IsSelected = false;
+ sc.IsSelected = false;
_selectClasses.Add(sc);
}
-
+
this.checkListBoxClasses.ItemsSource = _selectClasses;
this.OKClicked += SelectImportClassesDialog_OKClicked;
}
@@ -84,7 +85,7 @@ namespace ENI2.EditControls
class SelectClass : INotifyPropertyChanged
{
- private bool _isSelected;
+ private bool _isSelected;
public string Name { get; set; }
public Message.NotificationClass Class { get; set; }
public bool IsSelected
diff --git a/ENI2/Excel/ExcelUtil.cs b/ENI2/Excel/ExcelUtil.cs
index e3535490..a47cb295 100644
--- a/ENI2/Excel/ExcelUtil.cs
+++ b/ENI2/Excel/ExcelUtil.cs
@@ -120,8 +120,7 @@ namespace ENI2.Excel
internal static void SaveMessage(Message message)
{
message.CreatedBy = "EXCEL";
- if ((message.MessageNotificationClass == Message.NotificationClass.CREWD) || (message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
- (message.MessageNotificationClass == Message.NotificationClass.STO))
+ if (message.MessageNotificationClass == Message.NotificationClass.STO)
message.InternalStatus = Message.BSMDStatus.PREPARE;
else
message.InternalStatus = Message.BSMDStatus.EXCEL;
@@ -1133,8 +1132,7 @@ namespace ENI2.Excel
was.DeleteElements();
ScanMessage(was, reader);
-
- was.WasteDisposalDelivery = reader.ReadDelivery("WAS.WasteDisposalDelivery");
+
was.LastWasteDisposalPort = reader.ReadLoCode("WAS.LastWasteDisposalPort");
was.NextWasteDisposalPort = reader.ReadLoCode("WAS.NextWasteDisposalPort");
was.ConfirmationOfCorrectness = true; // wir haben immer Recht (NSW7.0)
@@ -1151,7 +1149,6 @@ namespace ENI2.Excel
was.WasteDisposalServiceProvider.Add(wdsp);
}
was.WasteDisposalServiceProvider[0].WasteDisposalServiceProviderName = wastedispServProvName;
- was.WasteDisposalServiceProvider[0].WasteDisposalDelivery = was.WasteDisposalDelivery;
}
// Waste 1 - 25
@@ -1175,16 +1172,14 @@ namespace ENI2.Excel
}
waste.WasteType = (int?) reader.ReadNumber(wasteCode);
-
- if (waste.WasteType.HasValue && (waste.WasteType == 2313))
- waste.WasteType = 2600;
+
// Waste description Spezialfälle für DK
waste.WasteDescription = reader.ReadText(wasteDescription);
if (waste.WasteDescription.IsNullOrEmpty())
{
- if (reader.Mode == ExcelReader.CountryMode.DE)
- {
+ if ((reader.Mode == ExcelReader.CountryMode.DE) && waste.IsDashWasteCode)
+ {
waste.WasteDescription = "-";
}
else if (reader.Mode == ExcelReader.CountryMode.DK)
@@ -1223,15 +1218,7 @@ namespace ENI2.Excel
waste.WasteDisposalPort = "ZZUKN";
}
- waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumberDefaultZero(amountGen);
-
- if(i==15) // falls letzte Zeile leer, entfernen: Christin 22.3.17
- {
- if ((waste.WasteDescription.IsNullOrEmpty() || waste.WasteDescription == "-") &&
- ((waste.WasteDisposalAmount_MTQ ?? 0) == 0) &&
- (((waste.WasteType ?? 0) == 1300) || !waste.WasteType.HasValue))
- was.Waste.Remove(waste);
- }
+ waste.WasteAmountGeneratedTillNextPort_MTQ = reader.ReadNumberDefaultZero(amountGen);
if (!waste.WasteType.HasValue)
{
diff --git a/ENI2/Excel/ExcelWriter.cs b/ENI2/Excel/ExcelWriter.cs
index 46560291..0c674dd2 100644
--- a/ENI2/Excel/ExcelWriter.cs
+++ b/ENI2/Excel/ExcelWriter.cs
@@ -47,14 +47,22 @@ namespace ENI2.Excel
{
switch(message.MessageNotificationClass)
{
- case Message.NotificationClass.AGNT:
- if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt);
+ case Message.NotificationClass.AGNT:
+ if (message.Elements[0] is AGNT agnt) this.WriteMessage(agnt);
break;
case Message.NotificationClass.ATA:
- if (message.Elements[0] is ATA ata) this.WriteMessage(ata);
+ if (message.Elements[0] is ATA ata)
+ {
+ WriteDate("ATA.ATADatePortOfCall", ata.ATAPortOfCall);
+ WriteTime("ATA.ATATimePortOfCall", ata.ATAPortOfCall);
+ }
break;
case Message.NotificationClass.ATD:
- if (message.Elements[0] is ATD atd) this.WriteMessage(atd);
+ if (message.Elements[0] is ATD atd)
+ {
+ WriteDate("ATD.ATDDatePortOfCall", atd.ATDPortOfCall);
+ WriteTime("ATD.ATDTimePortOfCall", atd.ATDPortOfCall);
+ }
break;
case Message.NotificationClass.BKRA:
this.WriteBKRA(message);
@@ -497,7 +505,7 @@ namespace ENI2.Excel
{
string ibc_productName = string.Format("{1}.IBC.ProductName_{0}", i + 1, className);
string ibc_pollutionCategory = string.Format("{1}.IBC.PollutionCategory_{0}", i + 1, className);
- string ibc_flash = string.Format("{1}.IBC.FlashpointInformation_{0}", i + 1, className);
+ string ibc_flash = string.Format("{1}.IBC.Flashpoint_CEL_{0}", i + 1, className);
string ibc_quantity = string.Format("{1}.IBC.Quantity_KGM_{0}", i + 1, className);
string ibc_stowagePosition = string.Format("{1}.IBC.StowagePosition_{0}", i + 1, className);
string ibc_portOfLoading = string.Format("{1}.IBC.PortOfLoading_{0}", i + 1, className);
@@ -568,7 +576,7 @@ namespace ENI2.Excel
string imsbc_portOfDischarge = string.Format("{1}.IMSBC.PortOfDischarge_{0}", i + 1, className);
string imsbc_imohazard = string.Format("{1}.IMSBC.IMOHazardClass_{0}", i + 1, className);
string imsbc_unnumber = string.Format("{1}.IMSBC.UNNumber_{0}", i + 1, className);
- string imsbc_imoclass = string.Format("{1}.IMSBC.IMOCLass_{0}", i + 1, className);
+ string imsbc_imoclass = string.Format("{1}.IMSBC.IMOClass_{0}", i + 1, className);
string imsbc_remarks = string.Format("{1}.IMSBC.Remarks_{0}", i + 1, className);
IMSBCPosition imsbcPosition = haz.IMSBCPositions[i];
WriteText(imsbc_bcsn, imsbcPosition.BulkCargoShippingName);
@@ -703,7 +711,7 @@ namespace ENI2.Excel
WriteDate("NOA_NOD.ETDDateFromPortOfCall", noa_nod.ETDFromKielCanal.Value);
WriteTime("NOA_NOD.ETDTimeFromPortOfCall", noa_nod.ETDFromKielCanal.Value);
}
- }
+ }
else
{
for(int i = 0; i < Math.Min(noa_nod.NumberOfExcelRows, noa_nod.CallPurposes.Count); i++)
@@ -1090,7 +1098,7 @@ namespace ENI2.Excel
string wdesc = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.WasteDescription_{1}", i, j);
string wamount = string.Format("WAS_RCPT.WasteDeliveryReceipt_{0}.AmountWasteReceived_MTQ_{1}", i, j);
- WasteReceived wReceived = wrcpt.WasteReceived[i - 1];
+ WasteReceived wReceived = wrcpt.WasteReceived[j - 1];
WriteText(wdesc, wReceived.WasteDescription);
WriteNumber(wamount, wReceived.AmountWasteReceived_MTQ);
diff --git a/ENI2/Properties/Resources.Designer.cs b/ENI2/Properties/Resources.Designer.cs
index c2031d71..29424950 100644
--- a/ENI2/Properties/Resources.Designer.cs
+++ b/ENI2/Properties/Resources.Designer.cs
@@ -3298,6 +3298,15 @@ namespace ENI2.Properties {
}
}
+ ///
+ /// Looks up a localized string similar to Next waste disposal port.
+ ///
+ public static string textNextWasteDisposalPort {
+ get {
+ return ResourceManager.GetString("textNextWasteDisposalPort", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Notification class.
///
diff --git a/ENI2/Properties/Resources.resx b/ENI2/Properties/Resources.resx
index 29713813..9b3d21e5 100644
--- a/ENI2/Properties/Resources.resx
+++ b/ENI2/Properties/Resources.resx
@@ -1822,4 +1822,7 @@
Emergency contact number
+
+ Next waste disposal port
+
\ No newline at end of file
diff --git a/bsmd.database/WAS.cs b/bsmd.database/WAS.cs
index 51a690c3..52334762 100644
--- a/bsmd.database/WAS.cs
+++ b/bsmd.database/WAS.cs
@@ -234,6 +234,7 @@ namespace bsmd.database
scmd.Parameters.AddWithNullableValue("@P5", this.LastWasteDisposalDate);
scmd.Parameters.AddWithNullableValue("@P6", this.WasteDisposalDelivery);
scmd.Parameters.AddWithNullableValue("@P7", this.ConfirmationOfSufficiency);
+ scmd.Parameters.AddWithNullableValue("@P8", this.NextWasteDisposalPort);
if (this.IsNew)
{
@@ -241,21 +242,21 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("INSERT INTO {0} (Id, MessageHeaderId, WasteDisposalValidExemption, " +
"LastWasteDisposalPort, ConfirmationOfCorrectness, LastWasteDisposalDate, WasteDisposalDelivery, " +
- "ConfirmationOfSufficiency) VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7 )", this.Tablename);
+ "ConfirmationOfSufficiency, NextWasteDisposalPort) VALUES ( @ID, @P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8 )", this.Tablename);
}
else
{
scmd.Parameters.AddWithValue("ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET WasteDisposalValidExemption = @P2, LastWasteDisposalPort = @P3, " +
- "ConfirmationOfCorrectness = @P4, LastWasteDisposalDate = @P5, WasteDisposalDelivery = @P6, ConfirmationOfSufficiency = @P7 " +
- "WHERE Id = @ID", this.Tablename);
+ "ConfirmationOfCorrectness = @P4, LastWasteDisposalDate = @P5, WasteDisposalDelivery = @P6, ConfirmationOfSufficiency = @P7, " +
+ "NextWasteDisposalPort = @P8 WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, WasteDisposalValidExemption, LastWasteDisposalPort, ConfirmationOfCorrectness, " +
- "LastWasteDisposalDate, WasteDisposalDelivery, ConfirmationOfSufficiency " +
+ "LastWasteDisposalDate, WasteDisposalDelivery, ConfirmationOfSufficiency, NextWasteDisposalPort " +
"FROM {0} ", this.Tablename);
switch (filter)
@@ -290,6 +291,7 @@ namespace bsmd.database
if (!reader.IsDBNull(4)) was.LastWasteDisposalDate = reader.GetDateTime(4);
if (!reader.IsDBNull(5)) was.WasteDisposalDelivery = reader.GetByte(5);
if (!reader.IsDBNull(6)) was.ConfirmationOfSufficiency = reader.GetBoolean(6);
+ if (!reader.IsDBNull(7)) was.NextWasteDisposalPort = reader.GetString(7);
result.Add(was);
}
reader.Close();
@@ -437,8 +439,9 @@ namespace bsmd.database
int missingType = 0;
- foreach(int wasteCode in RequiredCodes)
+ foreach(string wasteCodeString in WAS.WasteCodes)
{
+ int wasteCode = int.Parse(wasteCodeString);
bool codeFound = false;
foreach(Waste w in this.Waste)
{
@@ -455,19 +458,23 @@ namespace bsmd.database
}
}
+ if (entryMissing)
+ {
+ errors.Add(RuleEngine.CreateError(ValidationCode.POSITION_COUNT, string.Format("Waste {0}", missingType), null, this.Title, null, this.Tablename));
+ }
+
// Extravalidierung für "0" Meldung (5.3.21)
- double totalSludgeRetained = 0;
- double totalWDALP = 0;
+ double totalSludgeRetained = 0;
double totalWC = 0;
double totalWAR = 0;
double totalWAGTNP = 0;
double totalWDA = 0;
foreach(Waste w in this.Waste)
- {
+ {
if (w.WasteType == 1100) totalSludgeRetained += w.WasteAmountRetained_MTQ ?? 0;
if (w.WasteType == 1300) totalSludgeRetained += w.WasteAmountRetained_MTQ ?? 0;
- totalWDALP += w.WasteDisposedAtLastPort_MTQ ?? 0;
+
totalWC += w.WasteCapacity_MTQ ?? 0;
totalWAR += w.WasteAmountRetained_MTQ ?? 0;
totalWAGTNP += w.WasteAmountGeneratedTillNextPort_MTQ ?? 0;
@@ -476,11 +483,7 @@ namespace bsmd.database
if(totalSludgeRetained == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste amount retained on board for types 1100 'sludge' and 1300 'oil-others' = 0", null, this.Title, null, this.Tablename));
- }
- if(totalWDALP == 0)
- {
- violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteDisposedAtLastPort for all waste types", null, this.Title, null, this.Tablename));
- }
+ }
if(totalWC == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteCapacity for all waste types", null, this.Title, null, this.Tablename));
@@ -488,22 +491,7 @@ namespace bsmd.database
if(totalWAR == 0)
{
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteAmountRetained for all waste types", null, this.Title, null, this.Tablename));
- }
- if(totalWAGTNP == 0)
- {
- // herausgenommen lt Karte für 6.4.3 (15.7.21)
- // violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteAmountGeneratedTillNextPort for all waste types", null, this.Title, null, this.Tablename));
- }
- if((totalWDA == 0) && !(WasteDisposalDelivery.HasValue && (WasteDisposalDelivery.Value == 2)))
- {
- violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Total waste is 0 for WasteDisposalDelivery for all waste types", null, this.Title, null, this.Tablename));
- }
-
- if(entryMissing)
- {
- errors.Add(RuleEngine.CreateError(ValidationCode.POSITION_COUNT, string.Format("Waste {0}", missingType), null, this.Title, null, this.Tablename));
- }
-
+ }
if(!(this.ConfirmationOfCorrectness ?? false))
{
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "Confirmation of correctness not set!", null, this.Title, null, this.Tablename));
@@ -522,40 +510,7 @@ namespace bsmd.database
if (waste.WasteType.HasValue && waste.WasteType.Value == wasteType)
return waste;
return null;
- }
-
- public List AddRemainingWasteTypes()
- {
- List result = new List();
-
- for (byte wType = 1; wType <= 9; wType++ )
- {
- bool wasteTypeFound = false;
- foreach (Waste w in this.Waste)
- {
- if ((w.WasteType ?? 0) == wType)
- wasteTypeFound = true;
- }
- if (!wasteTypeFound)
- {
- Waste newWaste = new Waste
- {
- WasteType = wType,
- WasteAmountGeneratedTillNextPort_MTQ = 0,
- WasteAmountRetained_MTQ = 0,
- WasteCapacity_MTQ = 0,
- WasteDisposalAmount_MTQ = 0,
- Identifier = "",
- WasteDisposalPort = "ZZUKN",
- WasteDescription = "-",
- WAS = this
- };
- this.Waste.Add(newWaste);
- result.Add(newWaste);
- }
- }
- return result;
- }
+ }
///
/// Convenience Methode, die fehlende Waste Einträge ergänzt. Verbesserte Version, aus ENI-2 herüberkopiert, damit es auch im
@@ -564,8 +519,10 @@ namespace bsmd.database
public void AddMissingWaste()
{
- foreach (int wasteCode in WAS.RequiredCodes)
+ foreach (string wasteCodeString in WAS.WasteCodes)
{
+ int wasteCode = int.Parse(wasteCodeString);
+
Waste foundWaste = null;
foreach (Waste waste in this.Waste)
{
@@ -583,13 +540,14 @@ namespace bsmd.database
WAS = this,
WasteAmountGeneratedTillNextPort_MTQ = 0,
WasteAmountRetained_MTQ = 0,
- WasteCapacity_MTQ = 0,
- WasteDescription = (wasteCode == 1300) ? "-" : "",
+ WasteCapacity_MTQ = 0,
WasteDisposalAmount_MTQ = 0,
- WasteDisposalPort = "ZZUKN",
- WasteDisposedAtLastPort_MTQ = 0,
+ WasteDisposalPort = "ZZUKN",
WasteType = wasteCode
};
+
+ newWaste.WasteDescription = (newWaste.IsDashWasteCode) ? "-" : "";
+
this.Waste.Add(newWaste);
}
else
@@ -597,24 +555,11 @@ namespace bsmd.database
if (!foundWaste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) foundWaste.WasteAmountGeneratedTillNextPort_MTQ = 0;
if (!foundWaste.WasteAmountRetained_MTQ.HasValue) foundWaste.WasteAmountRetained_MTQ = 0;
if (!foundWaste.WasteCapacity_MTQ.HasValue) foundWaste.WasteCapacity_MTQ = 0;
- if ((wasteCode == 1300) && foundWaste.WasteDescription.IsNullOrEmpty()) foundWaste.WasteDescription = "-";
+ if (foundWaste.WasteDescription.IsNullOrEmpty() && foundWaste.IsDashWasteCode) foundWaste.WasteDescription = "-";
if (!foundWaste.WasteDisposalAmount_MTQ.HasValue) foundWaste.WasteDisposalAmount_MTQ = 0;
- if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN";
- if (!foundWaste.WasteDisposedAtLastPort_MTQ.HasValue) foundWaste.WasteDisposedAtLastPort_MTQ = 0;
+ if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN";
}
- }
-
- // falls Zeile 15 oder mehr vorhanden war / ist werden dort auch noch default Werte ergänzt
- foreach(Waste foundWaste in this.Waste)
- {
- if (!foundWaste.WasteAmountGeneratedTillNextPort_MTQ.HasValue) foundWaste.WasteAmountGeneratedTillNextPort_MTQ = 0;
- if (!foundWaste.WasteAmountRetained_MTQ.HasValue) foundWaste.WasteAmountRetained_MTQ = 0;
- if (!foundWaste.WasteCapacity_MTQ.HasValue) foundWaste.WasteCapacity_MTQ = 0;
- if ((foundWaste.WasteType == 1300) && foundWaste.WasteDescription.IsNullOrEmpty()) foundWaste.WasteDescription = "-";
- if (!foundWaste.WasteDisposalAmount_MTQ.HasValue) foundWaste.WasteDisposalAmount_MTQ = 0;
- if (foundWaste.WasteDisposalPort.IsNullOrEmpty()) foundWaste.WasteDisposalPort = "ZZUKN";
- if (!foundWaste.WasteDisposedAtLastPort_MTQ.HasValue) foundWaste.WasteDisposedAtLastPort_MTQ = 0;
- }
+ }
}
#endregion
diff --git a/bsmd.database/Waste.cs b/bsmd.database/Waste.cs
index fb4c660a..8101855d 100644
--- a/bsmd.database/Waste.cs
+++ b/bsmd.database/Waste.cs
@@ -142,6 +142,28 @@ namespace bsmd.database
}
}
+ [JsonIgnore]
+ public bool IsDashWasteCode
+ {
+ get
+ {
+ if (!WasteType.HasValue) return false;
+ switch (WasteType.Value)
+ {
+ case 999:
+ case 201:
+ case 202:
+ case 203:
+ case 204:
+ case 510:
+ case 511:
+ return true;
+ default:
+ return false;
+ }
+ }
+ }
+
#endregion
#region DatabaseEntity implementation
@@ -233,15 +255,26 @@ namespace bsmd.database
public override void Validate(List errors, List violations)
{
- if (this.WasteType.HasValue && (this.WasteType.Value == 1300) && this.WasteDescription.IsNullOrEmpty())
+ if (this.IsDashWasteCode && this.WasteDescription.IsNullOrEmpty())
violations.Add(RuleEngine.CreateViolation(ValidationCode.V781, "WasteDescription", null, this.Title, this.Identifier, this.Tablename));
if (!this.HasValidWasteCode)
violations.Add(RuleEngine.CreateViolation(ValidationCode.V784, "WasteCode", null, this.Title, this.Identifier, this.Tablename));
-
+
+ if (this.WasteDisposalAmount_MTQ > 10000)
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste disposal amount", null, this.Title, this.Identifier, this.Tablename));
+
+ if (this.WasteCapacity_MTQ > 10000)
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste capacity", null, this.Title, this.Identifier, this.Tablename));
+
+ if (this.WasteAmountRetained_MTQ > 10000)
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste amount retained", null, this.Title, this.Identifier, this.Tablename));
+
+ if (this.WasteAmountGeneratedTillNextPort_MTQ > 10000)
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste generated till next port", null, this.Title, this.Identifier, this.Tablename));
}
#endregion
- }
+ }
}
diff --git a/bsmd.database/WasteReceived.cs b/bsmd.database/WasteReceived.cs
index 116349b6..06787e12 100644
--- a/bsmd.database/WasteReceived.cs
+++ b/bsmd.database/WasteReceived.cs
@@ -59,7 +59,7 @@ namespace bsmd.database
[ShowReport]
[Validation(ValidationCode.NOT_NULL)]
[ENI2Validation]
- public double? AmountWasteReceived_MTQ { get; set; }
+ public double? AmountWasteReceived_MTQ { get; set; }
#endregion
@@ -136,8 +136,8 @@ namespace bsmd.database
public override void Validate(List errors, List violations)
{
-
-
+ if (this.AmountWasteReceived_MTQ > 10000)
+ violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Waste disposal amount", null, this.Title, this.Identifier, this.Tablename));
}
#endregion
diff --git a/bsmd.hisnord/Request.cs b/bsmd.hisnord/Request.cs
index d55afdf5..cfea5b35 100644
--- a/bsmd.hisnord/Request.cs
+++ b/bsmd.hisnord/Request.cs
@@ -184,7 +184,7 @@ namespace bsmd.hisnord
vesseltype hn_stat = new vesseltype();
if (stat.Beam_MTR.HasValue)
- hn_stat.Beam_MTR = (decimal) stat.Beam_MTR.Value;
+ hn_stat.Beam_MTR = Math.Round((decimal) stat.Beam_MTR.Value, 2);
hn_stat.CallSign = stat.CallSign;
hn_stat.Flag = stat.Flag;
if (stat.GrossTonnage.HasValue)
@@ -217,7 +217,7 @@ namespace bsmd.hisnord
hn_stat.ISMCompany.ISMCompanyStreetAndNumber = stat.ISMCompanyStreetAndNumber;
}
if (stat.LengthOverall_MTR.HasValue)
- hn_stat.LengthOverall_MTR = (decimal)stat.LengthOverall_MTR.Value;
+ hn_stat.LengthOverall_MTR = Math.Round((decimal)stat.LengthOverall_MTR.Value, 2);
hn_stat.MMSINumber = stat.MMSINumber;
hn_stat.PortOfRegistry = stat.PortOfRegistry;
hn_stat.ShipName = stat.ShipName;
@@ -425,7 +425,7 @@ namespace bsmd.hisnord
if (tiefa.DraughtUponArrival_DMT.HasValue)
{
items1ChoiceType.Add(Items1ChoiceType.TIEFA);
- items1.Add((decimal)tiefa.DraughtUponArrival_DMT.Value);
+ items1.Add(Math.Round((decimal)tiefa.DraughtUponArrival_DMT.Value, 1));
}
}
}
@@ -447,7 +447,7 @@ namespace bsmd.hisnord
if (tiefd.DraughtUponDeparture_DMT.HasValue)
{
items1ChoiceType.Add(Items1ChoiceType.TIEFD);
- items1.Add((decimal)tiefd.DraughtUponDeparture_DMT.Value);
+ items1.Add(Math.Round((decimal)tiefd.DraughtUponDeparture_DMT.Value, 1));
}
}
}
@@ -486,7 +486,7 @@ namespace bsmd.hisnord
hn_info.DeadWeightSummer_TNESpecified = info.DeplacementSummerDraught_TNE.HasValue;
if (hn_info.DeadWeightSummer_TNESpecified)
- hn_info.DeadWeightSummer_TNE = (decimal)info.DeplacementSummerDraught_TNE.Value;
+ hn_info.DeadWeightSummer_TNE = Math.Round((decimal)info.DeplacementSummerDraught_TNE.Value, 3);
items1ChoiceType.Add(Items1ChoiceType.INFO);
items1.Add(hn_info);
@@ -516,7 +516,7 @@ namespace bsmd.hisnord
BRKA brka = message.Elements[i] as BRKA;
hn_bkra.BunkerFuelArrival[i] = new bunkerfuel();
hn_bkra.BunkerFuelArrival[i].BunkerFuelType = brka.BunkerFuelType;
- hn_bkra.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = (decimal)brka.BunkerFuelQuantity_TNE;
+ hn_bkra.BunkerFuelArrival[i].BunkerFuelQuantity_TNE = Math.Round((decimal)brka.BunkerFuelQuantity_TNE, 3);
}
items1ChoiceType.Add(Items1ChoiceType.BKRA);
items1.Add(hn_bkra);
@@ -542,7 +542,7 @@ namespace bsmd.hisnord
BRKD brkd = message.Elements[i] as BRKD;
hn_bkrd.BunkerFuelDeparture[i] = new bunkerfuel();
hn_bkrd.BunkerFuelDeparture[i].BunkerFuelType = brkd.BunkerFuelType;
- hn_bkrd.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = (decimal)brkd.BunkerFuelQuantity_TNE;
+ hn_bkrd.BunkerFuelDeparture[i].BunkerFuelQuantity_TNE = Math.Round((decimal)brkd.BunkerFuelQuantity_TNE, 3);
}
items1ChoiceType.Add(Items1ChoiceType.BKRD);
items1.Add(hn_bkrd);
@@ -709,7 +709,7 @@ namespace bsmd.hisnord
if ((ladg.CargoNumberOfItems ?? 0) > 0)
lu.CargoNumberOfItems = ladg.CargoNumberOfItems.Value.ToString();
if (ladg.CargoGrossQuantity_TNE.HasValue)
- lu.CargoGrossQuantity_TNE = (decimal)ladg.CargoGrossQuantity_TNE.Value;
+ lu.CargoGrossQuantity_TNE = Math.Round((decimal)ladg.CargoGrossQuantity_TNE.Value, 3);
lu.CargoPortOfLoading = ladg.PortOfLoading;
lu.CargoPortOfDischarge = ladg.PortOfDischarge;
@@ -777,7 +777,7 @@ namespace bsmd.hisnord
hn_pre72.DateOfLastExpandedInspection = pre72h.DateOfLastExpandedInspection.Value;
hn_pre72.PlannedOperations = pre72h.PlannedOperations;
if (pre72h.PlannedPeriodOfStay_HUR.HasValue)
- hn_pre72.PlannedPeriodOfStay_HUR = (decimal)pre72h.PlannedPeriodOfStay_HUR.Value;
+ hn_pre72.PlannedPeriodOfStay_HUR = Math.Round((decimal)pre72h.PlannedPeriodOfStay_HUR.Value, 2);
hn_pre72.PlannedWorks = pre72h.PlannedWorks;
hn_pre72.Tanker = (pre72h.Tanker ?? false) ? yorntype.Y : yorntype.N;
@@ -792,7 +792,7 @@ namespace bsmd.hisnord
if (pre72h.TankerHullConfiguration.HasValue)
hn_pre72.TankerDetails.TankerHullConfiguration = (hullconfigtype)pre72h.TankerHullConfiguration.Value;
if (pre72h.VolumeOfCargo.HasValue && (pre72h.VolumeOfCargo > 0))
- hn_pre72.TankerDetails.VolumeOfCargo_TNE = (decimal)pre72h.VolumeOfCargo.Value;
+ hn_pre72.TankerDetails.VolumeOfCargo_TNE = Math.Round((decimal)pre72h.VolumeOfCargo.Value, 3);
hn_pre72.TankerDetails.VolumeOfCargo_TNESpecified = pre72h.VolumeOfCargo.HasValue;
}
else
@@ -1220,7 +1220,7 @@ namespace bsmd.hisnord
Waste waste = was.Waste[i];
if (waste.WasteDisposalAmount_MTQ.HasValue)
- hn_waste.WasteDisposalAmount_MTQ = (decimal)waste.WasteDisposalAmount_MTQ.Value;
+ hn_waste.WasteDisposalAmount_MTQ = Math.Round((decimal)waste.WasteDisposalAmount_MTQ.Value, 3);
hn_waste.WasteType = new wastetyp();
if (waste.WasteType.HasValue)
@@ -1233,15 +1233,15 @@ namespace bsmd.hisnord
hn_waste.WasteDetails = new wastedetails();
hn_waste.WasteDetails.WasteAmountGeneratedTillNextPort_MTQSpecified = true; // waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue;
// if (hn_waste.WasteDetails.WasteAmountGeneratedTillNextPort_MTQSpecified)
- hn_waste.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = (decimal) (waste.WasteAmountGeneratedTillNextPort_MTQ ?? 0);
+ hn_waste.WasteDetails.WasteAmountGeneratedTillNextPort_MTQ = Math.Round((decimal) (waste.WasteAmountGeneratedTillNextPort_MTQ ?? 0), 3);
hn_waste.WasteDetails.WasteAmountRetained_MTQSpecified = true; // waste.WasteAmountRetained_MTQ.HasValue;
// if (hn_waste.WasteDetails.WasteAmountRetained_MTQSpecified)
- hn_waste.WasteDetails.WasteAmountRetained_MTQ = (decimal) (waste.WasteAmountRetained_MTQ ?? 0);
+ hn_waste.WasteDetails.WasteAmountRetained_MTQ = Math.Round((decimal) (waste.WasteAmountRetained_MTQ ?? 0), 3);
hn_waste.WasteDetails.WasteCapacity_MTQSpecified = true; // waste.WasteCapacity_MTQ.HasValue;
// if (hn_waste.WasteDetails.WasteCapacity_MTQSpecified)
- hn_waste.WasteDetails.WasteCapacity_MTQ = (decimal) (waste.WasteCapacity_MTQ ?? 0);
+ hn_waste.WasteDetails.WasteCapacity_MTQ = Math.Round((decimal) (waste.WasteCapacity_MTQ ?? 0), 3);
hn_waste.WasteDetails.WasteDisposalPort = waste.WasteDisposalPort.IsNullOrEmpty() ? "ZZUKN" : waste.WasteDisposalPort;