From 62fb0e38b33bf7c792213b5347ea0edaf89b6e1d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 10 Apr 2025 08:09:11 +0200 Subject: [PATCH] SPEC: - Completo gestione Template KIT --- MP-TAB3/Components/InsManual.razor | 10 +- MP.Data/Services/ListSelectDataSrv.cs | 6 +- MP.SPEC/Components/CmpTop.razor | 2 +- MP.SPEC/Components/ListODL.razor.cs | 2 +- MP.SPEC/Components/ListPODL.razor.cs | 2 +- MP.SPEC/Components/SelectCodArt.razor | 39 +++++ MP.SPEC/Components/SelectCodArt.razor.cs | 143 ++++++++++++++++++ .../{MessageService.cs => MsgServiceSpec.cs} | 2 +- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Pages/Contacts.razor | 2 +- MP.SPEC/Pages/Index.razor.cs | 2 +- MP.SPEC/Pages/KIT.razor | 101 +++++++++---- MP.SPEC/Pages/KIT.razor.cs | 58 +++++-- MP.SPEC/Pages/TestBtn.razor.cs | 2 +- MP.SPEC/Program.cs | 6 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- MP.SPEC/appsettings.Production.json | 1 + MP.SPEC/appsettings.json | 1 + 20 files changed, 326 insertions(+), 61 deletions(-) create mode 100644 MP.SPEC/Components/SelectCodArt.razor create mode 100644 MP.SPEC/Components/SelectCodArt.razor.cs rename MP.SPEC/Data/{MessageService.cs => MsgServiceSpec.cs} (96%) diff --git a/MP-TAB3/Components/InsManual.razor b/MP-TAB3/Components/InsManual.razor index 24f01ddc..394a2375 100644 --- a/MP-TAB3/Components/InsManual.razor +++ b/MP-TAB3/Components/InsManual.razor @@ -145,13 +145,13 @@ { } - +
- +
@@ -162,7 +162,7 @@ } - +
@@ -191,13 +191,13 @@ { } - +
- +
diff --git a/MP.Data/Services/ListSelectDataSrv.cs b/MP.Data/Services/ListSelectDataSrv.cs index f6c51ad7..2c73b604 100644 --- a/MP.Data/Services/ListSelectDataSrv.cs +++ b/MP.Data/Services/ListSelectDataSrv.cs @@ -77,7 +77,10 @@ namespace MP.Data.Services } else { - result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal)); + result = dbController.ArticoliGetSearch(numRecord, azienda, searchVal); +#if false + result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal)); +#endif // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(currKey, rawData, LongCache); @@ -104,7 +107,6 @@ namespace MP.Data.Services // cerco in redis... string currKey = $"{redisBaseKey}:Conf"; RedisValue rawData = await redisDb.StringGetAsync(currKey); - //if (!string.IsNullOrEmpty($"{rawData}")) if (rawData.HasValue) { result = JsonConvert.DeserializeObject>($"{rawData}"); diff --git a/MP.SPEC/Components/CmpTop.razor b/MP.SPEC/Components/CmpTop.razor index 37bc1032..7eb87b12 100644 --- a/MP.SPEC/Components/CmpTop.razor +++ b/MP.SPEC/Components/CmpTop.razor @@ -4,7 +4,7 @@ @using Microsoft.AspNetCore.Components.Authorization @inject AuthenticationStateProvider AuthenticationStateProvider -@inject MessageService MService +@inject MsgServiceSpec MService
diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index c3e38745..42040ed5 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -129,7 +129,7 @@ namespace MP.SPEC.Components await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setArt", currRecord.CodArticolo); string odlPad = currRecord.IdxOdl.ToString(padCodXdl); await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setComm", $"ODL{odlPad}"); - //await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setComm", $"ODL{currRecord.IdxOdl:00000000}"); + //await MpIoApiCall.addTask2Exe(EditRecord.IdxMacchina, "setComm", $"ODL{EditRecord.IdxOdl:00000000}"); await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setPzComm", $"{currRecord.NumPezzi}"); // richiesto anche sync DB diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index bf024c2c..3bfea796 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -42,7 +42,7 @@ namespace MP.SPEC.Components try { answ = (currRecord.IdxPromessa == record.IdxPromessa) ? "table-info" : ""; - //answ = ((currRecord.IdxMacchina == record.IdxMacchina) && (currRecord.CodArticolo == record.CodArticolo) && (currRecord.CodFase == record.CodFase)) ? "table-info" : ""; + //answ = ((EditRecord.IdxMacchina == record.IdxMacchina) && (EditRecord.CodArticolo == record.CodArticolo) && (EditRecord.CodFase == record.CodFase)) ? "table-info" : ""; } catch { } diff --git a/MP.SPEC/Components/SelectCodArt.razor b/MP.SPEC/Components/SelectCodArt.razor new file mode 100644 index 00000000..2993d322 --- /dev/null +++ b/MP.SPEC/Components/SelectCodArt.razor @@ -0,0 +1,39 @@ +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+ + diff --git a/MP.SPEC/Components/SelectCodArt.razor.cs b/MP.SPEC/Components/SelectCodArt.razor.cs new file mode 100644 index 00000000..29b051aa --- /dev/null +++ b/MP.SPEC/Components/SelectCodArt.razor.cs @@ -0,0 +1,143 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.Services; +using NLog; + +namespace MP.SPEC.Components +{ + public partial class SelectCodArt + { + #region Public Properties + + [Parameter] + public EventCallback E_CodArt { get; set; } + + [Parameter] + public int SearchMinChar { get; set; } + + #endregion Public Properties + + #region Protected Properties + + protected string CodArtSel + { + get => codArtSel; + set + { + if (codArtSel != value) + { + codArtSel = value; + E_CodArt.InvokeAsync(CodArtSel).ConfigureAwait(false); + } + } + } + + protected int DisplayCount { get; set; } = 0; + + protected bool ListArtDisabled { get => string.IsNullOrEmpty(SearchVal) || SearchVal.Length < SearchMinChar; } + + protected Dictionary? ListArticoli { get; set; } = null; + + protected Dictionary ListArticoliAll { get; set; } = new Dictionary(); + + [Inject] + protected ListSelectDataSrv MDataService { get; set; } = null!; + + protected int Num2Displ + { + get => num2Displ; + set + { + if (num2Displ != value) + { + num2Displ = value; + FiltArticoli(); + } + } + } + + protected string SearchVal + { + get => searchVal; + set + { + if (value.Length >= SearchMinChar || string.IsNullOrEmpty(value)) + { + if (searchVal != value) + { + searchVal = value; + var pUpd = Task.Run(async () => + { + await ReloadArticoli(); + }); + pUpd.Wait(); + } + } + } + } + + protected int TotalCount { get; set; } = 0; + + #endregion Protected Properties + + #region Protected Methods + + protected void FiltArticoli() + { + bool done = false; + if (!ListArtDisabled) + { + if (ListArticoliAll != null) + { + TotalCount = ListArticoliAll.Count; + ListArticoli = ListArticoliAll.Take(Num2Displ).ToDictionary(x => x.Key, x => x.Value); + DisplayCount = ListArticoli.Count; + done = true; + } + } + + if (!done) + { + TotalCount = 0; + ListArticoli = new Dictionary(); + DisplayCount = 0; + } + } + + protected async Task GetArticoli() + { + if (!ListArtDisabled) + { + Log.Debug("START GetArticoli"); + var rawData = await MDataService.ArticoliGetSearch(10000, "*", searchVal); + // trasformo! + if (rawData != null) + { + ListArticoliAll = rawData.ToDictionary(x => x.CodArticolo, x => $"{x.CodArticolo} | {x.DescArticolo} | {x.Disegno}"); + } + Log.Debug("END GetArticoli"); + } + } + + protected async Task ReloadArticoli() + { + await GetArticoli(); + FiltArticoli(); + } + + #endregion Protected Methods + + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Private Properties + + private string codArtSel { get; set; } = ""; + private int num2Displ { get; set; } = 20; + private string searchVal { get; set; } = ""; + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/MessageService.cs b/MP.SPEC/Data/MsgServiceSpec.cs similarity index 96% rename from MP.SPEC/Data/MessageService.cs rename to MP.SPEC/Data/MsgServiceSpec.cs index 5e41a61d..d4d314e3 100644 --- a/MP.SPEC/Data/MessageService.cs +++ b/MP.SPEC/Data/MsgServiceSpec.cs @@ -1,6 +1,6 @@ namespace MP.SPEC.Data { - public class MessageService + public class MsgServiceSpec { #region Public Events diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 0819948d..f140349a 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2504.919 + 6.16.2504.1007 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/Contacts.razor b/MP.SPEC/Pages/Contacts.razor index e845ae27..4fbcfb21 100644 --- a/MP.SPEC/Pages/Contacts.razor +++ b/MP.SPEC/Pages/Contacts.razor @@ -1,7 +1,7 @@ @page "/Contacts" @using MP.SPEC.Data -@inject MessageService AppMService +@inject MsgServiceSpec AppMService
diff --git a/MP.SPEC/Pages/Index.razor.cs b/MP.SPEC/Pages/Index.razor.cs index 725e093b..f37b343c 100644 --- a/MP.SPEC/Pages/Index.razor.cs +++ b/MP.SPEC/Pages/Index.razor.cs @@ -18,7 +18,7 @@ namespace MP.SPEC.Pages protected MpDataService MDService { get; set; } = null!; [Inject] - protected MessageService MessageService { get; set; } = null!; + protected MsgServiceSpec MessageService { get; set; } = null!; #endregion Protected Properties diff --git a/MP.SPEC/Pages/KIT.razor b/MP.SPEC/Pages/KIT.razor index 282e313a..af93f106 100644 --- a/MP.SPEC/Pages/KIT.razor +++ b/MP.SPEC/Pages/KIT.razor @@ -6,7 +6,8 @@
-

