diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 9259f2cc..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: /// @@ -740,33 +713,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: /// @@ -987,25 +933,8 @@ namespace MP_IO.Controllers /// Json contenente lista oggetti PODL serializzati public string getCurrPODL(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; + // lasciato x retrocompatibilità, FixMe ToDo ELiminare con udpate IOB.... + return getPOdlNext(id); } /// @@ -1506,6 +1435,70 @@ 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 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: /// @@ -1531,6 +1524,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() { @@ -1996,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 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 ///