From b0804c78e720c049c8f5e5dbeb9b421f46da6525 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 2 Aug 2024 09:10:25 +0200 Subject: [PATCH] Update gestioen spezzoni - fix calcolo qta - fix display - fix stored ricerca --- .../Controllers/TenantController.cs | 5 ++-- MagMan.Data.Tenant/Services/TenantService.cs | 10 ++++--- MagMan.UI/Components/AliasEdit.razor.cs | 4 +-- MagMan.UI/Components/ItemEdit.razor.cs | 12 ++++----- MagMan.UI/Components/ItemMan.razor.cs | 16 +++++------ MagMan.UI/Components/MaterialEdit.razor.cs | 2 +- MagMan.UI/Components/MaterialMan.razor | 12 ++++++++- MagMan.UI/Components/MaterialMan.razor.cs | 27 ++++++++++++++++++- MagMan.UI/Controllers/MaterialsController.cs | 4 +-- MagMan.UI/MagMan.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 13 files changed, 69 insertions(+), 31 deletions(-) diff --git a/MagMan.Data.Tenant/Controllers/TenantController.cs b/MagMan.Data.Tenant/Controllers/TenantController.cs index 5442ea4..56cf54f 100644 --- a/MagMan.Data.Tenant/Controllers/TenantController.cs +++ b/MagMan.Data.Tenant/Controllers/TenantController.cs @@ -704,8 +704,9 @@ namespace MagMan.Data.Tenant.Controllers /// /// Stringa connessione (variabile x cliente) /// Se true allora include record child (Items) + /// Se true allora include record remnants (Items) nei conteggi qty /// - public List MaterialDtoGetAll(string connString, bool withChild) + public List MaterialDtoGetAll(string connString, bool withChild, bool withRemn) { List dbResult = new List(); using (MagManContext dbCtx = new MagManContext(connString)) @@ -725,7 +726,7 @@ namespace MagMan.Data.Tenant.Controllers LMm = x.LMm, WMm = x.WMm, SizeNum = x.RawItemList == null ? 0 : x.RawItemList.Where(x => x.IsActive).Count(), - QtyTot = x.RawItemList == null ? 0 : calcQty(x.IsBeam, x.RawItemList.Where(x => x.IsActive).ToList()), + QtyTot = x.RawItemList == null ? 0 : calcQty(x.IsBeam, x.RawItemList.Where(x => x.IsActive && (withRemn || !x.IsRemn)).ToList()), MatDtmx = x.MatDtmx, IsBeam = x.IsBeam, IsWall = x.IsWall, diff --git a/MagMan.Data.Tenant/Services/TenantService.cs b/MagMan.Data.Tenant/Services/TenantService.cs index 7268fe9..8d8f443 100644 --- a/MagMan.Data.Tenant/Services/TenantService.cs +++ b/MagMan.Data.Tenant/Services/TenantService.cs @@ -679,16 +679,18 @@ namespace MagMan.Data.Tenant.Services /// /// Key di riferimento /// Se true allora include record child (Items) + /// Se true allora include record remnants (Items) nei conteggi qty /// - public async Task> MaterialDtoGetAll(int nKey, bool withChild) + public async Task> MaterialDtoGetAll(int nKey, bool withChild, bool withRemn) { string source = "DB"; string cString = ConnString(nKey); List? dbResult = new List(); try { - string dType = withChild ? "MaterialsDtoFull" : "MaterialsDto"; - string currKey = $"{Const.rKeyConfig}:{nKey}:{dType}"; + string dType = withChild ? "MatDtoFull" : "MatDto"; + string remn = withRemn ? "All" : "Buy"; + string currKey = $"{Const.rKeyConfig}:{nKey}:{remn}:{dType}"; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string? rawData = await redisDb.StringGetAsync(currKey); @@ -707,7 +709,7 @@ namespace MagMan.Data.Tenant.Services } else { - dbResult = dbController.MaterialDtoGetAll(cString, withChild); + dbResult = dbController.MaterialDtoGetAll(cString, withChild, withRemn); rawData = JsonConvert.SerializeObject(dbResult, JSSettings); await redisDb.StringSetAsync(currKey, rawData, LongCache); // per evitare loopback uso deserialize... diff --git a/MagMan.UI/Components/AliasEdit.razor.cs b/MagMan.UI/Components/AliasEdit.razor.cs index 3a7867d..a0487c9 100644 --- a/MagMan.UI/Components/AliasEdit.razor.cs +++ b/MagMan.UI/Components/AliasEdit.razor.cs @@ -73,11 +73,11 @@ namespace MagMan.UI.Components protected async Task ReloadData() { // rileggo TUTTI i materiali - AllMaterials = await TService.MaterialDtoGetAll(KeyNum, false); + AllMaterials = await TService.MaterialDtoGetAll(KeyNum, false, false); // proietto elenco alias ammissibili ListAliasTarget = AllMaterials .GroupBy(x => x.MatCode) - .Select(grp=> grp.First()) + .Select(grp => grp.First()) .OrderBy(x => x.MatCode) .Select(x => x.MatCode) .ToList(); diff --git a/MagMan.UI/Components/ItemEdit.razor.cs b/MagMan.UI/Components/ItemEdit.razor.cs index 20412b9..629c54d 100644 --- a/MagMan.UI/Components/ItemEdit.razor.cs +++ b/MagMan.UI/Components/ItemEdit.razor.cs @@ -25,6 +25,12 @@ namespace MagMan.UI.Components [Inject] protected MessageService AppMService { get; set; } = null!; + protected bool IsAcquisto + { + get => !(CurrRecord!.IsRemn); + set => CurrRecord!.IsRemn = !value; + } + [Inject] protected TenantService TService { get; set; } = null!; @@ -51,12 +57,6 @@ namespace MagMan.UI.Components } } - protected bool IsAcquisto - { - get => !(CurrRecord!.IsRemn); - set => CurrRecord!.IsRemn = !value; - } - #endregion Protected Methods #region Private Properties diff --git a/MagMan.UI/Components/ItemMan.razor.cs b/MagMan.UI/Components/ItemMan.razor.cs index b071938..cd35289 100644 --- a/MagMan.UI/Components/ItemMan.razor.cs +++ b/MagMan.UI/Components/ItemMan.razor.cs @@ -55,10 +55,6 @@ namespace MagMan.UI.Components { get => onlyActive ? "Solo Attivi" : "Mostra Eliminati"; } - protected string remnMessage - { - get => "Mostra Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto"; - } [Inject] protected MessageService AppMService { get; set; } = null!; @@ -86,6 +82,12 @@ namespace MagMan.UI.Components } } } + + protected string remnMessage + { + get => "Mostra Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto"; + } + protected bool ShowRemn { get => showRemn; @@ -126,6 +128,7 @@ namespace MagMan.UI.Components } return answ; } + protected async Task CreateNew() { string matNote = $"{MaterialSel.MatCode.Replace("_", " ")}"; @@ -262,12 +265,9 @@ namespace MagMan.UI.Components private List? ListRecords = null; private bool onlyActive = true; - private bool showRemn = false; - private int RawItemId = 0; - private List? SearchRecords = null; - + private bool showRemn = false; private bool sortAsc = true; private string sortField = ""; diff --git a/MagMan.UI/Components/MaterialEdit.razor.cs b/MagMan.UI/Components/MaterialEdit.razor.cs index 6141e08..6a714b7 100644 --- a/MagMan.UI/Components/MaterialEdit.razor.cs +++ b/MagMan.UI/Components/MaterialEdit.razor.cs @@ -59,7 +59,7 @@ namespace MagMan.UI.Components if (!IsEditRec) { // verifico SE esista già un materiale uguale x dimensioni / tipo... - var matList = await TService.MaterialDtoGetAll(KeyNum, false); + var matList = await TService.MaterialDtoGetAll(KeyNum, false, false); if (CurrRecord != null) { var sameRec = matList diff --git a/MagMan.UI/Components/MaterialMan.razor b/MagMan.UI/Components/MaterialMan.razor index a9e3918..f4eb17a 100644 --- a/MagMan.UI/Components/MaterialMan.razor +++ b/MagMan.UI/Components/MaterialMan.razor @@ -2,7 +2,17 @@
-

