Inizio fix display archivio ricette

This commit is contained in:
Samuele Locatelli
2023-04-03 17:19:27 +02:00
parent d119bc3995
commit 03a8910399
8 changed files with 73 additions and 13 deletions
+2 -1
View File
@@ -234,7 +234,8 @@ namespace MP.Data
public const string redisGiacenzaList = redisBaseAddr + "Cache:GiacenzaList";
public const string redisMacByFlux = redisBaseAddr + "Cache:MacByFlux";
public const string redisMacList = redisBaseAddr + "Cache:MacList";
public const string redisMacRecipe = redisBaseAddr + "Cache:Recipe";
public const string redisMacRecipeConf = redisBaseAddr + "Cache:RecipeConf";
public const string redisMacRecipePath = redisBaseAddr + "Cache:RecipePath";
public const string redisOdlByBatch = redisXdlData + "OdlByBatch";
public const string redisOdlCurrByMac = redisXdlData + "OdlByMac";
public const string redisOdlList = redisXdlData + "OdlList";
+7 -1
View File
@@ -68,12 +68,18 @@ else
}
@if (MachineWithRecipe)
{
@if (machineHasRecipe(record.IdxMacchina).Result)
@if (machineHasRecipeConf(record.IdxMacchina).Result)
{
<button class="btn btn-dark btn-sm mx-1" title="Gestione Ricetta" @onclick="() => doShowRecipe(record)">
<i class="fa-solid fa-flask"></i>
</button>
}
@if (machineHasRecipeArch(record.IdxMacchina).Result)
{
<button class="btn btn-primary btn-sm mx-1" title="Gestione Ricetta" @onclick="() => doShowRecipeArch(record)">
<i class="fa-solid fa-flask"></i>
</button>
}
}
</td>
<td>
+22 -3
View File
@@ -111,9 +111,16 @@ namespace MP.SPEC.Components
protected async Task doShowRecipe(PODLExpModel selRec)
{
currRecord = selRec;
currRecipePath = await MDService.MacchineRecipe(selRec.IdxMacchina);
currRecipePath = await MDService.MacchineRecipeConf(selRec.IdxMacchina);
showRecipe = true;
}
protected async Task doShowRecipeArch(PODLExpModel selRec)
{
currRecord = selRec;
currRecipeArchPath = await MDService.MacchineRecipeArchive(selRec.IdxMacchina);
showRecipe = true;
}
protected override async Task OnInitializedAsync()
{
@@ -228,6 +235,7 @@ namespace MP.SPEC.Components
/// Percorso ricetta corrente
/// </summary>
private string currRecipePath = "";
private string currRecipeArchPath = "";
private PODLExpModel? currRecord = null;
@@ -426,12 +434,23 @@ namespace MP.SPEC.Components
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
private async Task<bool> machineHasRecipe(string idxMacchina)
private async Task<bool> machineHasRecipeConf(string idxMacchina)
{
var recipePath = await MDService.MacchineRecipe(idxMacchina);
var recipePath = await MDService.MacchineRecipeConf(idxMacchina);
return !string.IsNullOrEmpty(recipePath);
}
/// <summary>
/// Verifica se la macchina abbia associata un path x ricette (elenco)
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
private async Task<bool> machineHasRecipeArch(string idxMacchina)
{
var recipeArchive = await MDService.MacchineRecipeArchive(idxMacchina);
return !string.IsNullOrEmpty(recipeArchive);
}
/// <summary>
/// processa evento richiesto
/// </summary>
+38 -4
View File
@@ -909,17 +909,17 @@ namespace MP.SPEC.Data
}
/// <summary>
/// Verifica se la macchina abbia un codice ricetta associato
/// Verifica se la macchina abbia un codice CONF ricetta associato
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<string> MacchineRecipe(string idxMacchina)
public async Task<string> MacchineRecipeConf(string idxMacchina)
{
string? result = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{Utils.redisMacRecipe}:{idxMacchina}";
string currKey = $"{Utils.redisMacRecipeConf}:{idxMacchina}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
@@ -939,7 +939,41 @@ namespace MP.SPEC.Data
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"MacchineRecipe | Read from {readType}: {ts.TotalMilliseconds}ms");
Log.Debug($"MacchineRecipeConf | Read from {readType}: {ts.TotalMilliseconds}ms");
return result ?? "";
}
/// <summary>
/// Verifica se la macchina abbia un codice PATH ricette associato
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<string> MacchineRecipeArchive(string idxMacchina)
{
string? result = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{Utils.redisMacRecipePath}:{idxMacchina}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<string>($"{rawData}");
readType = "REDIS";
}
else
{
//recupero elenco macchine...
var machineList = await MacchineGetFilt("*");
var currMach = machineList.Where(x => x.IdxMacchina == idxMacchina).FirstOrDefault();
result = currMach != null ? currMach.RecipeArchivePath : null;
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"MacchineRecipeArchive | Read from {readType}: {ts.TotalMilliseconds}ms");
return result ?? "";
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2303.3117</Version>
<Version>6.16.2304.317</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2303.3117</h4>
<h4>Versione: 6.16.2304.317</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2303.3117
6.16.2304.317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2303.3117</version>
<version>6.16.2304.317</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>