From 310fe9c1f7467e9687de940e6e2bdea6c44bfeed Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 7 Dec 2022 10:16:59 +0100 Subject: [PATCH] fix gestione dati mancanti per aggiunta scan --- MP.INVE/Components/CodeScan.razor | 1 + MP.INVE/Components/CodeScan.razor.cs | 5 +- MP.INVE/Components/ProcSuggestion.razor | 56 ++++++++++++++++++---- MP.INVE/Components/ProcSuggestion.razor.cs | 27 +++-------- 4 files changed, 59 insertions(+), 30 deletions(-) diff --git a/MP.INVE/Components/CodeScan.razor b/MP.INVE/Components/CodeScan.razor index c8b47e41..cc6b2c68 100644 --- a/MP.INVE/Components/CodeScan.razor +++ b/MP.INVE/Components/CodeScan.razor @@ -3,4 +3,5 @@ + diff --git a/MP.INVE/Components/CodeScan.razor.cs b/MP.INVE/Components/CodeScan.razor.cs index 5bfafafa..2c0002dd 100644 --- a/MP.INVE/Components/CodeScan.razor.cs +++ b/MP.INVE/Components/CodeScan.razor.cs @@ -16,6 +16,7 @@ using MP.INVE.Shared; using MP.INVE.Components; using MP.INVE.Data; using StackExchange.Redis; +using NLog.Targets; namespace MP.INVE.Components { @@ -27,6 +28,7 @@ namespace MP.INVE.Components private ElementReference target; + private ElementReference target2; public SelectScanParams currParams = new SelectScanParams(); @@ -42,7 +44,8 @@ namespace MP.INVE.Components { saveSel(LastScan); } - + target2.FocusAsync(); + css = "disabilita"; } } diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index bd7712b8..eff6ab27 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -8,7 +8,6 @@
  • totalmente ignoto
  • *@ - @if (currUdc != null || currLotto != null) { @@ -99,20 +98,61 @@ else if (alreadyScan != null)
    - @if (!isScannedLotto) - { - - } - else + @if (!alreadyScan.IsUnique) { + } -
    } else { -
    @firstMsg
    + +
    + @if (articoloScan != "" && quantitaScan != 0) + { + + + } + else if(articoloScan == "" && quantitaScan != 0) + { +
    Dati mancanti: Codice articolo
    + } + else if (quantitaScan == 0 && articoloScan != "") + { +
    Dati mancanti: Quantità a "0"
    + } + else + { +
    Dati mancanti: Codice articolo e Quantità
    + } +
    } diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index 18f9f540..dba6c406 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -54,7 +54,6 @@ namespace MP.INVE.Components protected bool isScannedLotto; protected bool firstMsg = false; protected bool isMod = true; - private ElementReference target; protected override async Task OnAfterRenderAsync(bool firstRender) { await Task.Delay(1); @@ -66,7 +65,6 @@ namespace MP.INVE.Components protected override async Task OnParametersSetAsync() { - //await target.FocusAsync(); await MIService.ConfigResetCache(); var result = await MIService.tryGetConfig("MAG_SmartUdcEdit"); elencoScansioni = MIService.ScanList(); @@ -83,23 +81,10 @@ namespace MP.INVE.Components { isMod = false; } - else if (!isScannedLotto) - { - - alertScan = await JSRuntime.InvokeAsync("confirm", $"L'oggetto {lastScan} è già stato scannerizzato, si desidera modificarlo?"); - if (alertScan) - { - alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - currUdc = null; - currLotto = null; - } - } - else - { - alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); - currUdc = null; - currLotto = null; - } + alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault(); + currUdc = null; + currLotto = null; + } } else @@ -131,7 +116,6 @@ namespace MP.INVE.Components tipo = "LOTTO"; #if false var alertMod = await JSRuntime.InvokeAsync("confirm", $"L'oggetto {lastScan} risulta presente nelle nostre anagrafiche con i seguenti dati: \nTipo: {tipo}\nLotto: {lotto.Lotto}\nArticolo: {lotto.CodArt} \nSi desidera modificarlo?"); - currLotto = lotto; if (alertMod) { } @@ -140,6 +124,7 @@ namespace MP.INVE.Components insertScan(); } #endif + currLotto = lotto; lottoScan = lotto.Lotto; articoloScan = lotto.CodArt; } @@ -148,7 +133,7 @@ namespace MP.INVE.Components currLotto = null; currUdc = null; alreadyScan = null; - lottoScan = ""; + lottoScan = lastScan; articoloScan = ""; quantitaScan = 0; noteScan = "";