From 72168fe1de2232b4cf82d63034ff2ed20ddaf7e9 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli (W11-AI)" Date: Sat, 18 Apr 2026 07:12:43 +0200 Subject: [PATCH] minor typo su controller IOB --- MP.IOC/Controllers/IOBController.cs | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs index e43f2633..ba186bd0 100644 --- a/MP.IOC/Controllers/IOBController.cs +++ b/MP.IOC/Controllers/IOBController.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using MP.Core.DTO; using MP.Core.Objects; using MP.Data.DbModels; @@ -798,31 +798,33 @@ namespace MP.IOC.Controllers } /// - /// Recupera TASK richiesto x macchina: + /// Recupera i task richiesti per la macchina indicata: /// GET: IOB/getTask2Exe/SIMUL_03 /// - /// - /// Json contenente 1..n task da eseguire + /// ID della macchina + /// Dictionary contenente i task da eseguire [HttpGet("getTask2Exe/{id}")] public async Task GetTask2Exe(string id) { if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID"); - // Multi: gestione carattere "|" trasformato in "#" - id = id.Replace("|", "#"); - Dictionary valori = new(); + id = id.Replace('|', '#'); + try { - await DService.ScriviKeepAliveAsync(id, DateTime.Now); - // leggo da REDIS eventuale elenco task x macchina... - valori = await DService.GetTask2ExeMacchinaAsync(id); + await DService.ScriviKeepAliveAsync(id, DateTime.UtcNow); + var valori = await DService.GetTask2ExeMacchinaAsync(id); + + if (valori == null || valori.Count == 0) + return Ok(new Dictionary()); + + return Ok(valori); } catch (Exception exc) { - Log.Error($"Errore in GetTask2Exe{Environment.NewLine}{exc}"); - return StatusCode(StatusCodes.Status500InternalServerError, "NO"); + Log.Error(exc, "Errore nel recupero dei task per la macchina {MachineId}", id); + return StatusCode(StatusCodes.Status500InternalServerError, "Errore interno | GetTask2Exe"); } - return Ok(valori); } ///