backToSM()">
-
+
+
backToSM()">
+
MapoTAB2
-
-

+
diff --git a/MP-TAB-SERV/Components/CmpTop.razor.cs b/MP-TAB-SERV/Components/CmpTop.razor.cs
index 8f465e08..3f0abd3b 100644
--- a/MP-TAB-SERV/Components/CmpTop.razor.cs
+++ b/MP-TAB-SERV/Components/CmpTop.razor.cs
@@ -15,6 +15,8 @@ namespace MP_TAB_SERV.Components
[Parameter]
public List CurrMenuItems { get; set; } = new List();
+ [Parameter]
+ public EventCallback EA_UserIsOk { get; set; }
#endregion Public Properties
@@ -27,12 +29,13 @@ namespace MP_TAB_SERV.Components
#region Protected Properties
protected string CurrOprTknLS { get; set; } = null!;
+ //protected Guid CurrDevGuid { get; set; }
protected string LastOpenedPage { get; set; } = null!;
protected string CurrMacc { get; set; } = null!;
protected string CurrOprTknRedis { get; set; } = null!;
- protected DateTime expDT { get; set; } = DateTime.Now;
+ protected int expLoginType { get; set; } = 0;
protected bool HideMenu
{
@@ -63,7 +66,15 @@ namespace MP_TAB_SERV.Components
protected async Task RefreshLogIn(string decodValue)
{
- bool done = await MsgServ.DoLogIn(decodValue);
+ bool done = false;
+ if (expLoginType == 0)
+ {
+ done = await MsgServ.DoLogIn(decodValue, false);
+ }
+ else
+ {
+ done = await MsgServ.DoLogIn(decodValue, true);
+ }
if (done)
{
if (!string.IsNullOrEmpty(LastOpenedPage) && !string.IsNullOrEmpty(CurrMacc))
@@ -84,7 +95,7 @@ namespace MP_TAB_SERV.Components
Log.Info("Start ForceReload");
ResetClass = "btn-warning";
await InvokeAsync(StateHasChanged);
- var currToken = await MsgServ.GetCurrOperDtoAsync();
+ var currToken = await MsgServ.GetCurrOperDtoLSAsync();
var lastOpr = await MsgServ.GetLastMatrOprAsync();
// reset cache varie
await MsgServ.ClearLocalStor();
@@ -92,7 +103,7 @@ namespace MP_TAB_SERV.Components
await MDataService.FlushCache();
// salvo di nuovo opr
await MsgServ.SetLastMatrOprAsync(lastOpr);
- await MsgServ.SetCurrOperDtoAsync(currToken);
+ await MsgServ.SetCurrOperDtoLSAsync(currToken);
// reload MStor
await ReloadMemStor();
// calcolo tempo esecuzione
@@ -121,46 +132,49 @@ namespace MP_TAB_SERV.Components
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
- int expDays = SMServ.GetConfInt("cookieDayExpire");
- expDT = DateTime.Now.AddDays(expDays);
+ expLoginType = SMServ.GetConfInt("TAB_TypeScadLogin");
+ var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
- CurrOprTknLS = await MsgServ.GetCurrOperDtoAsync();
- LastOpenedPage = await MsgServ.LastOpenedPageGet();
- CurrMacc = await MsgServ.IdxMaccGet();
- var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
-
- // verifico se non avessi dati operatore
- //var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
-
- //if (diffOfTime.Minutes >= 1)
- //{
- // NavMan.NavigateTo("logout");
- //}
- //else
- if (MsgServ.RigaOper == null)
+ //if (string.IsNullOrEmpty(CurrDevGuid.ToString()))
+ if (CurrDevGuid == Guid.Empty)
{
- await RefreshLogIn(decodedUrl);
+ CurrDevGuid = Guid.NewGuid();
+ await MsgServ.SetCurrDevGuidLSAsync(CurrDevGuid);
}
- CurrOprTknRedis = await TDService.OperatoreGetRedis(MatrOpr);
+ LastOpenedPage = await MsgServ.LastOpenedPageGet();
+ CurrMacc = await MsgServ.IdxMaccGet();
+
+ CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync();
+ var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
+ if (!string.IsNullOrEmpty(CurrOprTknLS))
+ {
+ var decryptedData = MsgServ.DecryptData(CurrOprTknLS);
+ if (!string.IsNullOrEmpty(decryptedData))
+ {
+ var oprObj = JsonConvert.DeserializeObject(decryptedData);
+ if (oprObj != null)
+ {
+ MsgServ.RigaOper = oprObj.currOpr;
+ }
+ }
+ }
- if (CurrOprTknRedis == "")
+ CurrOprTknRedis = await TDService.OperatoreGetRedis(MatrOpr, CurrDevGuid);
+
+
+ if (string.IsNullOrEmpty(CurrOprTknRedis))
{
if (!NavMan.Uri.Contains("reg-new-device"))
{
NavMan.NavigateTo("reg-new-device", true);
}
}
- else if (CurrOprTknRedis != "")
+ else if (!string.IsNullOrEmpty(CurrOprTknRedis) && CurrOprTknRedis == CurrOprTknLS)
{
- //if (!NavMan.Uri.Contains("status-map"))
- //{
- //}
- //if (LastOpenedPage != "")
- //{
- // NavMan.NavigateTo(LastOpenedPage, true);
- //}
+ await RefreshLogIn(decodedUrl);
+ await EA_UserIsOk.InvokeAsync(true);
}
}
diff --git a/MP-TAB-SERV/Components/ControlsMan.razor.cs b/MP-TAB-SERV/Components/ControlsMan.razor.cs
index 83d548d4..d2f37dfd 100644
--- a/MP-TAB-SERV/Components/ControlsMan.razor.cs
+++ b/MP-TAB-SERV/Components/ControlsMan.razor.cs
@@ -10,6 +10,9 @@ namespace MP_TAB_SERV.Components
{
#region Public Properties
+ [Parameter]
+ public EventCallback E_Updated { get; set; }
+
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
@@ -45,28 +48,28 @@ namespace MP_TAB_SERV.Components
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
}
+ protected bool enableControlli { get; set; } = true;
protected List ListComplete { get; set; } = new List();
protected List ListPaged { get; set; } = new List();
[Inject]
protected MessageService MServ { get; set; } = null!;
- [Inject]
- protected TabDataService TabDServ { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
+ [Inject]
+ protected TabDataService TabDServ { get; set; } = null!;
+
#endregion Protected Properties
#region Protected Methods
- protected bool enableControlli { get; set; } = true;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
if (RecMSE != null)
{
-
enableControlli = SMServ.GetConfBool("enableControlli");
IdxMaccSel = RecMSE.IdxMacchina;
DateTime fine = DateTime.Today.AddDays(1);
@@ -83,6 +86,7 @@ namespace MP_TAB_SERV.Components
showInsert = false;
showNote = false;
await doUpdate();
+ await E_Updated.InvokeAsync(false);
isProcessing = false;
}
@@ -99,6 +103,7 @@ namespace MP_TAB_SERV.Components
showInsert = false;
showNote = false;
await doUpdate();
+ await E_Updated.InvokeAsync(true);
isProcessing = false;
}
diff --git a/MP-TAB-SERV/Components/MachSel.razor.cs b/MP-TAB-SERV/Components/MachSel.razor.cs
index b328ed09..2c154c7a 100644
--- a/MP-TAB-SERV/Components/MachSel.razor.cs
+++ b/MP-TAB-SERV/Components/MachSel.razor.cs
@@ -1,6 +1,7 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
+using MP_TAB_SERV.Shared;
using System;
using System.Reflection.Metadata;
@@ -28,43 +29,68 @@ namespace MP_TAB_SERV.Components
if (idxMaccSel != value)
{
idxMaccSel = value;
+ MsgServ.UserPrefSet(idxMaccCurr, value);
E_MachSel.InvokeAsync(value).ConfigureAwait(false);
}
}
}
private string idxMaccSel { get; set; } = "";
+ [Inject]
+ protected MessageService MsgServ { get; set; } = null!;
+
protected Dictionary? ListMacchine { get; set; } = null;
[Inject]
- protected SharedMemService MServ { get; set; } = null!;
+ protected SharedMemService SMServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
+ protected string idxMaccCurr
+ {
+ get
+ {
+ string answ = "";
+ if (RecMSE != null)
+ {
+ answ = RecMSE?.IdxMacchina ?? "";
+ }
+ return answ;
+ }
+ }
+
protected override async Task OnParametersSetAsync()
{
// inizilamente riporto machcina corrente da MSE
if (RecMSE != null)
{
// verifico se la macchina sia configurata tra le MSFD...
- if (MServ.DictMacchMulti.ContainsKey(RecMSE?.IdxMacchina))
+ if (SMServ.DictMacchMulti.ContainsKey(RecMSE.IdxMacchina))
{
- isMulti = MServ.DictMacchMulti[RecMSE?.IdxMacchina] == 1;
+ isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
}
if (isMulti)
{
var listMulti = await TDataService.VMSFDGetAll();
ListMacchine = listMulti
- .Where(x => x.IdxMacchina.Contains($"{RecMSE?.IdxMacchina}#"))
+ .Where(x => x.IdxMacchina.Contains($"{RecMSE.IdxMacchina}#"))
.ToDictionary(x => x.IdxMacchina, x => x.CodMaccArticolo);
if (ListMacchine.Count > 0 && string.IsNullOrEmpty(idxMaccSel))
{
- IdxMaccSel = ListMacchine.FirstOrDefault().Key;
- //await E_MachSel.InvokeAsync(idxMaccSel);
+ // cerco se ho in storage la macchina selezionata...
+ var idxMSel = MsgServ.UserPrefGet(idxMaccCurr);
+ if (!string.IsNullOrEmpty(idxMSel))
+ {
+ idxMaccSel = idxMSel;
+ }
+ else
+ {
+ IdxMaccSel = ListMacchine.FirstOrDefault().Key;
+ }
}
}
}
diff --git a/MP-TAB-SERV/Components/MachineBlock.razor.cs b/MP-TAB-SERV/Components/MachineBlock.razor.cs
index 493cf73a..1cf8f397 100644
--- a/MP-TAB-SERV/Components/MachineBlock.razor.cs
+++ b/MP-TAB-SERV/Components/MachineBlock.razor.cs
@@ -1,5 +1,6 @@
using EgwCoreLib.Razor;
using global::Microsoft.AspNetCore.Components;
+using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
@@ -118,6 +119,11 @@ namespace MP_TAB_SERV.Components
}
}
+ ///
+ /// Dati produzioen rilevati
+ ///
+ protected StatoProdModel? datiProdAct { get; set; } = null;
+
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -127,6 +133,9 @@ namespace MP_TAB_SERV.Components
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
+ [Inject]
+ protected StatusData SDService { get; set; } = null!;
+
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
@@ -159,15 +168,9 @@ namespace MP_TAB_SERV.Components
{
imgBasePath = $"{Environment.CurrentDirectory}/images/";
}
-
-
-
+ await Task.Delay(1);
}
- ///
- /// Dati produzioen rilevati
- ///
- protected StatoProdModel? datiProdAct { get; set; } = null;
protected override async Task OnParametersSetAsync()
{
DateTime adesso = DateTime.Now;
@@ -175,7 +178,16 @@ namespace MP_TAB_SERV.Components
// controllo SE avessi idxMacchSub --> rileggo!
if (RecMSE != null)
{
- datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
+ if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.NumPezzi)
+ {
+ datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
+ SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct);
+ SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.NumPezzi);
+ }
+ else
+ {
+ datiProdAct = SDService.MachProdStGet(RecMSE.IdxMacchina);
+ }
}
if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null)
{
diff --git a/MP-TAB-SERV/Components/MseSampler.razor.cs b/MP-TAB-SERV/Components/MseSampler.razor.cs
index 0f96ac5a..788802a9 100644
--- a/MP-TAB-SERV/Components/MseSampler.razor.cs
+++ b/MP-TAB-SERV/Components/MseSampler.razor.cs
@@ -57,7 +57,7 @@ namespace MP_TAB_SERV.Components
}
[Inject]
- protected StatusData MDataService { get; set; } = null!;
+ protected StatusData SDService { get; set; } = null!;
[Inject]
protected MessageService MServ { get; set; } = null!;
@@ -68,13 +68,19 @@ namespace MP_TAB_SERV.Components
protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
- var pUpd = Task.Run(async () =>
- {
- aTimer.Interval = fastRefreshMs;
- await InvokeAsync(RefreshData);
- //Log.Trace("MseSampler Timer elapsed");
- });
- pUpd.Wait();
+ try
+ {
+ var pUpd = Task.Run(async () =>
+ {
+ aTimer.Interval = fastRefreshMs;
+ await InvokeAsync(RefreshData);
+ });
+ pUpd.Wait();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante MseSampler.ElapsedTimer{Environment.NewLine}{exc}");
+ }
}
protected override void OnInitialized()
@@ -107,7 +113,7 @@ namespace MP_TAB_SERV.Components
private async Task RefreshData()
{
- List ListMSE = await MDataService.MseGetAll();
+ List ListMSE = await SDService.MseGetAll();
await MServ.SaveMse(ListMSE);
await E_Updated.InvokeAsync(ListMSE);
}
diff --git a/MP-TAB-SERV/Components/OdlMan.razor b/MP-TAB-SERV/Components/OdlMan.razor
index b3ce4602..37d69700 100644
--- a/MP-TAB-SERV/Components/OdlMan.razor
+++ b/MP-TAB-SERV/Components/OdlMan.razor
@@ -225,17 +225,18 @@