From 811d8c1eb459e7faf1db7ed41775eceda591ef85 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sun, 3 Apr 2022 10:39:00 +0200 Subject: [PATCH 1/5] fixed Report error, fixed WAS_RCPT delete --- ENI2/DetailViewControls/WasteDetailControl.xaml.cs | 13 +++++++------ ENI2/Report/ReportDocument.cs | 6 +++++- bsmd.database/Properties/AssemblyProductInfo.cs | 2 +- bsmd.database/Properties/AssemblyProjectInfo.cs | 2 +- bsmd.hisnord/Request.cs | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs index 7d1e1890..3723b3d9 100644 --- a/ENI2/DetailViewControls/WasteDetailControl.xaml.cs +++ b/ENI2/DetailViewControls/WasteDetailControl.xaml.cs @@ -212,6 +212,7 @@ namespace ENI2.DetailViewControls { // are you sure dialog is in base class _wasRcptMessage.Elements.Remove(wasRCPT); + wasRCPT.DeleteElements(); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Delete(wasRCPT); DatabaseEntity.ResetIdentifiers(new List(_wasRcptMessage.Elements)); this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); @@ -241,10 +242,10 @@ namespace ENI2.DetailViewControls if (epd.ShowDialog() ?? false) { if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT)) - _wasRcptMessage.Elements.Add(epd.WAS_RCPT); - this.dataGridWasteReceipt.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); + _wasRcptMessage.Elements.Add(epd.WAS_RCPT); } + this.dataGridWasteReceipt.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); } private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e) @@ -335,10 +336,10 @@ namespace ENI2.DetailViewControls { if (!_selectedWAS_RCPT.WasteReceived.Any(wr => wr.WasteCode == ewrd.WasteReceived.WasteCode)) { - _selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived); - this.dataGridWasteReceived.Items.Refresh(); - this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); + _selectedWAS_RCPT.WasteReceived.Add(ewrd.WasteReceived); } + this.dataGridWasteReceived.Items.Refresh(); + this.SublistElementChanged(Message.NotificationClass.WAS_RCPT); } } diff --git a/ENI2/Report/ReportDocument.cs b/ENI2/Report/ReportDocument.cs index 12500578..4de02bcd 100644 --- a/ENI2/Report/ReportDocument.cs +++ b/ENI2/Report/ReportDocument.cs @@ -380,7 +380,8 @@ namespace ENI2.Report case Message.NotificationClass.TOWA: case Message.NotificationClass.TOWD: case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)): - { + case Message.NotificationClass.HAZD when (message.Elements[0] is HAZ hazd) && ((hazd.IMDGPositions.Count > 0) || (hazd.IBCPositions.Count > 0) || (hazd.IGCPositions.Count > 0) || (hazd.IMSBCPositions.Count > 0) || (hazd.MARPOLPositions.Count > 0)): + { // Landscape if not set if (_lastOrientation == Orientation.Portrait) { @@ -434,6 +435,9 @@ namespace ENI2.Report case Message.NotificationClass.HAZA when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)): CreateHAZPage(document, haz); return; + case Message.NotificationClass.HAZD when (message.Elements[0] is HAZ haz) && ((haz.IMDGPositions.Count > 0) || (haz.IBCPositions.Count > 0) || (haz.IGCPositions.Count > 0) || (haz.IMSBCPositions.Count > 0) || (haz.MARPOLPositions.Count > 0)): + CreateHAZPage(document, haz); + return; case Message.NotificationClass.WAS: CreateWASTable(document, message); return; diff --git a/bsmd.database/Properties/AssemblyProductInfo.cs b/bsmd.database/Properties/AssemblyProductInfo.cs index 6c462a7b..510fabfd 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.0.1")] +[assembly: AssemblyInformationalVersion("7.0.2")] [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 b1f00991..98fdcad6 100644 --- a/bsmd.database/Properties/AssemblyProjectInfo.cs +++ b/bsmd.database/Properties/AssemblyProjectInfo.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("7.0.1.*")] +[assembly: AssemblyVersion("7.0.2.*")] diff --git a/bsmd.hisnord/Request.cs b/bsmd.hisnord/Request.cs index 38973dc6..1708119a 100644 --- a/bsmd.hisnord/Request.cs +++ b/bsmd.hisnord/Request.cs @@ -1309,7 +1309,7 @@ namespace bsmd.hisnord for (int j = 0; j < was_rcpt.WasteReceived.Count; j++) { hn_was_rcpt.Items[i].WasteReceived[j] = new was_rcptWasteDeliveryReceiptWasteReceived(); - hn_was_rcpt.Items[i].WasteReceived[j].AmountWasteReceived_MTQ = (decimal) (was_rcpt.WasteReceived[j].AmountWasteReceived_MTQ ?? 0); + hn_was_rcpt.Items[i].WasteReceived[j].AmountWasteReceived_MTQ = decimal.Round((decimal) (was_rcpt.WasteReceived[j].AmountWasteReceived_MTQ ?? 0), 3); hn_was_rcpt.Items[i].WasteReceived[j].WasteType = new was_rcptWasteDeliveryReceiptWasteReceivedWasteType(); hn_was_rcpt.Items[i].WasteReceived[j].WasteType.WasteCode = was_rcpt.WasteReceived[j].WasteCode; if(!was_rcpt.WasteReceived[j].WasteDescription.IsNullOrEmpty()) From 176602c18493e2a7ffe0f4d5970fe0f998290782 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Sun, 3 Apr 2022 11:11:24 +0200 Subject: [PATCH 2/5] Korrekturen Excel einlesen Locode und Datum korrekt schreiben (Localtime) --- ENI2/ENI2.csproj | 2 +- ENI2/Excel/ExcelReader.cs | 7 +++- ENI2/Excel/ExcelWriter.cs | 2 +- bsmd.ExcelReadService/LocodeDB.cs | 66 +++++++++++++++++++------------ 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index cf7b29c0..7c4ecd43 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -37,7 +37,7 @@ true publish.html 0 - 7.0.1.0 + 7.0.2.0 false true true diff --git a/ENI2/Excel/ExcelReader.cs b/ENI2/Excel/ExcelReader.cs index 5828924b..81d065f0 100644 --- a/ENI2/Excel/ExcelReader.cs +++ b/ENI2/Excel/ExcelReader.cs @@ -77,8 +77,11 @@ namespace ENI2.Excel { val = val.ToUpper(); string portName = LocodeDB.PortNameFromLocode(val); - if(portName.IsNullOrEmpty()) - _log.WarnFormat("unknown Locode {0}", val); + if (portName.IsNullOrEmpty()) + { + _log.WarnFormat("unknown Locode {0}", val); + val = ""; + } } return val; } diff --git a/ENI2/Excel/ExcelWriter.cs b/ENI2/Excel/ExcelWriter.cs index 65756ece..580074c5 100644 --- a/ENI2/Excel/ExcelWriter.cs +++ b/ENI2/Excel/ExcelWriter.cs @@ -1379,7 +1379,7 @@ namespace ENI2.Excel { if(v != null) { - _nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToOADate(); // Test this I dont believe it + _nameDict[lookupName].RefersToRange.Value = ((DateTime) v).ToLocalTime().ToOADate(); } } diff --git a/bsmd.ExcelReadService/LocodeDB.cs b/bsmd.ExcelReadService/LocodeDB.cs index e5b18201..c8f40e7a 100644 --- a/bsmd.ExcelReadService/LocodeDB.cs +++ b/bsmd.ExcelReadService/LocodeDB.cs @@ -186,20 +186,29 @@ namespace ENI2.Locode if (locode.IsNullOrEmpty()) return null; if (locode.Length != 5) return null; - string result = null; - string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode); - - SQLiteCommand cmd = new SQLiteCommand(query, _con); - IDataReader reader = cmd.ExecuteReader(); - while (reader.Read()) + try { - if (!reader.IsDBNull(0)) - result = reader.GetString(0); - break; + + string result = null; + string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode); + + SQLiteCommand cmd = new SQLiteCommand(query, _con); + IDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + if (!reader.IsDBNull(0)) + result = reader.GetString(0); + break; + } + reader.Close(); + cmd.Dispose(); + return result; + } + catch (Exception ex) + { + _log.WarnFormat("error reading SSN location from locode: {0}", ex.ToString()); + return null; } - reader.Close(); - cmd.Dispose(); - return result; } @@ -212,21 +221,28 @@ namespace ENI2.Locode { if (locode.IsNullOrEmpty()) return null; if (locode.Length != 5) return null; - - string result = null; - string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'", - locode.Substring(2), locode.Substring(0, 2)); - SQLiteCommand cmd = new SQLiteCommand(query, _con); - IDataReader reader = cmd.ExecuteReader(); - while (reader.Read()) + try { - if (!reader.IsDBNull(0)) - result = reader.GetString(0); - break; + string result = null; + string query = string.Format("SELECT locodes.name_wo_diacritics FROM locodes JOIN countries ON locodes.country_id = countries.ID WHERE locodes.city_code = '{0}' AND countries.code = '{1}'", + locode.Substring(2), locode.Substring(0, 2)); + SQLiteCommand cmd = new SQLiteCommand(query, _con); + IDataReader reader = cmd.ExecuteReader(); + while (reader.Read()) + { + if (!reader.IsDBNull(0)) + result = reader.GetString(0); + break; + } + reader.Close(); + cmd.Dispose(); + return result; + } + catch(Exception ex) + { + _log.WarnFormat("error reading location from locode: {0}", ex.ToString()); + return null; } - reader.Close(); - cmd.Dispose(); - return result; } public static void CloseDB() From 966a311b53b94ddd612da1d0669be1a82cc1309d Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Tue, 5 Apr 2022 09:00:52 +0200 Subject: [PATCH 3/5] Version 7.0.2.1, Testversion mit ein paar Restpunkten in der LT Zeitansicht und dem PDF Report --- .../WasteDetailControl.xaml | 4 +- ENI2/ENI2.csproj | 4 +- ENI2/EditControls/EditWasteReceiptDialog.xaml | 6 +- .../EditWasteReceiptDialog.xaml.cs | 4 + ENI2/Report/ReportDocument.cs | 83 +++++++++---------- bsmd.database/Waste.cs | 2 +- 6 files changed, 53 insertions(+), 50 deletions(-) diff --git a/ENI2/DetailViewControls/WasteDetailControl.xaml b/ENI2/DetailViewControls/WasteDetailControl.xaml index 801a9a0b..bd8cbb7a 100644 --- a/ENI2/DetailViewControls/WasteDetailControl.xaml +++ b/ENI2/DetailViewControls/WasteDetailControl.xaml @@ -145,8 +145,8 @@ - - + + diff --git a/ENI2/ENI2.csproj b/ENI2/ENI2.csproj index 7c4ecd43..0efa3d38 100644 --- a/ENI2/ENI2.csproj +++ b/ENI2/ENI2.csproj @@ -36,8 +36,8 @@ 5.4.0.0 true publish.html - 0 - 7.0.2.0 + 1 + 7.0.2.1 false true true diff --git a/ENI2/EditControls/EditWasteReceiptDialog.xaml b/ENI2/EditControls/EditWasteReceiptDialog.xaml index c44e7399..d6ada39e 100644 --- a/ENI2/EditControls/EditWasteReceiptDialog.xaml +++ b/ENI2/EditControls/EditWasteReceiptDialog.xaml @@ -17,7 +17,9 @@ - + + + @@ -39,5 +41,7 @@ +