Aggiunto display idx di ODL/PODL

This commit is contained in:
Samuele Locatelli
2022-11-09 15:00:25 +01:00
parent 9908327a12
commit 7c8ee74ec7
9 changed files with 130 additions and 6 deletions
+25
View File
@@ -859,6 +859,31 @@ namespace MP.Data.Controllers
await Task.Delay(1);
return dbResult;
}
/// <summary>
/// Recupero PODL da IdxOdl
/// </summary>
/// <param name="idxPODL"></param>
/// <returns></returns>
public PODLModel PODL_getByOdl(int idxODL)
{
PODLModel dbResult = new PODLModel();
using (var dbCtx = new MoonProContext(_configuration))
{
try
{
dbResult = dbCtx
.DbSetPODL
.AsNoTracking()
.Where(x => x.IdxOdl == idxODL)
.FirstOrDefault();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante PODL_getByOdl{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Avvio setup ODL da PODL
+5 -1
View File
@@ -36,6 +36,7 @@ else
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}
</th>
<th>Cod</th>
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
@@ -48,7 +49,6 @@ else
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.IdxOdl)">
<td>
@if (isCurrOdl)
{
@@ -59,6 +59,10 @@ else
<button class="btn btn-secondary btn-sm disabled"><i class="fa-solid fa-magnifying-glass"></i></button>
}
</td>
<td>
<div class="small"><b>ODL</b> @($"{record.IdxOdl:000000}")</div>
<div class="small"><b>PODL</b> @($"{getPodl(record.IdxOdl):000000}")</div>
</td>
<td>
@record.CodArticolo
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
+11
View File
@@ -253,6 +253,17 @@ namespace MP.SPEC.Components
}
}
protected int getPodl(int idxOdl)
{
int answ = 0;
var pOdlData = MDService.PODL_getByOdl(idxOdl);
if (pOdlData != null)
{
answ = pOdlData.IdxPromessa;
}
return answ;
}
private bool hideSpenta { get; set; } = false;
/// <summary>
+4
View File
@@ -22,6 +22,7 @@ else
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}
</th>
<th>Cod</th>
<th><i class="fa-solid fa-file"></i> Articolo</th>
<th><i class="fa-solid fa-screwdriver-wrench"></i> Fase</th>
<th><i class="fa-solid fa-hard-drive"></i> Macchina</th>
@@ -51,6 +52,9 @@ else
</button>
}
</td>
<td>
<div class="small"><b>PODL</b> @($"{record.IdxPromessa:000000}")</div>
</td>
<td>
@record.CodArticolo
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
+81 -1
View File
@@ -845,7 +845,83 @@ namespace MP.SPEC.Data
/// <returns></returns>
public async Task<PODLModel> PODL_getByKey(int idxPODL)
{
return await dbController.PODL_getByKey(idxPODL);
PODLModel result = new PODLModel();
if (idxPODL != 0)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlByPOdl}:{idxPODL}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
readType = "REDIS";
}
else
{
result = await dbController.PODL_getByKey(idxPODL);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new PODLModel();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
}
else
{
Log.Debug("Errore IdxPODL = 0");
}
return result;
}
/// <summary>
/// Recupero PODL da IdxODL
/// </summary>
/// <param name="idxODL"></param>
/// <returns></returns>
public PODLModel PODL_getByOdl(int idxODL)
{
PODLModel result = new PODLModel();
if (idxODL != 0)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisPOdlByOdl}:{idxODL}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
readType = "REDIS";
}
else
{
result = dbController.PODL_getByOdl(idxODL);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new PODLModel();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
}
else
{
Log.Debug("Errore IdxODL = 0");
}
return result;
}
/// <summary>
@@ -1036,6 +1112,10 @@ namespace MP.SPEC.Data
private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.709</Version>
<Version>6.16.2211.914</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.709</h4>
<h4>Versione: 6.16.2211.914</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.709
6.16.2211.914
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.709</version>
<version>6.16.2211.914</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>