Merge branch 'release/eni_7.0.2'

This commit is contained in:
Daniel Schick 2022-04-08 10:49:41 +02:00
commit 8c9e415459
14 changed files with 131 additions and 91 deletions

View File

@ -145,8 +145,8 @@
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityName}" Binding="{Binding PortReceptionFacilityName}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textPortReceptionFacilityProviderName}" Binding="{Binding PortReceptionFacilityProviderName}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textTreatmentFacilityProviderName}" Binding="{Binding TreatmentFacilityProviderText}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateFrom}" Binding="{Binding WasteDeliveryDateFrom, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" Width="Auto" />
<DataGridTextColumn Header="{x:Static p:Resources.textWasteDeliveryDateTo}" Binding="{Binding WasteDeliveryDateTo, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" Width="Auto" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
<Grid Grid.Row="1">

View File

@ -170,6 +170,12 @@ namespace ENI2.DetailViewControls
this.dataGridWasteReceived.DeleteRequested += DataGridWasteReceived_DeleteRequested;
this.dataGridWasteReceived.CreateRequested += DataGridWasteReceived_CreateRequested;
if(this._wasRcptMessage.Elements.Count > 0)
{
this.dataGridWasteReceipt.SelectedItem = this._wasRcptMessage.Elements[0];
this.dataGridWasteReceipt_SelectionChanged(null, null);
}
#endregion
}
@ -182,6 +188,7 @@ namespace ENI2.DetailViewControls
epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.AddMissingWasteReceived();
epd.AddClicked += () =>
{
@ -192,6 +199,7 @@ namespace ENI2.DetailViewControls
epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.AddMissingWasteReceived();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
};
@ -200,9 +208,10 @@ namespace ENI2.DetailViewControls
if (!this._wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
this.dataGridWasteReceipt.Items.Refresh();
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
this.dataGridWasteReceived.ItemsSource = null;
this._selectedWAS_RCPT = null;
dataGridWasteReceipt_SelectionChanged(this, null);
}
}
@ -212,6 +221,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<DatabaseEntity>(_wasRcptMessage.Elements));
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
@ -235,6 +245,7 @@ namespace ENI2.DetailViewControls
epd.WAS_RCPT = new WAS_RCPT();
epd.WAS_RCPT.Identifier = WAS_RCPT.GetNewIdentifier(_wasRcptMessage.Elements);
epd.WAS_RCPT.MessageHeader = _wasRcptMessage;
epd.WAS_RCPT.AddMissingWasteReceived();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
};
@ -242,9 +253,11 @@ namespace ENI2.DetailViewControls
{
if (!_wasRcptMessage.Elements.Contains(epd.WAS_RCPT))
_wasRcptMessage.Elements.Add(epd.WAS_RCPT);
}
this.dataGridWasteReceipt.SelectedItem = epd.WAS_RCPT;
this.dataGridWasteReceipt.Items.Refresh();
this.SublistElementChanged(Message.NotificationClass.WAS_RCPT);
}
dataGridWasteReceipt_SelectionChanged(this, null);
}
private void DataGridWasteReceipt_AddingNewItem(object sender, AddingNewItemEventArgs e)
@ -336,11 +349,11 @@ 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);
}
}
}
private void DataGridWasteReceived_AddingNewItem(object sender, AddingNewItemEventArgs e)
{

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>7.0.1.0</ApplicationVersion>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>7.0.2.3</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -17,6 +17,8 @@
<RowDefinition Height="56" />
<RowDefinition Height="28" />
<RowDefinition Height="28" />
<RowDefinition Height="10" />
<RowDefinition Height="28" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -39,5 +41,7 @@
<xctk:DateTimePicker Grid.Row="4" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateFrom" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<xctk:DateTimePicker Grid.Row="5" Grid.Column="1" Name="dateTimePickerWasteDeliveryDateTo" Format="Custom" FormatString="dd.MM.yyyy HH:mm" ShowButtonSpinner="False" VerticalContentAlignment="Center" Margin="2" AllowTextInput="True" ContextMenu="{DynamicResource ClearContextMenu}" TextAlignment="Left" Minimum="1899.12.31 00:00" Maximum="2100.12.31 00:00" PreviewKeyUp="DateTimePicker_PreviewKeyUp"/>
<!--Button x:Name="buttonAddEntries" Grid.Column="1" Grid.Row="7" Margin="2" Click="buttonAddEntries_Click" Width="170" Content="Add waste received entries" HorizontalAlignment="Left"/-->
</Grid>
</enictrl:EditWindowBase>

View File

@ -52,5 +52,10 @@ namespace ENI2.EditControls
this.CopyValuesToEntity();
}
// private void buttonAddEntries_Click(object sender, RoutedEventArgs e)
// {
// this.WAS_RCPT.AddMissingWasteReceived();
// }
}
}

