5.0.5 + AIS Version 1.1 .. neueste Änderungen sind noch auf dem SMSPLASH01

This commit is contained in:
Daniel Schick 2018-03-30 17:44:22 +00:00
parent dccb6f178b
commit 8a602e8ee8
20 changed files with 180 additions and 50 deletions

View File

@ -40,6 +40,8 @@ CREATE TABLE [dbo].[aisstation] (
[comPort] NVARCHAR (10) NULL,
[name] NVARCHAR (255) NULL,
[baudrate] INT NULL,
[address] NVARCHAR (255) NULL,
[active] BIT NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
@ -101,10 +103,10 @@ CREATE TABLE [dbo].[hotposition] (
GO
PRINT N'Creating unnamed constraint on [dbo].[aisstaticdata]...';
PRINT N'Creating unnamed constraint on [dbo].[hotposition]...';
GO
ALTER TABLE [dbo].[aisstaticdata]
ALTER TABLE [dbo].[hotposition]
ADD DEFAULT newid() FOR [Id];
GO

View File

@ -53,6 +53,16 @@ namespace bsmd.AISService
}
internal void DebugStart()
{
this.Init(null);
string msg = "";
if(this.qManager.Start(ref msg))
{
Console.Read(); // hold it right here
}
}
protected override void OnStop()
{
this.qManager.Stop();

View File

@ -13,7 +13,7 @@ namespace bsmd.AISService.DB
{
#region private members
private int station_Id;
private Guid station_Id;
private string name;
private bool active;
private string comport;
@ -177,7 +177,7 @@ namespace bsmd.AISService.DB
while (reader.Read())
{
AISStation station = new AISStation();
station.station_Id = reader.GetInt32(0);
station.station_Id = reader.GetGuid(0);
station.name = reader.GetString(1);
station.active = reader.GetBoolean(2);
station.latitude = (double) reader.GetInt32(3) / 600000;
@ -201,12 +201,12 @@ namespace bsmd.AISService.DB
public static AISStation CreateStation(string name, DBConnector con)
{
AISStation newStation = new AISStation();
newStation.station_Id = Guid.NewGuid();
newStation.name = name;
newStation.active = true;
string query = string.Format("INSERT INTO aisstation SET name='{0}',active=1",
name);
con.ExecuteNonQuery(query);
newStation.station_Id = Convert.ToInt32(con.ExecuteScalar("SELECT LAST_INSERT_ID()"));
string query = string.Format("INSERT INTO aisstation SET Id='{0}', name='{1}',active=1",
newStation.station_Id, newStation.name);
con.ExecuteNonQuery(query);
return newStation;
}

View File

@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.ServiceProcess;
@ -41,7 +42,11 @@ namespace bsmd.AISService
return 1;
}
}
else
else if(Debugger.IsAttached)
{
AISService aisService = new AISService();
aisService.DebugStart();
} else
{
DisplayUsage();
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<AIS_Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SerialPorts>
<!--SerialPort>
<station>Hamburg 1</station>
<ComPort>COM5</ComPort>
<BaudRate>9600</BaudRate>
</SerialPort-->
</SerialPorts>
<TelnetConnections>
<TelnetConnection>
<ipAddress>127.0.0.1</ipAddress>
<port>32100</port>
</TelnetConnection>
</TelnetConnections>
<Configuration_Path>ais_config.xml</Configuration_Path>
<DBConnectionString>Server=192.168.2.12;Database=ais;Uid=aisuser;Pwd=aispasswd</DBConnectionString>
<UseDB>true</UseDB>
<DBUpdateInterval>500</DBUpdateInterval>
<DBMinPosReportTimeDifference>120</DBMinPosReportTimeDifference>
<StationIsOfflineTimeDifferenceSecs>120</StationIsOfflineTimeDifferenceSecs>
<TargetStaleMins>20</TargetStaleMins>
</AIS_Configuration>

View File

@ -116,6 +116,11 @@
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="ais_config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -210,17 +210,42 @@ namespace ENI2
CopyDeclarationDialog closedDialog = senderDialog as CopyDeclarationDialog;
if (closedDialog.IsOK)
{
if (!closedDialog.NewCore.IsDK && closedDialog.NewCore.VisitId.IsNullOrEmpty() && closedDialog.NewCore.TransitId.IsNullOrEmpty())
MessageCore existingCore = null;
if (newCore.IsDK && newCore.VisitId.IsNullOrEmpty() && newCore.TransitId.IsNullOrEmpty())
{
// deutsche Häfen fordern eine Visit-Id an, für DK erfolgt hier nur die Anlage eines Datensatzes
closedDialog.NewCore.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
newCore.BSMDStatusInternal = MessageCore.BSMDStatus.TOSEND;
}
if (closedDialog.NewCore.PoC.Equals("ZZNOK"))
closedDialog.NewCore.IsTransit = true;
if (newCore.PoC.Equals("ZZNOK")) newCore.IsTransit = true;
newCore.Incoming = true;
newCore.DefaultReportingPartyId = this.LockedBy.Id;
if(!newCore.VisitId.IsNullOrEmpty() || !newCore.TransitId.IsNullOrEmpty())
{
if (newCore.IsTransit)
existingCore = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreByTransitId(newCore.TransitId);
else
existingCore = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoreByVisitId(newCore.VisitId);
}
if(existingCore != null)
{
if(MessageBox.Show(Properties.Resources.textDeclarationAlreadyExists, Properties.Resources.textCaptionExists,
MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
{
}
else
{
}
return;
}
closedDialog.NewCore.Incoming = true;
closedDialog.NewCore.DefaultReportingPartyId = this.LockedBy.Id;
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(newCore);
// Meldeklassen für neuen Anlauf erzeugen

View File

@ -666,6 +666,14 @@ namespace ENI2.DetailViewControls
for (int i = 0; i < this.Messages.Count; i++)
{
Message selectedMessage = this.Messages[i];
// 28.3. Diese Nachrichten sollten dabei nicht geprüft werden.. immer diese Spezialfälle
if ((selectedMessage.MessageNotificationClass == Message.NotificationClass.VISIT) ||
(selectedMessage.MessageNotificationClass == Message.NotificationClass.TRANSIT) ||
(selectedMessage.MessageNotificationClass == Message.NotificationClass.CREWD) ||
(selectedMessage.MessageNotificationClass == Message.NotificationClass.PASD) ||
(selectedMessage.MessageNotificationClass == Message.NotificationClass.STO)) continue;
if ((selectedMessage.InternalStatus == Message.BSMDStatus.SENT) || (selectedMessage.InternalStatus == Message.BSMDStatus.TOSEND))
{
cannotCreateReport = true;

View File

@ -35,8 +35,8 @@
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.html</WebPage>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.0.5.%2a</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>5.0.6.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>

View File

@ -118,6 +118,20 @@ namespace ENI2.EditControls
private void textBoxVisitTransitId_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
string newVisitId = this.textBoxVisitTransitId.Text;
// bei Angabe einer gültigen Visit/Transit Id soll
// a) IMO nicht mehr änderbar sein und
// b) der Hafen aus der Visit/Transit Id abgeleitet werden
if (bsmd.database.Util.IsVisitId(newVisitId) || bsmd.database.Util.IsTransitId(newVisitId))
{
this.doubleUpDownIMO.IsEnabled = false;
this.locodePoC.LocodeValue = newVisitId.Substring(0, 5);
}
else
{
this.doubleUpDownIMO.IsEnabled = true;
}
this.CheckComplete();
}

View File

@ -1052,6 +1052,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Item already exists.
/// </summary>
public static string textCaptionExists {
get {
return ResourceManager.GetString("textCaptionExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Information.
/// </summary>
@ -1664,6 +1673,15 @@ namespace ENI2.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to There is already a declaration with this ID. A new declaration will not be created. Do you want to clear all data? .
/// </summary>
public static string textDeclarationAlreadyExists {
get {
return ResourceManager.GetString("textDeclarationAlreadyExists", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Declarations.
/// </summary>

View File

@ -1639,4 +1639,10 @@
<data name="textCopyFromL10P" xml:space="preserve">
<value>Copy from last 10 port facilities called</value>
</data>
<data name="textCaptionExists" xml:space="preserve">
<value>Item already exists</value>
</data>
<data name="textDeclarationAlreadyExists" xml:space="preserve">
<value>There is already a declaration with this ID. A new declaration will not be created. Do you want to clear all data? </value>
</data>
</root>

Binary file not shown.

View File

@ -2,6 +2,6 @@
[assembly: AssemblyCompany("schick Informatik")]
[assembly: AssemblyProduct("BSMD NSW interface")]
[assembly: AssemblyInformationalVersion("5.0.5")]
[assembly: AssemblyInformationalVersion("5.0.7")]
[assembly: AssemblyCopyright("Copyright © 2014-2018 schick Informatik")]
[assembly: AssemblyTrademark("")]

View File

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

View File

@ -21,7 +21,7 @@ namespace bsmd.dbh.ResponseService
bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial,
bsmd.dbh.response.RootReportingClassesError RootReportingClassesError,
bsmd.dbh.response.RootReportingClassesResetted ReportingClassesResetted,
bsmd.dbh.response.RootMessage[] Messages);
bsmd.dbh.response.Message[] Messages);
}

View File

@ -18,7 +18,7 @@ namespace bsmd.dbh.ResponseService
bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial,
bsmd.dbh.response.RootReportingClassesError RootReportingClassesError,
bsmd.dbh.response.RootReportingClassesResetted ReportingClassesResetted,
bsmd.dbh.response.RootMessage[] Messages)
bsmd.dbh.response.Message[] Messages)
{
// Der Fehler hier aktuell ist dass alles funktioniert, außer dass "Messages" nicht

View File

@ -51,7 +51,7 @@ namespace bsmd.dbh.response
private RootReportingClassesResetted reportingClassesResettedField;
private RootMessage[] messagesField;
private Message[] messagesField;
/// <remarks/>
public string Version
@ -212,7 +212,7 @@ namespace bsmd.dbh.response
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("Message", IsNullable = false)]
public RootMessage[] Messages
public Message[] Messages
{
get
{
@ -443,7 +443,7 @@ namespace bsmd.dbh.response
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
public partial class RootMessage
public partial class Message
{
private string idField;

View File

@ -1169,15 +1169,27 @@ namespace bsmd.dbh
}
else
{
rootHAZA.Items = new object[3];
rootHAZA.ItemsElementName = new ItemsChoiceType5[3];
rootHAZA.Items = new object[4];
rootHAZA.ItemsElementName = new ItemsChoiceType5[4];
// if(haz.DPGManifestOnBoardOnArrival.HasValue)
rootHAZA.ItemsElementName[0] = ItemsChoiceType5.DPGManifestOnBoardOnArrival;
rootHAZA.Items[0] = (haz.DPGManifestOnBoardOnArrival ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootHAZA.ItemsElementName[1] = ItemsChoiceType5.INFShipClass;
if (haz.INFShipClass.HasValue)
{
INFClassType infShipClass = (INFClassType)haz.INFShipClass.Value;
rootHAZA.Items[1] = infShipClass;
}
rootHAZA.ItemsElementName[2] = ItemsChoiceType5.MOUBaltic;
rootHAZA.Items[2] = (haz.MOUBaltic ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
#region HAZ positions
rootHAZA.ItemsElementName[1] = ItemsChoiceType5.DPGOnArrival;
rootHAZA.ItemsElementName[3] = ItemsChoiceType5.DPGOnArrival;
DBHWebReference.RootHAZADPGOnArrival dpgOnArrival = new DBHWebReference.RootHAZADPGOnArrival();
@ -1387,17 +1399,10 @@ namespace bsmd.dbh
}
#endregion
rootHAZA.Items[1] = dpgOnArrival;
rootHAZA.Items[3] = dpgOnArrival;
#endregion
rootHAZA.ItemsElementName[2] = ItemsChoiceType5.INFShipClass;
if (haz.INFShipClass.HasValue)
{
INFClassType infShipClass = (INFClassType) haz.INFShipClass.Value;
rootHAZA.Items[2] = infShipClass;
}
}
item = rootHAZA;
@ -1423,13 +1428,24 @@ namespace bsmd.dbh
else
{
rootHAZD.Items = new object[3];
rootHAZD.ItemsElementName = new ItemsChoiceType6[3];
rootHAZD.Items = new object[4];
rootHAZD.ItemsElementName = new ItemsChoiceType6[4];
rootHAZD.ItemsElementName[0] = ItemsChoiceType6.DPGManifestOnBoardOnDeparture;
if (haz.DPGManifestOnBoardOnArrival.HasValue)
rootHAZD.Items[0] = haz.DPGManifestOnBoardOnArrival.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
rootHAZD.ItemsElementName[1] = ItemsChoiceType6.INFShipClass;
if (haz.INFShipClass.HasValue)
{
INFClassType infShipClass = (INFClassType)haz.INFShipClass.Value;
rootHAZD.Items[1] = infShipClass;
}
rootHAZD.ItemsElementName[2] = ItemsChoiceType6.MOUBaltic;
rootHAZD.Items[2] = (haz.MOUBaltic ?? false) ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
#region HAZ positions
RootHAZDDPGOnDeparture dpgOnDeparture = new RootHAZDDPGOnDeparture();
@ -1640,19 +1656,11 @@ namespace bsmd.dbh
}
#endregion
rootHAZD.ItemsElementName[1] = ItemsChoiceType6.DPGOnDeparture;
rootHAZD.Items[1] = dpgOnDeparture;
rootHAZD.ItemsElementName[3] = ItemsChoiceType6.DPGOnDeparture;
rootHAZD.Items[3] = dpgOnDeparture;
#endregion
rootHAZD.ItemsElementName[2] = ItemsChoiceType6.INFShipClass;
if (haz.INFShipClass.HasValue)
{
INFClassType infShipClass = (INFClassType)haz.INFShipClass.Value;
rootHAZD.Items[2] = infShipClass;
}
}

View File

@ -22,7 +22,7 @@ namespace bsmd.dbh
private static ILog _log = LogManager.GetLogger("dbh Response");
public static void ProcessResponse(string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, response.RootType Type, bsmd.dbh.response.RootMessage[] Messages,
string SenderReference, response.RootType Type, bsmd.dbh.response.Message[] Messages,
bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull,
bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial,
bsmd.dbh.response.RootReportingClassesError ReportingClassesError,
@ -179,12 +179,17 @@ namespace bsmd.dbh
_log.InfoFormat("message {0} type {1}: {2}", i,
Messages[i].Type,
Messages[i].Text ?? "null");
int code = 0;
bool hasCode = Int32.TryParse(Messages[i].ID, out code);
switch (Messages[i].Type)
{
case dbh.response.RootMessageType.ERROR:
MessageError error = new MessageError();
error.ErrorText = Messages[i].Text;
if (hasCode) error.ErrorCode = code;
_log.WarnFormat("Error received for {0}: {1}", Messages[i].Type, error.ErrorText);
error.MessageHeaderId = aMessage.Id.Value;
aMessage.InternalStatus = Message.BSMDStatus.ERROR;
@ -196,6 +201,7 @@ namespace bsmd.dbh
case dbh.response.RootMessageType.VIOLATION:
MessageViolation violation = new MessageViolation();
violation.ViolationText = Messages[i].Text;
if (hasCode) violation.ViolationCode = code;
_log.WarnFormat("Violation received for {0}: {1}", Messages[i].Type, violation.ViolationText);
violation.MessageHeaderId = aMessage.Id.Value;
aMessage.InternalStatus = Message.BSMDStatus.VIOLATION;