3.6.12: Korrekturen für das Versenden, neue Dialog für Error / Violation Meldungen

This commit is contained in:
Daniel Schick 2017-08-10 14:18:38 +00:00
parent 5f6f61e54e
commit e0a7f2654e
34 changed files with 521 additions and 121 deletions

View File

@ -70,6 +70,8 @@ namespace ENI2
STAT.TransportModeDict = LocalizedLookup.getTransportModes();
HAZ.PackageTypes = LocalizedLookup.getPackageTypes();
LADG.LACodes = LocalizedLookup.getLACodes();
LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST();
LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3();
// Connect to locking service (if enabled)

View File

@ -172,6 +172,12 @@ namespace ENI2
}
}
this.buttonSave.Visibility = Visibility.Hidden;
if(currentControl is OverViewDetailControl)
{
// ggf. hat sich die Ticketnr geändert..
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(currentControl.Core);
}
}
}

View File

@ -56,7 +56,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textNationality}" Binding="{Binding CrewMemberNationality, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textCrewFunctionOnBoard}" Binding="{Binding CrewMemberDuty, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textPlaceOfBirth}" Binding="{Binding CrewMemberPlaceOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding CrewMemberDateOfBirth, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding CrewMemberDateOfBirth, Mode=TwoWay, StringFormat=\{0:dd.MM.yy\}}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocType}" Binding="{Binding CrewMemberIdentityDocumentTypeDisplay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocNumber}" Binding="{Binding CrewMemberIdentityDocumentId, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textVisaNumber}" Binding="{Binding CrewMemberVisaNumber, Mode=TwoWay}" IsReadOnly="True" Width="0.1*" />
@ -79,7 +79,7 @@
<DataGridTextColumn Header="{x:Static p:Resources.textPortOfDisembarkation}" Binding="{Binding PassengerPortOfDisembarkation}" IsReadOnly="True" Width="0.1*" />
<DataGridCheckBoxColumn Header="{x:Static p:Resources.textTransitPassenger}" Binding="{Binding PassengerInTransit}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textPlaceOfBirth}" Binding="{Binding PassengerPlaceOfBirth}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding PassengerDateOfBirth}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDateOfBirth}" Binding="{Binding PassengerDateOfBirth, StringFormat=\{0:dd.MM.yy\}}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocType}" Binding="{Binding PassengerIdentityDocumentTypeDisplay}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textIdDocNumber}" Binding="{Binding PassengerIdentityDocumentId}" IsReadOnly="True" Width="0.1*" />
<DataGridTextColumn Header="{x:Static p:Resources.textVisaNumber}" Binding="{Binding PassengerVisaNumber}" IsReadOnly="True" Width="0.1*" />

View File

@ -73,13 +73,14 @@
<Label HorizontalAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textTicketNo}" Margin="0,0,10,0" />
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="3" Content="{x:Static p:Resources.textCreated}" Margin="0,0,10,0" />
<Label Name="labelCreated" Grid.Column="4" Grid.Row="4" Margin="2, 0, 0, 0" />
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding TicketNo}" Margin="2" />
<TextBox Name="textBoxTicketNo" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Text="{Binding TicketNo, Mode=TwoWay}" Margin="2" />
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="6" Visibility="Hidden" Name="stackPanelLock">
<Image Source="../Resources/lock.png" Margin="0,0,5,0" Height="24" />
<TextBlock Name="textBlockLockUserName" VerticalAlignment="Center" />
</StackPanel>
<Label Grid.Column="0" Grid.Row="6" Margin="0,0,10,0" HorizontalContentAlignment="Right" Name="labelBSMDStatusInternal" Content="{Binding BSMDStatusInternal, StringFormat={}{0}}" VerticalContentAlignment="Center" FontWeight="Bold" />
<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}"/>
@ -94,6 +95,14 @@
<Button Name="buttonInfoCore" Margin="2" Click="buttonInfoCore_Click" BorderThickness="0" Background="Transparent">
<Image Source="../Resources/document_view.png" Margin="0,0,5,0" Height="24" />
</Button>
<!--
<Button Name="buttonErrors" Margin="2" Click="buttonErrors_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<Image Source="../Resources/error.png" Margin="0,0,5,0" Height="24" />
</Button>
<Button Name="buttonWarnings" Margin="2" Click="buttonWarnings_Click" BorderThickness="0" Background="Transparent" Visibility="Hidden">
<Image Source="../Resources/sign_warning.png" Margin="0,0,5,0" Height="24" />
</Button>
-->
</StackPanel>
<!-- Data Grid -->
@ -109,6 +118,30 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasErrors"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasErrors}" Value="True">
<Setter Property="Source" Value="/Resources/error.png" TargetName="imageHasErrors"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="SizeToCells" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image x:Name="imageHasViolations"/>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=HasViolations}" Value="True">
<Setter Property="Source" Value="/Resources/sign_warning.png" TargetName="imageHasViolations"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--
<DataGridTextColumn Header="{x:Static p:Resources.textNotificationGroup}" Binding="{Binding ENINotificationDetailGroup}" IsReadOnly="True" Width="0.25*" />
-->

