3.6.10: Kleinigkeiten und ein paar Modifikationen beim Versand
NEU: SystemError
This commit is contained in:
parent
362f0f4285
commit
5f6f61e54e
@ -69,6 +69,7 @@ namespace ENI2
|
||||
STAT.VesselTypeDict = LocalizedLookup.getVesselTypes();
|
||||
STAT.TransportModeDict = LocalizedLookup.getTransportModes();
|
||||
HAZ.PackageTypes = LocalizedLookup.getPackageTypes();
|
||||
LADG.LACodes = LocalizedLookup.getLACodes();
|
||||
|
||||
// Connect to locking service (if enabled)
|
||||
|
||||
|
||||
@ -84,8 +84,12 @@ namespace ENI2.Controls
|
||||
{
|
||||
ComboBox cmb = sender as ComboBox;
|
||||
if (cmb == null) return;
|
||||
if (cmb.ItemsSource == null) return;
|
||||
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
|
||||
bool ignoreSelect = ((e.Key == System.Windows.Input.Key.Back) || (e.Key == System.Windows.Input.Key.Delete));
|
||||
|
||||
itemsViewOriginal.Filter = ((o) =>
|
||||
{
|
||||
bool result = false;
|
||||
@ -98,7 +102,10 @@ namespace ENI2.Controls
|
||||
if(o is System.Collections.Generic.KeyValuePair<string, string>)
|
||||
if(((System.Collections.Generic.KeyValuePair<string, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
if(o is string)
|
||||
if(o is System.Collections.Generic.KeyValuePair<int, string>)
|
||||
if (((System.Collections.Generic.KeyValuePair<int, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
if (o is string)
|
||||
if (((string)o).Contains(cmb.Text, StringComparison.OrdinalIgnoreCase)) result = true;
|
||||
}
|
||||
//System.Diagnostics.Trace.WriteLine(string.Format("{0} - {1} - {2}", o, cmb.Text, result));
|
||||
@ -108,7 +115,7 @@ namespace ENI2.Controls
|
||||
//System.Diagnostics.Trace.WriteLine("---");
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if (itemsViewOriginal.Count == 1)
|
||||
if (!ignoreSelect && (itemsViewOriginal.Count == 1))
|
||||
{
|
||||
// Treffer: Select?
|
||||
cmb.SelectedItem = itemsViewOriginal.GetItemAt(0);
|
||||
|
||||
@ -215,12 +215,17 @@ namespace ENI2
|
||||
|
||||
#region combobox content filtering
|
||||
|
||||
|
||||
protected void ComboBox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
|
||||
ComboBox cmb = sender as ComboBox;
|
||||
if (cmb == null) return;
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
|
||||
bool ignoreSelect = ((e.Key == System.Windows.Input.Key.Back) || (e.Key == System.Windows.Input.Key.Delete));
|
||||
|
||||
CollectionView itemsViewOriginal = (CollectionView)CollectionViewSource.GetDefaultView(cmb.ItemsSource);
|
||||
System.Diagnostics.Trace.WriteLine(cmb.Text);
|
||||
itemsViewOriginal.Filter = ((o) =>
|
||||
{
|
||||
bool result = false;
|
||||
@ -236,13 +241,13 @@ namespace ENI2
|
||||
{
|
||||
if (((System.Collections.Generic.KeyValuePair<string, string>)o).Value.StartsWith(cmb.Text, StringComparison.OrdinalIgnoreCase))
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if(itemsViewOriginal.Count == 1)
|
||||
itemsViewOriginal.Refresh();
|
||||
|
||||
if (!ignoreSelect && (itemsViewOriginal.Count == 1))
|
||||
{
|
||||
// Treffer: Select?
|
||||
cmb.SelectedItem = itemsViewOriginal.GetItemAt(0);
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<TextBlock Name="textBlockLockUserName" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<Button IsEnabled="False" Name="buttonStorno" Grid.Column="1" Grid.Row="6" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}"/>
|
||||
<Button IsEnabled="True" Name="buttonStorno" Grid.Column="1" Grid.Row="6" Margin="2" Click="buttonStorno_Click" Content="{x:Static p:Resources.textCancelDeclaration}"/>
|
||||
<Button IsEnabled="False" Name="buttonCopy" Grid.Column="2" Grid.Row="6" Margin="2" Click="buttonCopy_Click" Content="{x:Static p:Resources.textCopyData}"/>
|
||||
<Button IsEnabled="False" Name="buttonSendPDF" Grid.Column="3" Grid.Row="6" Margin="2" Click="buttonSendPDF_Click" Content="{x:Static p:Resources.textCreatePDF}"/>
|
||||
<Button Name="buttonQueryHIS" Grid.Column="4" Grid.Row="6" Margin="2" Click="buttonQueryHIS_Click" Content="{x:Static p:Resources.textQueryHIS}"/>
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
<!-- Data Grid -->
|
||||
<DataGrid Grid.Row="8" Grid.ColumnSpan="6" Margin="0,8,0,0" x:Name="dataGridMessages" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" CanUserAddRows="False"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
|
||||
SelectionMode="Extended" AutoGenerateColumns="False" MouseDoubleClick="dataGrid_MouseDoubleClick" PreviewKeyDown="dataGrid_PreviewKeyDown">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header=" " Width="SizeToCells" IsReadOnly="True">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
|
||||
@ -191,13 +191,23 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
#region Context-Menu Meldeklassen
|
||||
|
||||
// wenn man das mal aufwendig "schön" machen will (die Items enabled abh. vom Zustand der Meldeklasse) sollte man
|
||||
// Command Bindings verwenden. Hier ist das erklärt: https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/commanding-overview#code-snippet-2
|
||||
|
||||
this.dataGridMessages.ContextMenu = new ContextMenu();
|
||||
MenuItem sendItem = new MenuItem();
|
||||
sendItem.Header = Properties.Resources.textSendToNSW;
|
||||
sendItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_forward.png")) };
|
||||
//sendItem.Command =
|
||||
sendItem.Click += new RoutedEventHandler(this.contextSendMessage);
|
||||
this.dataGridMessages.ContextMenu.Items.Add(sendItem);
|
||||
|
||||
MenuItem resetItem = new MenuItem();
|
||||
resetItem.Header = Properties.Resources.textReset;
|
||||
resetItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/mail_delete.png")) };
|
||||
resetItem.Click += new RoutedEventHandler(this.contextResetMessage);
|
||||
this.dataGridMessages.ContextMenu.Items.Add(resetItem);
|
||||
|
||||
#endregion
|
||||
|
||||
#region init ATA
|
||||
@ -346,12 +356,47 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
private void contextSendMessage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("not yet..");
|
||||
//MessageBox.Show("not yet..");
|
||||
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmSend, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
|
||||
{
|
||||
selectedMessage.InternalStatus = Message.BSMDStatus.TOSEND;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
|
||||
}
|
||||
|
||||
// komplette Anmeldung auf "zu versenden" stellen
|
||||
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
|
||||
}
|
||||
}
|
||||
|
||||
private void contextResetMessage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmReset, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
foreach (Message selectedMessage in this.dataGridMessages.SelectedItems)
|
||||
{
|
||||
selectedMessage.Reset = true;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(selectedMessage);
|
||||
}
|
||||
|
||||
// komplette Anmeldung auf "zu versenden" stellen
|
||||
this.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStorno_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
MessageBoxResult result = MessageBox.Show(Properties.Resources.textConfirmCancel, Properties.Resources.textConfirm, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
this.Core.Cancelled = true;
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(this.Core);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCopy_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@ -124,13 +124,19 @@ namespace ENI2.DetailViewControls
|
||||
_noa_nod.CallPurposes.Add(ecpd.CallPurpose);
|
||||
this.dataGridCallPurposes.Items.Refresh();
|
||||
ecpd.CallPurpose = new CallPurpose();
|
||||
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
|
||||
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
|
||||
};
|
||||
ecpd.CallPurpose = new CallPurpose();
|
||||
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
|
||||
|
||||
if(ecpd.ShowDialog() ?? false)
|
||||
{
|
||||
if(!_noa_nod.CallPurposes.Contains(ecpd.CallPurpose))
|
||||
_noa_nod.CallPurposes.Add(ecpd.CallPurpose);
|
||||
this.dataGridCallPurposes.Items.Refresh();
|
||||
// signal up
|
||||
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,6 +156,8 @@ namespace ENI2.DetailViewControls
|
||||
_noa_nod.CallPurposes.Add(ecpd.CallPurpose);
|
||||
this.dataGridCallPurposes.Items.Refresh();
|
||||
ecpd.CallPurpose = new CallPurpose();
|
||||
ecpd.CallPurpose.NOA_NOD = this._noa_nod;
|
||||
this.SublistElementChanged(Message.NotificationClass.NOA_NOD);
|
||||
};
|
||||
if (ecpd.ShowDialog() ?? false)
|
||||
{
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>2</ApplicationRevision>
|
||||
<ApplicationVersion>3.6.9.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>3.6.10.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
@ -550,6 +550,7 @@
|
||||
<None Include="Resources\mail_new.png" />
|
||||
<Resource Include="Resources\document_view.png" />
|
||||
<Resource Include="Resources\mail_forward.png" />
|
||||
<Resource Include="Resources\mail_delete.png" />
|
||||
<Content Include="x64\SQLite.Interop.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@ -36,10 +36,10 @@ Copyright (c) 2017 schick Informatik
|
||||
<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}" />
|
||||
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" Name="comboBoxHandlingType" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="3" Name="comboBoxLACodes" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" IsEditable="True" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
|
||||
<xctk:IntegerUpDown Grid.Row="2" Grid.Column="1" Name="integerUpDownNumberOfItems" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" />
|
||||
<xctk:DoubleUpDown Grid.Row="3" Grid.Column="1" Name="doubleUpDownGrossQuantity" ShowButtonSpinner="False" ParsingNumberStyle="Any" Margin="2,2,2,2" FormatString="N1"/>
|
||||
<enictrl:LocodeControl Grid.Column="1" Grid.Row="4" Width="Auto" x:Name="locodeControl_PortOfLoading" />
|
||||
|
||||
@ -3,9 +3,11 @@
|
||||
//
|
||||
|
||||
using System.Windows;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using bsmd.database;
|
||||
using ENI2.Controls;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace ENI2.EditControls
|
||||
{
|
||||
@ -28,7 +30,7 @@ namespace ENI2.EditControls
|
||||
Loaded += EditLADGDialog_Loaded;
|
||||
}
|
||||
|
||||
public LADG LADG { get; set; }
|
||||
public LADG LADG { get; set; }
|
||||
|
||||
#region event handler
|
||||
|
||||
@ -37,18 +39,21 @@ namespace ENI2.EditControls
|
||||
this.OKClicked += EditLADGDialog_OKClicked;
|
||||
|
||||
this.comboBoxHandlingType.ItemsSource = handlingTypeList;
|
||||
this.comboBoxLACodes.ItemsSource = LaCodes;
|
||||
this.comboBoxHandlingType.KeyUp += ComboBox_KeyUp;
|
||||
this.comboBoxLACodes.ItemsSource = LocalizedLookup.getLACodes();
|
||||
this.comboBoxLACodes.KeyUp += ComboBox_KeyUp;
|
||||
|
||||
if (this.LADG.CargoHandlingType.HasValue)
|
||||
this.comboBoxHandlingType.SelectedIndex = this.LADG.CargoHandlingType.Value;
|
||||
|
||||
this.integerUpDownNumberOfItems.Value = this.LADG.CargoNumberOfItems;
|
||||
this.doubleUpDownGrossQuantity.Value = this.LADG.CargoGrossQuantity_TNE;
|
||||
this.locodeControl_PortOfLoading.LocodeValue = this.LADG.PortOfLoading;
|
||||
this.locodeControl_PortOfDischarge.LocodeValue = this.LADG.PortOfDischarge;
|
||||
this.comboBoxLACodes.SelectedItem = LACodeEntryForCode(this.LADG.CargoLACode);
|
||||
|
||||
|
||||
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
|
||||
this.comboBoxLACodes.KeyUp += ComboBox_KeyUp;
|
||||
|
||||
this.comboBoxNST3Code.KeyUp += ComboBox_KeyUp;
|
||||
}
|
||||
|
||||
private void EditLADGDialog_OKClicked()
|
||||
@ -58,58 +63,10 @@ namespace ENI2.EditControls
|
||||
this.LADG.CargoGrossQuantity_TNE = this.doubleUpDownGrossQuantity.Value;
|
||||
this.LADG.PortOfLoading = this.locodeControl_PortOfLoading.LocodeValue;
|
||||
this.LADG.PortOfDischarge = this.locodeControl_PortOfDischarge.LocodeValue;
|
||||
this.LADG.CargoLACode = (this.comboBoxLACodes.SelectedIndex < 0) ? null : (int?) ((LACodeEntry)this.comboBoxLACodes.SelectedValue).Code;
|
||||
this.LADG.CargoLACode = (this.comboBoxLACodes.SelectedIndex < 0) ? null : (int?) (this.comboBoxLACodes.SelectedValue);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region class LACodeEntry
|
||||
|
||||
private static LACodeEntry[] LaCodes =
|
||||
{
|
||||
new LACodeEntry(10, "unverpacktes Flüssiggut"),
|
||||
new LACodeEntry(20, "unverpacktes Schüttgut"),
|
||||
new LACodeEntry(30, "unverpacktes oder konventionell verpacktes Stückgut (Stückgut nicht in Containern >= 20 Fuß und nicht auf Ro-Ro-Einheiten)"),
|
||||
new LACodeEntry(31, "Kfz als Handelsgüter"),
|
||||
new LACodeEntry(32, "lebende Tiere als Handelsgüter"),
|
||||
new LACodeEntry(41, "20-Fuß-Container"),
|
||||
new LACodeEntry(42, "40-Fuß-Container"),
|
||||
new LACodeEntry(43, "Container zwischen 20 und 40 Fuß"),
|
||||
new LACodeEntry(44, "Container größer als 40 Fuß"),
|
||||
new LACodeEntry(51, "Straßengüterfahrzeuge einschl. deren Anhänger"),
|
||||
new LACodeEntry(52, "Pkw einschl. deren Anhänger, Krafträder"),
|
||||
new LACodeEntry(53, "Omnibusse"),
|
||||
new LACodeEntry(61, "Anhänger / Sattelauflieger für Straßengüterfahrzeuge"),
|
||||
new LACodeEntry(62, "Sonstige Anhänger von Straßenfahrzeugen (ohne Zugmaschine) und nicht selbstfahrende Straßenfahrzeuge"),
|
||||
new LACodeEntry(63, "Rolltrailer (Anhänger für die Güterbeförderung auf See"),
|
||||
new LACodeEntry(64, "Trägerschiffsleichter"),
|
||||
new LACodeEntry(65, "Wechselbrücken / -behälter"),
|
||||
new LACodeEntry(66, "Eisenbahngüterwagen"),
|
||||
new LACodeEntry(67, "Reisezugwagen und Triebwagen")
|
||||
};
|
||||
|
||||
private static LACodeEntry LACodeEntryForCode(int? code)
|
||||
{
|
||||
if (!code.HasValue) return null;
|
||||
for (int i = 0; i < LaCodes.Length; i++)
|
||||
if (LaCodes[i].Code == code) return LaCodes[i];
|
||||
return null;
|
||||
}
|
||||
|
||||
public class LACodeEntry
|
||||
{
|
||||
public int Code;
|
||||
public string Description;
|
||||
|
||||
public LACodeEntry(int code, string description) { Code = code; Description = description; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} - {1}", this.Code, this.Description);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,5 +135,24 @@ namespace ENI2
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Dictionary<int, string> getLACodes()
|
||||
{
|
||||
Dictionary<int, string> result = new Dictionary<int, string>();
|
||||
string query = string.Format("SELECT Code, Description FROM LATypes ORDER BY Code");
|
||||
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||
IDataReader reader = cmd.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
int? code = null;
|
||||
string name = null;
|
||||
if (!reader.IsDBNull(0)) code = reader.GetInt32(0);
|
||||
if (!reader.IsDBNull(1)) name = reader.GetString(1);
|
||||
if ((code != null) && (name != null))
|
||||
result[(int) code] = string.Format("{0} {1}", code, name);
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
55
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
55
ENI-2/ENI2/ENI2/Properties/Resources.Designer.cs
generated
@ -390,6 +390,16 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap mail_delete {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("mail_delete", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -968,6 +978,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Confirmation.
|
||||
/// </summary>
|
||||
public static string textConfirm {
|
||||
get {
|
||||
return ResourceManager.GetString("textConfirm", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Confirmation.
|
||||
/// </summary>
|
||||
@ -977,6 +996,33 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cancel this declaration?.
|
||||
/// </summary>
|
||||
public static string textConfirmCancel {
|
||||
get {
|
||||
return ResourceManager.GetString("textConfirmCancel", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reset messages?.
|
||||
/// </summary>
|
||||
public static string textConfirmReset {
|
||||
get {
|
||||
return ResourceManager.GetString("textConfirmReset", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Send messages?.
|
||||
/// </summary>
|
||||
public static string textConfirmSend {
|
||||
get {
|
||||
return ResourceManager.GetString("textConfirmSend", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Construction characteristics.
|
||||
/// </summary>
|
||||
@ -2939,6 +2985,15 @@ namespace ENI2.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reset.
|
||||
/// </summary>
|
||||
public static string textReset {
|
||||
get {
|
||||
return ResourceManager.GetString("textReset", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ResidencePermit.
|
||||
/// </summary>
|
||||
|
||||
@ -1354,4 +1354,22 @@
|
||||
<data name="textArchived" xml:space="preserve">
|
||||
<value>Archived</value>
|
||||
</data>
|
||||
<data name="textReset" xml:space="preserve">
|
||||
<value>Reset</value>
|
||||
</data>
|
||||
<data name="mail_delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\mail_delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="textConfirm" xml:space="preserve">
|
||||
<value>Confirmation</value>
|
||||
</data>
|
||||
<data name="textConfirmReset" xml:space="preserve">
|
||||
<value>Reset messages?</value>
|
||||
</data>
|
||||
<data name="textConfirmSend" xml:space="preserve">
|
||||
<value>Send messages?</value>
|
||||
</data>
|
||||
<data name="textConfirmCancel" xml:space="preserve">
|
||||
<value>Cancel this declaration?</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
ENI-2/ENI2/ENI2/Resources/mail_delete.png
Normal file
BIN
ENI-2/ENI2/ENI2/Resources/mail_delete.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@ -4,9 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ENI2.Util
|
||||
{
|
||||
|
||||
Binary file not shown.
15
nsw/Source/SQL/SystemError.sql
Normal file
15
nsw/Source/SQL/SystemError.sql
Normal file
@ -0,0 +1,15 @@
|
||||
CREATE TABLE [dbo].[SystemError] (
|
||||
[Id] UNIQUEIDENTIFIER DEFAULT (newid()) NOT NULL,
|
||||
[ErrorAt] DATETIME NULL,
|
||||
[MeldeType] NVARCHAR (50) NULL,
|
||||
[ReferenceId] NVARCHAR (50) NULL,
|
||||
[ProcessStatus] INT NULL,
|
||||
[ImportFilename] NVARCHAR (255) NULL,
|
||||
[ErrorCode] INT NULL,
|
||||
[ErrorMessage] NVARCHAR (255) NULL,
|
||||
[ErrorDescription] NVARCHAR (255) NULL,
|
||||
[MessageCoreId] UNIQUEIDENTIFIER NULL,
|
||||
[Status] TINYINT NULL,
|
||||
PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
||||
@ -110,6 +110,8 @@ namespace SendNSWMessageService
|
||||
else
|
||||
{
|
||||
|
||||
#region DBH / Dakosy Logik
|
||||
|
||||
List<Message> toSendMessageList = new List<Message>();
|
||||
|
||||
if ((core.IsTransit && core.TransitId.IsNullOrEmpty()) ||
|
||||
@ -259,6 +261,8 @@ namespace SendNSWMessageService
|
||||
}
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,11 +273,7 @@ namespace SendNSWMessageService
|
||||
core.QueryNSWStatus = false; // reset flag
|
||||
Status aStatus = new Status(core);
|
||||
aStatus.PerformQuery();
|
||||
}
|
||||
|
||||
// Auf erhaltene Visit-Ids prüfen (HIS-NORD)
|
||||
// TODO
|
||||
// bsmd.hisnord.Response.ReadAnswers();
|
||||
}
|
||||
|
||||
DBManager.Instance.Disconnect();
|
||||
|
||||
|
||||
@ -438,12 +438,13 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IMDGPosition imdgPosition = haza.GetIMDGPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IMDG-{0}", i);
|
||||
IMDGPosition imdgPosition = haza.GetIMDGPositionWithIdentifier(posIdent);
|
||||
if(imdgPosition == null)
|
||||
{
|
||||
imdgPosition = new IMDGPosition();
|
||||
imdgPosition.HAZ = haza;
|
||||
imdgPosition.Identifier = i.ToString();
|
||||
imdgPosition.Identifier = posIdent;
|
||||
haza.IMDGPositions.Add(imdgPosition);
|
||||
}
|
||||
|
||||
@ -497,11 +498,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IBCPosition ibcPosition = haza.GetIBCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IBC-{0}", i);
|
||||
IBCPosition ibcPosition = haza.GetIBCPositionWithIdentifier(posIdent);
|
||||
if(ibcPosition == null)
|
||||
{
|
||||
ibcPosition = new IBCPosition();
|
||||
ibcPosition.Identifier = i.ToString();
|
||||
ibcPosition.Identifier = posIdent;
|
||||
ibcPosition.HAZ = haza;
|
||||
haza.IBCPositions.Add(ibcPosition);
|
||||
}
|
||||
@ -547,11 +549,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IGCPosition igcPosition = haza.GetIGCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IGC-{0}", i);
|
||||
IGCPosition igcPosition = haza.GetIGCPositionWithIdentifier(posIdent);
|
||||
if(igcPosition == null)
|
||||
{
|
||||
igcPosition = new IGCPosition();
|
||||
igcPosition.Identifier = i.ToString();
|
||||
igcPosition.Identifier = posIdent;
|
||||
igcPosition.HAZ = haza;
|
||||
haza.IGCPositions.Add(igcPosition);
|
||||
}
|
||||
@ -586,11 +589,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IMSBCPosition imsbcPosition = haza.GetIMSBCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IMSBC-{0}", i);
|
||||
IMSBCPosition imsbcPosition = haza.GetIMSBCPositionWithIdentifier(posIdent);
|
||||
if(imsbcPosition == null)
|
||||
{
|
||||
imsbcPosition = new IMSBCPosition();
|
||||
imsbcPosition.Identifier = i.ToString();
|
||||
imsbcPosition.Identifier = posIdent;
|
||||
imsbcPosition.HAZ = haza;
|
||||
haza.IMSBCPositions.Add(imsbcPosition);
|
||||
}
|
||||
@ -626,11 +630,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
MARPOL_Annex_I_Position marpolPosition = haza.GetMARPOLPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("MARPOL-{0}", i);
|
||||
MARPOL_Annex_I_Position marpolPosition = haza.GetMARPOLPositionWithIdentifier(posIdent);
|
||||
if(marpolPosition == null)
|
||||
{
|
||||
marpolPosition = new MARPOL_Annex_I_Position();
|
||||
marpolPosition.Identifier = i.ToString();
|
||||
marpolPosition.Identifier = posIdent;
|
||||
marpolPosition.HAZ = haza;
|
||||
haza.MARPOLPositions.Add(marpolPosition);
|
||||
}
|
||||
@ -737,12 +742,13 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IMDGPosition imdgPosition = hazd.GetIMDGPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IMDG-{0}", i);
|
||||
IMDGPosition imdgPosition = hazd.GetIMDGPositionWithIdentifier(posIdent);
|
||||
if (imdgPosition == null)
|
||||
{
|
||||
imdgPosition = new IMDGPosition();
|
||||
imdgPosition.HAZ = hazd;
|
||||
imdgPosition.Identifier = i.ToString();
|
||||
imdgPosition.Identifier = posIdent;
|
||||
hazd.IMDGPositions.Add(imdgPosition);
|
||||
}
|
||||
|
||||
@ -796,11 +802,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IBCPosition ibcPosition = hazd.GetIBCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IBC-{0}", i);
|
||||
IBCPosition ibcPosition = hazd.GetIBCPositionWithIdentifier(posIdent);
|
||||
if (ibcPosition == null)
|
||||
{
|
||||
ibcPosition = new IBCPosition();
|
||||
ibcPosition.Identifier = i.ToString();
|
||||
ibcPosition.Identifier = posIdent;
|
||||
ibcPosition.HAZ = hazd;
|
||||
hazd.IBCPositions.Add(ibcPosition);
|
||||
}
|
||||
@ -846,11 +853,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IGCPosition igcPosition = hazd.GetIGCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IGC-{0}", i);
|
||||
IGCPosition igcPosition = hazd.GetIGCPositionWithIdentifier(posIdent);
|
||||
if (igcPosition == null)
|
||||
{
|
||||
igcPosition = new IGCPosition();
|
||||
igcPosition.Identifier = i.ToString();
|
||||
igcPosition.Identifier = posIdent;
|
||||
igcPosition.HAZ = hazd;
|
||||
hazd.IGCPositions.Add(igcPosition);
|
||||
}
|
||||
@ -885,11 +893,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
IMSBCPosition imsbcPosition = hazd.GetIMSBCPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("IMSBC-{0}", i);
|
||||
IMSBCPosition imsbcPosition = hazd.GetIMSBCPositionWithIdentifier(posIdent);
|
||||
if (imsbcPosition == null)
|
||||
{
|
||||
imsbcPosition = new IMSBCPosition();
|
||||
imsbcPosition.Identifier = i.ToString();
|
||||
imsbcPosition.Identifier = posIdent;
|
||||
imsbcPosition.HAZ = hazd;
|
||||
hazd.IMSBCPositions.Add(imsbcPosition);
|
||||
}
|
||||
@ -925,11 +934,12 @@ namespace bsmd.ExcelReadService
|
||||
continue;
|
||||
}
|
||||
|
||||
MARPOL_Annex_I_Position marpolPosition = hazd.GetMARPOLPositionWithIdentifier(i.ToString());
|
||||
string posIdent = string.Format("MARPOL-{0}", i);
|
||||
MARPOL_Annex_I_Position marpolPosition = hazd.GetMARPOLPositionWithIdentifier(posIdent);
|
||||
if (marpolPosition == null)
|
||||
{
|
||||
marpolPosition = new MARPOL_Annex_I_Position();
|
||||
marpolPosition.Identifier = i.ToString();
|
||||
marpolPosition.Identifier = posIdent;
|
||||
marpolPosition.HAZ = hazd;
|
||||
hazd.MARPOLPositions.Add(marpolPosition);
|
||||
}
|
||||
|
||||
@ -102,13 +102,7 @@ namespace bsmd.database
|
||||
|
||||
public string Identifier { get; set; }
|
||||
|
||||
public static Lazy<Dictionary<int, string>> LACodes
|
||||
{
|
||||
get
|
||||
{
|
||||
return laCodes;
|
||||
}
|
||||
}
|
||||
public static Dictionary<int, string> LACodes { get; set; }
|
||||
|
||||
public static Dictionary<int, string> CargoHandlingDict
|
||||
{
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.6.9")]
|
||||
[assembly: AssemblyInformationalVersion("3.6.10")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.6.9.*")]
|
||||
[assembly: AssemblyVersion("3.6.10.*")]
|
||||
|
||||
|
||||
194
nsw/Source/bsmd.database/SystemError.cs
Normal file
194
nsw/Source/bsmd.database/SystemError.cs
Normal file
@ -0,0 +1,194 @@
|
||||
// Copyright (c) 2015-2017 schick Informatik
|
||||
// Description: Speicherobjekt für HIS-Nord Fehlermeldungen
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using log4net;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Diese Klasse bildet den Verbindungsfehler der HIS-Nord Schnittstelle ab. Damit ist ein Fehler der dazwischenliegenden
|
||||
/// Kommunikationsschnittstelle gemeint, der Fehler wird nicht im NSW produziert
|
||||
/// </summary>
|
||||
public class SystemError : DatabaseEntity
|
||||
{
|
||||
private static ILog _log = LogManager.GetLogger(typeof(SystemError));
|
||||
|
||||
public SystemError()
|
||||
{
|
||||
this.tablename = "[dbo].[SystemError]";
|
||||
}
|
||||
|
||||
#region Enums
|
||||
|
||||
public enum SystemErrorStatus
|
||||
{
|
||||
NEW,
|
||||
ACKNOWLEDGED
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public DateTime? ErrorAt { get; set; }
|
||||
|
||||
public string Meldetype { get; set; }
|
||||
|
||||
public string ReferenceId { get; set; }
|
||||
|
||||
public int ProcessStatus { get; set; }
|
||||
|
||||
public string ImportFilename { get; set; }
|
||||
|
||||
public int ErrorCode { get; set; }
|
||||
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public string ErrorDescription { get; set; }
|
||||
|
||||
public SystemErrorStatus Status { get; set; }
|
||||
|
||||
public Guid MessageCoreId { get; set; }
|
||||
|
||||
public DateTime? SendDate { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region DatabaseEntity implementation
|
||||
|
||||
public override List<DatabaseEntity> LoadList(IDataReader reader)
|
||||
{
|
||||
List<DatabaseEntity> result = new List<DatabaseEntity>();
|
||||
while (reader.Read())
|
||||
{
|
||||
SystemError se = new SystemError();
|
||||
se.id = reader.GetGuid(0);
|
||||
|
||||
if (!reader.IsDBNull(1)) se.ErrorAt = reader.GetDateTime(1);
|
||||
if (!reader.IsDBNull(2)) se.Meldetype = reader.GetString(2);
|
||||
if (!reader.IsDBNull(3)) se.ReferenceId = reader.GetString(3);
|
||||
if (!reader.IsDBNull(4)) se.ProcessStatus = reader.GetInt32(4);
|
||||
if (!reader.IsDBNull(5)) se.ImportFilename = reader.GetString(5);
|
||||
if (!reader.IsDBNull(6)) se.ErrorCode = reader.GetInt32(6);
|
||||
if (!reader.IsDBNull(7)) se.ErrorMessage = reader.GetString(7);
|
||||
if (!reader.IsDBNull(8)) se.ErrorDescription = reader.GetString(8);
|
||||
if (!reader.IsDBNull(9)) se.MessageCoreId = reader.GetGuid(9);
|
||||
if (!reader.IsDBNull(10)) se.Status = (SystemError.SystemErrorStatus) Enum.ToObject(typeof(SystemError.SystemErrorStatus), reader.GetByte(10));
|
||||
|
||||
result.Add(se);
|
||||
}
|
||||
reader.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void PrepareLoadCommand(IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
|
||||
{
|
||||
string query = string.Format("SELECT Id, ErrorAt, MeldeType, ReferenceId, ProcessStatus, ImportFilename, ErrorCode, ErrorMessage, ErrorDescription, MessageCoreId, Status FROM {0} ", this.Tablename);
|
||||
|
||||
switch (filter)
|
||||
{
|
||||
case Message.LoadFilter.BY_CORE:
|
||||
query += "WHERE MessageCoreId = @COREID";
|
||||
((SqlCommand)cmd).Parameters.AddWithValue("@COREID", criteria[0]);
|
||||
break;
|
||||
case Message.LoadFilter.ALL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cmd.CommandText = query;
|
||||
}
|
||||
|
||||
public override void PrepareSave(IDbCommand cmd)
|
||||
{
|
||||
SqlCommand scmd = cmd as SqlCommand;
|
||||
|
||||
scmd.Parameters.AddWithValue("@EAT", this.ErrorAt);
|
||||
scmd.Parameters.AddWithValue("@MT", this.Meldetype);
|
||||
scmd.Parameters.AddWithValue("@REFID", this.ReferenceId);
|
||||
scmd.Parameters.AddWithValue("@PS", this.ProcessStatus);
|
||||
scmd.Parameters.AddWithValue("@IF", this.ImportFilename);
|
||||
scmd.Parameters.AddWithValue("@EC", this.ErrorCode);
|
||||
scmd.Parameters.AddWithValue("@EM", this.ErrorMessage);
|
||||
scmd.Parameters.AddWithValue("@ED", this.ErrorDescription);
|
||||
scmd.Parameters.AddWithValue("@MCID", this.MessageCoreId);
|
||||
scmd.Parameters.AddWithValue("@STATUS", (byte)this.Status);
|
||||
|
||||
if (this.IsNew)
|
||||
{
|
||||
scmd.CommandText = string.Format("INSERT INTO {0} (ErrorAt, MeldeType, ReferenceId, ProcessStatus, ImportFilename, ErrorCode, ErrorMessage, ErrorDescription, MessageCoreId, Status) " +
|
||||
"VALUES (@EAT, @MT, @REFID, @PS, @IF, @EC, @EM, @ED, @MCID, @STATUS)", this.Tablename);
|
||||
}
|
||||
else
|
||||
{
|
||||
scmd.Parameters.AddWithValue("@ID", this.Id);
|
||||
scmd.CommandText = string.Format("UPDATE {0} SET ErrorAt = @EAT, MeldeType = @MT, ReferenceId = @REFID, ProcessStatus = @PS, ImportFilename = @IF, " +
|
||||
"ErrorCode = @EC, ErrorMessage = @EM, ErrorDescription = @ED, MessageCoreId = @MCID, Status = @STATUS WHERE Id = @ID", this.Tablename);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static methods
|
||||
|
||||
public static SystemError createFromXml(XElement xml)
|
||||
{
|
||||
SystemError systemError = new SystemError();
|
||||
try
|
||||
{
|
||||
if (xml.Descendants("ErrorAt").Count() > 0)
|
||||
{
|
||||
systemError.ErrorAt = DateTime.Parse(xml.Descendants("ErrorAt").First().Value);
|
||||
}
|
||||
|
||||
systemError.Meldetype = xml.Descendants("Meldetype").First()?.Value;
|
||||
systemError.ReferenceId = xml.Descendants("ReferenceId").First()?.Value;
|
||||
if (xml.Descendants("ProcessStatus").Count() > 0)
|
||||
{
|
||||
systemError.ProcessStatus = Int32.Parse(xml.Descendants("ProcessStatus").FirstOrDefault().Value);
|
||||
}
|
||||
|
||||
systemError.ImportFilename = xml.Descendants("ImportFilename").First()?.Value;
|
||||
|
||||
if (!systemError.ImportFilename.IsNullOrEmpty())
|
||||
{
|
||||
systemError.ImportFilename = Path.GetFileNameWithoutExtension(systemError.ImportFilename);
|
||||
int ind = systemError.ImportFilename.IndexOf('-');
|
||||
Guid aGuid;
|
||||
if (Guid.TryParse(systemError.ImportFilename.Substring(ind + 1), out aGuid))
|
||||
systemError.MessageCoreId = aGuid;
|
||||
DateTime aDate;
|
||||
if (DateTime.TryParse(systemError.ImportFilename.Substring(0, ind), out aDate))
|
||||
systemError.SendDate = aDate;
|
||||
}
|
||||
|
||||
|
||||
if (xml.Descendants("ErrorCode").Count() > 0)
|
||||
{
|
||||
systemError.ErrorCode = Int32.Parse(xml.Descendants("ErrorCode").First().Value);
|
||||
}
|
||||
|
||||
systemError.ErrorMessage = xml.Descendants("ErrorMessage").First()?.Value;
|
||||
systemError.ErrorDescription = xml.Descendants("ErrorDescription").First()?.Value;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_log.WarnFormat("Error parsing system error: {0} ERROR-XML: {1}", ex.ToString(), xml.ToString());
|
||||
}
|
||||
|
||||
return systemError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@ -114,6 +114,7 @@
|
||||
<Compile Include="STO.cs" />
|
||||
<Compile Include="StowawaysJoiningLocation.cs" />
|
||||
<Compile Include="SubsidiaryRisks.cs" />
|
||||
<Compile Include="SystemError.cs" />
|
||||
<Compile Include="TIEFA.cs" />
|
||||
<Compile Include="TIEFD.cs" />
|
||||
<Compile Include="TOWA.cs" />
|
||||
|
||||
@ -81,8 +81,7 @@ namespace bsmd.email
|
||||
message.IsBodyHtml = false;
|
||||
message.Body = "see attachment";
|
||||
|
||||
// wenn recipient leer ist, geht es an die Recipientliste
|
||||
// wenn nicht, an den Recipient + die Admin-Email
|
||||
// wenn recipient leer ist, geht es an die Recipientliste
|
||||
|
||||
if ((recipient == null) || (recipient.Length == 0))
|
||||
{
|
||||
@ -94,7 +93,12 @@ namespace bsmd.email
|
||||
else
|
||||
{
|
||||
message.To.Add(recipient);
|
||||
message.CC.Add(Properties.Settings.Default.AdminEmail);
|
||||
// message.CC.Add(Properties.Settings.Default.AdminEmail);
|
||||
foreach (string extraRecipient in Properties.Settings.Default.Recipient)
|
||||
{
|
||||
if(!extraRecipient.Equals(recipient, StringComparison.OrdinalIgnoreCase))
|
||||
message.CC.Add(extraRecipient);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -81,6 +81,7 @@
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@ -1,21 +1,192 @@
|
||||
using System;
|
||||
// Copyright (c) 2015-2017 schick Informatik
|
||||
// Description: Hilfsklasse zur Bearbeitung der Antworten / HIS-Nord
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using bsmd.database;
|
||||
using log4net;
|
||||
|
||||
namespace bsmd.hisnord
|
||||
{
|
||||
|
||||
public class NSWResponse
|
||||
{
|
||||
private string _clientRequestId;
|
||||
private DateTime _receiveAt;
|
||||
private string _notificationId;
|
||||
private string _status;
|
||||
private string _visitId;
|
||||
private string _transitId;
|
||||
private Message.NotificationClass _notificationClass;
|
||||
|
||||
private List<MessageViolation> _violations = new List<MessageViolation>();
|
||||
private List<MessageError> _errors = new List<MessageError>();
|
||||
|
||||
private Guid _messageCoreId;
|
||||
private ILog _log = LogManager.GetLogger(typeof(NSWResponse));
|
||||
|
||||
public NSWResponse(XElement xml)
|
||||
{
|
||||
XNamespace ns1 = "http://api.national-single-window.de/visitIdRequest";
|
||||
XNamespace ns6 = "http://api.national-single-window.de/receipt";
|
||||
//XNamespace ns15 = "http://api.national-single-window.de/statusForClientRequestId";
|
||||
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||
XNamespace ns15 = "http://api.national-single-window.de/visitIdResponse";
|
||||
XNamespace ladgNS = "http://api.national-single-window.de/ladg";
|
||||
XNamespace hazaNS = "http://api.national-single-window.de/haza";
|
||||
XNamespace hazdNS = "http://api.national-single-window.de/hazd";
|
||||
XNamespace mdhNS = "http://api.national-single-window.de/mdh";
|
||||
XNamespace agntNS = "http://api.national-single-window.de/agnt";
|
||||
XNamespace vioNS = "http://api.national-single-window.de/violation";
|
||||
XNamespace errNS = "http://api.national-single-window.de/error";
|
||||
|
||||
// detect response type
|
||||
|
||||
foreach (Message.NotificationClass messageClassType in Enum.GetValues(typeof(Message.NotificationClass)))
|
||||
{
|
||||
XName lookupName = "";
|
||||
|
||||
switch (messageClassType)
|
||||
{
|
||||
// we won't get answers for these message types
|
||||
case Message.NotificationClass.STO: continue;
|
||||
case Message.NotificationClass.CREWD: continue;
|
||||
case Message.NotificationClass.PASD: continue;
|
||||
|
||||
case Message.NotificationClass.VISIT:
|
||||
lookupName = ns15 + "VisitIdResponse";
|
||||
break;
|
||||
case Message.NotificationClass.TRANSIT:
|
||||
lookupName = ns15 + "VisitIdResponse";
|
||||
break;
|
||||
case Message.NotificationClass.LADG:
|
||||
lookupName = ladgNS + "LADGResponse";
|
||||
break;
|
||||
case Message.NotificationClass.HAZA:
|
||||
lookupName = hazaNS + "HAZAResponse";
|
||||
break;
|
||||
case Message.NotificationClass.HAZD:
|
||||
lookupName = hazdNS + "HAZDResponse";
|
||||
break;
|
||||
case Message.NotificationClass.MDH:
|
||||
lookupName = mdhNS + "MDHResponse";
|
||||
break;
|
||||
case Message.NotificationClass.AGNT:
|
||||
lookupName = agntNS + "AGNTResponse";
|
||||
break;
|
||||
default:
|
||||
lookupName = "dontmatchmeplease";
|
||||
break;
|
||||
}
|
||||
|
||||
if(xml.Descendants(lookupName).Count() > 0)
|
||||
{
|
||||
|
||||
_notificationClass = messageClassType;
|
||||
|
||||
// match found
|
||||
XName xname = ns6 + "ClientRequestId";
|
||||
var elem = xml.Descendants(xname);
|
||||
if(elem.Count() > 0)
|
||||
{
|
||||
_clientRequestId = elem.First()?.Value;
|
||||
if (!Guid.TryParse(_clientRequestId, out this._messageCoreId))
|
||||
{
|
||||
throw new ApplicationException(string.Format("cannot parse client request id to guid: {0}", _clientRequestId));
|
||||
}
|
||||
}
|
||||
|
||||
xname = ns6 + "ReceivedAt";
|
||||
elem = xml.Descendants(xname);
|
||||
if(elem.Count() > 0)
|
||||
{
|
||||
DateTime.TryParse(elem.First()?.Value, out _receiveAt);
|
||||
}
|
||||
|
||||
xname = ns6 + "NotificationId";
|
||||
elem = xml.Descendants(xname);
|
||||
if (elem.Count() > 0)
|
||||
_notificationId = elem.First()?.Value;
|
||||
|
||||
xname = ns6 + "Status";
|
||||
elem = xml.Descendants(xname);
|
||||
if(elem.Count() > 0)
|
||||
{
|
||||
_status = elem.First()?.Value;
|
||||
}
|
||||
|
||||
xname = ns6 + "VisitId";
|
||||
elem = xml.Descendants(xname);
|
||||
if(elem.Count() > 0)
|
||||
{
|
||||
_visitId = elem.First()?.Value;
|
||||
}
|
||||
|
||||
xname = ns6 + "TransitId";
|
||||
elem = xml.Descendants(xname);
|
||||
if (elem.Count() > 0)
|
||||
{
|
||||
_transitId = elem.First()?.Value;
|
||||
}
|
||||
|
||||
|
||||
// check for violations -------------------------------------------
|
||||
xname = ns6 + "Violation";
|
||||
XName vCodeName = vioNS + "ViolationCode";
|
||||
XName vTextName = vioNS + "ViolationText";
|
||||
elem = xml.Descendants(xname);
|
||||
foreach(XElement anElem in elem)
|
||||
{
|
||||
MessageViolation mv = new MessageViolation();
|
||||
int vCode = -1;
|
||||
if (!Int32.TryParse(anElem.Element(vCodeName).Value, out vCode))
|
||||
_log.WarnFormat("cannot convert violation code to int: {0}", anElem.Element(vCodeName).Value);
|
||||
else
|
||||
mv.ViolationCode = vCode;
|
||||
mv.ViolationText = anElem.Element(vTextName).Value;
|
||||
_violations.Add(mv);
|
||||
}
|
||||
|
||||
// check for errors ----------------------------------------------
|
||||
xname = ns6 + "Error";
|
||||
XName eCodeName = errNS + "ErrorCode";
|
||||
XName eTextName = errNS + "ErrorText";
|
||||
elem = xml.Descendants(xname);
|
||||
foreach (XElement anElem in elem)
|
||||
{
|
||||
MessageError me = new MessageError();
|
||||
int eCode = -1;
|
||||
if (!Int32.TryParse(anElem.Element(eCodeName).Value, out eCode))
|
||||
_log.WarnFormat("cannot convert error code to int: {0}", anElem.Element(eCodeName).Value);
|
||||
else
|
||||
me.ErrorCode = eCode;
|
||||
me.ErrorText = anElem.Element(eTextName).Value;
|
||||
_errors.Add(me);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public string ClientRequestId { get { return _clientRequestId; } }
|
||||
|
||||
public DateTime? ReceiveAt { get { return _receiveAt; } }
|
||||
|
||||
public string NotificationId { get { return _notificationId; } }
|
||||
|
||||
public string Status { get { return this._status; } }
|
||||
|
||||
public List<MessageViolation> Violations { get { return _violations; } }
|
||||
|
||||
public List<MessageError> Errors { get { return _errors; } }
|
||||
|
||||
public Message.NotificationClass NotificationClass { get { return this._notificationClass; } }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,12 +1,10 @@
|
||||
using bsmd.database;
|
||||
// Copyright (c) 2015-2017 schick Informatik
|
||||
// Description: Bearbeitung von Antworten (dateibasiert..)
|
||||
|
||||
using bsmd.database;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using log4net;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@ -44,8 +42,8 @@ namespace bsmd.hisnord
|
||||
}
|
||||
else
|
||||
{
|
||||
int timestampMilliSecs;
|
||||
if (!Int32.TryParse(fileNameElems[fileNameElems.Length - 2], out timestampMilliSecs))
|
||||
long timestampMilliSecs;
|
||||
if (!Int64.TryParse(fileNameElems[fileNameElems.Length - 2], out timestampMilliSecs))
|
||||
{
|
||||
_log.WarnFormat("ANSWER file {0}.xml has no readable timestamp", bareFileName);
|
||||
isOK = false;
|
||||
@ -70,13 +68,24 @@ namespace bsmd.hisnord
|
||||
XNamespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||
XNamespace ns15 = "http://api.national-single-window.de/visitIdResponse";
|
||||
|
||||
if(xml.Descendants("SystemError").Count() > 0)
|
||||
if (xml.Name == "SystemError")
|
||||
{
|
||||
// Fehlernachricht
|
||||
SystemError systemError = new SystemError(xml);
|
||||
|
||||
// Speichern
|
||||
|
||||
SystemError systemError = SystemError.createFromXml(xml);
|
||||
if (systemError != null)
|
||||
{
|
||||
MessageCore aCore = DBManager.Instance.GetMessageCoreById(systemError.MessageCoreId);
|
||||
if (aCore != null)
|
||||
{
|
||||
_log.InfoFormat("SystemError received for Core [{0}], IMO {1} ETA {2}: {3}", aCore.Id, aCore.IMO, aCore.ETADisplay, systemError.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.WarnFormat("SystemError received for unknown core {0}: {1}", systemError.MessageCoreId, systemError.ErrorMessage);
|
||||
}
|
||||
// trotzdem immer speichern
|
||||
DBManager.Instance.Save(systemError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -84,48 +93,59 @@ namespace bsmd.hisnord
|
||||
NSWResponse nswResponse = new NSWResponse(xml);
|
||||
|
||||
// Rückmeldung auswerten
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (visitIdResponse != null)
|
||||
{
|
||||
_log.InfoFormat("HIS-NORD: Visit-ID {0} delivered for Core {1}", visitIdResponse.VisitId, visitIdResponse.ClientRequestId);
|
||||
// update MessageCore
|
||||
if (visitIdResponse.ClientRequestId != null)
|
||||
Guid coreId;
|
||||
if (Guid.TryParse(nswResponse.ClientRequestId, out coreId))
|
||||
{
|
||||
Guid messageCoreId;
|
||||
if (Guid.TryParse(visitIdResponse.ClientRequestId, out messageCoreId))
|
||||
MessageCore core = DBManager.Instance.GetMessageCoreById(coreId);
|
||||
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
|
||||
|
||||
// now find the message that was meant..
|
||||
foreach(Message aMessage in messages)
|
||||
{
|
||||
MessageCore answerCore = DBManager.Instance.GetMessageCoreById(messageCoreId);
|
||||
if (answerCore == null)
|
||||
if(aMessage.MessageNotificationClass == nswResponse.NotificationClass)
|
||||
{
|
||||
_log.WarnFormat("HIS-NORD: Core not found for notification id {0}", visitIdResponse.NotificationId);
|
||||
|
||||
if (nswResponse.Status != null)
|
||||
{
|
||||
bool isAccepted = (nswResponse.Status == "ACCEPTED");
|
||||
aMessage.Status = isAccepted ? Message.MessageStatus.ACCEPTED : Message.MessageStatus.REJECTED;
|
||||
aMessage.InternalStatus = isAccepted ? Message.BSMDStatus.CONFIRMED : Message.BSMDStatus.ERROR;
|
||||
}
|
||||
|
||||
#region Error / Violation handling
|
||||
|
||||
foreach (MessageError existingError in aMessage.ErrorList)
|
||||
DBManager.Instance.Delete(existingError);
|
||||
|
||||
foreach (MessageViolation existingViolation in aMessage.ViolationList)
|
||||
DBManager.Instance.Delete(existingViolation);
|
||||
|
||||
foreach(MessageError messageError in nswResponse.Errors)
|
||||
{
|
||||
messageError.MessageHeaderId = aMessage.Id.Value;
|
||||
messageError.MessageHeader = aMessage;
|
||||
DBManager.Instance.Save(messageError);
|
||||
}
|
||||
|
||||
foreach(MessageViolation messageViolation in nswResponse.Violations)
|
||||
{
|
||||
messageViolation.MessageHeaderId = aMessage.Id.Value;
|
||||
messageViolation.MessageHeader = aMessage;
|
||||
DBManager.Instance.Save(messageViolation);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!answerCore.IsTransit)
|
||||
answerCore.VisitId = visitIdResponse.VisitId;
|
||||
else
|
||||
answerCore.TransitId = visitIdResponse.VisitId;
|
||||
answerCore.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||
DBManager.Instance.Save(answerCore);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.WarnFormat("{0} ANSWER parsed, but MessageCoreId is no Guid: {1}",
|
||||
Path.GetFileName(answerFile), visitIdResponse.ClientRequestId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.WarnFormat("Client request id is null in {0}", answerFile);
|
||||
_log.ErrorFormat("received response for unknown core {0}", nswResponse.ClientRequestId);
|
||||
isOK = false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
@ -143,6 +163,7 @@ namespace bsmd.hisnord
|
||||
}
|
||||
else
|
||||
{
|
||||
// save in separate folder (to look at it later?)
|
||||
File.Move(answerFile, Path.Combine(Properties.Settings.Default.AnswerCorruptDir, Path.GetFileName(answerFile)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace bsmd.hisnord
|
||||
{
|
||||
public class SystemError
|
||||
{
|
||||
private DateTime? _errorAt;
|
||||
private string _meldeTyp;
|
||||
private string _referenceId;
|
||||
private int _processStatus;
|
||||
private string _importFileName;
|
||||
private int _errorCode;
|
||||
private string _errorMessage;
|
||||
private string _errorDescription;
|
||||
|
||||
public SystemError(XElement xml)
|
||||
{
|
||||
if(xml.Descendants("ErrorAt").Count() > 0)
|
||||
{
|
||||
_errorAt = DateTime.Parse(xml.Descendants("ErrorAt").First().Value);
|
||||
}
|
||||
|
||||
_meldeTyp = xml.Descendants("MeldeType").First()?.Value;
|
||||
_referenceId = xml.Descendants("ReferenceId").First()?.Value;
|
||||
if(xml.Descendants("ProcessStatus").Count() > 0)
|
||||
{
|
||||
_processStatus = Int32.Parse(xml.Descendants("ProcessStatus").First().Value);
|
||||
}
|
||||
|
||||
_importFileName = xml.Descendants("ImportFilename").First()?.Value;
|
||||
if(xml.Descendants("ErrorCode").Count() > 0)
|
||||
{
|
||||
_errorCode = Int32.Parse(xml.Descendants("ErrorCode").First().Value);
|
||||
}
|
||||
_errorMessage = xml.Descendants("ErrorMessage").First()?.Value;
|
||||
_errorDescription = xml.Descendants("ErrorDescription").First()?.Value;
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public DateTime? ErrorAt { get { return _errorAt; } }
|
||||
|
||||
public string MeldeTyp { get { return _meldeTyp; } }
|
||||
|
||||
public string ReferenceId { get { return _referenceId; } }
|
||||
|
||||
public int ProcessStatus { get { return _processStatus; } }
|
||||
|
||||
public string ImportFileName { get { return _importFileName; } }
|
||||
|
||||
public int ErrorCode { get { return _errorCode; } }
|
||||
|
||||
public string ErrorMessage { get { return _errorMessage; } }
|
||||
|
||||
public string ErrorDescription { get { return _errorDescription; } }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -59,7 +59,7 @@
|
||||
<Link>Properties\AssemblyProjectKeyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="his-nord.cs" />
|
||||
<Compile Include="nsw_response.cs" />
|
||||
<Compile Include="NSWResponse.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
@ -68,7 +68,6 @@
|
||||
</Compile>
|
||||
<Compile Include="Request.cs" />
|
||||
<Compile Include="Response.cs" />
|
||||
<Compile Include="SystemError.cs" />
|
||||
<Compile Include="TransitId.cs" />
|
||||
<Compile Include="transmitter.cs" />
|
||||
<Compile Include="VisitId.cs" />
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user