diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 1b4897e6..6527775b 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -277,6 +277,30 @@ namespace MP.Data.Controllers { } + /// + /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato + /// macchina (ordinato x data registrazione) + /// + /// * = tutte, altrimenti solo x una data macchina + /// Data di riferimento (Massima) per estrazioen records + /// numero massimo record da restituire + /// + public List DossiersGetLastFilt(string IdxMacchina, DateTime DtRef, int MaxRec) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetDossiers + .AsNoTracking() + .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && x.DtRif <= DtRef) + .OrderByDescending(x => x.DtRif) + .Take(MaxRec) + .ToList(); + } + return dbResult; + } + /// /// Elenco valori link (x home e navMenu laterale) /// @@ -309,29 +333,6 @@ namespace MP.Data.Controllers return dbResult; } - - /// - /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato macchina (ordinato x data registrazione) - /// - /// * = tutte, altrimenti solo x una data macchina - /// numero massimo record da restituire - /// - public List DossiersGetLastFilt(string IdxMacchina, int MaxRec) - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbSetDossiers - .AsNoTracking() - .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) ) - .OrderByDescending(x => x.DtRif) - .Take(MaxRec) - .ToList(); - } - return dbResult; - } - public List ListLinkFilt(string tipoLink) { List dbResult = new List(); diff --git a/MP.SPEC/Components/DossiersFilter.razor b/MP.SPEC/Components/DossiersFilter.razor new file mode 100644 index 00000000..4efc679a --- /dev/null +++ b/MP.SPEC/Components/DossiersFilter.razor @@ -0,0 +1,99 @@ + +
+
+ @if (!liveUpdate) + { + + } + else + { + + } +
+ +
+
+ @if (showEditPar) + { +
+ + + + + +
+ } + else + { +
+ +
+ } +
+
+ + + + +
+
+
+
+
+ + + diff --git a/MP.SPEC/Components/DossiersFilter.razor.cs b/MP.SPEC/Components/DossiersFilter.razor.cs new file mode 100644 index 00000000..37e8430e --- /dev/null +++ b/MP.SPEC/Components/DossiersFilter.razor.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class DossiersFilter + { + #region Public Properties + + [Parameter] + public EventCallback FilterChanged { get; set; } + + [Parameter] + public SelectFluxParams SelFilter { get; set; } = null!; + + #endregion Public Properties + + #region Protected Fields + + protected string lastUpdate + { + get => SelFilter.lastUpdate; + set => SelFilter.lastUpdate = value; + } + + #endregion Protected Fields + + #region Protected Properties + + protected bool liveUpdate + { + get => SelFilter.LiveUpdate; + set + { + if (!SelFilter.LiveUpdate.Equals(value)) + { + SelFilter.LiveUpdate = value; + if (!value) + { + SelFilter.CurrPage = 0; + } + reportChange(); + } + } + } + + [Inject] + protected MpDataService MDService { get; set; } = null!; + + protected string selFlux + { + get + { + return SelFilter.CodFlux; + } + set + { + if (!SelFilter.CodFlux.Equals(value)) + { + SelFilter.CurrPage = 1; + SelFilter.CodFlux = value; + StateHasChanged(); + Task.Delay(1); + reportChange(); + } + } + } + + protected string selMacchina + { + get + { + return SelFilter.IdxMacchina; + } + set + { + if (!SelFilter.IdxMacchina.Equals(value)) + { + SelFilter.CurrPage = 1; + SelFilter.IdxMacchina = value; + SelFilter.CodFlux = "*"; + ListFlux = MDService.ParametriGetFilt(selMacchina).Result; + StateHasChanged(); + Task.Delay(1); + reportChange(); + } + } + } + + protected int selMaxRecord + { + get + { + return SelFilter.MaxRecord; + } + + set + { + if (!SelFilter.MaxRecord.Equals(value)) + { + SelFilter.MaxRecord = value; + reportChange(); + } + } + } + + protected int selTempoAgg + { + get + { + return SelFilter.TempoAgg / 1000; + } + + set + { + int tempoMS = value * 1000; + if (!SelFilter.TempoAgg.Equals(tempoMS)) + { + SelFilter.TempoAgg = tempoMS; + reportChange(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + SelFilter = new SelectFluxParams(); + ListMacchine = await MDService.MacchineWithFlux(); + ListFlux = await MDService.ParametriGetFilt(selMacchina); + await FilterChanged.InvokeAsync(SelFilter); + } + + protected void toggleParams() + { + showEditPar = !showEditPar; + } + + protected async Task toggleUpdate() + { + liveUpdate = !liveUpdate; + await Task.Delay(1); + if (!liveUpdate) + { + lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; + } + } + + #endregion Protected Methods + + #region Private Fields + + private List? ListFlux = null; + private List? ListMacchine = null; + + #endregion Private Fields + + #region Private Properties + + private bool showEditPar { get; set; } = false; + + #endregion Private Properties + + #region Private Methods + + private void reportChange() + { + FilterChanged.InvokeAsync(SelFilter); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/Components/ListDossiers.razor b/MP.SPEC/Components/ListDossiers.razor new file mode 100644 index 00000000..0745d5cb --- /dev/null +++ b/MP.SPEC/Components/ListDossiers.razor @@ -0,0 +1,9 @@ +

ListDossiers

+ +
    +
  • copiare da ListParameters
  • +
  • metodo dati: DossiersGetLastFilt
  • +
  • metodo dati x ora non fa cache redis (se vuoi provare...)
  • +
+ + diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs new file mode 100644 index 00000000..872595ff --- /dev/null +++ b/MP.SPEC/Components/ListDossiers.razor.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Components; +using System.Net.Http; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Components.Authorization; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; + +namespace MP.SPEC.Components +{ + public partial class ListDossiers + { + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 4121cdca..470a72b2 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -280,6 +280,49 @@ namespace MP.SPEC.Data redisConn.Dispose(); } + /// + /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato + /// macchina (ordinato x data registrazione) + /// + /// * = tutte, altrimenti solo x una data macchina + /// Data di riferimento (Massima) per estrazioen records + /// numero massimo record da restituire + /// + public async Task> DossiersGetLastFilt(string IdxMacchina, DateTime DtRef, int MaxRec) + { +#if false + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisFluxByMac}:{IdxMacchina}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina)); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ParametriGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; +#endif + + return await Task.FromResult(dbController.DossiersGetLastFilt(IdxMacchina, DtRef, MaxRec)); + } + /// /// Restitusice elenco aziende /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 25e17287..a2e1a3e7 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.15.2209.1910 + 6.15.2209.2009 diff --git a/MP.SPEC/Pages/DOSS.razor b/MP.SPEC/Pages/DOSS.razor new file mode 100644 index 00000000..0bdba786 --- /dev/null +++ b/MP.SPEC/Pages/DOSS.razor @@ -0,0 +1,38 @@ +@page "/DOSS" + +
+
+
+
+

DOSSIERS

+
+
+ @if (isFiltering) + { + + filtro x macchina / periodo + } + else + { + + } +
+
+
+
+ @if (isLoading) + { + + } + else + { + @**@ + + } +
+ +
+ + diff --git a/MP.SPEC/Pages/DOSS.razor.cs b/MP.SPEC/Pages/DOSS.razor.cs new file mode 100644 index 00000000..3c38b08b --- /dev/null +++ b/MP.SPEC/Pages/DOSS.razor.cs @@ -0,0 +1,117 @@ +using Microsoft.AspNetCore.Components; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Pages +{ + public partial class DOSS + { + #region Protected Fields + + protected DataPager pagerODL = null!; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected MessageService MsgService { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + currFilter.lastUpdate = $"Last Snapshot: {DateTime.Now:yyyy/MM/dd HH:mm:ss}"; + currFilter.LiveUpdate = (currPage == 1); + StateHasChanged(); + } + + protected override async Task OnInitializedAsync() + { + isLoading = true; + isFiltering = true; + // disabilito ricerca... + MsgService.SearchVal = ""; + MsgService.ShowSearch = false; + // fix pagina + await Task.Delay(1); + var modFilter = currFilter; + modFilter.CurrPage = 1; + modFilter.LiveUpdate = (currPage == 1); + currFilter = modFilter; + await Task.Delay(1); + isFiltering = false; + } + + protected async Task pgResetReq(bool doReset) + { + if (doReset) + { + await pagerODL.resetCurrPage(); + } + } + + protected void updateTotal(int newTotCount) + { + totalCount = newTotCount; + } + + #endregion Protected Methods + + #region Private Properties + + private SelectFluxParams currFilter { get; set; } = new SelectFluxParams(); + + private int currPage + { + get => MsgService.currPage; + set => MsgService.currPage = value; + } + + private bool isFiltering { get; set; } = false; + private bool isLoading { get; set; } = true; + + private int numRecord + { + get => MsgService.numRecord; + set => MsgService.numRecord = value; + } + + private int totalCount { get; set; } = 0; + + #endregion Private Properties + + #region Private Methods + + private async Task updateFilter(SelectFluxParams newParams) + { + isFiltering = false; + isLoading = true; + await Task.Delay(1); + currPage = 1; + if (newParams.CurrPage == 0) + { + newParams.CurrPage = 1; + newParams.LiveUpdate = false; + } + else + { + newParams.LiveUpdate = (currPage == 1); + } + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + currFilter = newParams; + isLoading = false; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 5bd22be0..d198161f 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.15.2209.1910

+

Versione: 6.15.2209.2009


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 6213f0f5..5047ec82 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.15.2209.1910 +6.15.2209.2009 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 57c0cda0..3c5aa0b3 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.15.2209.1910 + 6.15.2209.2009 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false