View File

@ -58,6 +58,7 @@ namespace ENI2.DetailViewControls
this.textBoxIMO.DataContext = this.Core;
this.locodePoC.DataContext = this.Core;
this.textBoxTicketNo.DataContext = this.Core;
this.labelBSMDStatusInternal.DataContext = this.Core;
this.labelCreated.Content = this.Core.Created?.ToString();
@ -208,6 +209,18 @@ namespace ENI2.DetailViewControls
resetItem.Click += new RoutedEventHandler(this.contextResetMessage);
this.dataGridMessages.ContextMenu.Items.Add(resetItem);
MenuItem errorItem = new MenuItem();
errorItem.Header = Properties.Resources.textErrors;
errorItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/error.png")) };
errorItem.Click += new RoutedEventHandler(this.buttonErrors_Click);
this.dataGridMessages.ContextMenu.Items.Add(errorItem);
MenuItem vioItem = new MenuItem();
vioItem.Header = Properties.Resources.textViolations;
vioItem.Icon = new Image { Source = new BitmapImage(new Uri("pack://application:,,,/Resources/sign_warning.png")) };
vioItem.Click += new RoutedEventHandler(this.buttonWarnings_Click);
this.dataGridMessages.ContextMenu.Items.Add(vioItem);
#endregion
#region init ATA
@ -494,6 +507,28 @@ namespace ENI2.DetailViewControls
spvd.Show();
}
private void buttonErrors_Click(object sender, RoutedEventArgs e)
{
if(this.dataGridMessages.SelectedItems.Count > 0)
{
Message selectedMessage = this.dataGridMessages.SelectedItems[0] as Message;
ErrorListDialog eld = new ErrorListDialog();
eld.Errors = selectedMessage.ErrorList;
eld.ShowDialog();
}
}
private void buttonWarnings_Click(object sender, RoutedEventArgs e)
{
if (this.dataGridMessages.SelectedItems.Count > 0)
{
Message selectedMessage = this.dataGridMessages.SelectedItems[0] as Message;
ViolationListDialog vld = new ViolationListDialog();
vld.Violations = selectedMessage.ViolationList;
vld.ShowDialog();
}
}
#endregion
}

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>3.6.10.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>3.6.12.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -275,9 +275,15 @@
<Compile Include="EditControls\EditWasteDialog.xaml.cs">
<DependentUpon>EditWasteDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\ErrorListDialog.xaml.cs">
<DependentUpon>ErrorListDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\SimplePropertyViewDialog.xaml.cs">
<DependentUpon>SimplePropertyViewDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\ViolationListDialog.xaml.cs">
<DependentUpon>ViolationListDialog.xaml</DependentUpon>
</Compile>
<Compile Include="EditControls\VisitIdDialog.xaml.cs">
<DependentUpon>VisitIdDialog.xaml</DependentUpon>
</Compile>
@ -451,10 +457,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\ErrorListDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\SimplePropertyViewDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\ViolationListDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="EditControls\VisitIdDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@ -540,7 +554,7 @@
<None Include="Resources\flash_yellow.png" />
<None Include="Resources\lightbulb_on.png" />
<None Include="Resources\rotate_left.png" />
<None Include="Resources\sign_warning.png" />
<Resource Include="Resources\sign_warning.png" />
<None Include="Resources\trafficlight_green.png" />
<None Include="Resources\trafficlight_off.png" />
<None Include="Resources\trafficlight_red.png" />
@ -551,6 +565,7 @@
<Resource Include="Resources\document_view.png" />
<Resource Include="Resources\mail_forward.png" />
<Resource Include="Resources\mail_delete.png" />
<Resource Include="Resources\error.png" />
<Content Include="x64\SQLite.Interop.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@ -38,8 +38,8 @@ Copyright (c) 2017 schick Informatik
<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" />
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxNSTCode" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" StaysOpenOnEdit="True" IsTextSearchEnabled="False" />
<ComboBox Grid.Row="1" Grid.Column="3" Name="comboBoxNST3Code" Margin="2" IsEditable="True" SelectedValuePath="Key" DisplayMemberPath="Value" 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" />

