Update x inserimento nuovo record (OK)
This commit is contained in:
@@ -51,7 +51,6 @@
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="input-group" title="Tipo">
|
||||
@*<span class="input-group-text">T</span>*@
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
@@ -65,7 +64,6 @@
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Azienda">
|
||||
@*<span class="input-group-text">A</span>*@
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<select @bind="@currAzienda" class="form-select">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
foreach (var item in ListAziende)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
|
||||
+40
-32
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.SPEC.Components;
|
||||
using MP.SPEC.Data;
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace MP.SPEC.Pages
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecord = new MP.Data.DatabaseModels.PODLModel()
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
||||
};
|
||||
@@ -71,6 +72,13 @@ namespace MP.SPEC.Pages
|
||||
MsgService.SearchVal = "";
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
// preselezione valori
|
||||
configData = await MDService.ConfigGetAll();
|
||||
var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA");
|
||||
if (currRec != null)
|
||||
{
|
||||
currAzienda = currRec.Valore;
|
||||
}
|
||||
// carico dati
|
||||
await reloadData();
|
||||
}
|
||||
@@ -89,38 +97,36 @@ namespace MP.SPEC.Pages
|
||||
/// <returns></returns>
|
||||
protected async Task reqNewPODL()
|
||||
{
|
||||
if (string.IsNullOrEmpty(currArticolo))
|
||||
// aggiungo record articolo
|
||||
currArticolo = "";
|
||||
if (ListArticoli != null && ListArticoli.Count > 0)
|
||||
{
|
||||
reqNew = !reqNew;
|
||||
var firstArt = ListArticoli.FirstOrDefault();
|
||||
currArticolo = firstArt != null ? firstArt.CodArticolo : "";
|
||||
}
|
||||
else
|
||||
string codExt = $"{selStato}";
|
||||
string codGruppo = "STEAMWARE-SIM-FASE-01";
|
||||
string codMacc = "SIMUL_01";
|
||||
currRecord = new PODLModel()
|
||||
{
|
||||
// aggiungo record articolo
|
||||
DateTime adesso = DateTime.Now;
|
||||
string codExt = $"{selStato}_{currArticolo}_{adesso:yyMMdd-HHmm}";
|
||||
string codGruppo = "STEAMWARE-SIM-FASE-01";
|
||||
string codMacc = "SIMUL_01";
|
||||
currRecord = new MP.Data.DatabaseModels.PODLModel()
|
||||
{
|
||||
CodArticolo = currArticolo,
|
||||
KeyBCode = codExt,
|
||||
KeyRichiesta = codExt,
|
||||
CodGruppo = codGruppo,
|
||||
IdxMacchina = codMacc,
|
||||
NumPezzi = 1
|
||||
};
|
||||
}
|
||||
CodArticolo = currArticolo,
|
||||
KeyBCode = codExt,
|
||||
KeyRichiesta = codExt,
|
||||
CodGruppo = codGruppo,
|
||||
IdxMacchina = codMacc,
|
||||
NumPezzi = 1,
|
||||
DueDate = DateTime.Now.AddDays(30)
|
||||
};
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
|
||||
protected async Task selRecord(MP.Data.DatabaseModels.PODLModel selRec)
|
||||
protected async Task selRecord(PODLModel selRec)
|
||||
{
|
||||
currRecord = selRec;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected async Task update(MP.Data.DatabaseModels.PODLModel selRec)
|
||||
protected async Task update(PODLModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
|
||||
return;
|
||||
@@ -135,16 +141,7 @@ namespace MP.SPEC.Pages
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private MP.Data.DatabaseModels.PODLModel? _currRecord = null;
|
||||
private MP.Data.DatabaseModels.PODLModel? currRecord
|
||||
{
|
||||
get => _currRecord;
|
||||
set
|
||||
{
|
||||
_currRecord = value;
|
||||
artSearch = value == null ? "" : value.CodArticolo;
|
||||
}
|
||||
}
|
||||
private PODLModel? _currRecord = null;
|
||||
private List<MP.Data.DatabaseModels.AnagArticoli>? ListArticoli;
|
||||
private List<MP.Data.DatabaseModels.AnagGruppi>? ListAziende;
|
||||
private List<MP.Data.DatabaseModels.ListValues>? ListStati;
|
||||
@@ -183,6 +180,7 @@ namespace MP.SPEC.Pages
|
||||
get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL";
|
||||
}
|
||||
|
||||
private List<ConfigModel>? configData { get; set; } = null;
|
||||
private string currArticolo { get; set; } = "";
|
||||
|
||||
private string currAzienda
|
||||
@@ -210,6 +208,16 @@ namespace MP.SPEC.Pages
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private PODLModel? currRecord
|
||||
{
|
||||
get => _currRecord;
|
||||
set
|
||||
{
|
||||
_currRecord = value;
|
||||
artSearch = value == null ? "" : value.CodArticolo;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
|
||||
Reference in New Issue
Block a user