Fix selezione period e ODL x controlli
This commit is contained in:
@@ -1163,6 +1163,42 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ultimi ODL x macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina">Macchina</param>
|
||||
/// <param name="numRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<vSelOdlModel>> VSOdlGetLastByMacc(string idxMacchina, int numRec)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<vSelOdlModel>? result = new List<vSelOdlModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:VSODL:{idxMacchina}:{numRec}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<vSelOdlModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbTabController.VSOdlGetLastByMacc(idxMacchina, numRec));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, LongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<vSelOdlModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"VSOdlGetLastByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
Reference in New Issue
Block a user