diff --git a/EgwCApp/EgwCApp.Core/ConfigFile.cs b/EgwCApp/EgwCApp.Core/ConfigFile.cs index a3125084..9114467c 100644 --- a/EgwCApp/EgwCApp.Core/ConfigFile.cs +++ b/EgwCApp/EgwCApp.Core/ConfigFile.cs @@ -27,6 +27,11 @@ /// public string FileOutPath { get; set; } = ""; + /// + /// IdxODL da registrare + /// + public int IdxODL { get; set; } = 0; + /// /// Parametri per processing file string --> int /// diff --git a/EgwCApp/EgwCApp.ExcImport/ImportProc.cs b/EgwCApp/EgwCApp.ExcImport/ImportProc.cs index b4f92459..0daebe4a 100644 --- a/EgwCApp/EgwCApp.ExcImport/ImportProc.cs +++ b/EgwCApp/EgwCApp.ExcImport/ImportProc.cs @@ -148,7 +148,7 @@ namespace EgwCApp.ExcImport } // sposto file string fName = Path.GetFileName(taskConfig.FileInPath); - File.Move(taskConfig.FileInPath, Path.Combine(taskConfig.ArchiveDir, fName)); + File.Move(taskConfig.FileInPath, Path.Combine(taskConfig.ArchiveDir, fName), true); } } } @@ -236,31 +236,29 @@ namespace EgwCApp.ExcImport // 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 (taskConfig != null && !string.IsNullOrEmpty(taskConfig.TargetName)) + if (!found && taskConfig != null && !string.IsNullOrEmpty(taskConfig.TargetName)) { if (dtSet.Tables[i].TableName == taskConfig.TargetName) { idxTab = i; - } - } - else - { - if (nomeFile.Contains(dtSet.Tables[i].TableName)) - { - idxTab = i; + break; } } } } var tabella = dtSet.Tables[idxTab]; int numRighe = tabella.Rows.Count; - int idxODL = 0; - DateTime dataDoc = DateTime.Today; - DateTime.TryParse(nomeFile, out dataDoc); - + int idxODL = taskConfig != null ? taskConfig.IdxODL : 0; for (int i = 0; i < numRighe; i++) { if (taskConfig != null && taskConfig.ProcessParamInt != null && taskConfig.ProcessParamInt.Count > 5) diff --git a/EgwCApp/EgwCApp.ExcImport/testConf.json b/EgwCApp/EgwCApp.ExcImport/testConf.json index e110ade0..a62fe2c3 100644 --- a/EgwCApp/EgwCApp.ExcImport/testConf.json +++ b/EgwCApp/EgwCApp.ExcImport/testConf.json @@ -1,8 +1,9 @@ { - "ArchiveDir": "C:\\temp\\import\\archive\\", - "ConvertDir": "C:\\temp\\import\\convert\\", + "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, diff --git a/EgwCApp/EgwCApp.ExcImport/testConfExcel.json b/EgwCApp/EgwCApp.ExcImport/testConfExcel.json index 21ca7e7d..a62fe2c3 100644 --- a/EgwCApp/EgwCApp.ExcImport/testConfExcel.json +++ b/EgwCApp/EgwCApp.ExcImport/testConfExcel.json @@ -1,9 +1,9 @@ { "ArchiveDir": "C:\\temp\\import\\archive", - "ConvertDir": "C:\\temp\\import\\converted", + "ConvertDir": "C:\\temp\\import\\convert", "FileInPath": "C:\\temp\\import\\01.12.xlsx", - "FileOutPath": "C:\\temp\\import\\01.12.json", - "ProcessParamStr": {}, + "FileOutPath": "01.12.json", + "IdxODL": 987654321, "ProcessParamInt": { "Product": 3, "Variety": 9, @@ -16,6 +16,9 @@ "PackPed": 18, "PesoPack": 20 }, + "ProcessParamStr": {}, + "RedisDB": 0, + "RedisOut": "", "Return": "File", "TargetName": "DB Loco", "Type": "Excel" diff --git a/EgwCApp/EgwCApp.Testing/Program.cs b/EgwCApp/EgwCApp.Testing/Program.cs index 519ac50f..29779573 100644 --- a/EgwCApp/EgwCApp.Testing/Program.cs +++ b/EgwCApp/EgwCApp.Testing/Program.cs @@ -28,13 +28,22 @@ string rawData = ""; //}; +// 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) { - FileProcMan fpm = new FileProcMan("Tools", "ExcImport.exe"); TimeSpan timeElaps = fpm.doProcess(item); statsColl.Add($"Ext prog executed for {item}", timeElaps); diff --git a/EgwCApp/EgwCApp.Testing/Tools/ExcImport.exe b/EgwCApp/EgwCApp.Testing/Tools/ExcImport.exe index 6ad3a0bf..b5f962e4 100644 Binary files a/EgwCApp/EgwCApp.Testing/Tools/ExcImport.exe and b/EgwCApp/EgwCApp.Testing/Tools/ExcImport.exe differ diff --git a/IOB-WIN-NEXT/Tools/ExcImport.exe b/IOB-WIN-NEXT/Tools/ExcImport.exe index 6ad3a0bf..b5f962e4 100644 Binary files a/IOB-WIN-NEXT/Tools/ExcImport.exe and b/IOB-WIN-NEXT/Tools/ExcImport.exe differ diff --git a/IOB-WIN-NEXT/Tools/RefExcConv.json b/IOB-WIN-NEXT/Tools/RefExcConv.json index a66b85e1..40baa3cc 100644 --- a/IOB-WIN-NEXT/Tools/RefExcConv.json +++ b/IOB-WIN-NEXT/Tools/RefExcConv.json @@ -3,6 +3,7 @@ "ConvertDir": "{{ConvertDir}}", "FileInPath": "{{FileInPath}}", "FileOutPath": "{{FileOutPath}}", + "IdxODL": 987654321, "ProcessParamInt": { "Product": 3, "Variety": 9,