Rimesso da minimal api a controller metodi

This commit is contained in:
Samuele Locatelli
2026-06-13 12:22:47 +02:00
parent a16282ff78
commit f9a20b2ee9
26 changed files with 45 additions and 46 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>8.16.2606.1117</Version>
<Version>8.16.2606.1312</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 8.16.2606.1117</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1117
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1117</version>
<version>8.16.2606.1312</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+4 -7
View File
@@ -127,7 +127,7 @@ namespace MP.IOC.Controllers
//{
// Log.Error(ex, "Errore durante la verifica abilitazione per {Id}", id);
// return StatusCode(500, "Errore interno del server");
//}
//}
}
#endif
@@ -483,7 +483,6 @@ namespace MP.IOC.Controllers
return Ok(actValues);
}
#if false
/// <summary>
/// Recupera ODL corrente x macchina:
/// GET: IOB/getCurrODL/SIMUL_03
@@ -507,8 +506,7 @@ namespace MP.IOC.Controllers
Log.Error(exc, "Errore GetCurrODL | macchina {MachineId}", id);
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
}
}
#endif
}
/// <summary>
/// Restituisce la quantità pezzi dell'odl correntemente in lavorazione sulla macchina...
@@ -1227,7 +1225,6 @@ namespace MP.IOC.Controllers
return Ok(answ);
}
#if false
/// <summary>
/// SALVA Counter x macchina restituendo il valore appena inviato o, se mancasse chiave
/// redis, valore da DB ///
@@ -1258,8 +1255,7 @@ namespace MP.IOC.Controllers
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
}
return Ok(answ);
}
#endif
}
/// <summary>
/// Salva associazione tra macchina, device IOB chiamante e sue info
@@ -1473,6 +1469,7 @@ namespace MP.IOC.Controllers
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private IIocService IOCService;
+17 -15
View File
@@ -5,6 +5,8 @@ namespace MP.IOC.Endpoints
{
public static class IobEndpoints
{
#region Public Methods
public static void MapIobHighPerformanceEndpoints(this IEndpointRouteBuilder app)
{
// 1. Root di test base: api/IOB e api/IOB/alive
@@ -15,31 +17,24 @@ namespace MP.IOC.Endpoints
app.MapGet("api/IOB/enabled/{id}", async (string id, IIocService iocService, HttpContext context) =>
{
if (string.IsNullOrEmpty(id))
{
context.Response.StatusCode = StatusCodes.Status400BadRequest;
return "Missing ID";
}
return Results.BadRequest("Missing ID");
try
{
bool isEnabled = await iocService.IobInsEnabAsync(id);
if (!isEnabled)
{
context.Response.StatusCode = StatusCodes.Status422UnprocessableEntity;
return "NO";
}
return "OK";
return isEnabled
? Results.Ok("OK")
: Results.UnprocessableEntity("NO");
}
catch (Exception ex)
{
Log.Error(ex, "Errore durante la verifica abilitazione per {Id}", id);
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
return "Errore interno del server";
return Results.StatusCode(500);
}
});
#if false
// 3. 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) =>
@@ -94,7 +89,7 @@ namespace MP.IOC.Endpoints
{
var odl = await iocService.GetCurrOdlAsync(id);
// Ottimizzazione: Se 'odl' è già una stringa, ritornala direttamente.
// 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;
}
@@ -105,8 +100,15 @@ namespace MP.IOC.Endpoints
return "NO";
}
});
#endif
}
#endregion Public Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>8.16.2606.1311</Version>
<Version>8.16.2606.1312</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-IOC </i>
<h4>Versione: 8.16.2606.1311</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1311
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1311</version>
<version>8.16.2606.1312</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>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Land</RootNamespace>
<Version>8.16.2606.1117</Version>
<Version>8.16.2606.1312</Version>
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo Tablet MAPO - DotNet6</i>
<h4>Versione: 8.16.2606.1117</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1117
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1117</version>
<version>8.16.2606.1312</version>
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.MON</RootNamespace>
<AssemblyName>$(AssemblyName.Replace(' ', '_'))</AssemblyName>
<Version>8.16.2606.1117</Version>
<Version>8.16.2606.1312</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 8.16.2606.1117</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1117
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1117</version>
<version>8.16.2606.1312</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>MP.Prog</RootNamespace>
<Version>8.16.2606.1117</Version>
<Version>8.16.2606.1312</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo gestione Programmi MAPO</i>
<h4>Versione: 8.16.2606.1117</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1117
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1117</version>
<version>8.16.2606.1312</version>
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.RIOC</RootNamespace>
<Version>8.16.2606.1218</Version>
<Version>8.16.2606.1312</Version>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MP-RIOC </i>
<h4>Versione: 8.16.2606.1218</h4>
<h4>Versione: 8.16.2606.1312</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
8.16.2606.1218
8.16.2606.1312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>8.16.2606.1218</version>
<version>8.16.2606.1312</version>
<url>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>