Update gestione letture sync/async MSE
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2503.2909</Version>
|
||||
<Version>6.16.2503.2915</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -12,16 +12,15 @@
|
||||
@if (ShowScanBarcode)
|
||||
{
|
||||
|
||||
<BarcodeReader
|
||||
@ref="barcodeReaderCustom"
|
||||
<BarcodeReader @ref="barcodeReaderCustom"
|
||||
ScanResult="(e) => ScanDoneHandler(e)"
|
||||
Close="ToggleCodeScan"
|
||||
ScanBtnTitle="Scan"
|
||||
ResetBtnTitle="Reset"
|
||||
CloseBtnTitle="Close"
|
||||
UseBuiltinDiv="false"
|
||||
UseBuiltinDiv="false"
|
||||
SelectDeviceBtnTitle="Select Device">
|
||||
</BarcodeReader>
|
||||
</BarcodeReader>
|
||||
|
||||
<div @ref="barcodeReaderCustom.Element" class="d-flex justify-content-center">
|
||||
<div class="col-12 col-md-8 col-lg-6">
|
||||
@@ -39,7 +38,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
}
|
||||
|
||||
@if (oprList.Count > 0)
|
||||
|
||||
@@ -15,10 +15,13 @@ namespace MP_TAB3.Pages
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
barcodeReaderCustom.Stop();
|
||||
barcodeReaderCustom.CloseScan();
|
||||
ShowScanBarcode = false;
|
||||
txtError = "";
|
||||
matrOpr = 0;
|
||||
oprList = new List<AnagOperatoriModel>();
|
||||
//GC.Collect();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
@@ -135,8 +138,11 @@ namespace MP_TAB3.Pages
|
||||
await TDService.RegDichiarInsert(ulRec);
|
||||
}
|
||||
|
||||
// nascondo scanner...
|
||||
ShowScanBarcode = false;
|
||||
|
||||
// passo a status map
|
||||
await Task.Delay(150);
|
||||
await Task.Delay(50);
|
||||
NavMan.NavigateTo("status-map", true);
|
||||
}
|
||||
else
|
||||
|
||||
+138
-122
@@ -10,32 +10,6 @@ namespace MP_TAB3.Pages
|
||||
{
|
||||
public partial class StatusMap : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ListMSE = null;
|
||||
TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage;
|
||||
TDFeeder.blinkPipe.EA_NewMessage -= BlinkPipe_EA_NewMessage;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class WindowDimension
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public int Height { get; set; }
|
||||
public int Width { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool _showCard = false;
|
||||
@@ -44,6 +18,14 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -56,6 +38,43 @@ namespace MP_TAB3.Pages
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Numero colonne mappa: calcolato larghezza riga...
|
||||
/// </summary>
|
||||
protected int mapNCol
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 2;
|
||||
if (Width > 450)
|
||||
{
|
||||
if (Width < 1024)
|
||||
{
|
||||
answ = (int)Math.Floor((decimal)Width / 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = (int)Math.Floor((decimal)Width / 220) - 1;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero righe mappa: calcolato da num elementi e numMax x riga...
|
||||
/// </summary>
|
||||
protected int mapNRow
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 1;
|
||||
int numElems = ListMSE != null ? ListMSE.Count : 1;
|
||||
answ = (int)Math.Ceiling((double)numElems / mapNCol);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
[Inject]
|
||||
protected StatusData MDataService { get; set; } = null!;
|
||||
|
||||
@@ -85,6 +104,37 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<MappaStatoExpl>? AllDataMSE { get; set; } = null;
|
||||
|
||||
private string baseLang { get; set; } = "";
|
||||
|
||||
private List<Macchine>? ListMachineEnabled { get; set; } = null;
|
||||
|
||||
private List<MappaStatoExpl>? ListMSE { get; set; } = null;
|
||||
|
||||
private int MatrOpr
|
||||
{
|
||||
get => MsgServ.MatrOpr;
|
||||
}
|
||||
|
||||
private string tcMode { get; set; } = "";
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ListMSE = null;
|
||||
TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage;
|
||||
TDFeeder.blinkPipe.EA_NewMessage -= BlinkPipe_EA_NewMessage;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -108,58 +158,6 @@ namespace MP_TAB3.Pages
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero righe mappa: calcolato da num elementi e numMax x riga...
|
||||
/// </summary>
|
||||
protected int mapNRow
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 1;
|
||||
int numElems = ListMSE != null ? ListMSE.Count : 1;
|
||||
answ = (int)Math.Ceiling((double)numElems / mapNCol);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce MSE dato indice
|
||||
/// </summary>
|
||||
/// <param name="mseIdx">Indice MSE richiesto</param>
|
||||
/// <returns></returns>
|
||||
protected MappaStatoExpl? MseById(int mseIdx)
|
||||
{
|
||||
MappaStatoExpl? answ = null;
|
||||
if (ListMSE != null && ListMSE.Count > mseIdx)
|
||||
{
|
||||
answ = ListMSE[mseIdx];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Numero colonne mappa: calcolato larghezza riga...
|
||||
/// </summary>
|
||||
protected int mapNCol
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 2;
|
||||
if (Width > 450)
|
||||
{
|
||||
if (Width < 1024)
|
||||
{
|
||||
answ = (int)Math.Floor((decimal)Width / 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = (int)Math.Floor((decimal)Width / 220) - 1;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task DoLogout()
|
||||
{
|
||||
string tgtUrl = "logout";
|
||||
@@ -197,6 +195,21 @@ namespace MP_TAB3.Pages
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// restituisce MSE dato indice
|
||||
/// </summary>
|
||||
/// <param name="mseIdx">Indice MSE richiesto</param>
|
||||
/// <returns></returns>
|
||||
protected MappaStatoExpl? MseById(int mseIdx)
|
||||
{
|
||||
MappaStatoExpl? answ = null;
|
||||
if (ListMSE != null && ListMSE.Count > mseIdx)
|
||||
{
|
||||
answ = ListMSE[mseIdx];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@@ -208,10 +221,10 @@ namespace MP_TAB3.Pages
|
||||
{
|
||||
ListMachineEnabled = await TabDServ.MacchineByMatrOper(MatrOpr);
|
||||
}
|
||||
AllDataMSE = await MDataService.MseGetAll(true);
|
||||
FiltOprMse();
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
// rileggo macchina e pagina
|
||||
await RestoreMaccPage();
|
||||
if (ListMSE != null)
|
||||
{
|
||||
// salvo in LocalStorage...
|
||||
@@ -224,27 +237,19 @@ namespace MP_TAB3.Pages
|
||||
// ora resetto il resto
|
||||
ListMSE = null;
|
||||
setDefaults();
|
||||
await LoadMseData();
|
||||
SetupConf();
|
||||
TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage;
|
||||
TDFeeder.blinkPipe.EA_NewMessage += BlinkPipe_EA_NewMessage;
|
||||
Random rnd = new Random();
|
||||
await Task.Delay(rnd.Next(1, 5));
|
||||
SetupConf();
|
||||
var LastOpenedPage = await MsgServ.LastOpenedPageGet();
|
||||
var currMacc = await MsgServ.IdxMaccGet();
|
||||
if (currMacc != "" && currMacc != null)
|
||||
{
|
||||
await MsgServ.IdxMaccSet(currMacc);
|
||||
if (LastOpenedPage != "" && LastOpenedPage != null)
|
||||
{
|
||||
NavMan.NavigateTo(LastOpenedPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// x prima cosa elenco macchine operatore...
|
||||
ListMachineEnabled = await TabDServ.MacchineByMatrOper(MatrOpr);
|
||||
// x prima cosa elenco macchine operatore... se mancasse
|
||||
if (ListMachineEnabled == null || ListMachineEnabled.Count == 0)
|
||||
{
|
||||
ListMachineEnabled = await TabDServ.MacchineByMatrOper(MatrOpr);
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SaveData(List<MappaStatoExpl> newList)
|
||||
@@ -262,33 +267,6 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool doBlink = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private List<MappaStatoExpl>? AllDataMSE { get; set; } = null;
|
||||
|
||||
private string baseLang { get; set; } = "";
|
||||
|
||||
private List<Macchine>? ListMachineEnabled { get; set; } = null;
|
||||
|
||||
private List<MappaStatoExpl>? ListMSE { get; set; } = null;
|
||||
|
||||
private int MatrOpr
|
||||
{
|
||||
get => MsgServ.MatrOpr;
|
||||
}
|
||||
|
||||
private string tcMode { get; set; } = "";
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
@@ -367,6 +345,30 @@ namespace MP_TAB3.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadMseData()
|
||||
{
|
||||
AllDataMSE = await MDataService.MseGetAll(true);
|
||||
FiltOprMse();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restore della macchina + pagina selezionate da info di sessione browser
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task RestoreMaccPage()
|
||||
{
|
||||
var LastOpenedPage = await MsgServ.LastOpenedPageGet();
|
||||
var currMacc = await MsgServ.IdxMaccGet();
|
||||
if (currMacc != "" && currMacc != null)
|
||||
{
|
||||
await MsgServ.IdxMaccSet(currMacc);
|
||||
if (LastOpenedPage != "" && LastOpenedPage != null)
|
||||
{
|
||||
NavMan.NavigateTo(LastOpenedPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaults()
|
||||
{
|
||||
string df = MsgServ.UserPrefSetup("DefCardMode", "full");
|
||||
@@ -384,5 +386,19 @@ namespace MP_TAB3.Pages
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class WindowDimension
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public int Height { get; set; }
|
||||
public int Width { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2503.2909</h4>
|
||||
<h4>Versione: 6.16.2503.2915</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2503.2909
|
||||
6.16.2503.2915
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2503.2909</version>
|
||||
<version>6.16.2503.2915</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>
|
||||
|
||||
@@ -9,6 +9,16 @@ namespace MP.Data.Services
|
||||
{
|
||||
public class TabDataFeeder : StatusData, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private int fastRefreshMs = 1000;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public TabDataFeeder(IConfiguration configuration) : base(configuration)
|
||||
@@ -70,16 +80,6 @@ namespace MP.Data.Services
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000);
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private int fastRefreshMs = 1000;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e)
|
||||
@@ -87,28 +87,28 @@ namespace MP.Data.Services
|
||||
try
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
// secondi pari --> blink, secondi dispari --> ricarica
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
// invio in channel blink il segnale
|
||||
blinkPipe.sendMessage("true");
|
||||
Log.Debug("Elapsed Fast Timer Blink");
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in channel blink segnale false
|
||||
blinkPipe.sendMessage("false");
|
||||
// rileggo dati...
|
||||
var newData = await MseGetAll();
|
||||
// invio tramite la pipe...
|
||||
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
|
||||
Log.Debug("Elapsed Fast Timer reload");
|
||||
}
|
||||
});
|
||||
{
|
||||
// secondi pari --> blink, secondi dispari --> ricarica
|
||||
DateTime adesso = DateTime.Now;
|
||||
int resto = 0;
|
||||
Math.DivRem(adesso.Second, 2, out resto);
|
||||
if (resto == 0)
|
||||
{
|
||||
// invio in channel blink il segnale
|
||||
blinkPipe.sendMessage("true");
|
||||
Log.Trace("Elapsed Fast Timer Blink");
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in channel blink segnale false
|
||||
blinkPipe.sendMessage("false");
|
||||
// rileggo dati...
|
||||
var newData = await MseGetAll();
|
||||
// invio tramite la pipe...
|
||||
dataPipe.sendMessage(JsonConvert.SerializeObject(newData));
|
||||
Log.Trace("Elapsed Fast Timer reload");
|
||||
}
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
Reference in New Issue
Block a user