Lookup für NST2007 Codes in LADG Detaildialog eingebaut.

Die dazu notwendigen Daten liegen in der SQLite Datenbank.
This commit is contained in:
Daniel Schick 2022-12-09 17:57:04 +01:00
parent ad5f873d04
commit d63cb8034d
10 changed files with 3132 additions and 25 deletions

View File

@ -106,6 +106,20 @@ namespace ENI2
} }
} }
public bool HasCriticalInfoMissing(out string messageText)
{
messageText = "";
// Hier haben wir Logik für Spezialfälle, z.B. dass für BRE und BRV bestimmte Meldeklassen gesendet werden *müssen*
if(this.Core.PoC.Equals("DEBRV") || this.Core.PoC.Equals("DEBRE"))
{
}
return false;
}
#endregion #endregion
#region Construction #region Construction

View File

@ -36,8 +36,8 @@
<MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion> <MinimumRequiredVersion>5.4.0.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish> <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage> <WebPage>publish.html</WebPage>
<ApplicationRevision>3</ApplicationRevision> <ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>7.6.0.%2a</ApplicationVersion> <ApplicationVersion>7.7.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>
@ -84,7 +84,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup /> <PropertyGroup />
<PropertyGroup> <PropertyGroup>
<ManifestCertificateThumbprint>F2C2D0164244EC89955EF50201EE24C2A300FF0B</ManifestCertificateThumbprint> <ManifestCertificateThumbprint>62DE8527C377957850DB503DA52FF66F664BD459</ManifestCertificateThumbprint>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignManifests>true</SignManifests> <SignManifests>true</SignManifests>

View File

@ -35,6 +35,8 @@ Copyright (c) 2017 schick Informatik
<Label Name="labelPortOfLoading" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfLoading}" /> <Label Name="labelPortOfLoading" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfLoading}" />
<Label Name="labelPortOfDischarge" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfDischarge}" /> <Label Name="labelPortOfDischarge" Grid.Row="5" Grid.Column="0" Content="{x:Static p:Resources.textCargoPortOfDischarge}" />
<Label Name="labelCodeNST3" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textCargoCodeNST3}" /> <Label Name="labelCodeNST3" Grid.Row="1" Grid.Column="2" Content="{x:Static p:Resources.textCargoCodeNST3}" />
<Label Name="labelSearchNST2007" Grid.Row="3" Grid.Column="2" Content="{x:Static p:Resources.textSearchNST}" HorizontalAlignment="Right" />
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/> <ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/> <ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="True"/>
@ -45,5 +47,19 @@ Copyright (c) 2017 schick Informatik
<enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" /> <enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" />
<enictrl:LocodeControl Grid.Column="1" Grid.Row="5" Width="Auto" x:Name="locodeControl_PortOfDischarge" /> <enictrl:LocodeControl Grid.Column="1" Grid.Row="5" Width="Auto" x:Name="locodeControl_PortOfDischarge" />
<TextBox Grid.Row="3" Grid.Column="3" Margin="2" Name="textBoxSearchNSTList" TextChanged="textBoxSearchNSTList_TextChanged" VerticalContentAlignment="Center" />
<Grid Grid.Row="4" Grid.Column="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="28" />
</Grid.ColumnDefinitions>
<ComboBox Name="comboBoxSelectNST2007ListItem" Margin="2" DisplayMemberPath="Key" />
<Button Name="buttonSetTemplate" Margin="2" Click="buttonSetTemplate_Click" BorderThickness="0" Background="Transparent" ToolTip="Apply template" HorizontalContentAlignment="Right" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
</StackPanel>
</Button>
</Grid>
</Grid> </Grid>
</enictrl:EditWindowBase> </enictrl:EditWindowBase>

View File

@ -2,13 +2,14 @@
// Description: LADG Bearbeitungsdialog // Description: LADG Bearbeitungsdialog
// //
using System;
using System.Linq;
using System.Windows; using System.Windows;
using System.Collections.Generic; using System.Collections.Generic;
using bsmd.database; using bsmd.database;
using ENI2.Controls; using ENI2.Controls;
using System.Collections.ObjectModel;
using System.Windows.Data;
namespace ENI2.EditControls namespace ENI2.EditControls
{ {
@ -30,10 +31,14 @@ namespace ENI2.EditControls
Properties.Resources.textDischarge Properties.Resources.textDischarge
}; };
private static List<KeyValuePair<string, string>> _nstList = null;
public EditLADGDialog() public EditLADGDialog()
{ {
InitializeComponent(); InitializeComponent();
Loaded += EditLADGDialog_Loaded; Loaded += EditLADGDialog_Loaded;
if (_nstList == null)
_nstList = LocalizedLookup.GetNST2007List();
} }
public LADG LADG { get; set; } public LADG LADG { get; set; }
@ -112,5 +117,35 @@ namespace ENI2.EditControls
#endregion #endregion
#region NST2007 list search/select event handler
private void textBoxSearchNSTList_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
if (textBoxSearchNSTList.Text.IsNullOrEmpty() || (textBoxSearchNSTList.Text.Length == 1))
{
this.comboBoxSelectNST2007ListItem.ItemsSource = null;
}
else
{
var result = _nstList.Where(kvp => kvp.Key.Contains(textBoxSearchNSTList.Text, StringComparison.OrdinalIgnoreCase));
this.comboBoxSelectNST2007ListItem.ItemsSource = result;
}
}
private void buttonSetTemplate_Click(object sender, RoutedEventArgs e)
{
if(this.comboBoxSelectNST2007ListItem.SelectedItem != null)
{
KeyValuePair<string, string> selectedTemplate = (KeyValuePair<string, string>) this.comboBoxSelectNST2007ListItem.SelectedItem;
if(selectedTemplate.Value.Length == 3)
{
this.comboBoxNSTCode.SelectedValue = selectedTemplate.Value.Substring(0, 2);
this.comboBoxNST3Code.SelectedValue = selectedTemplate.Value.Substring(2, 1);
}
}
}
#endregion
} }
} }

