Compare commits
1 Commits
Refactored
...
Standortän
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e3e99ad20 |
@@ -101,7 +101,6 @@ namespace MergeCMInpro.Business
|
||||
{
|
||||
int count = 0;
|
||||
int countRows = File.ReadAllLines(path).Length;
|
||||
|
||||
using (StreamReader sr = new StreamReader(path, System.Text.Encoding.GetEncoding("ISO-8859-1")))
|
||||
{
|
||||
string[] arr = new string[10];
|
||||
@@ -117,44 +116,22 @@ namespace MergeCMInpro.Business
|
||||
Console.WriteLine("\r{0}/{1} ", count, countRows);
|
||||
}
|
||||
arr = sr.ReadLine().Split(";");
|
||||
bool jpmFiles = arr[2].Contains(".jpm");
|
||||
|
||||
//Erstelle Basis-Vorgang aus den SAGA-Daten
|
||||
Vorgang v;
|
||||
|
||||
if(arr[2].Contains("70/"))
|
||||
{
|
||||
//arr[0]=ID z.B. 815922, arr[2]=AZ z.B. 61/5-3-048105, arr[3]=Strasse z.B. Westheck, arr[5]=DocType z.B. SCHRIFTVERKEHR, arr[6]=Teil z.B. 001, arr[8]=PDF z.B. 815922.pdf
|
||||
if (jpmFiles)
|
||||
{
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[7], arr[3], arr[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[7], arr[3], arr[4]);
|
||||
}
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[8], arr[3],arr[4]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (jpmFiles)
|
||||
{
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[8]);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[7]);
|
||||
}
|
||||
v = new Vorgang(arr[0], arr[2], string.Concat(arr[5], " Teil ", arr[6]), arr[6], arr[8]);
|
||||
}
|
||||
|
||||
#region PDF
|
||||
if(jpmFiles)
|
||||
{
|
||||
v.AbsoluteFilePath = GetFullFilePath(arr[8], path); //arr[7]=jpm-Dateien
|
||||
}
|
||||
else
|
||||
{
|
||||
v.AbsoluteFilePath = GetFullFilePath(arr[7], path);
|
||||
}
|
||||
|
||||
v.AbsoluteFilePath = GetFullFilePath(arr[8], path); //arr[7]=jpm-Dateien
|
||||
if (v.AbsoluteFilePath == string.Empty)
|
||||
{
|
||||
Console.WriteLine("Keine PDF-Dateien gefunden.");
|
||||
|
||||
@@ -33,21 +33,7 @@ namespace MergeCMInpro.Business
|
||||
string documentType = FileOperations.LowerDocumentType(v.DocType.Split(" ").FirstOrDefault());
|
||||
sbCM.Append(string.Concat(documentType, " ", string.Concat(v.DocType.Split(" ").FirstOrDefault().Substring(0, 1), v.DocType.Split(" ").FirstOrDefault().Substring(1).ToLower()), " ", v.DocType.Split(" ", 2).Skip(1).FirstOrDefault(), ";"));
|
||||
|
||||
string langBez = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
langBez = base.GenerateLangbezeichnungFromPath(v.AbsoluteFilePath);
|
||||
}
|
||||
catch (ArgumentOutOfRangeException ex)
|
||||
{
|
||||
Console.WriteLine("ERROR: Wrong Path {0}. Please provide folder like '843.818 - 847.187 SAGA HD 28 2023_12_18'", Path.GetDirectoryName(v.AbsoluteFilePath),ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
//string langBez = base.GenerateLangbezeichnungFromPath(v.AbsoluteFilePath);
|
||||
string langBez = base.GenerateLangbezeichnungFromPath(v.AbsoluteFilePath);
|
||||
sbCM.Append(string.Concat(langBez, ";"));
|
||||
|
||||
sbCM.Append(string.Concat(v.FameId, ".pdf"));
|
||||
@@ -55,5 +41,7 @@ namespace MergeCMInpro.Business
|
||||
return sbCM.ToString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,12 @@ namespace MergeCMInpro.Business
|
||||
sbStandort.Append(string.Concat(this.CID, ";"));//CID
|
||||
sbStandort.Append(string.Concat(v.Aktenzeichen, ";"));//Vorgangsnummer
|
||||
sbStandort.Append(string.Concat(this.Sachbearbeiter, ";"));//Sachbearbeiter
|
||||
sbStandort.Append(string.Concat(this.Bemerkung, ";"));//Bemerkung
|
||||
sbStandort.Append(string.Concat(this.Standort, ";"));//Standort
|
||||
sbStandort.Append(string.Concat(this.Entnahmedatum.ToShortDateString(), ";"));//Entnahmedatum -> Datum Tabelle
|
||||
sbStandort.Append(string.Concat(this.Entnahmezeit, ";"));//Entnahmezeit
|
||||
sbStandort.Append(string.Concat(this.Entnahmedatum.ToShortDateString(), ";"));//Rückgabedatum=Entnahmedatum
|
||||
sbStandort.Append(string.Concat(this.Entnahmezeit, ";"));//Rückgabezeit=Entnahmezeit
|
||||
sbStandort.Append(this.Entnahmezeit);//Rückgabezeit=Entnahmezeit
|
||||
|
||||
return sbStandort.ToString();
|
||||
}
|
||||
|
||||
@@ -30,9 +30,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog" Version="6.0.3" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.9.1" />
|
||||
<PackageReference Include="Sentry" Version="5.14.1" />
|
||||
<PackageReference Include="NLog" Version="5.0.4" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.70" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.32126.317
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MergeCMInpro", "MergeCMInpro.csproj", "{0798D653-CA13-4E5D-8A9E-4D8A3ADA4D1A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MergeCMInpro.Test", "..\TestProject1\MergeCMInpro.Test.csproj", "{E67A9AAD-585E-4F23-8A85-665A49285C61}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MergeCMInpro.Testing", "..\MergeCMInpro.Testing\MergeCMInpro.Testing.csproj", "{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -23,14 +23,14 @@ Global
|
||||
{0798D653-CA13-4E5D-8A9E-4D8A3ADA4D1A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0798D653-CA13-4E5D-8A9E-4D8A3ADA4D1A}.Release|x86.ActiveCfg = Release|x86
|
||||
{0798D653-CA13-4E5D-8A9E-4D8A3ADA4D1A}.Release|x86.Build.0 = Release|x86
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E67A9AAD-585E-4F23-8A85-665A49285C61}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F0F62B9F-4802-44AE-BFEC-7E20285ED2BE}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
108
Program.cs
108
Program.cs
@@ -4,7 +4,6 @@ using NLog;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Sentry;
|
||||
|
||||
namespace MergeCMInpro
|
||||
{
|
||||
@@ -18,18 +17,15 @@ namespace MergeCMInpro
|
||||
{
|
||||
try
|
||||
{
|
||||
CallSentry();
|
||||
Console.ForegroundColor = ConsoleColor.White;
|
||||
|
||||
//productive
|
||||
csvPath = Path.Combine(Directory.GetFiles(Environment.CurrentDirectory, "*.csv").FirstOrDefault());
|
||||
|
||||
//testing
|
||||
//csvPath = Path.Combine(Directory.GetFiles(@"\\fsdeg002\DatenStA61_S\Bauvorhaben\0_SAGA\839.867 - 843.817 SAGA HD 27 2023_11_08", "*.csv").FirstOrDefault());
|
||||
//csvPath = Path.Combine(Directory.GetFiles(@"\\fsdeg002\DatenStA61_S\Bauvorhaben\0_SAGA\815.922 - 819.917 SAGA HD 21 2021_09_27_Testing", "*.csv").FirstOrDefault());
|
||||
//csvPath = Path.Combine(Directory.GetFiles(@"C:\Testing\MergeInpro", "*.csv").FirstOrDefault());
|
||||
//csvPath = Path.Combine(Directory.GetFiles(@"C:\TEMP\SAGA\839.867 - 843.817 SAGA HD 27 2023_11_08", "*.csv").FirstOrDefault());
|
||||
//csvPath = Path.Combine(Directory.GetFiles(@"C:\TEMP\SAGA\843.818 - 847.187 SAGA HD 28 2023_12_18", "*.csv").FirstOrDefault());
|
||||
csvPath = Path.Combine(Directory.GetFiles(@"D:\TestData\MergeCMInpro", "*.csv").FirstOrDefault());
|
||||
|
||||
|
||||
string pathOutputFileCM = Path.Combine(Directory.GetParent(csvPath).FullName, "outputCM.csv");
|
||||
string pathOutputFileInpro = Path.Combine(Directory.GetParent(csvPath).FullName, "outputInpro.csv");
|
||||
@@ -43,15 +39,6 @@ namespace MergeCMInpro
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!CheckFolderStructure(csvPath))
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Yellow;
|
||||
Console.WriteLine("WARNING: folder structure wrong. Please note folder with name '{0}' has to contain all pdf files.", Path.GetFileNameWithoutExtension(csvPath));
|
||||
Console.ResetColor();
|
||||
return;
|
||||
}
|
||||
|
||||
var config = File.ReadLines(@".\config.txt").ToArray();
|
||||
DataOperations.conString = config[0];
|
||||
DataOperations.kanalAktePath = config[2];
|
||||
@@ -60,10 +47,6 @@ namespace MergeCMInpro
|
||||
if (!File.Exists(DataOperations.kanalAktePath))
|
||||
throw new FileNotFoundException("Kanalaktendatei nicht gefunden.");
|
||||
|
||||
//Testing
|
||||
//string archivNetPath = Path.Combine(@"C:\TEMP\ArchivPath");
|
||||
|
||||
//productive
|
||||
string archivNetPath = Path.Combine(config[1]);
|
||||
|
||||
Console.WriteLine("Working, please wait... or get yourself a tea.");
|
||||
@@ -91,33 +74,29 @@ namespace MergeCMInpro
|
||||
//Standort
|
||||
using (StreamWriter sw = new StreamWriter(pathOutputFileStandort))
|
||||
{
|
||||
foreach (var item in DataOperations.vorgängeStandort.Distinct())
|
||||
for (int i = 0; i < DataOperations.vorgängeStandort.Count; i++)
|
||||
{
|
||||
sw.WriteLine(item.ToString());
|
||||
if (i == 0)
|
||||
{
|
||||
sw.WriteLine(String.Concat("CID", "VORGANGID", "Sachbearbeiter", "Bemerkung", "Standort", "ENTNAHMEDATUM", "Entnahmezeit", "RUECKGABEDATUM", "Rückgabezeit"));
|
||||
}
|
||||
sw.WriteLine(DataOperations.vorgängeStandort[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("{0} created.", pathOutputFileCM);
|
||||
|
||||
FileInfo fi = new FileInfo(pathOutputFileInpro);
|
||||
if(fi.Length!=0)
|
||||
{
|
||||
Console.WriteLine("{0} created.", pathOutputFileInpro);
|
||||
Console.WriteLine("{0} created.", pathOutputFileStandort);
|
||||
}
|
||||
|
||||
Console.WriteLine("{0} created.", pathOutputFileInpro);
|
||||
Console.WriteLine("{0} created.", pathOutputFileStandort);
|
||||
Console.ResetColor();
|
||||
|
||||
//#region Backup JPM-Files
|
||||
//Console.WriteLine("Start copying jpm-files, please wait...");
|
||||
//FileInfo fi = new FileInfo(csvPath);
|
||||
//FileOperations.CopyJPMFilesToDestination(fi.Directory.FullName, archivNetPath);
|
||||
//Console.WriteLine("");
|
||||
//Console.ForegroundColor = ConsoleColor.Green;
|
||||
//Console.WriteLine("Done. You may close this window now.");
|
||||
//#endregion
|
||||
//Backup JPM-Files
|
||||
Console.WriteLine("Start copying jpm-files, please wait...");
|
||||
FileInfo fi = new FileInfo(csvPath);
|
||||
FileOperations.CopyJPMFilesToDestination(fi.Directory.FullName, archivNetPath);
|
||||
Console.WriteLine("");
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine("Done. You may close this window now.");
|
||||
|
||||
Console.ReadLine();
|
||||
|
||||
@@ -131,7 +110,7 @@ namespace MergeCMInpro
|
||||
catch (FileNotFoundException ex)
|
||||
{
|
||||
Console.ForegroundColor = ConsoleColor.Red;
|
||||
Console.WriteLine("ERROR: " + ex.Message);
|
||||
Console.WriteLine("ERROR: "+ex.Message);
|
||||
Console.ReadLine();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -141,59 +120,10 @@ namespace MergeCMInpro
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
static string CallSentry()
|
||||
{
|
||||
try
|
||||
{
|
||||
var res = SentrySdk.Init(options =>
|
||||
{
|
||||
// A Sentry Data Source Name (DSN) is required.
|
||||
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/
|
||||
// You can set it in the SENTRY_DSN environment variable, or you can set it in code here.
|
||||
options.Dsn = "";
|
||||
|
||||
// When debug is enabled, the Sentry client will emit detailed debugging information to the console.
|
||||
// This might be helpful, or might interfere with the normal operation of your application.
|
||||
// We enable it here for demonstration purposes when first trying Sentry.
|
||||
// You shouldn't do this in your applications unless you're troubleshooting issues with Sentry.
|
||||
options.Debug = true;
|
||||
|
||||
// This option is recommended. It enables Sentry's "Release Health" feature.
|
||||
options.AutoSessionTracking = true;
|
||||
});
|
||||
return res.ToString();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureMessage("Something went wrong");
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static bool CheckFolderStructure(string csvName)
|
||||
{
|
||||
string fileName = Path.GetFileNameWithoutExtension(csvName);
|
||||
bool result = false;
|
||||
string dir = Path.GetDirectoryName(csvName);
|
||||
DirectoryInfo di = new DirectoryInfo(dir);
|
||||
if(di.GetFiles("*.pdf").Length > 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (Directory.Exists(Path.Combine(dir, fileName)))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool CheckFileExist()
|
||||
{
|
||||
FileInfo fi = new FileInfo(Path.Combine(Directory.GetParent(csvPath).FullName, "outputInpro.csv"));
|
||||
|
||||
if ((File.Exists(Path.Combine(Directory.GetParent(csvPath).FullName, "outputInpro.csv")) && fi.Length!=0) || File.Exists(Path.Combine(Directory.GetParent(csvPath).FullName, "outputCM.csv")))
|
||||
if (File.Exists(Path.Combine(Directory.GetParent(csvPath).FullName, "outputInpro.csv")) || File.Exists(Path.Combine(Directory.GetParent(csvPath).FullName, "outputCM.csv")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user