SFTP Verzeichnis Einstellungen getrennt

This commit is contained in:
Daniel Schick 2022-10-31 13:22:12 +01:00
parent ca58d091c5
commit 02c619011c
9 changed files with 132 additions and 35 deletions

View File

@ -268,13 +268,13 @@ namespace SendNSWMessageService
} }
// external processing for HIS-Nord // external processing for HIS-Nord
bsmd.hisnord.transmitter.CallTransmitter(); bsmd.hisnord.transmitter.CallTransmitter();
bsmd.hisnord.Request.ReadResponseFiles(); bsmd.hisnord.Request.ReadResponseFiles();
bsmd.hisnord.Response.ReadAnswers(); bsmd.hisnord.Response.ReadAnswers();
// external processing for dbh
bsmd.dbh.MessageController.SendAndReceive();
List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag(); List<MessageCore> coresMarkedForStatusQuery = DBManager.Instance.GetMessageCoresWithNSWStatusFlag();
foreach (MessageCore core in coresMarkedForStatusQuery) foreach (MessageCore core in coresMarkedForStatusQuery)

View File

@ -13,7 +13,7 @@ namespace bsmd.dakosy.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -31,7 +31,7 @@ namespace bsmd.dakosy
string localDir = Properties.Settings.Default.SFTPInDir; string localDir = Properties.Settings.Default.SFTPInDir;
string remoteDir = Properties.Settings.Default.RemoteOutgoingDir; string remoteDir = Properties.Settings.Default.RemoteOutgoingDir;
SFtp.GetAll(remoteDir); SFtp.GetAll(remoteDir, localDir);
// lokale Dateien verarbeiten // lokale Dateien verarbeiten
foreach (string inputFile in Directory.GetFiles(localDir)) foreach (string inputFile in Directory.GetFiles(localDir))

View File

@ -77,7 +77,7 @@
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None> </None>
</ItemGroup> </ItemGroup>

View File

@ -95,7 +95,7 @@ namespace bsmd.dakosy
} }
public static void GetAll(string remoteDir) public static void GetAll(string remoteDir, string localDir)
{ {
Process winscp = new Process(); Process winscp = new Process();
winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath; winscp.StartInfo.FileName = Properties.Settings.Default.WINSCPFullPath;
@ -110,7 +110,7 @@ namespace bsmd.dakosy
winscp.StandardInput.WriteLine("option batch abort"); winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off"); winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName); winscp.StandardInput.WriteLine("open " + Properties.Settings.Default.SFTPSessionName);
winscp.StandardInput.WriteLine("lcd " + Properties.Settings.Default.SFTPInDir); winscp.StandardInput.WriteLine("lcd " + localDir);
// winscp.StandardInput.WriteLine("ls"); // winscp.StandardInput.WriteLine("ls");
if (remoteDir != null) if (remoteDir != null)
winscp.StandardInput.WriteLine("cd " + remoteDir); winscp.StandardInput.WriteLine("cd " + remoteDir);

View File

@ -69,26 +69,24 @@ namespace bsmd.dbh
// receive files from remote host // receive files from remote host
// SFTP verbindung öffnen und alle Dateien herunterladen // SFTP verbindung öffnen und alle Dateien herunterladen
string localDir = bsmd.dakosy.Properties.Settings.Default.SFTPInDir; string localDir = Properties.Settings.Default.OutgoingFolder;
string remoteDir = bsmd.dakosy.Properties.Settings.Default.RemoteOutgoingDir;
bsmd.dakosy.SFtp.GetAll(remoteDir); bsmd.dakosy.SFtp.GetAll(Properties.Settings.Default.RemoteOutgoingFolder, Properties.Settings.Default.IncomingFolder);
// lokale Dateien verarbeiten
foreach (string inputFile in Directory.GetFiles(localDir)) foreach (string inputFile in Directory.GetFiles(localDir))
{ {
// lokale Dateien verarbeiten
if (!ResponseUtil.Read(inputFile)) if (!ResponseUtil.Read(inputFile))
{ {
_log.ErrorFormat("Error reading input file {0}", inputFile); _log.ErrorFormat("Error reading input file {0}", inputFile);
} }
else else
{ {
File.Delete(inputFile); // alternativ: move to archive folder File.Move(inputFile, Properties.Settings.Default.IncomingArchiveFolder);
} }
// remote Dateien löschen // remote Dateien löschen
bsmd.dakosy.SFtp.RemoveProcessedFile(remoteDir, Path.GetFileName(inputFile)); bsmd.dakosy.SFtp.RemoveProcessedFile(Properties.Settings.Default.RemoteOutgoingFolder, Path.GetFileName(inputFile));
} }
// process result files
} }
} }

