NON ok gestione reload dettaglio macchina

This commit is contained in:
Samuele Locatelli
2023-10-02 19:08:15 +02:00
parent 08657fd90d
commit a53585bd99
6 changed files with 375 additions and 275 deletions
+131 -116
View File
@@ -107,6 +107,21 @@ namespace MP.Data.Services
pUpd.Wait();
}
}
/// <summary>
/// Macchine attualmente selezionata
/// </summary>
public async Task<string> IdxMaccGet()
{
return await localStorage.GetItemAsync<string>("CurrMach");
}
/// <summary>
/// Macchine attualmente selezionata
/// </summary>
public async Task IdxMaccSet(string machSel)
{
await localStorage.SetItemAsync("CurrMach", machSel);
}
#if false
public bool IsActive
@@ -188,19 +203,19 @@ namespace MP.Data.Services
public RegAttivitaModel? recordRA { get; set; } = null;
#endif
public AnagOperatoriModel? RigaOper
public AnagOperatoriModel? RigaOper
{
get => _rigaOper;
set
{
get => _rigaOper;
set
// salvo
_rigaOper = value;
if (EA_OperUpdated != null)
{
// salvo
_rigaOper = value;
if (EA_OperUpdated != null)
{
EA_OperUpdated?.Invoke();
}
EA_OperUpdated?.Invoke();
}
}
}
#if false
public string SearchVal
@@ -239,42 +254,42 @@ namespace MP.Data.Services
public DateTime targetDateMancTimb { get; set; }
#endif
#endregion Public Properties
#endregion Public Properties
protected const string KeyMacDict = "MachineDict";
protected const string KeyDevSec = "DevSec";
protected const string KeyDevIp4 = "DevIpv4";
protected const string KeyMacDict = "MachineDict";
protected const string KeyDevSec = "DevSec";
protected const string KeyDevIp4 = "DevIpv4";
#region Public Methods
#region Public Methods
/// <summary>
/// Restituisce il valore di DeviceSecret da localstorage
/// </summary>
/// <returns></returns>
public async Task<string> getDevSecretAsync()
/// <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)
{
string answ = "";
var result = await localStorage.GetItemAsync<string>(KeyDevSec);
if (result != null)
{
answ = result;
}
return answ;
answ = result;
}
/// <summary>
/// Restituisce il valore Ipv4 del Device da localstorage
/// </summary>
/// <returns></returns>
public async Task<string> getDevIpAsync()
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)
{
string answ = "";
var result = await localStorage.GetItemAsync<string>(KeyDevIp4);
if (result != null)
{
answ = result;
}
return answ;
answ = result;
}
return answ;
}
#if false
public void ReportDateChange()
@@ -344,112 +359,112 @@ namespace MP.Data.Services
}
#endif
/// <summary>
/// Scrive il valore di DeviceSecret nel localstoragee
/// </summary>
/// <param name="newVal"></param>
/// <returns></returns>
public async Task<bool> setDevSecretAsync(string newVal)
/// <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
{
bool answ = false;
try
{
await localStorage.SetItemAsync(KeyDevSec, newVal);
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}");
}
return answ;
await localStorage.SetItemAsync(KeyDevSec, newVal);
answ = true;
}
/// <summary>
/// Scrive il valore di IPV4 del device nel localstoragee
/// </summary>
/// <param name="newVal"></param>
/// <returns></returns>
public async Task<bool> setDevIpv4Async(string newVal)
catch (Exception ex)
{
bool answ = false;
try
{
await localStorage.SetItemAsync(KeyDevIp4, newVal);
answ = true;
}
catch (Exception ex)
{
Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}");
}
return answ;
Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}");
}
private string machineMse(string idxMacc)
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
{
return $"MSE_{idxMacc}";
await localStorage.SetItemAsync(KeyDevIp4, newVal);
answ = true;
}
/// <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)
catch (Exception ex)
{
foreach (var item in currListMSE)
{
string serVal = JsonSerializer.Serialize(item);
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
}
Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}");
}
return answ;
}
/// <summary>
/// Recupero dati MSE x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<MappaStatoExpl> GetMachineMse(string idxMacchina)
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)
{
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;
string serVal = JsonSerializer.Serialize(item);
await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal);
}
}
#endregion Public Methods
/// <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;
}
#region Protected Properties
#endregion Public Methods
protected ILocalStorageService localStorage { get; set; } = null!;
#region Protected Properties
protected ISessionStorageService sessionStore { get; set; } = null!;
protected ILocalStorageService localStorage { get; set; } = null!;
#endregion Protected Properties
protected ISessionStorageService sessionStore { get; set; } = null!;
#region Private Fields
#endregion Protected Properties
#region Private Fields
#if false
private string _pageIcon = "";
private string _pageName = "";
#endif
private AnagOperatoriModel? _rigaOper;
private AnagOperatoriModel? _rigaOper;
private Logger Log = LogManager.GetCurrentClassLogger();
private Logger Log = LogManager.GetCurrentClassLogger();
#if false
private string _searchVal = "";
private bool showSearch;
#endif
#endregion Private Fields
#endregion Private Fields
#region Private Properties
#region Private Properties
#if false
@@ -457,9 +472,9 @@ namespace MP.Data.Services
private bool nextIsEntrata { get; set; } = true;
#endif
#endregion Private Properties
#endregion Private Properties
#region Private Methods
#region Private Methods
#if false
private void ReportPageUpd()
@@ -479,6 +494,6 @@ namespace MP.Data.Services
}
#endif
#endregion Private Methods
}
#endregion Private Methods
}
}