From f74ae7a72c47f87ef4e54eb99cd6b8a6ab18bf4e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 27 Apr 2026 18:48:51 +0200 Subject: [PATCH] Minor update x tentativo ottimizzazione input (da rivedere) --- MP.IOC/Data/MpDataService.cs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/MP.IOC/Data/MpDataService.cs b/MP.IOC/Data/MpDataService.cs index 11f047f2..e425fbf9 100644 --- a/MP.IOC/Data/MpDataService.cs +++ b/MP.IOC/Data/MpDataService.cs @@ -1043,9 +1043,6 @@ namespace MP.IOC.Data }; // salva e processa answ = await scriviRigaEventoAsync(newRecEv); - //currTask = scriviRigaEvento(idxMacchina, idxTipoEv, codArticolo, valEsteso, 0, "-", dtEve, DateTime.Now); - // forzo RESET dati macchina... - await ResetDatiMacchinaAsync(idxMacchina); } catch (Exception exc) { @@ -3036,12 +3033,24 @@ namespace MP.IOC.Data } } // inizio processing vero e proprio INPUT... - if (idxMacchina != null && valore != null) + if (string.IsNullOrEmpty(idxMacchina)) { - if (idxMacchina != "" && valore != "") + string errore = "Errore: missing IdxMacchina"; + Log.Warn(errore); + answ = errore; + } + else + { + if (string.IsNullOrEmpty(valore)) + { + string errore = "Errore: missing valore"; + Log.Warn(errore); + answ = errore; + } + else { // se abilitato registro evento sul DB - if (!string.IsNullOrEmpty(idxMacchina) && await IobSLogEnabAsync(idxMacchina)) + if (await IobSLogEnabAsync(idxMacchina)) { int cntVal = 0; int.TryParse(contatore, out cntVal); @@ -3075,6 +3084,8 @@ namespace MP.IOC.Data // gestisce i casi DB/REDIS secondo necessità await CheckMicroStatoAsync(idxMacchina, valore, dataOraEvento, contatore, datiMacc); } + // forzo RESET dati macchina... + await ResetDatiMacchinaAsync(idxMacchina); // registro in risposta che è andato tutto bene... answ = "OK"; } @@ -3085,18 +3096,6 @@ namespace MP.IOC.Data answ = errore; } } - else - { - string errore = "Errore: parametri macchina/valore vuoti"; - Log.Warn(errore); - answ = errore; - } - } - else - { - string errore = "Errore: mancano parametri macchina/valore"; - Log.Warn(errore); - answ = errore; } } return answ;