Ancora fix gestione ODL
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
// REDIS KEY Dati correnti
|
||||
public static readonly string CONF_MON_KEY = $"{BASE_HASH}:Conf:MonDispData";
|
||||
|
||||
|
||||
|
||||
public static string redisMseKey = "MP:MON:Cache:MSE";
|
||||
|
||||
#endregion Public Fields
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,7 @@ namespace MP.Data.Controllers
|
||||
var FlgStorico = new SqlParameter("@flgStorico", flgStorico);
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_EL_UpsertByOdl @IdxMacchina, @flgStorico, @DoInsert", IdxOdl, FlgStorico);
|
||||
.ExecuteSqlRaw("EXEC stp_EL_UpsertByOdl @IdxODL, @flgStorico", IdxOdl, FlgStorico);
|
||||
fatto = result != 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace MP.Data.DatabaseModels
|
||||
public string IdxMacchina { get; set; }
|
||||
public int NumPezzi { get; set; }
|
||||
public decimal Tcassegnato { get; set; }
|
||||
public decimal TCRichAttr { get; set; }
|
||||
public DateTime? DataInizio { get; set; }
|
||||
public DateTime? DataFine { get; set; }
|
||||
[MaxLength(2500)]
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace MP.Data.Services
|
||||
stopWatch.Start();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(redisMseKey);
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
@@ -131,7 +131,7 @@ namespace MP.Data.Services
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
|
||||
@@ -165,7 +165,9 @@ namespace MP.Data.Services
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private int maxAge = 2000;
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#if false
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#endif
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
|
||||
@@ -1199,7 +1199,7 @@ namespace MP.Data.Services
|
||||
answ = dbTabController.OdlInizioSetup(idxODL, matrOpr, idxMacchina, tcRich, pzPallet, note);
|
||||
await FlushCache("ODL");
|
||||
await FlushCache("PODL");
|
||||
await FlushCache("VSODL");
|
||||
await FlushCache("VSODL");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -1893,10 +1893,11 @@ namespace MP.Data.Services
|
||||
/// <param name="idxMacchina">idx macchina da confermare</param>
|
||||
/// <param name="maxAgeSec">Num massimo secondi di "vecchiaia" del dato</param>
|
||||
/// <returns></returns>
|
||||
public bool RicalcMse(string idxMacchina, int maxAgeSec)
|
||||
public async Task<bool> RicalcMse(string idxMacchina, int maxAgeSec)
|
||||
{
|
||||
bool answ = false;
|
||||
answ = dbTabController.RicalcMse(idxMacchina, maxAgeSec);
|
||||
await FlushCache(Constants.redisMseKey);
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user