diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs index 350b031e..ea56e9c2 100644 --- a/MP.IOC/Controllers/IOBController.cs +++ b/MP.IOC/Controllers/IOBController.cs @@ -622,43 +622,43 @@ namespace MP.IOC.Controllers return Ok(answ); } - ///// - ///// restituisce elenco parametri correnti come una List Json di oggetti objItem - ///// GET: IOB/getObjItems/SIMUL_03 - ///// - ///// ID dell'IOB - ///// - //[HttpGet("getObjItems/{id}")] - //public async Task GetObjItems(string id) - //{ + /// + /// restituisce elenco parametri correnti come una List Json di oggetti objItem + /// GET: IOB/getObjItems/SIMUL_03 + /// + /// ID dell'IOB + /// + [HttpGet("getObjItems/{id}")] + public async Task GetObjItems(string id) + { + if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID"); + // Multi: gestione carattere "|" trasformato in "#" + id = id.Replace("|", "#"); - // if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID"); - // // Multi: gestione carattere "|" trasformato in "#" - // id = id.Replace("|", "#"); + string answ = ""; - // string answ = ""; - - // // procedo a recuperare l'oggetto... - // List currParams = new List(); - // try - // { - // DataLayer DataLayerObj = new DataLayer(); - // // deserializzo - // currParams = DataLayerObj.getCurrObjItems(id); - // // se != null --> salvo! - // if (currParams != null) - // { - // answ = JsonConvert.SerializeObject(currParams); - // } - // } - // catch (Exception exc) - // { - // Log.Error($"Errore in GetObjItems{Environment.NewLine}{exc}"); - // return StatusCode(StatusCodes.Status500InternalServerError, "NO"); - // } - // return Ok(answ); - - //} + // procedo a recuperare l'oggetto... + List currParams = new List(); + try + { + // deserializzo + var rawData = await DService.MachineParamListAsync(id); + currParams = rawData.OrderBy(x => x.displOrdinal) + .ThenBy(x => x.description) + .ToList(); + // se != null --> salvo! + if (currParams != null) + { + answ = JsonConvert.SerializeObject(currParams); + } + } + catch (Exception exc) + { + Log.Error($"Errore in GetObjItems{Environment.NewLine}{exc}"); + return StatusCode(StatusCodes.Status500InternalServerError, "NO"); + } + return Ok(answ); + } /// /// restituisce elenco parametri CHE RICHIEDONO scrittura su PLC come una List Json di @@ -671,7 +671,6 @@ namespace MP.IOC.Controllers [HttpGet("getObjItems2Write/{id}")] public async Task GetObjItems2Write(string id) { - if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID"); // Multi: gestione carattere "|" trasformato in "#" id = id.Replace("|", "#");