diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index eff6ab27..755dab34 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -34,7 +34,14 @@
  • Quantità:
    - + @if (currLotto != null) + { + + } + else + { + + } @if ((canMod != "false") || (tipo != "UDC")) {
  • - - + @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à
    + }
    } else if (alreadyScan != null) @@ -103,6 +125,11 @@ else if (alreadyScan != null) } + else + { +
    Questo oggetto risulta essere univoco perciò non è possibile salvare una nuova scansione
    + } + } else @@ -118,19 +145,41 @@ else
  • Articolo:
    - + @if (lastScan != null && lastScan != "") + { + + } + else + { + + } +
  • Quantità:
    - + @if (lastScan != null && lastScan != "") + { + + } + else + { + + }
  • Note:
    - + @if (lastScan != null && lastScan != "") + { + + } + else + { + + }
  • @@ -140,7 +189,7 @@ else } - else if(articoloScan == "" && quantitaScan != 0) + else if (articoloScan == "" && quantitaScan != 0) {
    Dati mancanti: Codice articolo
    } diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index dba6c406..6adfc6cf 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -127,6 +127,7 @@ namespace MP.INVE.Components currLotto = lotto; lottoScan = lotto.Lotto; articoloScan = lotto.CodArt; + quantitaScan = 0; } else { @@ -146,88 +147,97 @@ namespace MP.INVE.Components protected decimal qtaLotto = 0; protected async void insertScan() { - var alertInsert = await JSRuntime.InvokeAsync("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?"); - if (alertInsert) + + var artExists = await MIService.artBySearch(articoloScan); + + if (artExists != null) { - - if (currUdc != null) + var alertInsert = await JSRuntime.InvokeAsync("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?"); + if (alertInsert) { - if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta)) + + if (currUdc != null) { - isForced = true; + if ((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta)) + { + isForced = true; + } + //if() + + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = isForced, + CodArticolo = currUdc.lottoNav.CodArt, + Lotto = currUdc.lottoNav.Lotto, + RifExt = currUdc.lottoNav.RifExt, + Qty = currUdc.Qta, + Note = currUdc.Note, + IsKnown = true, + IsUnique = true, + InveSessID = sessID + }; + + + + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); } - //if() - - ScanDataModel newScan = new ScanDataModel() + else if (currLotto != null) { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = isForced, - CodArticolo = currUdc.lottoNav.CodArt, - Lotto = currUdc.lottoNav.Lotto, - RifExt = currUdc.lottoNav.RifExt, - Qty = currUdc.Qta, - Note = currUdc.Note, - IsKnown = true, - IsUnique = true, - InveSessID = sessID - }; - - - - await MIService.InsertNewScansione(newScan); - NavManager.NavigateTo(NavManager.Uri, true); + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = true, + CodArticolo = currLotto.CodArt, + Lotto = currLotto.Lotto, + RifExt = currLotto.RifExt, + Qty = qtaLotto, + Note = currLotto.Note, + IsKnown = true, + IsUnique = false, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); + } + else if (alreadyScan != null) + { + ScanDataModel newScan = new ScanDataModel() + { + DtScan = DateTime.Now, + UserScan = userScan, + ScanValue = lastScan, + IsForced = true, + CodArticolo = alreadyScan.CodArticolo, + Lotto = alreadyScan.Lotto, + RifExt = alreadyScan.RifExt, + Qty = alreadyScan.Qty, + Note = alreadyScan.Note, + IsKnown = alreadyScan.IsKnown, + IsUnique = alreadyScan.IsUnique, + InveSessID = sessID + }; + await MIService.InsertNewScansione(newScan); + NavManager.NavigateTo(NavManager.Uri, true); + } } - else if (currLotto != null) + else { - ScanDataModel newScan = new ScanDataModel() - { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = true, - CodArticolo = currLotto.CodArt, - Lotto = currLotto.Lotto, - RifExt = currLotto.RifExt, - Qty = qtaLotto, - Note = currLotto.Note, - IsKnown = true, - IsUnique = false, - InveSessID = sessID - }; - await MIService.InsertNewScansione(newScan); - NavManager.NavigateTo(NavManager.Uri, true); - } - else if (alreadyScan != null) - { - ScanDataModel newScan = new ScanDataModel() - { - DtScan = DateTime.Now, - UserScan = userScan, - ScanValue = lastScan, - IsForced = true, - CodArticolo = alreadyScan.CodArticolo, - Lotto = alreadyScan.Lotto, - RifExt = alreadyScan.RifExt, - Qty = alreadyScan.Qty, - Note = alreadyScan.Note, - IsKnown = alreadyScan.IsKnown, - IsUnique = alreadyScan.IsUnique, - InveSessID = sessID - }; - await MIService.InsertNewScansione(newScan); + currLotto = null; + currUdc = null; + alreadyScan = null; NavManager.NavigateTo(NavManager.Uri, true); } } else { - currLotto = null; - currUdc = null; - alreadyScan = null; - NavManager.NavigateTo(NavManager.Uri, true); + var artSbagliato = await JSRuntime.InvokeAsync("alert", $"l'articolo {articoloScan} non risulta presente nelle nostre anagrafiche. Inserire un articolo giusto o controllare di non aver sbagliato a digitare"); } - } diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index e02d0e1f..023cb27c 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -363,6 +363,18 @@ namespace MP.INVE.Data 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 = "";