From fa3e9a8273efc385b70171527f4a2a305212760b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 28 Nov 2024 12:01:19 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Aggiunbti=20nuovi=20metodi=20x=20gestioen?= =?UTF-8?q?=20PODL=20running/Act=20e=20inizio=20deprecate=20curr=20(che=20?= =?UTF-8?q?=C3=A8=20NEXT...)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MP-IO/Controllers/IOBController.cs | 103 +++++++++++++++++++++-------- MapoSDK/Enums.cs | 1 + 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 9259f2cc..5323a602 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -740,33 +740,6 @@ namespace MP_IO.Controllers return answ; } - /// - /// Recupera codice numerico ODL/PODL dato CodXdl, in pratica la parte finale SENZA ODL/PODL - /// Funzione per impianti che accettano solo INT in scrittura: - /// - /// GET: IOB/getXdlNum/SIMUL_03?CodXdl=ODL00000123 - /// - /// IdxMacchina (NON considerato) - /// CodXdl richiesto, se vuoto restituisce TUTTI i valori in tabella di decodifica - /// SINGOLO VALORE calcolato on the fly - public string getXdlNum(string id, string CodXdl = "") - { - // in realtà ID macchina non conta e lo ignoriamo... - string answ = ""; - // scrivo keep alive!!! (se necessario, altrimenti è in cache...) - MapoDb.MapoDb connDb = new MapoDb.MapoDb(); - DataLayer DataLayerObj = new DataLayer(); - connDb.scriviKeepAlive(id, DateTime.Now); - try - { - // sostituisco PODL/ODL con "" e lascio zero iniziali (conversione INT in IOB) - answ = CodXdl.Replace("PODL", "").Replace("ODL", ""); - } - catch - { } - return answ; - } - /// /// Recupera elenco articoli USATI: /// @@ -986,6 +959,19 @@ namespace MP_IO.Controllers /// id macchina, se "" mostra tutto /// Json contenente lista oggetti PODL serializzati public string getCurrPODL(string id) + { + // lasciato x retrocompatibilità, FixMe ToDo ELiminare con udpate IOB.... + return getPOdlNext(id); + } + + /// + /// Recupera DATI PODL NEXT (=NON AVVIATI) x macchina: (copia di getCurrPODL) + /// + /// GET: IOB/getPOdlNext/SIMUL_03 + /// + /// id macchina, se "" mostra tutto + /// Json contenente lista oggetti PODL serializzati + public string getPOdlNext(string id) { // attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il // carattere "|" che poi trasformiamo ora in "#" @@ -1506,6 +1492,40 @@ namespace MP_IO.Controllers return answ; } + /// + /// Recupera DATI PODL Running/Actual (AVVIATO e in corso) x macchina: + /// + /// GET: IOB/getPOdlAct/SIMUL_03 + /// + /// id macchina, se "" mostra tutto + /// Json contenente lista 1 oggetto PODL serializzato, se presente + public string getPOdlAct(string id) + { + // attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il + // carattere "|" che poi trasformiamo ora in "#" + if (!string.IsNullOrEmpty(id)) + { + id = id.Replace("|", "#"); + } + string answ = ""; + + // init obj DataLayer + DataLayer DataLayerObj = new DataLayer(); + try + { + // recupero IdxOdl corrente + string sIdxOdl = DataLayerObj.currODL(id); + int IdxOdl = 0; + int.TryParse(sIdxOdl, out IdxOdl); + // recupero Podl running x macchina ... + DS_ProdTempi.PromesseODLDataTable elencoOdl = DataLayerObj.taPODL.getByIdxOdl(IdxOdl); + answ = JsonConvert.SerializeObject(elencoOdl); + } + catch + { } + return answ; + } + /// /// Recupera TASK richiesto x macchina: /// @@ -1531,6 +1551,35 @@ namespace MP_IO.Controllers return answ; } + /// + /// Recupera codice numerico ODL/PODL dato CodXdl, in pratica la parte finale SENZA ODL/PODL + /// Funzione per impianti che accettano solo INT in scrittura: + /// + /// GET: IOB/getXdlNum/SIMUL_03?CodXdl=ODL00000123 + /// + /// IdxMacchina (NON considerato) + /// + /// CodXdl richiesto, se vuoto restituisce TUTTI i valori in tabella di decodifica + /// + /// SINGOLO VALORE calcolato on the fly + public string getXdlNum(string id, string CodXdl = "") + { + // in realtà ID macchina non conta e lo ignoriamo... + string answ = ""; + // scrivo keep alive!!! (se necessario, altrimenti è in cache...) + MapoDb.MapoDb connDb = new MapoDb.MapoDb(); + DataLayer DataLayerObj = new DataLayer(); + connDb.scriviKeepAlive(id, DateTime.Now); + try + { + // sostituisco PODL/ODL con "" e lascio zero iniziali (conversione INT in IOB) + answ = CodXdl.Replace("PODL", "").Replace("ODL", ""); + } + catch + { } + return answ; + } + // GET: IOB (è un check alive del server) public string Index() { diff --git a/MapoSDK/Enums.cs b/MapoSDK/Enums.cs index 857bd5c8..32f05a29 100644 --- a/MapoSDK/Enums.cs +++ b/MapoSDK/Enums.cs @@ -265,6 +265,7 @@ namespace MapoSDK /// Imposta Articolo su PLC /// setArt, + /// /// Imposta Articolo IN MODALITA' NUMERICA su PLC /// From f4aee79d608ad330572e48825b68e05a093d8fda Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 28 Nov 2024 12:03:40 +0100 Subject: [PATCH 2/3] Typo reordering codice --- MP-IO/Controllers/IOBController.cs | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 5323a602..1feb9f1a 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -964,36 +964,6 @@ namespace MP_IO.Controllers return getPOdlNext(id); } - /// - /// Recupera DATI PODL NEXT (=NON AVVIATI) x macchina: (copia di getCurrPODL) - /// - /// GET: IOB/getPOdlNext/SIMUL_03 - /// - /// id macchina, se "" mostra tutto - /// Json contenente lista oggetti PODL serializzati - public string getPOdlNext(string id) - { - // attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il - // carattere "|" che poi trasformiamo ora in "#" - if (!string.IsNullOrEmpty(id)) - { - id = id.Replace("|", "#"); - } - string answ = ""; - - // init obj DataLayer - DataLayer DataLayerObj = new DataLayer(); - try - { - // recupero dati macchina... - var elencoOdl = DataLayerObj.taPODL.getByMaccArt(id, "", "", true); - answ = JsonConvert.SerializeObject(elencoOdl); - } - catch - { } - return answ; - } - /// /// Restituisce intera riga dello stato di macchina... /// GET: IOB/getCurrStatoRow/SIMUL_01 @@ -1526,6 +1496,36 @@ namespace MP_IO.Controllers return answ; } + /// + /// Recupera DATI PODL NEXT (=NON AVVIATI) x macchina: (copia di getCurrPODL) + /// + /// GET: IOB/getPOdlNext/SIMUL_03 + /// + /// id macchina, se "" mostra tutto + /// Json contenente lista oggetti PODL serializzati + public string getPOdlNext(string id) + { + // attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il + // carattere "|" che poi trasformiamo ora in "#" + if (!string.IsNullOrEmpty(id)) + { + id = id.Replace("|", "#"); + } + string answ = ""; + + // init obj DataLayer + DataLayer DataLayerObj = new DataLayer(); + try + { + // recupero dati macchina... + var elencoOdl = DataLayerObj.taPODL.getByMaccArt(id, "", "", true); + answ = JsonConvert.SerializeObject(elencoOdl); + } + catch + { } + return answ; + } + /// /// Recupera TASK richiesto x macchina: /// From 9c7585b86f9230ce11cb0a57835c18fdc62ceb4b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 28 Nov 2024 12:09:00 +0100 Subject: [PATCH 3/3] Typo --- MP-IO/Controllers/IOBController.cs | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 1feb9f1a..3f8fd9f8 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -111,33 +111,6 @@ namespace MP_IO.Controllers return answ; } -#if false - /// - /// Chiude ODL x macchina: - /// - /// GET: IOB/closeODL/SIMUL_03?idxOdl=123 - /// - /// id macchina - /// idx dell'ODL da chiudere - /// bool esecuzione - public bool closeODL(string id, int idxOdl) - { - bool answ = false; - // init obj DataLayer - DataLayer DataLayerObj = new DataLayer(); - try - { - // chiamata diretta sul DB... - DateTime dtEvento = DateTime.Now; - DataLayerObj.taODL.forceClose(idxOdl, id, dtEvento); - answ = true; - } - catch - { } - return answ; - } -#endif - /// /// Chiude ODL x macchina: /// @@ -2045,6 +2018,7 @@ namespace MP_IO.Controllers } return answ; } + /// /// SALVA in blocco un incremento pezzi x macchina restituendo il valore appena inviato o, /// se mancasse chaive redis, del valore da DB