View File

@ -40,12 +40,13 @@ namespace ENI2.EditControls
this.comboBoxHandlingType.ItemsSource = handlingTypeList;
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.comboBoxLACodes.ItemsSource = LADG.LACodes;
this.comboBoxLACodes.KeyUp += ComboBox_KeyUp;
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
this.integerUpDownNumberOfItems.Value = this.LADG.CargoNumberOfItems;
this.doubleUpDownGrossQuantity.Value = this.LADG.CargoGrossQuantity_TNE;
this.locodeControl_PortOfLoading.LocodeValue = this.LADG.PortOfLoading;
@ -53,7 +54,13 @@ namespace ENI2.EditControls
this.comboBoxLACodes.SelectedValue = this.LADG.CargoLACode;
this.comboBoxLACodes.KeyUp += ComboBox_KeyUp;
this.comboBoxNSTCode.ItemsSource = LADG.CargoCodesNST;
this.comboBoxNSTCode.KeyUp += ComboBox_KeyUp;
this.comboBoxNSTCode.SelectedValue = this.LADG.CargoCodeNST;
this.comboBoxNST3Code.ItemsSource = LADG.CargoCodesNST3;
this.comboBoxNST3Code.KeyUp += ComboBox_KeyUp;
this.comboBoxNST3Code.SelectedValue = this.LADG.CargoCodeNST_3;
}
private void EditLADGDialog_OKClicked()
@ -63,7 +70,9 @@ 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?) (this.comboBoxLACodes.SelectedValue);
this.LADG.CargoLACode = (int) this.comboBoxLACodes.SelectedValue;
this.LADG.CargoCodeNST = (string) this.comboBoxNSTCode.SelectedValue;
this.LADG.CargoCodeNST_3 = (string)this.comboBoxNST3Code.SelectedValue;
}
#endregion

View File

@ -0,0 +1,24 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.ErrorListDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textErrors}" Height="300" Width="600" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="220" />
</Grid.RowDefinitions>
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" x:Name="dataGridErrors">
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding ErrorCode}" IsReadOnly="True" Width="0.3*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding ErrorText}" IsReadOnly="True" Width="0.7*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,32 @@
// Copyright (c) 2017 schick Informatik
// Description: Darstellung einer Liste von NSW Fehlermeldungen in einem Grid
//
using System.Collections.Generic;
using System.Windows;
using bsmd.database;
using ENI2.Controls;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for ErrorListDialog.xaml
/// </summary>
public partial class ErrorListDialog : EditWindowBase
{
public ErrorListDialog()
{
InitializeComponent();
Loaded += ErrorListDialog_Loaded;
}
public List<MessageError> Errors { get; set; }
private void ErrorListDialog_Loaded(object sender, RoutedEventArgs e)
{
this.dataGridErrors.Initialize();
this.dataGridErrors.ItemsSource = this.Errors;
}
}
}

View File

