EgwCApp COnv:
modifica x caso nome sheet = data (non fisso)
This commit is contained in:
@@ -27,6 +27,11 @@
|
||||
/// </summary>
|
||||
public string FileOutPath { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// IdxODL da registrare
|
||||
/// </summary>
|
||||
public int IdxODL { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Parametri per processing file string --> int
|
||||
/// </summary>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@
|
||||
"ConvertDir": "{{ConvertDir}}",
|
||||
"FileInPath": "{{FileInPath}}",
|
||||
"FileOutPath": "{{FileOutPath}}",
|
||||
"IdxODL": 987654321,
|
||||
"ProcessParamInt": {
|
||||
"Product": 3,
|
||||
"Variety": 9,
|
||||
|
||||
Reference in New Issue
Block a user