einige kleinere Korrekturen und ergänzungenn

This commit is contained in:
Daniel Schick 2015-12-27 12:44:18 +00:00
parent 7cf82f732c
commit b8d4e943e5
23 changed files with 182 additions and 43 deletions

Binary file not shown.

View File

@ -196,3 +196,18 @@
-----------------------------
18.11.2015 07:43:31 20151118074325-ad8761c2-bfbe-4afc-a9f5-004ab739ebd2.xml(28,61 kB) - Transfer successful
18.11.2015 07:43:31 No more Answers
-----------------------------
10.12.2015 20:18:57 Client started
-----------------------------
10.12.2015 20:18:57 No files to send
10.12.2015 20:18:58 Getting Answers
10.12.2015 20:18:58 Filename: DEEME-2015-DYCIOJ_VISIT.xml
10.12.2015 20:18:58 Filesize: 133(133 B)
10.12.2015 20:18:58 PACKETSIZE: 500
10.12.2015 20:18:58 Tiles: 1
10.12.2015 20:18:58 Getting Answers
10.12.2015 20:18:59 Filename: DEEME-2015-IDUQJU_VISIT.xml
10.12.2015 20:18:59 Filesize: 100(100 B)
10.12.2015 20:18:59 PACKETSIZE: 500
10.12.2015 20:18:59 Tiles: 1
10.12.2015 20:18:59 No more Answers

View File

@ -0,0 +1,13 @@
ALTER TABLE [dbo].[Error]
ADD [Created] DATETIME DEFAULT (getdate()) NULL,
[Deleted] INT DEFAULT 0 NULL;
GO
ALTER TABLE [dbo].[Violation]
ADD [Created] DATETIME DEFAULT (getdate()) NULL,
[Deleted] INT DEFAULT 0 NULL;
GO

View File

@ -148,7 +148,7 @@ namespace SendNSWMessageService
if ((message.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
continue;
/*
// Wenn kein Gefahrgut gemeldet ist soll die Meldeklasse gar nicht gesendet werden
if((message.MessageNotificationClass == Message.NotificationClass.HAZA) ||
(message.MessageNotificationClass == Message.NotificationClass.HAZD))
@ -187,7 +187,7 @@ namespace SendNSWMessageService
if ((DateTime.UtcNow - ata.ATAPortOfCall.Value).TotalDays > 7) continue;
}
}
*/
if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) &&
(message.InternalStatus != Message.BSMDStatus.SENT))

View File

