TAB3 speedup:

- update vari in fase reload: da provare...
- update in reload dati utente la row top
This commit is contained in:
Samuele E. Locatelli
2025-03-29 16:32:23 +01:00
parent 7d077b6576
commit 087e6318f6
14 changed files with 86 additions and 46 deletions
+14 -8
View File
@@ -1,4 +1,4 @@
<div class="top-row d-flex justify-content-between text-light">
<div class="top-row d-flex justify-content-between text-light @CssReload">
<div class="col-4 d-flex">
<div class="pe-1">
<button class="btn btn-sm @ResetClass" @onclick="() => ForceReload()" title="Update"><i class="fa-solid fa-rotate"></i></button>
@@ -16,13 +16,19 @@
</div>
</div>
<div class="col-4 text-end">
@if (!HideMenu)
{
<div class="row w-100 slideMen">
<div class="p-0">
<SlideMenu MenuItems="@CurrMenuItems"></SlideMenu>
<div class="d-flex flex-row-reverse">
@if (!HideMenu)
{
<div class="px-1 slideMen">
<span class="p-0">
<SlideMenu MenuItems="@CurrMenuItems"></SlideMenu>
</span>
</div>
</div>
}
}
@if (IsReloading)
{
<div class="px-1 text-nowrap">Reloading User Data...</div>
}
</div>
</div>
</div>
+13 -3
View File
@@ -78,12 +78,21 @@ namespace MP_TAB3.Components
}
}
private bool IsReloading = false;
private string CssReload
{
get => IsReloading ? "bg-primary bg-gradient" : "";
}
protected async Task ForceReload()
{
Stopwatch sw = new Stopwatch();
sw.Start();
Log.Info("Start ForceReload");
IsReloading = true;
ResetClass = "btn-warning";
MsgServ.IsReloading = true;
await InvokeAsync(StateHasChanged);
var currToken = await MsgServ.GetCurrOperDtoLSAsync();
var lastOpr = await MsgServ.GetLastMatrOprAsync();
@@ -101,11 +110,12 @@ namespace MP_TAB3.Components
await EA_ReloadMStor.InvokeAsync(true);
// calcolo tempo esecuzione
sw.Stop();
int delta = 250 - (int)sw.ElapsedMilliseconds;
delta = delta > 0 ? delta : 50;
int delta = 150 - (int)sw.ElapsedMilliseconds;
delta = delta > 0 ? delta : 10;
await Task.Delay(delta);
ResetClass = "btn-primary";
// await InvokeAsync(StateHasChanged);
MsgServ.IsReloading = false;
IsReloading = false;
Log.Info($"ForceReload completed in {sw.Elapsed.TotalMilliseconds}ms");
// ricarica pagina!
NavMan.NavigateTo("status-map", true);
+6 -1
View File
@@ -420,9 +420,14 @@ namespace MP_TAB3.Components
TabDServ.DataInvalidated -= TabDServ_DataInvalidated;
}
/// <summary>
/// Rilettura dettagli
/// </summary>
/// <returns></returns>
private async Task loadDetails()
{
if (CRecMSE != null)
// verifico di non essere in reloading e di avere dati...
if (!MServ.IsReloading && CRecMSE != null)
{
bool doForce = false;
if (SDService.MachNumPzGet(IdxMaccCur) != CRecMSE.PezziProd || SDService.MachProdStGet(IdxMaccCur).IdxOdl != CRecMSE.IdxOdl || (datiProdAct != null && datiProdAct.PzTotODL != CRecMSE.PezziProd))
+7 -7
View File
@@ -1,8 +1,8 @@
<div class="card text-white2 shadow bg-dark p-0 m-0">
<div class="card-body rounded rounded-3 py-2">
<div class="card shadow bg-dark p-0 m-0">
<div class="card-body rounded rounded-3 py-2 px-3">
<div class="row">
<div class="col-12 placeholder-glow text-center mb-1">
<span class="placeholder col-3 fs-2 bg-light"></span>
<span class="placeholder col-3 fs-1 bg-light"></span>
</div>
<div class="col-4 placeholder-glow my-1">
<span class="placeholder text-light col-12"></span>
@@ -14,7 +14,7 @@
<span class="placeholder text-primary placeholder-sm col-2"></span>
</div>
<div class="col-4 placeholder-glow text-center py-2 my-1">
<span class="placeholder col-6 bg-success rounded-circle h-100"></span>
<span class="placeholder col-6 bg-secondary rounded-circle h-100"></span>
</div>
<div class="col-4 placeholder-glow my-1">
<span class="placeholder col-12"></span>
@@ -26,9 +26,9 @@
<span class="placeholder text-light col-2"></span>
</div>
<div class="col-12 placeholder-glow text-center my-1">
<span class="placeholder placeholder-lg fs-2 col-2 bg-warning"></span>
<span class="placeholder placeholder-lg fs-2 col-7 bg-primary"></span>
<span class="placeholder placeholder-lg fs-2 col-2 bg-info"></span>
<span class="placeholder placeholder-lg fs-1 col-2 bg-warning"></span>
<span class="placeholder placeholder-lg fs-1 col-7 bg-primary"></span>
<span class="placeholder placeholder-lg fs-1 col-2 bg-info"></span>
</div>
</div>
</div>
@@ -9,7 +9,7 @@
}
@media (min-width: 600px) {
.pholderHeight {
height: 5.1rem;
height: 6.6rem;
}
}
@media (min-width: 768px) {
@@ -12,7 +12,7 @@
@media (min-width: 600px) {
.pholderHeight {
height: 5.1rem;
height: 6.6rem;
}
}
+1 -1
View File
@@ -1 +1 @@
.pholderHeight{height:5.5rem;object-fit:cover;}@media(min-width:430px){.pholderHeight{height:5.8rem;}}@media(min-width:600px){.pholderHeight{height:5.1rem;}}@media(min-width:768px){.pholderHeight{height:7.6rem;}}@media(min-width:800px){.pholderHeight{height:8.2rem;}}@media(min-width:1025px){.pholderHeight{height:7.2rem;}}
.pholderHeight{height:5.5rem;object-fit:cover;}@media(min-width:430px){.pholderHeight{height:5.8rem;}}@media(min-width:600px){.pholderHeight{height:6.6rem;}}@media(min-width:768px){.pholderHeight{height:7.6rem;}}@media(min-width:800px){.pholderHeight{height:8.2rem;}}@media(min-width:1025px){.pholderHeight{height:7.2rem;}}
+4 -4
View File
@@ -1,19 +1,19 @@
<div class="col-12 mt-1">
<div class="mt-1">
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
</div>
<div class="col-12 mt-3">
<div class="mt-2">
<div class="row">
@if (enableMagPrint)
{
<div class="col-6 pe-1">
<div class="col-6 pe-2">
<PrintMag RecMSE="RecMSE"></PrintMag>
</div>
}
@if (odlOk)
{
<div class="@ConfCssWidth ps-1">
<div class="@ConfCssWidth">
<button class="btn btn-lg @ConfBg py-2 px-2 text-nowrap text-truncate" style="width: 100%" @onclick="()=>ToggleConfProd()">
<span>@ConfTitle</span><i class="fa-solid @ConfTitleIcon ps-1"></i>
</button>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2503.2915</Version>
<Version>6.16.2503.2916</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+23 -13
View File
@@ -305,21 +305,31 @@ namespace MP_TAB3.Pages
/// <exception cref="NotImplementedException"></exception>
private void DataPipe_EA_NewMessage(object? sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly List<string> --> allarmi
if (!string.IsNullOrEmpty(currArgs.newMessage))
#if false
// se fossi in update resetto...
if (MsgServ.IsReloading)
{
try
{
List<MappaStatoExpl>? dataList = JsonConvert.DeserializeObject<List<MappaStatoExpl>>(currArgs.newMessage);
if (dataList != null)
{
InvokeAsync(() => SaveData(dataList));
}
}
catch
{ }
AllDataMSE = null;
}
else
{
}
#endif
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// conversione on-the-fly List<string> --> allarmi
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
try
{
List<MappaStatoExpl>? dataList = JsonConvert.DeserializeObject<List<MappaStatoExpl>>(currArgs.newMessage);
if (dataList != null)
{
InvokeAsync(() => SaveData(dataList));
}
}
catch
{ }
}
InvokeAsync(() =>
{
StateHasChanged();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2503.2915</h4>
<h4>Versione: 6.16.2503.2916</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2503.2915
6.16.2503.2916
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2503.2915</version>
<version>6.16.2503.2916</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>
+12 -3
View File
@@ -411,6 +411,11 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Semaforo x indicare fasi di reload attive e così non effettuare alcune operazioni...
/// </summary>
public bool IsReloading { get; set; } = false;
/// <summary>
/// Restituisce il record OperatoreDTO da localstorage
/// </summary>
@@ -541,10 +546,14 @@ namespace MP.Data.Services
/// <exception cref="NotImplementedException"></exception>
public async Task SaveMse(List<MappaStatoExpl> currListMSE)
{
foreach (var item in currListMSE)
// procedo SOLO SE non sono in reloading...
if (!IsReloading)
{
string serVal = JsonConvert.SerializeObject(item);
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
foreach (var item in currListMSE)
{
string serVal = JsonConvert.SerializeObject(item);
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
}
}
}