From 0e1c22f96bcbd15be5f2eb5f83e910a79a2b2998 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 23 Mar 2026 19:13:11 +0100 Subject: [PATCH] Reorg progetto CalcRuid --- .../Services/CalcRuidService.cs | 147 +++++++++--------- Lux.API/Program.cs | 1 - Resources/ChangeLog.html | 27 ++++ Resources/VersNum.txt | 1 + Resources/manifest.xml | 7 + 5 files changed, 109 insertions(+), 74 deletions(-) diff --git a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs index 9294043b..16b6f6e9 100644 --- a/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs +++ b/EgwCoreLib.Lux.Data/Services/CalcRuidService.cs @@ -698,45 +698,6 @@ namespace EgwCoreLib.Lux.Data.Services return answDto; } - #endregion Public Methods - - #region Protected Methods - - /// - /// Esegue un fix dei tags: se fossero numerici li converte in Egw.Window.Data.Enums.QuestionModes - /// - /// - /// - protected string fixTag(object origValue) - { - string strVal = $"{origValue}"; - // 1. Proviamo a vedere se il valore è un intero - if (int.TryParse(strVal, out int numericValue)) - { - // 2. Verifichiamo se il numero è definito nel tuo Enum - if (Enum.IsDefined(typeof(QuestionModes), numericValue)) - { - // Trasformiamo il numero nel nome testuale dell'enum - strVal = ((QuestionModes)numericValue).ToString(); - } - } - return strVal; - } - - #endregion Protected Methods - - #region Private Fields - - private static Logger Log = LogManager.GetCurrentClassLogger(); - private readonly TimeSpan _archivePeriod; - private readonly string _base; - private readonly IDatabase _db; - private readonly TimeSpan _retention; - private readonly Random _rnd = new Random(); - private readonly IServiceProvider _serviceProvider; - - #endregion Private Fields - #if false /// /// Metodo di Cleanup periodico @@ -838,41 +799,7 @@ namespace EgwCoreLib.Lux.Data.Services batch.Execute(); await Task.WhenAll(tasks); } -#endif - #region Private Methods - - /// - /// Generatore RUID: - /// ID incrementale = timestamp ms + random 4 chars HEX - /// - /// - private string GenerateRuid() - { - long ts = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - string rand = Convert.ToString(_rnd.Next(0x1000, 0xFFFF), 16).ToUpper(); - return $"{ts}-{rand}"; - } - - private RedisKey GetCombinationsKey() => Key("req:combinations"); - - /// - /// Restituisce un oggetto HashDict di Redis come dizionario - /// - /// - /// - private async Task> GetRedisHashDict(RedisKey reqKey) - { - Dictionary reqDict = new Dictionary(); - var reqData = await _db.HashGetAllAsync(reqKey); - if (reqDict != null) - { - reqDict = reqData.ToDictionary(x => x.Name.ToString(), x => x.Value); - } - return reqDict; - } - -#if false public async Task AggregateAndSaveStatsAsync(TimeSpan? timeRange = null, bool deleteFromRedis = false) { var now = DateTime.Now; @@ -999,6 +926,80 @@ namespace EgwCoreLib.Lux.Data.Services } } #endif + #endregion Public Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + private readonly TimeSpan _archivePeriod; + + private readonly string _base; + + private readonly IDatabase _db; + + private readonly TimeSpan _retention; + + private readonly Random _rnd = new Random(); + + private readonly IServiceProvider _serviceProvider; + + #endregion Private Fields + + #region Private Methods + + /// + /// Esegue un fix dei tags: se fossero numerici li converte in Egw.Window.Data.Enums.QuestionModes + /// + /// + /// + private string fixTag(object origValue) + { + string strVal = $"{origValue}"; + // 1. Proviamo a vedere se il valore è un intero + if (int.TryParse(strVal, out int numericValue)) + { + // 2. Verifichiamo se il numero è definito nel tuo Enum + if (Enum.IsDefined(typeof(QuestionModes), numericValue)) + { + // Trasformiamo il numero nel nome testuale dell'enum + strVal = ((QuestionModes)numericValue).ToString(); + } + } + return strVal; + } + + + /// + /// Generatore RUID: + /// ID incrementale = timestamp ms + random 4 chars HEX + /// + /// + private string GenerateRuid() + { + long ts = DateTimeOffset.Now.ToUnixTimeMilliseconds(); + string rand = Convert.ToString(_rnd.Next(0x1000, 0xFFFF), 16).ToUpper(); + return $"{ts}-{rand}"; + } + + private RedisKey GetCombinationsKey() => Key("req:combinations"); + + /// + /// Restituisce un oggetto HashDict di Redis come dizionario + /// + /// + /// + private async Task> GetRedisHashDict(RedisKey reqKey) + { + Dictionary reqDict = new Dictionary(); + var reqData = await _db.HashGetAllAsync(reqKey); + if (reqDict != null) + { + reqDict = reqData.ToDictionary(x => x.Name.ToString(), x => x.Value); + } + return reqDict; + } + private RedisKey GetRequestKey(string ruid) => Key($"request:{ruid}"); diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index 04f3936a..e79417c9 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -168,7 +168,6 @@ builder.Services.AddHostedService(); // init servizio gestone ReqIndex builder.Services.AddScoped(); -//builder.Services.AddSingleton(new CalcRuidService(configuration, redisConn)); builder.Services.AddHostedService(); diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index e3716607..ef8a7849 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -25,3 +25,30 @@ + + 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 92a8cc26..7717fe19 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1,2 @@ 1.1.2603.2319 +1.1.2603.2319 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 295013e4..a1bd83ad 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -5,3 +5,10 @@ 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 +