aggiunta salvataggio scansione
This commit is contained in:
@@ -24,26 +24,22 @@ namespace MP.INVE.Components
|
||||
// FIXME TODO creare evento x riportare scansione
|
||||
[Parameter]
|
||||
public EventCallback<string> lastRawScan { get; set; }
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Imposta il focus su input scansione
|
||||
/// </summary>
|
||||
protected void setFocus()
|
||||
{
|
||||
// all'apertura del componente --> focus su txtbox scan (e anche dopo input)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private ElementReference target;
|
||||
|
||||
//protected string lastScan { get; set; } = "";
|
||||
|
||||
public SelectScanParams currParams = new SelectScanParams();
|
||||
|
||||
//protected string rawScan
|
||||
//{
|
||||
// get => currParams.UDC;
|
||||
// set => currParams.UDC = value;
|
||||
//}
|
||||
protected string _lastScan = "";
|
||||
protected string LastScan
|
||||
{
|
||||
|
||||
@@ -8,31 +8,51 @@
|
||||
<li>totalmente ignoto</li>
|
||||
</ul>*@
|
||||
|
||||
@if (udc != null)
|
||||
@if (currUdc != null)
|
||||
{
|
||||
<ul class="p-0">
|
||||
<li class="list-group-item">
|
||||
Lotto:
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control" value="@udc.lottoNav.Lotto" disabled />
|
||||
<input class="form-control" value="@currUdc.lottoNav.Lotto" 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 @reqArtMod" @bind-value="@udc.lottoNav.CodArt" type="text" />
|
||||
<button title="Mod articolo" @onclick="@cssDisableArt" class="btn btn-sm btn-primary"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<input class="form-control @reqArtMod" @bind-value="@currUdc.lottoNav.CodArt" type="text" />
|
||||
@if (canMod != "false")
|
||||
{
|
||||
<button title="Mod articolo" @onclick="@cssDisableArt" class="btn btn-sm btn-primary">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Quantità:
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control @reqQtaMod" @bind-value="@udc.Qta" type="number" />
|
||||
<button title="Mod quantità" @onclick="@cssDisableQta" class="btn btn-sm btn-primary"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<input class="form-control @reqQtaMod" @bind-value="@currUdc.Qta" type="number" />
|
||||
@if (canMod != "false")
|
||||
{
|
||||
<button title="Mod quantità" @onclick="@cssDisableQta" class="btn btn-sm btn-primary">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
Note:
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control " @bind-value="@currUdc.Note" type="text" />
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="btn-group col-12" role="group" aria-label="Basic example">
|
||||
<button type="button" class="btn btn-success col-6" @onclick="()=>insertScan()">Conferma</button>
|
||||
<button type="button" class="btn btn-danger col-6">Annulla</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@ using MP.INVE.Shared;
|
||||
using MP.INVE.Components;
|
||||
using MP.INVE.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
|
||||
|
||||
namespace MP.INVE.Components
|
||||
{
|
||||
@@ -25,19 +27,39 @@ namespace MP.INVE.Components
|
||||
private MiDataService MIService { get; set; } = null!;
|
||||
[Parameter]
|
||||
public string lastScan { get; set; } = null!;
|
||||
//[Parameter]
|
||||
//public EventCallback<AnagUdcModel> udcSend { get; set; }
|
||||
[Parameter]
|
||||
public string userScan { get; set; } = null!;
|
||||
[Parameter]
|
||||
public int sessID { get; set; } = 0;
|
||||
[Inject]
|
||||
public IJSRuntime JSRuntime { get; set; } = null!;
|
||||
[Inject]
|
||||
public NavigationManager NavManager { get; set; } = null!;
|
||||
private string tipo { get; set; } = "";
|
||||
private string canMod = "false";
|
||||
|
||||
public List<AnagUdcModel>? searchrecords;
|
||||
public AnagUdcModel? udc;
|
||||
protected List<AnagUdcModel>? searchrecords;
|
||||
protected AnagUdcModel? udc;
|
||||
|
||||
protected AnagUdcModel? currUdc;
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await MIService.ConfigResetCache();
|
||||
var result = await MIService.tryGetConfig("MAG_SmartUdcEdit");
|
||||
if (result != null)
|
||||
{
|
||||
canMod = result;
|
||||
}
|
||||
await Task.Delay(1);
|
||||
searchrecords = MIService.ElencoUDC();
|
||||
udc = searchrecords.Where(x => x.UDC == lastScan).FirstOrDefault();
|
||||
|
||||
|
||||
if (udc != null)
|
||||
{
|
||||
currUdc = udc;
|
||||
if (udc.UDC.Contains("MFI"))
|
||||
{
|
||||
tipo = "FINITO";
|
||||
@@ -45,15 +67,60 @@ namespace MP.INVE.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected bool isForced = false;
|
||||
protected async void insertScan()
|
||||
{
|
||||
var alert = await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi di voler salvare la seguente scansione per la sessione {sessID}?");
|
||||
|
||||
if (currUdc != null)
|
||||
{
|
||||
if (alert)
|
||||
{
|
||||
if((currUdc.lottoNav.CodArt != udc.lottoNav.CodArt) || (currUdc.Qta != udc.Qta))
|
||||
{
|
||||
isForced = true;
|
||||
}
|
||||
|
||||
ScanDataModel newScan = new ScanDataModel()
|
||||
{
|
||||
DtScan = DateTime.Now,
|
||||
UserScan = userScan,
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NavManager.NavigateTo(NavManager.Uri, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected string reqArtMod = "disabilita";
|
||||
protected string reqQtaMod = "disabilita";
|
||||
protected void cssDisableArt()
|
||||
{
|
||||
reqArtMod = "";
|
||||
reqArtMod = "";
|
||||
}
|
||||
protected void cssDisableQta()
|
||||
{
|
||||
reqQtaMod = "";
|
||||
}
|
||||
|
||||
|
||||
//private void saveSel(AnagUdcModel udcToSend)
|
||||
//{
|
||||
// Task.FromResult(udcSend.InvokeAsync(udcToSend));
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,9 @@
|
||||
{
|
||||
}*@
|
||||
<div class="col-12">
|
||||
<ProcSuggestion lastScan="@rawScan"></ProcSuggestion>
|
||||
<ProcSuggestion lastScan="@rawScan" sessID="@sessionId" userScan="@idOPeratore"></ProcSuggestion>
|
||||
</div>
|
||||
@if (rawScan != null)
|
||||
{
|
||||
<div class="col-12">
|
||||
<ProcOperat></ProcOperat>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<div class="col-12">
|
||||
|
||||
@@ -18,6 +18,7 @@ using Blazored.LocalStorage;
|
||||
using MP.Data.DTO;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using MP.INVE.Data;
|
||||
using MP.Data.DatabaseModels;
|
||||
|
||||
namespace MP.INVE.Pages
|
||||
{
|
||||
@@ -35,14 +36,25 @@ namespace MP.INVE.Pages
|
||||
private bool logged { get;set; } = false;
|
||||
protected string rawScan { get; set; } = null!;
|
||||
protected string idOPeratore { get; set; } = null!;
|
||||
protected string authKey { get; set; } = null!;
|
||||
protected int sessionId { get; set; } = 0;
|
||||
//protected AnagUdcModel currUdc{ get; set; } = null!;
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOperatore", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
|
||||
{
|
||||
idOPeratore = _matrOpr;
|
||||
sessionId = int.Parse(_inveSessionId);
|
||||
}
|
||||
}
|
||||
protected void saveScan(string newScan)
|
||||
{
|
||||
rawScan = newScan;
|
||||
}
|
||||
//protected DateTime? lastScan { get; set; } = null;
|
||||
//protected void saveUdc(AnagUdcModel newUdc)
|
||||
//{
|
||||
// currUdc = newUdc;
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user