From e70d2b191561b1b691e8dacf2ce7b155fb4dca59 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 24 Feb 2026 17:50:28 +0100 Subject: [PATCH] Aggiunto display stato MSE --- MP.SPEC/Components/ListMacc.razor | 6 +- MP.SPEC/Components/ListMacc.razor.cs | 44 ++++++- MP.SPEC/Data/MpDataService.cs | 181 ++++++++++++++++----------- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/RepStop.razor | 2 +- MP.SPEC/Pages/RepStop.razor.cs | 12 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 9 files changed, 168 insertions(+), 85 deletions(-) diff --git a/MP.SPEC/Components/ListMacc.razor b/MP.SPEC/Components/ListMacc.razor index c1b23165..cb1a9aac 100644 --- a/MP.SPEC/Components/ListMacc.razor +++ b/MP.SPEC/Components/ListMacc.razor @@ -16,7 +16,7 @@
- @if (ListRecords == null || ListRecords.Count==0) + @if (ListRecords == null || ListRecords.Count == 0) {
Nessun Record Trovato
} @@ -59,9 +59,9 @@ } @record.CodMacchina - @record.Descrizione + @record.Nome - Stato: TBD + @record.DescrizioneStato } diff --git a/MP.SPEC/Components/ListMacc.razor.cs b/MP.SPEC/Components/ListMacc.razor.cs index 3be9f83d..1b7b9696 100644 --- a/MP.SPEC/Components/ListMacc.razor.cs +++ b/MP.SPEC/Components/ListMacc.razor.cs @@ -8,7 +8,7 @@ namespace MP.SPEC.Components #region Public Properties [Parameter] - public List ListMSE { get; set; } = null!; + public List 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; } + /// + /// CSS Class bordo da stato macchina + /// + 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 ListRecords = new(); + private List ListRecords = new(); private int numRecord = 10; private int totalCount = 0; diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 7da30c24..4629e0db 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -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; } - /// - /// Elenco EVENTI validi x macchina - /// - /// - public List AnagEventiGetByMacch(string IdxMacch) - { - using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch"); - string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); - List? result = new List(); - // cerco in redisConn... - string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}"; - RedisValue rawData = redisDb.StringGet(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{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(); - } - sw.Stop(); - Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms"); - activity?.SetTag("data.source", source); - activity?.SetTag("result.count", result.Count); - return result; - } - /// /// Elenco EVENTI validi x ogni macchina secondo conf standard macchina /// @@ -235,6 +199,43 @@ namespace MP.SPEC.Data return result; } + /// + /// Elenco EVENTI validi x macchina + /// + /// + public List AnagEventiGetByMacch(string IdxMacch) + { + using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch"); + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redisConn... + string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{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(); + } + sw.Stop(); + Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + return result; + } + /// /// Delete record AnagraficaGruppi /// @@ -278,11 +279,6 @@ namespace MP.SPEC.Data return result; } - /// - /// Oggetto per collezione dati Activity (span in Uptrace) - /// - private static readonly ActivitySource ActivitySource = new ActivitySource("MP.DATA.Tracer"); - /// /// Elenco Gruppi /// @@ -1403,14 +1399,6 @@ namespace MP.SPEC.Data activity?.SetTag("data.source", "DB+REDIS"); return result; } - /// - /// Reset macchine e gruppi - /// - private void ResetMacGrpCache() - { - ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*"); - ExecFlushRedisPattern($"{Utils.redisMacList}:*"); - } /// /// Eliminazione di un record operatore dal gruppo @@ -1454,15 +1442,6 @@ namespace MP.SPEC.Data return result; } - /// - /// Reset cache operatori e gruppi - /// - private void ResetOprGrpCache() - { - ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*"); - ExecFlushRedisPattern($"{Utils.redisOprList}:*"); - } - /// /// Init ricetta /// @@ -1906,6 +1885,43 @@ namespace MP.SPEC.Data return answ; } + /// + /// Elenco MSE stato amcchine + /// + /// + /// + public async Task> MseGetAll(bool forceDb = false) + { + using var activity = ActivitySource.StartActivity("MseGetAll"); + Stopwatch sw = new Stopwatch(); + string source = "DB"; + sw.Start(); + List? result = new List(); + // cerco in redisConn... + RedisValue rawData = redisDb.StringGet(Constants.redisMseKey); + if (rawData.HasValue && !forceDb) + { + result = JsonConvert.DeserializeObject>($"{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(); + } + sw.Stop(); + Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + return result; + } + /// /// Invio notifica rilettura (con parametro) /// @@ -2999,18 +3015,6 @@ namespace MP.SPEC.Data return fatto; } - /// - /// Svuota cache creazione KIT - /// - private void EmptyWipCache() - { - string pattern = $"{Utils.redisKitWip}:*"; - if (!string.IsNullOrEmpty(pattern)) - { - ExecFlushRedisPattern(pattern); - } - } - /// /// Elenco Template KIT da ricerca /// @@ -3158,6 +3162,11 @@ namespace MP.SPEC.Data #region Private Fields + /// + /// Oggetto per collezione dati Activity (span in Uptrace) + /// + private static readonly ActivitySource ActivitySource = new ActivitySource("MP.DATA.Tracer"); + private static IConfiguration _configuration = null!; private static ILogger _logger = null!; @@ -3203,6 +3212,18 @@ namespace MP.SPEC.Data #region Private Methods + /// + /// Svuota cache creazione KIT + /// + private void EmptyWipCache() + { + string pattern = $"{Utils.redisKitWip}:*"; + if (!string.IsNullOrEmpty(pattern)) + { + ExecFlushRedisPattern(pattern); + } + } + private async Task POdlFlushCache() { using var activity = ActivitySource.StartActivity("POdlFlushCache"); @@ -3244,6 +3265,24 @@ namespace MP.SPEC.Data activity?.SetTag("data.source", "REDIS"); } + /// + /// Reset macchine e gruppi + /// + private void ResetMacGrpCache() + { + ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*"); + ExecFlushRedisPattern($"{Utils.redisMacList}:*"); + } + + /// + /// Reset cache operatori e gruppi + /// + private void ResetOprGrpCache() + { + ExecFlushRedisPattern($"{Utils.redisAnagGruppi}:*"); + ExecFlushRedisPattern($"{Utils.redisOprList}:*"); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 7d653d3f..45f53f1b 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2602.2416 + 6.16.2602.2417 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/RepStop.razor b/MP.SPEC/Pages/RepStop.razor index 3f5d58e2..98ee38e8 100644 --- a/MP.SPEC/Pages/RepStop.razor +++ b/MP.SPEC/Pages/RepStop.razor @@ -24,7 +24,7 @@ {
- +
@if (showFermate) diff --git a/MP.SPEC/Pages/RepStop.razor.cs b/MP.SPEC/Pages/RepStop.razor.cs index 473ee56f..c80dccc8 100644 --- a/MP.SPEC/Pages/RepStop.razor.cs +++ b/MP.SPEC/Pages/RepStop.razor.cs @@ -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 SearchMacchine = new(); +#if false + private List SearchMacchine = new(); +#endif + private List CurrMSE = new(); List SearchFermate = new(); #endregion Private Fields diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 6a51e69a..c370e1e9 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2602.2416

+

Versione: 6.16.2602.2417


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 26913b83..090c7a27 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2602.2416 +6.16.2602.2417 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 8ad48abd..b6f5fc18 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2602.2416 + 6.16.2602.2417 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false