View File

@ -77,8 +77,11 @@ namespace ENI2.Excel
{
val = val.ToUpper();
string portName = LocodeDB.PortNameFromLocode(val);
if(portName.IsNullOrEmpty())
if (portName.IsNullOrEmpty())
{
_log.WarnFormat("unknown Locode {0}", val);
val = "";
}
}
return val;
}

View File

@ -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();
}
}

View File

@ -380,6 +380,7 @@ 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;
@ -1096,30 +1100,27 @@ namespace ENI2.Report
Table table = AddGrayTable(document);
table.AddColumn(290);
table.AddColumn(200);
_ = table.AddColumn(290);
_ = table.AddColumn(200);
Row row = table.AddRow();
row.Cells[0].AddParagraph("Valid exemption?");
row.Cells[1].AddParagraph("Confirmation of correctness");
row = table.AddRow();
row.Cells[0].AddParagraph(was.WasteDisposalValidExemption ?? false ? "Yes" : "No");
row.Cells[1].AddParagraph(was.ConfirmationOfCorrectness ?? false ? "Yes" : "No");
_ = row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
_ = row.Cells[1].AddParagraph(LocodeDB.PortNameFromLocode(was.LastWasteDisposalPort) ?? "");
_ = row = table.AddRow();
_ = row.Cells[0].AddParagraph("Date of last disposal");
if (was.LastWasteDisposalDate.HasValue)
row.Cells[1].AddParagraph(was.LastWasteDisposalDate?.ToShortDateString());
row = table.AddRow();
row.Cells[0].AddParagraph("Last port where waste or cargo residues were discharged");
row.Cells[1].AddParagraph("Date of last disposal");
row = table.AddRow();
row.Cells[0].AddParagraph(LocodeDB.PortNameFromLocode(was.LastWasteDisposalPort) ?? "");
if(was.LastWasteDisposalDate.HasValue)
row.Cells[1].AddParagraph(was.LastWasteDisposalDate?.ToShortDateString());
row = table.AddRow();
row.Cells[0].AddParagraph("Name of waste disposal service provider");
row.Cells[1].AddParagraph("Waste disposal order (all, some, none)");
row = table.AddRow();
_ = row.Cells[0].AddParagraph("Name of waste disposal service provider");
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
row.Cells[0].AddParagraph(((WasteDisposalServiceProvider) was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName);
row.Cells[1].AddParagraph(((WasteDisposalServiceProvider)was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName);
row = table.AddRow();
_ = row.Cells[0].AddParagraph("Next waste disposal port");
_ = row.Cells[1].AddParagraph(LocodeDB.PortNameFromLocode(was.NextWasteDisposalPort) ?? "");
table = document.LastSection.AddTable();
table.Rows.VerticalAlignment = VerticalAlignment.Top;
@ -1134,21 +1135,19 @@ namespace ENI2.Report
table.AddColumn(65);
table.AddColumn(65);
row = table.AddRow();
row.Cells[0].AddParagraph("TYPE");
row.Cells[1].AddParagraph("Description");
row.Cells[2].AddParagraph("Amount to be disposed");
row.Cells[3].AddParagraph("Maximum dedicated storage capacity on board");
row.Cells[4].AddParagraph("Amount retained on board");
row.Cells[5].AddParagraph("Port of delivery of remaining waste");
row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port");
_ = row.Cells[0].AddParagraph("TYPE");
_ = row.Cells[1].AddParagraph("Description");
_ = row.Cells[2].AddParagraph("Amount to be disposed");
_ = row.Cells[3].AddParagraph("Maximum dedicated storage capacity on board");
_ = row.Cells[4].AddParagraph("Amount retained on board");
_ = row.Cells[5].AddParagraph("Port of delivery of remaining waste");
_ = row.Cells[6].AddParagraph("Estimated waste/cargo residues amount generated between port of call and next port");
for (int i = 0; i < WAS.WasteCodes.Length; i++)
{
row = table.AddRow();
row.Cells[0].AddParagraph(string.Format("{0} {1}", WAS.WasteCodes[i], WAS.WasteCodeDescriptions[i]));
_ = row.Cells[0].AddParagraph(string.Format("{0} {1}", WAS.WasteCodes[i], WAS.WasteCodeDescriptions[i]));
if(Int32.TryParse(WAS.WasteCodes[i], out int wasteCode))
GetWasteForIndex(wasteCode, was, row);
}
@ -1162,12 +1161,12 @@ namespace ENI2.Report
if (!waste.WasteType.HasValue) continue; // kaputt!
if (waste.WasteType.Value == index)
{
row.Cells[1].AddParagraph(waste.WasteDescription ?? "");
row.Cells[2].AddParagraph(waste.WasteDisposalAmount_MTQ.HasValue ? waste.WasteDisposalAmount_MTQ.Value.ToString("N3") : "");
row.Cells[3].AddParagraph(waste.WasteCapacity_MTQ.HasValue ? waste.WasteCapacity_MTQ.Value.ToString("N3") : "");
row.Cells[4].AddParagraph(waste.WasteAmountRetained_MTQ.HasValue ? waste.WasteAmountRetained_MTQ.Value.ToString("N3") : "");
row.Cells[5].AddParagraph(LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) ?? "");
row.Cells[6].AddParagraph(waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue ? waste.WasteAmountGeneratedTillNextPort_MTQ.Value.ToString("N3") : "");
_ = row.Cells[1].AddParagraph(waste.WasteDescription ?? "");
_ = row.Cells[2].AddParagraph(waste.WasteDisposalAmount_MTQ.HasValue ? waste.WasteDisposalAmount_MTQ.Value.ToString("N3") : "");
_ = row.Cells[3].AddParagraph(waste.WasteCapacity_MTQ.HasValue ? waste.WasteCapacity_MTQ.Value.ToString("N3") : "");
_ = row.Cells[4].AddParagraph(waste.WasteAmountRetained_MTQ.HasValue ? waste.WasteAmountRetained_MTQ.Value.ToString("N3") : "");
_ = row.Cells[5].AddParagraph(LocodeDB.PortNameFromLocode(waste.WasteDisposalPort) ?? "");
_ = row.Cells[6].AddParagraph(waste.WasteAmountGeneratedTillNextPort_MTQ.HasValue ? waste.WasteAmountGeneratedTillNextPort_MTQ.Value.ToString("N3") : "");
}
}
}
@ -1197,10 +1196,10 @@ namespace ENI2.Report
row.Cells[1].AddParagraph(was_rpct.PortReceptionFacilityProviderName);
row = table.AddRow();
row.Cells[0].AddParagraph("Waste delivery from");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateFrom.HasValue ? was_rpct.WasteDeliveryDateFrom.ToString() : "");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateFrom.HasValue ? was_rpct.WasteDeliveryDateFrom.Value.ToLocalTime().ToString() : "");
row = table.AddRow();
row.Cells[0].AddParagraph("Waste delivery to");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateTo.HasValue ? was_rpct.WasteDeliveryDateTo.ToString() : "");
row.Cells[1].AddParagraph(was_rpct.WasteDeliveryDateTo.HasValue ? was_rpct.WasteDeliveryDateTo.Value.ToLocalTime().ToString() : "");
row = table.AddRow();
row.Cells[0].AddParagraph("Treatment facility provider");
row.Cells[1].AddParagraph(was_rpct.TreatmentFacilityProviderText);

View File

@ -186,6 +186,9 @@ namespace ENI2.Locode
if (locode.IsNullOrEmpty()) return null;
if (locode.Length != 5) return null;
try
{
string result = null;
string query = string.Format("SELECT LocationName FROM SSN_LOCODES WHERE LocationCode = '{0}'", locode);
@ -201,6 +204,12 @@ namespace ENI2.Locode
cmd.Dispose();
return result;
}
catch (Exception ex)
{
_log.WarnFormat("error reading SSN location from locode: {0}", ex.ToString());
return null;
}
}
/// <summary>
@ -212,7 +221,8 @@ namespace ENI2.Locode
{
if (locode.IsNullOrEmpty()) return null;
if (locode.Length != 5) return null;
try
{
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));
@ -228,6 +238,12 @@ namespace ENI2.Locode
cmd.Dispose();
return result;
}
catch(Exception ex)
{
_log.WarnFormat("error reading location from locode: {0}", ex.ToString());
return null;
}
}
public static void CloseDB()
{

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />

View File

@ -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("")]

View File

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

View File

@ -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())