OK metodo PODLNext
This commit is contained in:
@@ -622,6 +622,182 @@ namespace MP.IOC.Controllers
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// restituisce elenco parametri correnti come una List Json di oggetti objItem
|
||||
///// GET: IOB/getObjItems/SIMUL_03
|
||||
///// </summary>
|
||||
///// <param name="id">ID dell'IOB</param>
|
||||
///// <returns></returns>
|
||||
//[HttpGet("getObjItems/{id}")]
|
||||
//public async Task<IActionResult> GetObjItems(string id)
|
||||
//{
|
||||
|
||||
// if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// // Multi: gestione carattere "|" trasformato in "#"
|
||||
// id = id.Replace("|", "#");
|
||||
|
||||
// string answ = "";
|
||||
|
||||
// // procedo a recuperare l'oggetto...
|
||||
// List<objItem> currParams = new List<objItem>();
|
||||
// try
|
||||
// {
|
||||
// DataLayer DataLayerObj = new DataLayer();
|
||||
// // deserializzo
|
||||
// currParams = DataLayerObj.getCurrObjItems(id);
|
||||
// // se != null --> salvo!
|
||||
// if (currParams != null)
|
||||
// {
|
||||
// answ = JsonConvert.SerializeObject(currParams);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception exc)
|
||||
// {
|
||||
// Log.Error($"Errore in GetObjItems{Environment.NewLine}{exc}");
|
||||
// return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
// }
|
||||
// return Ok(answ);
|
||||
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// restituisce elenco parametri CHE RICHIEDONO scrittura su PLC come una List Json di
|
||||
///// oggetti objItem
|
||||
///// GET: IOB/getObjItems2Write/SIMUL_03
|
||||
///// </summary>
|
||||
///// <param name="id">ID dell'IOB</param>
|
||||
///// <returns></returns>
|
||||
|
||||
//[HttpGet("getObjItems2Write/{id}")]
|
||||
//public async Task<IActionResult> GetObjItems2Write(string id)
|
||||
//{
|
||||
|
||||
// if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// // Multi: gestione carattere "|" trasformato in "#"
|
||||
// id = id.Replace("|", "#");
|
||||
|
||||
// string answ = "";
|
||||
|
||||
// // procedo a recuperare l'oggetto...
|
||||
// List<objItem> currParams = new List<objItem>();
|
||||
// try
|
||||
// {
|
||||
// DataLayer DataLayerObj = new DataLayer();
|
||||
// // deserializzo
|
||||
// currParams = DataLayerObj.getCurrObjItemsPendigWrite(id);
|
||||
// // se != null --> salvo!
|
||||
// if (currParams != null)
|
||||
// {
|
||||
// answ = JsonConvert.SerializeObject(currParams);
|
||||
// }
|
||||
// }
|
||||
// catch (Exception exc)
|
||||
// {
|
||||
// Log.Error($"Errore in GetObjItems2Write{Environment.NewLine}{exc}");
|
||||
// return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
// }
|
||||
// return Ok(answ);
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL NEXT (=NON AVVIATI) x macchina: (copia di getCurrPODL)
|
||||
///
|
||||
/// GET: IOB/getPOdlNext/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">id macchina, se "" mostra tutto</param>
|
||||
/// <returns>Json contenente lista oggetti PODL serializzati</returns>
|
||||
|
||||
[HttpGet("getPOdlNext/{id}")]
|
||||
public async Task<IActionResult> GetPOdlNext(string id)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
|
||||
// Multi: gestione carattere "|" trasformato in "#"
|
||||
id = id.Replace("|", "#");
|
||||
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
// recupero dati macchina...
|
||||
var elencoOdl = await DService.POdlGetByMaccArtAsync(id, "", "", true);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in GetPOdlNext{Environment.NewLine}{exc}");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, "NO");
|
||||
}
|
||||
return Ok(answ);
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL x macchina e codice PODL:
|
||||
///
|
||||
/// GET: IOB/getPODL/SIMUL_03?idxPODL=123
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="idxPODL">idx del PDL da avviare</param>
|
||||
/// <returns>Json contenente lista oggetti PODL serializzati</returns>
|
||||
public string getPODL(string id, int idxPODL)
|
||||
{
|
||||
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
|
||||
// carattere "|" che poi trasformiamo ora in "#"
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
id = id.Replace("|", "#");
|
||||
}
|
||||
string answ = "";
|
||||
|
||||
// init obj DataLayer
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
try
|
||||
{
|
||||
// recupero dati da chaive, ignorando info macchina...
|
||||
var elencoOdl = DataLayerObj.taPODL.getByKey(idxPODL);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera DATI PODL Running/Actual (AVVIATO e in corso) x macchina:
|
||||
///
|
||||
/// GET: IOB/getPOdlAct/SIMUL_03
|
||||
/// </summary>
|
||||
/// <param name="id">id macchina, se "" mostra tutto</param>
|
||||
/// <returns>Json contenente lista 1 oggetto PODL serializzato, se presente</returns>
|
||||
public string getPOdlAct(string id)
|
||||
{
|
||||
// attenzione! poiché nell'URL il carattere "#" viene filtrato ci aspettiamo il
|
||||
// carattere "|" che poi trasformiamo ora in "#"
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
id = id.Replace("|", "#");
|
||||
}
|
||||
string answ = "";
|
||||
|
||||
// init obj DataLayer
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
try
|
||||
{
|
||||
// recupero IdxOdl corrente
|
||||
string sIdxOdl = DataLayerObj.currODL(id);
|
||||
int IdxOdl = 0;
|
||||
int.TryParse(sIdxOdl, out IdxOdl);
|
||||
// recupero Podl running x macchina ...
|
||||
DS_ProdTempi.PromesseODLDataTable elencoOdl = DataLayerObj.taPODL.getByIdxOdl(IdxOdl);
|
||||
answ = JsonConvert.SerializeObject(elencoOdl);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
/// GET: IOB/getOptPar/SIMUL_03
|
||||
|
||||
@@ -811,6 +811,39 @@ namespace MP.IOC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<PODLExpModel>> POdlGetByMaccArtAsync(string idxMacchina, string codArticolo, string codGruppo, bool onlyFree)
|
||||
{
|
||||
List<PODLExpModel> result = new List<PODLExpModel>();
|
||||
|
||||
var currKey = $"{Utils.redisPOdlByMaccArt}:{idxMacchina}";
|
||||
if (!string.IsNullOrEmpty(codArticolo))
|
||||
{
|
||||
currKey += $":A{codArticolo}";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(codGruppo))
|
||||
{
|
||||
currKey += $":G{codGruppo}";
|
||||
}
|
||||
currKey += onlyFree ? $":FREE" : ":ALL";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{rawData}") ?? new();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await IocDbController.POdlGetByMaccArtAsync(idxMacchina, codArticolo, codGruppo, onlyFree);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<PODLExpModel>();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione di un dossier
|
||||
/// </summary>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>6.16.2604.1610</Version>
|
||||
<Version>6.16.2604.1611</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 6.16.2604.1610</h4>
|
||||
<h4>Versione: 6.16.2604.1611</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2604.1610
|
||||
6.16.2604.1611
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2604.1610</version>
|
||||
<version>6.16.2604.1611</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