cambiato approccio

per disegno componente acquisizione
This commit is contained in:
zaccaria.majid
2022-12-13 14:39:06 +01:00
parent 0727a246d9
commit 56872db21e
6 changed files with 113 additions and 52 deletions
+7 -3
View File
@@ -21,7 +21,7 @@
Articolo:
<div class="input-group input-group-sm">
<input class="form-control @reqArtMod" @bind-value="@articoloScan" type="text" />
@if ((canMod != "false") || (tipo != "UDC"))
@if ((canMod != "false") || (tipo != "U") || (!isKnown))
{
<button title="Mod articolo" @onclick="@cssDisableArt" class="btn btn-sm btn-primary">
<i class="fa-solid fa-pen-to-square"></i>
@@ -40,7 +40,7 @@
{
<input class="form-control @reqQtaMod" @bind-value="@quantitaScan" type="number" />
}
@if ((canMod != "false") || (tipo != "UDC"))
@if ((canMod != "false") || (tipo != "U") || (!isKnown))
{
<button title="Mod quantità" @onclick="@cssDisableQta" class="btn btn-sm btn-primary">
<i class="fa-solid fa-pen-to-square"></i>
@@ -56,7 +56,7 @@
</li>
</ul>
<div class="btn-group col-12" role="group">
@if (articoloScan != "" && quantitaScan != 0)
@if (articoloScan != "" && quantitaScan != 0 && canSave)
{
<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>
@@ -69,6 +69,10 @@
{
<div class="alert bg-warning col-12">Dati mancanti: Quantità a "0"</div>
}
else if (isKnown)
{
<div class="alert bg-warning col-12">Codice già scansionato per la sessione corrente</div>
}
else
{
<div class="alert bg-warning col-12">Dati mancanti: Codice articolo e Quantità </div>
+57 -38
View File
@@ -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
{
+46 -8
View File
@@ -298,22 +298,18 @@ namespace MP.INVE.Data
}
public List<AnagLottiArca> 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<AnagLottiArca>? result = new List<AnagLottiArca>();
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<AnagLottiArca>();
}
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<ScanDataModel> ScanBySession(int idSessione)
{
string source = "";
@@ -395,6 +405,7 @@ namespace MP.INVE.Data
await Task.Delay(1);
return dbResult;
}
public List<AnagUdcModel> 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<AnagLottoModel> ElencoLotti()
{
string source = "";
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.1311</h4>
<h4>Versione: 6.16.2212.1314</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.1311
6.16.2212.1314
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.1311</version>
<version>6.16.2212.1314</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>