diff --git a/EgwCApp/EgwCApp.XmlProc.sln b/EgwCApp/EgwCApp.XmlProc.sln new file mode 100644 index 00000000..2139c5b7 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32516.85 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.Core", "EgwCApp.Core\EgwCApp.Core.csproj", "{DF02D478-2309-48B8-BF0D-90B02327AF02}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.XmlProc", "EgwCApp.XmlProc\EgwCApp.XmlProc.csproj", "{64BC5889-BE30-489A-B78F-8B3EE08819CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EgwCApp.XmlTesting", "EgwCApp.XmlTesting\EgwCApp.XmlTesting.csproj", "{52D72303-ACAB-4289-8856-0F56A50474FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF02D478-2309-48B8-BF0D-90B02327AF02}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF02D478-2309-48B8-BF0D-90B02327AF02}.Release|Any CPU.Build.0 = Release|Any CPU + {64BC5889-BE30-489A-B78F-8B3EE08819CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64BC5889-BE30-489A-B78F-8B3EE08819CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64BC5889-BE30-489A-B78F-8B3EE08819CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64BC5889-BE30-489A-B78F-8B3EE08819CB}.Release|Any CPU.Build.0 = Release|Any CPU + {52D72303-ACAB-4289-8856-0F56A50474FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52D72303-ACAB-4289-8856-0F56A50474FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52D72303-ACAB-4289-8856-0F56A50474FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52D72303-ACAB-4289-8856-0F56A50474FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2AF3181F-288A-47D5-8087-2AB660476D85} + EndGlobalSection +EndGlobal diff --git a/EgwCApp/EgwCApp.XmlProc/EgwCApp.XmlProc.csproj b/EgwCApp/EgwCApp.XmlProc/EgwCApp.XmlProc.csproj new file mode 100644 index 00000000..d18020f3 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/EgwCApp.XmlProc.csproj @@ -0,0 +1,20 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + Always + + + + diff --git a/EgwCApp/EgwCApp.XmlProc/ImportProc.cs b/EgwCApp/EgwCApp.XmlProc/ImportProc.cs new file mode 100644 index 00000000..2084be68 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/ImportProc.cs @@ -0,0 +1,378 @@ +using EgwCApp.Core; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static EgwCApp.Core.WharehouseData; + +namespace EgwCApp.XmlProc +{ + public class ImportProc + { + #region Public Constructors + + /// + /// Init oggetto per import + /// + /// + public ImportProc(string confFileName) + { + if (!string.IsNullOrEmpty(confFileName)) + { + fileConfName = confFileName; + } + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Decodifica configurazione + /// + /// + public bool decodeConfig() + { + bool answ = false; + if (!string.IsNullOrEmpty(fileConfName)) + { + // deserializzo config + if (!File.Exists(fileConfName)) + { + Console.WriteLine($"Error: ConfigFile not found | {fileConfName}"); + } + else + { + string rawData = File.ReadAllText(fileConfName); + // se ho contenuto procedo + if (string.IsNullOrEmpty(rawData)) + { + Console.WriteLine($"Error: ConfigFile empty! | {fileConfName}"); + } + else + { + // deserializzo + taskConfig = JsonConvert.DeserializeObject(rawData); + answ = taskConfig != null; + } + } + } + return answ; + } + + /// + /// Esegue import (se possibile) + /// + /// + public bool doProcess() + { + bool answ = false; + if (taskConfig != null) + { + // verifico esista il file... + if (string.IsNullOrEmpty(taskConfig.FileInPath) && File.Exists(taskConfig.FileInPath)) + { + // manca file ingresso!!! esco! + } + else + { + // verifico il tipo di process necessario... + switch (taskConfig.Type) + { + case ImportType.CSV: + fileReturnData = File.ReadAllText(taskConfig.FileInPath); + answ = true; + break; + + case ImportType.Excel: + fileReturnData = processExcelImport(taskConfig.FileInPath); + answ = true; + break; + + case ImportType.ND: + default: + break; + } + } + } + return answ; + } + + /// + /// Esecuzione ritorno informazioni secondo configurazione... + /// + /// + public bool doReturn() + { + bool answ = false; + if (taskConfig != null) + { + // verifico il tipo di return necessario... + switch (taskConfig.Return) + { + case ReturnMode.Console: + Console.WriteLine(fileReturnData); + answ = true; + break; + + case ReturnMode.Redis: + break; + + case ReturnMode.File: + // verifico path ci sia... sennò creo + string outPath = string.IsNullOrEmpty(taskConfig.FileOutPath) ? "FileOut.txt" : taskConfig.FileOutPath; + // verifico se vadano salvati in una folder differente... + if (!string.IsNullOrEmpty(taskConfig.ConvertDir)) + { + if (!Directory.Exists(taskConfig.ConvertDir)) + { + Directory.CreateDirectory(taskConfig.ConvertDir); + } + outPath = Path.Combine(taskConfig.ConvertDir, Path.GetFileName(outPath)); + } + // salvo il file! + File.WriteAllText(outPath, fileReturnData); + answ = true; + break; + + case ReturnMode.ND: + default: + break; + } + // se fatto eventualmente archivio + if (answ) + { + if (!string.IsNullOrEmpty(taskConfig.ArchiveDir)) + { + // verifico cartella archivio + if (!Directory.Exists(taskConfig.ArchiveDir)) + { + Directory.CreateDirectory(taskConfig.ArchiveDir); + } + // sposto file + string fName = Path.GetFileName(taskConfig.FileInPath); + File.Move(taskConfig.FileInPath, Path.Combine(taskConfig.ArchiveDir, fName), true); + } + } + } + return answ; + } + + #endregion Public Methods + + #region Protected Properties + + /// + /// Nome del file config da processare + /// + protected string fileConfName { get; set; } = ""; + + /// + /// Contenuto del file da restituire come return data (serializzato) + /// + protected string fileReturnData { get; set; } = ""; + + /// + /// Configurazione del task da eseguire + /// + protected ConfigFile? taskConfig { get; set; } = new ConfigFile(); + + #endregion Protected Properties + + #region Protected Methods + + /// + /// Estrae da una riga l'i-esimo elemento + /// + /// + /// + /// + protected string getCellVal(System.Data.DataRow? riga, int col) + { + string answ = ""; + if (riga != null) + { + try + { + answ = $"{riga.ItemArray[col]}".Trim(); + } + catch + { } + } + return answ; + } + + /// + /// Cleanup stringa x impiego tipo ident da char dubbi + /// + /// + /// + protected string strFixId(string origData) + { + return origData.Replace(".", "").Replace(" ", "_"); + } + + #endregion Protected Methods + + #region Private Methods + + /// + /// Importa un file excel e restituisce una + /// + /// + /// + private string processExcelImport(string fileItem) + { + string outVal = ""; + int numErr = 0; + // test procedura di import files excel x Giacovelli... + var currExcel = new ExcelMan(fileItem); + // creo lista dati in formato RegGiacenze... + Dictionary listaGiac = new Dictionary(); + var dtSet = currExcel.getDataSet(); + if (dtSet != null && dtSet.Tables != null && dtSet.Tables.Count > 0) + { + string nomeFile = Path.GetFileName(fileItem); + nomeFile = nomeFile.Substring(0, nomeFile.LastIndexOf(".")); + var elSheet = dtSet.Tables; + int idxTab = 0; + // cerco lo sheet corretto se > 1 + if (dtSet.Tables.Count > 1) + { + bool found = false; + for (int i = 0; i < dtSet.Tables.Count; i++) + { + if (nomeFile.Contains(dtSet.Tables[i].TableName)) + { + idxTab = i; + found = true; + break; + } + // controllo parametro opzionale... + if (!found && taskConfig != null && !string.IsNullOrEmpty(taskConfig.TargetName)) + { + if (dtSet.Tables[i].TableName == taskConfig.TargetName) + { + idxTab = i; + break; + } + } + } + } + var tabella = dtSet.Tables[idxTab]; + int numRighe = tabella.Rows.Count; + int idxODL = taskConfig != null ? taskConfig.IdxODL : 0; + for (int i = 0; i < numRighe; i++) + { + if (taskConfig != null && taskConfig.ProcessParamInt != null && taskConfig.ProcessParamInt.Count > 5) + { + if (numErr < numRighe / 5) + { + try + { + // variabili di appoggio... + DateTime dtRif = DateTime.Today; + double qtyTot = 0; + int numPack = 0; + var riga = tabella.Rows[i]; + if (riga != null) + { + string ddt = getCellVal(riga, taskConfig.ProcessParamInt["ExtDoc"]); + string sDate = getCellVal(riga, taskConfig.ProcessParamInt["DateRif"]); + string prod = getCellVal(riga, taskConfig.ProcessParamInt["Product"]); + // verifiche x import: header, data e DDT (vuoti o "-") --> SKIP! + bool checkHeaderKo = (ddt == "DDT" || prod == "PRODOTTO"); + bool checkEmptyDdt = (string.IsNullOrEmpty(ddt) || ddt == "-"); + bool checkEmptyDate = (string.IsNullOrEmpty(sDate) || sDate == "-"); + if (checkHeaderKo) + { + //lgTrace($"SKIP header"); + } + else if (checkEmptyDdt || checkEmptyDate) + { + //lgTrace($"SKIP linea vuota | i: {i} | ddt: {ddt} | date: {sDate} | prod: {prod}"); + } + else + { + string variety = getCellVal(riga, taskConfig.ProcessParamInt["Variety"]); + string suppl = getCellVal(riga, taskConfig.ProcessParamInt["Supplier"]); + string sQty = getCellVal(riga, taskConfig.ProcessParamInt["QtyTot"]); + string sNum = getCellVal(riga, taskConfig.ProcessParamInt["NumPack"]); + string numPed = getCellVal(riga, taskConfig.ProcessParamInt["NumPed"]); + string packPed = getCellVal(riga, taskConfig.ProcessParamInt["PackPed"]); + string pesoPack = getCellVal(riga, taskConfig.ProcessParamInt["PesoPack"]); + DateTime.TryParse(sDate, out dtRif); + int.TryParse(sNum, out numPack); + double.TryParse(sQty, out qtyTot); + string identRG = ddt.Length > 2 ? $"{strFixId(ddt)}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}" : $"{dtRif:yyyyMMdd}.{strFixId(prod)}.{strFixId(variety)}.{strFixId(suppl)}"; + string notes = $"{numPed}x{packPed}x{pesoPack}"; + // verifico di avere dati per proseguire... + bool checkIdent = !string.IsNullOrEmpty($"{prod}{variety}{suppl}"); + if (checkIdent) + { + BatchRec newRow = new BatchRec() + { + IdxODL = idxODL, + IdentRG = identRG, + DateRif = dtRif, + ExtDoc = ddt, + Product = prod, + Variety = variety, + Supplier = suppl, + NumPack = numPack, + QtyTot = qtyTot, + Notes = notes + }; + // verifico: se manca aggiungo + if (!listaGiac.ContainsKey(identRG)) + { + listaGiac.Add(identRG, newRow); + } + else + { + // altrimenti aggiorno giacenza con valori numerici + listaGiac[identRG].NumPack += newRow.NumPack; + listaGiac[identRG].QtyTot += newRow.QtyTot; + } + } + else + { + //lgError($"Errore verifica identità riga | prod: {prod} | variety: {variety} | suppl: {suppl}"); + numErr++; + } + } + } + } + catch (Exception exc) + { + numErr++; + } + } + } + } + } + if (listaGiac.Count > 0) + { + // converto in una nuova lista... + int rCounter = 1; + Dictionary list2Send = new Dictionary(); + foreach (var item in listaGiac) + { + list2Send.Add(rCounter, item.Value); + rCounter++; + } + // serializzo e restituisco file JSON... + var serVal = JsonConvert.SerializeObject(list2Send); + if (serVal != null && !string.IsNullOrEmpty(serVal)) + { + outVal = serVal; + } + } + return outVal; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlProc/Program.cs b/EgwCApp/EgwCApp.XmlProc/Program.cs new file mode 100644 index 00000000..03e44040 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/Program.cs @@ -0,0 +1,62 @@ +// See https://aka.ms/new-console-template for more information + +// ExcImport: Excel Importer, per IobWin in logica lettura Giacenze +// parametri: +// $0: Path ConfigFile file per esecuzione + + +using EgwCApp.XmlProc; + +string separator = "--------------------------------------"; +string fileName = ""; + +// controllo args, se mancassero o incompleti mostro help +if (args.Length < 1) +{ + Console.WriteLine(separator); + Console.WriteLine("- ExcelFileImporter - Core 6.0"); + Console.WriteLine("- v.0.0.0.0 | @Egalware 2022+"); + Console.WriteLine(separator); + Console.WriteLine(); + Console.WriteLine("Mancano parametri per esecuzione:"); + Console.WriteLine(""); + Console.WriteLine("$0: ConfigFile da impiegare"); + + // provo a processare testConf... + fileName = "testConf.json"; +} +else +{ + fileName = args[0]; +} + +// ora processo se ho filename valido... +if (!string.IsNullOrEmpty(fileName)) +{ + // verifico se ho file... + if (File.Exists(fileName)) + { + ImportProc importObj = new ImportProc(fileName); + bool stepOk = importObj.decodeConfig(); + if (stepOk) + { + stepOk = importObj.doProcess(); + if (!stepOk) + { + Console.WriteLine("Errore in processing file"); + } + else + { + importObj.doReturn(); + } + } + else + { + Console.WriteLine("Errore in processing config file"); + } + } + else + { + Console.WriteLine("Errore file non trovato!"); + } +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlProc/postBuild.bat b/EgwCApp/EgwCApp.XmlProc/postBuild.bat new file mode 100644 index 00000000..e6852aea --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/postBuild.bat @@ -0,0 +1,4 @@ +@echo off + +REM compilo in publish +dotnet publish EgwCApp.ExcImport.csproj -p:PublishSingleFile=true -r win-x64 -c Release --self-contained false diff --git a/EgwCApp/EgwCApp.XmlProc/testConf.json b/EgwCApp/EgwCApp.XmlProc/testConf.json new file mode 100644 index 00000000..a62fe2c3 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/testConf.json @@ -0,0 +1,25 @@ +{ + "ArchiveDir": "C:\\temp\\import\\archive", + "ConvertDir": "C:\\temp\\import\\convert", + "FileInPath": "C:\\temp\\import\\01.12.xlsx", + "FileOutPath": "01.12.json", + "IdxODL": 987654321, + "ProcessParamInt": { + "Product": 3, + "Variety": 9, + "Supplier": 8, + "ExtDoc": 2, + "DateRif": 14, + "QtyTot": 22, + "NumPack": 21, + "NumPed": 17, + "PackPed": 18, + "PesoPack": 20 + }, + "ProcessParamStr": {}, + "RedisDB": 0, + "RedisOut": "", + "Return": "File", + "TargetName": "DB Loco", + "Type": "Excel" +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlProc/testConfCsv.json b/EgwCApp/EgwCApp.XmlProc/testConfCsv.json new file mode 100644 index 00000000..5278eb08 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/testConfCsv.json @@ -0,0 +1,6 @@ +{ + "FilePath": "C:\\Temp\\test.log", + "ProcessParams": {}, + "Return": "Console", + "Type": "Excel" +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlProc/testConfExcel.json b/EgwCApp/EgwCApp.XmlProc/testConfExcel.json new file mode 100644 index 00000000..a62fe2c3 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlProc/testConfExcel.json @@ -0,0 +1,25 @@ +{ + "ArchiveDir": "C:\\temp\\import\\archive", + "ConvertDir": "C:\\temp\\import\\convert", + "FileInPath": "C:\\temp\\import\\01.12.xlsx", + "FileOutPath": "01.12.json", + "IdxODL": 987654321, + "ProcessParamInt": { + "Product": 3, + "Variety": 9, + "Supplier": 8, + "ExtDoc": 2, + "DateRif": 14, + "QtyTot": 22, + "NumPack": 21, + "NumPed": 17, + "PackPed": 18, + "PesoPack": 20 + }, + "ProcessParamStr": {}, + "RedisDB": 0, + "RedisOut": "", + "Return": "File", + "TargetName": "DB Loco", + "Type": "Excel" +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlTesting/Appunti.txt b/EgwCApp/EgwCApp.XmlTesting/Appunti.txt new file mode 100644 index 00000000..6e57618e --- /dev/null +++ b/EgwCApp/EgwCApp.XmlTesting/Appunti.txt @@ -0,0 +1,9 @@ +echo ------------ Parametri compilazione ------------ +echo OutDir: $(OutDir) +echo Configuration: $(ConfigurationName) +echo ProjectDir: $(ProjectDir) +echo AssemblyName: $(AssemblyName) +echo TargetDir: $(TargetDir) +echo ------------ Parametri compilazione ------------ + +preBuild.bat $(SolutionDir)EgwCApp.ExcImport\EgwCApp.ExcImport.csproj $(SolutionDir)EgwCApp.ExcImport\bin\Release\net6.0\publish\win-x64\ $(ProjectDir)Utils \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlTesting/EgwCApp.XmlTesting.csproj b/EgwCApp/EgwCApp.XmlTesting/EgwCApp.XmlTesting.csproj new file mode 100644 index 00000000..436788fe --- /dev/null +++ b/EgwCApp/EgwCApp.XmlTesting/EgwCApp.XmlTesting.csproj @@ -0,0 +1,21 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + + + Always + + + + diff --git a/EgwCApp/EgwCApp.XmlTesting/FileProcMan.cs b/EgwCApp/EgwCApp.XmlTesting/FileProcMan.cs new file mode 100644 index 00000000..454f967d --- /dev/null +++ b/EgwCApp/EgwCApp.XmlTesting/FileProcMan.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using EgwCApp.Core; +using Newtonsoft.Json; +using System.Diagnostics; + +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EgwCApp.XmlTesting +{ + public class FileProcMan + { + #region Public Constructors + + public FileProcMan(string toolDir, string exeFileName) + { + this.confFileName = "conf.json"; + this.baseDir = toolDir; + this.exeName = exeFileName; + appPath = $"./{baseDir}/{exeName}"; + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Processa il singolo file e riporta tempo esecuzione + /// + /// + public TimeSpan doProcess(string fPath) + { + TimeSpan outVal = new TimeSpan(); + Stopwatch sw = new Stopwatch(); + // preparo file conf + createConfFile(fPath); + // avvio processing + Console.WriteLine("calling ext app with args:"); + Console.WriteLine($"{appPath} {confFileName}"); + Console.WriteLine(); + + ProcessStartInfo psi = new ProcessStartInfo + { + FileName = appPath, + Arguments = $"{confFileName}", + WindowStyle = ProcessWindowStyle.Minimized, + //WindowStyle = ProcessWindowStyle.Hidden, + UseShellExecute = false, + //CreateNoWindow = true, + RedirectStandardOutput = true, + RedirectStandardInput = true, + }; + + sw.Start(); + + Process p = Process.Start(psi); + + string q = ""; + while (!p.HasExited) + { + q += p.StandardOutput.ReadToEnd(); + } + + sw.Stop(); + outVal = sw.Elapsed; + + return outVal; + } + + #endregion Public Methods + + #region Protected Fields + + protected string appPath = ""; + protected string baseDir = ""; + protected string confFileName = ""; + protected string exeName = ""; + + #endregion Protected Fields + + #region Private Methods + + private void createConfFile(string item) + { + Dictionary importParams = new Dictionary(); + importParams.Add("Product", 3); + importParams.Add("Variety", 9); + importParams.Add("Supplier", 8); + importParams.Add("ExtDoc", 2); + importParams.Add("DateRif", 14); + importParams.Add("QtyTot", 22); + importParams.Add("NumPack", 21); + importParams.Add("NumPed", 17); + importParams.Add("PackPed", 18); + importParams.Add("PesoPack", 20); + // calcolo nome file conf specifico + string outFileName = Path.GetFileName(item).Replace("xlsx", "json"); + confFileName = $"conf_{outFileName}"; + // calcolo outFIleName + var newConf = new ConfigFile() + { + ArchiveDir = @"C:\temp\import\archive\", + ConvertDir = @"C:\temp\import\convert\", + Type = ImportType.Excel, + FileInPath = item, + FileOutPath = outFileName, + Return = ReturnMode.File, + ProcessParamInt = importParams, + TargetName = "DB Loco" + }; + // serializzo e salvo! + var rawData = JsonConvert.SerializeObject(newConf, Formatting.Indented); + File.WriteAllText(confFileName, rawData); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlTesting/Program.cs b/EgwCApp/EgwCApp.XmlTesting/Program.cs new file mode 100644 index 00000000..527c7c24 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlTesting/Program.cs @@ -0,0 +1,65 @@ +// See https://aka.ms/new-console-template for more information + +using EgwCApp.Core; +using System.Diagnostics; +using Newtonsoft.Json; +using EgwCApp.XmlTesting; + +Dictionary statsColl = new Dictionary(); +Stopwatch sw = new Stopwatch(); + +string separator = "--------------------------------------"; +Console.WriteLine(separator); +Console.WriteLine("Console Test Application"); +Console.WriteLine(separator); +Console.WriteLine(); + +// creo il file di configurazione... +string fileName = "conf.json"; +ConfigFile newConf = new ConfigFile(); +string rawData = ""; + +// test CSV +//newConf = new ConfigFile() +//{ +// Type = ImportType.CSV, +// FileInPath = @"C:\Temp\test.log", +// Return = ReturnMode.Console +//}; + + +// svuoto eventuali conf vecchi +var listaConf = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.json"); +if (listaConf != null && listaConf.Count() > 0) +{ + foreach (var file2del in listaConf) + { + File.Delete(file2del); + } +} +// cerco file xlsx e ciclo... +var listaFiles = Directory.GetFiles(@"C:\temp\import\", "*.xlsx"); +if (listaFiles != null && listaFiles.Count() > 0) +{ + FileProcMan fpm = new FileProcMan("Tools", "ExcImport.exe"); + foreach (var item in listaFiles) + { + TimeSpan timeElaps = fpm.doProcess(item); + + statsColl.Add($"Ext prog executed for {item}", timeElaps); + } +} + + +Console.WriteLine(separator); +Console.WriteLine("press enter to proceed..."); + +Console.ReadLine(); + +foreach (var item in statsColl) +{ + Console.WriteLine($"{item.Key} {item.Value.TotalMilliseconds} ms"); +} +//Console.WriteLine($"Display executed in {timeElaps.TotalMilliseconds} ms"); + +Console.ReadLine(); \ No newline at end of file diff --git a/EgwCApp/EgwCApp.XmlTesting/Tools/ExcImport.exe b/EgwCApp/EgwCApp.XmlTesting/Tools/ExcImport.exe new file mode 100644 index 00000000..b5f962e4 Binary files /dev/null and b/EgwCApp/EgwCApp.XmlTesting/Tools/ExcImport.exe differ diff --git a/EgwCApp/EgwCApp.XmlTesting/preBuild.bat b/EgwCApp/EgwCApp.XmlTesting/preBuild.bat new file mode 100644 index 00000000..2fe8abf9 --- /dev/null +++ b/EgwCApp/EgwCApp.XmlTesting/preBuild.bat @@ -0,0 +1,6 @@ +@echo off + +REM recupero versione compilata +ROBOCOPY %1 %2 *.exe /MIR + +echo Eseguito restore CApp! \ No newline at end of file diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 18357e13..7b0e5f0d 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -472,106 +472,6 @@ Always - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 7115b69c..3bc4a5c7 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -5768,6 +5768,8 @@ namespace IOB_WIN_NEXT /// /// Effettua eventuale file import, archiviando file importati + /// - es gestione file excel di Giacovelli + /// - es gestione ritorno ricette FIMAT /// /// protected virtual bool processFileImport() @@ -5882,6 +5884,7 @@ namespace IOB_WIN_NEXT return answ; } + /// /// Processa le richieste di scrittura memoria ///