diff --git a/Jenkinsfile b/Jenkinsfile index de8d814d..b9060397 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,7 +18,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=1186']) { + withEnv(['NEXT_BUILD_NUMBER=1188']) { // env.versionNumber = VersionNumber(versionNumberString : '6.6.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '6.6.${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 70c7cbeb..8e53f866 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -253,7 +253,6 @@ namespace MP_IO.Controllers /// /// /// - /// public string remTask2Exe(string id, string taskName) { string answ = ""; @@ -270,6 +269,77 @@ namespace MP_IO.Controllers return answ; } /// + /// Recupera TASK richiesto x macchina: + /// + /// GET: IOB/getOptPar/SIMUL_03 + /// + /// + /// + /// jSon contenente 1..n task da eseguire + public string getOptPar(string id) + { + string answ = ""; + // scrivo keep alive!!! (se necessario, altrimenti è in cache...) + MapoDb.MapoDb connDb = new MapoDb.MapoDb(); + connDb.scriviKeepAlive(id, DateTime.Now); + try + { + // leggo da REDIS eventuale elenco task x macchina... + Dictionary valori = DataLayer.mOptParMacchina(id); + answ = JsonConvert.SerializeObject(valori); + } + catch + { } + return answ; + } + /// + /// SALVA x macchina KVP parametro/valore: + /// + /// GET: IOB/addOptPar/SIMUL_03?pName=PZREQ&pValue=1000 + /// + /// + /// + /// + /// + public string addOptPar(string id, string pName, string pValue) + { + string answ = ""; + // scrivo keep alive!!! (se necessario, altrimenti è in cache...) + MapoDb.MapoDb connDb = new MapoDb.MapoDb(); + connDb.scriviKeepAlive(id, DateTime.Now); + try + { + DataLayer.addOptPar4Machine(id, pName, pValue); + answ = getOptPar(id); + } + catch + { } + return answ; + } + /// + /// ELIMINA TASK richiesto x macchina: + /// + /// GET: IOB/remOptPar/SIMUL_03?pName=PZREQ + /// + /// + /// + /// + public string remOptPar(string id, string pName) + { + string answ = ""; + // scrivo keep alive!!! (se necessario, altrimenti è in cache...) + MapoDb.MapoDb connDb = new MapoDb.MapoDb(); + connDb.scriviKeepAlive(id, DateTime.Now); + try + { + DataLayer.remOptPar4Machine(id, pName); + answ = getOptPar(id); + } + catch + { } + return answ; + } + /// /// Effettua RESET dell'ODL corrente x macchina: /// /// GET: IOB/resetCurrODL/5 diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index 6425f596..e691a9dd 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -1020,6 +1020,15 @@ namespace MapoDb return mHash(string.Format("ExeTask:{0}", idxMacchina)); } /// + /// Hash dati OPT PARAMETERS x la macchina specificata + /// + /// + /// + public static string optParHash(string idxMacchina) + { + return mHash(string.Format("OptPar:{0}", idxMacchina)); + } + /// /// Hash dati STATUS x la macchina specificata. /// - dati ODL /// - dati articolo @@ -1153,7 +1162,7 @@ namespace MapoDb return answ; } /// - /// Aggiunge un task all'elenco di quelli salvati (in modalità upsert) + /// RIMUOVE un task dall'elenco di quelli salvati /// /// /// @@ -1175,6 +1184,78 @@ namespace MapoDb return answ; } + #endregion + + + #region gestione OPT PARAMETERS macchina + + /// + /// Restitusice elenco KVP dei TASK (da passare a IOB-WIN) per l'impianto indicato + /// + /// + /// + public static Dictionary mOptParMacchina(string idxMacchina) + { + // hard coded dimensione vettore DatiMacchine + Dictionary answ = new Dictionary(); + // ORA recupero da memoria redis... + try + { + string currHash = optParHash(idxMacchina); + answ = memLayer.ML.redGetHashDict(currHash); + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Errore in compilazione dati OPT PARAM x Redis - idxMacchina {2}:{0}{1}", Environment.NewLine, exc, idxMacchina)); + } + return answ; + } + + /// + /// Aggiunge un PARAMETRO OPZIONALE all'elenco di quelli salvati (in modalità upsert) + /// + /// + /// + /// + /// + public static bool addOptPar4Machine(string idxMacchina, string taskKey, string taskVal) + { + bool answ = false; + string currHash = optParHash(idxMacchina); + try + { + // leggo task attuali... + var currVal = mOptParMacchina(idxMacchina); + currVal[taskKey] = taskVal; + answ = memLayer.ML.redSaveHashDict(currHash, currVal); + } + catch + { } + return answ; + } + /// + /// RIMUOVE un PARAMETRO OPZIONALE dall'elenco di quelli salvati + /// + /// + /// + /// + public static bool remOptPar4Machine(string idxMacchina, string taskKey) + { + bool answ = false; + string currHash = optParHash(idxMacchina); + try + { + // leggo task attuali... + var currVal = mOptParMacchina(idxMacchina); + currVal.Remove(taskKey); + memLayer.ML.redDelKey(currHash); + answ = memLayer.ML.redSaveHashDict(currHash, currVal); + } + catch + { } + return answ; + } + #endregion