From 4f6edcae470c4df050c3f50dccbc54b37589a6c8 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 24 Feb 2026 16:37:30 +0100 Subject: [PATCH] refresh fermate --- MP.Core/Utils.cs | 2 + MP.Data/Controllers/MpSpecController.cs | 53 ++++++++++++- MP.Data/Controllers/MpTabController.cs | 2 +- .../{ => Fermate}/ProdStopMan.razor | 2 +- .../{ => Fermate}/ProdStopMan.razor.cs | 2 +- MP.SPEC/Components/ListFerm.razor | 10 ++- MP.SPEC/Data/MpDataService.cs | 74 +++++++++++++++++++ MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/RepStop.razor | 11 ++- MP.SPEC/Pages/RepStop.razor.cs | 12 ++- MP.SPEC/Resources/ChangeLog.html | 25 +++++++ MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 13 files changed, 181 insertions(+), 18 deletions(-) rename MP.SPEC/Components/{ => Fermate}/ProdStopMan.razor (91%) rename MP.SPEC/Components/{ => Fermate}/ProdStopMan.razor.cs (98%) diff --git a/MP.Core/Utils.cs b/MP.Core/Utils.cs index d4bfc95f..bb16197a 100644 --- a/MP.Core/Utils.cs +++ b/MP.Core/Utils.cs @@ -26,6 +26,8 @@ namespace MP.Core public const string redisDossByMac = redisBaseAddr + "Cache:DossByMac"; + public const string redisEventList = redisBaseAddr + "Cache:EventList"; + public const string redisFluxByMac = redisBaseAddr + "Cache:FluxByMac"; public const string redisFluxLogFilt = redisBaseAddr + "Cache:FluxLogFilt"; diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 3c63a32a..30370a3e 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -1,20 +1,21 @@ using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using MP.Core.DTO; +using MP.Core.Objects; using MP.Data.DbModels; using MP.Data.DTO; -using MP.Core.Objects; +using MP.Data.Translate; using NLog; +using Org.BouncyCastle.Crypto; using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; -using static EgwCoreLib.Utils.DtUtils; -using MP.Core.DTO; -using MP.Data.Translate; using ZXing; +using static EgwCoreLib.Utils.DtUtils; namespace MP.Data.Controllers { @@ -115,6 +116,50 @@ namespace MP.Data.Controllers return answ; } + /// + /// Restituisce l'anagrafica EVENTI per macchina + /// + /// + public List AnagEventiGetByMacc(string IdxMac) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxMacch = new SqlParameter("@idxMacchina", IdxMac); + + dbResult = dbCtx + .DbSetVSEB + .FromSqlRaw("exec dbo.stp_vseb_getByIdxMacchinaFull @idxMacchina", IdxMacch) + .AsNoTracking() + .AsEnumerable() + .ToList(); + } + return dbResult; + } + + /// + /// Restituisce l'anagrafica EVENTI generalmente disponibile per OGNI macchina + /// + /// Nome Table x filtro (std: EvList) + /// Nome Field x filtro (std: Common) + /// + public List AnagEventiGeneral(string TableName = "EvList", string FieldName = "Common") + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var pTableName = new SqlParameter("@TableName", TableName); + var pFieldName = new SqlParameter("@FieldName", FieldName); + dbResult = dbCtx + .DbSetVSEB + .FromSqlRaw("exec dbo.stp_vseb_getGenerallyAvailable @TableName, @FieldName", pTableName, pFieldName) + .AsNoTracking() + .AsEnumerable() + .ToList(); + } + return dbResult; + } + /// /// Elenco Gruppi tipo Azienda /// diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 4975a126..6d76c64c 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -118,7 +118,7 @@ namespace MP.Data.Controllers } /// - /// Restituisce l'anagrafica EVENTI per intero + /// Restituisce l'anagrafica EVENTI per macchina /// /// public List AnagEventiGetByMacc(string IdxMac) diff --git a/MP.SPEC/Components/ProdStopMan.razor b/MP.SPEC/Components/Fermate/ProdStopMan.razor similarity index 91% rename from MP.SPEC/Components/ProdStopMan.razor rename to MP.SPEC/Components/Fermate/ProdStopMan.razor index 01298ec0..6756e9e6 100644 --- a/MP.SPEC/Components/ProdStopMan.razor +++ b/MP.SPEC/Components/Fermate/ProdStopMan.razor @@ -1,4 +1,4 @@ -
+
diff --git a/MP.SPEC/Components/ProdStopMan.razor.cs b/MP.SPEC/Components/Fermate/ProdStopMan.razor.cs similarity index 98% rename from MP.SPEC/Components/ProdStopMan.razor.cs rename to MP.SPEC/Components/Fermate/ProdStopMan.razor.cs index 8a130732..52abcece 100644 --- a/MP.SPEC/Components/ProdStopMan.razor.cs +++ b/MP.SPEC/Components/Fermate/ProdStopMan.razor.cs @@ -1,6 +1,6 @@ using Microsoft.AspNetCore.Components; -namespace MP.SPEC.Components +namespace MP.SPEC.Components.Fermate { public partial class ProdStopMan { diff --git a/MP.SPEC/Components/ListFerm.razor b/MP.SPEC/Components/ListFerm.razor index e779d00c..5a80c2a7 100644 --- a/MP.SPEC/Components/ListFerm.razor +++ b/MP.SPEC/Components/ListFerm.razor @@ -6,10 +6,12 @@ } else { - foreach (var item in ListaFermate) - { - - } +
+ @foreach (var item in ListaFermate) + { + + } +
}
\ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 071c480a..7da30c24 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -161,6 +161,80 @@ 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 + /// + /// + public List AnagEventiGeneral() + { + using var activity = ActivitySource.StartActivity("AnagEventiGeneral"); + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redisConn... + string currKey = $"{Utils.redisEventList}:VSEB:GENERAL"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbController.AnagEventiGeneral(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"AnagEventiGeneral | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + activity?.SetTag("data.source", source); + activity?.SetTag("result.count", result.Count); + return result; + } + /// /// Delete record AnagraficaGruppi /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 84e8c92a..7d653d3f 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2602.2415 + 6.16.2602.2416 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/RepStop.razor b/MP.SPEC/Pages/RepStop.razor index 12a9483d..ef9d9de1 100644 --- a/MP.SPEC/Pages/RepStop.razor +++ b/MP.SPEC/Pages/RepStop.razor @@ -24,10 +24,17 @@ {
- +
- + @if (showFermate) + { + + } + else + { +
Selezionare impianti per proseguire.
+ }
} diff --git a/MP.SPEC/Pages/RepStop.razor.cs b/MP.SPEC/Pages/RepStop.razor.cs index c99cdb84..473ee56f 100644 --- a/MP.SPEC/Pages/RepStop.razor.cs +++ b/MP.SPEC/Pages/RepStop.razor.cs @@ -23,7 +23,8 @@ namespace MP.SPEC.Pages { var rawList = MDService.MacchineGetFilt("*"); // prendo solo macchine VALIDE - SearchRecords = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList(); + SearchMacchine = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList(); + SearchFermate = MDService.AnagEventiGeneral(); } #endregion Protected Methods @@ -31,9 +32,16 @@ namespace MP.SPEC.Pages #region Private Fields private bool isLoading = false; + private bool showFermate = false; - private List SearchRecords = new(); + private List SearchMacchine = new(); + List SearchFermate = new(); #endregion Private Fields + private void CheckSelection(List listSelezione) + { + // se c'è selezione mostro elenco fermate... + showFermate = listSelezione.Count > 0; + } } } \ No newline at end of file diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index e69de29b..6a51e69a 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -0,0 +1,25 @@ + + Modulo MAPOSPEC +

Versione: 6.16.2602.2416

+
Note di rilascio: +
    +
  • + Ultime modifiche: +
      {{LAST-CHANGES}}
    +
  • +
  • + v.6.15.* → +
      +
    • Prima release dotnet6
    • +
    +
  • +
+
+
+ +
+ +
+ diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 1862b72d..26913b83 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2602.2415 +6.16.2602.2416 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 3d5f9683..8ad48abd 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2602.2415 + 6.16.2602.2416 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