diff --git a/MP.SPEC/Components/ListPARAMS.razor b/MP.SPEC/Components/ListPARAMS.razor new file mode 100644 index 00000000..34bc1b21 --- /dev/null +++ b/MP.SPEC/Components/ListPARAMS.razor @@ -0,0 +1,70 @@ +@using MP.SPEC.Components +@using MP.SPEC.Data + +@if (ListRecords == null) +{ + +} +else if (totalCount == 0) +{ +
Nessun record trovato
+} +else +{ +
+
+ + + + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + + + } + +
+ @**@ + ArticoloMacchina# pzT.CicloInizioNoteRichiesta
+ @**@ + + @record.CodArticolo + + @record.IdxMacchina + + @record.NumPezzi + + @record.Tcassegnato.ToString("N3") + +
@record.DataInizio
+
@record.Note@record.KeyRichiesta + @*@if (ArticoloDelEnabled(record.CodArticolo)) + { + + }*@ +
+
+
+} + + diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs new file mode 100644 index 00000000..e0353136 --- /dev/null +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -0,0 +1,153 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class ListPARAMS + { + #region Public Properties + + [Parameter] + public EventCallback PagerResetReq { get; set; } + + [Parameter] + public string selStato + { + get => _statoSel; + set + { + if (_statoSel != value) + { + _statoSel = value; + var pUpd = Task.Run(async () => await reloadData()); + pUpd.Wait(); + } + } + } + + #endregion Public Properties + + #region Public Methods + + public string checkSelect(string CodArticolo) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.CodArticolo == CodArticolo) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + #endregion Public Methods + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected MpDataService MDService { get; set; } = null!; + + [Inject] + protected MessageService MessageService { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + MessageService.EA_PageUpdated += MessageService_EA_PageUpdated; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await reloadData(); + } + + protected async void OnSeachUpdated() + { + await InvokeAsync(() => + { + PagerResetReq.InvokeAsync(true); + //currPage = 1; + Task task = UpdateData(); + StateHasChanged(); + }); + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Private Fields + + private string _statoSel = "*"; + + private ODLModel? currRecord = null; + + private List? ListRecords; + + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int currPage + { + get => MessageService.currPage; + set => MessageService.currPage = value; + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => MessageService.numRecord; + set => MessageService.numRecord = value; + } + + private string SearchVal + { + get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal; + } + + private int totalCount + { + get => MessageService.totalCount; + set => MessageService.totalCount = value; + } + + #endregion Private Properties + + #region Private Methods + + private async void MessageService_EA_PageUpdated() + { + await reloadData(); + } + + private async Task reloadData() + { + isLoading = true; + SearchRecords = await MDService.ListODLFilt(true, SearchVal, selStato); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + isLoading = false; + } + + #endregion Private Methods + } +} diff --git a/MP.SPEC/Pages/PARAMS.razor b/MP.SPEC/Pages/PARAMS.razor index dff9f790..995e1101 100644 --- a/MP.SPEC/Pages/PARAMS.razor +++ b/MP.SPEC/Pages/PARAMS.razor @@ -1,28 +1,157 @@ @page "/PARAMS" +
+
+
+
+
+
+

PARAMETERS

+
+
+ @**@ +
+
+
+
+
+
+
+
+
+ @*
*@ + @**@ + @**@ + @*
*@ +
+
+ * +
+
+
+
-

PARAMS

+ @*@if (reqNew) + { +
+
+
+ Azienda + + Art Search + +
+
+
+
+
+
+ Articolo + +
+
+
+ } + else if (currRecordOdl != null) + { +
+
+
+
Modifica ODL
+
*@ + @*
+
+
+ Codice + +
+
+
+
+ Disegno + +
+
+
+
+ +
+
+
+
+ -

Appunti (eliminabili)

+
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
*@ + @*
+
+
+
*@ +
+
+ +
+ @**@ +
-
    -
  • - I parametri sono nella tabella FluxLog (in preparazione modello dati + metodi...) -
  • -
  • - scopo della apgina è mostrare in "quasi tempo reale" (near realtime) i parametri che si aggiornano -
  • -
  • - la pagina deve avere un card come PODL nel cui header siano mostrate elenco amchcine ed elenco parametri x mostrare tutti / solo uno (filtro) -
  • -
  • - il metodo principale recupera gli ultimi n record (configurabile? mostrare in alto un selettore x indicare quanti "last values" recuperare?) -
  • -
  • - il refgresh idealmente è ogni 2-5 sec (configurabile come sopra?) -
  • -
-@code { -} diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs new file mode 100644 index 00000000..4f47569c --- /dev/null +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -0,0 +1,191 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Pages +{ + public partial class PARAMS + { + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MpDataService MDService { get; set; } + + [Inject] + protected MessageService MsgService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected async Task pgResetReq(bool doReset) + { + if (doReset) + { + await pagerODL.resetCurrPage(); + } + } + + + private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null; + private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null; + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task addNew() + { + currRecordPOdl = new MP.Data.DatabaseModels.PODLModel() + { + CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}" + }; + await Task.Delay(1); + } + + protected async Task cancel() + { + currRecordOdl = null; + currRecordPOdl = null; + await reloadData(); + await Task.Delay(1); + } + + protected DataPager pagerODL; + + protected bool reqNew = false; + + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task reqNewPODL() + { + reqNew = !reqNew; + await Task.Delay(1); + } + + protected override async Task OnInitializedAsync() + { + // abilito ricerca... + MsgService.ShowSearch = true; + // resetto search + MsgService.SearchVal = ""; + ListAziende = await MDService.ElencoAziende(); + ListStati = await MDService.AnagStatiComm(); + // carico dati + await reloadData(); + } + + private string currAzienda { get; set; } = "*"; + + private List? ListAziende; + + #endregion Protected Methods + + #region Private Fields + + private List? ListStati; + + #endregion Private Fields + + #region Private Properties + + private int currPage + { + get => MsgService.currPage; + set => MsgService.currPage = value; + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => MsgService.numRecord; + set => MsgService.numRecord = value; + } + + private string selStato { get; set; } = "*"; +#if false + private string selStato + { + get => _selStato; + set + { + if (!_selStato.Equals(value)) + { + _selStato = value; + addEnabled = selStato != "*"; + ////StateHasChanged(); + //var pUpd = Task.Run(async () => + //{ + // //await reloadData(); + // await Task.Delay(1); + // await InvokeAsync(() => StateHasChanged()); + //}); + //pUpd.Wait(); + } + } + } +#endif + + //private bool showODL { get; set; } = false; + + private bool addEnabled = false; + + //private string textToggle + //{ + // get => showODL ? "In Corso" : "Programmati"; + //} + + private int totalCount + { + get => MsgService.totalCount; + set => MsgService.totalCount = value; + } + + #endregion Private Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + await Task.Delay(1); + isLoading = false; + } + + //private async Task toggleCurrent() + //{ + // //NavManager.NavigateTo("/PODL"); + // showODL = !showODL; + // await Task.Delay(1); + //} + private async Task navToPODL() + { + NavManager.NavigateTo("/PODL"); + //showODL = !showODL; + await Task.Delay(1); + } + + #endregion Private Methods + } +}