inizio fix tab3 x DP

This commit is contained in:
Samuele E. Locatelli
2025-03-07 12:28:07 +01:00
parent 9bb4e1e9a9
commit 70f4f8ce8b
6 changed files with 84 additions and 28 deletions
+79 -23
View File
@@ -28,17 +28,33 @@ namespace MP_TAB3.Components
public string IdxMacchSub { get; set; } = "";
[Parameter]
public int keepAliveMin { get; set; } = 5;
public int KeepAliveMin { get; set; } = 5;
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
[Parameter]
public bool showCard { get; set; }
public bool ShowCard { get; set; }
[Parameter]
public int Width { get; set; } = 0;
private bool LastFullMode = true;
private MappaStatoExpl? LastRecMSE = null;
private bool LastShowCard = true;
private int LastKeepAliveMin = 5;
private string LastIdxMacchSub = "";
/// <summary>
/// Info correnti secondo tipo selezione
/// </summary>
private MappaStatoExpl? CRecMSE
{
get => string.IsNullOrEmpty(IdxMacchSub) ? RecMSE : RecMSESub;
}
private MappaStatoExpl? RecMSESub { get; set; } = null;
#endregion Public Properties
#region Public Methods
@@ -244,6 +260,8 @@ namespace MP_TAB3.Components
protected override async Task OnInitializedAsync()
{
isLoading = true;
// salvo i parametri precedenti x calcolare variazioni...
saveParams();
// abilitazione disegni...
TabDServ.ConfigGetVal("enableDisegno", ref enableDisegno);
await ReloadXDL(true);
@@ -260,35 +278,73 @@ namespace MP_TAB3.Components
await Task.Delay(1);
}
private void saveParams()
{
LastIdxMacchSub = IdxMacchSub;
LastRecMSE = RecMSE;
LastFullMode = FullMode;
LastShowCard = ShowCard;
LastKeepAliveMin = KeepAliveMin;
}
/// <summary>
/// Verifica variazione parametri
/// </summary>
/// <returns></returns>
private bool paramsChanged()
{
if (LastFullMode != FullMode)
return true;
if (LastKeepAliveMin != KeepAliveMin)
return true;
if (LastShowCard != ShowCard)
return true;
if (LastIdxMacchSub != IdxMacchSub)
return true;
if (LastRecMSE != RecMSE)
return true;
return false;
}
protected override async Task OnParametersSetAsync()
{
DateTime adesso = DateTime.Now;
isLoading = RecMSE == null;
// controllo SE ho variazioni così rileggo
if (RecMSE != null)
// controllo variazione parametri...
if (paramsChanged())
{
if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.PezziProd || SDService.MachProdStGet(RecMSE.IdxMacchina).IdxOdl != RecMSE.IdxOdl || (datiProdAct != null && datiProdAct.PzTotODL != RecMSE.PezziProd))
saveParams();
DateTime adesso = DateTime.Now;
isLoading = RecMSE == null;
// controllo SE ho variazioni così rileggo
if (RecMSE != null)
{
datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct);
SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.PezziProd);
if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.PezziProd || SDService.MachProdStGet(RecMSE.IdxMacchina).IdxOdl != RecMSE.IdxOdl || (datiProdAct != null && datiProdAct.PzTotODL != RecMSE.PezziProd))
{
datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct);
SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.PezziProd);
}
else
{
datiProdAct = SDService.MachProdStGet(RecMSE.IdxMacchina);
}
if (string.IsNullOrEmpty(IdxMaccSel))
{
IdxMaccSel = RecMSE.IdxMacchina;
}
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
}
if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null)
{
RecMSESub = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, true);
}
else
{
datiProdAct = SDService.MachProdStGet(RecMSE.IdxMacchina);
RecMSESub = RecMSE;
}
if (string.IsNullOrEmpty(IdxMaccSel))
{
IdxMaccSel = RecMSE.IdxMacchina;
}
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
setGaugeVals();
}
if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null)
{
RecMSE = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, true);
}
setGaugeVals();
}
protected void setGaugeVals()
@@ -406,7 +462,7 @@ namespace MP_TAB3.Components
{
DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1);
string answ = cssStatus(semaforo);
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor))
if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (KeepAliveMin * kaFactor))
{
answ = $"{baseCss}Ro";
// blink se secondo pari...
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2503.709</Version>
<Version>6.16.2503.712</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -36,7 +36,7 @@
{
currIdx++;
<div class="col ps-0 pe-1">
<MachineBlock RecMSE="@item" FullMode="true" Width="@Width" Height="@Height" showCard="@ShowCard" doBlink="@doBlink"></MachineBlock>
<MachineBlock RecMSE="@item" FullMode="true" Width="@Width" Height="@Height" ShowCard="@ShowCard" doBlink="@doBlink"></MachineBlock>
</div>
@if (currIdx >= maxBlocks)
{
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2503.709</h4>
<h4>Versione: 6.16.2503.712</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2503.709
6.16.2503.712
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2503.709</version>
<version>6.16.2503.712</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>