Fix CalcRuid x interface
This commit is contained in:
@@ -220,6 +220,24 @@
|
||||
MACHINABLE = 1,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modalità raggruppamento (giornalieri, orari...)
|
||||
/// </summary>
|
||||
public enum RuidGroupMode
|
||||
{
|
||||
Day,
|
||||
Hour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di dati raggruppamento gestiti
|
||||
/// </summary>
|
||||
public enum RuidTagMode
|
||||
{
|
||||
Envir,
|
||||
Mode
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#if false
|
||||
|
||||
@@ -6,13 +6,14 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using static Egw.Window.Data.Enums;
|
||||
using static EgwCoreLib.Lux.Core.Enums;
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione servizio indice richieste
|
||||
/// </summary>
|
||||
public class CalcRuidService : BaseServ
|
||||
public class CalcRuidService : BaseServ, ICalcRuidService
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
@@ -41,24 +42,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
|
||||
#region Public Enums
|
||||
|
||||
/// <summary>
|
||||
/// Modalità raggruppamento (giornalieri, orari...)
|
||||
/// </summary>
|
||||
public enum GroupMode
|
||||
{
|
||||
Day,
|
||||
Hour
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tipo di dati raggruppamento gestiti
|
||||
/// </summary>
|
||||
public enum TagMode
|
||||
{
|
||||
Envir,
|
||||
Mode
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Properties
|
||||
@@ -584,7 +567,7 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
/// <param name="reqTag">Tipologia dati richiesti</param>
|
||||
/// <param name="dtFrom">DataOra inizio recupero</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<RealtimeProcDto>> RealTimeDataStats(GroupMode reqGroup, TagMode reqTag, DateTime dtFrom)
|
||||
public async Task<List<RealtimeProcDto>> RealTimeDataStats(RuidGroupMode reqGroup, RuidTagMode reqTag, DateTime dtFrom)
|
||||
{
|
||||
var adesso = DateTime.Now;
|
||||
var tasks = new List<Task<HashEntry[]>>();
|
||||
@@ -592,7 +575,7 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
var dtList = new List<DateTime>();
|
||||
|
||||
// calcolo step richiesto
|
||||
int step = reqGroup == GroupMode.Day ? 24 : 1;
|
||||
int step = reqGroup == RuidGroupMode.Day ? 24 : 1;
|
||||
// [1] Costruzione lista chiavi
|
||||
for (var dt = dtFrom.Date; dt < adesso; dt = dt.AddHours(step))
|
||||
{
|
||||
@@ -602,15 +585,15 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
// processo il resto...
|
||||
string dateKey = reqGroup switch
|
||||
{
|
||||
GroupMode.Day => $"{dt:yyyyMMdd}",
|
||||
GroupMode.Hour => $"{dt:yyyyMMddHH}",
|
||||
RuidGroupMode.Day => $"{dt:yyyyMMdd}",
|
||||
RuidGroupMode.Hour => $"{dt:yyyyMMddHH}",
|
||||
_ => $"{dt:yyyyMM}"
|
||||
};
|
||||
|
||||
RedisKey currKey = reqTag switch
|
||||
{
|
||||
TagMode.Envir => Key($"stats:rtime:env:{dateKey}"),
|
||||
TagMode.Mode => Key($"stats:rtime:mode:{dateKey}"),
|
||||
RuidTagMode.Envir => Key($"stats:rtime:env:{dateKey}"),
|
||||
RuidTagMode.Mode => Key($"stats:rtime:mode:{dateKey}"),
|
||||
_ => ""
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
using EgwCoreLib.Lux.Core.Stats;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Stats;
|
||||
using StackExchange.Redis;
|
||||
using static EgwCoreLib.Lux.Core.Enums;
|
||||
|
||||
namespace EgwCoreLib.Lux.Data.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Interfaccia servizio indice richieste
|
||||
/// </summary>
|
||||
public interface ICalcRuidService
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Metodo Creazione nuova richiesta
|
||||
/// </summary>
|
||||
/// <param name="envir">Environment calcolo</param>
|
||||
/// <param name="tipo">Tipologia richiesta</param>
|
||||
/// <param name="uid">UID di riferimento</param>
|
||||
/// <returns>restituisce il valore del RUID (ID univoco richiesta)</returns>
|
||||
Task<string> AddRequestAsync(string envir, string tipo, string uid);
|
||||
|
||||
/// <summary>
|
||||
/// Effettua pulizia delle statistiche collezionate una volta migrate sul DB
|
||||
/// </summary>
|
||||
/// <param name="keysToDelete">Lista delle chiavi da eliminare da Redis</param>
|
||||
/// <returns></returns>
|
||||
Task CleanupStatsAsync(List<RedisValue> keysToDelete);
|
||||
|
||||
/// <summary>
|
||||
/// Metodo di Aggiornamento richiesta esistente
|
||||
/// </summary>
|
||||
/// <param name="ruid">RUID richiesta</param>
|
||||
/// <returns>HashKey della richiesta</returns>
|
||||
Task<string> CompleteRequestAsync(string ruid);
|
||||
|
||||
/// <summary>
|
||||
/// Espostazione statistiche da REDIS al DB
|
||||
/// </summary>
|
||||
/// <param name="clearRedisAfterExport">Se true, cancella le statistiche da Redis dopo l'esportazione</param>
|
||||
/// <returns>True se esportazione completata con successo</returns>
|
||||
Task ExportStatsToDbAsync(bool clearRedisAfterExport = false);
|
||||
|
||||
/// <summary>
|
||||
/// Metodo Recupero combinazioni envir/tipo
|
||||
/// </summary>
|
||||
/// <returns>Elenco di combinazioni envir|tipo</returns>
|
||||
Task<IEnumerable<(string env, string tipo)>> GetCombinationsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Gestione statistiche (da rivedere)
|
||||
/// </summary>
|
||||
/// <returns>Elenco di statistiche detail da Redis</returns>
|
||||
Task<List<StatsDetailModel>> GetOldStatsFromRedisAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Metodo Recupero richieste per UID
|
||||
/// </summary>
|
||||
/// <param name="uid">UID di riferimento</param>
|
||||
/// <returns>Elenco di RUID associati all'UID</returns>
|
||||
Task<IEnumerable<string>> GetRequestsByUidAsync(string uid);
|
||||
|
||||
/// <summary>
|
||||
/// Metodo Statistiche aggregate
|
||||
/// </summary>
|
||||
/// <returns>Dati statistici in tempo reale</returns>
|
||||
Task<StatsRealtimeDto> GetStatsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce le statistiche per range date
|
||||
/// </summary>
|
||||
/// <param name="from">DataOra inizio</param>
|
||||
/// <param name="to">DataOra fine</param>
|
||||
/// <returns>Range di statistiche</returns>
|
||||
Task<StatsRangeDto> GetStatsRangeAsync(DateTime from, DateTime to);
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce le statistiche RealTime da REDIS
|
||||
/// </summary>
|
||||
/// <param name="reqGroup">Raggruppamento orario richiesto (giornaliero/orario)</param>
|
||||
/// <param name="reqTag">Tipologia dati richiesti (environment/mode)</param>
|
||||
/// <param name="dtFrom">DataOra inizio recupero</param>
|
||||
///
|
||||
/// <returns>Elenco di dati statistici in tempo reale</returns>
|
||||
Task<List<RealtimeProcDto>> RealTimeDataStats(RuidGroupMode reqGroup, RuidTagMode reqTag, DateTime dtFrom);
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco statistiche aggregate disponibili dal DB
|
||||
/// </summary>
|
||||
/// <param name="from">Data inizio</param>
|
||||
/// <param name="to">Data fine</param>
|
||||
///
|
||||
/// <returns>Elenco di statistiche aggregate dal DB</returns>
|
||||
Task<List<StatsAggregatedModel>> StatsAggrListAsync(DateTime from, DateTime to);
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il periodo valido x dati aggregati
|
||||
/// </summary>
|
||||
///
|
||||
/// <returns>Periodo valido per dati aggregati</returns>
|
||||
Task<EgwCoreLib.Utils.DtUtils.Periodo> StatsAggrRangeAsync();
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Modo</span>
|
||||
<div class="input-group-text">
|
||||
@foreach (var type in Enum.GetValues<EgwCoreLib.Lux.Data.Services.CalcRuidService.TagMode>())
|
||||
@foreach (var type in Enum.GetValues<EgwCoreLib.Lux.Core.Enums.RuidTagMode>())
|
||||
{
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input"
|
||||
@@ -35,7 +35,7 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text">Periodo</span>
|
||||
<div class="input-group-text">
|
||||
@foreach (var group in Enum.GetValues<EgwCoreLib.Lux.Data.Services.CalcRuidService.GroupMode>())
|
||||
@foreach (var group in Enum.GetValues<EgwCoreLib.Lux.Core.Enums.RuidGroupMode>())
|
||||
{
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input"
|
||||
|
||||
@@ -3,10 +3,6 @@ using EgwCoreLib.Lux.Core.Stats;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.CodeDom;
|
||||
using System.Net.Cache;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace Lux.UI.Components.Compo.Stats
|
||||
{
|
||||
@@ -69,9 +65,9 @@ namespace Lux.UI.Components.Compo.Stats
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadStatsRT();
|
||||
return ReloadStatsRT();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
@@ -90,15 +86,15 @@ namespace Lux.UI.Components.Compo.Stats
|
||||
private int numDay = 3;
|
||||
private int refrPeriod = 5;
|
||||
private List<RealtimeProcDto> rtProcStats = new List<RealtimeProcDto>();
|
||||
private CalcRuidService.GroupMode SelGroup = CalcRuidService.GroupMode.Hour;
|
||||
private CalcRuidService.TagMode SelMode = CalcRuidService.TagMode.Envir;
|
||||
private Enums.RuidGroupMode SelGroup = Enums.RuidGroupMode.Hour;
|
||||
private Enums.RuidTagMode SelMode = Enums.RuidTagMode.Envir;
|
||||
private StatsRealtimeDto? stats;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task OnGroupChanged(CalcRuidService.GroupMode value)
|
||||
private async Task OnGroupChanged(Enums.RuidGroupMode value)
|
||||
{
|
||||
if (SelGroup != value)
|
||||
{
|
||||
@@ -107,7 +103,7 @@ namespace Lux.UI.Components.Compo.Stats
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnTagChanged(CalcRuidService.TagMode value)
|
||||
private async Task OnTagChanged(Enums.RuidTagMode value)
|
||||
{
|
||||
if (SelMode != value)
|
||||
{
|
||||
|
||||
@@ -25,30 +25,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 1.1.2603.2319</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
<b>Ultime modifiche:</b>
|
||||
<ul>{{LAST-CHANGES}}</ul>
|
||||
</li>
|
||||
<li>
|
||||
<b>v.0.9.* →</b>
|
||||
<ul>
|
||||
<li>Versione preliminare</li>
|
||||
<li>Release dotNet8</li>
|
||||
<li>Integrazione EFCore</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div>
|
||||
<div style="float: left;">
|
||||
<img src="logoEgalware.png" />
|
||||
</div>
|
||||
<div style="float: right;">
|
||||
<a href="https://www.egalware.net/LUX" target="_blank">© Egalware 2025+</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
1.1.2603.2319
|
||||
1.1.2603.2319
|
||||
|
||||
@@ -5,10 +5,3 @@
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.1.2603.2319</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user