Gestione snapshot

- anticipo parametricod a tab config
This commit is contained in:
Samuele Locatelli
2022-10-05 10:58:49 +02:00
parent 10f9ed08a8
commit c4a682cc24
2 changed files with 19 additions and 12 deletions
+18 -11
View File
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Components;
using MP.SPEC.Data;
using System.Runtime.CompilerServices;
namespace MP.SPEC.Components
{
@@ -170,6 +169,14 @@ namespace MP.SPEC.Components
SelFilter = new SelectFluxParams();
ListMacchine = await MDService.MacchineWithFlux();
ListFlux = await MDService.ParametriGetFilt(selMacchina);
var configData = await MDService.ConfigGetAll();
var currRec = configData.FirstOrDefault(x => x.Chiave == "numOreAnticipoSnapshot");
if (currRec != null)
{
int.TryParse(currRec.Valore, out numOreAnticipoSnapshot);
}
await FilterChanged.InvokeAsync(SelFilter);
}
@@ -182,7 +189,7 @@ namespace MP.SPEC.Components
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = RoundDatetime(5);
currFilt.dtMin = RoundDatetime(5).AddDays(-1);
currFilt.dtMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot);
SelFilter = currFilt;
}
@@ -196,19 +203,19 @@ namespace MP.SPEC.Components
protected async Task takeSnapshot()
{
// indico snapshot fatto
snapshotDone = true;
startTimer();
// fermo udpate
liveUpdate = false;
// se non ho data rif uso adesso...
DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax;
DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddDays(-1) : (DateTime)selDtMin;
DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin;
// aggiungo 2 sec
dtMax = dtMax.AddSeconds(15);
//dtMin = dtMin.AddMinutes(-30);
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
// indico snapshot fatto
snapshotDone = true;
startTimer();
}
protected void toggleParams()
@@ -237,15 +244,17 @@ namespace MP.SPEC.Components
private static System.Timers.Timer aTimer = new System.Timers.Timer();
private List<string>? ListFlux = null;
private List<string>? ListMacchine = null;
private int numOreAnticipoSnapshot = 5;
private bool snapshotDone = false;
#endregion Private Fields
#region Private Properties
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private DateTime? selDtMax
{
get => SelFilter.dtMax;
@@ -265,6 +274,7 @@ namespace MP.SPEC.Components
}
}
}
private DateTime? selDtMin
{
get => SelFilter.dtMin;
@@ -285,9 +295,6 @@ namespace MP.SPEC.Components
}
}
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private bool showEditPar { get; set; } = false;
private string snapMode
+1 -1
View File
@@ -15,6 +15,6 @@
"ServerConf": {
"maxAge": "2000",
"cacheCheckArtUsato": 2,
"redisLongTimeCache": 15
"redisLongTimeCache": 15
}
}