diff --git a/MP-TAB-SERV/Components/CmpFooter.razor.cs b/MP-TAB-SERV/Components/CmpFooter.razor.cs index f1e0f2a9..89ea2480 100644 --- a/MP-TAB-SERV/Components/CmpFooter.razor.cs +++ b/MP-TAB-SERV/Components/CmpFooter.razor.cs @@ -22,6 +22,7 @@ namespace MP_TAB_SERV.Components { await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); + //Log.Trace("CmpFooter Timer elapsed"); }); pUpd.Wait(); } @@ -29,7 +30,6 @@ namespace MP_TAB_SERV.Components public void StartTimer() { int tOutPeriod = 5000; - //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); aTimer = new System.Timers.Timer(tOutPeriod); aTimer.Elapsed += ElapsedTimer; aTimer.Enabled = true; @@ -44,6 +44,7 @@ namespace MP_TAB_SERV.Components { var rawVers = typeof(Program).Assembly.GetName().Version; ; version = rawVers != null ? rawVers : new Version("0.0.0.0"); + StartTimer(); } #endregion Protected Methods diff --git a/MP-TAB-SERV/Components/MachineBlock.razor.cs b/MP-TAB-SERV/Components/MachineBlock.razor.cs index 61a9fc3d..8bfb3755 100644 --- a/MP-TAB-SERV/Components/MachineBlock.razor.cs +++ b/MP-TAB-SERV/Components/MachineBlock.razor.cs @@ -3,8 +3,10 @@ using global::Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.Services; +using NLog; using NLog.Fluent; using static MP_TAB_SERV.Pages.User; +using static Org.BouncyCastle.Math.EC.ECCurve; namespace MP_TAB_SERV.Components { @@ -74,6 +76,9 @@ namespace MP_TAB_SERV.Components } } + + + #region Public Methods diff --git a/MP-TAB-SERV/Components/MseSampler.razor b/MP-TAB-SERV/Components/MseSampler.razor new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/MP-TAB-SERV/Components/MseSampler.razor @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/MP-TAB-SERV/Components/MseSampler.razor.cs b/MP-TAB-SERV/Components/MseSampler.razor.cs new file mode 100644 index 00000000..a464b07d --- /dev/null +++ b/MP-TAB-SERV/Components/MseSampler.razor.cs @@ -0,0 +1,124 @@ +using global::Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data.Services; +using NLog; + +namespace MP_TAB_SERV.Components +{ + public partial class MseSampler : IDisposable + { + #region Public Properties + + [Parameter] + public EventCallback> E_Updated { get; set; } + + /// Moltiplicatore campionamento: + /// HF: se > 1 (mappa) + /// LF: se < 1 (dettaglio) + [Parameter] + public double SampleMult { get; set; } = 1; + + #endregion Public Properties + + #region Public Methods + + public void Dispose() + { + if (aTimer != null) + { + aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + Log.Info("MseSampler Timer Disposed!"); + } + } + + #endregion Public Methods + + #region Protected Fields + + protected int fastTimerMSec = 3000; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected IConfiguration config { get; set; } = null!; + + protected int fastRefreshMs + { + get + { + // tempo variabile tra +/- 10% del target (SampleMult) della freq standard di update MSE + int answ = ((int)(fastTimerMSec / SampleMult * rnd.Next(900, 1100))) / 1000; + return answ; + } + } + + [Inject] + protected StatusData MDataService { get; set; } = null!; + + [Inject] + protected MessageService MServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + aTimer.Interval = fastRefreshMs; + await RefreshData(); + //Log.Trace("MseSampler Timer elapsed"); + }); + pUpd.Wait(); + } + + protected override void OnInitialized() + { + SetupConf(); + StartTimer(); + } + + protected void StartTimer() + { + aTimer = new System.Timers.Timer(fastRefreshMs); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + Log.Info("MseSampler Timer started!"); + } + + #endregion Protected Methods + + #region Private Fields + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private System.Timers.Timer aTimer = null!; + + private Random rnd = new Random(); + + #endregion Private Fields + + #region Private Methods + + private async Task RefreshData() + { + List ListMSE = await MDataService.MseGetAll(); + await MServ.SaveMse(ListMSE); + await E_Updated.InvokeAsync(ListMSE); + } + + private void SetupConf() + { + // sistemo i parametri opzionali... + int.TryParse(config.GetValue("ServerConf:maxAge"), out fastTimerMSec); + Log.Trace($"MseSampler setupConf | Effettuato setup parametri | fastRefreshMSec: {fastTimerMSec}"); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index 9c3ab2c7..f657ab02 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2310.2708 + 6.16.2310.2710 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/Alarms.razor b/MP-TAB-SERV/Pages/Alarms.razor index f57a87a9..ff411c7a 100644 --- a/MP-TAB-SERV/Pages/Alarms.razor +++ b/MP-TAB-SERV/Pages/Alarms.razor @@ -1,5 +1,6 @@ @page "/alarms" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Alarms.razor.cs b/MP-TAB-SERV/Pages/Alarms.razor.cs index 4e0ed46c..b5afe499 100644 --- a/MP-TAB-SERV/Pages/Alarms.razor.cs +++ b/MP-TAB-SERV/Pages/Alarms.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/Controls.razor b/MP-TAB-SERV/Pages/Controls.razor index f5c55bf1..21bef545 100644 --- a/MP-TAB-SERV/Pages/Controls.razor +++ b/MP-TAB-SERV/Pages/Controls.razor @@ -1,5 +1,6 @@ @page "/controls" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Controls.razor.cs b/MP-TAB-SERV/Pages/Controls.razor.cs index 2add5b0a..e9449abd 100644 --- a/MP-TAB-SERV/Pages/Controls.razor.cs +++ b/MP-TAB-SERV/Pages/Controls.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/Declarations.razor b/MP-TAB-SERV/Pages/Declarations.razor index c9fb0ddd..7be4b8f6 100644 --- a/MP-TAB-SERV/Pages/Declarations.razor +++ b/MP-TAB-SERV/Pages/Declarations.razor @@ -1,5 +1,6 @@ @page "/declarations" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Declarations.razor.cs b/MP-TAB-SERV/Pages/Declarations.razor.cs index 0816788c..b069e0fb 100644 --- a/MP-TAB-SERV/Pages/Declarations.razor.cs +++ b/MP-TAB-SERV/Pages/Declarations.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/IobInfo.razor b/MP-TAB-SERV/Pages/IobInfo.razor index dcf4d33a..c8e7575f 100644 --- a/MP-TAB-SERV/Pages/IobInfo.razor +++ b/MP-TAB-SERV/Pages/IobInfo.razor @@ -1,5 +1,6 @@ @page "/iob-info" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/IobInfo.razor.cs b/MP-TAB-SERV/Pages/IobInfo.razor.cs index 665bca5d..2ef216e4 100644 --- a/MP-TAB-SERV/Pages/IobInfo.razor.cs +++ b/MP-TAB-SERV/Pages/IobInfo.razor.cs @@ -1,24 +1,6 @@ -using global::System; -using global::System.Collections.Generic; -using global::System.Linq; -using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP_TAB_SERV; -using MP_TAB_SERV.Shared; -using MP_TAB_SERV.Components; -using MP.Data; using MP.Data.DatabaseModels; -using MP.Data.DTO; using MP.Data.Services; -using NLog; namespace MP_TAB_SERV.Pages { @@ -41,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor b/MP-TAB-SERV/Pages/MachineDetail.razor index 9f2a5862..804c9d54 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor +++ b/MP-TAB-SERV/Pages/MachineDetail.razor @@ -1,5 +1,7 @@ @page "/machine-detail" + + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { @@ -10,4 +12,3 @@ else } - diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor.cs b/MP-TAB-SERV/Pages/MachineDetail.razor.cs index 3f74f5cd..c5e36643 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor.cs +++ b/MP-TAB-SERV/Pages/MachineDetail.razor.cs @@ -34,6 +34,24 @@ namespace MP_TAB_SERV.Pages } } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await RefreshMBlock(); + } + } + await InvokeAsync(StateHasChanged); + } + protected async Task RefreshMBlock() { // recupero MSE macchina.... @@ -41,7 +59,6 @@ namespace MP_TAB_SERV.Pages { CurrMSE = await MsgServ.GetMachineMse(IdxMacc); } - await Task.Delay(1); } #endregion Protected Methods diff --git a/MP-TAB-SERV/Pages/Notes.razor b/MP-TAB-SERV/Pages/Notes.razor index 1362e15e..15e2b1a9 100644 --- a/MP-TAB-SERV/Pages/Notes.razor +++ b/MP-TAB-SERV/Pages/Notes.razor @@ -1,5 +1,6 @@ @page "/notes" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Notes.razor.cs b/MP-TAB-SERV/Pages/Notes.razor.cs index e8b71a94..cff43b89 100644 --- a/MP-TAB-SERV/Pages/Notes.razor.cs +++ b/MP-TAB-SERV/Pages/Notes.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/Parameters.razor b/MP-TAB-SERV/Pages/Parameters.razor index 290ca2f9..16b8b68e 100644 --- a/MP-TAB-SERV/Pages/Parameters.razor +++ b/MP-TAB-SERV/Pages/Parameters.razor @@ -1,5 +1,7 @@ @page "/parameters" + + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Parameters.razor.cs b/MP-TAB-SERV/Pages/Parameters.razor.cs index 7be577ee..4bff0ffc 100644 --- a/MP-TAB-SERV/Pages/Parameters.razor.cs +++ b/MP-TAB-SERV/Pages/Parameters.razor.cs @@ -1,24 +1,6 @@ -using global::System; -using global::System.Collections.Generic; -using global::System.Linq; -using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP_TAB_SERV; -using MP_TAB_SERV.Shared; -using MP_TAB_SERV.Components; -using MP.Data; using MP.Data.DatabaseModels; -using MP.Data.DTO; using MP.Data.Services; -using NLog; namespace MP_TAB_SERV.Pages { @@ -41,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/ProdPlan.razor b/MP-TAB-SERV/Pages/ProdPlan.razor index 4664541b..8c0674dc 100644 --- a/MP-TAB-SERV/Pages/ProdPlan.razor +++ b/MP-TAB-SERV/Pages/ProdPlan.razor @@ -1,5 +1,6 @@ @page "/prod-plan" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/ProdPlan.razor.cs b/MP-TAB-SERV/Pages/ProdPlan.razor.cs index 35b6135a..f1ccae64 100644 --- a/MP-TAB-SERV/Pages/ProdPlan.razor.cs +++ b/MP-TAB-SERV/Pages/ProdPlan.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/ProdStop.razor b/MP-TAB-SERV/Pages/ProdStop.razor index b94832a2..0f9b2505 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor +++ b/MP-TAB-SERV/Pages/ProdStop.razor @@ -1,5 +1,7 @@ @page "/prod-stop" + + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs index 64482f08..aeb83c65 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor.cs +++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs @@ -214,6 +214,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + protected void SetDate(DateTime newDate) { DtRif = newDate; diff --git a/MP-TAB-SERV/Pages/Scrap.razor b/MP-TAB-SERV/Pages/Scrap.razor index 68a54c91..64aa41ba 100644 --- a/MP-TAB-SERV/Pages/Scrap.razor +++ b/MP-TAB-SERV/Pages/Scrap.razor @@ -1,5 +1,6 @@ @page "/scrap" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/Scrap.razor.cs b/MP-TAB-SERV/Pages/Scrap.razor.cs index 8e864810..da784347 100644 --- a/MP-TAB-SERV/Pages/Scrap.razor.cs +++ b/MP-TAB-SERV/Pages/Scrap.razor.cs @@ -23,6 +23,24 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods diff --git a/MP-TAB-SERV/Pages/StatusMap.razor b/MP-TAB-SERV/Pages/StatusMap.razor index 7852e3d7..df05b717 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor +++ b/MP-TAB-SERV/Pages/StatusMap.razor @@ -2,7 +2,7 @@ @page "/home" @page "/status-map" - +
@if (ListMSE == null || ListMSE.Count == 0) { diff --git a/MP-TAB-SERV/Pages/StatusMap.razor.cs b/MP-TAB-SERV/Pages/StatusMap.razor.cs index 6f9bcc0d..981c0791 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor.cs +++ b/MP-TAB-SERV/Pages/StatusMap.razor.cs @@ -6,61 +6,23 @@ using NLog; namespace MP_TAB_SERV.Pages { - public partial class StatusMap : IDisposable + public partial class StatusMap { - #region Public Methods - - public void Dispose() - { - if (aTimer != null) - { - aTimer.Elapsed -= ElapsedTimer; - aTimer.Stop(); - aTimer.Dispose(); - Log.Info("Timer Disposed!"); - } - } - - public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) - { - var pUpd = Task.Run(async () => - { - await ReloadData(); - await MServ.SaveMse(ListMSE); - await InvokeAsync(StateHasChanged); - Log.Debug("Timer elapsed"); - }); - pUpd.Wait(); - } - - public void StartTimer() - { - int tOutPeriod = 3000; - //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); - aTimer = new System.Timers.Timer(tOutPeriod); - aTimer.Elapsed += ElapsedTimer; - aTimer.Enabled = true; - aTimer.Start(); - Log.Info("Timer started!"); - } - - #endregion Public Methods - #region Protected Fields - //protected bool ShowCard { get; set; } = false; protected bool _showCard = false; - protected bool doAnimate = true; - protected int keepAliveMin = 1; protected int maxCol = 6; + protected string showArt = ""; - protected int slowRefreshSec = 300; #endregion Protected Fields #region Protected Properties + [Inject] + protected IConfiguration config { get; set; } = null!; + [Inject] protected StatusData MDataService { get; set; } = null!; @@ -77,16 +39,6 @@ namespace MP_TAB_SERV.Pages } } - protected int slowRefreshMs - { - get - { - // tempo variabile tra +/- 10% del target - int answ = rnd.Next(900, 1100) * slowRefreshSec; - return answ; - } - } - [Inject] protected TabDataService TabDServ { get; set; } = null!; @@ -141,12 +93,17 @@ namespace MP_TAB_SERV.Pages } } - protected override async Task OnInitializedAsync() + protected override void OnInitialized() { ListMSE = null; SetupConf(); - StartTimer(); - await ReloadData(); + } + + protected async Task RefreshData(List newList) + { + ListMSE = newList; + await InvokeAsync(StateHasChanged); + //Log.Trace("StatusMap | RefreshData"); } #endregion Protected Methods @@ -157,10 +114,6 @@ namespace MP_TAB_SERV.Pages private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000); - private System.Timers.Timer aTimer = null!; - - private Random rnd = new Random(); - #endregion Private Fields #region Private Properties @@ -171,22 +124,12 @@ namespace MP_TAB_SERV.Pages #region Private Methods - private async Task ReloadData() - { - ListMSE = await MDataService.MseGetAll(); - } - private void SetupConf() { // sistemo i parametri opzionali... - TabDServ.ConfigGetVal("keepAliveMin", ref keepAliveMin); TabDServ.ConfigGetVal("MON_maxCol", ref maxCol); - int intDoAnim = 0; - TabDServ.ConfigGetVal("doAnimate", ref intDoAnim); - doAnimate = intDoAnim == 1; - TabDServ.ConfigGetVal("pageRefreshSec", ref slowRefreshSec); TabDServ.ConfigGetVal("sART", ref showArt); - Log.Info($"setupConf | Effettuato setup parametri | keepAlive: {keepAliveMin} | MaxCol: {maxCol} | doAnimate: {doAnimate} | slowRefreshSec: {slowRefreshSec}"); + Log.Info($"setupConf | Effettuato setup parametri | MaxCol: {maxCol}"); } #endregion Private Methods diff --git a/MP-TAB-SERV/Pages/TechSheet.razor b/MP-TAB-SERV/Pages/TechSheet.razor index a728f9f2..612cfe71 100644 --- a/MP-TAB-SERV/Pages/TechSheet.razor +++ b/MP-TAB-SERV/Pages/TechSheet.razor @@ -1,5 +1,7 @@ @page "/tech-sheet" + + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/TechSheet.razor.cs b/MP-TAB-SERV/Pages/TechSheet.razor.cs index 4fe666cc..4a1fe840 100644 --- a/MP-TAB-SERV/Pages/TechSheet.razor.cs +++ b/MP-TAB-SERV/Pages/TechSheet.razor.cs @@ -14,6 +14,9 @@ namespace MP_TAB_SERV.Pages [Inject] protected MessageService MsgServ { get; set; } = null!; + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + #endregion Protected Properties #region Protected Methods @@ -24,20 +27,33 @@ namespace MP_TAB_SERV.Pages SetupConf(); } - private void SetupConf() + protected async Task RefreshData(List newList) { - TabDServ.ConfigGetVal("enableSchedaTecnica", ref enableSchedaTecnica); + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + } + await InvokeAsync(StateHasChanged); } - [Inject] - protected TabDataService TabDServ { get; set; } = null!; - private bool enableSchedaTecnica = false; + #endregion Protected Methods + + #region Private Fields - private string disTitle = "Scheda Tecnica"; - private string disSubtitle = "Funzionalità disattivata"; private string disMessage = "Gestione schede tecniche di attrezzaggio, collaudo e verifica procedure di setup. Il modulo opzionale è attivabile su richiesta."; - #endregion Protected Methods + private string disSubtitle = "Funzionalità disattivata"; + + private string disTitle = "Scheda Tecnica"; + + private bool enableSchedaTecnica = false; + + #endregion Private Fields #region Private Methods @@ -54,6 +70,11 @@ namespace MP_TAB_SERV.Pages } } + private void SetupConf() + { + TabDServ.ConfigGetVal("enableSchedaTecnica", ref enableSchedaTecnica); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/WorkShift.razor b/MP-TAB-SERV/Pages/WorkShift.razor index 09f29415..2ff08eb6 100644 --- a/MP-TAB-SERV/Pages/WorkShift.razor +++ b/MP-TAB-SERV/Pages/WorkShift.razor @@ -1,5 +1,6 @@ @page "/workshift" + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB-SERV/Pages/WorkShift.razor.cs b/MP-TAB-SERV/Pages/WorkShift.razor.cs index 605b1ee6..22e9e2bd 100644 --- a/MP-TAB-SERV/Pages/WorkShift.razor.cs +++ b/MP-TAB-SERV/Pages/WorkShift.razor.cs @@ -9,20 +9,86 @@ namespace MP_TAB_SERV.Pages #region Protected Properties protected MappaStatoExpl? CurrMSE { get; set; } = null; + protected TurniMaccModel currTurni { get; set; } = new TurniMaccModel(); protected string IdxMacc { get; set; } = ""; [Inject] protected MessageService MsgServ { get; set; } = null!; + protected bool T1 + { + get => currTurni.T1; + set + { + if (currTurni.T1 != value) + { + currTurni.T1 = value; + TabServ.TurnoMacchinaToggle(IdxMacc, 1); + } + } + } + + protected bool T2 + { + get => currTurni.T2; + set + { + if (currTurni.T2 != value) + { + currTurni.T2 = value; + TabServ.TurnoMacchinaToggle(IdxMacc, 2); + } + } + } + + protected bool T3 + { + get => currTurni.T3; + set + { + if (currTurni.T3 != value) + { + currTurni.T3 = value; + TabServ.TurnoMacchinaToggle(IdxMacc, 3); + } + } + } + + [Inject] + protected TabDataService TabServ { get; set; } = null!; + #endregion Protected Properties #region Protected Methods + protected string cssByState(bool isActive) + { + return isActive ? "bg-success text-warning" : "bg-secondary"; + } + protected override async Task OnInitializedAsync() { await ReloadData(); } + protected async Task RefreshData(List newList) + { + var ListMSE = newList; + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await ReloadData(); + } + } + await InvokeAsync(StateHasChanged); + } + #endregion Protected Methods #region Private Methods @@ -42,52 +108,6 @@ namespace MP_TAB_SERV.Pages } } - protected bool T1 - { - get => currTurni.T1; - set - { - if (currTurni.T1 != value) - { - currTurni.T1 = value; - TabServ.TurnoMacchinaToggle(IdxMacc, 1); - } - } - } - protected bool T2 - { - get => currTurni.T2; - set - { - if (currTurni.T2 != value) - { - currTurni.T2 = value; - TabServ.TurnoMacchinaToggle(IdxMacc, 2); - } - } - } - protected bool T3 - { - get => currTurni.T3; - set - { - if (currTurni.T3 != value) - { - currTurni.T3 = value; - TabServ.TurnoMacchinaToggle(IdxMacc, 3); - } - } - } - - protected string cssByState(bool isActive) - { - return isActive ? "bg-success text-warning" : "bg-secondary"; - } - - [Inject] - protected TabDataService TabServ { get; set; } = null!; - protected TurniMaccModel currTurni { get; set; } = new TurniMaccModel(); - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index f81d94bb..b6ce3a79 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2310.2708

+

Versione: 6.16.2310.2710


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index fdb2edcb..1fd16ea1 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.2708 +6.16.2310.2710 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index e7dd2fec..ed8fcd65 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.2708 + 6.16.2310.2710 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false