diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 08306519..fe86cc4d 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -360,6 +360,28 @@ namespace MP.Data.Controllers return fatto; } + /// + /// Restitusice elenco articoli dato tipo (es KIT) + /// + /// + /// + /// + /// + public List ArticoliGetByTipo(string tipo, string azienda = "*") + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetArticoli + .AsNoTracking() + .Where(x => x.Tipo.ToUpper() == tipo.ToUpper() && (azienda == "*" || x.Azienda.ToUpper() == azienda.ToUpper())) + .OrderBy(x => x.CodArticolo) + .ToList(); + } + return dbResult; + } + /// /// Elenco tabella Articoli da filtro /// @@ -397,7 +419,7 @@ namespace MP.Data.Controllers dbResult = dbCtx .DbSetArticoli .AsNoTracking() - .Where(x => (azienda == "*" || x.Azienda.ToLower().Equals(azienda.ToLower())) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal))) + .Where(x => (azienda == "*" || x.Azienda.ToUpper() == azienda.ToUpper()) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal))) .OrderBy(x => x.CodArticolo) .Take(numRecord) .ToList(); diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index ec5acc34..4b9d12e2 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -1,4 +1,5 @@ @using MP.SPEC.Components +@using MP.SPEC.Components.ProdKit @using MP.SPEC.Data @if (ListRecords == null || isLoading) @@ -15,8 +16,7 @@ else
@if (showKitDetail) { - @* *@ - dettaglio kit! + } @@ -118,7 +118,7 @@ else @record.CodArticolo @if (CheckIsKit(record.CodArticolo)) { - + }
@record.DescArticolo
diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index f72bccc2..5d930d12 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -95,6 +95,21 @@ namespace MP.SPEC.Components #region Protected Methods + /// + /// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio + /// + /// + /// + protected bool CheckIsKit(string CodArticolo) + { + bool answ = false; + if (ListArtKit != null && ListArtKit.Count > 0) + { + answ = ListArtKit.Count(x => x.CodArticolo == CodArticolo) > 0; + } + return answ; + } + protected async Task cloneRecord(PODLExpModel selRec) { currRecord = null; @@ -105,24 +120,6 @@ namespace MP.SPEC.Components header = "Duplica PODL"; } - private bool showKitDetail = false; - private string CodArtParent = ""; - protected void KitToggleDetail(string? selCodArt) - { - CodArtParent = selCodArt??""; - if (!string.IsNullOrEmpty(CodArtParent)) - { - ListKitTemplate = MDService.TemplateKitFilt(CodArtParent, ""); - } - else - { - ListKitTemplate = null; - } - showKitDetail = !showKitDetail; - } - - private List? ListKitTemplate = null; - /// /// Eliminazione record selezionato (previa conferma) /// @@ -140,18 +137,6 @@ namespace MP.SPEC.Components await Task.Delay(1); } - /// - /// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio - /// - /// - /// - protected bool CheckIsKit(string CodArticolo) - { - bool answ = false; - - return answ; - } - protected void doShowRecipeArch(PODLExpModel selRec) { currRecord = selRec; @@ -175,9 +160,24 @@ namespace MP.SPEC.Components await RecordEdit.InvokeAsync(selRec); } + protected void KitToggleDetail(string? selCodArt) + { + CodArtParent = selCodArt ?? ""; + if (!string.IsNullOrEmpty(CodArtParent)) + { + ListKitTemplate = MDService.TemplateKitFilt(CodArtParent, ""); + } + else + { + ListKitTemplate = null; + } + showKitDetail = !showKitDetail; + } + protected override async Task OnInitializedAsync() { ListStati = await MDService.AnagStatiComm(); + ListArtKit = MDService.ArticoliGetByTipo("KIT", "*"); string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe"); if (!string.IsNullOrEmpty(strMachRecipe)) { @@ -329,7 +329,7 @@ namespace MP.SPEC.Components #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); - + private string CodArtParent = ""; private string currRecipeArchPath = ""; /// @@ -339,8 +339,17 @@ namespace MP.SPEC.Components private PODLExpModel? currRecord = null; + /// + /// Elenco articoli tipo KIT + /// + private List? ListArtKit; + + private List? ListKitTemplate = null; private List? ListRecords; + /// + /// Elenco stati + /// private List? ListStati; private bool MachineWithRecipe = false; @@ -356,7 +365,7 @@ namespace MP.SPEC.Components private List odlCurrList = new List(); private List? SearchRecords; - + private bool showKitDetail = false; private bool showRecipeArch = false; private bool showRecipeConf = false; diff --git a/MP.SPEC/Components/ProdKit/KitDetailModal.razor b/MP.SPEC/Components/ProdKit/KitDetailModal.razor index 8452ea0d..98177bee 100644 --- a/MP.SPEC/Components/ProdKit/KitDetailModal.razor +++ b/MP.SPEC/Components/ProdKit/KitDetailModal.razor @@ -1,5 +1,5 @@  -
- - - - - - - - - @foreach (var record in ListKitTemplate) - { - - - - - - } - -
Cod Kit (Parent) Articolo (Child) Art/Kit Qty
- @record.CodArtParent - - @record.CodArtChild - -
@record.Qty
-
- } -
- - - *@ } diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index e982fd60..e4725619 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -336,6 +336,44 @@ namespace MP.SPEC.Data return fatto; } + /// + /// Restitusice elenco articoli dato tipo (es KIT) + /// + /// + /// + /// + public List ArticoliGetByTipo(string tipo, string azienda = "*") + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string sKey = string.IsNullOrEmpty(tipo) ? "ALL" : tipo; + string currKey = $"{Utils.redisArtList}:{azienda}:Tipo:{sKey}"; + // cerco in redis dato valore sel idxMaccSel... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = dbController.ArticoliGetByTipo(tipo); + // serializzo 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($"ArticoliGetByTipo | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Restitusice elenco articoli cercati /// @@ -2107,7 +2145,6 @@ namespace MP.SPEC.Data return result; } - /// /// Elenco PODL per composizione KIT (Async) non avviati filtrati x articolo, KeyRich (che contiene stato) /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index cac3d92b..5be0eaa3 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2505.918 + 6.16.2505.1017 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 96001154..8fc5119a 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2505.918

+

Versione: 6.16.2505.1017


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 8938f1aa..3f147e05 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2505.918 +6.16.2505.1017 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 3980d0e4..eb30cd1f 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2505.918 + 6.16.2505.1017 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