@ -0,0 +1,24 @@
<enictrl:EditWindowBase x:Class="ENI2.EditControls.ViolationListDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ENI2.EditControls"
xmlns:enictrl="clr-namespace:ENI2.Controls"
xmlns:p="clr-namespace:ENI2.Properties"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Title="{x:Static p:Resources.textViolations}" Height="300" Width="600" Background="AliceBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="220" />
</Grid.RowDefinitions>
<enictrl:ENIDataGrid Grid.Row="0" Grid.Column="0" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" x:Name="dataGridViolations">
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding ViolationCode}" IsReadOnly="True" Width="0.3*" />
<DataGridTextColumn Header="{x:Static p:Resources.textDescription}" Binding="{Binding ViolationText}" IsReadOnly="True" Width="0.7*" />
</DataGrid.Columns>
</enictrl:ENIDataGrid>
</Grid>
</enictrl:EditWindowBase>

View File

@ -0,0 +1,32 @@
// Copyright (c) 2017 schick Informatik
// Description: Darstellung einer Liste von NSW Fehlermeldungen in einem Grid
//
using System.Collections.Generic;
using System.Windows;
using bsmd.database;
using ENI2.Controls;
namespace ENI2.EditControls
{
/// <summary>
/// Interaction logic for ErrorListDialog.xaml
/// </summary>
public partial class ViolationListDialog : EditWindowBase
{
public ViolationListDialog()
{
InitializeComponent();
Loaded += ErrorListDialog_Loaded;
}
public List<MessageViolation> Violations { get; set; }
private void ErrorListDialog_Loaded(object sender, RoutedEventArgs e)
{
this.dataGridViolations.Initialize();
this.dataGridViolations.ItemsSource = this.Violations;
}
}
}

View File

@ -5,6 +5,7 @@
using System.Windows;
using ENI2.Controls;
using bsmd.ExcelReadService;
using bsmd.database;
namespace ENI2.EditControls
@ -52,6 +53,7 @@ namespace ENI2.EditControls
this.Core.ENI = this.doubleUpDownENI.Value.ToString();
this.Core.PoC = this.locodePoC.LocodeValue;
this.Core.Portname = LocodeDB.PortNameFromLocode(this.Core.PoC);
this._isOK = true;
}

View File

@ -154,5 +154,52 @@ namespace ENI2
return result;
}
public static Dictionary<string, string> getCargoCodesNST()
{
Dictionary<string, string> result = new Dictionary<string, string>();
string query = string.Format("SELECT Code, Description FROM CargoTypesNST ORDER BY Code");
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string code = null;
string description = null;
if (!reader.IsDBNull(0)) code = reader.GetString(0);
if (!reader.IsDBNull(1)) description = reader.GetString(1);
if ((code != null) && (description != null))
result[code] = string.Format("{0} {1}", code, description);
}
reader.Close();
return result;
}
public static List<KeyValuePair<string, string>> getCargoCodesNST3()
{
List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
string query = string.Format("SELECT Code, Description, codeGrp3 FROM CargoTypesNST3 ORDER BY Code");
SQLiteCommand cmd = new SQLiteCommand(query, _con);
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string code = null;
string description = null;
string codeGrp3 = null;
if (!reader.IsDBNull(0)) code = reader.GetString(0);
if (!reader.IsDBNull(1)) description = reader.GetString(1);
if (!reader.IsDBNull(2)) codeGrp3 = reader.GetString(2);
if ((code != null) && (description != null) && (codeGrp3 != null))
{
KeyValuePair<string, string> kvp = new KeyValuePair<string, string>(codeGrp3, string.Format("{0} {1} {2}", code, description, codeGrp3));
result.Add(kvp);
}
}
reader.Close();
return result;
}
}
}

View File

@ -303,11 +303,16 @@ namespace ENI2
closedDialog.Core.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
closedDialog.Core.InitialHIS = Message.NSWProvider.DUDR_TEST;
}
if (closedDialog.Core.PoC.Equals("ZZNOK"))
closedDialog.Core.IsTransit = true;
closedDialog.Core.DefaultReportingPartyId = this.userEntity.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(closedDialog.Core);
// Meldeklassen für neuen Anlauf erzeugen:
bsmd.database.Util.CreateMessagesForCore(closedDialog.Core);
bsmd.database.Util.CreateMessagesForCore(closedDialog.Core, userEntity);
this.AnmeldungenControl_MessageCoreSelected(closedDialog.Core); // in einem neuen Reiter öffnen
}
};