Materiali

+
+
+

Materiali

+
+
+
+ + +
+
+
diff --git a/MagMan.UI/Components/MaterialMan.razor.cs b/MagMan.UI/Components/MaterialMan.razor.cs index ebdf8b3..34db5cc 100644 --- a/MagMan.UI/Components/MaterialMan.razor.cs +++ b/MagMan.UI/Components/MaterialMan.razor.cs @@ -50,6 +50,30 @@ namespace MagMan.UI.Components [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + protected string remnMessage + { + get => showRemn ? "Acquisto + Spezzoni" : "Solo Acquisto"; + //get => "Spezzoni";// showRemn ? "Mostra Spezzoni" : "Solo Acquisto"; + } + + protected bool ShowRemn + { + get => showRemn; + set + { + if (showRemn != value) + { + showRemn = value; + DoSelect(null); + var pUpd = Task.Run(async () => + { + await ForceReload(true); + }); + pUpd.Wait(); + } + } + } + protected int totalCount { get; set; } = 0; [Inject] @@ -176,6 +200,7 @@ namespace MagMan.UI.Components private List? ListRecords = null; private int MaterialId = 0; private List? SearchRecords = null; + private bool showRemn = false; private bool sortAsc = true; private string sortField = ""; @@ -247,7 +272,7 @@ namespace MagMan.UI.Components { isLoading = true; ListRecords = null; - SearchRecords = await TService.MaterialDtoGetAll(KeyNum, false); + SearchRecords = await TService.MaterialDtoGetAll(KeyNum, false, showRemn); // verifico se filtrare x beam/wall if (FiltType > 0) { diff --git a/MagMan.UI/Controllers/MaterialsController.cs b/MagMan.UI/Controllers/MaterialsController.cs index e3c7257..f77c843 100644 --- a/MagMan.UI/Controllers/MaterialsController.cs +++ b/MagMan.UI/Controllers/MaterialsController.cs @@ -61,10 +61,10 @@ namespace MagMan.UI.Controllers /// /// Elenco Materiali dato RestToken + /// GET api/Materials/00000000-0000-0000-0000-000000000000 /// /// Rest Token cliente /// - // GET api/Materials/00000000-0000-0000-0000-000000000000 [HttpGet("{id}")] public async Task> Get(string id) { @@ -72,7 +72,7 @@ namespace MagMan.UI.Controllers // in primis recupero codice chiave da token... int nKey = await MTAdmService.MainKeyByToken(id); // ora recupero direttamente i materiali - ListDto = await TService.MaterialDtoGetAll(nKey, false); + ListDto = await TService.MaterialDtoGetAll(nKey, false, true); return ListDto; } diff --git a/MagMan.UI/MagMan.UI.csproj b/MagMan.UI/MagMan.UI.csproj index 123d299..cafc14e 100644 --- a/MagMan.UI/MagMan.UI.csproj +++ b/MagMan.UI/MagMan.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2408.0208 + 1.0.2408.0209 enable enable true diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index ab62d39..3139871 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MagMan - Wood Warehouse Management System -

Versione: 1.0.2408.0208

+

Versione: 1.0.2408.0209


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index e86f929..ef77f36 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2408.0208 +1.0.2408.0209 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 92d4c6d..a1baa86 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2408.0208 + 1.0.2408.0209 http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html false