From 1eb01b0532c77a50275d32bd731461609c623a55 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 8 Jan 2024 12:21:25 +0100 Subject: [PATCH 1/7] Fix due tipologie di login --- MP-TAB3/Components/CmpFooter.razor | 12 +++- MP-TAB3/Components/CmpFooter.razor.cs | 83 +++++++++++++++++++++++---- MP-TAB3/Components/CmpTop.razor.cs | 52 +++-------------- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Pages/Logout.razor.cs | 36 +++++------- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- MP-TAB3/Shared/MainLayout.razor | 6 +- MP-TAB3/Shared/MainLayout.razor.cs | 66 +++++++++++++-------- MP.Data/Services/MessageService.cs | 65 +++++++++------------ MP.Data/Services/TabDataService.cs | 32 ++++++++++- 12 files changed, 210 insertions(+), 150 deletions(-) diff --git a/MP-TAB3/Components/CmpFooter.razor b/MP-TAB3/Components/CmpFooter.razor index 7b4b69b8..e9fd9aeb 100644 --- a/MP-TAB3/Components/CmpFooter.razor +++ b/MP-TAB3/Components/CmpFooter.razor @@ -11,7 +11,17 @@ } else { - + if (MatrOper >= 0) + { + if (showProgrBar) + { + + } + } + else + { +
...login...
+ } } } diff --git a/MP-TAB3/Components/CmpFooter.razor.cs b/MP-TAB3/Components/CmpFooter.razor.cs index 02abc270..51794718 100644 --- a/MP-TAB3/Components/CmpFooter.razor.cs +++ b/MP-TAB3/Components/CmpFooter.razor.cs @@ -8,9 +8,15 @@ namespace MP_TAB3.Components { #region Public Properties + [Parameter] + public Guid CurrDevGuid { get; set; } + [Parameter] public int DtScadLogin { get; set; } = 0; + [Parameter] + public int MatrOper { get; set; } = -1; + [Parameter] public int TypeScadLogin { get; set; } = -1; @@ -41,6 +47,9 @@ namespace MP_TAB3.Components [Inject] protected SharedMemService SMServ { get; set; } = null!; + [Inject] + protected TabDataService TDataService { get; set; } = null!; + #endregion Protected Properties #region Protected Methods @@ -49,16 +58,50 @@ namespace MP_TAB3.Components { 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()); + // solo se NON sono in login... + if (!IsLoginPage) + { + var diffOfTime = adesso.Subtract(MsgServ.dtLastAction); + CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes; + if (TypeScadLogin == 1) + { + if (CurrExpVal < 0) + { + MsgServ.dtLastAction = adesso; + NavMan.NavigateTo("logout"); + } + } + // in questo caso cerco SOLO se sia scaduto su redis + else if (TypeScadLogin == 2) + { + // mitigazione check: solo ogni 10 secondi... + if (adesso.Subtract(MsgServ.dtLastSave).TotalSeconds > 10) + { + MsgServ.dtLastSave = adesso; + // rileggo scadenza ultima... + TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOper, CurrDevGuid); + // mostro scadenza SOLO se inferiore a 24h... + showProgrBar = tsScadenza.TotalHours < 24; + // se < 0 --> login + if (tsScadenza.TotalMinutes < 0) + { + NavMan.NavigateTo("logout"); + } + else + { + MsgServ.dtLastAction = adesso.Subtract(TimeSpan.FromMinutes(MaxExpVal)).Add(tsScadenza); + } + // comunque controllo chiave redis + var userTkn = await TDataService.OperatoreGetRedis(MatrOper, CurrDevGuid); + if (string.IsNullOrEmpty(userTkn)) + { + NavMan.NavigateTo("logout"); + } + } + } + } + await InvokeAsync(StateHasChanged); }); pUpd.Wait(); } @@ -68,9 +111,14 @@ namespace MP_TAB3.Components var rawVers = typeof(Program).Assembly.GetName().Version; version = rawVers != null ? rawVers : new Version("0.0.0.0"); DtScadLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin"); + showProgrBar = TypeScadLogin == 1; MaxExpVal = DtScadLogin; yLimit = MaxExpVal * 0.3; rLimit = MaxExpVal * 0.1; + // rileggo scadenza ultima... + TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOper, CurrDevGuid); + MsgServ.dtLastAction = adesso.Subtract(TimeSpan.FromMinutes(MaxExpVal)).Add(tsScadenza); + showProgrBar = tsScadenza.TotalHours < 24; StartTimer(); } @@ -89,6 +137,7 @@ namespace MP_TAB3.Components private DateTime adesso = DateTime.Now; private System.Timers.Timer aTimer = null!; + private bool showProgrBar = true; private Version version = null!; #endregion Private Fields @@ -96,20 +145,30 @@ namespace MP_TAB3.Components #region Private Properties private double CurrExpVal { get; set; } = 50; + + private bool IsLoginPage + { + get + { + string currPage = NavMan.Uri; + return currPage.Contains("logout") || currPage.Contains("reg-new-device"); + } + } + private double MaxExpVal { get; set; } = 100; private double rLimit { get; set; } = 10; - private string timeUm + private string CurrUM { get { string answ = "m"; - if (CurrExpVal > 60) + if (MaxExpVal > 60) { answ = "h"; } - else if (CurrExpVal > 1440) + else if (MaxExpVal > 1440) { answ = "gg"; } diff --git a/MP-TAB3/Components/CmpTop.razor.cs b/MP-TAB3/Components/CmpTop.razor.cs index 67b087c3..d48189d6 100644 --- a/MP-TAB3/Components/CmpTop.razor.cs +++ b/MP-TAB3/Components/CmpTop.razor.cs @@ -17,6 +17,8 @@ namespace MP_TAB3.Components public List CurrMenuItems { get; set; } = new List(); [Parameter] public EventCallback EA_UserIsOk { get; set; } + [Parameter] + public EventCallback EA_ReloadMStor { get; set; } #endregion Public Properties @@ -29,7 +31,7 @@ namespace MP_TAB3.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!; @@ -68,7 +70,7 @@ namespace MP_TAB3.Components protected async Task RefreshLogIn(string decodValue) { bool done = false; - if (TypeScadLogin <= 0) + if (TypeScadLogin <= 0 || TypeScadLogin == 2) { done = await MsgServ.DoLogIn(decodValue, false); } @@ -107,8 +109,8 @@ namespace MP_TAB3.Components await MsgServ.SetCurrDevGuidLSAsync(devGuid); await MsgServ.SetLastMatrOprAsync(lastOpr); await MsgServ.SetCurrOperDtoLSAsync(currToken); - // reload MStor - await ReloadMemStor(); + // richiesta reload MStor + await EA_ReloadMStor.InvokeAsync(true); // calcolo tempo esecuzione sw.Stop(); int delta = 500 - (int)sw.ElapsedMilliseconds; @@ -116,7 +118,7 @@ namespace MP_TAB3.Components await Task.Delay(delta); ResetClass = "btn-primary"; // await InvokeAsync(StateHasChanged); - Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms"); + Log.Info($"ForceReload completed in {sw.Elapsed.TotalMilliseconds}ms"); // ricarica pagina! NavMan.NavigateTo("status-map"); } @@ -135,9 +137,6 @@ namespace MP_TAB3.Components protected override async Task OnInitializedAsync() { await Task.Delay(1); -#if false - TypeScadLogin = SMServ.GetConfInt("TAB_TypeScadLogin"); -#endif var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); if (CurrDevGuid == Guid.Empty) @@ -182,43 +181,6 @@ namespace MP_TAB3.Components } } - protected async Task ReloadMemStor() - { - // in primis svuoto... - MStor.ClearCache(); - // rileggo link - var allData = await MDataService.ListLinkAll(); - MStor.SetupMenu(allData); - // fix config... - var allConf = await MDataService.ConfigGetAll(); - MStor.SetConfig(allConf); - // fix MSFD... - var allMSFD = await TDService.VMSFDGetAll(); - MStor.SetMsfd(allMSFD); - // fix slave - var macSlave = await TDService.Macchine2Slave(); - MStor.SetM2S(macSlave); - - // fix elenco eventi - var allEvents = await TDService.AnagEventiGetAll(); - MStor.SetEventi(allEvents); - // fix elenco stati - var allStati = await TDService.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 = TDService.VocabolarioGetAll(); - MStor.SetVocab(allVoc); - - // resetto il tabDServ - await TDService.FlushCache(); - // ricarica la config... - TDService.SetupConfig(); - } - #endregion Protected Methods #region Private Fields diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 849cf1a5..d5b79bae 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2401.511 + 6.16.2401.812 enable MP_TAB3 diff --git a/MP-TAB3/Pages/Logout.razor.cs b/MP-TAB3/Pages/Logout.razor.cs index e8b9dc0c..c4b3f3b8 100644 --- a/MP-TAB3/Pages/Logout.razor.cs +++ b/MP-TAB3/Pages/Logout.razor.cs @@ -1,41 +1,31 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP_TAB3; -using MP_TAB3.Shared; -using MP_TAB3.Components; -using MP.Data; -using MP.Data.DatabaseModels; using MP.Data.DTO; using MP.Data.Services; using Newtonsoft.Json; -using NLog; -using EgwCoreLib.Razor; -using Blazored.LocalStorage; namespace MP_TAB3.Pages { public partial class Logout { + #region Protected Properties + [Inject] protected ILocalStorageService localStorage { get; set; } = null!; - [Inject] - protected TabDataService TDService { get; set; } = null!; + [Inject] protected MessageService MsgServ { get; set; } = null!; + [Inject] protected NavigationManager NavMan { get; set; } = null!; + [Inject] + protected TabDataService TDService { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + protected override async Task OnInitializedAsync() { await Task.Delay(1); @@ -60,5 +50,7 @@ namespace MP_TAB3.Pages MsgServ.RigaOper = null; NavMan.NavigateTo("reg-new-device", true); } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 71fc2a36..520d2f65 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2401.511

+

Versione: 6.16.2401.812


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 3a53fb19..85d5ceec 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2401.511 +6.16.2401.812 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 55a2833c..0f33b222 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2401.511 + 6.16.2401.812 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 71e4124e..9d2889ad 100644 --- a/MP-TAB3/Shared/MainLayout.razor +++ b/MP-TAB3/Shared/MainLayout.razor @@ -4,9 +4,9 @@ MP-TAB3 -
    +
    - + @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 672d10ec..4b8e7e55 100644 --- a/MP-TAB3/Shared/MainLayout.razor.cs +++ b/MP-TAB3/Shared/MainLayout.razor.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Components.Routing; using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.Services; -using MP_TAB3.Components; using NLog; namespace MP_TAB3.Shared @@ -94,23 +93,25 @@ namespace MP_TAB3.Shared protected async Task checkDtDiff2Logout() { - TimeSpan tsDeltaAct = DateTime.Now.Subtract(MsgServ.dtLastAction); - TimeSpan tsDeltaSave = DateTime.Now.Subtract(MsgServ.dtLastSave); + DateTime adesso = DateTime.Now; + TimeSpan tsDeltaAct = adesso.Subtract(MsgServ.dtLastAction); + TimeSpan tsDeltaSave = adesso.Subtract(MsgServ.dtLastSave); + string userTkn = ""; switch (typeScadLogin) { case 1: if (tsDeltaAct.TotalMinutes >= dtScadLogin) { - var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); - if (!string.IsNullOrEmpty(userTkn)) + userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); + if (string.IsNullOrEmpty(userTkn)) { - await MsgServ.DoLogIn(userTkn, true); - MsgServ.dtLastAction = DateTime.Now; - MsgServ.dtLastSave = DateTime.Now; + NavMan.NavigateTo("logout"); } else { - NavMan.NavigateTo("logout"); + await MsgServ.DoLogIn(userTkn, true); + MsgServ.dtLastAction = adesso; + MsgServ.dtLastSave = adesso; } } else @@ -118,21 +119,35 @@ namespace MP_TAB3.Shared // se fosse oltre 1 minuto da ultimo save --> salvo! if (tsDeltaSave.TotalMinutes > 1) { - var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); + userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); if (!string.IsNullOrEmpty(userTkn)) { await MsgServ.DoLogIn(userTkn, true); - MsgServ.dtLastAction = DateTime.Now; - MsgServ.dtLastSave = DateTime.Now; + MsgServ.dtLastAction = adesso; + MsgServ.dtLastSave = adesso; } } } break; case 2: - if (tsDeltaAct.TotalMinutes >= dtScadLogin) + // se fosse oltre 1 minuto da ultimo save --> salvo! + if (tsDeltaSave.TotalMinutes > 1) { - NavMan.NavigateTo("logout"); + // mitigazione controlli: solo ogni 1 minuto... + if (tsDeltaSave.TotalMinutes > 1) + { + MsgServ.dtLastSave = adesso; + userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid); + if (string.IsNullOrEmpty(userTkn)) + { + NavMan.NavigateTo("logout"); + } + if (tsDeltaAct.TotalMinutes >= dtScadLogin) + { + NavMan.NavigateTo("logout"); + } + } } break; @@ -145,13 +160,12 @@ namespace MP_TAB3.Shared } } - protected async Task checkIfUserOk(bool isOk) + protected async Task ForceReloadMStor(bool isOk) { - await Task.Delay(1); - userIsOk = isOk; + await ReloadMemStor(); } - protected async Task handleBodyClick() + protected async Task HandleBodyClick() { await Task.Delay(1); if (!pageOk) @@ -160,6 +174,11 @@ namespace MP_TAB3.Shared } } + protected override async Task OnAfterRenderAsync(bool firstRender) + { + currDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); + } + /// /// Init struttura dati /// @@ -184,11 +203,6 @@ namespace MP_TAB3.Shared } } - protected override async Task OnAfterRenderAsync(bool firstRender) - { - currDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); - } - protected async Task ReloadMemStor() { // in primis svuoto... @@ -223,6 +237,12 @@ namespace MP_TAB3.Shared TDataService.SetupConfig(); } + protected async Task SetUserOk(bool isOk) + { + await Task.Delay(1); + userIsOk = isOk; + } + #endregion Protected Methods #region Private Fields diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 6d818038..0466f32f 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -53,30 +53,6 @@ namespace MP.Data.Services #endregion Public Events -#if false - protected bool _tReset { get; set; } = false; - protected bool tReset - { - get => _tReset; - set - { - if (_tReset != value) - { - _tReset = value; - resetTimer(); - } - } - } - - protected void resetTimer() - { - if (EA_ResetFooterTimer != null) - { - EA_ResetFooterTimer?.Invoke(); - } - } -#endif - #region Public Properties public string CognomeNome @@ -251,8 +227,6 @@ namespace MP.Data.Services public async Task DoLogIn(string decodValue, bool saveOpr) { bool answ = false; - //expDays = SMService.GetConfInt("cookieDayExpire"); - //var expDT = DateTime.Now.AddDays(expDays); var devGuid = await GetCurrDevGuidLSAsync(); // decifro i valori.. var decrVal = DecryptData(decodValue); @@ -306,6 +280,7 @@ namespace MP.Data.Services } return answ; } + /// /// Restituisce il record OperatoreDTO da localstorage /// @@ -351,6 +326,20 @@ namespace MP.Data.Services return answ; } + public TimeSpan GetKeyTTL(string redKey) + { + TimeSpan answ = new TimeSpan(); + try + { + answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan(); + } + catch (Exception exc) + { + Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}"); + } + return answ; + } + /// /// Restituisce ultima matrOpr registrata da localstorage /// @@ -440,17 +429,6 @@ namespace MP.Data.Services return hasKey; } - /// - /// scrive il record OperatoreDTO nel localstorage - /// - /// - public async Task SetCurrOperDtoLSAsync(string currTkn) - { - bool answ = false; - await localStorage.SetItemAsync("currTkn", currTkn); - answ = true; - return answ; - } /// /// scrive il record Device GUID nel localstorage /// @@ -463,6 +441,18 @@ namespace MP.Data.Services return answ; } + /// + /// scrive il record OperatoreDTO nel localstorage + /// + /// + public async Task SetCurrOperDtoLSAsync(string currTkn) + { + bool answ = false; + await localStorage.SetItemAsync("currTkn", currTkn); + answ = true; + return answ; + } + /// /// Scrive il valore di IPV4 del device nel localstoragee /// @@ -515,7 +505,6 @@ namespace MP.Data.Services return answ; } - /// /// Recupero singola preferenza utente /// diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 67f96f8d..cb4db236 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1617,6 +1617,36 @@ namespace MP.Data.Services return answ; } + public TimeSpan GetKeyTTL(string redKey) + { + TimeSpan answ = TimeSpan.FromMinutes(-1); + try + { + answ = redisDb.KeyTimeToLive(redKey) ?? new TimeSpan(); + } + catch (Exception exc) + { + Log.Info($"Errore GetKeyTTL | currKey: {redKey}{Environment.NewLine}{exc}"); + } + return answ; + } + + + /// + /// Legge l'oggetto operatore+device loggato e restituisce la sua TTL + /// + /// + /// + /// + public TimeSpan OperatoreGetGuidTTL(int matrOpr, Guid currDevGuid) + { + TimeSpan answ = new TimeSpan(); + // cerco in redis... + string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}:CurrDevGuid:{currDevGuid}"; + answ = GetKeyTTL(currKey); + return answ; + } + /// /// Legge l'oggetto operatore loggato /// @@ -1633,8 +1663,6 @@ namespace MP.Data.Services RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue) { - //var encrData = SteamCrypto.DecryptString(rawData, passPhrase); - //answ = JsonConvert.DeserializeObject(rawData); answ = rawData; } if (answ == null) From de1d30fdb61382cad8c0a38459961e2a665b1e66 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 8 Jan 2024 12:25:05 +0100 Subject: [PATCH 2/7] Fix refresh timeout eventi login --- MP-TAB3/Shared/MainLayout.razor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MP-TAB3/Shared/MainLayout.razor.cs b/MP-TAB3/Shared/MainLayout.razor.cs index 4b8e7e55..eb50caa6 100644 --- a/MP-TAB3/Shared/MainLayout.razor.cs +++ b/MP-TAB3/Shared/MainLayout.razor.cs @@ -177,6 +177,10 @@ namespace MP_TAB3.Shared protected override async Task OnAfterRenderAsync(bool firstRender) { currDevGuid = await MsgServ.GetCurrDevGuidLSAsync(); + // rileggo scadenza ultima... + DateTime adesso = DateTime.Now; + TimeSpan tsScadenza = TDataService.OperatoreGetGuidTTL(MatrOpr, currDevGuid); + MsgServ.dtLastSave = adesso.Subtract(TimeSpan.FromMinutes(dtScadLogin)).Add(tsScadenza); } /// From a9011e014bca13d45df926f9ae2666200ece0057 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 8 Jan 2024 17:08:34 +0100 Subject: [PATCH 3/7] Fix blocco update durante setup ODL --- MP-TAB3/Components/MachineBlock.razor | 17 +++---- MP-TAB3/Components/OdlMan.razor | 4 +- MP-TAB3/Components/OdlMan.razor.cs | 64 ++++++++++++++++++++------- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- 7 files changed, 61 insertions(+), 32 deletions(-) diff --git a/MP-TAB3/Components/MachineBlock.razor b/MP-TAB3/Components/MachineBlock.razor index 1258f89b..c1e19ff9 100644 --- a/MP-TAB3/Components/MachineBlock.razor +++ b/MP-TAB3/Components/MachineBlock.razor @@ -56,10 +56,9 @@ else   @($" {RecMSE.PezziConf}")  
    - +   - @if (datiProdAct != null) + @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) { - @($" {datiProdAct.PzConfScarto}") + @($"(- {datiProdAct.PzConfScarto})") }
    @@ -116,10 +115,9 @@ else
    - +   - @if (datiProdAct != null) + @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) { - @($" {datiProdAct.PzConfScarto}") + @($"(- {datiProdAct.PzConfScarto})") }
    @**@ @@ -166,10 +164,9 @@ else   @($"{RecMSE.PezziConf}")
    - +   - @if (datiProdAct != null) + @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) { - @($" {datiProdAct.PzConfScarto}") + @($"(- {datiProdAct.PzConfScarto})") }
    @@ -192,7 +189,7 @@ else @if (!string.IsNullOrEmpty(IdxMacchSub)) {
    - @IdxMacchSub + @IdxMacchSub
    }
    diff --git a/MP-TAB3/Components/OdlMan.razor b/MP-TAB3/Components/OdlMan.razor index 0728cf73..fe062f5e 100644 --- a/MP-TAB3/Components/OdlMan.razor +++ b/MP-TAB3/Components/OdlMan.razor @@ -44,7 +44,7 @@
    }
    -
    +
    -
    + @if (!odlOk) { diff --git a/MP-TAB3/Components/OdlMan.razor.cs b/MP-TAB3/Components/OdlMan.razor.cs index a5a87646..26dbe4ce 100644 --- a/MP-TAB3/Components/OdlMan.razor.cs +++ b/MP-TAB3/Components/OdlMan.razor.cs @@ -24,7 +24,22 @@ namespace MP_TAB3.Components public EventCallback> E_Updated { get; set; } [Parameter] - public MappaStatoExpl? RecMSE { get; set; } = null; + public MappaStatoExpl? RecMSE + { + get => currRecMSE; + set + { + // salvo SOLO SE non sono in conferma + if (!setupActive) + { + currRecMSE = value; + } + } + } + + private bool setupActive { get; set; } = false; + + private MappaStatoExpl? currRecMSE { get; set; } = null; #endregion Public Properties @@ -68,6 +83,7 @@ namespace MP_TAB3.Components get => idxPOdlSel; set { + setupActive = value != 0; if (idxPOdlSel != value) { idxPOdlSel = value; @@ -707,27 +723,33 @@ namespace MP_TAB3.Components } protected override async Task OnParametersSetAsync() { - if (RecMSE != null) + if (!setupActive) { - if (string.IsNullOrEmpty(IdxMaccSel)) + if (RecMSE != null) { - IdxMaccSel = RecMSE.IdxMacchina; - } - isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1; - if (isMulti) - { - var idxMSel = MServ.UserPrefGet(IdxMaccSel); - if (!string.IsNullOrEmpty(idxMSel)) + if (string.IsNullOrEmpty(IdxMaccSel)) { - IdxMaccSel = idxMSel; + IdxMaccSel = RecMSE.IdxMacchina; } + isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1; + if (isMulti) + { + var idxMSel = MServ.UserPrefGet(IdxMaccSel); + if (!string.IsNullOrEmpty(idxMSel)) + { + IdxMaccSel = idxMSel; + } + } + IdxMaccParent = getIdxMaccParent(); } - IdxMaccParent = getIdxMaccParent(); + checkAll(); + // verifica stato inAttr + await CheckAttr(); + await ReloadData(true); } - checkAll(); - // verifica stato inAttr - await CheckAttr(); - await ReloadData(true); + // verifica conferma produzione + datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, DateTime.Now); + checkConfProd(); } protected async Task ProdEnd() @@ -844,6 +866,12 @@ namespace MP_TAB3.Components //NavMan.NavigateTo(NavMan.Uri, true); } + protected void GoToMachDetail() + { + // navigo! + NavMan.NavigateTo($"machine-detail"); + } + protected async Task refreshAfterFixOdl(bool has2Refr) { if (has2Refr) @@ -1340,6 +1368,10 @@ namespace MP_TAB3.Components if (datiProdAct != null) { needConfProd = datiProdAct.Pz2RecTot > 0 && !isSlave; + if(needConfProd) + { + StateHasChanged(); + } } } diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index d5b79bae..56bca35d 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2401.812 + 6.16.2401.817 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 520d2f65..6795892e 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

    Versione: 6.16.2401.812

    +

    Versione: 6.16.2401.817


    Note di rilascio:
    • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 85d5ceec..4a3d088b 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2401.812 +6.16.2401.817 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 0f33b222..dbbf728a 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2401.812 + 6.16.2401.817 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 From 3ce38089951c900f8ba01fc6de9c6d5dbe21c219 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 8 Jan 2024 20:19:17 +0100 Subject: [PATCH 4/7] Fix extra prod --- MP-TAB3/Components/MachineBlock.razor | 65 ++++++++++++++---------- MP-TAB3/Components/MachineBlock.razor.cs | 11 ++-- MP-TAB3/Components/ProdConfirm.razor.cs | 13 ++--- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- 7 files changed, 58 insertions(+), 39 deletions(-) diff --git a/MP-TAB3/Components/MachineBlock.razor b/MP-TAB3/Components/MachineBlock.razor index c1e19ff9..11a0cd91 100644 --- a/MP-TAB3/Components/MachineBlock.razor +++ b/MP-TAB3/Components/MachineBlock.razor @@ -94,7 +94,6 @@ else } else { -
      @@ -106,24 +105,26 @@ else
      @if (showCard) { -
      - @*
      *@ -
      -
      -
      - @($"{RecMSE.PezziConf}") +
      +
      +
      +
      +  @($"{RecMSE.PezziConf}") +
      + @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) + { +
      +
      + @($"(- {datiProdAct.PzConfScarto})") +
      +
      + }
      -
      - @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) - { - @($"(- {datiProdAct.PzConfScarto})") - } -
      - @*
      *@ -
      -
      -
      @($"{RecMSE.PezziProd}")
      +
      +
      +  @($"{RecMSE.PezziProd}") +
      @@ -158,10 +159,13 @@ else
      -
      -
      -
      -   @($"{RecMSE.PezziConf}") +
      + Pz.Confermati + +
      +
      +
      + @($"{RecMSE.PezziConf}")
      @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) @@ -172,13 +176,22 @@ else
      -
      +
      + Pz.Prodotti + +
      @($"{RecMSE.PezziProd}")
      -
      -
      -
      @($"{RecMSE.extraVal}")
      -
      + @if (RecMSE.extraVal > 0) + { +
      +
      + Extra + +
      +
      @($"{RecMSE.extraVal}")
      +
      + }
      diff --git a/MP-TAB3/Components/MachineBlock.razor.cs b/MP-TAB3/Components/MachineBlock.razor.cs index 9251f62b..c129bc10 100644 --- a/MP-TAB3/Components/MachineBlock.razor.cs +++ b/MP-TAB3/Components/MachineBlock.razor.cs @@ -175,14 +175,14 @@ namespace MP_TAB3.Components { DateTime adesso = DateTime.Now; isLoading = RecMSE == null; - // controllo SE avessi idxMacchSub --> rileggo! + // controllo SE ho variazioni così rileggo if (RecMSE != null) { - if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.NumPezzi) + if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.PezziProd) { datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso); SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct); - SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.NumPezzi); + SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.PezziProd); } else { @@ -207,6 +207,11 @@ namespace MP_TAB3.Components if (RecMSE.PezziConf > 0) { innerCircleVals.Add(new CircleGaugeMulti.CircSegm() { Color = "#198754", Value = RecMSE.PezziConf }); + // se ho scarti aggiungo all'inizio + if (datiProdAct != null && datiProdAct.PzConfScarto > 0) + { + innerCircleVals.Add(new CircleGaugeMulti.CircSegm() { Color = "#CD1916", Value = datiProdAct.PzConfScarto }); + } } if (RecMSE.extraVal > 0) { diff --git a/MP-TAB3/Components/ProdConfirm.razor.cs b/MP-TAB3/Components/ProdConfirm.razor.cs index 7fe2096d..df4b4d22 100644 --- a/MP-TAB3/Components/ProdConfirm.razor.cs +++ b/MP-TAB3/Components/ProdConfirm.razor.cs @@ -76,15 +76,11 @@ namespace MP_TAB3.Components get => numPzConfermati - numPzLasciati; } - //protected int lblPzBuo2Rec { get; set; } = 0; protected int lblPz2RecScarto { get => numPzScarto2Rec; } - [Inject] - protected StatusData MDataService { get; set; } = null!; - [Inject] protected MessageService MsgServ { get; set; } = null!; @@ -131,6 +127,9 @@ namespace MP_TAB3.Components get => (RecMSE != null && RecMSE.IdxOdl > 0); } + [Inject] + protected StatusData SDService { get; set; } = null!; + [Inject] protected SharedMemService SMServ { get; set; } = null!; @@ -210,7 +209,7 @@ namespace MP_TAB3.Components // refresh tabella dati tablet... await TabDServ.RicalcMse(IdxMaccSel, 0); // rileggo e salvo.. - var ListMSE = await MDataService.MseGetAll(true); + var ListMSE = await SDService.MseGetAll(true); if (ListMSE != null) { // salvo in LocalStorage... @@ -224,6 +223,8 @@ namespace MP_TAB3.Components confProdActive = false; numPzLasciati = 0; dtReqUpdate = DateTime.Now; + // azzero cache pezzi conf + SDService.MachNumPzSet(IdxMaccSel, -1); await DoUpdate(); await Task.Delay(1); await RefreshData(); @@ -318,7 +319,7 @@ namespace MP_TAB3.Components private async Task RefreshData() { - List ListMSE = await MDataService.MseGetAll(true); + List ListMSE = await SDService.MseGetAll(true); await MsgServ.SaveMse(ListMSE); await E_Updated.InvokeAsync(ListMSE); } diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 56bca35d..644f2716 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2401.817 + 6.16.2401.820 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 6795892e..fbef759e 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

      Versione: 6.16.2401.817

      +

      Versione: 6.16.2401.820


      Note di rilascio:
      • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 4a3d088b..6b4cf5ee 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2401.817 +6.16.2401.820 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index dbbf728a..184126ca 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2401.817 + 6.16.2401.820 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 From 595ea40e6cedbae78579b2a96991bb8048030de0 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 9 Jan 2024 08:29:22 +0100 Subject: [PATCH 5/7] Fix grafico dettaglio macchina --- MP-TAB3/Components/MachineBlock.razor | 87 ++++++++++++++------------- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- 5 files changed, 49 insertions(+), 46 deletions(-) diff --git a/MP-TAB3/Components/MachineBlock.razor b/MP-TAB3/Components/MachineBlock.razor index 11a0cd91..e24b1eab 100644 --- a/MP-TAB3/Components/MachineBlock.razor +++ b/MP-TAB3/Components/MachineBlock.razor @@ -150,77 +150,80 @@ else else {
        -
        -
        -
        -

        - @RecMSE.Nome -

        -
        -
        +
        +
        +
        -
        - Pz.Confermati - +
        + Confermati + @* *@
        -
        -
        - @($"{RecMSE.PezziConf}") -
        -
        - @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) - { - @($"(- {datiProdAct.PzConfScarto})") - } -
        +
        + @($"{RecMSE.PezziConf}")
        -
        -
        - Pz.Prodotti - + @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) + { +
        +
        + Scarto +
        +
        + @($"- {datiProdAct.PzConfScarto}") +
        -
        @($"{RecMSE.PezziProd}")
        + } +
        +
        + Prodotti + @* *@ +
        +
        @($"{RecMSE.PezziProd}")
        @if (RecMSE.extraVal > 0) {
        -
        +
        Extra - -
        -
        @($"{RecMSE.extraVal}")
        + @* *@ +
        +
        @($"{RecMSE.extraVal}")
        }
        -
        +
        +

        + @RecMSE.Nome +

        -
        -
        +
        +
        @if (!string.IsNullOrEmpty(IdxMacchSub)) { -
        - @IdxMacchSub +
        + @IdxMacchSub
        } +
        +
        -
        ART:
        -
        @($"{RecMSE.CodArticolo}")
        +
        ART
        +
        @RecMSE.CodArticolo
        -
        ODL:
        -
        @($"ODL{RecMSE.IdxOdl:00000000}")
        +
        ODL
        +
        @RecMSE.IdxOdl
        -
        PODL:
        -
        @($"PODL{RecMSE.IdxPOdl:00000000}")
        +
        PODL:
        +
        @RecMSE.IdxPOdl
        -
        +
        diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 644f2716..f0034ddb 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2401.820 + 6.16.2401.908 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index fbef759e..94813b65 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

        Versione: 6.16.2401.820

        +

        Versione: 6.16.2401.908


        Note di rilascio:
        • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 6b4cf5ee..11439f7d 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2401.820 +6.16.2401.908 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 184126ca..19f0b99e 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2401.820 + 6.16.2401.908 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 From 98d3f13972b71fde866804b1317768c50eb8b821 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 9 Jan 2024 18:41:28 +0100 Subject: [PATCH 6/7] Bozza pagina Energy (fake demo) --- MP.Stats/MP.Stats.csproj | 6 +- MP.Stats/Pages/Energy.razor | 88 ++++++++++++ MP.Stats/Pages/Energy.razor.cs | 214 ++++++++++++++++++++++++++++++ MP.Stats/Resources/ChangeLog.html | 2 +- MP.Stats/Resources/VersNum.txt | 2 +- MP.Stats/Resources/manifest.xml | 2 +- MP.Stats/Shared/NavMenu.razor | 5 + 7 files changed, 313 insertions(+), 6 deletions(-) create mode 100644 MP.Stats/Pages/Energy.razor create mode 100644 MP.Stats/Pages/Energy.razor.cs diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index c653bf46..c6ca10bf 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,8 +4,8 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2311.1009 - 6.16.2311.1009 + 6.16.2401.0914 + 6.16.2401.0914 @@ -186,7 +186,7 @@ - + diff --git a/MP.Stats/Pages/Energy.razor b/MP.Stats/Pages/Energy.razor new file mode 100644 index 00000000..0e5554c5 --- /dev/null +++ b/MP.Stats/Pages/Energy.razor @@ -0,0 +1,88 @@ +@page "/Energy" + +@using MP.Stats.Components + +
          +
          + +
          +
          + @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
          Nessun record trovato
          + } + else + { +
          +
          + + + + + + + + + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + + + + + } + +
          MacchinaCommessa/ODLArticoloInizioFineUnitEnergyGasP1P2P3
          @record.IdxMacchina +
          @record.KeyRichiesta
          +
          @record.IdxOdl
          +
          + @record.CodArticolo +
          @record.DescArticolo
          +
          @record.DataInizio@record.DataFine@(record.NumPezziEv + 200) m + @{ + double currSim = simVal(record.NumPezzi, record.NumPezziEv + 200); + double currSimGas = simVal(record.NumPezzi, record.NumPezziEv + 200); + } +
          + @currSim.ToString("N2") kWh +
          + + @righDiv(currSim, record.NumPezziEv + 200).ToString("N1") kWh/m + +
          +
          + @currSim.ToString("N2") m3 +
          + + @righDiv(currSim, record.NumPezziEv + 200).ToString("N1") m3/m + +
          @($"{currSim:N1}")@($"{currSimGas:N1}")@($"{currSim + currSimGas:N1}")
          +
          +
          + } +
          + +
          \ No newline at end of file diff --git a/MP.Stats/Pages/Energy.razor.cs b/MP.Stats/Pages/Energy.razor.cs new file mode 100644 index 00000000..c367b36d --- /dev/null +++ b/MP.Stats/Pages/Energy.razor.cs @@ -0,0 +1,214 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.Stats.Pages +{ + public partial class Energy : ComponentBase, IDisposable + { + #region Private Fields + + private MP.Data.DatabaseModels.StatsODL currRecord = null; + + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Protected Fields + + protected string fileName = "ODL.csv"; + + #endregion Protected Fields + + #region Private Properties + + private SelectData currFilter + { + get + { + return MessageService.ODL_Filter; + } + set + { + MessageService.ODL_Filter = value; + } + } + + private int currPage { get; set; } = 1; + + private string fullPath + { + get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}"; + } + + private bool isLoading { get; set; } = false; + private int numRecord { get; set; } = 10; + + #endregion Private Properties + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MessageService MessageService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + [Inject] + protected MpStatsService StatService { get; set; } + + protected int totalCount + { + get + { + int answ = 0; + if (SearchRecords != null) + { + answ = SearchRecords.Count; + } + return answ; + } + } + + #endregion Protected Properties + + #region Private Methods + + private async void clearFile() + { + await Task.Run(() => File.Delete(fullPath)); + } + + private async Task ExportCsv() + { + isLoading = true; + // salvo davvero! + await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + isLoading = false; + } + + private async Task ReloadData() + { + SearchRecords = await StatService.StatOdlGetAll(currFilter, MessageService.SearchVal); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + } + + #endregion Private Methods + + #region Protected Methods + + protected async Task DoFilter(SelectData newFilter) + { + clearFile(); + SearchRecords = null; + ListRecords = null; + currFilter = newFilter; + await ReloadData(); + } + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + await ReloadData(); + } + + protected async Task ForceReloadPage(int newNum) + { + currPage = newNum; + await ReloadData(); + } + + protected override async Task OnInitializedAsync() + { + clearFile(); + numRecord = 10; + MessageService.ShowSearch = false; + MessageService.PageName = "Report ODL/Comm."; + MessageService.PageIcon = "oi oi-book"; + MessageService.EA_SearchUpdated += OnSeachUpdated; + await ReloadData(); + } + + protected void ResetData() + { + clearFile(); + StatService.rollBackEdit(currRecord); + currRecord = null; + } + + protected async Task ResetFilter(SelectData newFilter) + { + clearFile(); + currRecord = null; + SearchRecords = null; + ListRecords = null; + currFilter = SelectData.Init(5, 7); + await ReloadData(); + } + + protected async Task UpdateData() + { + currRecord = null; + await ReloadData(); + } + + #endregion Protected Methods + + #region Public Methods + + public string checkSelect(int IdxODL) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxOdl == IdxODL) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + public void Dispose() + { + MessageService.EA_SearchUpdated -= OnSeachUpdated; + } + + public async void OnSeachUpdated() + { + await InvokeAsync(() => + { + Task task = UpdateData(); + StateHasChanged(); + }); + } + + #endregion Public Methods + + protected double righDiv(double num, double den) + { + if (den == 0) + { + den = 1; + } + double answ = num / den; + return answ; + } + protected double simVal(double minVal, double maxVal) + { + Random rnd = new Random(); + return rnd.NextDouble() * (maxVal - minVal) + minVal; + } + } +} \ No newline at end of file diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index fc337935..0e6160b8 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

          Versione: 6.16.2311.1009

          +

          Versione: 6.16.2401.0914


          Note di rilascio:
            diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index cf39a0ed..c318ff4f 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2311.1009 +6.16.2401.0914 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index 39ed393f..8bc8e35a 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2311.1009 + 6.16.2401.0914 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Shared/NavMenu.razor b/MP.Stats/Shared/NavMenu.razor index 39754f97..1c6487c0 100644 --- a/MP.Stats/Shared/NavMenu.razor +++ b/MP.Stats/Shared/NavMenu.razor @@ -17,6 +17,11 @@ TRS/OEE % +