Update vor Import Gitea

This commit is contained in:
2021-12-23 09:13:44 +01:00
parent 56bd02798f
commit 609bd2b3f6
72 changed files with 1687 additions and 700 deletions

View File

@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using NDde.Client;
@@ -27,11 +28,12 @@ namespace ARSDDE
static string ARS_AuftragNr;
static string ARS_Belegart;
static DdeClient Client;
static string DebugFilename;
// static DdeClient Client = new DdeClient("ARS", "ARS");
static void Main(string[] args)
{
DebugFilename = @"h:\arsdebug_" + DateTime.Now.ToString("yyyyddMMhhmmsshs") + ".txt";
Debug = Properties.Settings.Default.Debug;
Debug =Debug.ToLower();
@@ -53,34 +55,53 @@ namespace ARSDDE
Debug_Print(String.Format("ARS_Belegart: {0}", ARS_Belegart));
}
Debug_Print("Start");
Call_OnDemand("Start");
Client = new DdeClient(Properties.Settings.Default.OnDemandClinetString, Properties.Settings.Default.OnDemandClinetString);
Client.Connect();
try
{
Debug_Print("Start");
Call_OnDemand("Start");
Client = new DdeClient(Properties.Settings.Default.OnDemandClinetString, Properties.Settings.Default.OnDemandClinetString);
try
{
Client.Connect();
if (Client.IsConnected==false)
{
MessageBox.Show("Client konnte nicht verbunden werden");
}
}
catch (NDde.DdeException e)
{
MessageBox.Show(e.Message);
};
if (Client == null)
{
MessageBox.Show("Client konnte nicht alloziert werden");
}
Debug_Print("Logon");
Call_OnDemand("Logon");
Debug_Print("Open_Folder");
Call_OnDemand("Open_Folder");
Debug_Print("Set_FieldData");
Call_OnDemand("Set_FieldData");
Debug_Print("Search_Folder");
Call_OnDemand("Search_Folder");
Debug_Print("Show_Doc");
Call_OnDemand("Show_Doc");
Debug_Print("Logoff");
Call_OnDemand("Logoff");
if (Debug == "true") { Console.ReadLine(); }
}
Call_OnDemand("Logon");
Call_OnDemand("Open_Folder");
Call_OnDemand("Set_FieldData");
Call_OnDemand("Search_Folder");
Call_OnDemand("Show_Doc");
Call_OnDemand("Logoff");
if (Debug == "true") { Console.ReadLine(); }
}
catch (Exception mainex)
{
MessageBox.Show("Fehler: " + mainex.Message);
}
}
static void Debug_Print(string s)
{
if (Debug == "true")
{
using (StreamWriter w = File.AppendText(@"h:\arsddedebug.txt"))
//string filename;
using (StreamWriter w = File.AppendText(DebugFilename))
{
w.WriteLine(s);
w.Close();
}
};
if (Debug=="true")
@@ -102,89 +123,69 @@ namespace ARSDDE
psi.WorkingDirectory = Path.GetDirectoryName(ARS_Application);
psi.Arguments= "/1 " + ARS_Language + " /S " + ARS_System + " /U " + ARS_User + " /P " + ARS_Password + " /I /B /V /T EDOKA COLD-Dokumentanzeige " + " /Z /Q /Y /O 1 /X";
psi.Arguments = "/1 " + ARS_Language + " /S " + ARS_System + " /I /B /V /T EDOKA COLD-Dokumentanzeige " + " /Z /Q /Y /O 1 /X";
Debug_Print(ARS_Application + " /1 " + ARS_Language + " /S " + ARS_System + " /U " + ARS_User + " /P " + ARS_Password + " /I /B /V /T EDOKA COLD-Dokumentanzeige " + " /Z /Q /Y /O 1 /X ");
psi.WindowStyle = ProcessWindowStyle.Maximized;
psi.UseShellExecute = true;
psi.UseShellExecute = false;
if (Properties.Settings.Default.UseShellExecute.ToLower()== "true")
{
psi.UseShellExecute = true;
}
Process.Start(psi);
// Process.Start(""+ARS_Application+"" + " /1 " + ARS_Language + " /S " + ARS_System + " /U " + ARS_User + " /P " + ARS_Password + " /I /B /V /T EDOKA COLD-Dokumentanzeige " + " /Z /Q /Y /O 1 /X /W N");
System.Threading.Thread.Sleep(Convert.ToInt32(Properties.Settings.Default.WaitAfterStart));
}
break;
case "Logon":
Debug_Print(String.Format("LOGON /S {0} /U {1} /P {2}", ARS_System,ARS_User, ARS_Password));
//Client.Execute(string.Format("LOGON /S Test_System_NOVA /U {0} /P {1}", ARS_User, ARS_Password), 3000);
Client.ExecuteCommand(string.Format("LOGON /S {0} /U {1} /P {2}", ARS_System, ARS_User, ARS_Password));
int logontry;
logontry = 0;
try
{
ExecARS(string.Format("LOGON /S {0} /U {1} /P {2}", ARS_System, ARS_User, ARS_Password));
}
catch (Exception e)
{
logontry = logontry + 1;
if (logontry >= 3) {
throw new System.ArgumentException("3 Loginversuche sind fehlgeschlagen.Bitte erneut versuchen.", "LoginFehler");
}
}
System.Threading.Thread.Sleep(Convert.ToInt32(Properties.Settings.Default.DDESleep));
break;
case "Open_Folder":
// 20201019 - Erweiterung /S /C /R /D -> Buttons ausblenden
Debug_Print(string.Format("OPEN_FOLDER /F {0} /S /C /R /D", ARS_Foler));
//Client.Execute(string.Format("OPEN_FOLDER / F {0})", ARS_Foler), 3000);
Client.ExecuteCommand(string.Format("OPEN_FOLDER /F {0} /S /C /R /D", ARS_Foler));
ExecARS(string.Format("OPEN_FOLDER /F {0} /S /C /R /D", ARS_Foler));
break;
case "Search_Folder":
Debug_Print("SEARCH_FOLDER");
//Client.Execute("SEARCH_FOLDER", 3000);
Client.ExecuteCommand("SEARCH_FOLDER");
ExecARS("SEARCH_FOLDER");
break;
case "Show_Doc":
Client.ExecuteCommand("OPEN_DOC /N 0");
//Client.ExecuteCommand("SHOW_WINDOW /W 0,0,75,100");
ExecARS("OPEN_DOC /N 0");
break;
case "Set_FieldData":
switch (ARS_Foler)
{
case "TGKB Kundenoutput AGI-OMS für EDOKA User":
Debug_Print("TGKB Kundenoutput AGI-OMS für EDOKA User");
Debug_Print(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID));
//Client.Execute(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0})", ARS_DocID), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID));
Debug_Print(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)));
//Client.Execute(string.Format("SET_FIELD_DATA / F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)));
ExecARS(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID),0);
ExecARS(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)),0);
ExecARS(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)),0);
break;
case "TGKB Kundenoutput ab 01.08.2008":
Debug_Print("TGKB Kundenoutput ab 01.08.2008");
Debug_Print(string.Format("SET_FIELD_DATA /F Dokumenten-Id /1 {0}", ARS_DocID));
//Client.Execute(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0})", ARS_DocID), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Dokumenten-Id /1 {0}", ARS_DocID));
Debug_Print(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)));
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)));
ExecARS(string.Format("SET_FIELD_DATA /F Dokumenten-Id /1 {0}", ARS_DocID),0);
ExecARS(string.Format("SET_FIELD_DATA /F Erstellung od. Valuta Datum /1 {0} /2 {1} ", FormatDate(ARS_Datum), FormatDate(ARS_Datum)),0);
break;
case "TGKB ZV-Scanning Belege (erweiterte Suche)":
Debug_Print(string.Format("SET_FIELD_DATA /F Dokumenttyp /1 {0}", ARS_Doctype));
//Client.Execute(string.Format("SET_FIELD_DATA /F Dokumenttyp /1 {0})", ARS_Doctype), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Dokumenttyp /1 {0}", ARS_Doctype));
Debug_Print(string.Format("SET_FIELD_DATA /F Auftrag-Nr. /1 {0}", ARS_AuftragNr));
//Client.Execute(string.Format("SET_FIELD_DATA /F Auftrag-Nr. /1 {0})", ARS_AuftragNr), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Auftrag-Nr. /1 {0}", ARS_AuftragNr));
Debug_Print(string.Format("SET_FIELD_DATA /F Paginator /1 {0}", ARS_DocID));
//Client.Execute(string.Format("SET_FIELD_DATA /F Paginator /1 {0})", ARS_DocID), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Paginator /1 {0}", ARS_DocID));
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Valuta od. Archiv Datum /1 {0} /2 {1}", "",""));
ExecARS(string.Format("SET_FIELD_DATA /F Dokumenttyp /1 {0}", ARS_Doctype),0);
ExecARS(string.Format("SET_FIELD_DATA /F Auftrag-Nr. /1 {0}", ARS_AuftragNr),0);
ExecARS(string.Format("SET_FIELD_DATA /F Paginator /1 {0}", ARS_DocID),0);
ExecARS(string.Format("SET_FIELD_DATA /F Valuta od. Archiv Datum /1 {0} /2 {1}", "",""),0);
break;
default:
Debug_Print(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID));
//Client.Execute(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0})", ARS_DocID), 3000);
Client.ExecuteCommand(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID));
ExecARS(string.Format("SET_FIELD_DATA /F Dokument-Id /1 {0}", ARS_DocID),0);
break;
}
break;
case "Logoff":
//ExecARS("Logoff");
//Client.Execute("LOGOFF",3000);
//Client.ExecuteCommand("LOGOFF");
break;
@@ -193,6 +194,19 @@ namespace ARSDDE
}
}
static void ExecARS(string Params, int DoTimeout=1)
{
Debug_Print(Params);
Client.ExecuteCommand(Params);
//int i;
//i=Client.TryExecute(Params, Convert.ToInt32(Properties.Settings.Default.DDETimeout));
//MessageBox.Show(Convert.ToString(i));
if (DoTimeout==1)
{
System.Threading.Thread.Sleep(Convert.ToInt32(Properties.Settings.Default.DDESleep));
}
}
static string FormatDate(string datum)
{
string dd;