FTP:
- inizio gestione ODL (da provare con cambio su tablet) - fluxlog delle azioni creazione DIR su FTP
This commit is contained in:
@@ -43,7 +43,6 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public bool SkipCert { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tempo di attesa in SEC standard prima della prossima ri-esecuzione
|
||||
/// </summary>
|
||||
|
||||
@@ -2893,7 +2893,7 @@ namespace IOB_WIN_NEXT.Iob
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
// recupero elenco delle cose da fare
|
||||
string resp = getTask2exe();
|
||||
if (!string.IsNullOrEmpty(resp))
|
||||
if (!string.IsNullOrEmpty(resp) && resp.Length > 2)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
+150
-79
@@ -11,6 +11,7 @@ using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace IOB_WIN_NEXT.IobNet
|
||||
{
|
||||
@@ -56,8 +57,33 @@ namespace IOB_WIN_NEXT.IobNet
|
||||
if (!string.IsNullOrEmpty(ftpConfFile))
|
||||
{
|
||||
loadFtpConfFile(ftpConfFile);
|
||||
// mi calcolo ed imposto la remoteBaseDir...
|
||||
string actKey = "RemoteDir";
|
||||
if (currFtpTaskList != null && currFtpTaskList.ListTask.Count > 0)
|
||||
{
|
||||
// prendo i task
|
||||
foreach (var fTask in currFtpTaskList.ListTask)
|
||||
{
|
||||
if (string.IsNullOrEmpty(RemoteBaseDir))
|
||||
{
|
||||
foreach (var fAct in fTask.StepsList)
|
||||
{
|
||||
// cerco nei parametri...
|
||||
if (fAct.ParamList.ContainsKey(actKey))
|
||||
{
|
||||
RemoteBaseDir = fAct.ParamList[actKey];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Directpry remota di abse
|
||||
/// </summary>
|
||||
private string RemoteBaseDir { get; set; } = "";
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
@@ -69,94 +95,133 @@ namespace IOB_WIN_NEXT.IobNet
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
// il compito della richiesta è SEMPRE scrivere folder dell'ODL corrente SE NON LA TROVASSE
|
||||
|
||||
// uso metodo base x salvare esito scrittura
|
||||
var writeResult = base.executeTasks(task2exe);
|
||||
|
||||
#if false
|
||||
/*---------------------------------------------------------------------------
|
||||
* va creata una folder x ogni ODL (una volta LANCIATO da tablet) APERTO
|
||||
* - nella folder scriviamo un file con articolo, qta, commessa
|
||||
* - la folder sarà usata x salvare OGNI file necessario e di rilevazione
|
||||
*---------------------------------------------------------------------------*/
|
||||
* va creata una folder x ogni ODL (una volta LANCIATO da tablet) APERTO
|
||||
* - nella folder scriviamo un file con articolo, qta, commessa
|
||||
* - la folder sarà usata x salvare OGNI file necessario e di rilevazione
|
||||
* - per farlo si creeano degli ActionStep specifici e vengono poi richiamati...
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
// aggiungo comportamento custom: se ho impostato nome ricetta (programma) --> imposto
|
||||
// richiesta caricamento se ho richiesto reset o fine lavoro --> imposto azzeramento
|
||||
// esco restituendo risutlato scrittura iniziali
|
||||
if (task2exe != null)
|
||||
// Verificare il protocollo: dovrebbe togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
ActionConfig currAct = new ActionConfig();
|
||||
var currActParam = new Dictionary<string, string>();
|
||||
string actKey = "RemoteDir";
|
||||
string newDir = "";
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
// controllo se memMap != null...
|
||||
if (memMap != null)
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY...
|
||||
switch (tName)
|
||||
{
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// cerco task specifici x OMP
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY...
|
||||
switch (tName)
|
||||
case taskType.setComm:
|
||||
/*------------------------------------------------------------------
|
||||
* La commessa è la cartella DI BASE per poter poi procedere con acquisizione dati...
|
||||
* - step 1: check folder
|
||||
* - step 2: creazione folder
|
||||
------------------------------------------------------------------*/
|
||||
// compongo remDir dai 2 parametri...
|
||||
newDir = $"{RemoteBaseDir}/{item.Value}";
|
||||
currActParam.Add(actKey, newDir);
|
||||
currAct = new ActionConfig()
|
||||
{
|
||||
#if false
|
||||
case taskType.setProg:
|
||||
// recupero dati da memMap...
|
||||
if (memMap != null && memMap.mMapWrite != null)
|
||||
{
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
{
|
||||
dataConf currMem = memMap.mMapWrite[item.Key];
|
||||
string addr = currMem.memAddr;
|
||||
taskVal = $"SET task: {item.Key} --> {item.Value} | mem: {currMem.memAddr} - {currMem.size} byte";
|
||||
// salvo il nuovo valore nella memoria... così prox invio lo trasmetterà
|
||||
memMap.mMapWrite[item.Key].value = item.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"NO DATA MEM, SET task: {item.Key} --> {item.Value}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"NO MemMap found, SET task: {item.Key} --> {item.Value}";
|
||||
}
|
||||
// salvo in currProd..
|
||||
saveProdData(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
|
||||
break;
|
||||
|
||||
case taskType.startSetup:
|
||||
setFineLotto();
|
||||
break;
|
||||
|
||||
case taskType.stopSetup:
|
||||
setInizioProd();
|
||||
break;
|
||||
|
||||
case taskType.syncDbData:
|
||||
processDataSync();
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
Id = "01",
|
||||
Description = "Verifica esistenza directory",
|
||||
Action = ActType.CheckDir,
|
||||
ParamList = currActParam
|
||||
};
|
||||
//eseguo step...
|
||||
bool dirOk = doStep(currAct);
|
||||
// se la cartella mancasse
|
||||
if (!dirOk)
|
||||
{
|
||||
// nuovo act x crearla!
|
||||
currAct = new ActionConfig()
|
||||
{
|
||||
Id = "02",
|
||||
Description = "Creazione directory",
|
||||
Action = ActType.CreateDir,
|
||||
ParamList = currActParam
|
||||
};
|
||||
//eseguo step...
|
||||
dirOk = doStep(currAct);
|
||||
if (dirOk)
|
||||
{
|
||||
taskVal = $"DIR Created: {item.Key} --> {item.Value}";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"DIR Already Exists: {item.Key} --> {item.Value}";
|
||||
}
|
||||
// salvo in currProd..
|
||||
saveProdData(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
break;
|
||||
|
||||
case taskType.setArt:
|
||||
/*------------------------------------------------------------------
|
||||
* Articolo è un file nella cartella commessa di info accessorie...
|
||||
* - step 1: check info folder presente in prod data
|
||||
* - step 2: creazione file info con articolo e commessa
|
||||
------------------------------------------------------------------*/
|
||||
#if false
|
||||
// compongo remDir dai 2 parametri...
|
||||
newDir = $"{remDir}/{item.Value}";
|
||||
currParam.Add(actKey, newDir);
|
||||
currAct = new ActionConfig()
|
||||
{
|
||||
Id = "01",
|
||||
Description = "Verifica esistenza directory",
|
||||
Action = ActType.CheckDir,
|
||||
ParamList = currParam
|
||||
};
|
||||
//eseguo step...
|
||||
bool dirOk = doStep(currAct);
|
||||
// se la cartella mancasse
|
||||
if (!dirOk)
|
||||
{
|
||||
// nuovo act x crearla!
|
||||
currAct = new ActionConfig()
|
||||
{
|
||||
Id = "02",
|
||||
Description = "Creazione directory",
|
||||
Action = ActType.CreateDir,
|
||||
ParamList = currParam
|
||||
};
|
||||
//eseguo step...
|
||||
dirOk = doStep(currAct);
|
||||
if (dirOk)
|
||||
{
|
||||
taskVal = $"DIR Created: {item.Key} --> {item.Value}";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"DIR Already Exists: {item.Key} --> {item.Value}";
|
||||
}
|
||||
// salvo in currProd..
|
||||
saveProdData(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
}
|
||||
else
|
||||
// aggiungo task SE svolto!
|
||||
if (!string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
lgError($"Attenzione! memMap è nullo, non posso eseguire task2exe!");
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return writeResult;
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -253,9 +318,15 @@ namespace IOB_WIN_NEXT.IobNet
|
||||
{
|
||||
B_input = 0;
|
||||
}
|
||||
|
||||
// aggiungo NON emergenza...
|
||||
B_input += (1 << 7);
|
||||
|
||||
#if false
|
||||
// annullo lettura bit signal IN pre/post x evitare invio automatico...
|
||||
B_output = B_input;
|
||||
B_previous = B_input;
|
||||
B_previous = B_input;
|
||||
#endif
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
|
||||
// aggiungo comportamento custom: se ho impostato nome ricetta (programma) --> imposto
|
||||
// richiesta caricamento se ho richiesto reset o fine lavoro --> imposto azzeramento
|
||||
// esco restituendo risutlato scrittura iniziali
|
||||
// esco restituendo risultato scrittura iniziali
|
||||
if (task2exe != null)
|
||||
{
|
||||
// controllo se memMap != null...
|
||||
|
||||
Reference in New Issue
Block a user