gestione codice "NOTO"
This commit is contained in:
@@ -89,7 +89,14 @@ else if (alreadyScan != null)
|
||||
</li>
|
||||
</ul>
|
||||
<div class="btn-group col-12" role="group" aria-label="Basic example">
|
||||
<button type="button" class="btn btn-success col-6" @onclick="()=>updateScansione(alreadyScan)">Conferma</button>
|
||||
@if (!isScannedLotto)
|
||||
{
|
||||
<button type="button" class="btn btn-success col-6" @onclick="()=>updateScansione(alreadyScan)">Conferma</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -49,25 +49,40 @@ namespace MP.INVE.Components
|
||||
|
||||
protected AnagUdcModel? currUdc;
|
||||
protected AnagLottoModel? currLotto;
|
||||
protected bool alertScan;
|
||||
protected bool isScannedLotto;
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
elencoScansioni = MIService.ScanList();
|
||||
var exists = elencoScansioni.Select(x => x.ScanValue).Contains(lastScan);
|
||||
var scansioneClone = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
|
||||
|
||||
if (exists)
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", $"L'oggetto {lastScan} è già stato scannerizzato, si desidera modificarlo?");
|
||||
if (alert)
|
||||
if (scansioneClone != null)
|
||||
{
|
||||
alreadyScan = elencoScansioni.Where(x => x.ScanValue == lastScan).FirstOrDefault();
|
||||
currUdc = null;
|
||||
currLotto = null;
|
||||
isScannedLotto = scansioneClone.ScanValue.StartsWith("M2");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
await MIService.ConfigResetCache();
|
||||
var result = await MIService.tryGetConfig("MAG_SmartUdcEdit");
|
||||
if (result != null)
|
||||
@@ -78,8 +93,9 @@ namespace MP.INVE.Components
|
||||
searchRecordsUDC = MIService.ElencoUDC();
|
||||
udc = searchRecordsUDC.Where(x => x.UDC == lastScan).FirstOrDefault();
|
||||
|
||||
if (udc != null && !udc.UDC.Contains("MSL"))
|
||||
if (udc != null && !udc.UDC.Contains("MSL"))
|
||||
{
|
||||
|
||||
currUdc = udc;
|
||||
tipo = "UDC";
|
||||
lottoScan = udc.lottoNav.Lotto;
|
||||
@@ -93,10 +109,18 @@ namespace MP.INVE.Components
|
||||
lotto = searchRecordsLotto.Where(x => x.Lotto == lastScan).FirstOrDefault();
|
||||
if (lotto != null)
|
||||
{
|
||||
currLotto = lotto;
|
||||
tipo = "LOTTO";
|
||||
lottoScan = lotto.Lotto;
|
||||
articoloScan = lotto.CodArt;
|
||||
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)
|
||||
{
|
||||
lottoScan = lotto.Lotto;
|
||||
articoloScan = lotto.CodArt;
|
||||
}
|
||||
else
|
||||
{
|
||||
insertScan();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,8 +137,8 @@ namespace MP.INVE.Components
|
||||
protected decimal qtaLotto = 0;
|
||||
protected async void insertScan()
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?");
|
||||
if (alert)
|
||||
var alertInsert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?");
|
||||
if (alertInsert)
|
||||
{
|
||||
|
||||
if (currUdc != null)
|
||||
@@ -166,6 +190,33 @@ namespace MP.INVE.Components
|
||||
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 = true,
|
||||
IsUnique = true,
|
||||
InveSessID = sessID
|
||||
};
|
||||
await MIService.InsertNewScansione(newScan);
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currLotto = null;
|
||||
currUdc = null;
|
||||
alreadyScan = null;
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -173,8 +224,8 @@ namespace MP.INVE.Components
|
||||
|
||||
protected async void updateScansione(ScanDataModel modScan)
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler modificare la seguente scansione {modScan.ScanValue}?");
|
||||
if (alert)
|
||||
var alertUpdate = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler modificare la seguente scansione {modScan.ScanValue}?");
|
||||
if (alertUpdate)
|
||||
{
|
||||
if (alreadyScan != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user