Aggiunto display stato MSE

This commit is contained in:
Samuele Locatelli
2026-02-24 17:50:28 +01:00
parent e8999cfb8f
commit e70d2b1915
9 changed files with 168 additions and 85 deletions
+3 -3
View File
@@ -16,7 +16,7 @@
</div>
</div>
<div class="card-body">
@if (ListRecords == null || ListRecords.Count==0)
@if (ListRecords == null || ListRecords.Count == 0)
{
<div class="alert alert-warning fs-3">Nessun Record Trovato</div>
}
@@ -59,9 +59,9 @@
}
</td>
<td>@record.CodMacchina</td>
<td>@record.Descrizione</td>
<td>@record.Nome</td>
<td>
<span class="badge text-bg-info bg-opacity-50">Stato: TBD</span>
<span class="rounded bg-opacity-75 p-1 @cssClassBorder(record.Semaforo)">@record.DescrizioneStato</span>
</td>
</tr>
}
+41 -3
View File
@@ -8,7 +8,7 @@ namespace MP.SPEC.Components
#region Public Properties
[Parameter]
public List<MacchineModel> ListMSE { get; set; } = null!;
public List<MappaStatoExplModel> ListMSE { get; set; } = null!;
[Parameter]
@@ -35,7 +35,7 @@ namespace MP.SPEC.Components
#region Protected Methods
protected string CheckSelect(MacchineModel currRec)
protected string CheckSelect(MappaStatoExplModel currRec)
{
string answ = "";
if (CurrList.Contains(currRec.CodMacchina))
@@ -45,6 +45,44 @@ namespace MP.SPEC.Components
return answ;
}
/// <summary>
/// CSS Class bordo da stato macchina
/// </summary>
protected string cssClassBorder(string semaforo)
{
string answ = "";
if (!string.IsNullOrEmpty(semaforo))
{
switch (semaforo)
{
case "sGi":
answ += " text-bg-warning";
break;
case "sRo":
answ += " text-bg-danger";
break;
case "sGr":
answ += " text-bg-dark";
break;
case "sBl":
answ += " text-bg-rimary";
break;
case "sVe":
answ += " text-bg-success";
break;
default:
answ += " text-bg-secondary";
break;
}
}
return answ;
}
protected override async Task OnParametersSetAsync()
{
totalCount = ListMSE.Count();
@@ -115,7 +153,7 @@ namespace MP.SPEC.Components
private int currPage = 1;
private bool isLoading = false;
private List<MacchineModel> ListRecords = new();
private List<MappaStatoExplModel> ListRecords = new();
private int numRecord = 10;
private int totalCount = 0;
+110 -71
View File
@@ -10,6 +10,7 @@ using MP.Data.Controllers;
using MP.Data.DbModels;
using MP.Data.MgModels;
using MP.Data.Services;
using MP.SPEC.Components.ProdKit;
using Newtonsoft.Json;
using NLog;
using StackExchange.Redis;
@@ -161,43 +162,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco EVENTI validi x macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGetByMacch(string IdxMacch)
{
using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch");
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
// cerco in redisConn...
string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.AnagEventiGetByMacc(IdxMacch);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<vSelEventiBCodeModel>();
}
sw.Stop();
Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms");
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
return result;
}
/// <summary>
/// Elenco EVENTI validi x ogni macchina secondo conf standard macchina
/// </summary>
@@ -235,6 +199,43 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco EVENTI validi x macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGetByMacch(string IdxMacch)
{
using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch");
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
// cerco in redisConn...
string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.AnagEventiGetByMacc(IdxMacch);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<vSelEventiBCodeModel>();
}
sw.Stop();
Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms");
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
return result;
}
/// <summary>
/// Delete record AnagraficaGruppi
/// </summary>
@@ -278,11 +279,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Oggetto per collezione dati Activity (span in Uptrace)
/// </summary>
private static readonly ActivitySource ActivitySource = new ActivitySource("MP.DATA.Tracer");
/// <summary>
/// Elenco Gruppi
/// </summary>
@@ -1403,14 +1399,6 @@ namespace MP.SPEC.Data
activity?.SetTag("data.source", "DB+REDIS");
return result;
}
/// <summary>
/// Reset macchine e gruppi
/// </summary>
private void ResetMacGrpCache()
{
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
ExecFlushRedisPattern($"{Utils.redisMacList}:*");
}
/// <summary>
/// Eliminazione di un record operatore dal gruppo
@@ -1454,15 +1442,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Reset cache operatori e gruppi
/// </summary>
private void ResetOprGrpCache()
{
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
ExecFlushRedisPattern($"{Utils.redisOprList}:*");
}
/// <summary>
/// Init ricetta
/// </summary>
@@ -1906,6 +1885,43 @@ namespace MP.SPEC.Data
return answ;
}
/// <summary>
/// Elenco MSE stato amcchine
/// </summary>
/// <param name="forceDb"></param>
/// <returns></returns>
public async Task<List<MappaStatoExplModel>> MseGetAll(bool forceDb = false)
{
using var activity = ActivitySource.StartActivity("MseGetAll");
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
List<MappaStatoExplModel>? result = new List<MappaStatoExplModel>();
// cerco in redisConn...
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
if (rawData.HasValue && !forceDb)
{
result = JsonConvert.DeserializeObject<List<MappaStatoExplModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = await Task.FromResult(dbController.MseGetAll(2000));
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromSeconds(1));
}
if (result == null)
{
result = new List<MappaStatoExplModel>();
}
sw.Stop();
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
return result;
}
/// <summary>
/// Invio notifica rilettura (con parametro)
/// </summary>
@@ -2999,18 +3015,6 @@ namespace MP.SPEC.Data
return fatto;
}
/// <summary>
/// Svuota cache creazione KIT
/// </summary>
private void EmptyWipCache()
{
string pattern = $"{Utils.redisKitWip}:*";
if (!string.IsNullOrEmpty(pattern))
{
ExecFlushRedisPattern(pattern);
}
}
/// <summary>
/// Elenco Template KIT da ricerca
/// </summary>
@@ -3158,6 +3162,11 @@ namespace MP.SPEC.Data
#region Private Fields
/// <summary>
/// Oggetto per collezione dati Activity (span in Uptrace)
/// </summary>
private static readonly ActivitySource ActivitySource = new ActivitySource("MP.DATA.Tracer");
private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!;
@@ -3203,6 +3212,18 @@ namespace MP.SPEC.Data
#region Private Methods
/// <summary>
/// Svuota cache creazione KIT
/// </summary>
private void EmptyWipCache()
{
string pattern = $"{Utils.redisKitWip}:*";
if (!string.IsNullOrEmpty(pattern))
{
ExecFlushRedisPattern(pattern);
}
}
private async Task<bool> POdlFlushCache()
{
using var activity = ActivitySource.StartActivity("POdlFlushCache");
@@ -3244,6 +3265,24 @@ namespace MP.SPEC.Data
activity?.SetTag("data.source", "REDIS");
}
/// <summary>
/// Reset macchine e gruppi
/// </summary>
private void ResetMacGrpCache()
{
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
ExecFlushRedisPattern($"{Utils.redisMacList}:*");
}
/// <summary>
/// Reset cache operatori e gruppi
/// </summary>
private void ResetOprGrpCache()
{
ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*");
ExecFlushRedisPattern($"{Utils.redisOprList}:*");
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2602.2416</Version>
<Version>6.16.2602.2417</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+1 -1
View File
@@ -24,7 +24,7 @@
{
<div class="row">
<div class="col-5">
<ListMacc ListMSE="@SearchMacchine" EC_Selected="CheckSelection"></ListMacc>
<ListMacc ListMSE="CurrMSE" EC_Selected="CheckSelection"></ListMacc>
</div>
<div class="col-7">
@if (showFermate)
+9 -3
View File
@@ -19,11 +19,14 @@ namespace MP.SPEC.Pages
#region Protected Methods
protected override void OnInitialized()
protected override async Task OnInitializedAsync()
{
#if false
var rawList = MDService.MacchineGetFilt("*");
// prendo solo macchine VALIDE
SearchMacchine = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList();
SearchMacchine = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList();
#endif
CurrMSE = await MDService.MseGetAll(false);
SearchFermate = MDService.AnagEventiGeneral();
}
@@ -34,7 +37,10 @@ namespace MP.SPEC.Pages
private bool isLoading = false;
private bool showFermate = false;
private List<MacchineModel> SearchMacchine = new();
#if false
private List<MacchineModel> SearchMacchine = new();
#endif
private List<MappaStatoExplModel> CurrMSE = new();
List<vSelEventiBCodeModel> SearchFermate = new();
#endregion Private Fields
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2602.2416</h4>
<h4>Versione: 6.16.2602.2417</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2602.2416
6.16.2602.2417
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2602.2416</version>
<version>6.16.2602.2417</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>