From 5941fec23cda2ac3c09e6334a78a625caebe7a67 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 14 Sep 2017 10:44:03 +0200 Subject: [PATCH] Fix verifica lunghezza carattere dtEvent + aggiunto log al nCall2Log x chiamate IOB --- Jenkinsfile | 2 +- MP-IO/Controllers/IOBController.cs | 14 ++++++++++ MapoDb/DataLayer.cs | 43 ++++++++++++++++++++++++++++-- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f60dca00..845bf8e6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=601']) { + withEnv(['NEXT_BUILD_NUMBER=602']) { // env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO' diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 8d741a40..b52b29f7 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -10,6 +10,20 @@ namespace MP_IO.Controllers // GET: IOB (รจ un check alive) public string Index() { + if (memLayer.ML.CRB("IOB_RedEnab")) + { + // conto la richiesta nel contatore REDIS + long nCall = memLayer.ML.setRCntI("IOB_INDEX"); + //... se == nCall2Log scrivo su log e resetto + long nCall2Log = memLayer.ML.cdvi("nCall2Log"); + if (nCall >= nCall2Log) + { + // loggo + logger.lg.scriviLog(string.Format("IOB_INDEX: effettuate {0} call", nCall), tipoLog.INFO); + // resetto! + memLayer.ML.resetRCnt("IOB_INDEX"); + } + } return "OK"; } diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index 34c02c89..96c6c9f3 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -399,7 +399,23 @@ namespace MapoDb /// public static string processInput(string idxMacchina, string valore, string dtEve, string dtCurr, string contatore) { - + // 2017.09.14 trimmo eventualmente lo zero finale dalle date SE supera i millisecondi... + dtEve = dtEve.Length > 17 ? dtEve.Substring(0, 17) : dtEve; + dtCurr = dtCurr.Length > 17 ? dtCurr.Substring(0, 17) : dtCurr; + if (memLayer.ML.CRB("IOB_RedEnab")) + { + // conto la richiesta nel contatore REDIS + long nCall = memLayer.ML.setRCntI("processInput"); + //... se == nCall2Log scrivo su log e resetto + long nCall2Log = memLayer.ML.cdvi("nCall2Log"); + if (nCall >= nCall2Log) + { + // loggo + logger.lg.scriviLog(string.Format("processInput: effettuate {0} call", nCall), tipoLog.INFO); + // resetto! + memLayer.ML.resetRCnt("processInput"); + } + } string answ = ""; DateTime dataOraEvento = DateTime.Now; DateTime dtEvento, dtCorrente; @@ -433,7 +449,7 @@ namespace MapoDb } catch (Exception exc) { - logger.lg.scriviLog(string.Format("Errore calcolo ms evento/ora corrente da device remoto:{0}dtEve: {1}{0}dtCurr: {2}{0}{3}", Environment.NewLine, dtEve, dtCurr, exc), tipoLog.EXCEPTION); + logger.lg.scriviLog(string.Format("Errore calcolo ms evento/ora corrente da device remoto:{0}dtEve : {1}{0}dtCurr: {2}{0}{3}", Environment.NewLine, dtEve, dtCurr, exc), tipoLog.EXCEPTION); } } // @@ -650,6 +666,17 @@ namespace MapoDb bool answ = false; if (memLayer.ML.CRB("IOB_RedEnab")) { + // conto la richiesta nel contatore REDIS + long nCall = memLayer.ML.setRCntI("insEnabled"); + //... se == nCall2Log scrivo su log e resetto + long nCall2Log = memLayer.ML.cdvi("nCall2Log"); + if (nCall >= nCall2Log) + { + // loggo + logger.lg.scriviLog(string.Format("insEnabled: effettuate {0} call", nCall), tipoLog.INFO); + // resetto! + memLayer.ML.resetRCnt("insEnabled"); + } try { answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "insEnabled")); @@ -684,6 +711,18 @@ namespace MapoDb bool answ = false; if (memLayer.ML.CRB("IOB_RedEnab")) { + + // conto la richiesta nel contatore REDIS + long nCall = memLayer.ML.setRCntI("sLogEnabled"); + //... se == nCall2Log scrivo su log e resetto + long nCall2Log = memLayer.ML.cdvi("nCall2Log"); + if (nCall >= nCall2Log) + { + // loggo + logger.lg.scriviLog(string.Format("sLogEnabled: effettuate {0} call", nCall), tipoLog.INFO); + // resetto! + memLayer.ML.resetRCnt("sLogEnabled"); + } try { answ = Convert.ToBoolean(mDatiMacchinaVal(idxMacchina, "sLogEnabled"));