From aedaf7e0ecec5fd76b63f33b1d110282e996b15d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 12 May 2025 08:59:50 +0200 Subject: [PATCH] Fix display dettaglio KIT x TAB3 --- MP-TAB3/Components/CurrOdlDetail.razor | 14 +++- MP-TAB3/Components/CurrOdlDetail.razor.cs | 54 +++++++++++++ .../Components/ProdKIT/KitDetailModal.razor | 79 +++++++++++++++++++ MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- MP-TAB3/appsettings.json | 8 +- MP.Data/Controllers/MpTabController.cs | 42 ++++++++++ MP.Data/Services/TabDataService.cs | 75 ++++++++++++++++++ MP.SPEC/Components/ListPODL.razor | 2 +- MP.SPEC/Data/MpDataService.cs | 2 +- 12 files changed, 273 insertions(+), 11 deletions(-) create mode 100644 MP-TAB3/Components/ProdKIT/KitDetailModal.razor diff --git a/MP-TAB3/Components/CurrOdlDetail.razor b/MP-TAB3/Components/CurrOdlDetail.razor index a9195b0b..d42d3702 100644 --- a/MP-TAB3/Components/CurrOdlDetail.razor +++ b/MP-TAB3/Components/CurrOdlDetail.razor @@ -1,4 +1,7 @@ - +@if (showKitDetail) +{ + +}
@@ -82,12 +85,21 @@ Articolo:
+ @if (CurrOdl != null && !showPOdlData) { + @if (CheckIsKit(CurrOdl.CodArticolo)) + { + + } @CurrOdl.DescArticolo } else { + @if (CheckIsKit(CurrPodl.CodArticolo)) + { + + } @CurrPodl.DescArticolo }
diff --git a/MP-TAB3/Components/CurrOdlDetail.razor.cs b/MP-TAB3/Components/CurrOdlDetail.razor.cs index 3ca29eb4..70be5a57 100644 --- a/MP-TAB3/Components/CurrOdlDetail.razor.cs +++ b/MP-TAB3/Components/CurrOdlDetail.razor.cs @@ -29,6 +29,7 @@ namespace MP_TAB3.Components [Parameter] public bool InAttr { get; set; } + [Parameter] public bool ShowClose { get; set; } = true; @@ -45,10 +46,48 @@ namespace MP_TAB3.Components [Inject] protected SharedMemService SMServ { get; set; } = null!; + [Inject] + protected TabDataService TDService { get; set; } = null!; + #endregion Protected Properties #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 void KitToggleDetail(string? selCodArt) + { + CodArtParent = selCodArt ?? ""; + if (!string.IsNullOrEmpty(CodArtParent)) + { + ListKitTemplate = TDService.TemplateKitFilt(CodArtParent, ""); + } + else + { + ListKitTemplate = null; + } + showKitDetail = !showKitDetail; + } + + protected override void OnInitialized() + { + // carico elenco KIT + ListArtKit = TDService.ArticoliGetByTipo("KIT", "*"); + } + protected async Task ToggleOdlDetail() { await EC_ToggleOdlDetail.InvokeAsync(true); @@ -61,6 +100,21 @@ namespace MP_TAB3.Components #endregion Protected Methods + #region Private Fields + + private string CodArtParent = ""; + + /// + /// Elenco articoli tipo KIT + /// + private List? ListArtKit; + + private List? ListKitTemplate = null; + + private bool showKitDetail = false; + + #endregion Private Fields + #region Private Properties private string baseLang diff --git a/MP-TAB3/Components/ProdKIT/KitDetailModal.razor b/MP-TAB3/Components/ProdKIT/KitDetailModal.razor new file mode 100644 index 00000000..98177bee --- /dev/null +++ b/MP-TAB3/Components/ProdKIT/KitDetailModal.razor @@ -0,0 +1,79 @@ + + + + +@code { + + [Parameter] + public string CodArtParent { get; set; } = ""; + + [Parameter] + public EventCallback EC_Close { get; set; } + + + [Parameter] + public List? ListRecords { get; set; } = null; + + protected override void OnParametersSet() + { + // base.OnParametersSet(); + totalKitCount = ListRecords != null ? ListRecords.Count() : 0; + } + private int totalKitCount = 0; + + protected async void ReqClose() + { + await EC_Close.InvokeAsync(true); + } +} diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 0b98a32e..3c0d1e0c 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2504.1617 + 6.16.2505.1208 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index bb81bb2b..eea0491d 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.1617

+

Versione: 6.16.2505.1208


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 02219081..72630e52 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.1617 +6.16.2505.1208 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 51b6644d..50e831a1 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.1617 + 6.16.2505.1208 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP-TAB3/appsettings.json b/MP-TAB3/appsettings.json index d0a48e1c..7183f2bb 100644 --- a/MP-TAB3/appsettings.json +++ b/MP-TAB3/appsettings.json @@ -60,11 +60,11 @@ }, "MailKitMailSettings": { "DisplayName": "MAPO EgalWare Email BOT", - "From": "steamwarebot@outlook.it", - "Host": "smtp-mail.outlook.com", - "Password": "siamoInViaNazionale93!", + "From": "services@steamware.net", + "Host": "smtp.gmail.com", + "Password": "rzdwvdhvyxtbrzoq", "Port": 587, - "UserName": "steamwarebot@outlook.it", + "UserName": "services@steamware.net", "UseSSL": false, "UseStartTls": true }, diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 7a919562..55efbb29 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -176,6 +176,28 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// 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; + } + /// /// Verifica se sia necessario inserire un cambio di stato impianto in modalità batch /// @@ -2281,6 +2303,26 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco template KIT da ricerca + /// + /// + /// + /// + public List TemplateKitFilt(string KitCode, string codChild) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetTempKit + .Where(x => (string.IsNullOrEmpty(KitCode) && string.IsNullOrEmpty(codChild)) || (x.CodArtParent.Contains(KitCode) && !string.IsNullOrEmpty(KitCode)) || (x.CodArtChild.Contains(codChild) && !string.IsNullOrEmpty(codChild))) + .AsNoTracking() + .ToList(); + } + return dbResult; + } + /// /// Elenco turni macchina (all) /// diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 22a943d7..09e09bff 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -21,6 +21,7 @@ using System.Threading.Tasks; using MongoDB.Driver.Core.Operations; using MP.Data.Controllers; using DnsClient.Protocol; +using MP.AppAuth.Controllers; namespace MP.Data.Services { @@ -366,6 +367,44 @@ namespace MP.Data.Services return result; } + /// + /// 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 = dbTabController.ArticoliGetByTipo(tipo, azienda); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, UltraLongCache); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ArticoliGetByTipo | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Recupera elenco ultimi commenti /// @@ -3441,6 +3480,42 @@ namespace MP.Data.Services return result; } + /// + /// Elenco Template KIT da ricerca + /// + /// + /// + /// + public List TemplateKitFilt(string codParent, string codChild) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{Utils.redisKitTempl}:{codParent}:{codChild}"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbTabController.TemplateKitFilt(codParent, codChild); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"TemplateKitFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + /// /// Turno macchina /// diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index 4b9d12e2..5dc8eae3 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -118,7 +118,7 @@ else @record.CodArticolo @if (CheckIsKit(record.CodArticolo)) { - + }
@record.DescArticolo
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index e4725619..892ddc08 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -359,7 +359,7 @@ namespace MP.SPEC.Data } else { - result = dbController.ArticoliGetByTipo(tipo); + result = dbController.ArticoliGetByTipo(tipo, azienda); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));