Spostata ricerca ODL in minimal API
This commit is contained in:
@@ -483,6 +483,7 @@ namespace MP.IOC.Controllers
|
||||
return Ok(actValues);
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Recupera ODL corrente x macchina:
|
||||
/// GET: IOB/getCurrODL/SIMUL_03
|
||||
@@ -507,6 +508,7 @@ namespace MP.IOC.Controllers
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce la quantità pezzi dell'odl correntemente in lavorazione sulla macchina...
|
||||
@@ -901,7 +903,6 @@ namespace MP.IOC.Controllers
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
answ = await IOCService.ProcessInputAsync(id, valore, dtEve, dtCurr, cnt);
|
||||
//answ = await DService.ProcessInputAsync(id, valore, dtEve, dtCurr, cnt);
|
||||
sw.Stop();
|
||||
Log.Debug($"Input | elapsed: {sw.Elapsed.TotalMilliseconds:N1} | id: {id} | val: {valore} | cnt: {cnt}");
|
||||
return Ok(answ);
|
||||
|
||||
@@ -34,8 +34,38 @@ namespace MP.IOC.Endpoints
|
||||
}
|
||||
});
|
||||
|
||||
// 3. Metodo: GetCurrODL (api/IOB/getCurrODL/{id})
|
||||
app.MapGet("api/IOB/getCurrODL/{id}", async (string id, IIocService iocService, HttpContext context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
context.Response.StatusCode = StatusCodes.Status400BadRequest;
|
||||
return "Missing ID";
|
||||
}
|
||||
|
||||
if (id.Contains('|'))
|
||||
{
|
||||
id = id.Replace('|', '#');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var odl = await iocService.GetCurrOdlAsync(id);
|
||||
|
||||
// Ottimizzazione: Se 'odl' è già una stringa, ritornala direttamente.
|
||||
// Se è un oggetto o un numero, il C# gestirà l'estrazione. Evitiamo $"{odl}" che alloca memoria inutilmente.
|
||||
return odl?.ToString() ?? string.Empty;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Errore GetCurrODL | macchina {MachineId}", id);
|
||||
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
|
||||
return "NO";
|
||||
}
|
||||
});
|
||||
|
||||
#if false
|
||||
// 3. Metodo: SetCounter (api/IOB/setCounter/{id}?counter=10)
|
||||
// 4. Metodo: SetCounter (api/IOB/setCounter/{id}?counter=10)
|
||||
// Nota: 'counter' viene letto automaticamente dalla Query String grazie al Model Binding automatico
|
||||
app.MapGet("api/IOB/setCounter/{id}", async (string id, string counter, IIocService iocService, HttpContext context) =>
|
||||
{
|
||||
@@ -71,35 +101,6 @@ namespace MP.IOC.Endpoints
|
||||
}
|
||||
});
|
||||
|
||||
// 4. Metodo: GetCurrODL (api/IOB/getCurrODL/{id})
|
||||
app.MapGet("api/IOB/getCurrODL/{id}", async (string id, IIocService iocService, HttpContext context) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
context.Response.StatusCode = StatusCodes.Status400BadRequest;
|
||||
return "Missing ID";
|
||||
}
|
||||
|
||||
if (id.Contains('|'))
|
||||
{
|
||||
id = id.Replace('|', '#');
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var odl = await iocService.GetCurrOdlAsync(id);
|
||||
|
||||
// Ottimizzazione: Se 'odl' è già una stringa, ritornala direttamente.
|
||||
// Se è un oggetto o un numero, il C# gestirà l'estrazione. Evitiamo $"{odl}" che alloca memoria inutilmente.
|
||||
return odl?.ToString() ?? string.Empty;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Errore GetCurrODL | macchina {MachineId}", id);
|
||||
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
|
||||
return "NO";
|
||||
}
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>8.16.2606.1511</Version>
|
||||
<Version>8.16.2606.2010</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 8.16.2606.1511</h4>
|
||||
<h4>Versione: 8.16.2606.2010</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
8.16.2606.1511
|
||||
8.16.2606.2010
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>8.16.2606.1511</version>
|
||||
<version>8.16.2606.2010</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user