diff --git a/MP.SPEC/Components/ListPARAMS.razor b/MP.SPEC/Components/ListPARAMS.razor index abd14f91..9874b541 100644 --- a/MP.SPEC/Components/ListPARAMS.razor +++ b/MP.SPEC/Components/ListPARAMS.razor @@ -21,7 +21,7 @@ else Data Macchina - Flusso + Parametro Valore diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 1813e0b2..485a1150 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -9,19 +9,49 @@ namespace MP.SPEC.Components { #region Public Properties + [Parameter] + public int MaxRecord + { + get => _maxRecord; + set + { + if (_maxRecord != value) + { + _maxRecord = value; + var pUpd = Task.Run(async () => await reloadData(true)); + pUpd.Wait(); + } + } + } + [Parameter] public EventCallback PagerResetReq { get; set; } + [Parameter] + public string SelFlux + { + get => _selFlux; + set + { + if (_selFlux != value) + { + _selFlux = value; + var pUpd = Task.Run(async () => await reloadData(false)); + pUpd.Wait(); + } + } + } + [Parameter] public string SelMacchina { - get => _statoMacchina; + get => _selMacchina; set { - if (_statoMacchina != value) + if (_selMacchina != value) { - _statoMacchina = value; - var pUpd = Task.Run(async () => await reloadData()); + _selMacchina = value; + var pUpd = Task.Run(async () => await reloadData(false)); pUpd.Wait(); } } @@ -31,8 +61,6 @@ namespace MP.SPEC.Components #region Public Methods - - public string checkSelect(string IdxMacchina) { string answ = ""; @@ -48,6 +76,20 @@ namespace MP.SPEC.Components return answ; } + public async Task reloadData(bool setChanged) + { + isLoading = true; + SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, SelFlux, MaxRecord); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + if (setChanged) + { + await InvokeAsync(() => StateHasChanged()); + } + isLoading = false; + } + #endregion Public Methods #region Protected Properties @@ -60,7 +102,7 @@ namespace MP.SPEC.Components [Inject] protected MessageService MessageService { get; set; } = null!; - + #endregion Protected Properties #region Protected Methods @@ -69,8 +111,8 @@ namespace MP.SPEC.Components { MessageService.EA_PageUpdated += MessageService_EA_PageUpdated; MessageService.EA_SearchUpdated += OnSeachUpdated; - - await reloadData(); + + await reloadData(true); } protected async void OnSeachUpdated() @@ -87,17 +129,16 @@ namespace MP.SPEC.Components protected async Task UpdateData() { currRecord = null; - await reloadData(); + await reloadData(true); } #endregion Protected Methods #region Private Fields - - - private string _statoMacchina = "*"; - + private int _maxRecord = 300; + private string _selFlux = "*"; + private string _selMacchina = "*"; private FluxLog? currRecord = null; private List? ListRecords; @@ -139,20 +180,9 @@ namespace MP.SPEC.Components private async void MessageService_EA_PageUpdated() { - await reloadData(); - } - - public async Task reloadData() - { - isLoading = true; - SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, "*", 300); - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - await Task.Delay(1); - await InvokeAsync(() => StateHasChanged()); - isLoading = false; + await reloadData(true); } #endregion Private Methods } -} +} \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 3ee649fd..9ab621bc 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -323,9 +323,15 @@ namespace MP.SPEC.Data /// *=tutti, altrimenti solo selezionato /// numero massimo record da restituire /// - public Task> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec) + public async Task> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec) { - return Task.FromResult(dbController.FluxLogGetLastFilt(IdxMacchina, CodFlux, MaxRec)); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + var results = await Task.FromResult(dbController.FluxLogGetLastFilt(IdxMacchina, CodFlux, MaxRec)); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"FluxLogGetLastFilt | Read from DB: {ts.TotalMilliseconds}ms"); + return results; } /// diff --git a/MP.SPEC/Pages/PARAMS.razor b/MP.SPEC/Pages/PARAMS.razor index bd3106ef..20cde666 100644 --- a/MP.SPEC/Pages/PARAMS.razor +++ b/MP.SPEC/Pages/PARAMS.razor @@ -6,12 +6,21 @@
-

PARAMETERS

+

PARAMETERS

- + @if (!liveUpdate) + { + + } + else + { + + }
@@ -24,7 +33,7 @@
- @if (ListMacchine != null) { @@ -36,7 +45,7 @@
- @if (ListFlux != null) { @@ -50,10 +59,9 @@
- *@
- +