View File

@ -23,7 +23,7 @@ namespace bsmd.dbh.Properties {
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("https://edi-gate.dbh.de/test/bsmd-soap")] [global::System.Configuration.DefaultSettingValueAttribute("https://edi-gate.dbh.de/test/bsmd-soap")]
@ -31,20 +31,77 @@ namespace bsmd.dbh.Properties {
get { get {
return ((string)(this["bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws"])); return ((string)(this["bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws"]));
} }
set {
this["bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws"] = value;
}
} }
[global::System.Configuration.UserScopedSettingAttribute()] [global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("00003050")] [global::System.Configuration.DefaultSettingValueAttribute("00003050")]
public string Sender { public string Sender {
get { get {
return ((string)(this["Sender"])); return ((string)(this["Sender"]));
} }
set { }
this["Sender"] = value;
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string OutgoingFolder {
get {
return ((string)(this["OutgoingFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string OutgoingArchiveFolder {
get {
return ((string)(this["OutgoingArchiveFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string IncomingFolder {
get {
return ((string)(this["IncomingFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string IncomingArchiveFolder {
get {
return ((string)(this["IncomingArchiveFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string RemoteIncomingFolder {
get {
return ((string)(this["RemoteIncomingFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string RemoteOutgoingFolder {
get {
return ((string)(this["RemoteOutgoingFolder"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string SFTPSessionName {
get {
return ((string)(this["SFTPSessionName"]));
} }
} }
} }

View File

@ -2,11 +2,32 @@
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.dbh.Properties" GeneratedClassName="Settings"> <SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="bsmd.dbh.Properties" GeneratedClassName="Settings">
<Profiles /> <Profiles />
<Settings> <Settings>
<Setting Name="bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws" Type="(Web Service URL)" Scope="User"> <Setting Name="bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">https://edi-gate.dbh.de/test/bsmd-soap</Value> <Value Profile="(Default)">https://edi-gate.dbh.de/test/bsmd-soap</Value>
</Setting> </Setting>
<Setting Name="Sender" Type="System.String" Scope="User"> <Setting Name="Sender" Type="System.String" Scope="Application">
<Value Profile="(Default)">00003050</Value> <Value Profile="(Default)">00003050</Value>
</Setting> </Setting>
<Setting Name="OutgoingFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="OutgoingArchiveFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="IncomingFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="IncomingArchiveFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RemoteIncomingFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="RemoteOutgoingFolder" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SFTPSessionName" Type="System.String" Scope="Application">
<Value Profile="(Default)" />
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="bsmd.dbh.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/> <section name="bsmd.dbh.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<userSettings> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup><applicationSettings>
<bsmd.dbh.Properties.Settings> <bsmd.dbh.Properties.Settings>
<setting name="bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws" serializeAs="String"> <setting name="bsmd_dbh_DBHWebReference_Dbh_Osis_Answ_Ws" serializeAs="String">
<value>https://edi-gate.dbh.de/test/bsmd-soap</value> <value>https://edi-gate.dbh.de/test/bsmd-soap</value>
@ -13,6 +13,27 @@
<setting name="Sender" serializeAs="String"> <setting name="Sender" serializeAs="String">
<value>00003050</value> <value>00003050</value>
</setting> </setting>
<setting name="OutgoingFolder" serializeAs="String">
<value />
</setting>
<setting name="OutgoingArchiveFolder" serializeAs="String">
<value />
</setting>
<setting name="IncomingFolder" serializeAs="String">
<value />
</setting>
<setting name="IncomingArchiveFolder" serializeAs="String">
<value />
</setting>
<setting name="RemoteIncomingFolder" serializeAs="String">
<value />
</setting>
<setting name="RemoteOutgoingFolder" serializeAs="String">
<value />
</setting>
<setting name="SFTPSessionName" serializeAs="String">
<value />
</setting>
</bsmd.dbh.Properties.Settings> </bsmd.dbh.Properties.Settings>
</userSettings> </applicationSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration> </configuration>