diff --git a/MP-TAB3/Components/MachineBlock.razor.cs b/MP-TAB3/Components/MachineBlock.razor.cs index 34df388c..fbbcfafd 100644 --- a/MP-TAB3/Components/MachineBlock.razor.cs +++ b/MP-TAB3/Components/MachineBlock.razor.cs @@ -368,6 +368,7 @@ namespace MP_TAB3.Components protected override async Task OnParametersSetAsync() { // controllo variazione parametri... + string lastIMS = LastIdxMacchSub; if (paramsChanged()) { saveParams(); @@ -376,7 +377,9 @@ namespace MP_TAB3.Components // controllo SE ho variazioni cosė rileggo if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null) { - RecMSESub = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, true); + // solo se cambia macchina forzo da DB + bool doForce = lastIMS != IdxMacchSub; + RecMSESub = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, doForce); } else { @@ -403,7 +406,7 @@ namespace MP_TAB3.Components protected void setGaugeVals() { - if (RecMSE != null) + if (CRecMSE != null) { innerCircleVals.Clear(); outerCircleVals.Clear(); @@ -497,7 +500,10 @@ namespace MP_TAB3.Components { currOdl = await TabDServ.OdlByIdx(currPodl.IdxOdl, false); } - await updateIdxOdl(); + if (!string.IsNullOrEmpty(IdxMaccMain)) + { + await updateIdxOdl(); + } } } diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 8a4da97e..fe8adc70 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2503.715 + 6.16.2503.716 enable MP_TAB3 diff --git a/MP-TAB3/Pages/BasePage.razor.cs b/MP-TAB3/Pages/BasePage.razor.cs index e031fb07..87ae6fea 100644 --- a/MP-TAB3/Pages/BasePage.razor.cs +++ b/MP-TAB3/Pages/BasePage.razor.cs @@ -12,6 +12,17 @@ namespace MP_TAB3.Pages /// public partial class BasePage : IDisposable { + #region Private Fields + + private bool doBlink = false; + + /// + /// DateTime ultimo salvataggio in LocalStorage + /// + private DateTime lastSave = DateTime.Now; + + #endregion Private Fields + #region Public Properties /// @@ -42,7 +53,6 @@ namespace MP_TAB3.Pages IdxMacc = ""; CurrMSE = null; TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage; - TDFeeder.blinkPipe.EA_NewMessage -= BlinkPipe_EA_NewMessage; } #endregion Public Methods @@ -57,7 +67,6 @@ namespace MP_TAB3.Pages { await base.OnInitializedAsync(); TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage; - TDFeeder.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage; } protected override async Task OnParametersSetAsync() @@ -121,47 +130,8 @@ namespace MP_TAB3.Pages #endregion Protected Methods - #region Private Fields - - private bool doBlink = false; - - /// - /// DateTime ultimo salvataggio in LocalStorage - /// - private DateTime lastSave = DateTime.Now; - - #endregion Private Fields - #region Private Methods - /// - /// Ricezione evento blink - /// - /// - /// - private void BlinkPipe_EA_NewMessage(object? sender, EventArgs e) - { - PubSubEventArgs currArgs = (PubSubEventArgs)e; - // conversione on-the-fly List --> allarmi - if (!string.IsNullOrEmpty(currArgs.newMessage)) - { - try - { - var dataRaw = JsonConvert.DeserializeObject(currArgs.newMessage); - if (dataRaw != null) - { - bool.TryParse($"{dataRaw}", out doBlink); - } - } - catch - { } - InvokeAsync(() => - { - StateHasChanged(); - }); - } - } - /// /// Ricevuto nuovi dati da mostrare! /// diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 43c5fe0e..de62dc11 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2503.715

+

Versione: 6.16.2503.716


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index ff9691ec..c6ac295b 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2503.715 +6.16.2503.716 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 17e83212..7a9bb685 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2503.715 + 6.16.2503.716 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index dcdf7a03..83c06402 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1285,7 +1285,7 @@ namespace MP.Data.Services } // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, UltraLongCache); + redisDb.StringSet(currKey, rawData, UltraFastCache); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms"); @@ -1344,7 +1344,7 @@ namespace MP.Data.Services result = new ODLExpModel(); } sw.Stop(); - Log.Debug($"OdlByIdx | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"OdlByIdx | {idxOdl} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; } @@ -1382,28 +1382,36 @@ namespace MP.Data.Services Stopwatch sw = new Stopwatch(); sw.Start(); ODLExpModel result = new ODLExpModel(); - // cerco in redis... - string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR"; - RedisValue rawData = await redisDb.StringGetAsync(currKey); - if (rawData.HasValue && !forceDb) + // se vuoto esco subito... + if (!string.IsNullOrEmpty(idxMacchina)) { - result = JsonConvert.DeserializeObject($"{rawData}"); - source = "REDIS"; + // cerco in redis... + string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue && !forceDb) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + source = "REDIS"; + } + else + { + var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina)); + result = listRes.FirstOrDefault(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, FastCache); + } + if (result == null) + { + result = new ODLExpModel(); + } + sw.Stop(); + Log.Debug($"OdlCurrByMacc | {source} | {idxMacchina} | {sw.Elapsed.TotalMilliseconds}ms"); } else { - var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina)); - result = listRes.FirstOrDefault(); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, FastCache); + Log.Trace("idxMacchina vuoto!"); } - if (result == null) - { - result = new ODLExpModel(); - } - sw.Stop(); - Log.Debug($"OdlCurrByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; } @@ -1928,7 +1936,7 @@ namespace MP.Data.Services result = new PODLExpModel(); } sw.Stop(); - Log.Debug($"PODL_getByKey | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"PODL_getByKey | {idxPODL} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; }