diff --git a/MP-TAB3/Components/CmpFooter.razor b/MP-TAB3/Components/CmpFooter.razor index f5d2eb11..7b4b69b8 100644 --- a/MP-TAB3/Components/CmpFooter.razor +++ b/MP-TAB3/Components/CmpFooter.razor @@ -1,23 +1,22 @@ 
- MP-TAB3 @(DateTime.Today.Year) v.@version + MP-TAB3 @(adesso.Year) v.@version
- @if (typeScadLogin > 0) + @if (TypeScadLogin > 0) { @if (CurrExpVal < 0) { -
TIMER SCADUTO!
+
TIMER SCADUTO!
} else { } } -
- @($"{DateTime.Now:HH:mm:ss}") | Egalware + @($"{adesso:HH:mm:ss}") | Egalware
diff --git a/MP-TAB3/Components/CmpFooter.razor.cs b/MP-TAB3/Components/CmpFooter.razor.cs index 2f30e01b..02abc270 100644 --- a/MP-TAB3/Components/CmpFooter.razor.cs +++ b/MP-TAB3/Components/CmpFooter.razor.cs @@ -6,6 +6,16 @@ namespace MP_TAB3.Components { public partial class CmpFooter : IDisposable { + #region Public Properties + + [Parameter] + public int DtScadLogin { get; set; } = 0; + + [Parameter] + public int TypeScadLogin { get; set; } = -1; + + #endregion Public Properties + #region Public Methods public void Dispose() @@ -18,12 +28,79 @@ namespace MP_TAB3.Components } } - public double CurrExpVal { get; set; } = 50; - public double MaxExpVal { get; set; } = 100; - public double yLimit { get; set; } = 30; - public double rLimit { get; set; } = 10; + #endregion Public Methods - public string timeUm + #region Protected Properties + + [Inject] + protected MessageService MsgServ { get; set; } = null!; + + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + if (TypeScadLogin > 0) + { + var diffOfTime = DateTime.Now.Subtract(MsgServ.dtLastAction); + CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes; + } + else + { + } + adesso = DateTime.Now; + await InvokeAsync(() => StateHasChanged()); + }); + pUpd.Wait(); + } + + protected override void OnParametersSet() + { + var rawVers = typeof(Program).Assembly.GetName().Version; + version = rawVers != null ? rawVers : new Version("0.0.0.0"); + DtScadLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin"); + MaxExpVal = DtScadLogin; + yLimit = MaxExpVal * 0.3; + rLimit = MaxExpVal * 0.1; + StartTimer(); + } + + protected void StartTimer() + { + int tOutPeriod = 1000; + aTimer = new System.Timers.Timer(tOutPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + } + + #endregion Protected Methods + + #region Private Fields + + private DateTime adesso = DateTime.Now; + private System.Timers.Timer aTimer = null!; + private Version version = null!; + + #endregion Private Fields + + #region Private Properties + + private double CurrExpVal { get; set; } = 50; + private double MaxExpVal { get; set; } = 100; + + private double rLimit { get; set; } = 10; + + private string timeUm { get { @@ -40,77 +117,7 @@ namespace MP_TAB3.Components } } - public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) - { - - var pUpd = Task.Run(async () => - { - if (typeScadLogin > 0) - { - var diffOfTime = DateTime.Now.Subtract(MsgServ.dtLastAction); - CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes; - - } - await InvokeAsync(() => StateHasChanged()); - }); - pUpd.Wait(); - } - - public void StartTimer() - { - int tOutPeriod = 1000; - aTimer = new System.Timers.Timer(tOutPeriod); - aTimer.Elapsed += ElapsedTimer; - aTimer.Enabled = true; - aTimer.Start(); - } - - #endregion Public Methods - - #region Protected Properties - - protected int dtScadLogin { get; set; } = 0; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - [Inject] - protected NavigationManager NavMan { get; set; } = null!; - - [Inject] - protected SharedMemService SMServ { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - - protected int typeScadLogin { get; set; } = 0; - protected override async Task OnInitializedAsync() - { - await Task.Delay(1); - var rawVers = typeof(Program).Assembly.GetName().Version; - version = rawVers != null ? rawVers : new Version("0.0.0.0"); - typeScadLogin = SMServ.GetConfInt("TAB_TypeScadLogin"); - dtScadLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin"); - MaxExpVal = dtScadLogin; - yLimit = MaxExpVal * 0.3; - rLimit = MaxExpVal * 0.1; - StartTimer(); - } - - #endregion Protected Methods - - #region Private Fields - - private static Logger Log = LogManager.GetCurrentClassLogger(); - private System.Timers.Timer aTimer = null!; - private Version version = null!; - - #endregion Private Fields - - #region Private Properties - - private int dtTimerScadenzaLogin { get; set; } = 0; + private double yLimit { get; set; } = 30; #endregion Private Properties } diff --git a/MP-TAB3/Components/CmpTop.razor.cs b/MP-TAB3/Components/CmpTop.razor.cs index 84d547ea..67b087c3 100644 --- a/MP-TAB3/Components/CmpTop.razor.cs +++ b/MP-TAB3/Components/CmpTop.razor.cs @@ -35,7 +35,8 @@ namespace MP_TAB3.Components protected string CurrOprTknRedis { get; set; } = null!; - protected int expLoginType { get; set; } = 0; + [Parameter] + public int TypeScadLogin { get; set; } = -1; protected bool HideMenu { @@ -67,7 +68,7 @@ namespace MP_TAB3.Components protected async Task RefreshLogIn(string decodValue) { bool done = false; - if (expLoginType == 0) + if (TypeScadLogin <= 0) { done = await MsgServ.DoLogIn(decodValue, false); } @@ -97,11 +98,13 @@ namespace MP_TAB3.Components await InvokeAsync(StateHasChanged); var currToken = await MsgServ.GetCurrOperDtoLSAsync(); var lastOpr = await MsgServ.GetLastMatrOprAsync(); + var devGuid = await MsgServ.GetCurrDevGuidLSAsync(); // reset cache varie await MsgServ.ClearLocalStor(); await MsgServ.ClearSessionStor(); await MDataService.FlushCache(); - // salvo di nuovo opr + // salvo di nuovo opr + GUID + await MsgServ.SetCurrDevGuidLSAsync(devGuid); await MsgServ.SetLastMatrOprAsync(lastOpr); await MsgServ.SetCurrOperDtoLSAsync(currToken); // reload MStor @@ -132,10 +135,11 @@ namespace MP_TAB3.Components protected override async Task OnInitializedAsync() { await Task.Delay(1); - expLoginType = SMServ.GetConfInt("TAB_TypeScadLogin"); +#if false + TypeScadLogin = SMServ.GetConfInt("TAB_TypeScadLogin"); +#endif var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); - //if (string.IsNullOrEmpty(CurrDevGuid.ToString())) if (CurrDevGuid == Guid.Empty) { CurrDevGuid = Guid.NewGuid(); diff --git a/MP-TAB3/Components/OdlMan.razor b/MP-TAB3/Components/OdlMan.razor index 854573ba..0728cf73 100644 --- a/MP-TAB3/Components/OdlMan.razor +++ b/MP-TAB3/Components/OdlMan.razor @@ -2,6 +2,7 @@
+
@if (isProcessing) { diff --git a/MP-TAB3/Components/OdlMan.razor.cs b/MP-TAB3/Components/OdlMan.razor.cs index d932d42a..a5a87646 100644 --- a/MP-TAB3/Components/OdlMan.razor.cs +++ b/MP-TAB3/Components/OdlMan.razor.cs @@ -28,10 +28,6 @@ namespace MP_TAB3.Components #endregion Public Properties -#if false - protected PzProdModel? prodMacchina = null; -#endif - #region Protected Properties /// @@ -688,7 +684,7 @@ namespace MP_TAB3.Components await InvokeAsync(StateHasChanged); } - protected override async Task OnInitializedAsync() + protected override void OnInitialized() { //baseLang = SMServ.GetConf("baseLang"); numDayOdl = SMServ.GetConfInt("numDaySelOdl"); @@ -708,6 +704,9 @@ namespace MP_TAB3.Components gPeriodReopenOdlTav = SMServ.GetConfInt("gPeriodReopenOdlTav"); string rawEmailDest = SMServ.GetConf("_adminEmail"); emailAdmDest = rawEmailDest.Split(',').ToList(); + } + protected override async Task OnParametersSetAsync() + { if (RecMSE != null) { if (string.IsNullOrEmpty(IdxMaccSel)) @@ -724,11 +723,11 @@ namespace MP_TAB3.Components } } IdxMaccParent = getIdxMaccParent(); - // verifica stato inAttr - await CheckAttr(); - await ReloadData(true); } checkAll(); + // verifica stato inAttr + await CheckAttr(); + await ReloadData(true); } protected async Task ProdEnd() @@ -965,19 +964,6 @@ namespace MP_TAB3.Components { showSplitOdlRiattr = !showSplitOdlRiattr; await ReloadXDL(true); - -#if false - if (tcRichAttr == 0) - { - tcRichAttr = currPodl.Tcassegnato; - } - if (string.IsNullOrEmpty(noteAttr)) - { - - noteAttr = currOdl.Note; - } - PzPallet = currOdl.PzPallet; -#endif } protected async Task SplitOdl() @@ -1016,8 +1002,6 @@ namespace MP_TAB3.Components } await advStep(currStep++); - // invio email! - await advStep(currStep++); // processo chiusura setup string evText = "Registrato Riattrezzaggio ODL (old :{0})"; StringBuilder sb = new StringBuilder(); @@ -1035,6 +1019,8 @@ namespace MP_TAB3.Components await RefreshData(); await CheckAttr(); await advStep(currStep++); + showSplitOdlRiattr = false; + await ReloadXDL(true); // chiudo update... isProcessing = false; await InvokeAsync(StateHasChanged); @@ -1101,6 +1087,7 @@ namespace MP_TAB3.Components private bool isMulti = false; private bool isProcessing = false; + private bool isLoading = false; private bool isSlave = false; @@ -1149,12 +1136,9 @@ namespace MP_TAB3.Components { get => IdxPOdlSel > 0 ? "bg-info text-light" : "bg-warning"; } - private string txtShowXDL - { - get => showPOdlData ? "PODL" : "ODL"; - } private ODLExpModel currOdl { get; set; } = new ODLExpModel(); + private PODLExpModel currPodl { get; set; } = new PODLExpModel(); /// @@ -1187,41 +1171,11 @@ namespace MP_TAB3.Components /// Valore calcolato key ODL corrente... /// private int IdxOdl { get; set; } = 0; -#if false - { - get - { - int answ = 0; - var pUpd = Task.Run(async () => - { - var tabOdl = await TabDServ.OdlCurrByMacc(IdxMaccSel, false); - answ = tabOdl.IdxOdl; - }); - pUpd.Wait(); - return answ; - } - } -#endif /// /// Valore calcolato key ODL altra tavola attivo... /// private int IdxOdlAltra { get; set; } = 0; -#if false - { - get - { - int answ = 0; - var pUpd = Task.Run(async () => - { - var tabOdl = await TabDServ.OdlCurrByMacc(idxMaccAltraTav, false); - answ = tabOdl.IdxOdl; - }); - pUpd.Wait(); - return answ; - } - } -#endif private string lblWarnBody { @@ -1348,6 +1302,11 @@ namespace MP_TAB3.Components get => forceCloseOdl ? Traduci("ForceCloseODL") : Traduci("SplitCurrODL"); } + private string txtShowXDL + { + get => showPOdlData ? "PODL" : "ODL"; + } + #endregion Private Properties #region Private Methods @@ -1479,6 +1438,19 @@ namespace MP_TAB3.Components } } + private void fixTcNotePzPallet() + { + if (tcRichAttr == 0) + { + tcRichAttr = IdxPOdlSel == 0 ? currOdl.Tcassegnato : currPodl.Tcassegnato; + } + if (string.IsNullOrEmpty(noteAttr)) + { + noteAttr = IdxPOdlSel == 0 ? currOdl.Note : currPodl.Note; + } + PzPallet = IdxPOdlSel == 0 ? currOdl.PzPallet : currPodl.PzPallet; + } + /// /// processa evento richiesto /// @@ -1530,7 +1502,8 @@ namespace MP_TAB3.Components private async Task ReloadData(bool forceReload) { - Log.Trace("OdlMan.ReloadData"); + isLoading = true; + Log.Trace("OdlMan.ReloadData 01"); if (forceReload) { isMaster = SMServ.ListM2S @@ -1551,17 +1524,15 @@ namespace MP_TAB3.Components { ListODL = ListODLAll.Where(x => x.label.Contains(SearchPodl, StringComparison.InvariantCultureIgnoreCase) || x.value == 0).ToList(); } - Log.Trace($"found {ListODL.Count} rec"); + Log.Trace($"OdlMan.ReloadData | found {ListODL.Count} rec"); if (forceReload) { if (!isMulti || (isMulti && IdxMaccSel.IndexOf("#") > 0)) { var rawData = await TabDServ.PezziProdMacchina(IdxMaccSel); datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, DateTime.Now); -#if false - prodMacchina = rawData.FirstOrDefault() ?? new PzProdModel(); -#endif checkConfProd(); + Log.Trace("OdlMan.ReloadData | check checkConfProd done"); } } await updateIdxOdl(); @@ -1583,6 +1554,8 @@ namespace MP_TAB3.Components } } } + isLoading = false; + Log.Trace("OdlMan.ReloadData | END"); } private async Task ReloadPOdlDetailData() @@ -1650,19 +1623,6 @@ namespace MP_TAB3.Components } } - private void fixTcNotePzPallet() - { - if (tcRichAttr == 0) - { - tcRichAttr = IdxPOdlSel == 0 ? currOdl.Tcassegnato : currPodl.Tcassegnato; - } - if (string.IsNullOrEmpty(noteAttr)) - { - noteAttr = IdxPOdlSel == 0 ? currOdl.Note : currPodl.Note; - } - PzPallet = IdxPOdlSel == 0 ? currOdl.PzPallet : currPodl.PzPallet; - } - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Components/ProdConfirm.razor.cs b/MP-TAB3/Components/ProdConfirm.razor.cs index ccd6d253..7fe2096d 100644 --- a/MP-TAB3/Components/ProdConfirm.razor.cs +++ b/MP-TAB3/Components/ProdConfirm.razor.cs @@ -29,14 +29,6 @@ namespace MP_TAB3.Components [Parameter] public EventCallback> E_Updated { get; set; } - /// - /// Verifica ODL OK (ovvero caricato x macchina...) - /// - public bool odlOk - { - get => (RecMSE != null && RecMSE.IdxOdl > 0); - } - [Parameter] public MappaStatoExpl? RecMSE { @@ -51,8 +43,6 @@ namespace MP_TAB3.Components } } - private MappaStatoExpl? currRecMSE { get; set; } = null; - #endregion Public Properties #region Protected Properties @@ -133,6 +123,14 @@ namespace MP_TAB3.Components protected int numPzScarto2Rec { get; set; } = 0; + /// + /// Verifica ODL OK (ovvero caricato x macchina...) + /// + protected bool odlOk + { + get => (RecMSE != null && RecMSE.IdxOdl > 0); + } + [Inject] protected SharedMemService SMServ { get; set; } = null!; @@ -269,17 +267,17 @@ namespace MP_TAB3.Components private bool chkPzBuoniNeg = false; private bool confRett = false; - private bool enableMagPrint = false; private bool enablePzProdLasciati = false; private string lblOut = ""; - private int modoConfProd = 0; #endregion Private Fields #region Private Properties + private bool confProdActive { get; set; } = false; + private MappaStatoExpl? currRecMSE { get; set; } = null; private DateTime dtReqUpdate { get; set; } = DateTime.Now; private string IdxMaccSel { get; set; } = ""; @@ -295,8 +293,6 @@ namespace MP_TAB3.Components private bool showConfirm { get; set; } = true; - private bool confProdActive { get; set; } = false; - #endregion Private Properties #region Private Methods diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index d8acdf04..849cf1a5 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2401.417 + 6.16.2401.511 enable MP_TAB3 diff --git a/MP-TAB3/Pages/Logout.razor.cs b/MP-TAB3/Pages/Logout.razor.cs index 54c76b0f..e8b9dc0c 100644 --- a/MP-TAB3/Pages/Logout.razor.cs +++ b/MP-TAB3/Pages/Logout.razor.cs @@ -39,9 +39,9 @@ namespace MP_TAB3.Pages protected override async Task OnInitializedAsync() { await Task.Delay(1); - await localStorage.SetItemAsync("currTkn", ""); - await localStorage.SetItemAsync("CurrMach", ""); - await localStorage.SetItemAsync("LastPage", ""); + await MsgServ.SetCurrOperDtoLSAsync(""); + await MsgServ.IdxMaccSet(""); + await MsgServ.LastOpenedPageSet(""); var CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync(); var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); if (!string.IsNullOrEmpty(CurrOprTknLS)) diff --git a/MP-TAB3/Pages/MachineDetail.razor b/MP-TAB3/Pages/MachineDetail.razor index 86ccbfec..08344cab 100644 --- a/MP-TAB3/Pages/MachineDetail.razor +++ b/MP-TAB3/Pages/MachineDetail.razor @@ -1,6 +1,5 @@ @page "/machine-detail" - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/MachineDetail.razor.cs b/MP-TAB3/Pages/MachineDetail.razor.cs index 82624583..36bb419f 100644 --- a/MP-TAB3/Pages/MachineDetail.razor.cs +++ b/MP-TAB3/Pages/MachineDetail.razor.cs @@ -49,7 +49,6 @@ namespace MP_TAB3.Pages await RefreshMBlock(); } } - //await InvokeAsync(StateHasChanged); } protected async Task RefreshMBlock() @@ -105,22 +104,22 @@ namespace MP_TAB3.Pages private async Task ReloadData() { - if (string.IsNullOrEmpty(IdxMacc)) + try { - try + if (string.IsNullOrEmpty(IdxMacc)) { IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } } - catch (Exception exc) + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) { - Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); } } + catch (Exception exc) + { + Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); + } // recupero parametri configurazione... await setupConf(); } diff --git a/MP-TAB3/Pages/ODL.razor.cs b/MP-TAB3/Pages/ODL.razor.cs index da8f91d5..bcb50c75 100644 --- a/MP-TAB3/Pages/ODL.razor.cs +++ b/MP-TAB3/Pages/ODL.razor.cs @@ -1,6 +1,7 @@ using global::Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.Data.Services; +using NLog; namespace MP_TAB3.Pages { @@ -38,7 +39,6 @@ namespace MP_TAB3.Pages await RefreshMBlock(); } } - await InvokeAsync(StateHasChanged); } protected async Task RefreshMBlock() @@ -59,6 +59,7 @@ namespace MP_TAB3.Pages #region Private Fields + private static Logger Log = LogManager.GetCurrentClassLogger(); private string IdxMaccSubSel = ""; #endregion Private Fields @@ -67,15 +68,23 @@ namespace MP_TAB3.Pages private async Task ReloadData() { - if (string.IsNullOrEmpty(IdxMacc)) + try + { + if (string.IsNullOrEmpty(IdxMacc)) { IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } } + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); + } + } #endregion Private Methods diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 9d800083..71fc2a36 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2401.417

+

Versione: 6.16.2401.511


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 673f5369..3a53fb19 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2401.417 +6.16.2401.511 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index e90bc311..55a2833c 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2401.417 + 6.16.2401.511 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP-TAB3/Shared/MainLayout.razor b/MP-TAB3/Shared/MainLayout.razor index 372be319..71e4124e 100644 --- a/MP-TAB3/Shared/MainLayout.razor +++ b/MP-TAB3/Shared/MainLayout.razor @@ -6,7 +6,7 @@
    - + @if (userIsOk || NavMan.Uri.Contains("reg-new-device")) {
    @@ -24,5 +24,5 @@
    - +
    diff --git a/MP-TAB3/Shared/MainLayout.razor.cs b/MP-TAB3/Shared/MainLayout.razor.cs index 82edadb9..672d10ec 100644 --- a/MP-TAB3/Shared/MainLayout.razor.cs +++ b/MP-TAB3/Shared/MainLayout.razor.cs @@ -27,6 +27,13 @@ namespace MP_TAB3.Shared #region Protected Properties + protected string bodyType + { + get => pageOk ? "mainBodyNoSide" : "mainBody"; + } + + protected Guid currDevGuid { get; set; } = new Guid(); + /// /// Livello corrente del menu /// @@ -37,11 +44,19 @@ namespace MP_TAB3.Shared ///
protected List CurrMenuItems { get; set; } = new List(); + /// + /// Scadenza del login + /// + protected int dtScadLogin { get; set; } = 0; + protected bool HideMenu { get => NavMan.Uri.Contains("reg-new-device"); } + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] protected ListSelectDataSrv MDataService { get; set; } = null!; @@ -54,21 +69,6 @@ namespace MP_TAB3.Shared [Inject] protected NavigationManager NavMan { get; set; } = null!; - [Inject] - protected TabDataService TDataService { get; set; } = null!; - - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - - protected string bodyType - { - get => pageOk ? "mainBodyNoSide" : "mainBody"; - } - protected bool pageOk { get @@ -78,23 +78,19 @@ namespace MP_TAB3.Shared } } + [Inject] + protected TabDataService TDataService { get; set; } = null!; - protected async Task handleBodyClick() - { - await Task.Delay(1); - if (!pageOk) - { - await checkDtDiff2Logout(); - } + /// + /// Tipo scadenza login Postoa -1 di default così da NON avere problemi in caso di setuop errato... + /// + protected int typeScadLogin { get; set; } = -1; - } - private int MatrOpr - { - get => MsgServ.MatrOpr; - } - protected int typeScadLogin { get; set; } = 0; - protected int dtScadLogin { get; set; } = 0; - protected Guid currDevGuid { get; set; } = new Guid(); + protected bool userIsOk { get; set; } = false; + + #endregion Protected Properties + + #region Protected Methods protected async Task checkDtDiff2Logout() { @@ -102,14 +98,8 @@ namespace MP_TAB3.Shared TimeSpan tsDeltaSave = DateTime.Now.Subtract(MsgServ.dtLastSave); switch (typeScadLogin) { - case 0: - if (tsDeltaAct.Minutes >= dtScadLogin) - { - NavMan.NavigateTo("logout"); - } - break; case 1: - if (tsDeltaAct.Minutes >= dtScadLogin) + if (tsDeltaAct.TotalMinutes >= dtScadLogin) { var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); if (!string.IsNullOrEmpty(userTkn)) @@ -138,6 +128,35 @@ namespace MP_TAB3.Shared } } break; + + case 2: + if (tsDeltaAct.TotalMinutes >= dtScadLogin) + { + NavMan.NavigateTo("logout"); + } + break; + + case 0: + case -1: + await ReloadMemStor(); + typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin"); + dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin"); + break; + } + } + + protected async Task checkIfUserOk(bool isOk) + { + await Task.Delay(1); + userIsOk = isOk; + } + + protected async Task handleBodyClick() + { + await Task.Delay(1); + if (!pageOk) + { + await checkDtDiff2Logout(); } } @@ -147,33 +166,27 @@ namespace MP_TAB3.Shared /// protected override async Task OnInitializedAsync() { - typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin"); - dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin"); NavMan.LocationChanged += HandleLocationChanged; - currDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); - // verifica preliminare setup mdati if (!MStor.MenuOk) { await ReloadMemStor(); } - + // leggo resto della configurazione + typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin"); + dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin"); CurrLevel = MStor.PageLevel(NavMan.Uri); - // recupero men� + // recupero menu corrente if (MStor.DictMenu.ContainsKey(CurrLevel)) { CurrMenuItems = MStor.DictMenu[CurrLevel]; } - - await Task.Delay(1); } - protected bool userIsOk { get; set; } = false; - protected async Task checkIfUserOk(bool isOk) + protected override async Task OnAfterRenderAsync(bool firstRender) { - await Task.Delay(1); - userIsOk = isOk; + currDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); } protected async Task ReloadMemStor() @@ -199,9 +212,6 @@ namespace MP_TAB3.Shared // fix elenco stati var allStati = await TDataService.AnaStatiGetAll(); MStor.SetStati(allStati); - // non da farsi globalmente // fix macchine var allMach = await - // MDataService.MacchineByMatrOper(0); MStor.DictMacchine = allMach.ToDictionary(x => - // x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}"); // fix vocabolario var allVoc = TDataService.VocabolarioGetAll(); @@ -221,6 +231,15 @@ namespace MP_TAB3.Shared #endregion Private Fields + #region Private Properties + + private int MatrOpr + { + get => MsgServ.MatrOpr; + } + + #endregion Private Properties + #region Private Methods private void HandleLocationChanged(object? sender, LocationChangedEventArgs e) @@ -235,11 +254,6 @@ namespace MP_TAB3.Shared } } - private void OnYes() - { - Console.WriteLine($"{DateTime.Now} | 'Yes' button selected."); - } - #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index fd04d925..6651eb16 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -1343,9 +1343,10 @@ namespace MP.Data.Controllers var PzPallet = new SqlParameter("@PzPallet", pzPallet); var Note = new SqlParameter("@Note", note); var DtEvento = new SqlParameter("@dtEvento", dtEvent); + var FlagNoteAppend = new SqlParameter("@FlgNoteAppend", false); var callResult = dbCtx .Database - .ExecuteSqlRaw("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina, @TCRichAttr, @PzPallet, @Note, @dtEvento", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note, DtEvento); + .ExecuteSqlRaw("EXEC stp_ODL_inizioSetupPromessa @idxPromessa, @MatrOpr, @IdxMacchina, @TCRichAttr, @PzPallet, @Note, @dtEvento, @FlgNoteAppend", IdxPromessa, MatrOpr, IdxMacchina, TCRichAttr, PzPallet, Note, DtEvento, FlagNoteAppend); answ = true; } diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 000f9e77..6d818038 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -262,6 +262,8 @@ namespace MP.Data.Services var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey); if (rigaOpr != null) { + await SetLastMatrOprAsync(rigaOpr.MatrOpr); + userTknDTO newUserTkn = new userTknDTO() { currOpr = rigaOpr, @@ -271,8 +273,10 @@ namespace MP.Data.Services var jsonTkn = JsonConvert.SerializeObject(newUserTkn); string hash = TDService.EncryptData(jsonTkn); RigaOper = rigaOpr; - await SetLastMatrOprAsync(rigaOpr.MatrOpr); - await SetCurrOperDtoLSAsync(hash); + if (!hash.Equals(decodValue)) + { + await SetCurrOperDtoLSAsync(hash); + } if (saveOpr) { await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash, devGuid); @@ -370,8 +374,8 @@ namespace MP.Data.Services public async Task GetMachineMse(string idxMacchina) { MappaStatoExpl answ = null; - string rawData = await localStorage.GetItemAsync(machineMse(idxMacchina)); - if (rawData != "") + var rawData = await localStorage.GetItemAsync(machineMse(idxMacchina)); + if (!string.IsNullOrEmpty(rawData)) { answ = JsonConvert.DeserializeObject(rawData); } diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 491627f5..67f96f8d 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1715,7 +1715,6 @@ namespace MP.Data.Services // cerco in redis... string currKey = $"{redisBaseKey}:PzProd:{idxMacchina}"; RedisValue rawData = await redisDb.StringGetAsync(currKey); - //if (!string.IsNullOrEmpty($"{rawData}")) if (rawData.HasValue) { result = JsonConvert.DeserializeObject>($"{rawData}");