From 18ef30789e9f70c6c7c711042d7fcc1d7ec37c77 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 16 Dec 2022 10:34:23 +0100 Subject: [PATCH 01/19] fix cifre decimali mostrate --- MP.INVE/Pages/Cancellazione.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor index 744564f8..a5bd47eb 100644 --- a/MP.INVE/Pages/Cancellazione.razor +++ b/MP.INVE/Pages/Cancellazione.razor @@ -72,7 +72,7 @@ Quantità:
- @Math.Round(currScan.Qty, 0) + @Math.Round(currScan.Qty, 2)
From 3ce24a0b64ece10901e75872d780554a27c7ef3a Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 16 Dec 2022 11:03:53 +0100 Subject: [PATCH 02/19] bozza sposstamento in MiDataService --- MP.INVE/Components/CmpTop.razor.cs | 10 +- MP.INVE/Data/MiDataService.cs | 890 +++++++++++++++-------------- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 6 files changed, 489 insertions(+), 419 deletions(-) diff --git a/MP.INVE/Components/CmpTop.razor.cs b/MP.INVE/Components/CmpTop.razor.cs index 3eb00344..17e6d5fd 100644 --- a/MP.INVE/Components/CmpTop.razor.cs +++ b/MP.INVE/Components/CmpTop.razor.cs @@ -22,7 +22,7 @@ namespace MP.INVE.Components public async Task LogOut() { - await localStorage.ClearAsync(); + await MIDataService.clearLocalStorageAsync(); // rimando a pagina login NavManager.NavigateTo("OperatoreLogin", true); } @@ -33,6 +33,7 @@ namespace MP.INVE.Components [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] protected MiDataService MIDataService { get; set; } = null!; @@ -44,8 +45,11 @@ namespace MP.INVE.Components protected async Task getId() { +#if false OperatoreDTO answ = new OperatoreDTO(); answ = await localStorage.GetItemAsync("MatrOpr"); +#endif + OperatoreDTO answ = await MIDataService.getCurrOperDtoAsync(); if (!NavManager.Uri.Contains("Jumper?")) { if (answ != null) @@ -89,10 +93,14 @@ namespace MP.INVE.Components [Inject] private NavigationManager NavManager { get; set; } = null!; + [Inject] private ISessionStorageService sessionStorage { get; set; } = null!; + +#if false [Inject] private ILocalStorageService localStorage { get; set; } = null!; +#endif #endregion Private Properties } diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 94cffed8..e35261d3 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -1,7 +1,9 @@ -using Egw.Core; +using Blazored.LocalStorage; +using Egw.Core; using Microsoft.AspNetCore.Mvc.ModelBinding; using MP.Data.Conf; using MP.Data.DatabaseModels; +using MP.Data.DTO; using MP.INVE.Pages; using Newtonsoft.Json; using NLog; @@ -13,13 +15,84 @@ namespace MP.INVE.Data { public class MiDataService : IDisposable { + #region Protected Fields + + protected const string passPhrase = "7871D817-C71F-4DFC-BF12-00A95BE507B5"; + + protected Random rand = new Random(); + + #endregion Protected Fields + + #region Private Fields + + private const string redisBaseAddr = "MP:INVE"; + + private const string redisConfigBaseAddr = ":Config"; + + private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori"; + + private const string redisLottiBaseAddr = ":Lotti"; + + private const string redisLottiEsterni = redisBaseAddr + redisLottiBaseAddr + ":LottiEsterni"; + + private const string redisLottiInterni = redisBaseAddr + redisLottiBaseAddr + ":LottiInterni"; + + private const string redisMagList = redisBaseAddr + ":ListMag"; + + private const string redisOperatoreLogged = redisBaseAddr + redisOperatoriBaseAddr + ":OperatoreLogged"; + + private const string redisOperatoriBaseAddr = ":Operatore"; + + private const string redisScanBaseAddr = redisBaseAddr + ":Scan"; + + private const string redisSessionBaseAddr = ":Session"; + + private const string redisSessionCurrList = redisBaseAddr + redisSessionBaseAddr + ":ListSessHist"; + + private const string redisSessionHistList = redisBaseAddr + redisSessionBaseAddr + ":ListSessCurr"; + + private const string redisTotLottoAddr = ":TotaleLotto"; + + private const string redisUdcBaseAddr = ":UDC"; + + private static IConfiguration _configuration = null!; + + private static ILogger _logger = null!; + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + /// + /// Oggetto vocabolario x uso continuo traduzione + /// + private List ObjVocabolario = new List(); + + /// + /// Oggetto per connessione a REDIS + /// + private ConnectionMultiplexer redisConn = null!; + + /// + /// Oggetto per connessione a REDIS modalità admin (ex flux dati) + /// + private ConnectionMultiplexer redisConnAdmin = null!; + + /// + /// Oggetto DB redis da impiegare x chiamate R/W + /// + private IDatabase redisDb = null!; + + private int redisLongTimeCache = 5; + + #endregion Private Fields + #region Public Constructors - public MiDataService(IConfiguration configuration, ILogger logger) + public MiDataService(IConfiguration configuration, ILogger logger, ILocalStorageService blazLocalStorage) { _logger = logger; _logger.LogInformation("Starting MiDataService INIT"); _configuration = configuration; + localStorage = blazLocalStorage; // setup compoenti REDIS redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); @@ -58,17 +131,58 @@ namespace MP.INVE.Data #endregion Public Properties + #region Private Properties + + private static ILocalStorageService localStorage { get; set; } = null!; + + #endregion Private Properties + #region Public Methods - public string DeriptData(string encData) + /// + /// Aggiornamento record selezionato + /// + /// + /// + public async Task artBySearch(string artSearch) { - return SteamCrypto.DecryptString(encData, passPhrase); + var dbResult = dbController.artBySearch(artSearch); + // elimino cache redis... + await Task.Delay(1); + return dbResult; } - public void Dispose() + /// + /// Effettua pulizia localstorage + /// + /// + public async Task clearLocalStorageAsync() { + bool answ = false; + try + { + await localStorage.ClearAsync(); + answ = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione in clearLocalStorage{Environment.NewLine}{exc}"); + } + return answ; } + public async Task CloseOpenSessione(int sessID, bool flgClose) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + bool result = false; + string source = "DB"; + result = await dbController.CloseOpenSessione(sessID, flgClose); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"CloseOpenSessione Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } public async Task> ConfigGetAll() { @@ -101,25 +215,6 @@ namespace MP.INVE.Data return result; } - /// - /// Restituisce valore della stringa (SE disponibile) - /// - /// - /// - public async Task tryGetConfig(string keyName) - { - string answ = ""; - // preselezione valori - var configData = await ConfigGetAll(); - var currRec = configData.FirstOrDefault(x => x.Chiave == keyName); - if (currRec != null) - { - answ = currRec.Valore; - } - - return answ; - } - /// /// Reset dati cache config /// @@ -129,38 +224,35 @@ namespace MP.INVE.Data await redisDb.StringSetAsync(redisConfigBaseAddr, ""); } - - public async Task InsertNewScansione(ScanDataModel newScan) + public async Task DeleteMag(AnagMagModel Mag) { bool result = false; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - result = await dbController.InsertNewScansione(newScan); + result = await dbController.DeleteMag(Mag); // elimino cache redis... - RedisValue pattern = new RedisValue(redisScanBaseAddr); + RedisValue pattern = new RedisValue($"{redisMagList}:*"); bool answ = await ExecFlushRedisPattern(pattern); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"InsertNewScansione | Id scansione: {newScan.ScanID} | Id sessione: {newScan.InveSessID} | {ts.TotalMilliseconds}ms"); + Log.Debug($"DeleteMag | Codice magazzino: {Mag.CodMag} | Descrizione magazzino: {Mag.DescMag} | {ts.TotalMilliseconds}ms"); return result; - // aggiungo record al DB } - - public async Task InsertNewSessione(InventorySessionModel newSess) + public async Task deleteScansione(ScanDataModel scan) { bool result = false; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - result = await dbController.InsertNewSessione(newSess); + result = await dbController.deleteScansione(scan); // elimino cache redis... - RedisValue pattern = new RedisValue($"{redisBaseAddr}{redisSessionBaseAddr}*"); + RedisValue pattern = new RedisValue($"{redisScanBaseAddr}*"); bool answ = await ExecFlushRedisPattern(pattern); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"InsertNewSessione | Id sessione: {newSess.InveSessID} | Descrizione sessione: {newSess.Description} | {ts.TotalMilliseconds}ms"); + Log.Debug($"deleteScansione | Id scansione: {scan.ScanID} | Codice scansionato: {scan.ScanValue} | {ts.TotalMilliseconds}ms"); return result; - // aggiungo record al DB + // elimino record dal DB } public async Task deleteSessione(InventorySessionModel session) @@ -178,107 +270,76 @@ namespace MP.INVE.Data return result; // elimino record dal DB } - public async Task deleteScansione(ScanDataModel scan) + + public string DeriptData(string encData) { - bool result = false; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - result = await dbController.deleteScansione(scan); - // elimino cache redis... - RedisValue pattern = new RedisValue($"{redisScanBaseAddr}*"); - bool answ = await ExecFlushRedisPattern(pattern); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"deleteScansione | Id scansione: {scan.ScanID} | Codice scansionato: {scan.ScanValue} | {ts.TotalMilliseconds}ms"); - return result; - // elimino record dal DB + return SteamCrypto.DecryptString(encData, passPhrase); } - public async Task InsertNewMag(AnagMagModel newMag) + public void Dispose() { - bool result = false; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - result = await dbController.InsertNewMag(newMag); - // elimino cache redis... - RedisValue pattern = new RedisValue($"{redisMagList}"); - bool answ = await ExecFlushRedisPattern(pattern); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"InsertNewMag | Codice magazzino: {newMag.CodMag} | Descrizione magazzino: {newMag.DescMag} | {ts.TotalMilliseconds}ms"); - return result; - // aggiungo record al DB - } - public async Task UpdateMag(AnagMagModel Mag) - { - bool result = false; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - result = await dbController.UpdateMag(Mag); - // elimino cache redis... - RedisValue pattern = new RedisValue($"{redisMagList}"); - bool answ = await ExecFlushRedisPattern(pattern); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"UpdateMag | Codice magazzino: {Mag.CodMag} | Descrizione magazzino: {Mag.DescMag} | {ts.TotalMilliseconds}ms"); - return result; - // aggiungo record al DB - } - public async Task DeleteMag(AnagMagModel Mag) - { - bool result = false; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - result = await dbController.DeleteMag(Mag); - // elimino cache redis... - RedisValue pattern = new RedisValue($"{redisMagList}:*"); - bool answ = await ExecFlushRedisPattern(pattern); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"DeleteMag | Codice magazzino: {Mag.CodMag} | Descrizione magazzino: {Mag.DescMag} | {ts.TotalMilliseconds}ms"); - return result; } - public bool loginOperatore(int matrOpr, string authkey) + public List ElencoLotti() { string source = ""; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - AnagOperatoriModel? result = new AnagOperatoriModel(); - bool answ = false; + List? result = new List(); // cerco in redis... - RedisValue rawData = redisDb.StringGet($"{redisElencoOperatori}:{matrOpr}:{authkey}"); + RedisValue rawData = redisDb.StringGet(redisLottiInterni); if (!string.IsNullOrEmpty($"{rawData}")) { + result = JsonConvert.DeserializeObject>($"{rawData}"); - result = JsonConvert.DeserializeObject($"{rawData}"); - if (result != null) - { - answ = true; - source = "REDIS"; - } + source = "REDIS"; } else { - answ = dbController.LoginOperatore(matrOpr, authkey); - if (answ) - { - result = ElencoOperatori().Where(x => (x.MatrOpr == matrOpr) && (x.authKey == authkey)).SingleOrDefault(); - } + result = dbController.ElencoLotti(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSetAsync(redisOperatoreLogged, rawData, getRandTOut(redisLongTimeCache)); + redisDb.StringSetAsync(redisLottiInterni, rawData, getRandTOut(redisLongTimeCache)); source = "DB"; - } if (result == null) { - result = new AnagOperatoriModel(); + result = new List(); } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"loginOperatore Read from {source}: {ts.TotalMilliseconds}ms"); - return answ; + Log.Debug($"ElencoLotti Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public List ElencoMagazzini() + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List result = new List(); + string source = "DB"; + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisMagList); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbController.ElencoMagazzini(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSetAsync(redisMagList, rawData, getRandTOut(redisLongTimeCache)); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ElencoMagazzini Read from {source}: {ts.TotalMilliseconds}ms"); + if (result == null) + { + result = new List(); + } + return result; } public List ElencoOperatori() @@ -313,147 +374,6 @@ namespace MP.INVE.Data return result; } - - public List LottoEsterno(string codArt, string codLotto, string codMagazzino) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - // cerco in redis... - result = dbController.LottoEsterno(codArt, codLotto, codMagazzino); - source = "DB"; - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"LottoEsterno Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - - public List ScanList() - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - // cerco in redis... - RedisValue rawData = redisDb.StringGet(redisScanBaseAddr); - if (!string.IsNullOrEmpty($"{rawData}")) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - - source = "REDIS"; - } - else - { - result = dbController.ScanList(); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSetAsync(redisScanBaseAddr, rawData, getRandTOut(redisLongTimeCache)); - source = "DB"; - } - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ScanList Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - public List InveSessTotLotList(int sessID) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - result = dbController.InveSessTotLotList(sessID); - source = "DB"; - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"InveSessTotLotList Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - - public ScanDataModel ScanByUdcSession(string udc, int inveSessId) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - ScanDataModel? result = new ScanDataModel(); - result = dbController.ScanByUdcSession(udc, inveSessId); - source = "DB"; - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ScanByUdcSession Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - - public List ScanByValueSessionOpr(string scanData, int inveSessId, string Opr) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - result = dbController.ScanByValueSessionOpr(scanData, inveSessId, Opr); - source = "DB"; - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ScanByValueSessionOpr Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - - public List ScanBySession(int idSessione) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - // cerco in redis... - { - var ListAll = ScanList(); - result = ListAll.Where(x => x.InveSessID == idSessione).ToList(); - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ScanBySession Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - } - - /// - /// Aggiornamento record selezionato - /// - /// - /// - public async Task UpdateScan(ScanDataModel currRec) - { - var dbResult = await dbController.updateScan(currRec); - // elimino cache redis... - RedisValue pattern = new RedisValue(redisScanBaseAddr); - bool answ = await ExecFlushRedisPattern(pattern); - await Task.Delay(1); - return dbResult; - } - /// - /// Aggiornamento record selezionato - /// - /// - /// - public async Task artBySearch(string artSearch) - { - var dbResult = dbController.artBySearch(artSearch); - // elimino cache redis... - await Task.Delay(1); - return dbResult; - } - public List ElencoUDC() { string source = ""; @@ -486,69 +406,95 @@ namespace MP.INVE.Data return result; } - public AnagUdcModel IsUDC(string udc) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - AnagUdcModel? result = new AnagUdcModel(); - result = dbController.IsUDC(udc); - source = "DB"; - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"IsUDC Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - public AnagLottoModel LottoInterno(string lotto) - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - AnagLottoModel? result = new AnagLottoModel(); - result = dbController.LottoInterno(lotto); - source = "DB"; - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"LottoInterno Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - public List ElencoLotti() - { - string source = ""; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List? result = new List(); - // cerco in redis... - RedisValue rawData = redisDb.StringGet(redisLottiInterni); - if (!string.IsNullOrEmpty($"{rawData}")) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - - source = "REDIS"; - } - else - { - result = dbController.ElencoLotti(); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSetAsync(redisLottiInterni, rawData, getRandTOut(redisLongTimeCache)); - source = "DB"; - } - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ElencoLotti Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - public string EncriptData(string rawData) { return SteamCrypto.EncryptString(rawData, passPhrase); } + public async Task FlushRedisCache() + { + await Task.Delay(1); + RedisValue pattern = new RedisValue($"{redisBaseAddr}*"); + bool answ = await ExecFlushRedisPattern(pattern); + return answ; + } + + /// + /// Restituisce il record OperatoreDTO da localstorage + /// + /// + public async Task getCurrOperDtoAsync() + { + OperatoreDTO answ = new OperatoreDTO(); + answ = await localStorage.GetItemAsync("MatrOpr"); + return answ; + } + + public async Task InsertNewMag(AnagMagModel newMag) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.InsertNewMag(newMag); + // elimino cache redis... + RedisValue pattern = new RedisValue($"{redisMagList}"); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InsertNewMag | Codice magazzino: {newMag.CodMag} | Descrizione magazzino: {newMag.DescMag} | {ts.TotalMilliseconds}ms"); + return result; + // aggiungo record al DB + } + + public async Task InsertNewScansione(ScanDataModel newScan) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.InsertNewScansione(newScan); + // elimino cache redis... + RedisValue pattern = new RedisValue(redisScanBaseAddr); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InsertNewScansione | Id scansione: {newScan.ScanID} | Id sessione: {newScan.InveSessID} | {ts.TotalMilliseconds}ms"); + return result; + // aggiungo record al DB + } + + public async Task InsertNewSessione(InventorySessionModel newSess) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.InsertNewSessione(newSess); + // elimino cache redis... + RedisValue pattern = new RedisValue($"{redisBaseAddr}{redisSessionBaseAddr}*"); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InsertNewSessione | Id sessione: {newSess.InveSessID} | Descrizione sessione: {newSess.Description} | {ts.TotalMilliseconds}ms"); + return result; + // aggiungo record al DB + } + + public InventorySessionModel InventSessByID(int sessID) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + InventorySessionModel result = new InventorySessionModel(); + string source = "DB"; + result = dbController.InventSessByID(sessID); + if (result == null) + { + result = new InventorySessionModel(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"InventSessByID Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List InventSessCurrList() { Stopwatch stopWatch = new Stopwatch(); @@ -579,36 +525,6 @@ namespace MP.INVE.Data return result; } - public List ElencoMagazzini() - { - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - List result = new List(); - string source = "DB"; - // cerco in redis... - RedisValue rawData = redisDb.StringGet(redisMagList); - if (!string.IsNullOrEmpty($"{rawData}")) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = dbController.ElencoMagazzini(); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - redisDb.StringSetAsync(redisMagList, rawData, getRandTOut(redisLongTimeCache)); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ElencoMagazzini Read from {source}: {ts.TotalMilliseconds}ms"); - if (result == null) - { - result = new List(); - } - return result; - } - public List InventSessHistList() { Stopwatch stopWatch = new Stopwatch(); @@ -639,35 +555,188 @@ namespace MP.INVE.Data return result; } - public InventorySessionModel InventSessByID(int sessID) + public List InveSessTotLotList(int sessID) { + string source = ""; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - InventorySessionModel result = new InventorySessionModel(); - string source = "DB"; - result = dbController.InventSessByID(sessID); + List? result = new List(); + result = dbController.InveSessTotLotList(sessID); + source = "DB"; if (result == null) { - result = new InventorySessionModel(); + result = new List(); } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"InventSessByID Read from {source}: {ts.TotalMilliseconds}ms"); + Log.Debug($"InveSessTotLotList Read from {source}: {ts.TotalMilliseconds}ms"); return result; } - public async Task CloseOpenSessione(int sessID, bool flgClose) + public AnagUdcModel IsUDC(string udc) { + string source = ""; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - bool result = false; - string source = "DB"; - result = await dbController.CloseOpenSessione(sessID, flgClose); + AnagUdcModel? result = new AnagUdcModel(); + result = dbController.IsUDC(udc); + source = "DB"; stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"CloseOpenSessione Read from {source}: {ts.TotalMilliseconds}ms"); + Log.Debug($"IsUDC Read from {source}: {ts.TotalMilliseconds}ms"); return result; } + + public bool loginOperatore(int matrOpr, string authkey) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + AnagOperatoriModel? result = new AnagOperatoriModel(); + bool answ = false; + // cerco in redis... + RedisValue rawData = redisDb.StringGet($"{redisElencoOperatori}:{matrOpr}:{authkey}"); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + if (result != null) + { + answ = true; + source = "REDIS"; + } + } + else + { + answ = dbController.LoginOperatore(matrOpr, authkey); + if (answ) + { + result = ElencoOperatori().Where(x => (x.MatrOpr == matrOpr) && (x.authKey == authkey)).SingleOrDefault(); + } + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSetAsync(redisOperatoreLogged, rawData, getRandTOut(redisLongTimeCache)); + source = "DB"; + } + if (result == null) + { + result = new AnagOperatoriModel(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"loginOperatore Read from {source}: {ts.TotalMilliseconds}ms"); + return answ; + } + + public List LottoEsterno(string codArt, string codLotto, string codMagazzino) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + result = dbController.LottoEsterno(codArt, codLotto, codMagazzino); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"LottoEsterno Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public AnagLottoModel LottoInterno(string lotto) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + AnagLottoModel? result = new AnagLottoModel(); + result = dbController.LottoInterno(lotto); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"LottoInterno Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public List ScanBySession(int idSessione) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + { + var ListAll = ScanList(); + result = ListAll.Where(x => x.InveSessID == idSessione).ToList(); + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanBySession Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + } + + public ScanDataModel ScanByUdcSession(string udc, int inveSessId) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + ScanDataModel? result = new ScanDataModel(); + result = dbController.ScanByUdcSession(udc, inveSessId); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByUdcSession Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public List ScanByValueSessionOpr(string scanData, int inveSessId, string Opr) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + result = dbController.ScanByValueSessionOpr(scanData, inveSessId, Opr); + source = "DB"; + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByValueSessionOpr Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + + public List ScanList() + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisScanBaseAddr); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + + source = "REDIS"; + } + else + { + result = dbController.ScanList(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSetAsync(redisScanBaseAddr, rawData, getRandTOut(redisLongTimeCache)); + source = "DB"; + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanList Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public async Task TransferSessione(int sessID) { Stopwatch stopWatch = new Stopwatch(); @@ -680,16 +749,59 @@ namespace MP.INVE.Data Log.Debug($"TransferSessione Read from {source}: {ts.TotalMilliseconds}ms"); return result; } + + /// + /// Restituisce valore della stringa (SE disponibile) + /// + /// + /// + public async Task tryGetConfig(string keyName) + { + string answ = ""; + // preselezione valori + var configData = await ConfigGetAll(); + var currRec = configData.FirstOrDefault(x => x.Chiave == keyName); + if (currRec != null) + { + answ = currRec.Valore; + } + + return answ; + } + + public async Task UpdateMag(AnagMagModel Mag) + { + bool result = false; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + result = await dbController.UpdateMag(Mag); + // elimino cache redis... + RedisValue pattern = new RedisValue($"{redisMagList}"); + bool answ = await ExecFlushRedisPattern(pattern); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"UpdateMag | Codice magazzino: {Mag.CodMag} | Descrizione magazzino: {Mag.DescMag} | {ts.TotalMilliseconds}ms"); + return result; + // aggiungo record al DB + } + + /// + /// Aggiornamento record selezionato + /// + /// + /// + public async Task UpdateScan(ScanDataModel currRec) + { + var dbResult = await dbController.updateScan(currRec); + // elimino cache redis... + RedisValue pattern = new RedisValue(redisScanBaseAddr); + bool answ = await ExecFlushRedisPattern(pattern); + await Task.Delay(1); + return dbResult; + } + #endregion Public Methods - #region Protected Fields - - protected const string passPhrase = "7871D817-C71F-4DFC-BF12-00A95BE507B5"; - - protected Random rand = new Random(); - - #endregion Protected Fields - #region Protected Methods /// @@ -702,13 +814,10 @@ namespace MP.INVE.Data double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60; return TimeSpan.FromMinutes(rndValue); } - public async Task FlushRedisCache() - { - await Task.Delay(1); - RedisValue pattern = new RedisValue($"{redisBaseAddr}*"); - bool answ = await ExecFlushRedisPattern(pattern); - return answ; - } + + #endregion Protected Methods + + #region Private Methods /// /// Esegue flush memoria redis dato pattern @@ -739,53 +848,6 @@ namespace MP.INVE.Data return answ; } - #endregion Protected Methods - - #region Private Fields - - private const string redisBaseAddr = "MP:INVE"; - private const string redisSessionBaseAddr = ":Session"; - private const string redisOperatoriBaseAddr = ":Operatore"; - private const string redisLottiBaseAddr = ":Lotti"; - private const string redisUdcBaseAddr = ":UDC"; - private const string redisTotLottoAddr = ":TotaleLotto"; - private const string redisLottiInterni = redisBaseAddr + redisLottiBaseAddr + ":LottiInterni"; - private const string redisLottiEsterni = redisBaseAddr + redisLottiBaseAddr + ":LottiEsterni"; - private const string redisConfigBaseAddr = ":Config"; - private const string redisScanBaseAddr = redisBaseAddr + ":Scan"; - private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori"; - private const string redisOperatoreLogged = redisBaseAddr + redisOperatoriBaseAddr + ":OperatoreLogged"; - private const string redisSessionCurrList = redisBaseAddr + redisSessionBaseAddr + ":ListSessHist"; - private const string redisSessionHistList = redisBaseAddr + redisSessionBaseAddr + ":ListSessCurr"; - private const string redisMagList = redisBaseAddr + ":ListMag"; - private static IConfiguration _configuration = null!; - - private static ILogger _logger = null!; - - private static Logger Log = LogManager.GetCurrentClassLogger(); - - /// - /// Oggetto vocabolario x uso continuo traduzione - /// - private List ObjVocabolario = new List(); - - /// - /// Oggetto per connessione a REDIS - /// - private ConnectionMultiplexer redisConn = null!; - - /// - /// Oggetto per connessione a REDIS modalità admin (ex flux dati) - /// - private ConnectionMultiplexer redisConnAdmin = null!; - - /// - /// Oggetto DB redis da impiegare x chiamate R/W - /// - private IDatabase redisDb = null!; - - private int redisLongTimeCache = 5; - - #endregion Private Fields + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index efe90c46..dffe99b2 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1610 + 6.16.2212.1611 diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index caaf0c73..2675e33f 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.1610

+

Versione: 6.16.2212.1611


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 31f86dce..b8ebf232 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1610 +6.16.2212.1611 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 3e35ff8d..72998040 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1610 + 6.16.2212.1611 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From 1e81d953842504e6a23d370d425960543a563e5c Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 16 Dec 2022 12:34:06 +0100 Subject: [PATCH 03/19] tentativo fix msgServic con gestione localStorage --- MP.INVE/Components/CmpTop.razor.cs | 13 ++--- MP.INVE/Data/MessageService.cs | 78 +++++++++++++++++++-------- MP.INVE/Data/MiDataService.cs | 34 +----------- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Cancellazione.razor | 21 -------- MP.INVE/Pages/Contacts.razor.cs | 1 - MP.INVE/Pages/InveSession.razor.cs | 5 +- MP.INVE/Pages/Invio.razor.cs | 5 +- MP.INVE/Pages/Jumper.razor.cs | 5 ++ MP.INVE/Pages/OperatoreLogin.razor.cs | 10 ++-- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 13 files changed, 86 insertions(+), 94 deletions(-) diff --git a/MP.INVE/Components/CmpTop.razor.cs b/MP.INVE/Components/CmpTop.razor.cs index 17e6d5fd..7dd888a0 100644 --- a/MP.INVE/Components/CmpTop.razor.cs +++ b/MP.INVE/Components/CmpTop.razor.cs @@ -19,10 +19,9 @@ namespace MP.INVE.Components // rimando a pagina corrente NavManager.NavigateTo(NavManager.Uri, true); } - public async Task LogOut() { - await MIDataService.clearLocalStorageAsync(); + await MsgService.clearLocalStorageAsync(); // rimando a pagina login NavManager.NavigateTo("OperatoreLogin", true); } @@ -36,6 +35,8 @@ namespace MP.INVE.Components [Inject] protected MiDataService MIDataService { get; set; } = null!; + [Inject] + protected MessageService MsgService { get; set; } = null!; #endregion Protected Properties @@ -49,10 +50,10 @@ namespace MP.INVE.Components OperatoreDTO answ = new OperatoreDTO(); answ = await localStorage.GetItemAsync("MatrOpr"); #endif - OperatoreDTO answ = await MIDataService.getCurrOperDtoAsync(); + OperatoreDTO answ = await MsgService.getCurrOperDtoAsync(); if (!NavManager.Uri.Contains("Jumper?")) { - if (answ != null) + if (answ.MatrOpr != 0) { userName = $"{answ.Cognome} {answ.Nome} ({answ.MatrOpr})"; if (NavManager.Uri.Contains("OperatoreLogin")) @@ -76,10 +77,6 @@ namespace MP.INVE.Components await getId(); } - protected override async Task OnAfterRenderAsync(bool firstRender) - { - await getId(); - } #endregion Protected Methods diff --git a/MP.INVE/Data/MessageService.cs b/MP.INVE/Data/MessageService.cs index 985557d0..0b560ee9 100644 --- a/MP.INVE/Data/MessageService.cs +++ b/MP.INVE/Data/MessageService.cs @@ -1,8 +1,61 @@ -namespace MP.INVE.Data +using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using MP.Data.DTO; +using NLog.Fluent; + +namespace MP.INVE.Data { public class MessageService { - #region Public Events + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + [Inject] + protected ILogger logger { get; set; } = null!; + + /// + /// Effettua pulizia localstorage + /// + /// + public async Task clearLocalStorageAsync() + { + bool answ = false; + try + { + await localStorage.ClearAsync(); + answ = true; + } + catch (Exception exc) + { + //Log.Error($"Eccezione in clearLocalStorage{Environment.NewLine}{exc}"); + } + return answ; + } + /// + /// Restituisce il record OperatoreDTO da localstorage + /// + /// + public async Task getCurrOperDtoAsync() + { + OperatoreDTO answ = new OperatoreDTO(); + //var result = await localStorage.GetItemAsync("Opr"); + //if(result != null) + //{ + // answ= result; + //} + return answ; + } + /// + /// scrive il record OperatoreDTO nel localstorage + /// + /// + public async Task setCurrOperDtoAsync(OperatoreDTO opr) + { + bool answ = false; + await localStorage.SetItemAsync("Opr", opr); + answ = true; + return answ; + } +#if false public event Action EA_PageUpdated = null!; @@ -12,10 +65,6 @@ public event Action EA_StatoSearch = null!; - #endregion Public Events - - #region Public Properties - public int currPage { get => _currPage; @@ -123,10 +172,6 @@ } } - #endregion Public Properties - - #region Protected Methods - protected void reportPaging() { if (EA_PageUpdated != null) @@ -143,24 +188,15 @@ } } - #endregion Protected Methods - - #region Private Fields - private string searchVal = ""; private bool showSearch; private string stateSel = "*"; private string tipoSearch = ""; - #endregion Private Fields - - #region Private Properties - private int _currPage { get; set; } = 1; private int _numRecord { get; set; } = 10; - private int _totalCount { get; set; } = 0; - - #endregion Private Properties + private int _totalCount { get; set; } = 0; +#endif } } \ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index e35261d3..54ebdbc2 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -87,12 +87,11 @@ namespace MP.INVE.Data #region Public Constructors - public MiDataService(IConfiguration configuration, ILogger logger, ILocalStorageService blazLocalStorage) + public MiDataService(IConfiguration configuration, ILogger logger) { _logger = logger; _logger.LogInformation("Starting MiDataService INIT"); _configuration = configuration; - localStorage = blazLocalStorage; // setup compoenti REDIS redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); @@ -133,7 +132,6 @@ namespace MP.INVE.Data #region Private Properties - private static ILocalStorageService localStorage { get; set; } = null!; #endregion Private Properties @@ -152,25 +150,6 @@ namespace MP.INVE.Data return dbResult; } - /// - /// Effettua pulizia localstorage - /// - /// - public async Task clearLocalStorageAsync() - { - bool answ = false; - try - { - await localStorage.ClearAsync(); - answ = true; - } - catch (Exception exc) - { - Log.Error($"Eccezione in clearLocalStorage{Environment.NewLine}{exc}"); - } - return answ; - } - public async Task CloseOpenSessione(int sessID, bool flgClose) { Stopwatch stopWatch = new Stopwatch(); @@ -419,16 +398,7 @@ namespace MP.INVE.Data return answ; } - /// - /// Restituisce il record OperatoreDTO da localstorage - /// - /// - public async Task getCurrOperDtoAsync() - { - OperatoreDTO answ = new OperatoreDTO(); - answ = await localStorage.GetItemAsync("MatrOpr"); - return answ; - } + public async Task InsertNewMag(AnagMagModel newMag) { diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index dffe99b2..47dba471 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1611 + 6.16.2212.1612 diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor index a5bd47eb..7fba94a2 100644 --- a/MP.INVE/Pages/Cancellazione.razor +++ b/MP.INVE/Pages/Cancellazione.razor @@ -1,27 +1,6 @@ @page "/Cancellazione" -@*
    -
    MP.INVE
    -
    - Cancellazione -
    -
    - -
    -
    -
    -
    -
    Menu
    - -
    -
    - - -
    -
    *@
    diff --git a/MP.INVE/Pages/Contacts.razor.cs b/MP.INVE/Pages/Contacts.razor.cs index dc094d4b..1155597b 100644 --- a/MP.INVE/Pages/Contacts.razor.cs +++ b/MP.INVE/Pages/Contacts.razor.cs @@ -24,7 +24,6 @@ namespace MP.INVE.Pages { Titolo = "MP INVE"; Messaggio = "I nostri contattatti e siti di supporto"; - AppMService.ShowSearch = false; } #endregion Protected Methods diff --git a/MP.INVE/Pages/InveSession.razor.cs b/MP.INVE/Pages/InveSession.razor.cs index 618ca295..85edd283 100644 --- a/MP.INVE/Pages/InveSession.razor.cs +++ b/MP.INVE/Pages/InveSession.razor.cs @@ -124,11 +124,12 @@ namespace MP.INVE.Pages { currPage = newNum; } - + [Inject] + protected MessageService MsgService { get; set; } = null!; protected async Task getId() { OperatoreDTO local = new OperatoreDTO(); - local = await localStorage.GetItemAsync("MatrOpr"); + local = await MsgService.getCurrOperDtoAsync(); if (local != null) { idOperatore = local.MatrOpr.ToString(); diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index 51abbc87..a876d830 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -181,11 +181,12 @@ namespace MP.INVE.Pages protected int sessID { get; set; } = 0; protected string codMag { get; set; } = ""; - + [Inject] + protected MessageService MsgService { get; set; } = null!; protected async Task getId() { OperatoreDTO local = new OperatoreDTO(); - local = await localStorage.GetItemAsync("MatrOpr"); + local = await MsgService.getCurrOperDtoAsync(); if (local != null) { idOperatore = local.MatrOpr.ToString(); diff --git a/MP.INVE/Pages/Jumper.razor.cs b/MP.INVE/Pages/Jumper.razor.cs index c0cc5080..ebbaefd0 100644 --- a/MP.INVE/Pages/Jumper.razor.cs +++ b/MP.INVE/Pages/Jumper.razor.cs @@ -25,6 +25,8 @@ namespace MP.INVE.Pages [Inject] protected MiDataService MIService { get; set; } = null!; + [Inject] + protected MessageService MsgService { get; set; } = null!; [Inject] protected NavigationManager NavManager { get; set; } = null!; @@ -69,7 +71,10 @@ namespace MP.INVE.Pages dtExp = DateTime.Now.AddMinutes(1) }; +#if false await localStorage.SetItemAsync("MatrOpr", currOpr); +#endif + await MsgService.setCurrOperDtoAsync(sessionOpr); await sessionStorage.SetItemAsync("idSessione", inveSessionId); } NavManager.NavigateTo($"Acquisizione?idSess={inveSessionId}&idOpr={idOpr}&codMag={codMag}"); diff --git a/MP.INVE/Pages/OperatoreLogin.razor.cs b/MP.INVE/Pages/OperatoreLogin.razor.cs index 9af22264..7cdb4d99 100644 --- a/MP.INVE/Pages/OperatoreLogin.razor.cs +++ b/MP.INVE/Pages/OperatoreLogin.razor.cs @@ -60,8 +60,9 @@ namespace MP.INVE.Pages elencoOperatori = MIDataservice.ElencoOperatori(); isLoading = false; } - - private void login() + [Inject] + protected MessageService MsgService { get; set; } = null!; + private async void login() { logged = MIDataservice.loginOperatore(idOperatore, authKey); @@ -80,7 +81,10 @@ namespace MP.INVE.Pages hashAuthKey = hash, dtExp = DateTime.Now.AddMinutes(1) }; - localStorage.SetItemAsync("MatrOpr", sessionOpr); +#if false + localStorage.SetItemAsync("MatrOpr", sessionOpr); +#endif + await MsgService.setCurrOperDtoAsync(sessionOpr); NavManager.NavigateTo("InveSession", true); } } diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 2675e33f..17a30827 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 6.16.2212.1611

    +

    Versione: 6.16.2212.1612


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index b8ebf232..2b5d77b5 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1611 +6.16.2212.1612 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 72998040..a40c1b2f 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1611 + 6.16.2212.1612 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From a0fd96af79aeef2c5a4a9fcc2987134b58a7729e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 16 Dec 2022 12:44:38 +0100 Subject: [PATCH 04/19] Fix init messageservice --- MP.INVE/Data/MessageService.cs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/MP.INVE/Data/MessageService.cs b/MP.INVE/Data/MessageService.cs index 0b560ee9..948b53f4 100644 --- a/MP.INVE/Data/MessageService.cs +++ b/MP.INVE/Data/MessageService.cs @@ -1,16 +1,21 @@ using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using MP.Data.DTO; +using NLog; using NLog.Fluent; namespace MP.INVE.Data { public class MessageService { - [Inject] protected ILocalStorageService localStorage { get; set; } = null!; - [Inject] - protected ILogger logger { get; set; } = null!; + + public MessageService(ILocalStorageService genLocalStorage) + { + localStorage = genLocalStorage; + } + + private static Logger Log = LogManager.GetCurrentClassLogger(); /// /// Effettua pulizia localstorage @@ -30,20 +35,22 @@ namespace MP.INVE.Data } return answ; } + /// /// Restituisce il record OperatoreDTO da localstorage /// /// public async Task getCurrOperDtoAsync() { - OperatoreDTO answ = new OperatoreDTO(); - //var result = await localStorage.GetItemAsync("Opr"); - //if(result != null) - //{ - // answ= result; - //} + OperatoreDTO answ = new OperatoreDTO(); + var result = await localStorage.GetItemAsync("Opr"); + if (result != null) + { + answ = result; + } return answ; } + /// /// scrive il record OperatoreDTO nel localstorage /// @@ -55,6 +62,7 @@ namespace MP.INVE.Data answ = true; return answ; } + #if false public event Action EA_PageUpdated = null!; @@ -196,7 +204,7 @@ namespace MP.INVE.Data private int _currPage { get; set; } = 1; private int _numRecord { get; set; } = 10; - private int _totalCount { get; set; } = 0; + private int _totalCount { get; set; } = 0; #endif } } \ No newline at end of file From 0344b8ed4a8de1a98f79eb87c7e9ef2d0f68fa9c Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 16 Dec 2022 13:23:14 +0100 Subject: [PATCH 05/19] aggiunto bottone "back to sessioni" --- MP.INVE/Pages/Invio.razor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index 972f1022..df654375 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -13,6 +13,8 @@ else

      Invio

      + TORNA A SESSIONI +
      From e2ef035eb7993614f28bba7e833cde25e63b1c16 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 16 Dec 2022 14:11:08 +0100 Subject: [PATCH 06/19] fix conf produzione --- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- MP.INVE/appsettings.Production.json | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 47dba471..88fec51d 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1612 + 6.16.2212.1614 diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 17a30827..5448e247 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

      Versione: 6.16.2212.1612

      +

      Versione: 6.16.2212.1614


      Note di rilascio:
      • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 2b5d77b5..a8bbf661 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1612 +6.16.2212.1614 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index a40c1b2f..a11b211e 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1612 + 6.16.2212.1614 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false diff --git a/MP.INVE/appsettings.Production.json b/MP.INVE/appsettings.Production.json index 8aa1fd63..65a7782c 100644 --- a/MP.INVE/appsettings.Production.json +++ b/MP.INVE/appsettings.Production.json @@ -10,8 +10,11 @@ "AllowedHosts": "*", "CodApp": "MP.INVE", "ConnectionStrings": { - "Mp.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;", - "Redis": "localhost:6379,DefaultDatabase=13,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false" + "Mp.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;", + "Mp.IS": "Server=SQL2016DEV;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;", + "Mp.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;", + "Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false", + "RedisAdmin": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false,allowAdmin=true" }, "ServerConf": { "maxAge": "2000", @@ -19,4 +22,4 @@ "redisLongTimeCache": 15, "MpIoBaseUrl": "http://localhost/MP/IO/" } -} +} \ No newline at end of file From 48278eb10f3f29c5a50d090c9402938ddd708316 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 16 Dec 2022 14:24:17 +0100 Subject: [PATCH 07/19] fix delay qr --- MP.INVE/Pages/Invio.razor | 14 +++++++------- MP.INVE/Pages/Invio.razor.cs | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index df654375..48768c20 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -67,26 +67,26 @@ else
        - @if (sessione.DtEnd == null) { - + } else { - + } @if ((sessione.DtEnd != null) && (!sessione.Transferred)) { - - + + } else { - - + + }
        diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index a876d830..3ae02aaa 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -130,6 +130,7 @@ namespace MP.INVE.Pages } protected async override Task OnAfterRenderAsync(bool firstRender) { + await Task.Delay(50); if (firstRender) { if (sessione != null) From 537a9c38b58a53f4a88e042068f258ebadaeb184 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 16 Dec 2022 15:04:21 +0100 Subject: [PATCH 08/19] =?UTF-8?q?controllo=20quantit=C3=A0=20udc=20<=3D=20?= =?UTF-8?q?0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MP.INVE/Components/ProcSuggestion.razor | 146 +++++++++++---------- MP.INVE/Components/ProcSuggestion.razor.cs | 35 +++-- MP.INVE/Pages/Cancellazione.razor | 2 +- 3 files changed, 100 insertions(+), 83 deletions(-) diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index 5f7eb404..bcaf3f73 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -10,76 +10,84 @@ @if (!firstMsg) { + @if (!isQtaSbagliata) + { -
          -
        • - Lotto: -
          - - @tipo -
          -
        • -
        • - Articolo: -
          - - @if ((canMod != "false") || (tipo != "U") || (!isKnown)) - { - - } -
          -
        • -
        • - Quantità: -
          - @if (currLottoInterno != null || currLottoEsterno != null) - { - - } - else - { - - } - @if ((canMod != "false") || (tipo != "U") || (!isKnown)) - { - - } -
          -
        • -
        • - Note: -
          - -
          -
        • -
        -
        - @if (articoloScan != "" && quantitaScan != 0 && canSave) - { - - - } - else if (articoloScan == "" && quantitaScan != 0) - { -
        Dati mancanti: Codice articolo
        - } - else if (quantitaScan == 0 && articoloScan != "") - { -
        Dati mancanti: Quantità a "0"
        - } - else if (isKnown) - { -
        Codice già scansionato per la sessione corrente
        - } - else - { -
        Dati mancanti: Codice articolo e Quantità
        - } -
        +
          +
        • + Lotto: +
          + + @tipo +
          +
        • +
        • + Articolo: +
          + + @if ((canMod != "false") || (tipo != "U") || (!isKnown)) + { + + } +
          +
        • +
        • + Quantità: +
          + @if (currLottoInterno != null || currLottoEsterno != null) + { + + } + else + { + + } + @if ((canMod != "false") || (tipo != "U") || (!isKnown)) + { + + } +
          +
        • +
        • + Note: +
          + +
          +
        • +
        +
        + @if (articoloScan != "" && quantitaScan != 0 && canSave) + { + + + } + else if (articoloScan == "" && quantitaScan != 0) + { +
        Dati mancanti: Codice articolo
        + } + else if (quantitaScan == 0 && articoloScan != "") + { +
        Dati mancanti: Quantità a "0"
        + } + else if (isKnown) + { +
        Codice già scansionato per la sessione corrente
        + } + + else + { +
        Dati mancanti: Codice articolo e Quantità
        + } +
        + } + else + { +
        Quantità registrata minore o uguale a 0
        + } } else { diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index c8a43ee1..e7a08a51 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -59,6 +59,7 @@ namespace MP.INVE.Components protected bool isKnown = false; protected bool canSave = true; protected string oldArt = ""; + protected bool isQtaSbagliata = false; protected override async Task OnAfterRenderAsync(bool firstRender) { await Task.Delay(1); @@ -74,12 +75,13 @@ namespace MP.INVE.Components currLottoInterno = null; currUdc = null; alreadyScan = null; - + isQtaSbagliata = false; + // se il valore scansionato è != null... if (string.IsNullOrEmpty(lastScan)) { firstMsg = true; - await Task.Delay(1); + await Task.Delay(1); } else { @@ -129,19 +131,26 @@ namespace MP.INVE.Components if (udc != null) { - var udcString = udc.UDC.Substring(2, 3); - if (udcString == "MFI") + if (udc.Qta > 0) { + var udcString = udc.UDC.Substring(2, 3); + if (udcString == "MFI") + { - isKnown = true; - canSave = true; - currUdc = udc; - tipo = "U"; - lottoScan = udc.lottoNav.Lotto; - oldArt = udc.lottoNav.CodArt; - articoloScan = udc.lottoNav.CodArt; - quantitaScan = Math.Round(udc.Qta, 2); - noteScan = udc.Note; + isKnown = true; + canSave = true; + currUdc = udc; + tipo = "U"; + lottoScan = udc.lottoNav.Lotto; + oldArt = udc.lottoNav.CodArt; + articoloScan = udc.lottoNav.CodArt; + quantitaScan = Math.Round(udc.Qta, 2); + noteScan = udc.Note; + } + } + else + { + isQtaSbagliata = true; } } else diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor index 7fba94a2..7242e6c7 100644 --- a/MP.INVE/Pages/Cancellazione.razor +++ b/MP.INVE/Pages/Cancellazione.razor @@ -9,7 +9,7 @@ @if (currScan != null) { -
        +
        Dati ultima scansione From 89769ca4898efb7a26c67cb723e1c8ff6fbed443 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 17 Dec 2022 08:58:40 +0100 Subject: [PATCH 09/19] cleanup + inizio formattazione tab lotti --- MP.INVE/Components/ListTotLotto.razor | 91 ++++++++++++++++----------- MP.INVE/Pages/Acquisizione.razor | 22 ------- MP.INVE/Pages/Invio.razor | 7 --- 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index 7d3c919d..eea749d9 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -1,38 +1,57 @@ -

        Totale lotti

        - - - - - - - - - - - - - @if (elencoTotLotto != null) - { - @foreach (var item in elencoTotLotto) - { + +
        +
        +
        +
        + Totale lotti +
        +
        +
        + + +
        +
        +
        +
        +
        +
        LottoArticoloDescrizione ArtTot colliTot lotto
        + - - - - - + + + + + - } - } - -
        - @item.Lotto - - @item.CodArticolo - - @item.DescrArt - - @item.NumColli - - @($"{item.TotLotto:N2}") - LottoCod.Art.Descrizione Articolo# ColliQty Tot
        + + + @if (elencoTotLotto != null) + { + @foreach (var item in elencoTotLotto) + { + + + @item.Lotto + + + @item.CodArticolo + + + @item.DescrArt + + + @item.NumColli + + + @($"{item.TotLotto:N2}") + + + } + } + + +
        + +
        \ No newline at end of file diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index f2122071..85f1dc99 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -1,27 +1,5 @@ @page "/Acquisizione" -@*
        -
        MP.INVE
        -
        - Acquisizione -
        -
        - -
        -
        - -
        -
        -
        Menu
        - -
        - -
        *@
        diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index 48768c20..b15d5685 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -110,13 +110,6 @@ else } }
        - - @*if (sessID != 0) - { - - }*@
      } } From f016d8dbd7f7c4b25157dfc2ddc04aa081b231ae Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 17 Dec 2022 09:46:53 +0100 Subject: [PATCH 10/19] INVE: - Completato aggiunta search x lotti anche testo parziale - fix paginazione (non c'era) --- MP.INVE/Components/ListTotLotto.razor | 89 +++----- MP.INVE/Components/ListTotLotto.razor.cs | 126 ++++++---- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Invio.razor | 28 ++- MP.INVE/Pages/Invio.razor.cs | 279 +++++++++++++---------- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 8 files changed, 304 insertions(+), 226 deletions(-) diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index eea749d9..863a00a7 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -1,57 +1,36 @@ - -
      -
      -
      -
      - Totale lotti -
      -
      -
      - - -
      -
      -
      -
      -
      - - +
      + + + + + + + + + + + @if (elencoTotLotto != null) + { + @foreach (var item in elencoTotLotto) + { - - - - - + + + + + - - - @if (elencoTotLotto != null) - { - @foreach (var item in elencoTotLotto) - { - - - - - - - - } - } - -
      LottoCod.Art.Descrizione Articolo# ColliQty Tot
      LottoCod.Art.Descrizione Articolo# ColliQty Tot + @item.Lotto + + @item.CodArticolo + + @item.DescrArt + + @item.NumColli + + @($"{item.TotLotto:N2}") +
      - @item.Lotto - - @item.CodArticolo - - @item.DescrArt - - @item.NumColli - - @($"{item.TotLotto:N2}") -
      -
      - -
      \ No newline at end of file + } + } + + diff --git a/MP.INVE/Components/ListTotLotto.razor.cs b/MP.INVE/Components/ListTotLotto.razor.cs index b8bc91a2..7a3eb14b 100644 --- a/MP.INVE/Components/ListTotLotto.razor.cs +++ b/MP.INVE/Components/ListTotLotto.razor.cs @@ -1,19 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP.INVE; -using MP.INVE.Shared; -using MP.INVE.Components; using MP.Data.DatabaseModels; using MP.INVE.Data; @@ -21,35 +6,72 @@ namespace MP.INVE.Components { public partial class ListTotLotto { + #region Public Properties + + [Parameter] + public SelectInvioParams currParams { get; set; } = null!; + + [Parameter] + public bool isLoading { get; set; } + + [Parameter] + public string searchVal { get; set; } = ""; + + [Parameter] + public int SessionID { get; set; } = 0; + + [Parameter] + public EventCallback updateRecordCount { get; set; } + + #endregion Public Properties + + #region Public Methods + public void Dispose() { elencoTotLotto = null; SearchRecords = null; GC.Collect(); } - [Parameter] - public int SessionID { get; set; } = 0; + + #endregion Public Methods + + #region Protected Fields + + protected List? elencoTotLotto; + + #endregion Protected Fields + + #region Protected Properties [Inject] protected MiDataService MIService { get; set; } = null!; - private int totalCount + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnParametersSetAsync() { - get => currParams.TotCount; - set + await Task.Delay(1); + if (SessionID != 0) { - currParams.TotCount = value; - StateHasChanged(); - } - } - private int numRecord - { - get => currParams.NumRec; - set - { - currParams.NumRec = value; - StateHasChanged(); + await reloadData(); } } + + #endregion Protected Methods + + #region Private Fields + + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int _totalCount { get; set; } = 0; + private int currPage { get => currParams.CurrPage; @@ -60,20 +82,45 @@ namespace MP.INVE.Components } } - protected async override Task OnParametersSetAsync() + private int numRecord { - await Task.Delay(1); - if (SessionID != 0) + get => currParams.NumRec; + set { - await reloadData(); + currParams.NumRec = value; + StateHasChanged(); } } + + private int totalCount + { + get => _totalCount; + set + { + if (_totalCount != value) + { + _totalCount = value; + updateRecordCount.InvokeAsync(value); + } + } + } + + #endregion Private Properties + + #region Private Methods + private async Task reloadData() { elencoTotLotto = null; - totalCount = 0; + //totalCount = 0; isLoading = true; SearchRecords = MIService.InveSessTotLotList(SessionID); + // se ho search --> filtro... + if (!string.IsNullOrEmpty(searchVal)) + { + StringComparison strComp = StringComparison.CurrentCultureIgnoreCase; + SearchRecords = SearchRecords.Where(x => x.CodArticolo.Contains(searchVal, strComp) || x.DescrArt.Contains(searchVal, strComp) || x.Lotto.Contains(searchVal, strComp)).ToList(); + } totalCount = SearchRecords.Count; elencoTotLotto = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); @@ -81,12 +128,7 @@ namespace MP.INVE.Components await Task.Delay(1); isLoading = false; } - protected List? elencoTotLotto; - private List? SearchRecords; - [Parameter] - public SelectInvioParams currParams { get; set; } = null!; - [Parameter] - public bool isLoading { get; set; } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 88fec51d..e78c35e8 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1614 + 6.16.2212.1709 diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index b15d5685..c6893f43 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -12,9 +12,19 @@ else
      -

      Invio

      - TORNA A SESSIONI -
      +
      + Invio +
      + +
      +
      + + + +
      +
      @@ -106,7 +116,17 @@ else { @if (sessID != 0) { - +
      +
      + Totale lotti +
      +
      + +
      + +
      } }
      diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index 3ae02aaa..eb5f7b54 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -1,79 +1,75 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP.INVE; -using MP.INVE.Shared; -using MP.INVE.Components; using Blazored.LocalStorage; -using MP.Data.DTO; -using MP.Data; -using MP.INVE.Data; -using MP.Data.DatabaseModels; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.WebUtilities; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.Data.DTO; +using MP.INVE.Data; namespace MP.INVE.Pages { public partial class Invio { + #region Public Properties + [Inject] public MiDataService MIService { get; set; } = null!; + #endregion Public Properties + + #region Protected Fields + protected SelectInvioParams invioParams = new SelectInvioParams(); + protected bool isLoading = false; + protected bool mostra = false; protected SelectInveSessionParams sessParams = new SelectInveSessionParams(); - private int totalCount + #endregion Protected Fields + + #region Protected Properties + + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } + + protected string codMag { get; set; } = ""; + + [Inject] + protected MessageService MsgService { get; set; } = null!; + + protected string rawCode { - get => invioParams.TotCount; - set + get { - if (invioParams.TotCount != value) - { - invioParams.TotCount = value; - } + string answ = ""; + answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; + return answ; } } - private int numRecord + + protected string searchVal { get; set; } = ""; + + protected int sessID { get; set; } = 0; + + #endregion Protected Properties + + #region Protected Methods + + protected async void apriSessione(int sessID) { - get => invioParams.NumRec; - set + var open = await MIService.CloseOpenSessione(sessID, false); + if (open) { - if (invioParams.NumRec != value) - { - invioParams.NumRec = value; - } + NavManager.NavigateTo(NavManager.Uri, true); } } - private int currPage + + protected async void chiudiSessione(int sessID) { - get => invioParams.CurrPage; - set + var closed = await MIService.CloseOpenSessione(sessID, true); + if (closed) { - if (invioParams.CurrPage != value) - { - invioParams.CurrPage = value; - } + NavManager.NavigateTo(NavManager.Uri, true); } } - private string idOperatore - { - get => sessParams.idOperatore; - set => sessParams.idOperatore = value; - } - private string authKey - { - get => sessParams.authKey; - set => sessParams.authKey = value; - } protected void ForceReload(int newNum) { @@ -84,51 +80,24 @@ namespace MP.INVE.Pages { currPage = newNum; } - protected bool mostra = false; + + protected async Task getId() + { + OperatoreDTO local = new OperatoreDTO(); + local = await MsgService.getCurrOperDtoAsync(); + if (local != null) + { + idOperatore = local.MatrOpr.ToString(); + authKey = local.hashAuthKey; + } + } protected void mostraDati() { mostra = true; } - protected async void chiudiSessione(int sessID) - { - var closed = await MIService.CloseOpenSessione(sessID, true); - if (closed) - { - NavManager.NavigateTo(NavManager.Uri, true); - } - } - protected async void apriSessione(int sessID) - { - var open = await MIService.CloseOpenSessione(sessID, false); - if (open) - { - NavManager.NavigateTo(NavManager.Uri, true); - } - } - protected async void trasfSessione(int sessID) - { - var trasf = await MIService.TransferSessione(sessID); - if (trasf) - { - NavManager.NavigateTo(NavManager.Uri, true); - } - } - protected override async Task OnInitializedAsync() - { - - var uri = NavManager.ToAbsoluteUri(NavManager.Uri); - if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag)) - { - sessID = int.Parse(_inveSessionId); - codMag = _idMag; - } - - await reloadData(); - - } - protected async override Task OnAfterRenderAsync(bool firstRender) + protected override async Task OnAfterRenderAsync(bool firstRender) { await Task.Delay(50); if (firstRender) @@ -145,33 +114,110 @@ namespace MP.INVE.Pages } } - [Inject] - private IConfiguration Configuration { get; set; } = null!; - [Inject] - private IJSRuntime JSRuntime { get; set; } = null!; - [Inject] - private NavigationManager NavManager { get; set; } = null!; - [Inject] - private ILocalStorageService localStorage { get; set; } = null!; - protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } - - - protected string rawCode + protected override async Task OnInitializedAsync() { - get + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag)) { - string answ = ""; - answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; - return answ; + sessID = int.Parse(_inveSessionId); + codMag = _idMag; + } + + await reloadData(); + } + + protected async void trasfSessione(int sessID) + { + var trasf = await MIService.TransferSessione(sessID); + if (trasf) + { + NavManager.NavigateTo(NavManager.Uri, true); } } + protected void UpdateTotCount(int newTotCount) + { + totalCount = newTotCount; + } + + #endregion Protected Methods + + #region Private Fields + private InventorySessionModel? sessione; - protected bool isLoading = false; + + #endregion Private Fields + + #region Private Properties + + private int _totalCount { get; set; } = 0; + + private string authKey + { + get => sessParams.authKey; + set => sessParams.authKey = value; + } + + [Inject] + private IConfiguration Configuration { get; set; } = null!; + + private int currPage + { + get => invioParams.CurrPage; + set + { + if (invioParams.CurrPage != value) + { + invioParams.CurrPage = value; + } + } + } + + private string idOperatore + { + get => sessParams.idOperatore; + set => sessParams.idOperatore = value; + } + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + private ILocalStorageService localStorage { get; set; } = null!; + + [Inject] + private NavigationManager NavManager { get; set; } = null!; + + private int numRecord + { + get => invioParams.NumRec; + set + { + if (invioParams.NumRec != value) + { + invioParams.NumRec = value; + } + } + } + + private int totalCount + { + get => invioParams.TotCount; + set + { + if (invioParams.TotCount != value) + { + invioParams.TotCount = value; + } + } + } + + #endregion Private Properties + + #region Private Methods private async Task reloadData() { - sessione = null; isLoading = true; sessione = MIService.InventSessByID(sessID); @@ -179,20 +225,11 @@ namespace MP.INVE.Pages isLoading = false; } - protected int sessID { get; set; } = 0; - protected string codMag { get; set; } = ""; - - [Inject] - protected MessageService MsgService { get; set; } = null!; - protected async Task getId() + private void reset() { - OperatoreDTO local = new OperatoreDTO(); - local = await MsgService.getCurrOperDtoAsync(); - if (local != null) - { - idOperatore = local.MatrOpr.ToString(); - authKey = local.hashAuthKey; - } + searchVal = ""; } + + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 5448e247..754fa71c 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

      Versione: 6.16.2212.1614

      +

      Versione: 6.16.2212.1709


      Note di rilascio:
      • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index a8bbf661..db30bbbc 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1614 +6.16.2212.1709 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index a11b211e..a53693b8 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1614 + 6.16.2212.1709 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From 99afef80600c6ee539abb8546fcad3f10738d990 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 10:13:58 +0100 Subject: [PATCH 11/19] Add metodi x reset cache invSession --- MP.INVE/Data/MiDataService.cs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 54ebdbc2..1392243c 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -390,6 +390,10 @@ namespace MP.INVE.Data return SteamCrypto.EncryptString(rawData, passPhrase); } + /// + /// Svuota tutta la sessione dalla root di gestione + /// + /// public async Task FlushRedisCache() { await Task.Delay(1); @@ -397,8 +401,27 @@ namespace MP.INVE.Data bool answ = await ExecFlushRedisPattern(pattern); return answ; } + /// + /// Svuota solo il pattern richiesto + /// + /// + /// + public async Task FlushRedisCache(string basePattern) + { + await Task.Delay(1); + RedisValue pattern = new RedisValue($"{basePattern}*"); + bool answ = await ExecFlushRedisPattern(pattern); + return answ; + } - + /// + /// Svuota cahce sessioni inventario + /// + public async Task FlushSessInvCache() + { + bool answ = await FlushRedisCache(redisSessionCurrList) && await FlushRedisCache(redisSessionHistList); + return answ; + } public async Task InsertNewMag(AnagMagModel newMag) { @@ -469,7 +492,7 @@ namespace MP.INVE.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - List result = new List(); + List? result = new List(); string source = "DB"; // cerco in redis... RedisValue rawData = redisDb.StringGet(redisSessionCurrList); From 243c451beff6e44c2d0de2d528cf38a9b4df1bac Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 10:14:27 +0100 Subject: [PATCH 12/19] Dettaglio lotti scansionati: - aggiunta (preliminare) visualizzazione --- MP.INVE/Components/InveSessionList.razor | 5 +- MP.INVE/Components/ListScan.razor.cs | 59 ++++++++------- MP.INVE/Components/ListTotLotto.razor | 87 ++++++++++++++--------- MP.INVE/Components/ListTotLotto.razor.cs | 34 +++++++++ MP.INVE/Components/LotScanDetail.razor | 48 +++++++++++++ MP.INVE/Components/LotScanDetail.razor.cs | 26 +++++++ MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Index.razor.cs | 15 +--- MP.INVE/Pages/InveSession.razor | 2 +- MP.INVE/Pages/Invio.razor | 2 +- MP.INVE/Pages/Invio.razor.cs | 15 ++++ MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 14 files changed, 219 insertions(+), 82 deletions(-) create mode 100644 MP.INVE/Components/LotScanDetail.razor create mode 100644 MP.INVE/Components/LotScanDetail.razor.cs diff --git a/MP.INVE/Components/InveSessionList.razor b/MP.INVE/Components/InveSessionList.razor index f777e5c3..eb6f4e03 100644 --- a/MP.INVE/Components/InveSessionList.razor +++ b/MP.INVE/Components/InveSessionList.razor @@ -70,10 +70,7 @@ - @if (inCorso) - { - - } + diff --git a/MP.INVE/Components/ListScan.razor.cs b/MP.INVE/Components/ListScan.razor.cs index 8ffdd6e3..40456e7d 100644 --- a/MP.INVE/Components/ListScan.razor.cs +++ b/MP.INVE/Components/ListScan.razor.cs @@ -1,19 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; using Microsoft.JSInterop; -using MP.INVE; -using MP.INVE.Shared; -using MP.INVE.Components; using MP.Data.DatabaseModels; using MP.INVE.Data; @@ -21,26 +7,51 @@ namespace MP.INVE.Components { public partial class ListScan { - [Inject] - MiDataService MIService { get; set; } = null!; - [Inject] - IJSRuntime JSRuntime { get; set; } = null!; + #region Public Properties + [Parameter] public string lastScan { get; set; } = ""; - [Parameter] - public string userScan { get; set; } = null!; - [Parameter] - public int sessID { get; set; } = 0; + [Parameter] public string magID { get; set; } = ""; + + [Parameter] + public int sessID { get; set; } = 0; + + [Parameter] + public string userScan { get; set; } = null!; + + #endregion Public Properties + + #region Protected Properties + protected string rawScan { get; set; } = null!; - List? elencoSCAN; + #endregion Protected Properties + + #region Protected Methods + protected override async Task OnParametersSetAsync() { await Task.Delay(1); - } + #endregion Protected Methods + + #region Private Fields + + private List? elencoSCAN; + + #endregion Private Fields + + #region Private Properties + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + private MiDataService MIService { get; set; } = null!; + + #endregion Private Properties } } \ No newline at end of file diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index 863a00a7..7439738a 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -1,36 +1,55 @@ -
        QRApri ID sessione Magazzino Operatore
        - - - - - - - - - - - @if (elencoTotLotto != null) - { - @foreach (var item in elencoTotLotto) - { +
        +
        +
        LottoCod.Art.Descrizione Articolo# ColliQty Tot
        + - - - - - + + + + + + - } - } - -
        - @item.Lotto - - @item.CodArticolo - - @item.DescrArt - - @item.NumColli - - @($"{item.TotLotto:N2}") - + @if (currRecord != null) + { + + } + LottoCod.Art.Descrizione Articolo# ColliQty Tot
        + + + @if (elencoTotLotto != null) + { + @foreach (var item in elencoTotLotto) + { + + + + + + @item.Lotto + + + @item.CodArticolo + + + @item.DescrArt + + + @item.NumColli + + + @($"{item.TotLotto:N2}") + + + } + } + + +
      + @if (currRecord != null) + { +
      + +
      + } +
    \ No newline at end of file diff --git a/MP.INVE/Components/ListTotLotto.razor.cs b/MP.INVE/Components/ListTotLotto.razor.cs index 7a3eb14b..ffd122f5 100644 --- a/MP.INVE/Components/ListTotLotto.razor.cs +++ b/MP.INVE/Components/ListTotLotto.razor.cs @@ -105,6 +105,40 @@ namespace MP.INVE.Components } } + + protected async Task selRecord(InveSessTotLotModel selRecord) + { + currRecord = selRecord; + await Task.Delay(1); + } + + protected async Task resetSel() + { + currRecord = null; + await Task.Delay(1); + } + public string checkSelect(InveSessTotLotModel thisRecord) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.Lotto == thisRecord.Lotto && currRecord.CodArticolo==thisRecord.CodArticolo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public string mainCss + { + get => currRecord != null ? "col-9" : "col-12"; + } + + protected InveSessTotLotModel? currRecord { get; set; } = null; + #endregion Private Properties #region Private Methods diff --git a/MP.INVE/Components/LotScanDetail.razor b/MP.INVE/Components/LotScanDetail.razor new file mode 100644 index 00000000..50c73f98 --- /dev/null +++ b/MP.INVE/Components/LotScanDetail.razor @@ -0,0 +1,48 @@ +

    @LottoSel

    + + + + + + + + + + + + + + + @*@if (elencoTotLotto != null) + { + @foreach (var item in elencoTotLotto) + { + + + + + + + + + } + }*@ + +
    + @*@if (currRecord != null) + { + + }*@ + LottoCod.Art.Descrizione Articolo# ColliQty Tot
    + + + @item.Lotto + + @item.CodArticolo + + @item.DescrArt + + @item.NumColli + + @($"{item.TotLotto:N2}") +
    \ No newline at end of file diff --git a/MP.INVE/Components/LotScanDetail.razor.cs b/MP.INVE/Components/LotScanDetail.razor.cs new file mode 100644 index 00000000..753aa186 --- /dev/null +++ b/MP.INVE/Components/LotScanDetail.razor.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; + +namespace MP.INVE.Components +{ + public partial class LotScanDetail + { + + [Parameter] + public string LottoSel { get; set; } = ""; + } +} \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index e78c35e8..74efc817 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1709 + 6.16.2212.1910 diff --git a/MP.INVE/Pages/Index.razor.cs b/MP.INVE/Pages/Index.razor.cs index 5f7b5a65..8b106951 100644 --- a/MP.INVE/Pages/Index.razor.cs +++ b/MP.INVE/Pages/Index.razor.cs @@ -1,19 +1,11 @@ -using Blazored.LocalStorage; -using Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; -using MP.Data.DTO; -using MP.INVE.Data; namespace MP.INVE.Pages { public partial class Index { - #region Public Properties - //public List? ElencoLink { get; set; } - #endregion Public Properties - #region Protected Methods protected override async Task OnInitializedAsync() @@ -34,14 +26,9 @@ namespace MP.INVE.Pages //await getId(); await Task.Delay(1); } + #endregion Protected Methods - #region Private Fields - - private string currAzienda = ""; - - #endregion Private Fields - #region Private Properties private List? configData { get; set; } = null; diff --git a/MP.INVE/Pages/InveSession.razor b/MP.INVE/Pages/InveSession.razor index 84685ce3..26103cd0 100644 --- a/MP.INVE/Pages/InveSession.razor +++ b/MP.INVE/Pages/InveSession.razor @@ -32,7 +32,7 @@ } else { - + } diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index c6893f43..323c0c15 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -16,7 +16,7 @@ else Invio
    - TORNA A SESSIONI +
    diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index eb5f7b54..c305f1fe 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -56,6 +56,7 @@ namespace MP.INVE.Pages protected async void apriSessione(int sessID) { var open = await MIService.CloseOpenSessione(sessID, false); + await resetCacheSessInv(); if (open) { NavManager.NavigateTo(NavManager.Uri, true); @@ -65,6 +66,7 @@ namespace MP.INVE.Pages protected async void chiudiSessione(int sessID) { var closed = await MIService.CloseOpenSessione(sessID, true); + await resetCacheSessInv(); if (closed) { NavManager.NavigateTo(NavManager.Uri, true); @@ -129,6 +131,7 @@ namespace MP.INVE.Pages protected async void trasfSessione(int sessID) { var trasf = await MIService.TransferSessione(sessID); + await resetCacheSessInv(); if (trasf) { NavManager.NavigateTo(NavManager.Uri, true); @@ -212,6 +215,18 @@ namespace MP.INVE.Pages } } + protected async Task returnToSessions() + { + await resetCacheSessInv(); + // ritorno pagina... + NavManager.NavigateTo("InveSession", true); + } + + private async Task resetCacheSessInv() + { + await MIService.FlushSessInvCache(); + } + #endregion Private Properties #region Private Methods diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 754fa71c..7758f8a0 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 6.16.2212.1709

    +

    Versione: 6.16.2212.1910


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index db30bbbc..c76fe32d 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1709 +6.16.2212.1910 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index a53693b8..043551f1 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1709 + 6.16.2212.1910 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From d4e1c17790135955fab2d92a9af81ad440d3f3a5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 11:39:16 +0100 Subject: [PATCH 13/19] INVE: - Aggiounta navigazione dettaglio scansioni --- MP.Data/Controllers/MpInveController.cs | 45 +++- MP.INVE/Components/InveSessionList.razor.cs | 264 +++++++++++--------- MP.INVE/Components/ListTotLotto.razor | 2 +- MP.INVE/Components/LotScanDetail.razor | 90 ++++--- MP.INVE/Components/LotScanDetail.razor.cs | 46 ++++ MP.INVE/Data/MiDataService.cs | 28 ++- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Invio.razor.cs | 24 +- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 11 files changed, 318 insertions(+), 189 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index e371b009..297f3c01 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -127,8 +127,10 @@ namespace MP.Data.Controllers /// /// Elenco Scansioni Totali /// + /// + /// /// - public ScanDataModel ScanByUdcSession(string udc, int InveSessId) + public ScanDataModel ScanByUdcSession(string Udc, int InveSessId) { ScanDataModel dbResult = new ScanDataModel(); using (var dbCtx = new MoonPro_InveContext(_configuration)) @@ -137,7 +139,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbScanData - .Where(x => (x.ScanValue == udc) && (x.InveSessID == InveSessId)) + .Where(x => (x.ScanValue == Udc) && (x.InveSessID == InveSessId)) .AsNoTracking() .OrderByDescending(x => x.DtScan) .FirstOrDefault(); @@ -146,7 +148,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbScanData - .Where(x => (x.ScanValue == udc)) + .Where(x => (x.ScanValue == Udc)) .AsNoTracking() .OrderByDescending(x => x.DtScan) .FirstOrDefault(); @@ -154,6 +156,39 @@ namespace MP.Data.Controllers } return dbResult; } + + /// + /// Elenco Scansioni dato lotto e sessione + /// + /// + /// + /// + public List ScanByLottoSession(string Lotto, int InveSessId) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + if (InveSessId != 0) + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.Lotto == Lotto) && (x.InveSessID == InveSessId)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .ToList(); + } + else + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.Lotto == Lotto)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .ToList(); + } + } + return dbResult; + } /// /// Elenco Scansioni per valore, operatore e sessione /// @@ -443,7 +478,7 @@ namespace MP.Data.Controllers #region gestione UDC /// - /// elenco udc + /// elenco Udc /// /// public List ElencoUdc() @@ -461,7 +496,7 @@ namespace MP.Data.Controllers return dbResult; } /// - /// check udc + /// check Udc /// /// /// diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index 02c22582..9946e90d 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -1,27 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP.INVE; -using MP.INVE.Shared; -using MP.INVE.Components; -using MP.INVE.Data; -using MP.Data.DatabaseModels; using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.INVE.Data; namespace MP.INVE.Components { public partial class InveSessionList : IDisposable { + #region Public Properties + + public string currIdMag { get; set; } + + public int currIdSess { get; set; } + + [Parameter] + public SelectInveSessionParams currParams { get; set; } = null!; + + [Parameter] + public bool isLoading { get; set; } + + #endregion Public Properties + + #region Public Methods public void Dispose() { @@ -31,8 +32,123 @@ namespace MP.INVE.Components SearchRecords = null; GC.Collect(); } - private int magazzino { get; set; } = 0; + + #endregion Public Methods + + #region Protected Properties + + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + + protected string rawCode + { + get + { + string answ = ""; + answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; + return answ; + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task getCurrSess(int idSess, string idMag) + { + currIdSess = idSess; + currIdMag = idMag; + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + + protected override async Task OnParametersSetAsync() + { + await reloadData(); + await popola(); + } + + protected async Task popola() + { + await Task.Delay(1); + if (reqNew) + { + elencoOperatori = MIDataservice.ElencoOperatori(); + ElencoMagazzini = MIDataservice.ElencoMagazzini(); + } + } + + #endregion Protected Methods + + #region Private Fields + + private List? ElencoMagazzini; + private List? elencoOperatori; + private List? elencoSessioni; + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private string authKey + { + get => currParams.authKey; + set => currParams.authKey = value; + } + + [Inject] + private IConfiguration Configuration { get; set; } = null!; + + private int currPage + { + get => currParams.CurrPage; + set + { + currParams.CurrPage = value; + StateHasChanged(); + } + } + private string desc { get; set; } = ""; + private DateTime dtEnd { get; set; } = DateTime.Now; + private DateTime dtStart { get; set; } = DateTime.Now.AddMonths(-1); + + private string idOperatore + { + get => currParams.idOperatore; + set => currParams.idOperatore = value; + } + + private bool inCorso + { + get => currParams.inCorso; + set => currParams.inCorso = value; + } + + private int magazzino { get; set; } = 0; + + [Inject] + private MiDataService MIDataservice { get; set; } = null!; + + private int numRecord + { + get => currParams.NumRec; + set + { + currParams.NumRec = value; + StateHasChanged(); + } + } + private bool reqNew { get => currParams.reqNew; @@ -44,40 +160,10 @@ namespace MP.INVE.Components get => currParams.TotCount; set => currParams.TotCount = value; } - private int numRecord - { - get => currParams.NumRec; - set - { - currParams.NumRec = value; - StateHasChanged(); - } - } - private int currPage - { - get => currParams.CurrPage; - set - { - currParams.CurrPage = value; - StateHasChanged(); - } - } - private string idOperatore - { - get => currParams.idOperatore; - set => currParams.idOperatore = value; - } - private string authKey - { - get => currParams.authKey; - set => currParams.authKey = value; - } - private bool inCorso - { - get => currParams.inCorso; - set => currParams.inCorso = value; - } + #endregion Private Properties + + #region Private Methods private void closeNew() { @@ -86,38 +172,16 @@ namespace MP.INVE.Components ElencoMagazzini = new List(); } - private DateTime dtStart { get; set; } = DateTime.Now.AddMonths(-1); - private DateTime dtEnd { get; set; } = DateTime.Now; - - protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } - - - protected string rawCode + private async Task deleteSession(InventorySessionModel session) { - get + var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare una nuova sessione per il magazzino selezionato?"); + if (alert) { - string answ = ""; - answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; - return answ; + await MIDataservice.deleteSessione(session); + NavManager.NavigateTo(NavManager.Uri, true); + await reloadData(); } } - protected async Task popola() - { - await Task.Delay(1); - if (reqNew) - { - elencoOperatori = MIDataservice.ElencoOperatori(); - ElencoMagazzini = MIDataservice.ElencoMagazzini(); - } - } - - protected async Task getCurrSess(int idSess, string idMag) - { - currIdSess = idSess; - currIdMag = idMag; - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); - } private async Task insertNewSession() { @@ -144,22 +208,7 @@ namespace MP.INVE.Components closeNew(); } } - protected override async Task OnParametersSetAsync() - { - await reloadData(); - await popola(); - } - private async Task deleteSession(InventorySessionModel session) - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare una nuova sessione per il magazzino selezionato?"); - if (alert) - { - await MIDataservice.deleteSessione(session); - NavManager.NavigateTo(NavManager.Uri, true); - await reloadData(); - } - } private async Task reloadData() { elencoSessioni = null; @@ -180,29 +229,6 @@ namespace MP.INVE.Components isLoading = false; } - [Parameter] - public SelectInveSessionParams currParams { get; set; } = null!; - - [Parameter] - public bool isLoading { get; set; } - - public int currIdSess { get; set; } - public string currIdMag { get; set; } - - [Inject] - private MiDataService MIDataservice { get; set; } = null!; - [Inject] - private IConfiguration Configuration { get; set; } = null!; - [Inject] - protected ILocalStorageService localStorage { get; set; } = null!; - [Inject] - protected NavigationManager NavManager { get; set; } = null!; - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - private List? elencoSessioni; - private List? SearchRecords; - private List? elencoOperatori; - private List? ElencoMagazzini; + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index 7439738a..72d45a9b 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -49,7 +49,7 @@ @if (currRecord != null) {
      - +
      }
    \ No newline at end of file diff --git a/MP.INVE/Components/LotScanDetail.razor b/MP.INVE/Components/LotScanDetail.razor index 50c73f98..d677160c 100644 --- a/MP.INVE/Components/LotScanDetail.razor +++ b/MP.INVE/Components/LotScanDetail.razor @@ -1,48 +1,44 @@ -

    @LottoSel

    - - - - - - - - - - - - - - - @*@if (elencoTotLotto != null) - { - @foreach (var item in elencoTotLotto) - { - - - - - - - +
    +
    +
    +
    + @LottoSel +
    +
    + @CodArtSel +
    +
    +
    +
    +
    - @*@if (currRecord != null) - { - - }*@ - LottoCod.Art.Descrizione Articolo# ColliQty Tot
    - - - @item.Lotto - - @item.CodArticolo - - @item.DescrArt - - @item.NumColli - - @($"{item.TotLotto:N2}") -
    + + + + + - } - }*@ - -
    DTimeUserQty
    \ No newline at end of file + + + @if (ListRecords != null) + { + @foreach (var item in ListRecords) + { + + + + @($"{item.DtScan:yy.MM.dd HH:mm:ss}") + + + + @item.CodArticolo + + + @($"{item.Qty:N2}") + + + } + } + + +
    + diff --git a/MP.INVE/Components/LotScanDetail.razor.cs b/MP.INVE/Components/LotScanDetail.razor.cs index 753aa186..4f7c71d0 100644 --- a/MP.INVE/Components/LotScanDetail.razor.cs +++ b/MP.INVE/Components/LotScanDetail.razor.cs @@ -14,6 +14,8 @@ using Microsoft.JSInterop; using MP.INVE; using MP.INVE.Shared; using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; namespace MP.INVE.Components { @@ -22,5 +24,49 @@ namespace MP.INVE.Components [Parameter] public string LottoSel { get; set; } = ""; + + [Parameter] + public string CodArtSel { get; set; } = ""; + [Parameter] + public int InveSessID { get; set; } = 0; + + protected override async Task OnParametersSetAsync() + { + await reloadData(); + } + + private async Task reloadData() + { + ListRecords = null; + //totalCount = 0; + isLoading = true; + SearchRecords = await MIService.ScanByLottoSession(LottoSel, InveSessID); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords;//.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + await Task.Delay(1); + isLoading = false; + } + + private int _totalCount { get; set; } = 0; + private int totalCount + { + get => _totalCount; + set + { + if (_totalCount != value) + { + _totalCount = value; + //updateRecordCount.InvokeAsync(value); + } + } + } + private List? SearchRecords; + protected List? ListRecords; + public bool isLoading { get; set; } + + [Inject] + protected MiDataService MIService { get; set; } = null!; } } \ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 1392243c..d0bccb35 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -669,7 +669,12 @@ namespace MP.INVE.Data return result; } } - + /// + /// Scansioni dati UDC e sessione + /// + /// + /// + /// public ScanDataModel ScanByUdcSession(string udc, int inveSessId) { string source = ""; @@ -684,6 +689,27 @@ namespace MP.INVE.Data return result; } + /// + /// Scansioni dato lotto e sessione + /// + /// + /// + /// + public async Task> ScanByLottoSession(string lotto, int inveSessId) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + result = dbController.ScanByLottoSession(lotto, inveSessId); + source = "DB"; + stopWatch.Stop(); + await Task.Delay(1); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByLottoSession Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List ScanByValueSessionOpr(string scanData, int inveSessId, string Opr) { string source = ""; diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 74efc817..9d06efae 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1910 + 6.16.2212.1911 diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index c305f1fe..f2cdbfb4 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -128,6 +128,13 @@ namespace MP.INVE.Pages await reloadData(); } + protected async Task returnToSessions() + { + await resetCacheSessInv(); + // ritorno pagina... + NavManager.NavigateTo("InveSession", true); + } + protected async void trasfSessione(int sessID) { var trasf = await MIService.TransferSessione(sessID); @@ -215,18 +222,6 @@ namespace MP.INVE.Pages } } - protected async Task returnToSessions() - { - await resetCacheSessInv(); - // ritorno pagina... - NavManager.NavigateTo("InveSession", true); - } - - private async Task resetCacheSessInv() - { - await MIService.FlushSessInvCache(); - } - #endregion Private Properties #region Private Methods @@ -245,6 +240,11 @@ namespace MP.INVE.Pages searchVal = ""; } + private async Task resetCacheSessInv() + { + await MIService.FlushSessInvCache(); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 7758f8a0..945beb08 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

    Versione: 6.16.2212.1910

    +

    Versione: 6.16.2212.1911


    Note di rilascio:
    • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index c76fe32d..fd2f65f4 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1910 +6.16.2212.1911 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 043551f1..857bbfb1 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1910 + 6.16.2212.1911 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From 53b355c03624ceb6186f0f43ea91b0c8b5ebb234 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 15:04:13 +0100 Subject: [PATCH 14/19] rename started in elencomagazzini --- .../{Starter.razor => ElencoMagazzini.razor} | 0 ...tarter.razor.cs => ElencoMagazzini.razor.cs} | 17 +++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) rename MP.INVE/Pages/{Starter.razor => ElencoMagazzini.razor} (100%) rename MP.INVE/Pages/{Starter.razor.cs => ElencoMagazzini.razor.cs} (93%) diff --git a/MP.INVE/Pages/Starter.razor b/MP.INVE/Pages/ElencoMagazzini.razor similarity index 100% rename from MP.INVE/Pages/Starter.razor rename to MP.INVE/Pages/ElencoMagazzini.razor diff --git a/MP.INVE/Pages/Starter.razor.cs b/MP.INVE/Pages/ElencoMagazzini.razor.cs similarity index 93% rename from MP.INVE/Pages/Starter.razor.cs rename to MP.INVE/Pages/ElencoMagazzini.razor.cs index e15de5c8..f59742f5 100644 --- a/MP.INVE/Pages/Starter.razor.cs +++ b/MP.INVE/Pages/ElencoMagazzini.razor.cs @@ -22,7 +22,7 @@ using MP.Data.DatabaseModels; namespace MP.INVE.Pages { - public partial class Starter + public partial class ElencoMagazzini { [Inject] private IConfiguration Configuration { get; set; } = null!; @@ -85,13 +85,14 @@ namespace MP.INVE.Pages } - private List? ElencoMagazzini; - protected override async Task OnInitializedAsync() + private List? ListaMagazzini; + + protected override async Task OnParametersSetAsync() { - await Task.Delay(1); await reloadData(); - //await getId(); + await Task.Delay(1); } + private void openNew() { reqNew = true; @@ -106,9 +107,9 @@ namespace MP.INVE.Pages private async Task reloadData() { await Task.Delay(1); - ElencoMagazzini = null; + //ListaMagazzini = null; isLoading = true; - ElencoMagazzini = MIDataservice.ElencoMagazzini(); + //ListaMagazzini = MIDataservice.MagazziniList(); isLoading = false; } @@ -128,7 +129,7 @@ namespace MP.INVE.Pages await MIDataservice.InsertNewMag(newMag); NavManager.NavigateTo(NavManager.Uri, true); //await MIDataservice.FlushRedisCache(); - await reloadData(); + //await reloadData(); } else { From dd2a47f2c759c584e78d330d4ee23720422dd95a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 15:04:33 +0100 Subject: [PATCH 15/19] Rename vari metodo elenco magazzini --- MP.Data/Controllers/MpInveController.cs | 2 +- MP.INVE/Components/CmpTop.razor.cs | 2 +- MP.INVE/Components/InveSessionList.razor.cs | 2 +- MP.INVE/Components/MagList.razor.cs | 2 +- MP.INVE/Data/MiDataService.cs | 4 ++-- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 297f3c01..8455f3ac 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -374,7 +374,7 @@ namespace MP.Data.Controllers /// Elenco Magazzini ///
/// - public List ElencoMagazzini() + public List MagazziniList() { List dbResult = new List(); using (var dbCtx = new MoonPro_InveContext(_configuration)) diff --git a/MP.INVE/Components/CmpTop.razor.cs b/MP.INVE/Components/CmpTop.razor.cs index 7dd888a0..900957a1 100644 --- a/MP.INVE/Components/CmpTop.razor.cs +++ b/MP.INVE/Components/CmpTop.razor.cs @@ -58,7 +58,7 @@ namespace MP.INVE.Components userName = $"{answ.Cognome} {answ.Nome} ({answ.MatrOpr})"; if (NavManager.Uri.Contains("OperatoreLogin")) { - NavManager.NavigateTo("Starter", true); + NavManager.NavigateTo("ElencoMagazzini", true); } } else diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index 9946e90d..14b129a9 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -82,7 +82,7 @@ namespace MP.INVE.Components if (reqNew) { elencoOperatori = MIDataservice.ElencoOperatori(); - ElencoMagazzini = MIDataservice.ElencoMagazzini(); + ElencoMagazzini = MIDataservice.MagazziniList(); } } diff --git a/MP.INVE/Components/MagList.razor.cs b/MP.INVE/Components/MagList.razor.cs index 439e3ca7..0e687681 100644 --- a/MP.INVE/Components/MagList.razor.cs +++ b/MP.INVE/Components/MagList.razor.cs @@ -90,7 +90,7 @@ namespace MP.INVE.Components isLoading = true; ElencoMagazzini = null; SearchRecords = null; - SearchRecords = MIDataservice.ElencoMagazzini(); + SearchRecords = MIDataservice.MagazziniList(); totalCount = SearchRecords.Count; ElencoMagazzini = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index d0bccb35..b23209b3 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -291,7 +291,7 @@ namespace MP.INVE.Data return result; } - public List ElencoMagazzini() + public List MagazziniList() { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); @@ -306,7 +306,7 @@ namespace MP.INVE.Data } else { - result = dbController.ElencoMagazzini(); + result = dbController.MagazziniList(); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSetAsync(redisMagList, rawData, getRandTOut(redisLongTimeCache)); diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 9d06efae..e456678f 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1911 + 6.16.2212.1915 diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 945beb08..0c65bcd2 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.1911

+

Versione: 6.16.2212.1915


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index fd2f65f4..0ce79757 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1911 +6.16.2212.1915 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 857bbfb1..81e37a78 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1911 + 6.16.2212.1915 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false From ff36428fcf93b035f1c27adf480061d77af73d44 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 15:18:24 +0100 Subject: [PATCH 16/19] Aggiunto filtro x magazzino o descrizione x invetari --- MP.INVE/Components/InveSessionList.razor.cs | 11 +++++++++ MP.INVE/Data/SelectInveSessionParams.cs | 4 +++ MP.INVE/Pages/InveSession.razor | 27 +++++++++++++++------ MP.INVE/Pages/InveSession.razor.cs | 17 +++++++------ 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index 14b129a9..1434fecc 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -104,6 +104,11 @@ namespace MP.INVE.Components get => currParams.authKey; set => currParams.authKey = value; } + private string searchVal + { + get => currParams.searchVal; + set => currParams.searchVal = value; + } [Inject] private IConfiguration Configuration { get; set; } = null!; @@ -221,6 +226,12 @@ namespace MP.INVE.Components { SearchRecords = MIDataservice.InventSessHistList(); } + //verifico filtro ricerca mag + if (!string.IsNullOrEmpty(searchVal)) + { + StringComparison strComp = StringComparison.CurrentCultureIgnoreCase; + SearchRecords = SearchRecords.Where(x => x.AnagMagNav.DescMag.Contains(searchVal, strComp) || x.Description.Contains(searchVal, strComp)).ToList(); + } totalCount = SearchRecords.Count; elencoSessioni = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); diff --git a/MP.INVE/Data/SelectInveSessionParams.cs b/MP.INVE/Data/SelectInveSessionParams.cs index 641536c3..9fbd04aa 100644 --- a/MP.INVE/Data/SelectInveSessionParams.cs +++ b/MP.INVE/Data/SelectInveSessionParams.cs @@ -23,6 +23,7 @@ namespace MP.INVE.Data public int currIdSession { get; set; } = 0; public int currIdMag { get; set; } = 0; public bool reqNew { get; set; } = false; + public string searchVal { get; set; } = ""; #endregion Public Properties @@ -33,6 +34,9 @@ namespace MP.INVE.Data if (!(obj is SelectInveSessionParams item)) return false; + if (searchVal != item.searchVal) + return false; + if (MaxRecord != item.MaxRecord) return false; diff --git a/MP.INVE/Pages/InveSession.razor b/MP.INVE/Pages/InveSession.razor index 26103cd0..3e90668e 100644 --- a/MP.INVE/Pages/InveSession.razor +++ b/MP.INVE/Pages/InveSession.razor @@ -4,10 +4,19 @@
    -
    -

    Sessione

    +
    +
    +
    + Sessione +
    +
    + +
    +
    -
    +
    In corso @@ -18,10 +27,12 @@
    -
    - +
    +
    + + + +
    @@ -32,7 +43,7 @@ } else { - + }
    diff --git a/MP.INVE/Pages/InveSession.razor.cs b/MP.INVE/Pages/InveSession.razor.cs index 85edd283..0ac93b5d 100644 --- a/MP.INVE/Pages/InveSession.razor.cs +++ b/MP.INVE/Pages/InveSession.razor.cs @@ -28,13 +28,11 @@ namespace MP.INVE.Pages private SelectInveSessionParams currParams = new SelectInveSessionParams(); - private List? elencoSessioni; - private List? SearchRecords; - private List? elencoOperatori; - private List? ElencoMagazzini; - - private DataPager pagerSession = null!; - + protected string searchVal + { + get => currParams.searchVal; + set => currParams.searchVal = value; + } protected override async Task OnInitializedAsync() { await getId(); @@ -50,6 +48,11 @@ namespace MP.INVE.Pages await Task.Delay(1); } + protected async Task reset() + { + searchVal = ""; + await Task.Delay(1); + } private bool isLoading { get; set; } = false; From febe81376e6f40e0e3482c9b0ff10c2e96b15310 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 15:43:53 +0100 Subject: [PATCH 17/19] LInk contatti --- MP.INVE/Shared/NavMenu.razor | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/MP.INVE/Shared/NavMenu.razor b/MP.INVE/Shared/NavMenu.razor index 544e4bd0..e921f79d 100644 --- a/MP.INVE/Shared/NavMenu.razor +++ b/MP.INVE/Shared/NavMenu.razor @@ -52,26 +52,36 @@
    -@* + @* *@ @**@ + +
    + +
    +
    + Invio +
    +
    +
    *@ } From 4599a7a4021d86e0472c5d919883063a854e4130 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 17:13:22 +0100 Subject: [PATCH 18/19] Typo --- MP.INVE/Components/NavMenuTerm.razor.cs | 6 +++--- MP.INVE/Pages/Acquisizione.razor | 3 --- MP.INVE/Pages/Cancellazione.razor | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/MP.INVE/Components/NavMenuTerm.razor.cs b/MP.INVE/Components/NavMenuTerm.razor.cs index 19867279..8e1e8691 100644 --- a/MP.INVE/Components/NavMenuTerm.razor.cs +++ b/MP.INVE/Components/NavMenuTerm.razor.cs @@ -23,7 +23,6 @@ namespace MP.INVE.Components public partial class NavMenuTerm { private bool collapseNavMenu = true; - //public List? ElencoLink { get; set; } private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; private void ToggleNavMenu() { @@ -39,6 +38,7 @@ namespace MP.INVE.Components protected string @cssCancScan = ""; protected override async Task OnInitializedAsync() { + await Task.Delay(1); if (isScan) { cssCancScan = "bg-info"; @@ -52,8 +52,8 @@ namespace MP.INVE.Components cssCancBack = "background-color: rgba(255,255,255,0.7)"; cssCanc = "fw-bold text-decoration-underline"; } - // recupero elenco JQM - //ElencoLink = await MDService.ElencoLink(); + // verifico se sia tutto OK (sessione aperta) + } protected bool showText { get; set; } = true; diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index 85f1dc99..dfe0ef8c 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -19,9 +19,6 @@
    - @*if (rawScan != null) - { - }*@
    diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor index 7242e6c7..13f4ada8 100644 --- a/MP.INVE/Pages/Cancellazione.razor +++ b/MP.INVE/Pages/Cancellazione.razor @@ -5,7 +5,6 @@
    - @if (currScan != null) { From ea6bd732b8c6e070b52ec56fa91a31c6054f4561 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 17:17:18 +0100 Subject: [PATCH 19/19] Fix dettaglio utente --- MP.INVE/Components/LotScanDetail.razor | 2 +- MP.INVE/Pages/ClosedSession.razor | 7 ++++ MP.INVE/Pages/ClosedSession.razor.cs | 54 ++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 MP.INVE/Pages/ClosedSession.razor create mode 100644 MP.INVE/Pages/ClosedSession.razor.cs diff --git a/MP.INVE/Components/LotScanDetail.razor b/MP.INVE/Components/LotScanDetail.razor index d677160c..c5244c69 100644 --- a/MP.INVE/Components/LotScanDetail.razor +++ b/MP.INVE/Components/LotScanDetail.razor @@ -30,7 +30,7 @@ - @item.CodArticolo + @item.UserScan @($"{item.Qty:N2}") diff --git a/MP.INVE/Pages/ClosedSession.razor b/MP.INVE/Pages/ClosedSession.razor new file mode 100644 index 00000000..8785d2b3 --- /dev/null +++ b/MP.INVE/Pages/ClosedSession.razor @@ -0,0 +1,7 @@ +@page "/ClosedSession" +
    + +
    +

    ClosedSession

    + + diff --git a/MP.INVE/Pages/ClosedSession.razor.cs b/MP.INVE/Pages/ClosedSession.razor.cs new file mode 100644 index 00000000..a19bbebc --- /dev/null +++ b/MP.INVE/Pages/ClosedSession.razor.cs @@ -0,0 +1,54 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.WebUtilities; +using MP.INVE.Data; + +namespace MP.INVE.Pages +{ + public partial class ClosedSession + { + #region Protected Properties + + protected string descr { get; set; } = ""; + protected string idOpr { get; set; } = null!; + protected string link { get; set; } = ""; + protected string magazzinoId { get; set; } = ""; + + protected string magInv { get; set; } = ""; + + [Inject] + protected MiDataService MIService { get; set; } = null!; + + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + + protected int sessionId { get; set; } = 0; + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSess", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag)) + { + idOpr = _matrOpr; + sessionId = int.Parse(_inveSessionId); + magazzinoId = _idMag; + + // recupero dati della sessione di inventario... + var currSessions = MIService.InventSessCurrList(); + var currInv = currSessions.Where(x => x.InveSessID == sessionId).FirstOrDefault(); + if (currInv != null) + { + descr = currInv.Description; + magInv = currInv.AnagMagNav.DescMag; + } + } + link = $"ClosedSession?idOpr={idOpr}&sessID={sessionId}"; + } + + #endregion Protected Methods + } +} \ No newline at end of file