diff --git a/MP-TAB3/Components/MachSel.razor.cs b/MP-TAB3/Components/MachSel.razor.cs index b0c857c4..ac180922 100644 --- a/MP-TAB3/Components/MachSel.razor.cs +++ b/MP-TAB3/Components/MachSel.razor.cs @@ -8,8 +8,13 @@ using System.Reflection.Metadata; namespace MP_TAB3.Components { - public partial class MachSel + public partial class MachSel:IDisposable { + public void Dispose() + { + TDataService.DataInvalidated -= TDataService_DataInvalidated; + } + #region Public Properties [Parameter] @@ -66,6 +71,7 @@ namespace MP_TAB3.Components protected override async Task OnParametersSetAsync() { + TDataService.DataInvalidated += TDataService_DataInvalidated; try { // inizilamente riporto macchina corrente da MSE @@ -78,33 +84,7 @@ namespace MP_TAB3.Components { if (string.IsNullOrEmpty(idxMaccSel)) { - // verifico se la macchina sia configurata tra le MSFD... - if (SMServ.DictMacchMulti.ContainsKey(RecMSE.IdxMacchina)) - { - isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1; - } - if (isMulti) - { - - var listMulti = await TDataService.VMSFDGetAll(); - ListMacchine = listMulti - .Where(x => x.IdxMacchina.Contains($"{RecMSE.IdxMacchina}#")) - .ToDictionary(x => x.IdxMacchina, x => x.CodMaccArticolo); - - if (ListMacchine.Count > 0) - { - // cerco se ho in storage la macchina selezionata... - var idxMSel = MsgServ.UserPrefGet(idxMaccCurr); - if (!string.IsNullOrEmpty(idxMSel)) - { - IdxMaccSel = idxMSel; - } - else - { - IdxMaccSel = ListMacchine.FirstOrDefault().Key; - } - } - } + await ReloadSelector(); } } } @@ -115,6 +95,44 @@ namespace MP_TAB3.Components await Task.Delay(1); } + private async Task ReloadSelector() + { + if (RecMSE != null) + { + // verifico se la macchina sia configurata tra le MSFD... + if (SMServ.DictMacchMulti.ContainsKey(RecMSE.IdxMacchina)) + { + isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1; + } + if (isMulti) + { + + var listMulti = await TDataService.VMSFDGetAll(); + ListMacchine = listMulti + .Where(x => x.IdxMacchina.Contains($"{RecMSE.IdxMacchina}#")) + .ToDictionary(x => x.IdxMacchina, x => x.CodMaccArticolo); + + if (ListMacchine.Count > 0) + { + // cerco se ho in storage la macchina selezionata... + var idxMSel = MsgServ.UserPrefGet(idxMaccCurr); + if (!string.IsNullOrEmpty(idxMSel)) + { + IdxMaccSel = idxMSel; + } + else + { + IdxMaccSel = ListMacchine.FirstOrDefault().Key; + } + } + } + } + } + + private async void TDataService_DataInvalidated(object? sender, EventArgs e) + { + await ReloadSelector(); + } [Inject] protected TabDataService TDataService { get; set; } = null!; diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 0f3d6297..8351b600 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2507.1016

+

Versione: 6.16.2507.1110


Note di rilascio: