diff --git a/EgwCoreLib.Lux.Core/Enums.cs b/EgwCoreLib.Lux.Core/Enums.cs index 5887e6a4..a44d7333 100644 --- a/EgwCoreLib.Lux.Core/Enums.cs +++ b/EgwCoreLib.Lux.Core/Enums.cs @@ -220,6 +220,24 @@ MACHINABLE = 1, } + /// + /// Modalità raggruppamento (giornalieri, orari...) + /// + public enum RuidGroupMode + { + Day, + Hour + } + + /// + /// Tipo di dati raggruppamento gestiti + /// + public enum RuidTagMode + { + Envir, + Mode + } + #endregion Public Enums #if false diff --git a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs index 16b6f6e9..d107783b 100644 --- a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs +++ b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs @@ -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 { /// /// Gestione servizio indice richieste /// - public class CalcRuidService : BaseServ + public class CalcRuidService : BaseServ, ICalcRuidService { #region Public Constructors @@ -41,24 +42,6 @@ namespace EgwCoreLib.Lux.Data.Services #region Public Enums - /// - /// Modalità raggruppamento (giornalieri, orari...) - /// - public enum GroupMode - { - Day, - Hour - } - - /// - /// Tipo di dati raggruppamento gestiti - /// - public enum TagMode - { - Envir, - Mode - } - #endregion Public Enums #region Public Properties @@ -584,7 +567,7 @@ namespace EgwCoreLib.Lux.Data.Services /// Tipologia dati richiesti /// DataOra inizio recupero /// - public async Task> RealTimeDataStats(GroupMode reqGroup, TagMode reqTag, DateTime dtFrom) + public async Task> RealTimeDataStats(RuidGroupMode reqGroup, RuidTagMode reqTag, DateTime dtFrom) { var adesso = DateTime.Now; var tasks = new List>(); @@ -592,7 +575,7 @@ namespace EgwCoreLib.Lux.Data.Services var dtList = new List(); // 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}"), _ => "" }; diff --git a/EgwCoreLib.Lux.Data/Services/ICalcRuidService.cs b/EgwCoreLib.Lux.Data/Services/ICalcRuidService.cs new file mode 100644 index 00000000..e58f5bf9 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/ICalcRuidService.cs @@ -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 +{ + /// + /// Interfaccia servizio indice richieste + /// + public interface ICalcRuidService + { + #region Public Methods + + /// + /// Metodo Creazione nuova richiesta + /// + /// Environment calcolo + /// Tipologia richiesta + /// UID di riferimento + /// restituisce il valore del RUID (ID univoco richiesta) + Task AddRequestAsync(string envir, string tipo, string uid); + + /// + /// Effettua pulizia delle statistiche collezionate una volta migrate sul DB + /// + /// Lista delle chiavi da eliminare da Redis + /// + Task CleanupStatsAsync(List keysToDelete); + + /// + /// Metodo di Aggiornamento richiesta esistente + /// + /// RUID richiesta + /// HashKey della richiesta + Task CompleteRequestAsync(string ruid); + + /// + /// Espostazione statistiche da REDIS al DB + /// + /// Se true, cancella le statistiche da Redis dopo l'esportazione + /// True se esportazione completata con successo + Task ExportStatsToDbAsync(bool clearRedisAfterExport = false); + + /// + /// Metodo Recupero combinazioni envir/tipo + /// + /// Elenco di combinazioni envir|tipo + Task> GetCombinationsAsync(); + + /// + /// Gestione statistiche (da rivedere) + /// + /// Elenco di statistiche detail da Redis + Task> GetOldStatsFromRedisAsync(); + + /// + /// Metodo Recupero richieste per UID + /// + /// UID di riferimento + /// Elenco di RUID associati all'UID + Task> GetRequestsByUidAsync(string uid); + + /// + /// Metodo Statistiche aggregate + /// + /// Dati statistici in tempo reale + Task GetStatsAsync(); + + /// + /// Restituisce le statistiche per range date + /// + /// DataOra inizio + /// DataOra fine + /// Range di statistiche + Task GetStatsRangeAsync(DateTime from, DateTime to); + + /// + /// Restituisce le statistiche RealTime da REDIS + /// + /// Raggruppamento orario richiesto (giornaliero/orario) + /// Tipologia dati richiesti (environment/mode) + /// DataOra inizio recupero + /// + /// Elenco di dati statistici in tempo reale + Task> RealTimeDataStats(RuidGroupMode reqGroup, RuidTagMode reqTag, DateTime dtFrom); + + /// + /// Restituisce elenco statistiche aggregate disponibili dal DB + /// + /// Data inizio + /// Data fine + /// + /// Elenco di statistiche aggregate dal DB + Task> StatsAggrListAsync(DateTime from, DateTime to); + + /// + /// Restituisce il periodo valido x dati aggregati + /// + /// + /// Periodo valido per dati aggregati + Task StatsAggrRangeAsync(); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/Lux.UI/Components/Compo/Stats/RealTimeStats.razor b/Lux.UI/Components/Compo/Stats/RealTimeStats.razor index fe0c4c53..17bb6a20 100644 --- a/Lux.UI/Components/Compo/Stats/RealTimeStats.razor +++ b/Lux.UI/Components/Compo/Stats/RealTimeStats.razor @@ -14,7 +14,7 @@
Modo
- @foreach (var type in Enum.GetValues()) + @foreach (var type in Enum.GetValues()) {
Periodo
- @foreach (var group in Enum.GetValues()) + @foreach (var group in Enum.GetValues()) {
rtProcStats = new List(); - 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) { diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index ef8a7849..e3716607 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -25,30 +25,3 @@
- - LUX - Web Windows MES -

Versione: 1.1.2603.2319

-
Note di rilascio: -
    -
  • - Ultime modifiche: -
      {{LAST-CHANGES}}
    -
  • -
  • - v.0.9.* → -
      -
    • Versione preliminare
    • -
    • Release dotNet8
    • -
    • Integrazione EFCore
    • -
    -
  • -
-
-
- -
- -
- diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 7717fe19..92a8cc26 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1,2 +1 @@ 1.1.2603.2319 -1.1.2603.2319 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index a1bd83ad..295013e4 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -5,10 +5,3 @@ http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false - - - 1.1.2603.2319 - http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip - http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html - false -