KIT

+ KIT + Definizione KIT multiprodotto per singolo ciclo
@@ -16,7 +17,7 @@ @if (enabKitCount) {
- +
}
@@ -31,40 +32,80 @@
- @if (currRecord != null) + @if (EditRecord != null) { -
+ @if (doSearchArt) + { + + + + } +
-
+
Modifica
-
- Art Parent - +
+ @if (string.IsNullOrEmpty(EditRecord.CodArtParent)) + { + + } + else + { + + } +
-
- Art Child - -
-
-
-
- Qty relativa - -
-
-
- -
-
- @if (currRecord.Qty > 0 && !string.IsNullOrEmpty(currRecord.CodArtParent) && !string.IsNullOrEmpty(currRecord.CodArtChild)) + @if (string.IsNullOrEmpty(EditRecord.CodArtChild)) { - +
+ +
+ + +
+
+ } + else + { +
+ + +
+ } +
+
+
+ + +
+
+
+ +
+
+ @if (EditRecord.Qty > 0 && !string.IsNullOrEmpty(EditRecord.CodArtParent) && !string.IsNullOrEmpty(EditRecord.CodArtChild)) + { + } else { @@ -91,7 +132,7 @@ @if (enabKitSearch && !string.IsNullOrEmpty(SearchParent) && totalCount == 0) {
- +
}
@@ -104,14 +145,14 @@ - @if (currRecord != null) + @if (EditRecord != null) { } - Articolo Parent - Articolo Child - KIT Qty + Cod Kit (Parent) + Articolo (Child) + Art/Kit Qty diff --git a/MP.SPEC/Pages/KIT.razor.cs b/MP.SPEC/Pages/KIT.razor.cs index d23173c7..a7d55d73 100644 --- a/MP.SPEC/Pages/KIT.razor.cs +++ b/MP.SPEC/Pages/KIT.razor.cs @@ -29,7 +29,7 @@ namespace MP.SPEC.Pages public void Dispose() { - currRecord = null; + EditRecord = null; ListTipoArt = null; ListAziende = null; SearchRecords = null; @@ -146,7 +146,7 @@ namespace MP.SPEC.Pages codParent = ""; } } - currRecord = new TemplateKitModel() + EditRecord = new TemplateKitModel() { CodArtParent = codParent, CodArtChild = "", @@ -157,7 +157,7 @@ namespace MP.SPEC.Pages protected async Task DoCancel() { - currRecord = null; + EditRecord = null; ReloadData(); await Task.Delay(1); } @@ -171,7 +171,7 @@ namespace MP.SPEC.Pages CodArtChild = "",//selRec.CodArtParent, Qty = selRec.Qty }; - currRecord = newRec; + EditRecord = newRec; await Task.Delay(1); } @@ -187,7 +187,7 @@ namespace MP.SPEC.Pages await Task.Delay(1); var done = await MDService.TemplateKitDelete(selRec); - currRecord = null; + EditRecord = null; ReloadData(); await Task.Delay(1); } @@ -199,7 +199,7 @@ namespace MP.SPEC.Pages await Task.Delay(1); var done = await MDService.TemplateKitUpsert(selRec); - currRecord = null; + EditRecord = null; ReloadData(); await Task.Delay(1); } @@ -239,7 +239,7 @@ namespace MP.SPEC.Pages protected void ResetData() { - currRecord = null; + EditRecord = null; } protected void ResetParent() @@ -250,12 +250,12 @@ namespace MP.SPEC.Pages protected void ResetSel() { - currRecord = null; + EditRecord = null; } protected void SelRecord(TemplateKitModel selRec) { - currRecord = selRec; + EditRecord = selRec; } protected void SetNumPage(int newNum) @@ -271,7 +271,7 @@ namespace MP.SPEC.Pages protected void UpdateData() { - currRecord = null; + EditRecord = null; ReloadData(); } @@ -279,14 +279,27 @@ namespace MP.SPEC.Pages #region Private Fields - private TemplateKitModel? currRecord = null; + /// + /// Boolear controllo visualizzazione ricerca articoli + /// + private bool doSearchArt = false; + + private TemplateKitModel? EditRecord = null; + private bool enabKitCount = false; + private bool enabKitSearch = false; + private List? ListAziende; + private List? ListRecords; + private List? ListTipoArt; + private int minChar = 2; + private string sCodChild = ""; + private List? SearchRecords; #endregion Private Fields @@ -294,6 +307,7 @@ namespace MP.SPEC.Pages #region Private Properties private int _currPage { get; set; } = 1; + private int _numRecord { get; set; } = 10; private int currPage @@ -325,6 +339,7 @@ namespace MP.SPEC.Pages } private string sCodParent { get; set; } = ""; + private bool ShowCharts { get; set; } = false; #endregion Private Properties @@ -342,6 +357,27 @@ namespace MP.SPEC.Pages isLoading = false; } + /// + /// Toggle modale ricerca articoli + /// + private void SearchArtToggle() + { + doSearchArt = !doSearchArt; + } + + /// + /// Salva selezione articolo + /// + /// + private void SetCodArtChild(string codArt) + { + if (EditRecord != null) + { + EditRecord.CodArtChild = codArt; + doSearchArt = false; + } + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.SPEC/Pages/TestBtn.razor.cs b/MP.SPEC/Pages/TestBtn.razor.cs index 4f88a6c7..82bfe58d 100644 --- a/MP.SPEC/Pages/TestBtn.razor.cs +++ b/MP.SPEC/Pages/TestBtn.razor.cs @@ -22,7 +22,7 @@ namespace MP.SPEC.Pages public partial class TestBtn { [Inject] - protected MessageService MService { get; set; } = null!; + protected MsgServiceSpec MService { get; set; } = null!; public EventCallback newBcMsg { get; set; } diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index 321a060f..75ca897f 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.FileProviders; +using MP.Data.Services; using MP.SPEC.Components; using MP.SPEC.Data; using MP.SPEC.Services; @@ -56,12 +57,13 @@ builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(redisMultiplexer); builder.Services.AddSingleton(); -builder.Services.AddScoped(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); +builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); builder.Services.AddBlazoredSessionStorage(); builder.Services.AddHttpClient(); -builder.Services.AddSingleton(); logger.Info("Aggiunti services"); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index d614d506..8070d5e2 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.919

+

Versione: 6.16.2504.1007


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index f657b0d1..0269c5cd 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.919 +6.16.2504.1007 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index a60e1ca4..7fbd1950 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.919 + 6.16.2504.1007 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 diff --git a/MP.SPEC/appsettings.Production.json b/MP.SPEC/appsettings.Production.json index b8e8fcb2..1980ac8c 100644 --- a/MP.SPEC/appsettings.Production.json +++ b/MP.SPEC/appsettings.Production.json @@ -9,6 +9,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { + "MP.All": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Flux": "Server=localhost\\SQLEXPRESS;Database=MoonPro_FluxData; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Inve": "Server=localhost\\SQLEXPRESS;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", diff --git a/MP.SPEC/appsettings.json b/MP.SPEC/appsettings.json index 1d4c6534..f37378f6 100644 --- a/MP.SPEC/appsettings.json +++ b/MP.SPEC/appsettings.json @@ -48,6 +48,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { + "MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Flux": "Server=SQL2016DEV;Database=MoonPro_FluxData; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;", "MP.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",