Aggiunta metodo getTask2Exe con gestione async estesa

This commit is contained in:
Samuele Locatelli
2026-04-11 12:21:28 +02:00
parent 76d3d6f9e6
commit ac48bc5a21
8 changed files with 107 additions and 21 deletions
+25 -4
View File
@@ -140,12 +140,10 @@ namespace MP.IOC.Controllers
// Multi: gestione carattere "|" trasformato in "#"
id = id.Replace("|", "#");
string answ = "";
try
{
var odl = await DService.GetCurrOdlAsync(id);
answ = $"{odl}";
return Ok(answ);
return Ok($"{odl}");
}
catch (Exception exc)
{
@@ -157,7 +155,6 @@ namespace MP.IOC.Controllers
/// <summary>
/// Recupera TASK richiesto x macchina:
///
/// GET: IOB/getOptPar/SIMUL_03
/// </summary>
/// <param name="id"></param>
@@ -179,6 +176,30 @@ namespace MP.IOC.Controllers
return answ;
}
/// <summary>
/// Recupera TASK richiesto x macchina: ///
/// GET: IOB/getTask2Exe/SIMUL_03
/// </summary>
/// <param name="id"></param>
/// <returns>Json contenente 1..n task da eseguire</returns>
[HttpGet("getTask2Exe/{id}")]
public async Task<IActionResult> GetTask2Exe(string id)
{
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
// Multi: gestione carattere "|" trasformato in "#"
if (!string.IsNullOrEmpty(id))
{
id = id.Replace("|", "#");
}
string answ = "";
DService.ScriviKeepAlive(id, DateTime.Now);
// leggo da REDIS eventuale elenco task x macchina...
Dictionary<string, string> valori = await DService.GetTask2ExeMacchinaAsync(id);
answ = JsonConvert.SerializeObject(valori);
return Ok(answ);
}
[HttpGet("version")]
public IActionResult Version()
{