Rrefresh reset componenti
This commit is contained in:
@@ -124,6 +124,11 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
int tOutPeriod = 1000;
|
||||
aTimer = new System.Timers.Timer(tOutPeriod);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
|
||||
@@ -92,6 +92,11 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
aTimer = new System.Timers.Timer(fastRefreshMs);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
@@ -121,7 +121,11 @@ namespace MP_TAB3.Components
|
||||
|
||||
protected void StartTimer()
|
||||
{
|
||||
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
|
||||
if (aTimer != null)
|
||||
{
|
||||
aTimer.Stop();
|
||||
aTimer.Dispose();
|
||||
}
|
||||
aTimer = new System.Timers.Timer(dtTimerTabParam);
|
||||
aTimer.Elapsed += ElapsedTimer;
|
||||
aTimer.Enabled = true;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2401.2616</Version>
|
||||
<Version>6.16.2401.2618</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -9,8 +9,18 @@ using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace MP_TAB3.Pages
|
||||
{
|
||||
public partial class StatusMap: IDisposable
|
||||
public partial class StatusMap : IDisposable
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ListMSE = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class WindowDimension
|
||||
@@ -23,12 +33,6 @@ namespace MP_TAB3.Pages
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ListMSE = null;
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
|
||||
#region Protected Fields
|
||||
@@ -81,12 +85,6 @@ namespace MP_TAB3.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task getWDim()
|
||||
{
|
||||
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
|
||||
Height = dimension.Height;
|
||||
Width = dimension.Width;
|
||||
}
|
||||
/// <summary>
|
||||
/// calcola num blocchi max data dimensione larghezza
|
||||
/// </summary>
|
||||
@@ -108,6 +106,13 @@ namespace MP_TAB3.Pages
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task getWDim()
|
||||
{
|
||||
var dimension = await JSRuntime.InvokeAsync<WindowDimension>("getWindowDimensions");
|
||||
Height = dimension.Height;
|
||||
Width = dimension.Width;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@@ -153,8 +158,6 @@ namespace MP_TAB3.Pages
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000);
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2401.2616</h4>
|
||||
<h4>Versione: 6.16.2401.2618</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2401.2616
|
||||
6.16.2401.2618
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2401.2616</version>
|
||||
<version>6.16.2401.2618</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>
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace MP.Data.Services
|
||||
public ListSelectDataSrv(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
|
||||
// setup compoenti REDIS
|
||||
redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
||||
redisDb = redisConn.GetDatabase();
|
||||
@@ -101,8 +100,10 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pulizia cache Redis (tutta)
|
||||
/// </summary>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Blazored.SessionStorage;
|
||||
using EgwCoreLib.Utils;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.Controllers;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.DTO;
|
||||
using Newtonsoft.Json;
|
||||
@@ -14,12 +15,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Services
|
||||
{
|
||||
public class MessageService
|
||||
public class MessageService : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public const string KeyCommDtRif = "DtRifComm";
|
||||
|
||||
public const string KeyCommText = "ValComm";
|
||||
|
||||
public int orarioDip = 0;
|
||||
|
||||
#endregion Public Fields
|
||||
@@ -95,6 +98,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
public DateTime dtLastAction { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime dtLastSave { get; set; } = DateTime.Now;
|
||||
|
||||
public string LastIdxMacchina
|
||||
@@ -238,6 +242,13 @@ namespace MP.Data.Services
|
||||
return SteamCrypto.DecryptString(encData, Constants.passPhrase);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
public async Task<bool> DoLogIn(string decodValue, bool saveOpr)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,9 @@ namespace MP.Data.Services
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -112,35 +115,6 @@ namespace MP.Data.Services
|
||||
return Task.FromResult(dbController.MacchineGetAll());
|
||||
}
|
||||
|
||||
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<MappaStatoExpl>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce numPezzi (ultimo) x macchina
|
||||
/// </summary>
|
||||
@@ -155,6 +129,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva numPezzi x macchina
|
||||
/// </summary>
|
||||
@@ -190,6 +165,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salva numPezzi x macchina
|
||||
/// </summary>
|
||||
@@ -211,8 +187,34 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
private Dictionary<string, int> MachineNumPz { get; set; } = new Dictionary<string, int>();
|
||||
private Dictionary<string, StatoProdModel> MachineProdStatus { get; set; } = new Dictionary<string, StatoProdModel>();
|
||||
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
string source = "DB";
|
||||
sw.Start();
|
||||
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.MseGetAll(maxAge));
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<MappaStatoExpl>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
@@ -236,12 +238,20 @@ namespace MP.Data.Services
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private int maxAge = 2000;
|
||||
#if false
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#endif
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private Dictionary<string, int> MachineNumPz { get; set; } = new Dictionary<string, int>();
|
||||
private Dictionary<string, StatoProdModel> MachineProdStatus { get; set; } = new Dictionary<string, StatoProdModel>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#if false
|
||||
private string redisMseKey = "MP:MON:Cache:MSE";
|
||||
#endif
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -610,6 +610,9 @@ namespace MP.Data.Services
|
||||
dbTabController.Dispose();
|
||||
dbIocController.Dispose();
|
||||
dbInveController.Dispose();
|
||||
// redis dispose
|
||||
redisConn = null;
|
||||
redisDb = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user