Reorg progetto CalcRuid
This commit is contained in:
@@ -698,45 +698,6 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
return answDto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Esegue un fix dei tags: se fossero numerici li converte in Egw.Window.Data.Enums.QuestionModes
|
||||
/// </summary>
|
||||
/// <param name="origValue"></param>
|
||||
/// <returns></returns>
|
||||
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
|
||||
/// <summary>
|
||||
/// Metodo di Cleanup periodico
|
||||
@@ -838,41 +799,7 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
batch.Execute();
|
||||
await Task.WhenAll(tasks);
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Generatore RUID:
|
||||
/// ID incrementale = timestamp ms + random 4 chars HEX
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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");
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un oggetto HashDict di Redis come dizionario
|
||||
/// </summary>
|
||||
/// <param name="reqKey"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Dictionary<string, RedisValue>> GetRedisHashDict(RedisKey reqKey)
|
||||
{
|
||||
Dictionary<string, RedisValue> reqDict = new Dictionary<string, RedisValue>();
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Esegue un fix dei tags: se fossero numerici li converte in Egw.Window.Data.Enums.QuestionModes
|
||||
/// </summary>
|
||||
/// <param name="origValue"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Generatore RUID:
|
||||
/// ID incrementale = timestamp ms + random 4 chars HEX
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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");
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un oggetto HashDict di Redis come dizionario
|
||||
/// </summary>
|
||||
/// <param name="reqKey"></param>
|
||||
/// <returns></returns>
|
||||
private async Task<Dictionary<string, RedisValue>> GetRedisHashDict(RedisKey reqKey)
|
||||
{
|
||||
Dictionary<string, RedisValue> reqDict = new Dictionary<string, RedisValue>();
|
||||
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}");
|
||||
|
||||
|
||||
@@ -168,7 +168,6 @@ builder.Services.AddHostedService<RedisSubscriberService>();
|
||||
|
||||
// init servizio gestone ReqIndex
|
||||
builder.Services.AddScoped<CalcRuidService>();
|
||||
//builder.Services.AddSingleton(new CalcRuidService(configuration, redisConn));
|
||||
|
||||
builder.Services.AddHostedService<StatsCollectService>();
|
||||
|
||||
|
||||
@@ -25,3 +25,30 @@
|
||||
</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 +1,2 @@
|
||||
1.1.2603.2319
|
||||
1.1.2603.2319
|
||||
|
||||
@@ -5,3 +5,10 @@
|
||||
<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