@ -48,6 +48,8 @@ namespace bsmd.ExcelReadService
return cellValue;
}
public void Dispose()
{
if (this.dataReader != null)

View File

@ -158,7 +158,11 @@ namespace bsmd.ReportGenerator
paragraph = section.AddParagraph("Rendering date: ");
paragraph.AddDateField();
paragraph.Format.SpaceAfter = Unit.FromCentimeter(2);
paragraph = section.AddParagraph("Note: Timezone for all values is assumed as UTC!");
paragraph.Format.Font.Size = 12;
paragraph.Format.Font.Bold = true;
paragraph.Format.SpaceAfter = Unit.FromCentimeter(1.5);
Table table = document.LastSection.AddTable();
table.Format.Font.Size = 14;

View File

@ -11,7 +11,7 @@
<userSettings>
<bsmd.dakosy.ResponseService.Properties.Settings>
<setting name="ConnectionString" serializeAs="String">
<value>Data Source=192.168.2.5\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False</value>
<value>Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=FalseData Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
</setting>
<setting name="SleepSeconds" serializeAs="String">
<value>300</value>

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -25,9 +25,7 @@ namespace bsmd.dakosy.ResponseService.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.2.5\\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;" +
"User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCer" +
"tificate=False")]
[global::System.Configuration.DefaultSettingValueAttribute(@"Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=FalseData Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False")]
public string ConnectionString {
get {
return ((string)(this["ConnectionString"]));

View File

@ -3,7 +3,7 @@
<Profiles />
<Settings>
<Setting Name="ConnectionString" Type="System.String" Scope="User">
<Value Profile="(Default)">Data Source=192.168.2.5\SQLEXPRESS;Initial Catalog=nsw;Integrated Security=False;User ID=dfuser;Password=dfpasswd;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False</Value>
<Value Profile="(Default)">Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=FalseData Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</Value>
</Setting>
<Setting Name="SleepSeconds" Type="System.Int32" Scope="User">
<Value Profile="(Default)">300</Value>

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -85,7 +85,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("E:\\Tools\\WinScp\\WinSCP.exe")]
[global::System.Configuration.DefaultSettingValueAttribute("E:\\Tools\\WinScp\\WinSCP.com")]
public string WINSCPFullPath {
get {
return ((string)(this["WINSCPFullPath"]));
@ -97,7 +97,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("out/prod")]
[global::System.Configuration.DefaultSettingValueAttribute("in/prod/ed02")]
public string RemoteProdIncomingDir {
get {
return ((string)(this["RemoteProdIncomingDir"]));
@ -109,7 +109,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("out/test")]
[global::System.Configuration.DefaultSettingValueAttribute("in/test/ed02")]
public string RemoteTestIncomingDir {
get {
return ((string)(this["RemoteTestIncomingDir"]));
@ -121,7 +121,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("in/prod/ed02")]
[global::System.Configuration.DefaultSettingValueAttribute("out/prod")]
public string RemoteProdOutgoingDir {
get {
return ((string)(this["RemoteProdOutgoingDir"]));
@ -133,7 +133,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("in/test/ed02")]
[global::System.Configuration.DefaultSettingValueAttribute("out/test")]
public string RemoteTestOutgoingDir {
get {
return ((string)(this["RemoteTestOutgoingDir"]));

View File

@ -18,19 +18,19 @@
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="WINSCPFullPath" Type="System.String" Scope="User">
<Value Profile="(Default)">E:\Tools\WinScp\WinSCP.exe</Value>
<Value Profile="(Default)">E:\Tools\WinScp\WinSCP.com</Value>
</Setting>
<Setting Name="RemoteProdIncomingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">out/prod</Value>
</Setting>
<Setting Name="RemoteTestIncomingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">out/test</Value>
</Setting>
<Setting Name="RemoteProdOutgoingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">in/prod/ed02</Value>
</Setting>
<Setting Name="RemoteTestOutgoingDir" Type="System.String" Scope="User">
<Setting Name="RemoteTestIncomingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">in/test/ed02</Value>
</Setting>
<Setting Name="RemoteProdOutgoingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">out/prod</Value>
</Setting>
<Setting Name="RemoteTestOutgoingDir" Type="System.String" Scope="User">
<Value Profile="(Default)">out/test</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -21,16 +21,20 @@ namespace bsmd.dakosy
{
private static ILog _log = LogManager.GetLogger(typeof(Request));
public static bool Send(DatabaseEntity dbEntity)
public static bool Send(Message aMessage)
{
bool retval = true;
try
{
/*
Message aMessage = null;
if (dbEntity.GetType().IsAssignableFrom(typeof(Message)))
aMessage = (Message)dbEntity;
else
aMessage = dbEntity.MessageHeader;
*/
if (!XtraSendLogic.ShouldSendMessage(aMessage)) return false;
// fill eDeclaration class
eDeclarationMessage edm = new eDeclarationMessage();
@ -700,11 +704,14 @@ namespace bsmd.dakosy
vList.Visit[0].STAT.ISMCompany.IsmCompanyName = stat.ISMCompanyName;
vList.Visit[0].STAT.ISMCompany.IsmCompanyId = stat.ISMCompanyId;
vList.Visit[0].STAT.ISMCompany.IsmCompanyPostalCode = stat.ISMCompanyPostalCode;
int lastBlank = stat.ISMCompanyStreetAndNumber.LastIndexOf(' ');
if (lastBlank > 0)
if (stat.ISMCompanyStreetAndNumber != null)
{
vList.Visit[0].STAT.ISMCompany.IsmCompanyStreetName = stat.ISMCompanyStreetAndNumber.Substring(0, lastBlank);
vList.Visit[0].STAT.ISMCompany.IsmCompanyStreetNumber = stat.ISMCompanyStreetAndNumber.Substring(lastBlank);
int lastBlank = stat.ISMCompanyStreetAndNumber.LastIndexOf(' ');
if (lastBlank > 0)
{
vList.Visit[0].STAT.ISMCompany.IsmCompanyStreetName = stat.ISMCompanyStreetAndNumber.Substring(0, lastBlank);
vList.Visit[0].STAT.ISMCompany.IsmCompanyStreetNumber = stat.ISMCompanyStreetAndNumber.Substring(lastBlank);
}
}
vList.Visit[0].STAT.ISMCompany.IsmCompanyCity = stat.ISMCompanyCity;
vList.Visit[0].STAT.ISMCompany.IsmCompanyCountry = stat.ISMCompanyCountry;

View File

@ -23,20 +23,20 @@
<value>True</value>
</setting>
<setting name="WINSCPFullPath" serializeAs="String">
<value>E:\Tools\WinScp\WinSCP.exe</value>
<value>E:\Tools\WinScp\WinSCP.com</value>
</setting>
<setting name="RemoteProdIncomingDir" serializeAs="String">
<value>out/prod</value>
</setting>
<setting name="RemoteTestIncomingDir" serializeAs="String">
<value>out/test</value>
</setting>
<setting name="RemoteProdOutgoingDir" serializeAs="String">
<value>in/prod/ed02</value>
</setting>
<setting name="RemoteTestOutgoingDir" serializeAs="String">
<setting name="RemoteTestIncomingDir" serializeAs="String">
<value>in/test/ed02</value>
</setting>
<setting name="RemoteProdOutgoingDir" serializeAs="String">
<value>out/prod</value>
</setting>
<setting name="RemoteTestOutgoingDir" serializeAs="String">
<value>out/test</value>
</setting>
</bsmd.dakosy.Properties.Settings>
</userSettings>
</configuration>

View File

@ -266,7 +266,7 @@ namespace bsmd.database
public void DeleteMessageErrors(Message message)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = string.Format("DELETE FROM Error WHERE MessageHeaderId='{0}'", message.Id);
cmd.CommandText = string.Format("UPDATE Error SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}
@ -274,7 +274,7 @@ namespace bsmd.database
public void DeleteMessageViolations(Message message)
{
SqlCommand cmd = new SqlCommand();
cmd.CommandText = string.Format("DELETE FROM Violation WHERE MessageHeaderId='{0}'", message.Id);
cmd.CommandText = string.Format("UPDATE Violation SET Deleted = 1 WHERE MessageHeaderId='{0}'", message.Id);
int queryResult = this.PerformNonQuery(cmd);
this.LogNonQueryResult(cmd.CommandText, queryResult);
}

View File

@ -30,6 +30,8 @@ namespace bsmd.database
public Guid MessageHeaderId { get; set; }
public bool Deleted { get; set; }
#endregion
#region IDatabaseEntity implementation
@ -41,6 +43,7 @@ namespace bsmd.database
scmd.Parameters.AddWithValue("@MHID", this.MessageHeaderId);
scmd.Parameters.AddWithValue("@VC", this.ErrorCode);
scmd.Parameters.AddWithValue("@VT", this.ErrorText);
scmd.Parameters.AddWithValue("@DEL", this.Deleted ? 1 : 0);
if (this.IsNew)
{
@ -49,13 +52,13 @@ namespace bsmd.database
else
{
scmd.Parameters.AddWithValue("@ID", this.Id);
scmd.CommandText = string.Format("UPDATE {0} SET MessageHeaderId = @MHID, ErrorCode = @VC, ErrorText = @VT WHERE Id = @ID", this.Tablename);
scmd.CommandText = string.Format("UPDATE {0} SET MessageHeaderId = @MHID, ErrorCode = @VC, ErrorText = @VT, Deleted = @DEL WHERE Id = @ID", this.Tablename);
}
}
public override void PrepareLoadCommand(System.Data.IDbCommand cmd, Message.LoadFilter filter, params object[] criteria)
{
string query = string.Format("SELECT Id, ErrorCode, ErrorText FROM {0} ", this.Tablename);
string query = string.Format("SELECT Id, ErrorCode, ErrorText, Deleted FROM {0} ", this.Tablename);
switch (filter)
{
@ -80,6 +83,7 @@ namespace bsmd.database
me.id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) me.ErrorCode = reader.GetInt32(1);
if (!reader.IsDBNull(2)) me.ErrorText = reader.GetString(2);
if (!reader.IsDBNull(3)) me.Deleted = (reader.GetInt32(3) != 0);
result.Add(me);
}
reader.Close();

View File

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

View File

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

View File

@ -0,0 +1,89 @@
//
// Class: XtraSendLogic
// Current CLR: 4.0.30319.42000
// System: Microsoft Visual Studio 10.0
// Author: dani
// Created: 11/30/2015 7:48:46 AM
//
// Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved.
using System;
using System.Collections.Generic;
namespace bsmd.database
{
public class XtraSendLogic
{
/// <summary>
/// Diese Methode entscheidet, ob die Nachrichtenklasse versendet werden soll oder nicht
/// Darin sind einige spezielle Festlegungen implementiert, die aus der Integrationsphase
/// kommen
/// </summary>
/// <returns>true falls Nachricht versendet werden soll</returns>
public static bool ShouldSendMessage(Message message)
{
// Wenn das ein Transit ist, werden nicht erforderliche Meldeklassen übersprungen
if (message.MessageCore.IsTransit)
{
if ((message.MessageNotificationClass == Message.NotificationClass.BKRD) ||
(message.MessageNotificationClass == Message.NotificationClass.PRE72H) ||
(message.MessageNotificationClass == Message.NotificationClass.TIEFD) ||
(message.MessageNotificationClass == Message.NotificationClass.NAME) ||
(message.MessageNotificationClass == Message.NotificationClass.INFO) ||
(message.MessageNotificationClass == Message.NotificationClass.ATA) ||
(message.MessageNotificationClass == Message.NotificationClass.ATD) ||
(message.MessageNotificationClass == Message.NotificationClass.LADG) ||
(message.MessageNotificationClass == Message.NotificationClass.SERV) ||
(message.MessageNotificationClass == Message.NotificationClass.WAS) ||
(message.MessageNotificationClass == Message.NotificationClass.TOWD))
return false;
}
// Wenn kein Gefahrgut gemeldet ist soll die Meldeklasse gar nicht gesendet werden
if ((message.MessageNotificationClass == Message.NotificationClass.HAZA) ||
(message.MessageNotificationClass == Message.NotificationClass.HAZD))
{
if (message.Elements.Count > 0)
{
HAZ haz = message.Elements[0] as HAZ;
if (haz != null)
{
if (haz.NoDPGOnBoardOnArrival ?? false) return false;
// Diese Einstellung wird im EU-NOAD Tool gemacht, muss bei anderen Quellen überarbeitet werden!
if (haz.TransmissionType != "EU-NOAD") return false;
// Schiffe nach Hamburg keine Gefahrgutmeldung, geht über GEGIS (26.11.2015)
if (message.MessageCore.PoC.Equals("DEHAM")) return false;
}
}
}
// ATD wird nur gesendet, wenn weniger als 60 Minuten in der Zukunft
// und auch nicht älter als eine Woche
if (message.MessageNotificationClass == Message.NotificationClass.ATD)
{
if (message.Elements.Count > 0)
{
bsmd.database.ATD atd = message.Elements[0] as bsmd.database.ATD;
if (!atd.ATDPortOfCall.HasValue) return false;
if ((atd.ATDPortOfCall.Value - DateTime.UtcNow).TotalMinutes > 60) return false;
if ((DateTime.UtcNow - atd.ATDPortOfCall.Value).TotalDays > 7) return false;
}
}
// ATA älter als eine Woche wird auch nicht versendet
if (message.MessageNotificationClass == Message.NotificationClass.ATA)
{
if (message.Elements.Count > 0)
{
bsmd.database.ATA ata = message.Elements[0] as bsmd.database.ATA;
if (!ata.ATAPortOfCall.HasValue) return false;
if ((DateTime.UtcNow - ata.ATAPortOfCall.Value).TotalDays > 7) return false;
}
}
return true;
}
}
}

View File

@ -112,6 +112,7 @@
<Compile Include="WAS.cs" />
<Compile Include="Waste.cs" />
<Compile Include="WasteDisposalServiceProvider.cs" />
<Compile Include="XtraSendLogic.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\bsmdKey.snk" />

View File

@ -41,6 +41,8 @@ namespace bsmd.dbh
return false;
}
if (!XtraSendLogic.ShouldSendMessage(message)) return false;
// map message to dbh NSWRequest object
Dbh_Osis_Answ_Ws client = new Dbh_Osis_Answ_Ws();

View File

@ -1006,7 +1006,9 @@ namespace bsmd.herberg.FormService
{
foreach (Waste existingWaste in was.Waste)
{
if ((existingWaste.WasteType ?? 0) == (Enums.ParseWasteType(wDict["WasteType"]) ?? 0))
if (wDict.ContainsKey("WasteType") &&
((existingWaste.WasteType ?? 0) == (Enums.ParseWasteType(wDict["WasteType"]) ?? 0))
)
{
waste = existingWaste;
break;

View File

@ -91,6 +91,8 @@ namespace bsmd.hisnord
foreach (Message message in messages)
{
if (!XtraSendLogic.ShouldSendMessage(message)) continue;
switch (message.MessageNotificationClass)
{
case Message.NotificationClass.VISIT:

Binary file not shown.