fix gestione dati mancanti per aggiunta scan

This commit is contained in:
zaccaria.majid
2022-12-07 10:16:59 +01:00
parent ba2f52f76d
commit 310fe9c1f7
4 changed files with 59 additions and 30 deletions
+1
View File
@@ -3,4 +3,5 @@
<button class="btn btn-sm btn-primary" @onclick="()=>newScan()">
<i class="fa-solid fa-qrcode"></i>
</button>
<input type="hidden" @ref="@target2"/>
</div>
+4 -1
View File
@@ -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";
}
}
+48 -8
View File
@@ -8,7 +8,6 @@
<li>totalmente ignoto</li>
</ul>*@
<input type="hidden" @ref="@target" />
@if (currUdc != null || currLotto != null)
{
@@ -99,20 +98,61 @@ else if (alreadyScan != null)
</li>
</ul>
<div class="btn-group col-12" role="group" aria-label="Basic example">
@if (!isScannedLotto)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>updateScansione(alreadyScan)">Conferma</button>
}
else
@if (!alreadyScan.IsUnique)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
<button type="button" class="btn btn-danger col-6" @onclick="()=>resetAll()">Annulla</button>
}
<button type="button" class="btn btn-danger col-6" @onclick="()=>resetAll()">Annulla</button>
</div>
}
else
{
<div class="alert bg-danger">@firstMsg</div>
<ul class="p-0">
<li class="list-group-item">
Lotto:
<div class="input-group input-group-sm">
<input class="form-control" value="@lottoScan" disabled />
<span class="input-group-text" id="basic-addon1">@tipo</span>
</div>
</li>
<li class="list-group-item">
Articolo:
<div class="input-group input-group-sm">
<input class="form-control " @bind-value="@articoloScan" type="text" />
</div>
</li>
<li class="list-group-item">
Quantità:
<div class="input-group input-group-sm">
<input class="form-control" @bind-value="@quantitaScan" type="number" />
</div>
</li>
<li class="list-group-item">
Note:
<div class="input-group input-group-sm">
<input class="form-control " @bind-value="@noteScan" type="text" />
</div>
</li>
</ul>
<div class="btn-group col-12" role="group" aria-label="Basic example">
@if (articoloScan != "" && quantitaScan != 0)
{
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
<button type="button" class="btn btn-danger col-6" @onclick="()=>resetAll()">Annulla</button>
}
else if(articoloScan == "" && quantitaScan != 0)
{
<div class="alert bg-warning col-12">Dati mancanti: Codice articolo</div>
}
else if (quantitaScan == 0 && articoloScan != "")
{
<div class="alert bg-warning col-12">Dati mancanti: Quantità a "0"</div>
}
else
{
<div class="alert bg-warning col-12">Dati mancanti: Codice articolo e Quantità </div>
}
</div>
}
+6 -21
View File
@@ -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<bool>("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<bool>("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 = "";