From 56872db21e9a2b21230f8cba8a67b13d5589cfcc Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 13 Dec 2022 14:39:06 +0100 Subject: [PATCH] cambiato approccio per disegno componente acquisizione --- MP.INVE/Components/ProcSuggestion.razor | 10 ++- MP.INVE/Components/ProcSuggestion.razor.cs | 95 +++++++++++++--------- MP.INVE/Data/MiDataService.cs | 54 ++++++++++-- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 6 files changed, 113 insertions(+), 52 deletions(-) diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index 1a11f12d..7c284006 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -21,7 +21,7 @@ Articolo:
- @if ((canMod != "false") || (tipo != "UDC")) + @if ((canMod != "false") || (tipo != "U") || (!isKnown)) { @@ -69,6 +69,10 @@ {
Dati mancanti: Quantità a "0"
} + else if (isKnown) + { +
Codice già scansionato per la sessione corrente
+ } else {
Dati mancanti: Codice articolo e Quantità
diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index b99857df..9884bcc1 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -58,7 +58,8 @@ namespace MP.INVE.Components protected bool alertScan; protected bool isScannedLotto; protected bool firstMsg = false; - protected bool isMod = true; + protected bool isKnown = false; + protected bool canSave = true; protected override async Task OnAfterRenderAsync(bool firstRender) { await Task.Delay(1); @@ -79,25 +80,30 @@ namespace MP.INVE.Components { await MIService.ConfigResetCache(); var result = await MIService.tryGetConfig("MAG_SmartUdcEdit"); - elencoScansioni = MIService.ScanList(); - var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan); - var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); + int sessIDSearch = 0; - if (exists) + if (lastScan.Contains("MFI") && lastScan.Length == 14) { - if (scansioneClone != null) + sessIDSearch = sessID; + } + var scansioneClone = MIService.ScanByUdcSession(lastScan, sessID); + if (scansioneClone != null) + { + //isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); + isKnown = false; + if (scansioneClone.IsUnique) { - isScannedLotto = scansioneClone.ScanValue.StartsWith("M2"); - isMod = true; - if (scansioneClone.IsUnique) - { - isMod = false; - } - alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - currUdc = null; - currLottoInterno = null; - + isKnown = true; + canSave = false; } + alreadyScan = scansioneClone; + lottoScan = alreadyScan.ScanValue; + articoloScan = alreadyScan.CodArticolo; + quantitaScan = Math.Round(alreadyScan.Qty, 2); + noteScan = alreadyScan.Note; + currUdc = null; + currLottoInterno = null; + } else { @@ -106,34 +112,33 @@ namespace MP.INVE.Components canMod = result; } await Task.Delay(1); - searchRecordsUDC = MIService.ElencoUDC(); - udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault(); + udc = MIService.IsUDC(lastScan); if (udc != null && !udc.UDC.Contains("MSL")) { - + isKnown = true; + canSave= true; currUdc = udc; - tipo = "UDC"; + tipo = "U"; lottoScan = udc.lottoNav.Lotto; articoloScan = udc.lottoNav.CodArt; - quantitaScan = udc.Qta; + quantitaScan = Math.Round(udc.Qta, 2); noteScan = udc.Note; } else { if (lastScan.StartsWith("M") && lastScan.Length == 10) { - searchRecordsLottoInterni = MIService.ElencoLotti(); - lottoInterno = searchRecordsLottoInterni.Where(x => (x.Lotto == lastScan) && x.Origine == "INT").FirstOrDefault(); + lottoInterno = MIService.LottoInterno(lastScan); } else { - searchRecordsLottoEsterni = MIService.ListLottiEsterni("", lastScan, magID); - lottoEsterno = searchRecordsLottoEsterni.FirstOrDefault(); + lottoEsterno = MIService.LottoEsterno("", lastScan, magID); } if (lottoInterno != null) { - tipo = "LOTTO"; + canSave = true; + tipo = "LI"; currLottoInterno = lottoInterno; lottoScan = lottoInterno.Lotto; articoloScan = lottoInterno.CodArt; @@ -143,7 +148,8 @@ namespace MP.INVE.Components { if (lottoEsterno != null) { - tipo = "LOTTO EXT"; + canSave = true; + tipo = "LE"; currLottoEsterno = lottoEsterno; if (lottoEsterno.Cd_ARLotto != null) { @@ -155,7 +161,8 @@ namespace MP.INVE.Components } else { - + canSave = true; + tipo = "S"; currLottoInterno = null; currUdc = null; alreadyScan = null; @@ -242,8 +249,8 @@ namespace MP.INVE.Components CodArticolo = alreadyScan.CodArticolo, Lotto = alreadyScan.Lotto, RifExt = alreadyScan.RifExt, - Qty = alreadyScan.Qty, - Note = alreadyScan.Note, + Qty = quantitaScan, + Note = noteScan, IsKnown = alreadyScan.IsKnown, IsUnique = alreadyScan.IsUnique, InveSessID = sessID @@ -251,14 +258,26 @@ namespace MP.INVE.Components await MIService.InsertNewScansione(newScan); NavManager.NavigateTo(NavManager.Uri, true); } - //} - //else - //{ - // currLotto = null; - // currUdc = null; - // alreadyScan = null; - // NavManager.NavigateTo(NavManager.Uri, true); - //} + else + { + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = true, + CodArticolo = articoloScan, + Lotto = lastScan, + RifExt = "", + Qty = quantitaScan, + Note = noteScan, + IsKnown = false, + IsUnique = false, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); + } } else { diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 3b229390..0c547067 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -298,22 +298,18 @@ namespace MP.INVE.Data } - public List ListLottiEsterni(string codArt, string codLotto, string codMagazzino) + public AnagLottiArca LottoEsterno(string codArt, string codLotto, string codMagazzino) { string source = ""; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); - List? result = new List(); + AnagLottiArca? result = new AnagLottiArca(); // cerco in redis... - result = dbController.ListLottiEsterni(codArt, codLotto, codMagazzino); + result = dbController.LottoEsterno(codArt, codLotto, codMagazzino); source = "DB"; - if (result == null) - { - result = new List(); - } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListLottiEsterni Read from {source}: {ts.TotalMilliseconds}ms"); + Log.Debug($"LottoEsterno Read from {source}: {ts.TotalMilliseconds}ms"); return result; } @@ -348,6 +344,20 @@ namespace MP.INVE.Data Log.Debug($"ScanList 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 ScanBySession(int idSessione) { string source = ""; @@ -395,6 +405,7 @@ namespace MP.INVE.Data await Task.Delay(1); return dbResult; } + public List ElencoUDC() { string source = ""; @@ -426,6 +437,33 @@ namespace MP.INVE.Data Log.Debug($"ElencoUDC Read from {source}: {ts.TotalMilliseconds}ms"); 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 = ""; diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index d3cb4d19..8099495c 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.1311

+

Versione: 6.16.2212.1314


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 9ad771bc..c11b05c6 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1311 +6.16.2212.1314 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index f9d02534..1c16e51b 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1311 + 6.16.2212.1314 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