View File

@ -250,6 +250,16 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap error {
get {
object obj = ResourceManager.GetObject("error", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -1464,6 +1474,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Errors.
/// </summary>
public static string textErrors {
get {
return ResourceManager.GetString("textErrors", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ETA.
/// </summary>
@ -3696,6 +3715,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Violations.
/// </summary>
public static string textViolations {
get {
return ResourceManager.GetString("textViolations", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Visa number.
/// </summary>

View File

@ -1372,4 +1372,13 @@
<data name="textConfirmCancel" xml:space="preserve">
<value>Cancel this declaration?</value>
</data>
<data name="error" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="textErrors" xml:space="preserve">
<value>Errors</value>
</data>
<data name="textViolations" xml:space="preserve">
<value>Violations</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

View File

@ -82,9 +82,6 @@ namespace SendNSWMessageService
if (DBManager.Instance.Connect(Properties.Settings.Default.ConnectionString))
{
bsmd.hisnord.Response.ReadAnswers();
// Datenbank auf zu sendende Objekte überprüfen und laden
List<MessageCore> coresMarkedForSending = DBManager.Instance.GetMessageCoresByStatus(MessageCore.BSMDStatus.TOSEND);
@ -100,7 +97,7 @@ namespace SendNSWMessageService
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
{
// HIS-NORD: alles auf einmal
sendSucceeded = bsmd.hisnord.Request.Send(messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
sendSucceeded = bsmd.hisnord.Request.CreateSendFile(core, messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
if (!sendSucceeded) core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
else core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
@ -266,6 +263,10 @@ namespace SendNSWMessageService
}
}
bsmd.hisnord.transmitter.CallTransmitter();
bsmd.hisnord.Request.Clear();
bsmd.hisnord.Response.ReadAnswers();
List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag();
foreach (MessageCore core in coresMarkedForStatusQuery)

View File

@ -29,7 +29,7 @@ namespace bsmd.ExcelReadService
if (messageCore == null) return false; // cannot work with this sheet or create one
// load messages if already present
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.EXCEL);
List<Message> messages = DBManager.Instance.GetMessagesForCore(messageCore, DBManager.MessageLoad.ALL);
// start parsing fields
if (messageCore.IsTransit)

View File

@ -104,6 +104,11 @@ namespace bsmd.database
public static Dictionary<int, string> LACodes { get; set; }
public static Dictionary<string, string> CargoCodesNST { get; set; }
public static List<KeyValuePair<string, string>> CargoCodesNST3 { get; set; }
public static Dictionary<int, string> CargoHandlingDict
{
get { return _cargoHandlingDict; }

View File

@ -299,6 +299,16 @@ namespace bsmd.database
/// </summary>
public bool IsDirty { get; set; }
/// <summary>
/// ENI Display flag
/// </summary>
public bool HasErrors { get { return !this.ErrorList.IsNullOrEmpty(); } }
/// <summary>
/// ENI Display flag
/// </summary>
public bool HasViolations { get { return !this.ViolationList.IsNullOrEmpty(); } }
#endregion
#region IDatabaseEntity implementation

View File

@ -380,7 +380,7 @@ namespace bsmd.database
}
case Message.LoadFilter.IMO_ETA_POC:
{
sb.Append("WHERE (IMO = @IMO AND ETA = @ETA AND Portname = @POC)");
sb.Append("WHERE (IMO = @IMO AND ETA = @ETA AND PoC = @POC)");
((SqlCommand)cmd).Parameters.AddWithValue("@IMO", criteria[0]);
((SqlCommand)cmd).Parameters.AddWithValue("@ETA", criteria[1]);
((SqlCommand)cmd).Parameters.AddWithValue("@POC", criteria[2]);

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("Informatikbüro Daniel Schick")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("3.6.10")]
[assembly: AssemblyInformationalVersion("3.6.12")]
[assembly: AssemblyCopyright("Copyright © 2014-2017 Informatikbüro Daniel Schick. All rights reserved.")]
[assembly: AssemblyTrademark("")]

View File

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

View File

@ -282,6 +282,7 @@ namespace bsmd.database
Dictionary<Guid, ReportingParty> reportingPartyDict = DBManager.Instance.GetReportingPartyDict(); // passt nicht ganz aber egal
foreach(Guid key in reportingPartyDict.Keys)
{
if (reportingPartyDict[key].Logon == null) continue;
if (reportingPartyDict[key].Logon.Equals(name))
{
// found user

View File

@ -147,7 +147,7 @@ namespace bsmd.database
{
if (xml.Descendants("ErrorAt").Count() > 0)
{
systemError.ErrorAt = DateTime.Parse(xml.Descendants("ErrorAt").First().Value);
systemError.ErrorAt = DateTime.Parse(xml.Descendants("ErrorAt").FirstOrDefault().Value);
}
systemError.Meldetype = xml.Descendants("Meldetype").First()?.Value;
@ -157,7 +157,7 @@ namespace bsmd.database
systemError.ProcessStatus = Int32.Parse(xml.Descendants("ProcessStatus").FirstOrDefault().Value);
}
systemError.ImportFilename = xml.Descendants("ImportFilename").First()?.Value;
systemError.ImportFilename = xml.Descendants("ImportFilename").FirstOrDefault()?.Value;
if (!systemError.ImportFilename.IsNullOrEmpty())
{
@ -177,8 +177,24 @@ namespace bsmd.database
systemError.ErrorCode = Int32.Parse(xml.Descendants("ErrorCode").First().Value);
}
systemError.ErrorMessage = xml.Descendants("ErrorMessage").First()?.Value;
systemError.ErrorDescription = xml.Descendants("ErrorDescription").First()?.Value;
systemError.ErrorMessage = xml.Descendants("ErrorMessage").FirstOrDefault()?.Value;
systemError.ErrorDescription = xml.Descendants("ErrorDescription").FirstOrDefault()?.Value;
string coreIdString = xml.Descendants("ConveyanceCode").FirstOrDefault()?.Value;
if(!coreIdString.IsNullOrEmpty())
{
Guid aCoreId;
if(Guid.TryParse(coreIdString, out aCoreId))
{
systemError.MessageCoreId = aCoreId;
} else
{
_log.WarnFormat("cannot parse conveyance code to Guid: {0}", coreIdString);
}
}
}
catch(Exception ex)
{

View File

@ -119,7 +119,7 @@ namespace bsmd.database
/// <summary>
/// Hilfsfunktion für "manuelle" Anlage eines Schiffsanlaufs. Die Objekte sind bereits gespeichert.
/// </summary>
public static List<Message> CreateMessagesForCore(MessageCore core)
public static List<Message> CreateMessagesForCore(MessageCore core, ReportingParty user = null)
{
List<Message> result = new List<Message>();
bool isDE, isDK;
@ -146,8 +146,14 @@ namespace bsmd.database
(notificationClass == Message.NotificationClass.TOWD)) continue;
}
if (core.IsTransit && (notificationClass == Message.NotificationClass.VISIT)) continue;
if (!core.IsTransit && (notificationClass == Message.NotificationClass.TRANSIT)) continue;
Message message = new Message();
if (user != null)
message.CreatedBy = string.Format("ENI-2: {0}", user.Logon);
message.MessageCore = core;
message.MessageCoreId = core.Id;
message.MessageNotificationClass = notificationClass;
DatabaseEntity classElement = DBManager.CreateMessage(notificationClass);
DBManager.Instance.Save(message);
@ -157,7 +163,6 @@ namespace bsmd.database
classElement.MessageHeader = message;
DBManager.Instance.Save(classElement);
message.Elements.Add(classElement);
message.SaveElements();
}
result.Add(message);
}

View File

@ -24,7 +24,7 @@ namespace bsmd.hisnord
private List<MessageViolation> _violations = new List<MessageViolation>();
private List<MessageError> _errors = new List<MessageError>();
private Guid _messageCoreId;
private Guid? _messageCoreId;
private ILog _log = LogManager.GetLogger(typeof(NSWResponse));
public NSWResponse(XElement xml)
@ -42,11 +42,26 @@ namespace bsmd.hisnord
XNamespace vioNS = "http://api.national-single-window.de/violation";
XNamespace errNS = "http://api.national-single-window.de/error";
XName idName = "ConveyanceCode";
var elem = xml.Descendants(idName);
if (elem.Count() > 0)
{
Guid aGuid;
if (Guid.TryParse(elem.FirstOrDefault()?.Value, out aGuid))
_messageCoreId = aGuid;
else
_log.WarnFormat("cannot parse ConveyanceCode {0}", elem.FirstOrDefault());
}else
{
_log.Warn("NSWResponse does not contain ConveyanceCode!!");
}
// detect response type
foreach (Message.NotificationClass messageClassType in Enum.GetValues(typeof(Message.NotificationClass)))
{
XName lookupName = "";
XName lookupName;
switch (messageClassType)
{
@ -88,14 +103,10 @@ namespace bsmd.hisnord
// match found
XName xname = ns6 + "ClientRequestId";
var elem = xml.Descendants(xname);
if(elem.Count() > 0)
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";
@ -173,6 +184,8 @@ namespace bsmd.hisnord
#region Properties
public Guid? MessageCoreId { get { return _messageCoreId; } }
public string ClientRequestId { get { return _clientRequestId; } }
public DateTime? ReceiveAt { get { return _receiveAt; } }
@ -181,6 +194,10 @@ namespace bsmd.hisnord
public string Status { get { return this._status; } }
public string VisitId { get { return this._visitId; } }
public string TransitId { get { return this._transitId; } }
public List<MessageViolation> Violations { get { return _violations; } }
public List<MessageError> Errors { get { return _errors; } }

View File

@ -21,6 +21,7 @@ namespace bsmd.hisnord
{
private static ILog _log = LogManager.GetLogger(typeof(Request));
private static Dictionary<Guid, ReportingParty> _reportingPartyDict = null;
private static Dictionary<MessageCore, string> coreFilenameDict = new Dictionary<MessageCore, string>();
internal static Dictionary<Guid, ReportingParty> ReportingPartyDict
{
@ -33,7 +34,46 @@ namespace bsmd.hisnord
return _reportingPartyDict;
}
}
public static bool Send(List<Message> messages, bool useTest)
public static void Clear()
{
coreFilenameDict.Clear();
}
public static void ReadResponseFiles()
{
foreach (MessageCore core in coreFilenameDict.Keys)
{
transmitter.result theResult = transmitter.GetResult(coreFilenameDict[core]);
if (theResult != null)
{
_log.InfoFormat("Result: Code {0} Detail {1} Message {2}", theResult.code, theResult.detail, theResult.message);
if (theResult.code > 0)
{
core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
/*
MessageError error = new MessageError();
error.MessageHeaderId = visitTransitHeader.Id.Value;
error.ErrorCode = theResult.code;
if ((theResult.detail != null) && (theResult.detail.Length > 255))
error.ErrorText = theResult.detail.Substring(0, 255);
else
error.ErrorText = theResult.detail;
*/
}
else
{
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
}
DBManager.Instance.Save(core);
}
}
}
public static bool CreateSendFile(MessageCore core, List<Message> messages, bool useTest)
{
bool retval = true;
@ -1398,32 +1438,7 @@ namespace bsmd.hisnord
serializer.Serialize(tw, _nsw);
}
#endregion
#region send message and store result
transmitter.result theResult = transmitter.UseHisNordTransmitter(filePath);
if (theResult != null)
{
_log.InfoFormat("Result: Code {0} Detail {1} Message {2}", theResult.code, theResult.detail, theResult.message);
if (visitTransitHeader != null)
{
if (theResult.code > 0)
{
MessageError error = new MessageError();
error.MessageHeaderId = visitTransitHeader.Id.Value;
error.ErrorCode = theResult.code;
if ((theResult.detail != null) && (theResult.detail.Length > 255))
error.ErrorText = theResult.detail.Substring(0, 255);
else
error.ErrorText = theResult.detail;
DBManager.Instance.Save(error);
}
}
}
coreFilenameDict[core] = filename;
#endregion

View File

@ -93,56 +93,78 @@ namespace bsmd.hisnord
NSWResponse nswResponse = new NSWResponse(xml);
// Rückmeldung auswerten
Guid coreId;
if (Guid.TryParse(nswResponse.ClientRequestId, out coreId))
if (nswResponse.MessageCoreId.HasValue)
{
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 core = DBManager.Instance.GetMessageCoreById(nswResponse.MessageCoreId.Value);
if (core != null)
{
if(aMessage.MessageNotificationClass == nswResponse.NotificationClass)
List<Message> messages = DBManager.Instance.GetMessagesForCore(core, DBManager.MessageLoad.ALL);
if(nswResponse.NotificationClass == Message.NotificationClass.VISIT)
{
if ((nswResponse.Status == "ACCEPTED") && !nswResponse.VisitId.IsNullOrEmpty())
core.VisitId = nswResponse.VisitId;
}
if (nswResponse.Status != null)
if(nswResponse.NotificationClass == Message.NotificationClass.TRANSIT)
{
if ((nswResponse.Status == "ACCEPTED") && !nswResponse.TransitId.IsNullOrEmpty())
core.TransitId = nswResponse.TransitId;
}
core.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
DBManager.Instance.Save(core);
// now find the message that was meant..
foreach (Message aMessage in messages)
{
if (aMessage.MessageNotificationClass == nswResponse.NotificationClass)
{
bool isAccepted = (nswResponse.Status == "ACCEPTED");
aMessage.Status = isAccepted ? Message.MessageStatus.ACCEPTED : Message.MessageStatus.REJECTED;
aMessage.InternalStatus = isAccepted ? Message.BSMDStatus.CONFIRMED : Message.BSMDStatus.ERROR;
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;
DBManager.Instance.Save(aMessage);
}
#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
}
#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
{
_log.ErrorFormat("cannot find core for id {0}", nswResponse.MessageCoreId);
}
}
else
{
_log.ErrorFormat("received response for unknown core {0}", nswResponse.ClientRequestId);
_log.ErrorFormat("received response without suitable conveyance code, request id {0}", nswResponse.ClientRequestId);
isOK = false;
}
}

View File

@ -14,6 +14,7 @@ using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using bsmd.database;
using log4net;
namespace bsmd.hisnord
@ -23,8 +24,7 @@ namespace bsmd.hisnord
private static ILog _log = LogManager.GetLogger(typeof(transmitter));
public static result UseHisNordTransmitter(string filenameFullPath)
public static void CallTransmitter()
{
Process process = new Process();
process.StartInfo.FileName = Properties.Settings.Default.Transmitter;
@ -39,16 +39,21 @@ namespace bsmd.hisnord
process.Start();
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
process.WaitForExit((timeout == 0) ? int.MaxValue : timeout);
string errorString = process.StandardError.ReadToEnd();
if(!errorString.IsNullOrEmpty())
_log.ErrorFormat("HIS-Nord transmitter error: {0}", errorString);
_log.ErrorFormat("HIS-Nord transmitter error: {0}", process.StandardError.ReadToEnd());
process.WaitForExit();
_log.InfoFormat("HIS-Nord transmitter: {0}", process.StandardOutput.ReadToEnd());
process.WaitForExit();
// process.WaitForExit();
string outputString = process.StandardOutput.ReadToEnd();
if(!outputString.IsNullOrEmpty())
_log.DebugFormat("HIS-Nord transmitter: {0}", outputString);
// process.WaitForExit();
}
public static result GetResult(string filenameFullPath)
{
// now we should read the response message...
string resultFilename = string.Format("{0}.result", Path.GetFileName(filenameFullPath)); // hier war früher noch ein .xml dran am Ende
string resultFullPath = Path.Combine(Properties.Settings.Default.ResultDir, resultFilename);
return result.ReadResult(resultFullPath);
}

Binary file not shown.