From 32999677ea7bb7529809a45a5ccc0ea5c09e56fd Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 25 Jan 2024 19:44:28 +0100 Subject: [PATCH] Aggiunta registrazione tipii comvimento in mag --- MagMan.Core/Services/MessageService.cs | 4 +- .../Controllers/TenantController.cs | 139 +++++-- MagMan.Data.Tenant/Services/TenantService.cs | 354 +++++++++--------- MagMan.UI/Components/ItemEdit.razor.cs | 30 +- MagMan.UI/Components/ItemMan.razor.cs | 2 +- MagMan.UI/Components/LoginDisplay.razor.cs | 23 +- MagMan.UI/Components/MovMag.razor | 61 ++- MagMan.UI/Controllers/InventoryController.cs | 2 +- MagMan.UI/Controllers/ResourcesController.cs | 16 +- MagMan.UI/MagMan.UI.csproj | 2 +- MagMan.UI/Pages/WareHouse.razor | 1 + Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 14 files changed, 379 insertions(+), 261 deletions(-) diff --git a/MagMan.Core/Services/MessageService.cs b/MagMan.Core/Services/MessageService.cs index 53e12ad..8ce9bbc 100644 --- a/MagMan.Core/Services/MessageService.cs +++ b/MagMan.Core/Services/MessageService.cs @@ -30,7 +30,7 @@ namespace MagMan.Core.Services public event Action EA_PageUpdated = null!; public event Action EA_SearchUpdated = null!; public event Action EA_ShowSearch = null!; - public event Action EA_CustomerSel = null!; + public event Action EA_CustomerSel = null!; #endregion Public Events @@ -57,6 +57,8 @@ namespace MagMan.Core.Services #region Public Properties + public string UserName { get; set; } = "NA"; + public string PageIcon { get => _pageIcon; diff --git a/MagMan.Data.Tenant/Controllers/TenantController.cs b/MagMan.Data.Tenant/Controllers/TenantController.cs index 8503907..873a760 100644 --- a/MagMan.Data.Tenant/Controllers/TenantController.cs +++ b/MagMan.Data.Tenant/Controllers/TenantController.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace MagMan.Data.Tenant.Controllers { @@ -23,30 +24,6 @@ namespace MagMan.Data.Tenant.Controllers #endregion Public Constructors - - /// - /// Elenco MovMag dato Item - /// - /// Stringa connessione (variabile x cliente) - /// ID dell'item x cui filtrare, 0 = tutti - /// numMax record da leggere, default 1000 - /// - public List MovMagGetFilt(string connString, int rawItemID, int maxRec = 1000) - { - List dbResult = new List(); - using (MagManContext dbCtx = new MagManContext(connString)) - { - dbResult = dbCtx - .DbSetMovMag - .Where(x => rawItemID == 0 || x.RawItemId == rawItemID) - //.Include(c => c.ItemNav) - .OrderByDescending(x => x.DtRec) - .Take(maxRec) - .ToList(); - } - return dbResult; - } - #region Public Methods public async Task DatabaseMigrate(string connString) @@ -144,11 +121,15 @@ namespace MagMan.Data.Tenant.Controllers return dbResult; } - /// Aggiunge/Modifica un item in magazzino Stringa connessione (variabile x cliente) Record da aggiornare quantità da - /// aggiornare (se <0 è consumo) - public bool ItemModQty(string connString, RawItemModel rec2upd, int deltaQty) + /// + /// Aggiunge/Modifica un item in magazzino + /// + /// Stringa connessione (variabile x cliente) + /// Record da aggiornare + /// quantità da aggiornare (se <0 è consumo) + /// User corrente (SE applicabile) + /// + public bool ItemModQty(string connString, RawItemModel rec2upd, int deltaQty, string userId) { bool done = false; using (MagManContext dbCtx = new MagManContext(connString)) @@ -167,6 +148,16 @@ namespace MagMan.Data.Tenant.Controllers .FirstOrDefault(); if (currData != null) { + MovMagModel recMovMag = new MovMagModel() + { + DtRec = DateTime.Now, + RawItemId = rec2upd.RawItemId, + QtyRec = deltaQty, + UserId = userId, + Note = deltaQty > 0 ? "M01+: Rettifica Inventariale" : "M01-: Rettifica Inventariale" + }; + dbCtx.DbSetMovMag.Add(recMovMag); + currData.QtyAvail += deltaQty; dbCtx.Entry(currData).State = EntityState.Modified; } @@ -186,8 +177,9 @@ namespace MagMan.Data.Tenant.Controllers /// /// Stringa connessione (variabile x cliente) /// Record da aggiungere/aggiornare + /// User corrente (SE applicabile) /// - public bool ItemUpdate(string connString, RawItemModel rec2upd) + public bool ItemUpdate(string connString, RawItemModel rec2upd, string userId) { bool done = false; using (MagManContext dbCtx = new MagManContext(connString)) @@ -206,6 +198,22 @@ namespace MagMan.Data.Tenant.Controllers .FirstOrDefault(); if (currData != null) { + // aggiungo record variazione quantità... + int delta = rec2upd.QtyAvail - currData.QtyAvail; + if (delta != 0) + { + MovMagModel recMovMag = new MovMagModel() + { + DtRec = DateTime.Now, + RawItemId = rec2upd.RawItemId, + QtyRec = delta, + UserId = userId, + Note = delta > 0 ? "M02+: Rettifica Inventariale" : "M02-: Rettifica Inventariale" + }; + dbCtx.DbSetMovMag.Add(recMovMag); + } + + // sistemo record... currData.MatId = rec2upd.MatId; currData.QtyAvail = rec2upd.QtyAvail; currData.IsActive = rec2upd.IsActive; @@ -222,6 +230,17 @@ namespace MagMan.Data.Tenant.Controllers dbCtx .DbSetItems .Add(rec2upd); + dbCtx.SaveChanges(); + + // aggiungo record variazione quantità... + MovMagModel recMovMag = new MovMagModel() + { + DtRec = DateTime.Now, + RawItemId = rec2upd.RawItemId, + QtyRec = rec2upd.QtyAvail, + Note = rec2upd.QtyAvail > 0 ? "M03+: Aggiunta Record" : "M03+: Aggiunta Record" + }; + dbCtx.DbSetMovMag.Add(recMovMag); } dbCtx.SaveChanges(); done = true; @@ -449,6 +468,29 @@ namespace MagMan.Data.Tenant.Controllers return done; } + /// + /// Elenco MovMag dato Item + /// + /// Stringa connessione (variabile x cliente) + /// ID dell'item x cui filtrare, 0 = tutti + /// numMax record da leggere, default 1000 + /// + public List MovMagGetFilt(string connString, int rawItemID, int maxRec = 1000) + { + List dbResult = new List(); + using (MagManContext dbCtx = new MagManContext(connString)) + { + dbResult = dbCtx + .DbSetMovMag + .Where(x => rawItemID == 0 || x.RawItemId == rawItemID) + //.Include(c => c.ItemNav) + .OrderByDescending(x => x.DtRec) + .Take(maxRec) + .ToList(); + } + return dbResult; + } + /// /// Elimina record Project /// @@ -770,10 +812,10 @@ namespace MagMan.Data.Tenant.Controllers /// /// Stringa connessione (variabile x cliente) /// Elenco record da aggiungere/aggiornare - /// > /// Tipo di aggiornamento da registratre + /// User corrente (SE applicabile) /// - public int ResourceUpdate(string connString, List recList, Enums.ProjResState resState) + public int ResourceUpdate(string connString, List recList, Enums.ProjResState resState, string userId) { int numMod = 0; using (MagManContext dbCtx = new MagManContext(connString)) @@ -793,12 +835,45 @@ namespace MagMan.Data.Tenant.Controllers // aggiorno if (currData != null) { + if (resState == Enums.ProjResState.Consumed) + { + // aggiungo record variazione quantità... + int delta = rec2upd.Qty - currData.Qty; + if (delta != 0) + { + MovMagModel recMovMag = new MovMagModel() + { + DtRec = DateTime.Now, + RawItemId = rec2upd.RawItemId, + QtyRec = delta, + UserId = userId, + Note = delta > 0 ? "M04+: Aggiunta Risorsa" : "M04-: Consumo Risorsa" + }; + dbCtx.DbSetMovMag.Add(recMovMag); + } + } + + // aggiorno le risorse currData.Qty = rec2upd.Qty; currData.RawItemId = rec2upd.RawItemId; dbCtx.Entry(currData).State = EntityState.Modified; } else { + if (resState == Enums.ProjResState.Consumed) + { + // aggiungo record variazione quantità... + MovMagModel recMovMag = new MovMagModel() + { + DtRec = DateTime.Now, + RawItemId = rec2upd.RawItemId, + QtyRec = rec2upd.Qty, + UserId = userId, + Note = rec2upd.Qty > 0 ? "M05+: Aggiunta Risorsa" : "M05-: Consumo Risorsa" + }; + dbCtx.DbSetMovMag.Add(recMovMag); + } + // aggiungo record dbCtx .DbSetResources diff --git a/MagMan.Data.Tenant/Services/TenantService.cs b/MagMan.Data.Tenant/Services/TenantService.cs index a911361..52d4510 100644 --- a/MagMan.Data.Tenant/Services/TenantService.cs +++ b/MagMan.Data.Tenant/Services/TenantService.cs @@ -206,70 +206,19 @@ namespace MagMan.Data.Tenant.Services } /// - /// Elenco MovMag dato Item + /// Update record Item per quantità + refresh cache /// /// Key di riferimento - /// ID dell'item x cui filtrare, 0 = tutti - /// numMax record da leggere, default 1000 + /// Item interesato + /// User corrente (SE applicabile) /// - public async Task> MovMagGetFilt(int nKey, int rawItemID, int maxRec = 1000) - { - string source = "DB"; - string cString = ConnString(nKey); - List? dbResult = new List(); - try - { - // in cache tengo dati estratti ogni minuto... - string dtKey = DateTime.Now.ToString("yyMMdd:HHmm"); - string currKey = $"{Const.rKeyConfig}:{nKey}:MovMag:{rawItemID}:{dtKey}"; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string? rawData = await redisDb.StringGetAsync(currKey); - if (!string.IsNullOrEmpty(rawData)) - { - source = "REDIS"; - var tempResult = JsonConvert.DeserializeObject>(rawData); - if (tempResult == null) - { - dbResult = new List(); - } - else - { - dbResult = tempResult; - } - } - else - { - dbResult = dbController.MovMagGetFilt(cString, rawItemID, maxRec); - rawData = JsonConvert.SerializeObject(dbResult, JSSettings); - await redisDb.StringSetAsync(currKey, rawData, LongCache); - } - if (dbResult == null) - { - dbResult = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"MovMagGetFilt | {source} in: {ts.TotalMilliseconds} ms"); - } - catch (Exception exc) - { - Log.Error($"Error during MovMagGetFilt:{Environment.NewLine}{exc}"); - } - return dbResult; - } - - - /// Update record Item + refresh cache Key di - /// riferimento Item interesato quantità da aggiornare (se <0 è consumo) - public async Task ItemModQty(int nKey, RawItemModel currItem, int deltaQty) + public async Task ItemModQty(int nKey, RawItemModel currItem, int deltaQty, string userId) { bool fatto = false; string cString = ConnString(nKey); try { - fatto = dbController.ItemModQty(cString, currItem, deltaQty); + fatto = dbController.ItemModQty(cString, currItem, deltaQty, userId); if (fatto) { await FlushRedisCache(); @@ -287,14 +236,15 @@ namespace MagMan.Data.Tenant.Services /// /// Key di riferimento /// Item interesato + /// User corrente (SE applicabile) /// - public async Task ItemUpdate(int nKey, RawItemModel currItem) + public async Task ItemUpdate(int nKey, RawItemModel currItem, string userId) { bool fatto = false; string cString = ConnString(nKey); try { - fatto = dbController.ItemUpdate(cString, currItem); + fatto = dbController.ItemUpdate(cString, currItem, userId); if (fatto) { await FlushRedisCache(); @@ -332,6 +282,64 @@ namespace MagMan.Data.Tenant.Services return fatto; } + /// + /// Lista Materiali gestiti a magazzino in formato DTO + /// + /// Key di riferimento + /// Se true allora include record child (Items) + /// + public async Task> MaterialDtoGetAll(int nKey, bool withChild) + { + string source = "DB"; + string cString = ConnString(nKey); + List? dbResult = new List(); + try + { + string dType = withChild ? "MaterialsDtoFull" : "MaterialsDto"; + string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}"; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string? rawData = await redisDb.StringGetAsync(currKey); + if (!string.IsNullOrEmpty(rawData)) + { + source = "REDIS"; + var tempResult = JsonConvert.DeserializeObject>(rawData); + if (tempResult == null) + { + dbResult = new List(); + } + else + { + dbResult = tempResult; + } + } + else + { + dbResult = dbController.MaterialDtoGetAll(cString, withChild); + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + // per evitare loopback uso deserialize... + var tempResult = JsonConvert.DeserializeObject>(rawData); + if (tempResult != null) + { + dbResult = tempResult; + } + } + if (dbResult == null) + { + dbResult = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"MaterialDtoGetAll | {source} in: {ts.TotalMilliseconds} ms"); + } + catch (Exception exc) + { + Log.Error($"Error during MaterialDtoGetAll:{Environment.NewLine}{exc}"); + } + return dbResult; + } + /// /// Converte il DTO in MaterialModel /// @@ -413,64 +421,6 @@ namespace MagMan.Data.Tenant.Services return dbResult; } - /// - /// Lista Materiali gestiti a magazzino in formato DTO - /// - /// Key di riferimento - /// Se true allora include record child (Items) - /// - public async Task> MaterialDtoGetAll(int nKey, bool withChild) - { - string source = "DB"; - string cString = ConnString(nKey); - List? dbResult = new List(); - try - { - string dType = withChild ? "MaterialsDtoFull" : "MaterialsDto"; - string currKey = $"{Const.rKeyConfig}:{dType}:{nKey}"; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string? rawData = await redisDb.StringGetAsync(currKey); - if (!string.IsNullOrEmpty(rawData)) - { - source = "REDIS"; - var tempResult = JsonConvert.DeserializeObject>(rawData); - if (tempResult == null) - { - dbResult = new List(); - } - else - { - dbResult = tempResult; - } - } - else - { - dbResult = dbController.MaterialDtoGetAll(cString, withChild); - rawData = JsonConvert.SerializeObject(dbResult, JSSettings); - await redisDb.StringSetAsync(currKey, rawData, LongCache); - // per evitare loopback uso deserialize... - var tempResult = JsonConvert.DeserializeObject>(rawData); - if (tempResult != null) - { - dbResult = tempResult; - } - } - if (dbResult == null) - { - dbResult = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"MaterialDtoGetAll | {source} in: {ts.TotalMilliseconds} ms"); - } - catch (Exception exc) - { - Log.Error($"Error during MaterialDtoGetAll:{Environment.NewLine}{exc}"); - } - return dbResult; - } - /// /// Lista Materiali gestiti a magazzino /// @@ -555,6 +505,60 @@ namespace MagMan.Data.Tenant.Services return fatto; } + /// + /// Elenco MovMag dato Item + /// + /// Key di riferimento + /// ID dell'item x cui filtrare, 0 = tutti + /// numMax record da leggere, default 1000 + /// + public async Task> MovMagGetFilt(int nKey, int rawItemID, int maxRec = 1000) + { + string source = "DB"; + string cString = ConnString(nKey); + List? dbResult = new List(); + try + { + // in cache tengo dati estratti ogni minuto... + string dtKey = DateTime.Now.ToString("yyMMdd:HHmm"); + string currKey = $"{Const.rKeyConfig}:{nKey}:MovMag:{rawItemID}:{dtKey}"; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string? rawData = await redisDb.StringGetAsync(currKey); + if (!string.IsNullOrEmpty(rawData)) + { + source = "REDIS"; + var tempResult = JsonConvert.DeserializeObject>(rawData); + if (tempResult == null) + { + dbResult = new List(); + } + else + { + dbResult = tempResult; + } + } + else + { + dbResult = dbController.MovMagGetFilt(cString, rawItemID, maxRec); + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (dbResult == null) + { + dbResult = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"MovMagGetFilt | {source} in: {ts.TotalMilliseconds} ms"); + } + catch (Exception exc) + { + Log.Error($"Error during MovMagGetFilt:{Environment.NewLine}{exc}"); + } + return dbResult; + } + /// /// Elimina record Project + refresh cache /// @@ -780,61 +784,6 @@ namespace MagMan.Data.Tenant.Services return answ; } - /// - /// Elenco risorse dato progetto e stato - /// - /// Key di riferimento - /// ID progetto - /// true = ultima stima attiva / false = consumi effettivi - /// true= mostra ANCHE archiviate, false = solo attive - /// - public async Task> ResourcesGetByProject(int nKey, int projDbId, bool isEstim, bool showAll) - { - string source = "DB"; - string cString = ConnString(nKey); - List? dbResult = new List(); - try - { - string tagEst = isEstim ? "EST" : "CON"; - string tagAct = showAll ? "ALL" : "ACT"; - string currKey = $"{Const.rKeyConfig}:{nKey}:ResList:{projDbId}:{tagEst}:{tagAct}"; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string? rawData = await redisDb.StringGetAsync(currKey); - if (!string.IsNullOrEmpty(rawData)) - { - source = "REDIS"; - var tempResult = JsonConvert.DeserializeObject>(rawData); - if (tempResult == null) - { - dbResult = new List(); - } - else - { - dbResult = tempResult; - } - } - else - { - dbResult = dbController.ResourcesGetByProject(cString, projDbId, isEstim, showAll); - rawData = JsonConvert.SerializeObject(dbResult, JSSettings); - await redisDb.StringSetAsync(currKey, rawData, FastCache); - } - if (dbResult == null) - { - dbResult = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ResourcesGetByProject | {source} in: {ts.TotalMilliseconds} ms"); - } - catch (Exception exc) - { - Log.Error($"Error during ResourcesGetByProject:{Environment.NewLine}{exc}"); - } - return dbResult; - } - /// /// Elenco risorse dato progetto e stato /// @@ -890,20 +839,77 @@ namespace MagMan.Data.Tenant.Services return dbResult; } + /// + /// Elenco risorse dato progetto e stato + /// + /// Key di riferimento + /// ID progetto + /// true = ultima stima attiva / false = consumi effettivi + /// true= mostra ANCHE archiviate, false = solo attive + /// + public async Task> ResourcesGetByProject(int nKey, int projDbId, bool isEstim, bool showAll) + { + string source = "DB"; + string cString = ConnString(nKey); + List? dbResult = new List(); + try + { + string tagEst = isEstim ? "EST" : "CON"; + string tagAct = showAll ? "ALL" : "ACT"; + string currKey = $"{Const.rKeyConfig}:{nKey}:ResList:{projDbId}:{tagEst}:{tagAct}"; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string? rawData = await redisDb.StringGetAsync(currKey); + if (!string.IsNullOrEmpty(rawData)) + { + source = "REDIS"; + var tempResult = JsonConvert.DeserializeObject>(rawData); + if (tempResult == null) + { + dbResult = new List(); + } + else + { + dbResult = tempResult; + } + } + else + { + dbResult = dbController.ResourcesGetByProject(cString, projDbId, isEstim, showAll); + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + await redisDb.StringSetAsync(currKey, rawData, FastCache); + } + if (dbResult == null) + { + dbResult = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ResourcesGetByProject | {source} in: {ts.TotalMilliseconds} ms"); + } + catch (Exception exc) + { + Log.Error($"Error during ResourcesGetByProject:{Environment.NewLine}{exc}"); + } + return dbResult; + } + /// /// Aggiunge/Modifica un record Resource /// /// Key di riferimento - /// Elenco record da aggiungere/aggiornare> + /// Elenco record da aggiungere/aggiornare + /// > /// Tipo di aggiornamento da registratre + /// User corrente (SE applicabile) /// - public async Task ResourceUpdate(int nKey, List recList, Enums.ProjResState resState) + public async Task ResourceUpdate(int nKey, List recList, Enums.ProjResState resState, string userId) { int newId = 0; string cString = ConnString(nKey); try { - newId = dbController.ResourceUpdate(cString, recList, resState); + newId = dbController.ResourceUpdate(cString, recList, resState, userId); if (newId > 0) { await FlushRedisCache(); diff --git a/MagMan.UI/Components/ItemEdit.razor.cs b/MagMan.UI/Components/ItemEdit.razor.cs index 451b3ec..f227cdb 100644 --- a/MagMan.UI/Components/ItemEdit.razor.cs +++ b/MagMan.UI/Components/ItemEdit.razor.cs @@ -1,3 +1,4 @@ +using MagMan.Core.Services; using MagMan.Data.Tenant.DbModels; using MagMan.Data.Tenant.Services; using Microsoft.AspNetCore.Components; @@ -11,15 +12,19 @@ namespace MagMan.UI.Components [Parameter] public RawItemModel? CurrRecord { get; set; } = null; - [Parameter] - public int KeyNum { get; set; } = 0; [Parameter] public EventCallback EC_update { get; set; } + [Parameter] + public int KeyNum { get; set; } = 0; + #endregion Public Properties #region Protected Properties + [Inject] + protected MessageService AppMService { get; set; } = null!; + [Inject] protected TenantService TService { get; set; } = null!; @@ -27,24 +32,35 @@ namespace MagMan.UI.Components #region Protected Methods + protected async Task DoCancel() + { + await EC_update.InvokeAsync(true); + } + protected async Task DoSave() { bool fatto = false; await Task.Delay(1); if (CurrRecord != null) { - fatto = await TService.ItemUpdate(KeyNum, CurrRecord); + fatto = await TService.ItemUpdate(KeyNum, CurrRecord, userName); } if (fatto) { await EC_update.InvokeAsync(true); } } - protected async Task DoCancel() - { - await EC_update.InvokeAsync(true); - } #endregion Protected Methods + + #region Private Properties + + private string userName + { + get => AppMService.UserName; + set => AppMService.UserName = value; + } + + #endregion Private Properties } } \ No newline at end of file diff --git a/MagMan.UI/Components/ItemMan.razor.cs b/MagMan.UI/Components/ItemMan.razor.cs index 7fab80e..1e6236f 100644 --- a/MagMan.UI/Components/ItemMan.razor.cs +++ b/MagMan.UI/Components/ItemMan.razor.cs @@ -98,7 +98,7 @@ namespace MagMan.UI.Components { if (selItem != null) { - RawItemId = selItem.MatId; + RawItemId = selItem.RawItemId; } else { diff --git a/MagMan.UI/Components/LoginDisplay.razor.cs b/MagMan.UI/Components/LoginDisplay.razor.cs index 688b909..3e7fb6b 100644 --- a/MagMan.UI/Components/LoginDisplay.razor.cs +++ b/MagMan.UI/Components/LoginDisplay.razor.cs @@ -1,16 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. +// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this +// file to you under the MIT license. +using MagMan.Core.Services; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; namespace MagMan.UI.Components { public partial class LoginDisplay { - #region Private Fields + #region Protected Properties - private string userName = ""; + [Inject] + protected MessageService AppMService { get; set; } = null!; - #endregion Private Fields + #endregion Protected Properties #region Protected Methods @@ -26,6 +29,16 @@ namespace MagMan.UI.Components #endregion Protected Methods + #region Private Properties + + private string userName + { + get => AppMService.UserName; + set => AppMService.UserName = value; + } + + #endregion Private Properties + #region Private Methods private async Task forceReload() diff --git a/MagMan.UI/Components/MovMag.razor b/MagMan.UI/Components/MovMag.razor index 1b93ee6..03497ee 100644 --- a/MagMan.UI/Components/MovMag.razor +++ b/MagMan.UI/Components/MovMag.razor @@ -2,27 +2,27 @@
-

