diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 2a73213c..bd9e5a2d 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -367,11 +367,12 @@ namespace MP.Data.Controllers /// /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// + /// Data massima (recupera eventi antecedenti) /// * = tutte, altrimenti solo x una data macchina /// *=tutti, altrimenti solo selezionato /// numero massimo record da restituire /// - public List FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec) + public List FluxLogGetLastFilt(DateTime DtMax, string IdxMacchina, string CodFlux, int MaxRec) { List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) @@ -379,7 +380,7 @@ namespace MP.Data.Controllers dbResult = dbCtx .DbSetFluxLog .AsNoTracking() - .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux)) + .Where(x => (x.dtEvento <= DtMax) && (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux)) .OrderByDescending(x => x.dtEvento) .Take(MaxRec) .ToList(); diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 8d2084b1..1e577c10 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -49,11 +49,6 @@ namespace MP.SPEC.Components { await reloadData(false); } - // se sono live --> elimino record selezionato - //if (SelFilter.LiveUpdate) - //{ - // currRecord = null; - //} } public void Dispose() @@ -91,7 +86,12 @@ namespace MP.SPEC.Components public async Task reloadData(bool setChanged) { isLoading = true; - SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, SelFlux, MaxRecord); + DateTime limitData = DateTime.Now; + if (SelDtMax != null) + { + limitData = (DateTime)SelDtMax; + } + SearchRecords = await MDService.FluxLogGetLastFilt(limitData, SelMacchina, SelFlux, MaxRecord); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); await Task.Delay(1); @@ -219,6 +219,10 @@ namespace MP.SPEC.Components { get => SelFilter.IdxMacchina; } + private DateTime? SelDtMax + { + get => SelFilter.dtMax; + } private int totalCount { diff --git a/MP.SPEC/Components/ParamsFilter.razor b/MP.SPEC/Components/ParamsFilter.razor index a23fe5b9..cc4d32a6 100644 --- a/MP.SPEC/Components/ParamsFilter.razor +++ b/MP.SPEC/Components/ParamsFilter.razor @@ -40,24 +40,10 @@