From 0795cae1d5f6bc6fff101b05c60508e7c1ec43ac Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 5 Oct 2022 15:46:59 +0200 Subject: [PATCH] Aggiunta filtro per articolo + fix lettura da redis dossiers --- MP.Data/Controllers/MpSpecController.cs | 19 ++++++++++ MP.SPEC/Components/DossiersFilter.razor | 13 ++++++- MP.SPEC/Components/DossiersFilter.razor.cs | 5 ++- MP.SPEC/Data/MpDataService.cs | 41 ++++++++++++++++++++-- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/DOSS.razor | 1 + MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 9 files changed, 79 insertions(+), 8 deletions(-) diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 4713d55f..f4103a4e 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -535,6 +535,25 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco codice articoli che abbiano dati Dossier + /// + /// + public List ArticleWithDossier() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetDossiers + .AsNoTracking() + .Select(i => i.OdlNav.CodArticolo) + .Distinct() + .ToList(); + } + return dbResult; + } + /// /// Elenco da tabella MappaStatoExpl /// diff --git a/MP.SPEC/Components/DossiersFilter.razor b/MP.SPEC/Components/DossiersFilter.razor index 762170c7..80c12120 100644 --- a/MP.SPEC/Components/DossiersFilter.razor +++ b/MP.SPEC/Components/DossiersFilter.razor @@ -5,7 +5,17 @@
- ...filtro ART + + +
diff --git a/MP.SPEC/Components/DossiersFilter.razor.cs b/MP.SPEC/Components/DossiersFilter.razor.cs index c6d48734..8d9e01bb 100644 --- a/MP.SPEC/Components/DossiersFilter.razor.cs +++ b/MP.SPEC/Components/DossiersFilter.razor.cs @@ -102,6 +102,7 @@ namespace MP.SPEC.Components { SelFilterDossier = new SelectDossierParams(); ListMacchine = await MDService.MacchineWithFlux(); + ListArticoli = await MDService.ArticleWithDossier(); #if false ListDossier = await MDService.DossiersGetLastFilt(selMacchina, selArticolo, selDtRef, selMaxRecord); #endif @@ -117,11 +118,13 @@ namespace MP.SPEC.Components #region Private Fields -#if fase +#if false private List? ListDossier = null; #endif private List? ListMacchine = null; + private List? ListArticoli = null; + #endregion Private Fields #region Private Properties diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 9ecec88e..cae0dd2c 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -314,7 +314,6 @@ namespace MP.SPEC.Data /// macchina (ordinato x data registrazione) /// /// * = tutte, altrimenti solo x una data macchina - /// * = tutti, altrimenti solo x un dato articolo /// Data di riferimento (Massima) per estrazione records /// numero massimo record da restituire /// @@ -324,7 +323,7 @@ namespace MP.SPEC.Data Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; - string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtRef:yyyy/MM/dd HH:mm:ss}:{MaxRec}"; + string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtRef}:{MaxRec}"; // cerco in redis dato valore sel macchina... RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) @@ -560,6 +559,42 @@ namespace MP.SPEC.Data return result; } + + /// + /// Elenco Codice articolo con dati dossier gestiti + /// + /// + public async Task> ArticleWithDossier() + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = redisArtByDossier; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ArticleWithDossier()); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ArticleWithDossier | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Elenco di tutti i parametri filtrati x macchina /// @@ -651,6 +686,8 @@ namespace MP.SPEC.Data private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; + private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier"; + private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index b68bc73a..6de1fbd1 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.514 + 6.16.2210.515 diff --git a/MP.SPEC/Pages/DOSS.razor b/MP.SPEC/Pages/DOSS.razor index 94278ea8..9c17c17b 100644 --- a/MP.SPEC/Pages/DOSS.razor +++ b/MP.SPEC/Pages/DOSS.razor @@ -14,6 +14,7 @@ } else { + }
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 6fcb5580..908f9356 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2210.514

+

Versione: 6.16.2210.515


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 97fa0ad3..34747600 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.514 +6.16.2210.515 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index abf385b5..3824b6da 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.514 + 6.16.2210.515 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