Aggiunta metodo getCurrODL

This commit is contained in:
Samuele Locatelli
2026-04-11 10:43:02 +02:00
parent 3c36c24ddb
commit 76d3d6f9e6
2 changed files with 89 additions and 56 deletions
+15 -54
View File
@@ -69,21 +69,6 @@ namespace MP.IOC.Controllers
//return StatusCode(503, "NO");
return UnprocessableEntity("NO");
}
#if false
if (string.IsNullOrEmpty(id)) return Ok("KO");
try
{
var result = DService.IobInsEnab(id) ? "OK" : "NO";
// Logga solo l'esito se necessario
return Ok(result);
}
catch (Exception exc)
{
Log.Error($"Errore in enabled {id}: {exc.Message}");
return Ok("NO");
}
#endif
}
/// <summary>
@@ -127,8 +112,7 @@ namespace MP.IOC.Controllers
{
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
// carattere "|" che poi trasformiamo ora in "#"
// Multi: gestione carattere "|" trasformato in "#"
id = id.Replace("|", "#");
try
{
@@ -138,61 +122,38 @@ namespace MP.IOC.Controllers
catch (Exception exc)
{
Log.Error(exc, "Errore durante il recupero del counter TC per la macchina {MachineId}", id);
//return StatusCode(StatusCodes.Status500InternalServerError, "NO");
return StatusCode(StatusCodes.Status500InternalServerError, "Errore interno | GetCounterTCRec");
}
}
#if false
/// <summary>
/// Recupera COUNTER x macchina:
///
/// GET: IOB/getCounter/5
/// Recupera ODL corrente x macchina:
/// GET: IOB/getCurrODL/SIMUL_03
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("getCounter/{id}")]
public async Task<string> getCounter(string id)
[HttpGet("getCurrODL/{id}")]
public async Task<IActionResult> GetCurrODL(string id)
{
string answ = "";
try
{
var pzCount = await _tabDService.pzCounter(id);
answ = $"{pzCount}";
}
catch (Exception exc)
{
Log.Error($"Errore in counter TC (get){Environment.NewLine}{exc}");
answ = "NO";
}
return answ;
}
/// <summary>
/// Recupera COUNTER x macchina dal CONTEGGIO dei TCRecorded:
///
/// GET: IOB/getCounterTCRec/5
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("getCounterTCRec/{id}")]
public async Task<string> getCounterTCRec(string id)
{
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
// carattere "|" che poi trasformiamo ora in "#"
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
// Multi: gestione carattere "|" trasformato in "#"
id = id.Replace("|", "#");
string answ = "";
try
{
var pzCountTC = await _tabDService.pzCounterTC(id);
answ = $"{pzCountTC}";
var odl = await DService.GetCurrOdlAsync(id);
answ = $"{odl}";
return Ok(answ);
}
catch (Exception exc)
{
Log.Error($"Errore in counter TC (get){Environment.NewLine}{exc}");
answ = "NO";
Log.Error(exc, "Errore GetCurrODL | macchina {MachineId}", id);
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
//return StatusCode(StatusCodes.Status500InternalServerError, "Errore interno | GetCurrODL");
}
return answ;
}
#endif
/// <summary>
/// Recupera TASK richiesto x macchina: