From c8564b87885e7876b98d322431d19d902e095663 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Wed, 9 Dec 2020 16:28:06 +0100 Subject: [PATCH] aggiunto gest forcePzCOunt x SIM --- IOB-WIN/IobSimula.cs | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/IOB-WIN/IobSimula.cs b/IOB-WIN/IobSimula.cs index 9b7eacdd..59feb936 100644 --- a/IOB-WIN/IobSimula.cs +++ b/IOB-WIN/IobSimula.cs @@ -520,6 +520,65 @@ namespace IOB_WIN #region Public Methods + /// + /// Processo i task richiesti e li elimino dalla coda 1:1 (in realtà SOLO forceSetPzCount x ora) + /// + /// + public override Dictionary executeTasks(Dictionary task2exe) + { + // Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti... + Dictionary taskDone = new Dictionary(); + string taskVal = ""; + // verifico non sia null + if (task2exe != null) + { + // cerco task specifici + foreach (var item in task2exe) + { + taskVal = ""; + // converto richiesta in enum... + taskType tName = taskType.nihil; + Enum.TryParse(item.Key, out tName); + // controllo sulla KEY + switch (tName) + { + case taskType.setArt: + case taskType.nihil: + case taskType.fixStopSetup: + case taskType.forceResetPzCount: + case taskType.sendWatchDogMes2Plc: + case taskType.setComm: + case taskType.setParameter: + case taskType.setProg: + case taskType.setPzComm: + case taskType.startSetup: + case taskType.stopSetup: + taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC"; + break; + + case taskType.forceSetPzCount: + // forzo sul SIM il valore pzCOunt dell'IOB... + int newPzCount = contapezziPLC; + bool fatto = int.TryParse(item.Value, out newPzCount); + if (fatto) + { + contapezziPLC = newPzCount; + taskVal = $"Set new contapezziPLC: {contapezziPLC}"; + } + break; + + default: + taskVal = "SKIPPED | NO EXEC"; + break; + } + // aggiungo task! + taskDone.Add(item.Key, taskVal); + } + } + + return taskDone; + } + /// /// Recupera e processa allarmi CNC... ///