refresh catena flush dati
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
@inject NavigationManager NavMan
|
||||
@inject ListSelectDataSrv MDataService
|
||||
@inject SharedMemService MStor
|
||||
@inject MessageService MServ
|
||||
|
||||
<PageTitle>MP-TAB-SERV</PageTitle>
|
||||
|
||||
@@ -91,11 +92,6 @@
|
||||
{
|
||||
CurrMenuItems = MStor.DictMenu[CurrLevel];
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// CurrMenuItems = await MDataService.ListLinkFilt(CurrLevel);
|
||||
// MStor.DictMenu.Add(CurrLevel, CurrMenuItems);
|
||||
// }
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
@@ -106,11 +102,17 @@
|
||||
Log.Info("Start ForceReload");
|
||||
ResetClass = "btn-warning";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
await MDataService.FlushCache();
|
||||
await MServ.ClearLocalStor();
|
||||
await MServ.ClearSessionStor();
|
||||
MStor.ResetCache();
|
||||
await Task.Delay(200);
|
||||
await MDataService.FlushCache();
|
||||
var allData = await MDataService.ListLinkAll();
|
||||
MStor.SetupMenu(allData);
|
||||
await Task.Delay(300);
|
||||
ResetClass = "btn-primary";
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("/", true);
|
||||
Log.Info("END ForceReload");
|
||||
}
|
||||
|
||||
|
||||
+188
-186
@@ -1,13 +1,9 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Blazored.SessionStorage;
|
||||
using MongoDB.Bson.IO;
|
||||
using MongoDB.Driver.Core.Servers;
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -29,29 +25,25 @@ namespace MP.Data.Services
|
||||
sessionStore = sessStore;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Events
|
||||
|
||||
|
||||
public event Action EA_OperUpdated = null!;
|
||||
|
||||
public event Action EA_PageUpdated = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#if false
|
||||
public event Action EA_DateChanged = null!;
|
||||
public event Action EA_CalModeChanged = null!;
|
||||
|
||||
public event Action EA_TimbUpd = null!;
|
||||
public event Action EA_TimbUpd = null!;
|
||||
#endif
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
#if false
|
||||
public RegAttivitaModel? clonedRA { get; set; } = null;
|
||||
public RegAttivitaModel? clonedRA { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Calcola HASH del codice impiego = payload utente
|
||||
@@ -68,20 +60,7 @@ namespace MP.Data.Services
|
||||
}
|
||||
#endif
|
||||
|
||||
public int MatrOpr
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 102;
|
||||
//int answ = -1;
|
||||
if (_rigaOper != null)
|
||||
{
|
||||
answ = _rigaOper.MatrOpr;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario macchine
|
||||
@@ -107,6 +86,96 @@ namespace MP.Data.Services
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
public int MatrOpr
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 102;
|
||||
//int answ = -1;
|
||||
if (_rigaOper != null)
|
||||
{
|
||||
answ = _rigaOper.MatrOpr;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public AnagOperatoriModel? RigaOper
|
||||
{
|
||||
get => _rigaOper;
|
||||
set
|
||||
{
|
||||
// salvo
|
||||
_rigaOper = value;
|
||||
if (EA_OperUpdated != null)
|
||||
{
|
||||
EA_OperUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task ClearLocalStor()
|
||||
{
|
||||
await localStorage.ClearAsync();
|
||||
}
|
||||
|
||||
public async Task ClearSessionStor()
|
||||
{
|
||||
await sessionStore.ClearAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore Ipv4 del Device da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> getDevIpAsync()
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStorage.GetItemAsync<string>(KeyDevIp4);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore di DeviceSecret da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> getDevSecretAsync()
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStorage.GetItemAsync<string>(KeyDevSec);
|
||||
if (result != null)
|
||||
{
|
||||
answ = result;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati MSE x macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<MappaStatoExpl> GetMachineMse(string idxMacchina)
|
||||
{
|
||||
MappaStatoExpl answ = new MappaStatoExpl();
|
||||
//answ = await localStorage.GetItemAsync<MappaStatoExpl>(machineMse(idxMacchina));
|
||||
string tryString = await localStorage.GetItemAsync<string>(machineMse(idxMacchina));
|
||||
if (tryString != "")
|
||||
{
|
||||
answ = JsonSerializer.Deserialize<MappaStatoExpl>(tryString);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Macchine attualmente selezionata
|
||||
/// </summary>
|
||||
@@ -139,7 +208,7 @@ namespace MP.Data.Services
|
||||
|
||||
public bool isRicTimb { get; set; } = false;
|
||||
|
||||
public CalendarModeEnum.modoControllo modoCal { get; set; } = CalendarModeEnum.modoControllo.showCalendar;
|
||||
public CalendarModeEnum.modoControllo modoCal { get; set; } = CalendarModeEnum.modoControllo.showCalendar;
|
||||
#endif
|
||||
|
||||
#if false
|
||||
@@ -184,7 +253,7 @@ namespace MP.Data.Services
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PageName
|
||||
{
|
||||
@@ -200,23 +269,8 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
public bool PayloadOk { get; set; } = false;
|
||||
public RegAttivitaModel? recordRA { get; set; } = null;
|
||||
public RegAttivitaModel? recordRA { get; set; } = null;
|
||||
#endif
|
||||
|
||||
public AnagOperatoriModel? RigaOper
|
||||
{
|
||||
get => _rigaOper;
|
||||
set
|
||||
{
|
||||
// salvo
|
||||
_rigaOper = value;
|
||||
if (EA_OperUpdated != null)
|
||||
{
|
||||
EA_OperUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
public string SearchVal
|
||||
{
|
||||
@@ -251,45 +305,74 @@ namespace MP.Data.Services
|
||||
}
|
||||
|
||||
public DateTime targetDate { get; set; } = DateTime.Today;
|
||||
public DateTime targetDateMancTimb { get; set; }
|
||||
public DateTime targetDateMancTimb { get; set; }
|
||||
#endif
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
protected const string KeyMacDict = "MachineDict";
|
||||
protected const string KeyDevSec = "DevSec";
|
||||
protected const string KeyDevIp4 = "DevIpv4";
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce il valore di DeviceSecret da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> getDevSecretAsync()
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStorage.GetItemAsync<string>(KeyDevSec);
|
||||
if (result != null)
|
||||
/// <summary>
|
||||
/// Effettua salvataggio in localstorage dei dati MSE correnti
|
||||
/// </summary>
|
||||
/// <param name="currListMSE"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task SaveMse(List<MappaStatoExpl> currListMSE)
|
||||
{
|
||||
answ = result;
|
||||
foreach (var item in currListMSE)
|
||||
{
|
||||
string serVal = JsonSerializer.Serialize(item);
|
||||
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce il valore Ipv4 del Device da localstorage
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> getDevIpAsync()
|
||||
{
|
||||
string answ = "";
|
||||
var result = await localStorage.GetItemAsync<string>(KeyDevIp4);
|
||||
if (result != null)
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore di IPV4 del device nel localstoragee
|
||||
/// </summary>
|
||||
/// <param name="newVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> setDevIpv4Async(string newVal)
|
||||
{
|
||||
answ = result;
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStorage.SetItemAsync(KeyDevIp4, newVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore di DeviceSecret nel localstoragee
|
||||
/// </summary>
|
||||
/// <param name="newVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> setDevSecretAsync(string newVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStorage.SetItemAsync(KeyDevSec, newVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected const string KeyDevIp4 = "DevIpv4";
|
||||
protected const string KeyDevSec = "DevSec";
|
||||
protected const string KeyMacDict = "MachineDict";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#if false
|
||||
|
||||
public void ReportDateChange()
|
||||
@@ -300,7 +383,6 @@ namespace MP.Data.Services
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setModeCalendar()
|
||||
{
|
||||
modoCal = CalendarModeEnum.modoControllo.showCalendar;
|
||||
@@ -356,126 +438,48 @@ namespace MP.Data.Services
|
||||
{
|
||||
EA_TimbUpd?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Scrive il valore di DeviceSecret nel localstoragee
|
||||
/// </summary>
|
||||
/// <param name="newVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> setDevSecretAsync(string newVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
#region Protected Properties
|
||||
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
|
||||
protected ISessionStorageService sessionStore { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private AnagOperatoriModel? _rigaOper;
|
||||
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private string machineMse(string idxMacc)
|
||||
{
|
||||
await localStorage.SetItemAsync(KeyDevSec, newVal);
|
||||
answ = true;
|
||||
return $"MSE_{idxMacc}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Scrive il valore di IPV4 del device nel localstoragee
|
||||
/// </summary>
|
||||
/// <param name="newVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> setDevIpv4Async(string newVal)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
await localStorage.SetItemAsync(KeyDevIp4, newVal);
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private string machineMse(string idxMacc)
|
||||
{
|
||||
return $"MSE_{idxMacc}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua salvataggio in localstorage dei dati MSE correnti
|
||||
/// </summary>
|
||||
/// <param name="currListMSE"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task SaveMse(List<MappaStatoExpl> currListMSE)
|
||||
{
|
||||
foreach (var item in currListMSE)
|
||||
{
|
||||
string serVal = JsonSerializer.Serialize(item);
|
||||
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati MSE x macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<MappaStatoExpl> GetMachineMse(string idxMacchina)
|
||||
{
|
||||
MappaStatoExpl answ = new MappaStatoExpl();
|
||||
//answ = await localStorage.GetItemAsync<MappaStatoExpl>(machineMse(idxMacchina));
|
||||
string tryString = await localStorage.GetItemAsync<string>(machineMse(idxMacchina));
|
||||
if (tryString != "")
|
||||
{
|
||||
answ = JsonSerializer.Deserialize<MappaStatoExpl>(tryString);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
|
||||
protected ISessionStorageService sessionStore { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
#endregion Private Methods
|
||||
|
||||
#if false
|
||||
private string _pageIcon = "";
|
||||
private string _pageName = "";
|
||||
private string _pageName = "";
|
||||
#endif
|
||||
|
||||
private AnagOperatoriModel? _rigaOper;
|
||||
|
||||
|
||||
private Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#if false
|
||||
private string _searchVal = "";
|
||||
private bool showSearch;
|
||||
private bool showSearch;
|
||||
#endif
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
|
||||
#if false
|
||||
private string lastAction { get; set; } = "";
|
||||
private bool nextIsEntrata { get; set; } = true;
|
||||
private bool nextIsEntrata { get; set; } = true;
|
||||
#endif
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#if false
|
||||
private void ReportPageUpd()
|
||||
{
|
||||
@@ -491,9 +495,7 @@ namespace MP.Data.Services
|
||||
{
|
||||
EA_DipUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user