WE in Uko
This commit is contained in:
parent
849578d7a2
commit
977b92c4f4
@ -26,12 +26,12 @@
|
|||||||
<value>1000</value>
|
<value>1000</value>
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="LockingServerAddress" serializeAs="String">
|
<setting name="LockingServerAddress" serializeAs="String">
|
||||||
<!--value>http://192.168.2.24/LockingService/LockingService.svc</value-->
|
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
|
||||||
<value>http://heupferd/bsmd.LockingService/LockingService.svc</value>
|
<!--value>http://heupferd/bsmd.LockingService/LockingService.svc</value-->
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="ConnectionString" serializeAs="String">
|
<setting name="ConnectionString" serializeAs="String">
|
||||||
<!--value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value-->
|
<value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
|
||||||
<value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value>
|
<!--value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value-->
|
||||||
</setting>
|
</setting>
|
||||||
</ENI2.Properties.Settings>
|
</ENI2.Properties.Settings>
|
||||||
</applicationSettings>
|
</applicationSettings>
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||||
<WebPage>publish.html</WebPage>
|
<WebPage>publish.html</WebPage>
|
||||||
<ApplicationRevision>1</ApplicationRevision>
|
<ApplicationRevision>1</ApplicationRevision>
|
||||||
<ApplicationVersion>5.7.0.%2a</ApplicationVersion>
|
<ApplicationVersion>5.8.0.%2a</ApplicationVersion>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||||
|
|||||||
Binary file not shown.
@ -13,18 +13,18 @@ namespace SendNSWMessageService
|
|||||||
public partial class NSWSendService : ServiceBase
|
public partial class NSWSendService : ServiceBase
|
||||||
{
|
{
|
||||||
private Timer _timer;
|
private Timer _timer;
|
||||||
private object _timerlock = new object();
|
private readonly object _timerlock = new object();
|
||||||
private bool processRunning = false;
|
private bool processRunning = false;
|
||||||
private ILog _log = LogManager.GetLogger(typeof(NSWSendService));
|
private readonly ILog _log = LogManager.GetLogger(typeof(NSWSendService));
|
||||||
|
|
||||||
public NSWSendService()
|
public NSWSendService()
|
||||||
{
|
{
|
||||||
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
System.Net.ServicePointManager.ServerCertificateValidationCallback += delegate (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
|
System.Net.ServicePointManager.ServerCertificateValidationCallback += (object _, System.Security.Cryptography.X509Certificates.X509Certificate ____,
|
||||||
System.Security.Cryptography.X509Certificates.X509Chain chain,
|
System.Security.Cryptography.X509Certificates.X509Chain __,
|
||||||
System.Net.Security.SslPolicyErrors sslPolicyErrors)
|
System.Net.Security.SslPolicyErrors ___) =>
|
||||||
{
|
{
|
||||||
return true; // **** Immer OK weil wir nur mit einem dedizierten Endpoint reden..
|
return true; // **** Immer OK weil wir nur mit einem dedizierten Endpoint reden..
|
||||||
};
|
};
|
||||||
@ -57,7 +57,7 @@ namespace SendNSWMessageService
|
|||||||
this.DoOnce();
|
this.DoOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init(string[] args)
|
private void Init(string[] args)
|
||||||
{
|
{
|
||||||
this._timer = new Timer();
|
this._timer = new Timer();
|
||||||
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
|
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
|
||||||
@ -70,11 +70,11 @@ namespace SendNSWMessageService
|
|||||||
this._timer_Elapsed(null, null);
|
this._timer_Elapsed(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _timer_Elapsed(object sender, ElapsedEventArgs e)
|
private void _timer_Elapsed(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
lock (this._timerlock)
|
lock (this._timerlock)
|
||||||
{
|
{
|
||||||
if (this.processRunning) return;
|
if (processRunning) return;
|
||||||
else this.processRunning = true;
|
else this.processRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ namespace SendNSWMessageService
|
|||||||
|
|
||||||
case Message.NSWProvider.DBH:
|
case Message.NSWProvider.DBH:
|
||||||
case Message.NSWProvider.DBH_TEST:
|
case Message.NSWProvider.DBH_TEST:
|
||||||
sendSucceeded = bsmd.dbh.Request.SendMessage(message, (message.HIS == Message.NSWProvider.DBH_TEST));
|
sendSucceeded = bsmd.dbh.Request.SendMessage(message, message.HIS == Message.NSWProvider.DBH_TEST);
|
||||||
if (!sendSucceeded)
|
if (!sendSucceeded)
|
||||||
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
|
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
|
||||||
else
|
else
|
||||||
@ -193,7 +193,7 @@ namespace SendNSWMessageService
|
|||||||
break;
|
break;
|
||||||
case Message.NSWProvider.DUDR:
|
case Message.NSWProvider.DUDR:
|
||||||
case Message.NSWProvider.DUDR_TEST:
|
case Message.NSWProvider.DUDR_TEST:
|
||||||
bool? sendResult = bsmd.hisnord.Request.CreateSendFile(core, message, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
|
bool? sendResult = bsmd.hisnord.Request.CreateSendFile(core, message, core.InitialHIS == Message.NSWProvider.DUDR_TEST);
|
||||||
if (sendResult.HasValue)
|
if (sendResult.HasValue)
|
||||||
{
|
{
|
||||||
didSendSomething = true;
|
didSendSomething = true;
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
[assembly: AssemblyCompany("schick Informatik")]
|
[assembly: AssemblyCompany("schick Informatik")]
|
||||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||||
[assembly: AssemblyInformationalVersion("5.8.0")]
|
[assembly: AssemblyInformationalVersion("5.9.0")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2014-2019 schick Informatik")]
|
[assembly: AssemblyCopyright("Copyright © 2014-2019 schick Informatik")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("5.8.0.*")]
|
[assembly: AssemblyVersion("5.9.0.*")]
|
||||||
|
|
||||||
|
|||||||
@ -1292,7 +1292,8 @@ namespace bsmd.dbh
|
|||||||
|
|
||||||
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
||||||
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
||||||
rootIMDG.Remarks = imdgPos.Remarks;
|
if(!imdgPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIMDG.Remarks = imdgPos.Remarks;
|
||||||
|
|
||||||
dpgOnArrival.DPGItemIMDG[i] = rootIMDG;
|
dpgOnArrival.DPGItemIMDG[i] = rootIMDG;
|
||||||
}
|
}
|
||||||
@ -1325,7 +1326,8 @@ namespace bsmd.dbh
|
|||||||
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
|
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
|
||||||
if (ibcPos.SpecRef15_19.HasValue)
|
if (ibcPos.SpecRef15_19.HasValue)
|
||||||
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N;
|
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? DBHWebReference.RootSECValidISSCOnBoard.Y : DBHWebReference.RootSECValidISSCOnBoard.N;
|
||||||
rootIBC.Remarks = ibcPos.Remarks;
|
if(!ibcPos.Remarks.IsNullOrEmpty() )
|
||||||
|
rootIBC.Remarks = ibcPos.Remarks;
|
||||||
|
|
||||||
dpgOnArrival.DPGItemIBC[i] = rootIBC;
|
dpgOnArrival.DPGItemIBC[i] = rootIBC;
|
||||||
}
|
}
|
||||||
@ -1349,7 +1351,8 @@ namespace bsmd.dbh
|
|||||||
rootIGC.StowagePosition = igcPos.StowagePosition;
|
rootIGC.StowagePosition = igcPos.StowagePosition;
|
||||||
rootIGC.PortOfLoading = igcPos.PortOfLoading;
|
rootIGC.PortOfLoading = igcPos.PortOfLoading;
|
||||||
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
|
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
|
||||||
rootIGC.Remarks = igcPos.Remarks;
|
if(!igcPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIGC.Remarks = igcPos.Remarks;
|
||||||
|
|
||||||
dpgOnArrival.DPGItemIGC[i] = rootIGC;
|
dpgOnArrival.DPGItemIGC[i] = rootIGC;
|
||||||
}
|
}
|
||||||
@ -1375,7 +1378,8 @@ namespace bsmd.dbh
|
|||||||
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
|
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
|
||||||
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
|
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
|
||||||
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
|
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
|
||||||
rootIMSBC.Remarks = imsbcPos.Remarks;
|
if(!imsbcPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIMSBC.Remarks = imsbcPos.Remarks;
|
||||||
|
|
||||||
dpgOnArrival.DPGItemIMSBC[i] = rootIMSBC;
|
dpgOnArrival.DPGItemIMSBC[i] = rootIMSBC;
|
||||||
}
|
}
|
||||||
@ -1400,7 +1404,8 @@ namespace bsmd.dbh
|
|||||||
rootMarpol.StowagePosition = marpolPos.StowagePosition;
|
rootMarpol.StowagePosition = marpolPos.StowagePosition;
|
||||||
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
|
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
|
||||||
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
|
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
|
||||||
rootMarpol.Remarks = marpolPos.Remarks;
|
if(!marpolPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootMarpol.Remarks = marpolPos.Remarks;
|
||||||
|
|
||||||
dpgOnArrival.DPGItemMARPOLAnnexI[i] = rootMarpol;
|
dpgOnArrival.DPGItemMARPOLAnnexI[i] = rootMarpol;
|
||||||
}
|
}
|
||||||
@ -1551,7 +1556,8 @@ namespace bsmd.dbh
|
|||||||
|
|
||||||
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
rootIMDG.PortOfLoading = imdgPos.PortOfLoading;
|
||||||
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
rootIMDG.PortOfDischarge = imdgPos.PortOfDischarge;
|
||||||
rootIMDG.Remarks = imdgPos.Remarks;
|
if(!imdgPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIMDG.Remarks = imdgPos.Remarks;
|
||||||
|
|
||||||
dpgOnDeparture.DPGItemIMDG[i] = rootIMDG;
|
dpgOnDeparture.DPGItemIMDG[i] = rootIMDG;
|
||||||
}
|
}
|
||||||
@ -1584,7 +1590,8 @@ namespace bsmd.dbh
|
|||||||
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
|
rootIBC.SpecRef15_19Specified = ibcPos.SpecRef15_19.HasValue;
|
||||||
if (ibcPos.SpecRef15_19.HasValue)
|
if (ibcPos.SpecRef15_19.HasValue)
|
||||||
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
|
rootIBC.SpecRef15_19 = ibcPos.SpecRef15_19.Value ? RootSECValidISSCOnBoard.Y : RootSECValidISSCOnBoard.N;
|
||||||
rootIBC.Remarks = ibcPos.Remarks;
|
if(!ibcPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIBC.Remarks = ibcPos.Remarks;
|
||||||
|
|
||||||
dpgOnDeparture.DPGItemIBC[i] = rootIBC;
|
dpgOnDeparture.DPGItemIBC[i] = rootIBC;
|
||||||
}
|
}
|
||||||
@ -1608,7 +1615,8 @@ namespace bsmd.dbh
|
|||||||
rootIGC.StowagePosition = igcPos.StowagePosition;
|
rootIGC.StowagePosition = igcPos.StowagePosition;
|
||||||
rootIGC.PortOfLoading = igcPos.PortOfLoading;
|
rootIGC.PortOfLoading = igcPos.PortOfLoading;
|
||||||
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
|
rootIGC.PortOfDischarge = igcPos.PortOfDischarge;
|
||||||
rootIGC.Remarks = igcPos.Remarks;
|
if(!igcPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIGC.Remarks = igcPos.Remarks;
|
||||||
|
|
||||||
dpgOnDeparture.DPGItemIGC[i] = rootIGC;
|
dpgOnDeparture.DPGItemIGC[i] = rootIGC;
|
||||||
}
|
}
|
||||||
@ -1634,7 +1642,8 @@ namespace bsmd.dbh
|
|||||||
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
|
rootIMSBC.StowagePosition = imsbcPos.StowagePosition;
|
||||||
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
|
rootIMSBC.PortOfLoading = imsbcPos.PortOfLoading;
|
||||||
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
|
rootIMSBC.PortOfDischarge = imsbcPos.PortOfDischarge;
|
||||||
rootIMSBC.Remarks = imsbcPos.Remarks;
|
if(!imsbcPos.Remarks.IsNullOrEmpty())
|
||||||
|
rootIMSBC.Remarks = imsbcPos.Remarks;
|
||||||
|
|
||||||
dpgOnDeparture.DPGItemIMSBC[i] = rootIMSBC;
|
dpgOnDeparture.DPGItemIMSBC[i] = rootIMSBC;
|
||||||
}
|
}
|
||||||
@ -1659,7 +1668,8 @@ namespace bsmd.dbh
|
|||||||
rootMarpol.StowagePosition = marpolPos.StowagePosition;
|
rootMarpol.StowagePosition = marpolPos.StowagePosition;
|
||||||
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
|
rootMarpol.PortOfLoading = marpolPos.PortOfLoading;
|
||||||
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
|
rootMarpol.PortOfDischarge = marpolPos.PortOfDischarge;
|
||||||
rootMarpol.Remarks = marpolPos.Remarks;
|
if(!rootMarpol.Remarks.IsNullOrEmpty())
|
||||||
|
rootMarpol.Remarks = marpolPos.Remarks;
|
||||||
|
|
||||||
dpgOnDeparture.DPGItemMARPOLAnnexI[i] = rootMarpol;
|
dpgOnDeparture.DPGItemMARPOLAnnexI[i] = rootMarpol;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,20 +13,9 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
public class NSWResponse
|
public class NSWResponse
|
||||||
{
|
{
|
||||||
private string _clientRequestId;
|
private readonly DateTime _receiveAt;
|
||||||
private DateTime _receiveAt;
|
|
||||||
private string _notificationId;
|
|
||||||
private string _status;
|
|
||||||
private string _visitId;
|
|
||||||
private string _transitId;
|
|
||||||
private Message.NotificationClass _notificationClass;
|
|
||||||
private bool _isReset;
|
|
||||||
|
|
||||||
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));
|
private readonly ILog _log = LogManager.GetLogger(typeof(NSWResponse));
|
||||||
|
|
||||||
public NSWResponse(XElement xml)
|
public NSWResponse(XElement xml)
|
||||||
{
|
{
|
||||||
@ -72,10 +61,9 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
XName idName = "ConveyanceCode";
|
XName idName = "ConveyanceCode";
|
||||||
var elem = xml.Descendants(idName);
|
var elem = xml.Descendants(idName);
|
||||||
if (elem.Count() > 0)
|
if (elem.Any())
|
||||||
{
|
{
|
||||||
Guid aGuid;
|
if (Guid.TryParse(elem.FirstOrDefault()?.Value, out Guid aGuid))
|
||||||
if (Guid.TryParse(elem.FirstOrDefault()?.Value, out aGuid))
|
|
||||||
_messageCoreId = aGuid;
|
_messageCoreId = aGuid;
|
||||||
else
|
else
|
||||||
_log.WarnFormat("cannot parse ConveyanceCode {0}", elem.FirstOrDefault());
|
_log.WarnFormat("cannot parse ConveyanceCode {0}", elem.FirstOrDefault());
|
||||||
@ -89,23 +77,22 @@ namespace bsmd.hisnord
|
|||||||
var mElem = xml.Descendants(meldeTypeName);
|
var mElem = xml.Descendants(meldeTypeName);
|
||||||
Message.NotificationClass? notificationClass = null;
|
Message.NotificationClass? notificationClass = null;
|
||||||
|
|
||||||
if(mElem.Count() > 0)
|
if(mElem.Any())
|
||||||
{
|
{
|
||||||
Message.NotificationClass tmpClass;
|
if (Enum.TryParse<Message.NotificationClass>(mElem.FirstOrDefault()?.Value, out Message.NotificationClass tmpClass))
|
||||||
if (Enum.TryParse<Message.NotificationClass>(mElem.FirstOrDefault()?.Value, out tmpClass))
|
|
||||||
notificationClass = tmpClass;
|
notificationClass = tmpClass;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// könnte VISIT/TRANSIT Id Beantragung sein
|
// könnte VISIT/TRANSIT Id Beantragung sein
|
||||||
XName test = ns15 + "VisitIdResponse";
|
XName test = ns15 + "VisitIdResponse";
|
||||||
if (xml.Descendants(test).Count() > 0)
|
if (xml.Descendants(test).Any())
|
||||||
{
|
{
|
||||||
notificationClass = Message.NotificationClass.VISIT;
|
notificationClass = Message.NotificationClass.VISIT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
test = ns16 + "TransitIdResponse";
|
test = ns16 + "TransitIdResponse";
|
||||||
if (xml.Descendants(test).Count() > 0) notificationClass = Message.NotificationClass.TRANSIT;
|
if (xml.Descendants(test).Any()) notificationClass = Message.NotificationClass.TRANSIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!notificationClass.HasValue)
|
if (!notificationClass.HasValue)
|
||||||
@ -113,19 +100,19 @@ namespace bsmd.hisnord
|
|||||||
XName cancelVisit = cancelVisitNS + "CancelVisitIdResponse";
|
XName cancelVisit = cancelVisitNS + "CancelVisitIdResponse";
|
||||||
XName cancelTransit = cancelTransitNS + "CancelTransitIdResponse";
|
XName cancelTransit = cancelTransitNS + "CancelTransitIdResponse";
|
||||||
|
|
||||||
if (xml.Descendants(cancelVisit).Count() > 0)
|
if (xml.Descendants(cancelVisit).Any())
|
||||||
{
|
{
|
||||||
lookupName = cancelVisit;
|
lookupName = cancelVisit;
|
||||||
notificationClass = Message.NotificationClass.STO; // HACK, es gibt keine Klasse für "Cancel"
|
notificationClass = Message.NotificationClass.STO; // HACK, es gibt keine Klasse für "Cancel"
|
||||||
_log.WarnFormat("CANCEL VISIT, setting Not.Class to STO (experimental)");
|
_log.WarnFormat("CANCEL VISIT, setting Not.Class to STO (experimental)");
|
||||||
_notificationClass = Message.NotificationClass.STO;
|
NotificationClass = Message.NotificationClass.STO;
|
||||||
}
|
}
|
||||||
else if(xml.Descendants(cancelTransit).Count() > 0)
|
else if (xml.Descendants(cancelTransit).Any())
|
||||||
{
|
{
|
||||||
lookupName = cancelTransit;
|
lookupName = cancelTransit;
|
||||||
notificationClass = Message.NotificationClass.STO; // HACK, es gibt keine Klasse für "Cancel"
|
notificationClass = Message.NotificationClass.STO; // HACK, es gibt keine Klasse für "Cancel"
|
||||||
_log.WarnFormat("CANCEL TRANSIT, setting Not.Class to STO (experimental)");
|
_log.WarnFormat("CANCEL TRANSIT, setting Not.Class to STO (experimental)");
|
||||||
_notificationClass = Message.NotificationClass.STO;
|
NotificationClass = Message.NotificationClass.STO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -234,55 +221,55 @@ namespace bsmd.hisnord
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool lookupMatch = (xml.Descendants(lookupName).Count() > 0);
|
bool lookupMatch = (xml.Descendants(lookupName).Any());
|
||||||
bool resetMatch = (xml.Descendants(resetLookup).Count() > 0);
|
bool resetMatch = (xml.Descendants(resetLookup).Any());
|
||||||
|
|
||||||
if(lookupMatch || resetMatch)
|
if(lookupMatch || resetMatch)
|
||||||
{
|
{
|
||||||
|
|
||||||
_isReset = resetMatch;
|
IsReset = resetMatch;
|
||||||
|
|
||||||
_notificationClass = notificationClass.Value;
|
NotificationClass = notificationClass.Value;
|
||||||
|
|
||||||
// match found
|
// match found
|
||||||
XName xname = ns6 + "ClientRequestId";
|
XName xname = ns6 + "ClientRequestId";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if (elem.Count() > 0)
|
if (elem.Any())
|
||||||
{
|
{
|
||||||
_clientRequestId = elem.First()?.Value;
|
ClientRequestId = elem.First()?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
xname = ns6 + "ReceivedAt";
|
xname = ns6 + "ReceivedAt";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if(elem.Count() > 0)
|
if(elem.Any())
|
||||||
{
|
{
|
||||||
DateTime.TryParse(elem.First()?.Value, out _receiveAt);
|
DateTime.TryParse(elem.First()?.Value, out _receiveAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
xname = ns6 + "NotificationId";
|
xname = ns6 + "NotificationId";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if (elem.Count() > 0)
|
if (elem.Any())
|
||||||
_notificationId = elem.First()?.Value;
|
NotificationId = elem.First()?.Value;
|
||||||
|
|
||||||
xname = ns6 + "Status";
|
xname = ns6 + "Status";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if(elem.Count() > 0)
|
if(elem.Any())
|
||||||
{
|
{
|
||||||
_status = elem.First()?.Value;
|
Status = elem.First()?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
xname = ns6 + "VisitId";
|
xname = ns6 + "VisitId";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if(elem.Count() > 0)
|
if(elem.Any())
|
||||||
{
|
{
|
||||||
_visitId = elem.First()?.Value;
|
VisitId = elem.First()?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
xname = ns6 + "TransitId";
|
xname = ns6 + "TransitId";
|
||||||
elem = xml.Descendants(xname);
|
elem = xml.Descendants(xname);
|
||||||
if (elem.Count() > 0)
|
if (elem.Any())
|
||||||
{
|
{
|
||||||
_transitId = elem.First()?.Value;
|
TransitId = elem.First()?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,7 +287,7 @@ namespace bsmd.hisnord
|
|||||||
else
|
else
|
||||||
mv.ViolationCode = vCode;
|
mv.ViolationCode = vCode;
|
||||||
mv.ViolationText = anElem.Element(vTextName).Value;
|
mv.ViolationText = anElem.Element(vTextName).Value;
|
||||||
_violations.Add(mv);
|
Violations.Add(mv);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for errors ----------------------------------------------
|
// check for errors ----------------------------------------------
|
||||||
@ -317,7 +304,7 @@ namespace bsmd.hisnord
|
|||||||
else
|
else
|
||||||
me.ErrorCode = eCode;
|
me.ErrorCode = eCode;
|
||||||
me.ErrorText = anElem.Element(eTextName).Value;
|
me.ErrorText = anElem.Element(eTextName).Value;
|
||||||
_errors.Add(me);
|
Errors.Add(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -328,25 +315,25 @@ namespace bsmd.hisnord
|
|||||||
|
|
||||||
public Guid? MessageCoreId { get { return _messageCoreId; } }
|
public Guid? MessageCoreId { get { return _messageCoreId; } }
|
||||||
|
|
||||||
public string ClientRequestId { get { return _clientRequestId; } }
|
public string ClientRequestId { get; }
|
||||||
|
|
||||||
public DateTime? ReceiveAt { get { return _receiveAt; } }
|
public DateTime? ReceiveAt { get { return _receiveAt; } }
|
||||||
|
|
||||||
public string NotificationId { get { return _notificationId; } }
|
public string NotificationId { get; }
|
||||||
|
|
||||||
public string Status { get { return this._status; } }
|
public string Status { get; }
|
||||||
|
|
||||||
public string VisitId { get { return this._visitId; } }
|
public string VisitId { get; }
|
||||||
|
|
||||||
public string TransitId { get { return this._transitId; } }
|
public string TransitId { get; }
|
||||||
|
|
||||||
public List<MessageViolation> Violations { get { return _violations; } }
|
public List<MessageViolation> Violations { get; } = new List<MessageViolation>();
|
||||||
|
|
||||||
public List<MessageError> Errors { get { return _errors; } }
|
public List<MessageError> Errors { get; } = new List<MessageError>();
|
||||||
|
|
||||||
public Message.NotificationClass NotificationClass { get { return this._notificationClass; } }
|
public Message.NotificationClass NotificationClass { get; }
|
||||||
|
|
||||||
public bool IsReset { get { return this._isReset; } }
|
public bool IsReset { get; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@ -19,8 +19,8 @@ namespace bsmd.hisnord
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class TransitId
|
public class TransitId
|
||||||
{
|
{
|
||||||
private string _transitId = null;
|
private readonly string _transitId = null;
|
||||||
private static ILog _log = LogManager.GetLogger(typeof(bsmd.hisnord.TransitId));
|
private static readonly ILog _log = LogManager.GetLogger(typeof(bsmd.hisnord.TransitId));
|
||||||
|
|
||||||
#region Construction
|
#region Construction
|
||||||
|
|
||||||
@ -54,8 +54,7 @@ namespace bsmd.hisnord
|
|||||||
int startIndex = this.ConveyanceCode.IndexOf('-');
|
int startIndex = this.ConveyanceCode.IndexOf('-');
|
||||||
if (startIndex > 0)
|
if (startIndex > 0)
|
||||||
{
|
{
|
||||||
Guid tmpGuid;
|
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out Guid tmpGuid))
|
||||||
if (Guid.TryParse(this.ConveyanceCode.Substring(startIndex + 1), out tmpGuid))
|
|
||||||
result = tmpGuid;
|
result = tmpGuid;
|
||||||
else if (Guid.TryParse(this.ConveyanceCode, out tmpGuid))
|
else if (Guid.TryParse(this.ConveyanceCode, out tmpGuid))
|
||||||
result = tmpGuid;
|
result = tmpGuid;
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace bsmd.hisnord
|
|||||||
{
|
{
|
||||||
public class transmitter
|
public class transmitter
|
||||||
{
|
{
|
||||||
private static ILog _log = LogManager.GetLogger(typeof(transmitter));
|
private static readonly ILog _log = LogManager.GetLogger(typeof(transmitter));
|
||||||
private static int? processId; // Achtung, das müsste getrennt behandelt werden Test <-> Livesystem!
|
private static int? processId; // Achtung, das müsste getrennt behandelt werden Test <-> Livesystem!
|
||||||
private static int? processTestId;
|
private static int? processTestId;
|
||||||
|
|
||||||
@ -48,51 +48,53 @@ namespace bsmd.hisnord
|
|||||||
// damit das gut geht schicken wir die Nachrichten einzeln und arbeiten jeweils das
|
// damit das gut geht schicken wir die Nachrichten einzeln und arbeiten jeweils das
|
||||||
// Ergebnis ab
|
// Ergebnis ab
|
||||||
|
|
||||||
Process transmitterProcess = new Process();
|
using (Process transmitterProcess = new Process())
|
||||||
if (useTest)
|
|
||||||
{
|
{
|
||||||
transmitterProcess.Exited += TransmitterTestProcess_Exited;
|
if (useTest)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
transmitterProcess.Exited += TransmitterProcess_Exited;
|
|
||||||
}
|
|
||||||
|
|
||||||
transmitterProcess.ErrorDataReceived += TransmitterProcess_ErrorDataReceived;
|
|
||||||
transmitterProcess.OutputDataReceived += TransmitterProcess_OutputDataReceived;
|
|
||||||
|
|
||||||
transmitterProcess.StartInfo = startInfo;
|
|
||||||
transmitterProcess.EnableRaisingEvents = true;
|
|
||||||
transmitterProcess.Start();
|
|
||||||
|
|
||||||
transmitterProcess.BeginErrorReadLine();
|
|
||||||
transmitterProcess.BeginOutputReadLine();
|
|
||||||
|
|
||||||
int aProcessId = transmitterProcess.Id;
|
|
||||||
|
|
||||||
if (useTest)
|
|
||||||
{
|
|
||||||
processTestId = aProcessId;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
processId = aProcessId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// _log.DebugFormat("started {0}", transmitterProcess.ProcessName);
|
|
||||||
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
|
|
||||||
if(!transmitterProcess.WaitForExit((timeout == 0) ? int.MaxValue : timeout))
|
|
||||||
{
|
|
||||||
_log.WarnFormat("Transmitter process not exited within {0} minute", Properties.Settings.Default.BatchTimeoutMins);
|
|
||||||
// dauert zu lang, beende Prozess..
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
transmitterProcess.Kill();
|
transmitterProcess.Exited += TransmitterTestProcess_Exited;
|
||||||
_log.Info("Transmitter killed");
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
else
|
||||||
{
|
{
|
||||||
_log.WarnFormat("Killing Transmitter failed: {0}", e.Message);
|
transmitterProcess.Exited += TransmitterProcess_Exited;
|
||||||
|
}
|
||||||
|
|
||||||
|
transmitterProcess.ErrorDataReceived += TransmitterProcess_ErrorDataReceived;
|
||||||
|
transmitterProcess.OutputDataReceived += TransmitterProcess_OutputDataReceived;
|
||||||
|
|
||||||
|
transmitterProcess.StartInfo = startInfo;
|
||||||
|
transmitterProcess.EnableRaisingEvents = true;
|
||||||
|
transmitterProcess.Start();
|
||||||
|
|
||||||
|
transmitterProcess.BeginErrorReadLine();
|
||||||
|
transmitterProcess.BeginOutputReadLine();
|
||||||
|
|
||||||
|
int aProcessId = transmitterProcess.Id;
|
||||||
|
|
||||||
|
if (useTest)
|
||||||
|
{
|
||||||
|
processTestId = aProcessId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
processId = aProcessId;
|
||||||
|
}
|
||||||
|
|
||||||
|
// _log.DebugFormat("started {0}", transmitterProcess.ProcessName);
|
||||||
|
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
|
||||||
|
if (!transmitterProcess.WaitForExit((timeout == 0) ? int.MaxValue : timeout))
|
||||||
|
{
|
||||||
|
_log.WarnFormat("Transmitter process not exited within {0} minute", Properties.Settings.Default.BatchTimeoutMins);
|
||||||
|
// dauert zu lang, beende Prozess..
|
||||||
|
try
|
||||||
|
{
|
||||||
|
transmitterProcess.Kill();
|
||||||
|
_log.Info("Transmitter killed");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_log.WarnFormat("Killing Transmitter failed: {0}", e.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user