From 8f8e1f1153fa08a081bfb4ba7465d087341749dc Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 13 Mar 2025 14:50:20 +0100 Subject: [PATCH 1/3] Soluzione problem TAB3 su refresh post controllo --- MP-TAB3/Components/ControlsMan.razor.cs | 78 +++++++++++++++++++++++- MP-TAB3/Components/MachineBlock.razor.cs | 2 + MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- 6 files changed, 82 insertions(+), 6 deletions(-) diff --git a/MP-TAB3/Components/ControlsMan.razor.cs b/MP-TAB3/Components/ControlsMan.razor.cs index 0386e08c..f3240476 100644 --- a/MP-TAB3/Components/ControlsMan.razor.cs +++ b/MP-TAB3/Components/ControlsMan.razor.cs @@ -78,8 +78,30 @@ namespace MP_TAB3.Components #endregion Protected Properties + private bool isMulti = false; + #region Protected Methods + /// + /// Restituisce il codice IdxMacchina dell'impianto PARENT (se multi) altrimenti la stessa macchina... + /// + protected string getIdxMaccParent() + { + string answ = IdxMaccSel; + // se fosse multi controllo + if (isMulti) + { + // verifico se SIA una tavola (ha char "#") + int iSharp = IdxMaccSel.IndexOf('#'); + if (iSharp > 0) + { + // sistemo nome + answ = IdxMaccSel.Substring(0, iSharp); + } + } + return answ; + } + protected override async Task OnInitializedAsync() { await Task.Delay(1); @@ -87,7 +109,7 @@ namespace MP_TAB3.Components { enableControlli = SMServ.GetConfBool("enableControlli"); IdxMaccSel = RecMSE.IdxMacchina; - bool isMulti = SMServ.DictMacchMulti[IdxMaccSel] == 1; + isMulti = SMServ.DictMacchMulti[IdxMaccSel] == 1; if (isMulti) { var idxMSel = MServ.UserPrefGet(IdxMaccSel); @@ -103,7 +125,44 @@ namespace MP_TAB3.Components await doUpdate(); } } + /// + /// Macchina selezionata MAIN + /// + private string IdxMaccMain + { + get => RecMSE != null ? RecMSE.IdxMacchina : ""; + } + /// + /// Restituisce il codice IdxMacchina dell'altra tavola (se multi) altrimenti la stessa macchina... + /// + private string idxMaccAltraTav + { + get + { + string answ = ""; + if (RecMSE != null) + { + try + { + // verifico se SIA una tavola (ha char "#") + int iSharp = IdxMaccMain.IndexOf('#'); + if (iSharp > 0) + { + // ora verifico SE ALTRA TAVOLA ha ODL... + string nomeTav = IdxMaccMain.Substring(iSharp); + string altraTav = nomeTav.Substring(0, nomeTav.Length - 1); + altraTav += nomeTav.EndsWith("1") ? "2" : "1"; + // sistemo nome + answ = IdxMaccMain.Replace(nomeTav, altraTav); + } + } + catch + { } + } + return answ; + } + } protected async Task SaveKo() { isProcessing = true; @@ -112,6 +171,13 @@ namespace MP_TAB3.Components showNote = false; await doUpdate(); await E_Updated.InvokeAsync(false); + //TabDServ.NotifyDataInvalidated(IdxMaccSel); + if (isMulti) + { + await E_MachSel.InvokeAsync(idxMaccAltraTav); + await Task.Delay(100); + } + await E_MachSel.InvokeAsync(IdxMaccSel); isProcessing = false; } @@ -129,6 +195,13 @@ namespace MP_TAB3.Components showNote = false; await doUpdate(); await E_Updated.InvokeAsync(true); + //TabDServ.NotifyDataInvalidated(IdxMaccSel); + if (isMulti) + { + await E_MachSel.InvokeAsync(idxMaccAltraTav); + await Task.Delay(100); + } + await E_MachSel.InvokeAsync(IdxMaccSel); isProcessing = false; } @@ -144,8 +217,8 @@ namespace MP_TAB3.Components await Task.Delay(1); IdxMaccSel = selIdxMacc; await doUpdate(); - isProcessing = false; await Task.Delay(1); + isProcessing = false; await E_MachSel.InvokeAsync(selIdxMacc); } @@ -222,6 +295,7 @@ namespace MP_TAB3.Components private Periodo CurrPeriodo { get; set; } = new Periodo(); private string IdxMaccSel { get; set; } = ""; + private string IdxMaccAltra { get; set; } = ""; private int IdxOdl { get; set; } = 0; diff --git a/MP-TAB3/Components/MachineBlock.razor.cs b/MP-TAB3/Components/MachineBlock.razor.cs index 4273816a..184ad592 100644 --- a/MP-TAB3/Components/MachineBlock.razor.cs +++ b/MP-TAB3/Components/MachineBlock.razor.cs @@ -402,9 +402,11 @@ namespace MP_TAB3.Components { // se riceve evento relativo a questo impianto --> ricarico dati prod... detailLoaded = false; + Log.Info("TabDServ_DataInvalidated: Reload Data"); // carico dettagli await loadDetails(); setGaugeVals(); + //await InvokeAsync(StateHasChanged); } } diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index fe3f96f8..03ecf080 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2503.1312 + 6.16.2503.1314 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 5c3a50ee..b7b138c4 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2503.1312

+

Versione: 6.16.2503.1314


Note di rilascio: