Service kennt keinen Unterschied zwischen Test- und Produktivsystem mehr. Diese Unterscheidung wird serverseitig durch zwei Instanzen mit unterschiedlicher Konfiguration getroffen.
This commit is contained in:
parent
12ae616f9b
commit
ee56a5dce3
@ -31,12 +31,12 @@ namespace SendNSWMessageService
|
||||
|
||||
}
|
||||
|
||||
public void Commandline(string[] args)
|
||||
public void Commandline()
|
||||
{
|
||||
// Dieser Modus dient allein dazu, eine separate Instanz "nebenher" laufen zu lassen, ohne
|
||||
// sie als Service zu installieren. Dies ist sinnvoll um für spezielle HIS Einstellungen Tests zu machen
|
||||
// ohne den laufenden Betrieb zu stören (hoffentlich!)
|
||||
this.Init(args); // setup timer
|
||||
this.Init(); // setup timer
|
||||
this.DoOnce();
|
||||
while (true)
|
||||
System.Threading.Thread.Sleep(1000); // sleep until someone kills me :)
|
||||
@ -46,7 +46,7 @@ namespace SendNSWMessageService
|
||||
{
|
||||
this.EventLog.Source = this.ServiceName;
|
||||
this.EventLog.Log = "Application";
|
||||
this.Init(args);
|
||||
this.Init();
|
||||
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
@ -57,7 +57,7 @@ namespace SendNSWMessageService
|
||||
this.DoOnce();
|
||||
}
|
||||
|
||||
private void Init(string[] args)
|
||||
private void Init()
|
||||
{
|
||||
this._timer = new Timer();
|
||||
this._timer.Interval = Properties.Settings.Default.SleepSeconds * 1000;
|
||||
@ -269,233 +269,16 @@ namespace SendNSWMessageService
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; // aus irgendwelchen Gründen wurde nichts verschickt -> zurück auf PREPARE
|
||||
}
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
#region old logic
|
||||
/*
|
||||
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
|
||||
{
|
||||
|
||||
bool sendSucceeded = true;
|
||||
bool didSendSomething = false;
|
||||
|
||||
// Fall: keine Meldeklasse aber trotzdem auf TO_SEND. Entweder beim Beantragen von Visit-Id's oder beim Storno der gesamten
|
||||
// Anmeldung
|
||||
if ((core.DisplayId.Length == 0) || (core.Cancelled ?? false))
|
||||
{
|
||||
sendSucceeded = bsmd.hisnord.Request.CreateSendFile(core, messages, (core.InitialHIS == Message.NSWProvider.DUDR_TEST)) ?? false;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
bool? sendResult = bsmd.hisnord.Request.CreateSendFile(core, message, (core.InitialHIS == Message.NSWProvider.DUDR_TEST));
|
||||
if (sendResult.HasValue)
|
||||
{
|
||||
didSendSomething = true;
|
||||
if (!sendResult.Value) sendSucceeded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!didSendSomething) core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE; // zurück zu neutral
|
||||
else
|
||||
{
|
||||
if (!sendSucceeded) core.BSMDStatusInternal = MessageCore.BSMDStatus.FAILURE;
|
||||
else core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
}
|
||||
|
||||
_log.InfoFormat("HIS-Nord Send: Core {0} [{1}] new Status {2}", core.Id, core.IMO, core.BSMDStatusInternal.ToString());
|
||||
|
||||
DBManager.Instance.Save(core);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
bool sendSucceeded;
|
||||
|
||||
#region DBH / Dakosy Logik
|
||||
|
||||
List<Message> toSendMessageList = new List<Message>();
|
||||
|
||||
if ((core.IsTransit && core.TransitId.IsNullOrEmpty()) ||
|
||||
(!core.IsTransit && core.VisitId.IsNullOrEmpty()))
|
||||
{
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.VISIT) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
|
||||
{
|
||||
if ((message.InternalStatus == Message.BSMDStatus.UNDEFINED) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.PREPARE) ||
|
||||
(message.InternalStatus == Message.BSMDStatus.TOSEND))
|
||||
{
|
||||
_log.Debug("Visit/Transit not found, SENDING VISIT/TRANSIT message");
|
||||
if (message.HIS == Message.NSWProvider.UNDEFINED)
|
||||
message.HIS = core.InitialHIS;
|
||||
if (core.DefaultReportingPartyId.HasValue)
|
||||
message.ReportingPartyId = core.DefaultReportingPartyId;
|
||||
toSendMessageList.Add(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // eine VISIT/TRANSIT Id ist vorhanden, die Daten können gesendet werden
|
||||
{
|
||||
// Änderung Sept 15: versendet werden alle Nachrichten, die *nicht* bestätigt sind
|
||||
// also auch alles was auf in bearbeitung / Korrektur etc steht
|
||||
// Einzig bleibt die Frage offen, was mit Nachrichten passiert, die über das UI
|
||||
// nachträglich geändert werden. Ich denke hier muss in dashface ggf. der Status
|
||||
// wieder auf PREPARE gesetzt werden
|
||||
_log.Debug("Visit/Transit found, SENDING DATA messages");
|
||||
|
||||
foreach (Message message in messages)
|
||||
{
|
||||
// Eine Nachricht mit dem Status "Suspended / Zurückgestellt" wird so lange nicht
|
||||
// versendet, bis im ENI der Status wieder explizit zurückgesetzt wird (16.4.16)
|
||||
|
||||
// Update 5.10.17: Alles was nicht explizit auf "TOSEND" steht wird nicht verschickt!
|
||||
if (message.InternalStatus != Message.BSMDStatus.TOSEND) continue;
|
||||
|
||||
// "virtuelle" Messages nicht versenden (DK, EU)
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.STO) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.CREWD) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.PASD))
|
||||
continue;
|
||||
|
||||
// Wenn das ein Transit ist, werden nicht erforderliche Meldeklassen übersprungen
|
||||
if (core.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))
|
||||
continue;
|
||||
}
|
||||
|
||||
// Visit/Transit Meldeklassen werden nicht erneut übertragen
|
||||
if ((message.MessageNotificationClass == Message.NotificationClass.VISIT) ||
|
||||
(message.MessageNotificationClass == Message.NotificationClass.TRANSIT))
|
||||
continue;
|
||||
|
||||
//if ((message.InternalStatus != Message.BSMDStatus.CONFIRMED) &&
|
||||
//(message.InternalStatus != Message.BSMDStatus.SENT))
|
||||
//{
|
||||
|
||||
// 28.12.2015: Das über "Overview" eingestellte HIS ist immer "führend" (zumindest aktuell zum Testen)
|
||||
// if (message.HIS == Message.NSWProvider.UNDEFINED)
|
||||
message.HIS = core.InitialHIS;
|
||||
if (core.DefaultReportingPartyId.HasValue)
|
||||
{
|
||||
message.ReportingPartyId = core.DefaultReportingPartyId; // Referenz umbiegen
|
||||
if (DBManager.Instance.GetReportingPartyDict().ContainsKey(core.DefaultReportingPartyId.Value)) // geladenes Objekt ersetzen
|
||||
message.ReportingParty = DBManager.Instance.GetReportingPartyDict()[core.DefaultReportingPartyId.Value];
|
||||
}
|
||||
toSendMessageList.Add(message);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Message message in toSendMessageList)
|
||||
{
|
||||
try
|
||||
{
|
||||
_log.InfoFormat("Sending {0} message to {1}",
|
||||
message.MessageNotificationClass.ToString(), message.HIS.ToString());
|
||||
|
||||
sendSucceeded = false;
|
||||
|
||||
// switch über passendes HIS / Schnittstelle
|
||||
switch (message.HIS)
|
||||
{
|
||||
case Message.NSWProvider.DBH:
|
||||
case Message.NSWProvider.DBH_TEST:
|
||||
if (!XtraSendLogic.ShouldSendMessage(message))
|
||||
{
|
||||
message.InternalStatus = Message.BSMDStatus.SUSPENDED;
|
||||
}
|
||||
else
|
||||
{
|
||||
sendSucceeded = bsmd.dbh.Request.SendMessage(message, (message.HIS == Message.NSWProvider.DBH_TEST));
|
||||
if (!sendSucceeded)
|
||||
message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Message.NSWProvider.DAKOSY:
|
||||
case Message.NSWProvider.DAKOSY_TEST:
|
||||
sendSucceeded = bsmd.dakosy.Request.Send(message, true);
|
||||
if (!sendSucceeded) message.InternalStatus = Message.BSMDStatus.SEND_FAILED;
|
||||
break;
|
||||
|
||||
default:
|
||||
_log.WarnFormat("Initial HIS not specified for message {0}", message.Id);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sendSucceeded)
|
||||
{
|
||||
// alte Fehlerliste entfernen (die Antwort kann praktisch noch nicht da sein)
|
||||
// vor dem Versenden zu entfernen halte ich für doof, wenn das Versenden scheitert
|
||||
|
||||
foreach (MessageError messageError in message.ErrorList)
|
||||
DBManager.Instance.Delete(messageError);
|
||||
foreach (MessageViolation messageViolation in message.ViolationList)
|
||||
DBManager.Instance.Delete(messageViolation);
|
||||
|
||||
_log.Info("send successful, saving message.");
|
||||
message.InternalStatus = Message.BSMDStatus.SENT;
|
||||
message.SentAt = DateTime.Now;
|
||||
}
|
||||
|
||||
DBManager.Instance.Save(message);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.ErrorFormat("SENDING message {0}: {1}", message.Id.ToString(), ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (toSendMessageList.Count > 0)
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.SENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
|
||||
}
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
}
|
||||
|
||||
if(bsmd.hisnord.Properties.Settings.Default.ConnectTestSystem)
|
||||
bsmd.hisnord.transmitter.CallTransmitter(true);
|
||||
if(bsmd.hisnord.Properties.Settings.Default.ConnectLiveSystem)
|
||||
bsmd.hisnord.transmitter.CallTransmitter(false);
|
||||
|
||||
bsmd.hisnord.transmitter.CallTransmitter();
|
||||
|
||||
// ob test oder nicht ist in stat. dict gespeichert
|
||||
bsmd.hisnord.Request.ReadResponseFiles();
|
||||
|
||||
if (bsmd.hisnord.Properties.Settings.Default.ConnectTestSystem)
|
||||
bsmd.hisnord.Response.ReadAnswers(true);
|
||||
if (bsmd.hisnord.Properties.Settings.Default.ConnectLiveSystem)
|
||||
bsmd.hisnord.Response.ReadAnswers(false);
|
||||
|
||||
bsmd.hisnord.Response.ReadAnswers();
|
||||
|
||||
List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag();
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ namespace SendNSWMessageService
|
||||
}
|
||||
else if(args.Length > 0)
|
||||
{
|
||||
((NSWSendService)ServicesToRun[0]).Commandline(args);
|
||||
((NSWSendService)ServicesToRun[0]).Commandline();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -39,9 +39,9 @@
|
||||
//
|
||||
// nswSendServiceInstaller
|
||||
//
|
||||
this.nswSendServiceInstaller.Description = "Sending Testing-NSW requests to HIS";
|
||||
this.nswSendServiceInstaller.DisplayName = "NSW Test Send Service";
|
||||
this.nswSendServiceInstaller.ServiceName = "NSWTestSendService";
|
||||
this.nswSendServiceInstaller.Description = "Sending NSW requests to HIS";
|
||||
this.nswSendServiceInstaller.DisplayName = "NSW Send Service";
|
||||
this.nswSendServiceInstaller.ServiceName = "NSWSendService";
|
||||
//
|
||||
// ProjectInstaller
|
||||
//
|
||||
|
||||
@ -39,14 +39,15 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.13" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -37,12 +37,13 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.13" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -37,15 +37,17 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ServiceModel.Web" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.13" targetFramework="net45" />
|
||||
</packages>
|
||||
44
bsmd.hisnord/Properties/Settings.Designer.cs
generated
44
bsmd.hisnord/Properties/Settings.Designer.cs
generated
@ -12,7 +12,7 @@ namespace bsmd.hisnord.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.2.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
@ -110,48 +110,12 @@ namespace bsmd.hisnord.Properties {
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("E:\\svnlager\\BSMD\\nsw\\HIS-NORD\\")]
|
||||
public string TestTransmitterRoot {
|
||||
public string TransmitterRoot {
|
||||
get {
|
||||
return ((string)(this["TestTransmitterRoot"]));
|
||||
return ((string)(this["TransmitterRoot"]));
|
||||
}
|
||||
set {
|
||||
this["TestTransmitterRoot"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string LiveTransmitterRoot {
|
||||
get {
|
||||
return ((string)(this["LiveTransmitterRoot"]));
|
||||
}
|
||||
set {
|
||||
this["LiveTransmitterRoot"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("False")]
|
||||
public bool ConnectTestSystem {
|
||||
get {
|
||||
return ((bool)(this["ConnectTestSystem"]));
|
||||
}
|
||||
set {
|
||||
this["ConnectTestSystem"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool ConnectLiveSystem {
|
||||
get {
|
||||
return ((bool)(this["ConnectLiveSystem"]));
|
||||
}
|
||||
set {
|
||||
this["ConnectLiveSystem"] = value;
|
||||
this["TransmitterRoot"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,17 +23,8 @@
|
||||
<Setting Name="AnswerCorruptDir" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</Value>
|
||||
</Setting>
|
||||
<Setting Name="TestTransmitterRoot" Type="System.String" Scope="User">
|
||||
<Setting Name="TransmitterRoot" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">E:\svnlager\BSMD\nsw\HIS-NORD\</Value>
|
||||
</Setting>
|
||||
<Setting Name="LiveTransmitterRoot" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="ConnectTestSystem" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ConnectLiveSystem" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@ -21,9 +21,7 @@ namespace bsmd.hisnord
|
||||
{
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(Request));
|
||||
private static Dictionary<Guid, ReportingParty> _reportingPartyDict = null;
|
||||
private static readonly Dictionary<MessageCore, Dictionary<Message, string>> coreFilenameDict = new Dictionary<MessageCore, Dictionary<Message,string>>();
|
||||
private static readonly Dictionary<MessageCore, bool> coreUseTestDict = new Dictionary<MessageCore, bool>();
|
||||
//private static Dictionary<Message.NotificationClass, Message> noteMessageDict = new Dictionary<Message.NotificationClass, Message>();
|
||||
private static readonly Dictionary<MessageCore, Dictionary<Message, string>> coreFilenameDict = new Dictionary<MessageCore, Dictionary<Message,string>>();
|
||||
|
||||
internal static Dictionary<Guid, ReportingParty> ReportingPartyDict
|
||||
{
|
||||
@ -41,7 +39,7 @@ namespace bsmd.hisnord
|
||||
|
||||
foreach (Message message in coreFilenameDict[core].Keys)
|
||||
{
|
||||
transmitter.result theResult = transmitter.GetResult(coreFilenameDict[core][message], coreUseTestDict[core]);
|
||||
transmitter.result theResult = transmitter.GetResult(coreFilenameDict[core][message]);
|
||||
if (theResult != null)
|
||||
{
|
||||
_log.InfoFormat("Result: Code {0} Detail {1} Message {2}", theResult.code, theResult.detail, theResult.message);
|
||||
@ -1594,9 +1592,7 @@ namespace bsmd.hisnord
|
||||
|
||||
#region serialize and save message
|
||||
|
||||
|
||||
string outputDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
|
||||
Properties.Settings.Default.OutputDir);
|
||||
string outputDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.OutputDir);
|
||||
|
||||
string filename = string.Format("BSMD_{1}-{2}-{0}.xml", (message == null) ? "CANCEL" : message.MessageNotificationClassDisplay, DateTime.Now.ToString("yyyyMMddHHmmss"), core.Id.Value);
|
||||
_log.InfoFormat("saving {0} to output directory", filename);
|
||||
@ -1612,8 +1608,7 @@ namespace bsmd.hisnord
|
||||
coreFilenameDict[core] = new Dictionary<Message, string>();
|
||||
if(message != null)
|
||||
coreFilenameDict[core][message] = filename;
|
||||
|
||||
coreUseTestDict[core] = useTest;
|
||||
|
||||
retval = true;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -15,10 +15,9 @@ namespace bsmd.hisnord
|
||||
|
||||
private static readonly ILog _log = LogManager.GetLogger(typeof(Response));
|
||||
|
||||
public static void ReadAnswers(bool useTest)
|
||||
public static void ReadAnswers()
|
||||
{
|
||||
string answerDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
|
||||
Properties.Settings.Default.AnswerDir);
|
||||
string answerDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerDir);
|
||||
|
||||
foreach (string answerFile in Directory.GetFiles(answerDir))
|
||||
{
|
||||
@ -293,8 +292,8 @@ namespace bsmd.hisnord
|
||||
if(isOK)
|
||||
{
|
||||
// archive file
|
||||
string answerArchiveDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
|
||||
Properties.Settings.Default.AnswerArchiveDir);
|
||||
string answerArchiveDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerArchiveDir);
|
||||
|
||||
try
|
||||
{
|
||||
File.Move(answerFile, Path.Combine(answerArchiveDir, Path.GetFileName(answerFile)));
|
||||
@ -307,8 +306,8 @@ namespace bsmd.hisnord
|
||||
else
|
||||
{
|
||||
// save in separate folder (to look at it later?)
|
||||
string answerCorruptDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
|
||||
Properties.Settings.Default.AnswerCorruptDir);
|
||||
string answerCorruptDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.AnswerCorruptDir);
|
||||
|
||||
try
|
||||
{
|
||||
File.Move(answerFile, Path.Combine(answerCorruptDir, Path.GetFileName(answerFile)));
|
||||
|
||||
@ -28,18 +28,9 @@
|
||||
<setting name="AnswerCorruptDir" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\Transmitter-Tool\ANSWERS_CORRUPT</value>
|
||||
</setting>
|
||||
<setting name="TestTransmitterRoot" serializeAs="String">
|
||||
<setting name="TransmitterRoot" serializeAs="String">
|
||||
<value>E:\svnlager\BSMD\nsw\HIS-NORD\</value>
|
||||
</setting>
|
||||
<setting name="LiveTransmitterRoot" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="ConnectTestSystem" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ConnectLiveSystem" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</bsmd.hisnord.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
@ -37,12 +37,13 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.13" targetFramework="net45" />
|
||||
</packages>
|
||||
@ -19,24 +19,17 @@ namespace bsmd.hisnord
|
||||
public class 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? processTestId;
|
||||
private static int? processId; // Achtung, das müsste getrennt behandelt werden Test <-> Livesystem!
|
||||
|
||||
public static void CallTransmitter(bool useTest)
|
||||
public static void CallTransmitter()
|
||||
{
|
||||
string rootDir = useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot;
|
||||
string rootDir = Properties.Settings.Default.TransmitterRoot;
|
||||
|
||||
if(!useTest && processId.HasValue)
|
||||
if(processId.HasValue)
|
||||
{
|
||||
_log.InfoFormat("Transmitter process {0} still running, aborting call", processId);
|
||||
return;
|
||||
}
|
||||
|
||||
if(useTest && processTestId.HasValue)
|
||||
{
|
||||
_log.InfoFormat("Transmitter process (Test system) {0} still running, aborting call", processId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(rootDir, Properties.Settings.Default.Transmitter));
|
||||
startInfo.WorkingDirectory = rootDir;
|
||||
@ -50,14 +43,8 @@ namespace bsmd.hisnord
|
||||
|
||||
using (Process transmitterProcess = new Process())
|
||||
{
|
||||
if (useTest)
|
||||
{
|
||||
transmitterProcess.Exited += TransmitterTestProcess_Exited;
|
||||
}
|
||||
else
|
||||
{
|
||||
transmitterProcess.Exited += TransmitterProcess_Exited;
|
||||
}
|
||||
|
||||
transmitterProcess.Exited += TransmitterProcess_Exited;
|
||||
|
||||
transmitterProcess.ErrorDataReceived += TransmitterProcess_ErrorDataReceived;
|
||||
transmitterProcess.OutputDataReceived += TransmitterProcess_OutputDataReceived;
|
||||
@ -69,16 +56,7 @@ namespace bsmd.hisnord
|
||||
transmitterProcess.BeginErrorReadLine();
|
||||
transmitterProcess.BeginOutputReadLine();
|
||||
|
||||
int aProcessId = transmitterProcess.Id;
|
||||
|
||||
if (useTest)
|
||||
{
|
||||
processTestId = aProcessId;
|
||||
}
|
||||
else
|
||||
{
|
||||
processId = aProcessId;
|
||||
}
|
||||
processId = transmitterProcess.Id;
|
||||
|
||||
// _log.DebugFormat("started {0}", transmitterProcess.ProcessName);
|
||||
int timeout = Properties.Settings.Default.BatchTimeoutMins * 1000 * 60; // convert to ms
|
||||
@ -89,9 +67,8 @@ namespace bsmd.hisnord
|
||||
try
|
||||
{
|
||||
transmitterProcess.Kill();
|
||||
_log.Info("Transmitter killed");
|
||||
if (useTest) processTestId = null;
|
||||
else processId = null;
|
||||
_log.Info("Transmitter killed");
|
||||
processId = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -111,13 +88,7 @@ namespace bsmd.hisnord
|
||||
{
|
||||
if(!e.Data.IsNullOrEmpty())
|
||||
_log.Error(e.Data);
|
||||
}
|
||||
|
||||
private static void TransmitterTestProcess_Exited(object sender, EventArgs e)
|
||||
{
|
||||
_log.Debug("Transmitter process (test) exited");
|
||||
processTestId = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void TransmitterProcess_Exited(object sender, EventArgs e)
|
||||
{
|
||||
@ -125,14 +96,11 @@ namespace bsmd.hisnord
|
||||
processId = null;
|
||||
}
|
||||
|
||||
public static result GetResult(string filenameFullPath, bool useTest)
|
||||
public static result GetResult(string filenameFullPath)
|
||||
{
|
||||
// now we should read the response message...
|
||||
string resultFilename = string.Format("{0}.result.xml", Path.GetFileName(filenameFullPath));
|
||||
|
||||
string resultDir = Path.Combine(useTest ? Properties.Settings.Default.TestTransmitterRoot : Properties.Settings.Default.LiveTransmitterRoot,
|
||||
Properties.Settings.Default.ResultDir);
|
||||
|
||||
string resultDir = Path.Combine(Properties.Settings.Default.TransmitterRoot, Properties.Settings.Default.ResultDir);
|
||||
string resultFullPath = Path.Combine(resultDir, resultFilename);
|
||||
return result.ReadResult(resultFullPath);
|
||||
}
|
||||
|
||||
@ -38,11 +38,11 @@
|
||||
<AssemblyOriginatorKeyFile>..\bsmdKey.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.8\lib\net45-full\log4net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="log4net, Version=2.0.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net.2.0.13\lib\net45\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.8" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.13" targetFramework="net45" />
|
||||
</packages>
|
||||
Loading…
Reference in New Issue
Block a user