View File

@ -48,13 +48,13 @@ namespace ENI2
string query = string.Format("SELECT Code, PortArea FROM INFO_PortArea WHERE Locode = '{0}' ORDER BY PortArea", locode); string query = string.Format("SELECT Code, PortArea FROM INFO_PortArea WHERE Locode = '{0}' ORDER BY PortArea", locode);
SQLiteCommand cmd = new SQLiteCommand(query, _con); SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader(); IDataReader reader = cmd.ExecuteReader();
while(reader.Read()) while (reader.Read())
{ {
string code = null; string code = null;
string portarea = null; string portarea = null;
if (!reader.IsDBNull(0)) code = reader.GetString(0); if (!reader.IsDBNull(0)) code = reader.GetString(0);
if (!reader.IsDBNull(1)) portarea = reader.GetString(1); if (!reader.IsDBNull(1)) portarea = reader.GetString(1);
if((code != null) && (portarea != null)) if ((code != null) && (portarea != null))
{ {
result[code] = string.Format("{0}-{1}", code, portarea); result[code] = string.Format("{0}-{1}", code, portarea);
} }
@ -68,7 +68,7 @@ namespace ENI2
if (locode.IsNullOrEmpty() || portArea.IsNullOrEmpty()) return false; if (locode.IsNullOrEmpty() || portArea.IsNullOrEmpty()) return false;
string query = string.Format("SELECT COUNT(*) FROM INFO_PortArea WHERE Locode = '{0}' AND Code = '{1}'", locode, portArea); string query = string.Format("SELECT COUNT(*) FROM INFO_PortArea WHERE Locode = '{0}' AND Code = '{1}'", locode, portArea);
SQLiteCommand cmd = new SQLiteCommand(query, _con); SQLiteCommand cmd = new SQLiteCommand(query, _con);
long numResults = (long) cmd.ExecuteScalar(); long numResults = (long)cmd.ExecuteScalar();
return numResults > 0; return numResults > 0;
} }
@ -85,7 +85,7 @@ namespace ENI2
string query = string.Format("SELECT Code, Name FROM Nationality ORDER BY Code"); string query = string.Format("SELECT Code, Name FROM Nationality ORDER BY Code");
SQLiteCommand cmd = new SQLiteCommand(query, _con); SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader(); IDataReader reader = cmd.ExecuteReader();
while(reader.Read()) while (reader.Read())
{ {
string code = null; string code = null;
string name = null; string name = null;
@ -142,7 +142,7 @@ namespace ENI2
string query = string.Format("SELECT PortArea from INFO_PortArea WHERE Code = '{0}'", code); string query = string.Format("SELECT PortArea from INFO_PortArea WHERE Code = '{0}'", code);
SQLiteCommand cmd = new SQLiteCommand(query, _con); SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader(); IDataReader reader = cmd.ExecuteReader();
if(reader.Read()) if (reader.Read())
{ {
if (!reader.IsDBNull(0)) result = reader.GetString(0); if (!reader.IsDBNull(0)) result = reader.GetString(0);
} }
@ -182,7 +182,7 @@ namespace ENI2
if (!reader.IsDBNull(0)) code = reader.GetInt32(0); if (!reader.IsDBNull(0)) code = reader.GetInt32(0);
if (!reader.IsDBNull(1)) name = reader.GetString(1); if (!reader.IsDBNull(1)) name = reader.GetString(1);
if ((code != null) && (name != null)) if ((code != null) && (name != null))
result[(int) code] = string.Format("{0} {1}", code, name); result[(int)code] = string.Format("{0} {1}", code, name);
} }
reader.Close(); reader.Close();
return result; return result;
@ -269,5 +269,24 @@ namespace ENI2
return result; return result;
} }
public static List<KeyValuePair<string, string>> GetNST2007List()
{
List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
string query = string.Format("SELECT Description, NST2007 FROM LADG_NST2007 ORDER BY Description");
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if (reader.IsDBNull(0)) continue;
string desc = reader.GetString(0);
string code = reader.GetString(1);
KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(desc, code);
result.Add(kvp);
}
reader.Close();
return result;
}
} }
} }

View File

@ -4245,6 +4245,15 @@ namespace ENI2.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Search NST2007 list.
/// </summary>
public static string textSearchNST {
get {
return ResourceManager.GetString("textSearchNST", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to SEC - Security. /// Looks up a localized string similar to SEC - Security.
/// </summary> /// </summary>

View File

@ -1855,4 +1855,7 @@
<data name="textEditor" xml:space="preserve"> <data name="textEditor" xml:space="preserve">
<value>Editor</value> <value>Editor</value>
</data> </data>
<data name="textSearchNST" xml:space="preserve">
<value>Search NST2007 list</value>
</data>
</root> </root>

3011
misc/LADG_NST2007.csv Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.