Movimenti Magazzino

+
Movimenti Magazzino
+
+ @*
+
+
+ @if (CurrItem == null) + { + + } + else + { + + } +
- @*
-
-
- @if (CurrItem == null) - { - - } - else - { - - } -
-
*@
@* @if (CurrItem != null) { -
- +
+ } *@
@@ -40,37 +40,36 @@ @* - - *@ + + *@ Id Data Qty - Note - User + Note @foreach (var item in ListRecords) { - @* - - - *@ - - @item.MovID + @* + + + *@ + + @item.MovID @item.DtRec.ToString("yyyy-MM-dd HH:mm:ss") - + @item.QtyRec - - @item.Note - - @item.UserId + @item.Note +
+ @item.UserId +
} diff --git a/MagMan.UI/Controllers/InventoryController.cs b/MagMan.UI/Controllers/InventoryController.cs index f71323c..54c3f99 100644 --- a/MagMan.UI/Controllers/InventoryController.cs +++ b/MagMan.UI/Controllers/InventoryController.cs @@ -101,7 +101,7 @@ namespace MagMan.UI.Controllers { try { - await TService.ItemUpdate(nKey, item); + await TService.ItemUpdate(nKey, item, $"Key: {nKey}"); fatto = true; } catch (Exception exc) diff --git a/MagMan.UI/Controllers/ResourcesController.cs b/MagMan.UI/Controllers/ResourcesController.cs index 534d3d8..1452fd7 100644 --- a/MagMan.UI/Controllers/ResourcesController.cs +++ b/MagMan.UI/Controllers/ResourcesController.cs @@ -99,13 +99,14 @@ namespace MagMan.UI.Controllers { // recupero ID interno da id esterno... int ProjDbId = 0; + ProjModel? projRec = null; var allProj = await TService.ProjectGetByMachine(nKey, 0); if (allProj != null) { - var pRec = allProj.Find(x => x.ProjExtDbId == projectData.ProjExtDbId); - if (pRec != null) + projRec = allProj.Find(x => x.ProjExtDbId == projectData.ProjExtDbId); + if (projRec != null) { - ProjDbId = pRec.ProjDbId; + ProjDbId = projRec.ProjDbId; } } if (ProjDbId > 0) @@ -127,8 +128,13 @@ namespace MagMan.UI.Controllers listRes = projectData.ResourceList.Select(x => TService.ResourceFromDto(x, reqId)).ToList(); try { - await TService.ResourceUpdate(nKey, listRes, projectData.ReqState); - + string kDesc = $"K{nKey}"; + string prDesc = kDesc; + if (projRec != null) + { + prDesc = $"P: {projRec.ProjExtId}.{projRec.ProjExtDbId} | {projRec.ProjDescription} ({projRec.Machine})"; + } + await TService.ResourceUpdate(nKey, listRes, projectData.ReqState, $"{prDesc} | {kDesc}"); fatto = true; } catch (Exception exc) diff --git a/MagMan.UI/MagMan.UI.csproj b/MagMan.UI/MagMan.UI.csproj index 8b8ef5f..744bae2 100644 --- a/MagMan.UI/MagMan.UI.csproj +++ b/MagMan.UI/MagMan.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2401.2518 + 1.0.2401.2519 enable enable true diff --git a/MagMan.UI/Pages/WareHouse.razor b/MagMan.UI/Pages/WareHouse.razor index 8000cb4..ff316c1 100644 --- a/MagMan.UI/Pages/WareHouse.razor +++ b/MagMan.UI/Pages/WareHouse.razor @@ -22,6 +22,7 @@ else @if (RawItemId > 0) { +
}
diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index e764482..60c9739 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MagMan - Wood Warehouse Management System -

Versione: 1.0.2401.2518

+

Versione: 1.0.2401.2519


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index d0f3e55..932a95a 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.0.2401.2518 +1.0.2401.2519 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 212efb1..be04690 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.0.2401.2518 + 1.0.2401.2519 http://nexus.steamware.net/repository/SWS/MagMan/stable/0/MagMan.UI.zip http://nexus.steamware.net/repository/SWS/MagMan/stable/0/ChangeLog.html false