Aggiunta metodo GetCurrOdlStart x IOC

This commit is contained in:
Samuele Locatelli
2026-04-13 16:26:39 +02:00
parent 66cbbc4ee9
commit dc07d77e20
9 changed files with 427 additions and 312 deletions
+32
View File
@@ -147,6 +147,38 @@ namespace MP.IOC.Controllers
}
}
/// <summary>
/// Restituisce data-ora inizio dell'odl correntemente in lavorazione sulla macchina...
/// es: http://url_site/MP/IO/IOB/getCurrOdlStart/SIMUL_03
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("getCurrOdlStart/{id}")]
public async Task<IActionResult> GetCurrOdlStart(string id)
{
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
// Multi: gestione carattere "|" trasformato in "#"
id = id.Replace("|", "#");
DateTime answ = new DateTime(DateTime.Now.Year - 1, 12, 31);
// chiamo metodo redis/db...
try
{
var odlData = await DService.OdlCurrByMaccAsync(id);
if (odlData != null && odlData.DataInizio.HasValue)
{
answ = odlData.DataInizio.Value;
}
}
catch (Exception exc)
{
Log.Error($"Eccezione in recupero getCurrOdlStart{Environment.NewLine}{exc}");
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
}
return Ok(answ.ToString("yyyy-MM-dd HH:mm:ss"));
}
/// <summary>
/// Recupera TASK richiesto x macchina:
/// GET: IOB/getOptPar/SIMUL_03