Fix scarti doppia tavola

This commit is contained in:
Samuele Locatelli
2023-12-19 15:39:00 +01:00
parent cf7fa880ae
commit 6428c8bff6
2 changed files with 24 additions and 7 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
</div>
@if(errMsg != "")
{
<div class="alert bg-danger mt-1">
<div class="alert alert-warning mt-1 text-center">
@errMsg
</div>
}
+23 -6
View File
@@ -31,11 +31,15 @@ namespace MP_TAB3.Components
}
}
protected string errMsg { get; set; } = "";
protected List<vSelCauScartoModel> ListComplete { get; set; } = new List<vSelCauScartoModel>();
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
protected int NumPz
{
get => numPz;
@@ -70,10 +74,25 @@ namespace MP_TAB3.Components
protected async Task doSave(vSelCauScartoModel currCau)
{
bool isMulti = false;
// verifico se la macchina sia configurata tra le MSFD...
if (SMServ.DictMacchMulti.ContainsKey(IdxMacc))
{
isMulti = SMServ.DictMacchMulti[IdxMacc] == 1;
}
string IdxMaccSel = IdxMacc;
if (isMulti)
{
var idxMSel = MsgServ.UserPrefGet(IdxMacc);
if (!string.IsNullOrEmpty(idxMSel))
{
IdxMaccSel = idxMSel;
}
}
// registro scarto
RegistroScartiModel newRec = new RegistroScartiModel()
{
IdxMacchina = IdxMacc,
IdxMacchina = IdxMaccSel,
DataOra = DateSel,
Causale = currCau.value,
Qta = NumPz,
@@ -87,20 +106,17 @@ namespace MP_TAB3.Components
// reset
DoReset();
errMsg = "";
//ToggleCtrl();
await E_Updated.InvokeAsync(true);
await ReloadData();
StateHasChanged();
await InvokeAsync(StateHasChanged);
}
else
{
errMsg = "ODL non attivo o data/ora errato";
errMsg = "Insert non possibile: ODL non attivo o data/ora errato";
}
ShowDetail = false;
}
protected string errMsg { get; set; } = "";
protected override async Task OnInitializedAsync()
{
await ReloadData();
@@ -127,6 +143,7 @@ namespace MP_TAB3.Components
if (ShowDetail)
{
DateSel = DateTime.Now;
errMsg = "";
}
}