Gestione dati invalidati x setup e display articolo in selettore

This commit is contained in:
Samuele Locatelli
2025-07-11 10:33:09 +02:00
parent c3c3423cd3
commit 1769ba2b51
4 changed files with 49 additions and 31 deletions
+46 -28
View File
@@ -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!;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2507.1016</h4>
<h4>Versione: 6.16.2507.1110</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2507.1016
6.16.2507.1110
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2507.1016</version>
<version>6.16.2507.1110</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>