diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f731a786..783b7936 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,8 @@ variables: APP_NAME: 'MP.Stats' SOL_NAME: 'MP-STATS' + # nota: cer creazione rules: https://docs.gitlab.com/ee/ci/jobs/job_control.html#common-if-clauses-for-rules + # helper x fix pacchetti nuget da repo locale nexus.steamware.net .nuget-fix: &nuget-fix - | @@ -90,10 +92,16 @@ LAND:build: variables: APP_NAME: MP.Land SOL_NAME: MP-LAND + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/LAND.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" script: + - echo $CI_COMMIT_BRANCH - dotnet build $env:APP_NAME/$env:APP_NAME.csproj PROG:build: @@ -103,6 +111,11 @@ PROG:build: variables: APP_NAME: MP.Prog SOL_NAME: MP-PROG + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/PROG.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -116,6 +129,11 @@ STAT:build: variables: APP_NAME: MP.Stats SOL_NAME: MP-STATS + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/STAT.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -129,6 +147,11 @@ MON:build: variables: APP_NAME: MP.Mon SOL_NAME: MP-MON + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/MON.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -142,6 +165,11 @@ SPEC:build: variables: APP_NAME: MP.SPEC SOL_NAME: MP-SPEC + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/SPEC.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -155,6 +183,11 @@ INVE:build: variables: APP_NAME: MP.INVE SOL_NAME: MP-INVE + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/INVE.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -168,6 +201,11 @@ CONF:build: variables: APP_NAME: IobConf.UI SOL_NAME: IobConf + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/CONF.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -181,6 +219,11 @@ IOC:build: variables: APP_NAME: MP.IOC SOL_NAME: MP-IOC + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/IOC.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -194,6 +237,11 @@ TAB3:build: variables: APP_NAME: MP-TAB-SERV SOL_NAME: MP-TAB3 + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH =~ /^feature\/TAB.+/ + when: always before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" @@ -212,8 +260,10 @@ LAND:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/LAND.+/ + when: always needs: ["LAND:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -229,8 +279,10 @@ PROG:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/PROG.+/ + when: always needs: ["PROG:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -246,8 +298,10 @@ STAT:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/STAT.+/ + when: always needs: ["STAT:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -263,8 +317,10 @@ MON:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/MON.+/ + when: always needs: ["MON:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -280,8 +336,10 @@ SPEC:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/SPEC.+/ + when: always needs: ["SPEC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -297,8 +355,10 @@ INVE:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/INVE.+/ + when: always needs: ["INVE:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -314,8 +374,10 @@ CONF:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/CONF.+/ + when: always needs: ["CONF:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -331,8 +393,10 @@ IOC:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/IOC.+/ + when: always needs: ["IOC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -348,8 +412,10 @@ TAB3:IIS01:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'develop' + - if: $CI_COMMIT_BRANCH =~ /^feature\/TAB.+/ + when: always needs: ["TAB3:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -366,8 +432,8 @@ LAND:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["LAND:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -384,8 +450,8 @@ PROG:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["PROG:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -402,8 +468,8 @@ STAT:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["STAT:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -420,8 +486,8 @@ MON:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["MON:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -438,8 +504,8 @@ SPEC:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["SPEC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -456,8 +522,8 @@ INVE:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["INVE:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -474,8 +540,8 @@ CONF:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["CONF:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -492,8 +558,8 @@ IOC:IIS02:deploy: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop + rules: + - if: $CI_COMMIT_BRANCH == 'master' needs: ["IOC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -512,9 +578,9 @@ LAND:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["LAND:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -534,9 +600,9 @@ PROG:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["PROG:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -556,9 +622,9 @@ STAT:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["STAT:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -578,9 +644,9 @@ MON:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["MON:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -600,9 +666,9 @@ SPEC:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["SPEC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -622,9 +688,9 @@ INVE:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["INVE:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -644,7 +710,7 @@ INVE:installer: # before_script: # - *nuget-fix # - dotnet restore "$env:SOL_NAME.sln" -# only: +# rules: # - develop # - master # needs: ["CONF:build"] @@ -666,9 +732,9 @@ IOC:installer: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - develop - - master + rules: + - if: $CI_COMMIT_BRANCH == 'master' + - if: $CI_COMMIT_BRANCH == 'develop' needs: ["IOC:build"] script: - dotnet build $env:APP_NAME/$env:APP_NAME.csproj @@ -689,10 +755,8 @@ LAND:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["LAND:build"] artifacts: paths: @@ -712,12 +776,8 @@ PROG:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - #- feature/Deploy_CI_CD - # - master - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["PROG:build"] artifacts: paths: @@ -737,12 +797,8 @@ STAT:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - #- feature/Deploy_CI_CD - # - master - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["STAT:build"] artifacts: paths: @@ -762,10 +818,8 @@ MON:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["MON:build"] artifacts: paths: @@ -785,10 +839,8 @@ SPEC:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["SPEC:build"] artifacts: paths: @@ -808,10 +860,8 @@ INVE:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["INVE:build"] artifacts: paths: @@ -831,10 +881,8 @@ CONF:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["CONF:build"] artifacts: paths: @@ -854,10 +902,8 @@ IOC:release: before_script: - *nuget-fix - dotnet restore "$env:SOL_NAME.sln" - only: - - tags - except: - - branches + rules: + - if: $CI_COMMIT_TAG needs: ["IOC:build"] artifacts: paths: diff --git a/MP-TAB-SERV/Components/CmpFooter.razor.cs b/MP-TAB-SERV/Components/CmpFooter.razor.cs index 89ea2480..da0756bb 100644 --- a/MP-TAB-SERV/Components/CmpFooter.razor.cs +++ b/MP-TAB-SERV/Components/CmpFooter.razor.cs @@ -1,9 +1,18 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.Services; using NLog; namespace MP_TAB_SERV.Components { public partial class CmpFooter : IDisposable { + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + [Inject] + protected MessageService MsgServ { get; set; } = null!; + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + #region Public Methods public void Dispose() @@ -18,10 +27,16 @@ namespace MP_TAB_SERV.Components public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) { + var diffOfTime = DateTime.Now - MsgServ.dtLastAction; + var pUpd = Task.Run(async () => { await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); + if(diffOfTime.Minutes >= dtTimerScadenzaLogin) + { + NavMan.NavigateTo("logout"); + } //Log.Trace("CmpFooter Timer elapsed"); }); pUpd.Wait(); @@ -29,7 +44,7 @@ namespace MP_TAB_SERV.Components public void StartTimer() { - int tOutPeriod = 5000; + int tOutPeriod = dtTimerScadenzaLogin * 60000; aTimer = new System.Timers.Timer(tOutPeriod); aTimer.Elapsed += ElapsedTimer; aTimer.Enabled = true; @@ -40,12 +55,26 @@ namespace MP_TAB_SERV.Components #region Protected Methods - protected override void OnInitialized() + int dtTimerScadenzaLogin { get; set; } = 0; + + protected override async Task OnInitializedAsync() { - var rawVers = typeof(Program).Assembly.GetName().Version; ; + await Task.Delay(1); + var rawVers = typeof(Program).Assembly.GetName().Version; version = rawVers != null ? rawVers : new Version("0.0.0.0"); - StartTimer(); + //dtTimerScadenzaLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin"); + //dtTimerScadenzaLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin"); + + //if (dtTimerScadenzaLogin > 0) + //{ + // //StartTimer(); + //} + } + //protected override void OnInitialized() + //{ + + //} #endregion Protected Methods diff --git a/MP-TAB-SERV/Components/CmpTop.razor b/MP-TAB-SERV/Components/CmpTop.razor new file mode 100644 index 00000000..bde404e3 --- /dev/null +++ b/MP-TAB-SERV/Components/CmpTop.razor @@ -0,0 +1,27 @@ +
+
+ + + @UserName + + [@MatrOpr] +
+
+
+   + MapoTAB2 +   + +
+
+
+ @if (!HideMenu) + { +
+
+ +
+
+ } +
+
diff --git a/MP-TAB-SERV/Components/CmpTop.razor.cs b/MP-TAB-SERV/Components/CmpTop.razor.cs new file mode 100644 index 00000000..8f465e08 --- /dev/null +++ b/MP-TAB-SERV/Components/CmpTop.razor.cs @@ -0,0 +1,226 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data.DTO; +using MP.Data.Services; +using MP_TAB_SERV.Pages; +using Newtonsoft.Json; +using NLog; +using System.Diagnostics; + +namespace MP_TAB_SERV.Components +{ + public partial class CmpTop + { + #region Public Properties + + [Parameter] + public List CurrMenuItems { get; set; } = new List(); + + #endregion Public Properties + + #region Protected Fields + + protected string ResetClass = "btn-primary"; + + #endregion Protected Fields + + #region Protected Properties + + protected string CurrOprTknLS { get; set; } = null!; + 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 bool HideMenu + { + get => NavMan.Uri.Contains("reg-new-device"); + } + + [Inject] + protected ListSelectDataSrv MDataService { get; set; } = null!; + + [Inject] + protected MessageService MsgServ { get; set; } = null!; + + [Inject] + protected SharedMemService MStor { get; set; } = null!; + + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TDService { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected async Task RefreshLogIn(string decodValue) + { + bool done = await MsgServ.DoLogIn(decodValue); + if (done) + { + if (!string.IsNullOrEmpty(LastOpenedPage) && !string.IsNullOrEmpty(CurrMacc)) + { + NavMan.NavigateTo(LastOpenedPage); + } + else + { + NavMan.NavigateTo("status-map"); + } + } + } + + protected async Task ForceReload() + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + Log.Info("Start ForceReload"); + ResetClass = "btn-warning"; + await InvokeAsync(StateHasChanged); + var currToken = await MsgServ.GetCurrOperDtoAsync(); + var lastOpr = await MsgServ.GetLastMatrOprAsync(); + // reset cache varie + await MsgServ.ClearLocalStor(); + await MsgServ.ClearSessionStor(); + await MDataService.FlushCache(); + // salvo di nuovo opr + await MsgServ.SetLastMatrOprAsync(lastOpr); + await MsgServ.SetCurrOperDtoAsync(currToken); + // reload MStor + await ReloadMemStor(); + // calcolo tempo esecuzione + sw.Stop(); + int delta = 500 - (int)sw.ElapsedMilliseconds; + delta = delta > 0 ? delta : 50; + await Task.Delay(delta); + ResetClass = "btn-primary"; + // await InvokeAsync(StateHasChanged); + Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms"); + // ricarica pagina! + NavMan.NavigateTo("status-map"); + } + + protected async Task backToSM() + { + await Task.Delay(1); + if (!NavMan.Uri.Contains("reg-new-device")) + { + + await MsgServ.IdxMaccSet(""); + NavMan.NavigateTo("status-map"); + } + } + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + int expDays = SMServ.GetConfInt("cookieDayExpire"); + expDT = DateTime.Now.AddDays(expDays); + + 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) + { + await RefreshLogIn(decodedUrl); + } + + CurrOprTknRedis = await TDService.OperatoreGetRedis(MatrOpr); + + + if (CurrOprTknRedis == "") + { + if (!NavMan.Uri.Contains("reg-new-device")) + { + NavMan.NavigateTo("reg-new-device", true); + } + } + else if (CurrOprTknRedis != "") + { + //if (!NavMan.Uri.Contains("status-map")) + //{ + //} + //if (LastOpenedPage != "") + //{ + // NavMan.NavigateTo(LastOpenedPage, true); + //} + } + } + + 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 + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + #endregion Private Fields + + #region Private Properties + + private int MatrOpr + { + get => MsgServ.MatrOpr; + } + + private string UserName + { + get => MsgServ.CognomeNome; + } + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/ControlsMan.razor b/MP-TAB-SERV/Components/ControlsMan.razor index 96861d63..97f4ad5e 100644 --- a/MP-TAB-SERV/Components/ControlsMan.razor +++ b/MP-TAB-SERV/Components/ControlsMan.razor @@ -1,31 +1,46 @@  -
-
-

Tipo Selezione

-
-
-
- - -
-
-
-@if (useOdl) -{ - -} -else -{ - -} +
- + @if (enableControlli) + { + @if (RecMSE.IdxOdl > 0) + { + + } + else + { +
ODL non presente!
+ } + } + else + { +
Registrazione controlli disabilitata
+ } +
+
+

Tipo Selezione

+
+
+
+ + +
+
+
+ @if (useOdl) + { + + } + else + { + + } @if (showInsert) { @if (showNote) diff --git a/MP-TAB-SERV/Components/ControlsMan.razor.cs b/MP-TAB-SERV/Components/ControlsMan.razor.cs index 027553c8..83d548d4 100644 --- a/MP-TAB-SERV/Components/ControlsMan.razor.cs +++ b/MP-TAB-SERV/Components/ControlsMan.razor.cs @@ -53,16 +53,21 @@ namespace MP_TAB_SERV.Components [Inject] protected TabDataService TabDServ { get; set; } = null!; + [Inject] + protected SharedMemService SMServ { 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); DateTime inizio = fine.AddDays(-8); diff --git a/MP-TAB-SERV/Components/DeclarMan.razor b/MP-TAB-SERV/Components/DeclarMan.razor index e1dfd528..53ff08ca 100644 --- a/MP-TAB-SERV/Components/DeclarMan.razor +++ b/MP-TAB-SERV/Components/DeclarMan.razor @@ -1,29 +1,31 @@  -
-
-

Tipo Selezione

-
-
-
- - -
-
-
-@if (useOdl) -{ - -} -else -{ - -} + +
-
+
+
+
+

Tipo Selezione

+
+
+
+ + +
+
+
+ @if (useOdl) + { + + } + else + { + + }
diff --git a/MP-TAB-SERV/Components/FixOdl.razor b/MP-TAB-SERV/Components/FixOdl.razor index e8998715..f2f19fd6 100644 --- a/MP-TAB-SERV/Components/FixOdl.razor +++ b/MP-TAB-SERV/Components/FixOdl.razor @@ -6,6 +6,31 @@

Riassegnazione ODL

+ +
+
+ + +
+ + +
+
+
+
+ @if (IdxOdlSel > 0) + { + + } +

Ultimi ODL lavorati:

@@ -35,7 +60,7 @@
-
+
@($"{item.DataFine:yyyy.MM.dd HH:mm:ss}")
@@ -61,30 +86,8 @@ -
-
- - -
- - -
-
-
-
- @if (IdxOdlSel > 0) - { - - } -
+ + } diff --git a/MP-TAB-SERV/Components/LongStopList.razor b/MP-TAB-SERV/Components/LongStopList.razor index c1566122..f9981a6b 100644 --- a/MP-TAB-SERV/Components/LongStopList.razor +++ b/MP-TAB-SERV/Components/LongStopList.razor @@ -51,7 +51,15 @@ - } + } + else + { +
+ +
+ }
@@ -66,6 +74,9 @@
} + } diff --git a/MP-TAB-SERV/Components/MachineBlock.razor b/MP-TAB-SERV/Components/MachineBlock.razor index 42835411..ccec9133 100644 --- a/MP-TAB-SERV/Components/MachineBlock.razor +++ b/MP-TAB-SERV/Components/MachineBlock.razor @@ -58,15 +58,19 @@ else
-   @($" {RecMSE.PezziConf:N0}")   +   @($" {RecMSE.PezziConf}")  
- +   @($" {0:N0}") + +   + @if (datiProdAct != null) + { + @($" {datiProdAct.PzConfScarto}") + }
-   @($" {RecMSE.PezziProd:N0}") +   @($" {RecMSE.PezziProd}")
@@ -111,16 +115,20 @@ else
- @($"{RecMSE.PezziConf:N0}") + @($"{RecMSE.PezziConf}")
- +   @($" {0:N0}") + +   + @if (datiProdAct != null) + { + @($" {datiProdAct.PzConfScarto}") + }
-
@($"{RecMSE.PezziProd:N0}")
+
@($"{RecMSE.PezziProd}")
ART.
@@ -153,20 +161,24 @@ else
- @($"{RecMSE.PezziConf:N0}") + @($"{RecMSE.PezziConf}")
- +   @($" {0:N0}") + +   + @if (datiProdAct != null) + { + @($" {datiProdAct.PzConfScarto}") + }
-
@($"{RecMSE.PezziProd:N0}")
+
@($"{RecMSE.PezziProd}")
-
@($"{RecMSE.extraVal:N0}")
+
@($"{RecMSE.extraVal}")
diff --git a/MP-TAB-SERV/Components/MachineBlock.razor.cs b/MP-TAB-SERV/Components/MachineBlock.razor.cs index 08617025..493cf73a 100644 --- a/MP-TAB-SERV/Components/MachineBlock.razor.cs +++ b/MP-TAB-SERV/Components/MachineBlock.razor.cs @@ -4,7 +4,6 @@ using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.Services; using NLog; -using static Org.BouncyCastle.Math.EC.ECCurve; namespace MP_TAB_SERV.Components { @@ -17,6 +16,11 @@ namespace MP_TAB_SERV.Components [Parameter] public bool FullMode { get; set; } = true; + [Parameter] + public int Height { get; set; } = 0; + + [Parameter] + public string IdxMacchSub { get; set; } = ""; [Parameter] public int keepAliveMin { get; set; } = 5; @@ -30,9 +34,6 @@ namespace MP_TAB_SERV.Components [Parameter] public int Width { get; set; } = 0; - [Parameter] - public int Height { get; set; } = 0; - #endregion Public Properties #region Public Methods @@ -96,6 +97,9 @@ namespace MP_TAB_SERV.Components #region Protected Properties + [Inject] + protected IConfiguration config { get; set; } = null!; + protected ProdAdvDispl.ProdCounter CurrCount { get @@ -123,14 +127,13 @@ namespace MP_TAB_SERV.Components [Inject] protected NavigationManager NavMan { get; set; } = null!; + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + #endregion Protected Properties #region Protected Methods - - [Inject] - protected IConfiguration config { get; set; } = null!; - protected override async Task OnAfterRenderAsync(bool firstRender) {//await Task.Delay(500); if (firstRender) @@ -143,7 +146,7 @@ namespace MP_TAB_SERV.Components //return base.OnAfterRenderAsync(firstRender); } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { isLoading = true; // se configurata uso cartella virtuale... altrimenti cartella processo @@ -156,11 +159,28 @@ namespace MP_TAB_SERV.Components { imgBasePath = $"{Environment.CurrentDirectory}/images/"; } + + + } - protected override void OnParametersSet() + /// + /// Dati produzioen rilevati + /// + protected StatoProdModel? datiProdAct { get; set; } = null; + protected override async Task OnParametersSetAsync() { + DateTime adesso = DateTime.Now; isLoading = RecMSE == null; + // controllo SE avessi idxMacchSub --> rileggo! + if (RecMSE != null) + { + datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso); + } + if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null) + { + RecMSE = TabDServ.MseGetSub(RecMSE.IdxMacchina, IdxMacchSub, true); + } setGaugeVals(); } @@ -192,6 +212,7 @@ namespace MP_TAB_SERV.Components { // salvo idxMacch await MServ.IdxMaccSet(RecMSE!.IdxMacchina); + await MServ.LastOpenedPageSet("machine-detail"); // navigo! NavMan.NavigateTo($"machine-detail"); } diff --git a/MP-TAB-SERV/Components/NotesEditor.razor b/MP-TAB-SERV/Components/NotesEditor.razor index 4e677c8a..7c93e784 100644 --- a/MP-TAB-SERV/Components/NotesEditor.razor +++ b/MP-TAB-SERV/Components/NotesEditor.razor @@ -1,15 +1,5 @@ 
- @if (ShowBtn) - { -
- -
- } - else + @if (!ShowBtn) {
@@ -18,7 +8,7 @@
- +
diff --git a/MP-TAB-SERV/Components/NotesEditor.razor.cs b/MP-TAB-SERV/Components/NotesEditor.razor.cs index a6af00a2..7282f87b 100644 --- a/MP-TAB-SERV/Components/NotesEditor.razor.cs +++ b/MP-TAB-SERV/Components/NotesEditor.razor.cs @@ -30,6 +30,8 @@ namespace MP_TAB_SERV.Components [Parameter] public bool CanSave { get; set; } = false; [Parameter] + public EventCallback E_relData { get; set; } + [Parameter] public CommentiModel? CurrComm { set @@ -101,8 +103,10 @@ namespace MP_TAB_SERV.Components #region Protected Methods - protected void doCancel() + protected async Task doCancel() { + + await E_relData.InvokeAsync(true); DoReset(); } @@ -136,9 +140,11 @@ namespace MP_TAB_SERV.Components // inserisco await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.commento); // reset + await E_relData.InvokeAsync(true); DoReset(); + //StateHasChanged(); //ToggleCtrl(); - await E_Updated.InvokeAsync(true); + } protected override void OnInitialized() @@ -245,6 +251,7 @@ namespace MP_TAB_SERV.Components { UserComment = ""; DateSel = DateTime.Now; + //CurrComm = null; ShowBtn = true; //StateHasChanged(); } diff --git a/MP-TAB-SERV/Components/NotesMan.razor b/MP-TAB-SERV/Components/NotesMan.razor index 8d43a10c..417f3357 100644 --- a/MP-TAB-SERV/Components/NotesMan.razor +++ b/MP-TAB-SERV/Components/NotesMan.razor @@ -1,5 +1,5 @@  - +
diff --git a/MP-TAB-SERV/Components/NotesMan.razor.cs b/MP-TAB-SERV/Components/NotesMan.razor.cs index da0df09a..8e5b22a5 100644 --- a/MP-TAB-SERV/Components/NotesMan.razor.cs +++ b/MP-TAB-SERV/Components/NotesMan.razor.cs @@ -90,7 +90,8 @@ namespace MP_TAB_SERV.Components { if (rel) { - await ReloadComments(); + await ReloadData(); + currComm = null; await InvokeAsync(StateHasChanged); } } diff --git a/MP-TAB-SERV/Components/OdlMan.razor b/MP-TAB-SERV/Components/OdlMan.razor index 355f0de0..b3ce4602 100644 --- a/MP-TAB-SERV/Components/OdlMan.razor +++ b/MP-TAB-SERV/Components/OdlMan.razor @@ -13,7 +13,7 @@ @if (isSlave) {
-
+
@(Traduci("lblWarnHeadSlave"))
@(Traduci("lblWarnBodySlave"))
@@ -23,10 +23,34 @@ { @if (needConfProd) { + @if (showSplitOdlOnTavVal || showReopOdlTav) + { +
+
+
+ @if (showSplitOdlOnTavVal) + { + + } +
+
+ @if (showReopOdlTav) + { + + } +
+
+
+ }
@lblWarnHead
-
@lblWarnBody @numPz2Conf.ToString("N0") pz NC
+
+ @lblWarnBody +
+ Pezzi NC: @numPz2Conf.ToString("N0") +
+
@if (!odlOk) @@ -60,10 +84,10 @@
Check articolo in revisione
- @if (cancelSetupEnabled) + @if (cancelSetupEnabled && RecMSE.PezziConf == 0) {
- +
} @@ -96,7 +120,7 @@ P.ODL:
- @currPodl.IdxPromessa.ToString("N0") + @currPodl.IdxPromessa
@@ -199,7 +223,7 @@ }
-
+
+
+
+
Pz Prodotti CONFERMATI
+
+ +
- @*
- - -
*@ - @*
- - -
*@ -
-
-
+
@if (enablePzProdLasciati) { -
Lasciati
- - +
Pz Prodotti LASCIATI
+
+ +
} else { @@ -61,15 +54,40 @@ }
-
-
Pz Buoni @lblPz2RecBuoni
-
Pz scarto @lblPz2RecScarto
-
-
- @if (showConfirm) - { - - } +
+
+
+
+ Pz Buoni + @lblPz2RecBuoni +
+
+ Pz scarto + @lblPz2RecScarto +
+
+
+ @($"{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}") +
+
+ @if (showConfirm && lblPz2RecBuoni >= 0) + { + + } + else if (showConfirm && lblPz2RecBuoni < 0 && !chkPzBuoniNeg) + { + + } + else if (showConfirm && lblPz2RecBuoni < 0 && chkPzBuoniNeg) + { +
Pezzi buoni negativi!
+ } + else + { +
Completare le modifiche!
+ } +
+
@@ -80,14 +98,7 @@
Dati Globali ODL
-
-
- -
-
- -
-
+
@@ -102,7 +113,7 @@ } else { - @($"{numPzProdotti2Rec:N0}") + @numPzProdotti2Rec }
@@ -119,7 +130,7 @@ } else { - @numPzProdotti.ToString("N0") + @numPzProdotti }
@@ -136,7 +147,7 @@ } else { - @numPzScaConf.ToString("N0") + @numPzScaConf }
@@ -153,7 +164,7 @@ } else { - @numPzBuoniConf.ToString("N0") + @numPzBuoniConf }
@@ -161,6 +172,14 @@
+
@if (!string.IsNullOrEmpty(lblOut)) { diff --git a/MP-TAB-SERV/Components/ProdConfirm.razor.cs b/MP-TAB-SERV/Components/ProdConfirm.razor.cs index b9867dc0..50763870 100644 --- a/MP-TAB-SERV/Components/ProdConfirm.razor.cs +++ b/MP-TAB-SERV/Components/ProdConfirm.razor.cs @@ -14,6 +14,9 @@ namespace MP_TAB_SERV.Components [Parameter] public EventCallback E_inserting { get; set; } + [Parameter] + public EventCallback E_MachSel { get; set; } + /// /// registrato nuovo valore /// @@ -50,6 +53,10 @@ namespace MP_TAB_SERV.Components { get => showInnov ? "Nascondi conferma" : "Mostra conferma"; } + protected string ConfCssWidth + { + get => enableMagPrint ? "col-6" : "col-12"; + } /// /// Dati produzioen rilevati @@ -152,7 +159,9 @@ namespace MP_TAB_SERV.Components { IdxMaccSel = RecMSE.IdxMacchina; enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati"); + chkPzBuoniNeg = SMServ.GetConfBool("TAB_ChkConfPz"); confRett = SMServ.GetConfBool("confRett"); + enableMagPrint = SMServ.GetConfBool("enableMagPrint"); modoConfProd = SMServ.GetConfInt("modoConfProd"); await DoUpdate(); } @@ -176,11 +185,11 @@ namespace MP_TAB_SERV.Components RecMSE = ListMSE.Find(x => x.IdxMacchina == IdxMaccSel); } // mostro output - lblOut = $"Confermata produzione {numPzConfermati - numPzLasciati} pezzi (+{numPzLasciati} pz lasciati, +{numPzScarto2Rec:N0} pz scarto) |{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}"; + lblOut = $"Confermata produzione {numPzConfermati - numPzLasciati} pezzi (+{numPzLasciati} pz lasciati, +{numPzScarto2Rec} pz scarto) |{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}"; // cambio button conferma... showInnov = false; // sollevo evento! - dtReqUpdate = DateTime.Now; + //dtReqUpdate = DateTime.Now; numPzLasciati = 0; await DoUpdate(); await Task.Delay(1); @@ -196,20 +205,23 @@ namespace MP_TAB_SERV.Components protected async Task SetMacc(string selIdxMacc) { isProcessing = true; - await Task.Delay(10); + await Task.Delay(1); IdxMaccSel = selIdxMacc; await DoUpdate(); isProcessing = false; - await Task.Delay(10); + await Task.Delay(1); + await E_MachSel.InvokeAsync(selIdxMacc); } /// /// Cambio stato visibilità pannello e testo button /// - protected void ToggleConfProd() + protected async Task ToggleConfProd() { showInnov = !showInnov; dtReqUpdate = DateTime.Now; + await DoUpdate(); + StateHasChanged(); } #endregion Protected Methods @@ -219,6 +231,8 @@ namespace MP_TAB_SERV.Components private bool confRett = false; private bool enablePzProdLasciati = false; + private bool enableMagPrint = false; + private bool chkPzBuoniNeg = false; private string lblOut = ""; diff --git a/MP-TAB-SERV/Components/ProdPlanMan.razor b/MP-TAB-SERV/Components/ProdPlanMan.razor index cde2ec27..c2e6d0c9 100644 --- a/MP-TAB-SERV/Components/ProdPlanMan.razor +++ b/MP-TAB-SERV/Components/ProdPlanMan.razor @@ -72,7 +72,7 @@ else
- Tot: @($"{item.NumPezzi:N0}") + Tot: @($"{item.NumPezzi}")
@item.PzPallet pz/pal
diff --git a/MP-TAB-SERV/Components/ProdStat.razor b/MP-TAB-SERV/Components/ProdStat.razor index e425aa5e..90b8fd52 100644 --- a/MP-TAB-SERV/Components/ProdStat.razor +++ b/MP-TAB-SERV/Components/ProdStat.razor @@ -49,7 +49,7 @@ Nr Pezzi lanciati
- @($"{RecMSE.NumPezzi:N0}") pz. + @($"{RecMSE.NumPezzi}") pz.
@@ -68,22 +68,6 @@
- - - - - - - - - - - - - - - -
@@ -91,7 +75,7 @@ Nr pezzi fatti
- (@($"{RecMSE.PezziProd:N0}") pz.) + (@($"{RecMSE.PezziProd}") pz.)
diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor b/MP-TAB-SERV/Components/ScrapEditor.razor index 14b63d93..c3cbe104 100644 --- a/MP-TAB-SERV/Components/ScrapEditor.razor +++ b/MP-TAB-SERV/Components/ScrapEditor.razor @@ -10,6 +10,12 @@
+ @if(errMsg != "") + { +
+ @errMsg +
+ } @if (ShowDetail) {
diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor.cs b/MP-TAB-SERV/Components/ScrapEditor.razor.cs index 14d2d7e7..c21c933c 100644 --- a/MP-TAB-SERV/Components/ScrapEditor.razor.cs +++ b/MP-TAB-SERV/Components/ScrapEditor.razor.cs @@ -81,14 +81,26 @@ namespace MP_TAB_SERV.Components Note = UserComment }; // inserisco - await TabServ.RegScartiInsert(newRec); - - // reset - DoReset(); - //ToggleCtrl(); - await E_Updated.InvokeAsync(true); + var done = await TabServ.RegScartiInsert(newRec); + if (done) + { + // reset + DoReset(); + errMsg = ""; + //ToggleCtrl(); + await E_Updated.InvokeAsync(true); + await ReloadData(); + StateHasChanged(); + } + else + { + errMsg = "ODL non attivo o data/ora errato"; + } + ShowDetail = false; } + protected string errMsg { get; set; } = ""; + protected override async Task OnInitializedAsync() { await ReloadData(); diff --git a/MP-TAB-SERV/Components/ScrapMan.razor b/MP-TAB-SERV/Components/ScrapMan.razor index 9d18452a..d7eed171 100644 --- a/MP-TAB-SERV/Components/ScrapMan.razor +++ b/MP-TAB-SERV/Components/ScrapMan.razor @@ -1,33 +1,41 @@  -
-
-

Tipo Selezione

-
-
-
- - -
-
-
-@if (useOdl) -{ - -} -else -{ -
- -
-} +
-
- + @if (enableScarti) + { +
+ +
+ } + else + { +
Registrazione scarti disabilitata
+ } +
+
+

Tipo Selezione

+
+
+
+ + +
+
+ @if (useOdl) + { + + } + else + { +
+ +
+ }
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor.cs b/MP-TAB-SERV/Components/ScrapMan.razor.cs index dc8c5248..022eb904 100644 --- a/MP-TAB-SERV/Components/ScrapMan.razor.cs +++ b/MP-TAB-SERV/Components/ScrapMan.razor.cs @@ -50,16 +50,21 @@ namespace MP_TAB_SERV.Components [Inject] protected TabDataService TabDServ { get; set; } = null!; + [Inject] + protected SharedMemService SMServ { get; set; } = null!; #endregion Protected Properties #region Protected Methods + protected bool enableScarti { get; set; } = true; + protected override async Task OnInitializedAsync() { await Task.Delay(1); if (RecMSE != null) { + enableScarti = SMServ.GetConfBool("enableScarti"); IdxMaccSel = RecMSE.IdxMacchina; DateTime fine = DateTime.Today.AddDays(1); DateTime inizio = fine.AddDays(-8); diff --git a/MP-TAB-SERV/Components/SlideMenu.razor.cs b/MP-TAB-SERV/Components/SlideMenu.razor.cs index b6b3766f..0e102d29 100644 --- a/MP-TAB-SERV/Components/SlideMenu.razor.cs +++ b/MP-TAB-SERV/Components/SlideMenu.razor.cs @@ -1,5 +1,6 @@ using global::Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; +using MP.Data.Services; namespace MP_TAB_SERV.Components { @@ -16,6 +17,8 @@ namespace MP_TAB_SERV.Components [Inject] protected NavigationManager navManager { get; set; } = null!; + [Inject] + protected MessageService MsgServ { get; set; } = null!; #endregion Protected Properties @@ -29,6 +32,11 @@ namespace MP_TAB_SERV.Components protected async Task SetPage(string tgtUrl) { await Task.Delay(1); + if (tgtUrl.Contains("status-map")) + { + await MsgServ.IdxMaccSet(""); + } + await MsgServ.LastOpenedPageSet(tgtUrl); navManager.NavigateTo(tgtUrl); } diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index c93c3d22..9fd21e92 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2311.1016 + 6.16.2312.1115 enable MP_TAB_SERV @@ -17,15 +17,14 @@ - - + + - diff --git a/MP-TAB-SERV/Pages/Index.razor b/MP-TAB-SERV/Pages/Index.razor new file mode 100644 index 00000000..b5d0a9fb --- /dev/null +++ b/MP-TAB-SERV/Pages/Index.razor @@ -0,0 +1,20 @@ +@page "/" +@page "/home" + + + +@code { + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + } + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await Task.Delay(1); + } + + protected override async Task OnParametersSetAsync() + { + await Task.Delay(1); + } +} diff --git a/MP-TAB-SERV/Pages/Logout.razor b/MP-TAB-SERV/Pages/Logout.razor index a881db05..6579df65 100644 --- a/MP-TAB-SERV/Pages/Logout.razor +++ b/MP-TAB-SERV/Pages/Logout.razor @@ -1,8 +1,6 @@ @page "/logout" -

logout

+ -@code { -} diff --git a/MP-TAB-SERV/Pages/Logout.razor.cs b/MP-TAB-SERV/Pages/Logout.razor.cs new file mode 100644 index 00000000..81f91ac5 --- /dev/null +++ b/MP-TAB-SERV/Pages/Logout.razor.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +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_TAB_SERV; +using MP_TAB_SERV.Shared; +using MP_TAB_SERV.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_TAB_SERV.Pages +{ + public partial class Logout + { + [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!; + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + await localStorage.SetItemAsync("currTkn", ""); + await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr); + MsgServ.RigaOper = null; + NavMan.NavigateTo("reg-new-device"); + } + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor b/MP-TAB-SERV/Pages/MachineDetail.razor index ecda23b2..fd965bef 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor +++ b/MP-TAB-SERV/Pages/MachineDetail.razor @@ -8,7 +8,7 @@ } else { - - + + } diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor.cs b/MP-TAB-SERV/Pages/MachineDetail.razor.cs index c5e36643..67275899 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor.cs +++ b/MP-TAB-SERV/Pages/MachineDetail.razor.cs @@ -61,14 +61,19 @@ namespace MP_TAB_SERV.Pages } } + protected void SetMacc(string selIdxMacc) + { + IdxMaccSubSel = selIdxMacc; + } + #endregion Protected Methods #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); - private bool enableMagLotti = false; private bool enableSchedaTecnica = false; + private string IdxMaccSubSel = ""; #endregion Private Fields diff --git a/MP-TAB-SERV/Pages/ODL.razor b/MP-TAB-SERV/Pages/ODL.razor index 8fdeb1fa..cea8d71f 100644 --- a/MP-TAB-SERV/Pages/ODL.razor +++ b/MP-TAB-SERV/Pages/ODL.razor @@ -7,6 +7,6 @@ } else { - - + + } diff --git a/MP-TAB-SERV/Pages/ODL.razor.cs b/MP-TAB-SERV/Pages/ODL.razor.cs index 6e382c7d..487859a9 100644 --- a/MP-TAB-SERV/Pages/ODL.razor.cs +++ b/MP-TAB-SERV/Pages/ODL.razor.cs @@ -23,25 +23,6 @@ namespace MP_TAB_SERV.Pages await ReloadData(); } - #endregion Protected Methods - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - - protected async Task RefreshData(List newList) { var ListMSE = newList; @@ -69,6 +50,34 @@ namespace MP_TAB_SERV.Pages } } + protected void SetMacc(string selIdxMacc) + { + IdxMaccSubSel = selIdxMacc; + } + + #endregion Protected Methods + + #region Private Fields + + private string IdxMaccSubSel = ""; + + #endregion Private Fields + + #region Private Methods + + private async Task ReloadData() + { + if (string.IsNullOrEmpty(IdxMacc)) + { + IdxMacc = await MsgServ.IdxMaccGet(); + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + } + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/RegNewDevice.razor b/MP-TAB-SERV/Pages/RegNewDevice.razor new file mode 100644 index 00000000..2e07310a --- /dev/null +++ b/MP-TAB-SERV/Pages/RegNewDevice.razor @@ -0,0 +1,74 @@ +@page "/reg-new-device" + +
+ QR-Scan USER LOGIN +
+ + +
+ +
+ +@if (ShowScanBarcode) +{ + + + +
+
+ + + + +
+ + +
+
+ +
+
+
+} + +@if (oprsList.Count > 0) +{ +
+ Selezionare un operatore + +
+
+ User Auth Key + +
+} + +
+
+ +
+
+ +
+
+ + +@if (!string.IsNullOrEmpty(txtError)) +{ +
+ @txtError +
+} diff --git a/MP-TAB-SERV/Pages/RegNewDevice.razor.cs b/MP-TAB-SERV/Pages/RegNewDevice.razor.cs new file mode 100644 index 00000000..993a095c --- /dev/null +++ b/MP-TAB-SERV/Pages/RegNewDevice.razor.cs @@ -0,0 +1,173 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.WebUtilities; + +//using MongoDB.Bson.IO; +using MP.Data.DatabaseModels; +using MP.Data.DTO; +using MP.Data.Services; +using Newtonsoft.Json; + +namespace MP_TAB_SERV.Pages +{ + public partial class RegNewDevice + { + #region Protected Fields + + protected int expDays = 1; + + protected DateTime vetoScan = DateTime.Now; + + #endregion Protected Fields + + #region Protected Properties + + protected string _authKey { get; set; } = ""; + + protected int _matrOpr { get; set; } = 0; + + protected string authKey + { + get + { + return _authKey; + } + set + { + if (_authKey != value) + { + _authKey = value; + FirstLogIn().ConfigureAwait(false); + } + } + } + + protected string CurrOprTknLS { get; set; } = null!; + + protected string CurrOprTknRedis { get; set; } = null!; + + protected DateTime expDT { get; set; } = DateTime.Now; + + protected int matrOpr + { + get + { + return _matrOpr; + } + set => _matrOpr = value; + } + + [Inject] + protected MessageService MsgServ { get; set; } = null!; + + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + protected List oprsList { get; set; } = new List(); + + protected AnagOperatoriModel rigaOpr { get; set; } = null!; + + [Inject] + protected TabDataService TDService { get; set; } = null!; + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected async Task ToggleCodeScan() + { + await Task.Delay(1); + ShowScanBarcode = !ShowScanBarcode; + } + + protected string txtError = ""; + + protected string Traduci(string lemma) + { + return SMServ.Traduci($"EN_{lemma}".ToUpper()); + } + protected async Task FirstLogIn() + { + rigaOpr = await TDService.OperatoreSearch(matrOpr, authKey); + if (rigaOpr == null) + { + var deHash = TDService.DecryptData(authKey); + rigaOpr = await TDService.OperatoreSearch(matrOpr, deHash); + } + if (rigaOpr != null && rigaOpr.MatrOpr > 0) + { + userTknDTO newUserTkn = new userTknDTO() + { + currOpr = rigaOpr, + expTime = expDT + }; + + var jsonTkn = JsonConvert.SerializeObject(newUserTkn); + string hash = TDService.EncryptData(jsonTkn); + MsgServ.RigaOper = rigaOpr; + await MsgServ.SetCurrOperDtoAsync(hash); + await MsgServ.SetLastMatrOprAsync(rigaOpr.MatrOpr); + await TDService.OperatoreSetRedis(matrOpr, hash); + NavMan.NavigateTo("status-map"); + } + else + { + txtError = Traduci("UserPwdMismatch"); + authKey = ""; + } + } + + protected override async Task OnInitializedAsync() + { + txtError = ""; + matrOpr = await MsgServ.GetLastMatrOprAsync(); + TDService.ConfigGetVal("cookieDayExpire", ref expDays); + ShowScanBarcode = !SMServ.GetConfBool("TAB_WebCamHide"); + expDT = DateTime.Now.AddDays(expDays); + oprsList = await TDService.ElencoOperatori(); + } + + protected async Task ScanDoneHandler(string value) + { + DateTime adesso = DateTime.Now; + // non nullo + if (!string.IsNullOrEmpty(value)) + { + // non veto... + if (adesso.Subtract(vetoScan).TotalMinutes > 0) + { + vetoScan = adesso.AddSeconds(4); + //NavManager.NavigateTo($"CodeProcess/{value}"); + var uri = NavMan.ToAbsoluteUri(value); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var Uri_matrOpr)) + { + if (!string.IsNullOrEmpty(Uri_matrOpr)) + { + matrOpr = int.Parse(Uri_matrOpr); + } + } + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var Uri_authKey)) + { + if (!string.IsNullOrEmpty(Uri_authKey)) + { + authKey = Uri_authKey; + } + } + await FirstLogIn(); + } + } + } + + #endregion Protected Methods + + #region Private Properties + + private bool ShowScanBarcode { get; set; } = false; + + protected EgwCoreLib.Razor.BarcodeReader barcodeReaderCustom { get; set; } = null!; + + #endregion Private Properties + + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/StatusMap.razor b/MP-TAB-SERV/Pages/StatusMap.razor index 250dd569..37a4a0d2 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor +++ b/MP-TAB-SERV/Pages/StatusMap.razor @@ -1,6 +1,4 @@ -@page "/" -@page "/home" -@page "/status-map" +@page "/status-map"
diff --git a/MP-TAB-SERV/Pages/StatusMap.razor.cs b/MP-TAB-SERV/Pages/StatusMap.razor.cs index cbc1c392..1fd20987 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor.cs +++ b/MP-TAB-SERV/Pages/StatusMap.razor.cs @@ -3,6 +3,7 @@ using Microsoft.JSInterop; using MP.Data.Conf; using MP.Data.DatabaseModels; using MP.Data.Services; +using MP_TAB_SERV.Shared; using NLog; using System.Runtime.ExceptionServices; @@ -10,6 +11,20 @@ namespace MP_TAB_SERV.Pages { public partial class StatusMap { + #region Public Classes + + public class WindowDimension + { + #region Public Properties + + public int Height { get; set; } + public int Width { get; set; } + + #endregion Public Properties + } + + #endregion Public Classes + #region Protected Fields protected bool _showCard = false; @@ -25,13 +40,20 @@ namespace MP_TAB_SERV.Pages [Inject] protected IConfiguration config { get; set; } = null!; + protected int Height { get; set; } = 0; + + protected bool isCalcSize { get; set; } = false; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] protected StatusData MDataService { get; set; } = null!; [Inject] - protected MessageService MServ { get; set; } = null!; + protected MessageService MsgServ { get; set; } = null!; [Inject] - protected IJSRuntime JSRuntime{ get; set; } = null!; + protected NavigationManager NavMan { get; set; } = null!; protected bool ShowCard { @@ -46,50 +68,19 @@ namespace MP_TAB_SERV.Pages [Inject] protected TabDataService TabDServ { get; set; } = null!; + protected int Width { get; set; } = 0; + #endregion Protected Properties #region Protected Methods - /// - /// Recupera da conf eventuale setup tag dell'IOB indicato - /// - /// - /// - protected List? getIobTag(string codIob) + protected async Task getWDim() { - List? answ = null; - if (MDataService.currTagConf != null) - { - // cerco x chiave IOB... - if (MDataService.currTagConf.ContainsKey(codIob)) - { - answ = MDataService.currTagConf[codIob]; - } - } - return answ; + var dimension = await JSRuntime.InvokeAsync("getWindowDimensions"); + Height = dimension.Height; + Width = dimension.Width; } - /// - /// Recupera da redis (in una chiamata soltanto) tutti i valori richiesti e compone un - /// dizionario x ottimizzare visualizzazione - /// - /// - /// - protected Dictionary getTagVal(string codIob) - { - Dictionary answ = new Dictionary(); - // recupero conf tags... - var currTags = getIobTag(codIob); - if (currTags != null && currTags.Count > 0) - { - // FIXME TODO !!!! FARE !!!! - da verificare - answ = currTags.ToDictionary(x => x.TagLocation, x => MDataService.getTagConf(x.TagLocation)); - } - return answ; - } - - protected bool isCalcSize { get; set; } = false; - protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) @@ -102,24 +93,31 @@ namespace MP_TAB_SERV.Pages if (ListMSE != null) { // salvo in LocalStorage... - await MServ.SaveMse(ListMSE); + await MsgServ.SaveMse(ListMSE); } } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { - var df = MServ.UserPrefGet("DefCardMode"); - ShowCard = df == "shrink" ? false : true; - isCalcSize = true; + setDefaults(); ListMSE = null; SetupConf(); + var LastOpenedPage = await MsgServ.LastOpenedPageGet(); + var currMacc = await MsgServ.IdxMaccGet(); + if (currMacc != "" && currMacc != null) + { + await MsgServ.IdxMaccSet(currMacc); + if (LastOpenedPage != "" && LastOpenedPage != null) + { + NavMan.NavigateTo(LastOpenedPage); + } + //NavMan.NavigateTo($"machine-detail"); + } } protected void SaveData(List newList) { - //await Task.Delay(1); ListMSE = newList; - //await InvokeAsync(StateHasChanged); } #endregion Protected Methods @@ -140,6 +138,19 @@ namespace MP_TAB_SERV.Pages #region Private Methods + private void setDefaults() + { + string df = MsgServ.UserPrefSetup("DefCardMode", "full"); + baseLang = MsgServ.UserPrefSetup("Lang", "IT"); + tcMode = MsgServ.UserPrefSetup("TcMode", "ms"); + ShowCard = df == "shrink" ? false : true; + isCalcSize = true; + } + + + private string baseLang { get; set; } = ""; + private string tcMode { get; set; } = ""; + private void SetupConf() { // sistemo i parametri opzionali... @@ -149,24 +160,5 @@ namespace MP_TAB_SERV.Pages } #endregion Private Methods - - protected int Width { get; set; } = 0; - protected int Height { get; set; } = 0; - - public class WindowDimension - { - #region Public Properties - - public int Height { get; set; } - public int Width { get; set; } - - #endregion Public Properties - } - protected async Task getWDim() - { - var dimension = await JSRuntime.InvokeAsync("getWindowDimensions"); - Height = dimension.Height; - Width = dimension.Width; - } } } \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/User.razor b/MP-TAB-SERV/Pages/User.razor index bf09134d..d23fee31 100644 --- a/MP-TAB-SERV/Pages/User.razor +++ b/MP-TAB-SERV/Pages/User.razor @@ -14,15 +14,50 @@
}
-
+ @*
USER DATA
-
+
*@
+
+ Preferenze +
+
+
    +
  • +
    Modalità di inserimento del tempo ciclo
    +
    +
    + + +
    +
    +
  • +
  • +
    Lingua
    + +
  • +
  • +
    Modalità di visualizzazione delle macchine in 'Mappa Stato'
    +
    +
    + + +
    +
    +
  • +
+
+
+ User Data +
  • @@ -43,47 +78,16 @@
-
- Preferenze -
-
-
    -
  • -
    Modalità di inserimento del tempo ciclo
    -
    -
    - - -
    -
    -
  • -
  • -
    Lingua
    - -
  • -
  • -
    Modalità di visualizzazione delle macchine in 'Mappa Stato'
    -
    -
    - - -
    -
    -
  • -
-
+
@if (Width > 1021) @@ -192,7 +196,7 @@ } } - protected string _langIns { get; set; } = ""; + protected string _langIns { get; set; } = "EN"; protected string langIns { @@ -242,21 +246,9 @@ } protected async override Task OnInitializedAsync() { - var tcPrefItem = MsgServ.UserPrefGet("TcMode"); - if (tcPrefItem != null) - { - tcModIns = tcPrefItem; - } - var langPrefItem = MsgServ.UserPrefGet("Lang"); - if (langPrefItem != null) - { - langIns = langPrefItem; - } - var defCardPrefItem = MsgServ.UserPrefGet("DefCardMode"); - if (defCardPrefItem != null) - { - defCardModeIns = defCardPrefItem; - } + tcModIns = MsgServ.UserPrefSetup("TcMode", "ms"); + langIns = MsgServ.UserPrefSetup("Lang", "IT"); + defCardModeIns = MsgServ.UserPrefSetup("DefCardMode", "full"); await Task.Delay(1); if (string.IsNullOrEmpty(currIpv4)) { diff --git a/MP-TAB-SERV/Pages/_Layout.cshtml b/MP-TAB-SERV/Pages/_Layout.cshtml index 24f41386..0a7d54c9 100644 --- a/MP-TAB-SERV/Pages/_Layout.cshtml +++ b/MP-TAB-SERV/Pages/_Layout.cshtml @@ -38,6 +38,14 @@ 🗙
+ @* + *@ + @**@ + @* + *@ + @**@ + + diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index 8d44feee..aa25c504 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2311.1016

+

Versione: 6.16.2312.1115


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index e1f886bd..ea217199 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2311.1016 +6.16.2312.1115 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index e8dda042..5c669432 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2311.1016 + 6.16.2312.1115 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false diff --git a/MP-TAB-SERV/Shared/MainLayout.razor b/MP-TAB-SERV/Shared/MainLayout.razor index d18e77a9..df3d355f 100644 --- a/MP-TAB-SERV/Shared/MainLayout.razor +++ b/MP-TAB-SERV/Shared/MainLayout.razor @@ -4,42 +4,23 @@ MP-TAB-SERV -
    - +
    -
    -
    - - - Username - - [999] -
    - -
    -
    -
    - -
    + + @if (MsgServ.RigaOper != null || NavMan.Uri.Contains("reg-new-device")) + { +
    +
    + @Body
    -
    -
    - -
    -
    - @Body -
    - -
    + @if (!HideMenu) + { + + } + + }
    diff --git a/MP-TAB-SERV/Shared/MainLayout.razor.cs b/MP-TAB-SERV/Shared/MainLayout.razor.cs index c20d5162..8e4c9e6d 100644 --- a/MP-TAB-SERV/Shared/MainLayout.razor.cs +++ b/MP-TAB-SERV/Shared/MainLayout.razor.cs @@ -1,9 +1,9 @@ using global::Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Routing; +using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.Data.Services; using NLog; -using System.Diagnostics; namespace MP_TAB_SERV.Shared { @@ -36,11 +36,16 @@ namespace MP_TAB_SERV.Shared /// protected List CurrMenuItems { get; set; } = new List(); + protected bool HideMenu + { + get => NavMan.Uri.Contains("reg-new-device"); + } + [Inject] protected ListSelectDataSrv MDataService { get; set; } = null!; [Inject] - protected MessageService MServ { get; set; } = null!; + protected MessageService MsgServ { get; set; } = null!; [Inject] protected SharedMemService MStor { get; set; } = null!; @@ -51,33 +56,59 @@ namespace MP_TAB_SERV.Shared [Inject] protected TabDataService TDataService { get; set; } = null!; + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + #endregion Protected Properties #region Protected Methods - protected async Task ForceReload() + protected string bodyTipe { - Stopwatch sw = new Stopwatch(); - sw.Start(); - Log.Info("Start ForceReload"); - ResetClass = "btn-warning"; - await InvokeAsync(StateHasChanged); - // reset cache varie - await MServ.ClearLocalStor(); - await MServ.ClearSessionStor(); - await MDataService.FlushCache(); - // reload MStor - await ReloadMemStor(); - // calcolo tempo esecuzione - sw.Stop(); - int delta = 500 - (int)sw.ElapsedMilliseconds; - delta = delta > 0 ? delta : 50; - await Task.Delay(delta); - ResetClass = "btn-primary"; - // await InvokeAsync(StateHasChanged); - Log.Info($"ForceReload completed in {sw.ElapsedMilliseconds}ms"); - // ricarica pagina! - NavMan.NavigateTo("/", true); + get => NavMan.Uri.Contains("reg-new-device") ? "mainBodyNoSide" : "mainBody"; + } + + + protected async Task handleBodyClick() + { + await Task.Delay(1); + await checkDtDiff2Logout(); + + } + private int MatrOpr + { + get => MsgServ.MatrOpr; + } + protected int typeScadLogin { get; set; } = 0; + protected int dtScadLogin { get; set; } = 0; + + protected async Task checkDtDiff2Logout() + { + var diffOfTime = DateTime.Now - MsgServ.dtLastAction; + switch (typeScadLogin) + { + case 0: + if (diffOfTime.Minutes >= dtScadLogin) + { + NavMan.NavigateTo("logout"); + } + break; + case 1: + if (diffOfTime.Minutes >= dtScadLogin) + { + var userTkn = await TDataService.OperatoreGetRedis(MatrOpr); + if (!string.IsNullOrEmpty(userTkn)) + { + await MsgServ.DoLogIn(userTkn); + MsgServ.dtLastAction = DateTime.Now; + } + else + { + NavMan.NavigateTo("logout"); + } + } + break; + } } /// @@ -86,6 +117,8 @@ namespace MP_TAB_SERV.Shared /// protected override async Task OnInitializedAsync() { + typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin"); + dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin"); NavMan.LocationChanged += HandleLocationChanged; // verifica preliminare setup mdati if (!MStor.MenuOk) diff --git a/MP-TAB-SERV/Shared/MainLayout.razor.css b/MP-TAB-SERV/Shared/MainLayout.razor.css index 20fe1add..e22bf95a 100644 --- a/MP-TAB-SERV/Shared/MainLayout.razor.css +++ b/MP-TAB-SERV/Shared/MainLayout.razor.css @@ -13,59 +13,20 @@ main { padding: 0 10px 0 0; } -.top-row { - background-color: #05173d; - /*border-bottom: 1px solid #d6d5d5;*/ - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - .top-row ::deep a, .top-row ::deep .btn-link { - white-space: nowrap; - /*margin-left: 1.5rem;*/ - text-decoration: none; - } - - .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { - text-decoration: underline; - } - - .top-row ::deep a:first-child { - overflow: hidden; - text-overflow: ellipsis; - } @media (min-width: 640.98px) { - .slideMen:not(.auth) { + /*.slideMen:not(.auth) { display: none; - } + }*/ #mainBody { width: 83%; } } - - - -@media (max-width: 640.98px) { - .top-row:not(.auth) { - display: none; - } - - #mainBody { - width: 100%; - } - - .top-row.auth { - justify-content: space-between; - } - - .top-row ::deep a, .top-row ::deep .btn-link { - margin-left: 0; - } +#mainBodyNoSide { + width: 100%; } @media (min-width: 641px) { @@ -82,22 +43,6 @@ main { } } -.top-row { - position: sticky; - top: 0; - z-index: 1; -} - - .top-row.auth ::deep a:first-child { - flex: 1; - text-align: right; - width: 0; - } - -.top-row, article { - padding-left: 1rem !important; - padding-right: .5rem !important; -} #blazor-error-ui { background: lightyellow; diff --git a/MP-TAB-SERV/Shared/NavMenu.razor b/MP-TAB-SERV/Shared/NavMenu.razor index 9e64402e..a3cfec58 100644 --- a/MP-TAB-SERV/Shared/NavMenu.razor +++ b/MP-TAB-SERV/Shared/NavMenu.razor @@ -14,7 +14,7 @@ foreach (var item in MenuItems) { @@ -28,4 +28,20 @@ [Parameter] public List MenuItems { get; set; } = new List(); + + [Inject] + protected MessageService MsgServ { get; set; } = null!; + [Inject] + protected NavigationManager navManager { get; set; } = null!; + + protected async Task SetPage(string tgtUrl) + { + await Task.Delay(1); + if (tgtUrl.Contains("status-map")) + { + await MsgServ.IdxMaccSet(""); + } + await MsgServ.LastOpenedPageSet(tgtUrl); + navManager.NavigateTo(tgtUrl); + } } diff --git a/MP-TAB-SERV/Shared/NavMenu.razor.css b/MP-TAB-SERV/Shared/NavMenu.razor.css index 4e972e81..1cf40bb7 100644 --- a/MP-TAB-SERV/Shared/NavMenu.razor.css +++ b/MP-TAB-SERV/Shared/NavMenu.razor.css @@ -35,7 +35,7 @@ } -@media (min-width: 640.98px) { +@media (max-width: 640.98px) { .slideMen:not(.auth) { display: none; } diff --git a/MP-TAB-SERV/wwwroot/css/site.css b/MP-TAB-SERV/wwwroot/css/site.css index 924a71e9..508a0b26 100644 --- a/MP-TAB-SERV/wwwroot/css/site.css +++ b/MP-TAB-SERV/wwwroot/css/site.css @@ -101,4 +101,56 @@ a, } .blazor-error-boundary::after { content: "An error has occurred."; +} +.top-row { + background-color: #05173d; + /*border-bottom: 1px solid #d6d5d5;*/ + justify-content: flex-end; + height: 3.5rem; + display: flex; + align-items: center; +} +.top-row ::deep a, +.top-row ::deep .btn-link { + white-space: nowrap; + /*margin-left: 1.5rem;*/ + text-decoration: none; +} +.top-row ::deep a:hover, +.top-row ::deep .btn-link:hover { + text-decoration: underline; +} +.top-row ::deep a:first-child { + overflow: hidden; + text-overflow: ellipsis; +} +@media (max-width: 640.98px) { + .top-row:not(.auth) { + display: none; + } + #mainBody { + width: 100%; + } + .top-row.auth { + justify-content: space-between; + } + .top-row ::deep a, + .top-row ::deep .btn-link { + margin-left: 0; + } +} +.top-row { + position: sticky; + top: 0; + z-index: 1; +} +.top-row.auth ::deep a:first-child { + flex: 1; + text-align: right; + width: 0; +} +.top-row, +article { + padding-left: 1rem !important; + padding-right: 0.5rem !important; } \ No newline at end of file diff --git a/MP-TAB-SERV/wwwroot/css/site.less b/MP-TAB-SERV/wwwroot/css/site.less index f1f08aa8..3623ea46 100644 --- a/MP-TAB-SERV/wwwroot/css/site.less +++ b/MP-TAB-SERV/wwwroot/css/site.less @@ -114,3 +114,63 @@ html, body { .blazor-error-boundary::after { content: "An error has occurred." } + +.top-row { + background-color: #05173d; + /*border-bottom: 1px solid #d6d5d5;*/ + justify-content: flex-end; + height: 3.5rem; + display: flex; + align-items: center; +} + +.top-row ::deep a, .top-row ::deep .btn-link { + white-space: nowrap; + /*margin-left: 1.5rem;*/ + text-decoration: none; +} + +.top-row ::deep a:hover, .top-row ::deep .btn-link:hover { + text-decoration: underline; +} + +.top-row ::deep a:first-child { + overflow: hidden; + text-overflow: ellipsis; +} + + +@media (max-width: 640.98px) { + .top-row:not(.auth) { + display: none; + } + + #mainBody { + width: 100%; + } + + .top-row.auth { + justify-content: space-between; + } + + .top-row ::deep a, .top-row ::deep .btn-link { + margin-left: 0; + } +} + +.top-row { + position: sticky; + top: 0; + z-index: 1; +} + +.top-row.auth ::deep a:first-child { + flex: 1; + text-align: right; + width: 0; +} + +.top-row, article { + padding-left: 1rem !important; + padding-right: .5rem !important; +} \ No newline at end of file diff --git a/MP-TAB-SERV/wwwroot/css/site.min.css b/MP-TAB-SERV/wwwroot/css/site.min.css index 9ec2a048..c429c6c5 100644 --- a/MP-TAB-SERV/wwwroot/css/site.min.css +++ b/MP-TAB-SERV/wwwroot/css/site.min.css @@ -1 +1 @@ -@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";} \ No newline at end of file +@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');html,body{font-family:'Open Sans Condensed',sans-serif;background-color:#151321;color:#ededed;}.cardObj{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardObjNoBL{border-radius:.375rem 0 0 .375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;}.cardFullHeight{border-radius:.375rem;background:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);box-shadow:0 4px 24px -1px rgba(0,0,0,.25);flex-shrink:0;height:100%;}.longStopListNotes{height:100%;}@media(max-width:640.98px){.longStopListNotes{max-height:120px;}}.borderStd{border-radius:.375rem;}.table-dark{--bs-table-color:#fff;--bs-table-bg:transparent;--bs-table-border-color:#4d5154;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color);}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.content{padding-top:1.1rem;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.blazor-error-boundary{background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem,#b32121;padding:1rem 1rem 1rem 3.7rem;color:#fff;}.blazor-error-boundary::after{content:"An error has occurred.";}.top-row{background-color:#05173d;justify-content:flex-end;height:3.5rem;display:flex;align-items:center;}.top-row ::deep a,.top-row ::deep .btn-link{white-space:nowrap;text-decoration:none;}.top-row ::deep a:hover,.top-row ::deep .btn-link:hover{text-decoration:underline;}.top-row ::deep a:first-child{overflow:hidden;text-overflow:ellipsis;}@media(max-width:640.98px){.top-row:not(.auth){display:none;}#mainBody{width:100%;}.top-row.auth{justify-content:space-between;}.top-row ::deep a,.top-row ::deep .btn-link{margin-left:0;}}.top-row{position:sticky;top:0;z-index:1;}.top-row.auth ::deep a:first-child{flex:1;text-align:right;width:0;}.top-row,article{padding-left:1rem!important;padding-right:.5rem!important;} \ No newline at end of file diff --git a/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js b/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js new file mode 100644 index 00000000..2fbce212 --- /dev/null +++ b/MP-TAB-SERV/wwwroot/lib/BarcodeReade.js @@ -0,0 +1,317 @@ +import '_content/ZXingBlazor/lib/zxing/zxing.min.js'; +let codeReader = null; +let id = null; +let supportsVibrate = false; +let opt = null; +let inst = null; +let selectedDeviceId = null; +let deviceID = null; +let element = null; +let debug = false; +export function vibrate() { + if (supportsVibrate) navigator.vibrate(1000); +} +export function init(instance, ele, elementid, options, deviceid) { + console.log('init' + elementid); + inst = instance; + opt = options; + id = elementid; + deviceID = deviceid; + element = ele; + debug = options.debug; + supportsVibrate = "vibrate" in navigator; + let startButton = element.querySelector("[data-action=startButton]"); + let resetButton = element.querySelector("[data-action=resetButton]"); + let closeButton = element.querySelector("[data-action=closeButton]"); + + if (startButton) startButton.addEventListener('click', () => { + start(elementid); + }) + + if (resetButton) resetButton.addEventListener('click', () => { + stop(elementid); + if (debug) console.log('Reset.') + }) + + if (closeButton) closeButton.addEventListener('click', () => { + stop(elementid); + if (debug) console.log('closeButton.') + instance.invokeMethodAsync("CloseScan"); + }) + + load(elementid); +} + +export function reload(elementid) { + load(elementid); +} + +function genHints(opt) { + const hints = new Map(); + if (opt.TRY_HARDER) { + hints.set(ZXing.DecodeHintType.TRY_HARDER, opt.TRY_HARDER); + } + if (opt.ASSUME_CODE_39_CHECK_DIGIT) { + hints.set(ZXing.DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT, opt.ASSUME_CODE_39_CHECK_DIGIT); + } + if (opt.ASSUME_GS1) { + hints.set(ZXing.DecodeHintType.ASSUME_GS1, opt.ASSUME_GS1); + } + if (opt.CHARACTER_SET) { + hints.set(ZXing.DecodeHintType.CHARACTER_SET, opt.CHARACTER_SET); + } + if (opt.OTHER) { + hints.set(ZXing.DecodeHintType.OTHER, opt.OTHER); + } + if (opt.PURE_BARCODE) { + hints.set(ZXing.DecodeHintType.PURE_BARCODE, opt.PURE_BARCODE); + } + if (opt.RETURN_CODABAR_START_END) { + hints.set(ZXing.DecodeHintType.RETURN_CODABAR_START_END, opt.RETURN_CODABAR_START_END); + } + if (opt.TRY_HARDER) { + hints.set(ZXing.DecodeHintType.TRY_HARDER, opt.TRY_HARDER); + } + return hints; +} + +export function load(elementid) { + if (id == elementid) { + + const sourceSelect = element.querySelector("[data-action=sourceSelect]"); + const sourceSelectPanel = element.querySelector("[data-action=sourceSelectPanel]"); + const hints = genHints(opt); + + if (opt.pdf417) { + codeReader = new ZXing.BrowserPDF417Reader(hints); + if (debug) console.log('ZXing code PDF417 reader initialized') + } else if (opt.decodeAllFormats) { + const formats = opt.formats; + hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, formats); + codeReader = new ZXing.BrowserMultiFormatReader(hints) + if (debug) console.log('ZXing code reader initialized with all formats') + } else { + codeReader = new ZXing.BrowserMultiFormatReader(hints) + if (debug) console.log('ZXing code reader initialized') + } + codeReader.timeBetweenDecodingAttempts = opt.timeBetweenDecodingAttempts; + + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + navigator.mediaDevices + .getUserMedia({ audio: false, video: true }) + .then(() => { + + codeReader.listVideoInputDevices() + .then((videoInputDevices) => { + if (deviceID != null) { + selectedDeviceId = deviceID + } else if (videoInputDevices.length > 1) { + selectedDeviceId = videoInputDevices[1].deviceId + } else { + selectedDeviceId = videoInputDevices[0].deviceId + } + if (debug) console.log('videoInputDevices:' + videoInputDevices.length); + if (videoInputDevices.length > 1) { + sourceSelect.innerHTML = ''; + videoInputDevices.forEach((device) => { + const sourceOption = document.createElement('option'); + if (device.label === '') { + sourceOption.text = 'Camera' + (sourceSelect.length + 1); + } else { + sourceOption.text = device.label + } + sourceOption.value = device.deviceId + if (selectedDeviceId != null && device.deviceId == selectedDeviceId) { + sourceOption.selected = true + } + sourceSelect.appendChild(sourceOption) + }) + + sourceSelect.onchange = () => { + selectedDeviceId = sourceSelect.value; + inst.invokeMethodAsync('SelectDeviceID', selectedDeviceId, sourceSelect.options[sourceSelect.selectedIndex].text); + codeReader.reset(); + start(elementid); + } + + sourceSelectPanel.style.display = 'block' + } + + start(elementid); + + }) + .catch((err) => { + console.log(err) + inst.invokeMethodAsync("GetError", err + ''); + }) + + }) + .catch((err) => { + console.error(`An error occurred: ${err}`); + inst.invokeMethodAsync('GetError', `An error occurred: ${err}`); + }); + + } + } +} + +export function start(elementid) { + if (undefined !== codeReader && null !== codeReader && id == elementid) { + if (opt.decodeonce) { + codeReader.decodeOnceFromVideoDevice(selectedDeviceId, 'video').then((result) => { + if (debug) console.log(result) + vibrate(); + if (debug) console.log('autostop'); + codeReader.reset(); + return inst.invokeMethodAsync("GetResult", result.text); + }).catch((err) => { + if (err && !(err instanceof ZXing.NotFoundException)) { + console.log(err) + inst.invokeMethodAsync("GetError", err + ''); + } + }) + } else { + codeReader.decodeFromVideoDevice(selectedDeviceId, 'video', (result, err) => { + if (result) { + if (debug) console.log(result) + vibrate(); + if (debug) console.log('None-stop'); + inst.invokeMethodAsync("GetResult", result.text); + } + if (err && !(err instanceof ZXing.NotFoundException)) { + console.log(err) + inst.invokeMethodAsync("GetError", err + ''); + } + }) + } + + var x = `decodeContinuously`; + if (opt.decodeonce) x = `decodeOnce`; + if (debug) console.log(`Started ` + x + ` decode from camera with id ${selectedDeviceId}`) + if (debug) console.log(id, 'start'); + } +} + +export function stop(elementid) { + if (undefined !== codeReader && null !== codeReader && id == elementid) { + codeReader.reset(); + if (debug) console.log(id, 'stop'); + } +} + +export function QRCodeSvg(instance, input, element, tobase64, size = 300) { + const codeWriter = new ZXing.BrowserQRCodeSvgWriter() + + if (debug) console.log('ZXing code writer initialized') + + if (tobase64) { + const elementTemp = document.createElement('elementTemp'); + codeWriter.writeToDom(elementTemp, input, size, size) + let svgElement = elementTemp.firstChild + const svgData = (new XMLSerializer()).serializeToString(svgElement) + //const blob = new Blob([svgData]) + instance.invokeMethodAsync("GetQRCode", svgData); + } else { + codeWriter.writeToDom(element.querySelector("[data-action=result]"), input, size, size) + } +} + +export function DecodeFormImage(instance, element, options, data) { + var codeReaderImage = null; + const hints = genHints(options); + if (options.pdf417) { + codeReaderImage = new ZXing.BrowserPDF417Reader(hints); + if (debug) console.log('ZXing code PDF417 reader initialized') + } else if (options.decodeAllFormats) { + const formats = options.formats; + hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, formats); + codeReaderImage = new ZXing.BrowserMultiFormatReader(hints) + if (debug) console.log('ZXing code reader initialized with all formats') + } else { + codeReaderImage = new ZXing.BrowserMultiFormatReader(hints) + if (debug) console.log('ZXing code reader initialized') + } + if (debug) console.log('ZXing code reader initialized') + + if (data != null) { + codeReaderImage.decodeFromImageUrl(data).then(result => { + if (result) { + vibrate(); + if (debug) console.log(result.text); + instance.invokeMethodAsync('GetResult', result.text) + } + }).catch((err) => { + if (err) { + console.log(err) + instance.invokeMethodAsync('GetError', err.message) + } + }) + + } + else { + const resetFile = () => { + let file = element.querySelector('[type="file"]') + if (file) { + file.removeEventListener('change', scanImageHandler) + file.remove() + } + file = document.createElement('input') + file.setAttribute('type', 'file') + file.setAttribute('hidden', 'true') + file.setAttribute('accept', 'image/*') + //file.setAttribute('capture', 'true') + element.append(file) + file.addEventListener('change', scanImageHandler) + codeReaderImage.file = file + return file + } + + const scanImageHandler = () => { + const files = codeReaderImage.file.files + if (files.length === 0) { + return + } + + + const reader = new FileReader() + reader.onloadend = e => { + + codeReaderImage.decodeFromImageUrl(e.target.result).then(result => { + if (result) { + vibrate(); + if (debug) console.log(result.text); + instance.invokeMethodAsync('GetResult', result.text) + } else { + instance.invokeMethodAsync('GetError', "no valid barcode detected") + } + }).catch((err) => { + if (err) { + console.log(err) + instance.invokeMethodAsync('GetError', err.message) + } + }) + } + reader.readAsDataURL(files[0]) + } + + let file = resetFile() + file.click() + + } + +} + +export function destroy(elementid) { + if (undefined !== codeReader && null !== codeReader && id == elementid) { + codeReader.reset(); + codeReader = null; + //id = null; + id = null; + opt = null; + inst = null; + selectedDeviceId = null; + deviceID = null; + element = null; + if (debug) console.log(id, 'destroy'); + } +} \ No newline at end of file diff --git a/MP.Data/Constants.cs b/MP.Data/Constants.cs index 9f43bd5b..4c988efc 100644 --- a/MP.Data/Constants.cs +++ b/MP.Data/Constants.cs @@ -20,6 +20,10 @@ public static string redisMseKey = "MP:MON:Cache:MSE"; + public static string redisMseKeySingle = "MP:MON:Cache:MseSingle"; + + // passphrase cifratura + public const string passPhrase = "7871D817-C71F-4DFC-BF12-00A95BE507B5"; #endregion Public Fields } diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 0b7b7aaa..73c17c66 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -611,7 +611,6 @@ namespace MP.Data.Controllers numRecProc += numRec; if (numRec > maxItem) { - List listPeriodi = new List(); switch (valMode) @@ -713,6 +712,27 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco Gruppi + /// + /// + public List FluxLogPareto(string idxMacchina, DateTime dtFrom, DateTime dtTo) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetFluxLog + .Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo)) + .AsNoTracking() + .GroupBy(x => x.CodFlux) + .Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() }) + .OrderByDescending(x => x.Qty) + .ToList(); + } + return dbResult; + } + /// /// Stored manutenzione del DB /// @@ -1270,27 +1290,6 @@ namespace MP.Data.Controllers return dbResult; } - /// - /// Elenco Gruppi - /// - /// - public List ParetoFluxLog(string idxMacchina, DateTime dtFrom, DateTime dtTo) - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbSetFluxLog - .Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo)) - .AsNoTracking() - .GroupBy(x => x.CodFlux) - .Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() }) - .OrderByDescending(x => x.Qty) - .ToList(); - } - return dbResult; - } - /// /// Stato prod macchina /// diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index ef4d23f9..e7311b81 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -54,6 +54,51 @@ namespace MP.Data.Controllers return dbResult; } + + /// + /// Elenco operatori + /// + /// + public List ElencoOperatori() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbOperatori + .Where(s => s.MatrOpr > 0) + .AsNoTracking() + .OrderBy(x => x.MatrOpr) + .ToList(); + } + return dbResult; + } + + /// + /// login operatori + /// + /// /// + /// /// + /// + public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey) + { + AnagOperatoriModel dbResult = null; + AnagOperatoriModel answ = new AnagOperatoriModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbOperatori + .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey)) + .AsNoTracking() + .FirstOrDefault(); + if (dbResult != null) + { + answ = dbResult; + } + } + return answ; + } + /// /// Registrato ACK allarme /// @@ -765,6 +810,35 @@ namespace MP.Data.Controllers return fatto; } + /// + /// Dati MSE x singola macchina SUB (tipicamente TAV) + /// + /// + /// + /// + public List MseGetSub(string idxMacc, string idxMacchSub) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var IdxMacc = new SqlParameter("@IdxMacchina", idxMacc); + var IdxMacchSub = new SqlParameter("@IdxMacchSub", idxMacchSub); + dbResult = dbCtx + .DbSetMSE + .FromSqlRaw("EXEC stp_MSE_getByIdxMacchAndSub @IdxMacchina, @IdxMacchSub", IdxMacc, IdxMacchSub) + .AsNoTracking() + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante MseGetSub{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// ODL da key /// @@ -794,6 +868,34 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Clear operazione setup ODL (annullamento) + /// + /// + /// + /// + public bool OdlClearSetup(int idxODL, string idxMacchina) + { + bool answ = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var IdxODL = new SqlParameter("@idxODL", idxODL); + var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); + var result = dbCtx + .Database + .ExecuteSqlRaw("EXEC stp_ODL_clearSetup @IdxODL, @IdxMacchina", IdxODL, IdxMacchina); + answ = result != 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlClearSetup{Environment.NewLine}{exc}"); + } + } + return answ; + } + /// /// ODL corrente macchina /// @@ -821,33 +923,6 @@ namespace MP.Data.Controllers return dbResult; } - /// - /// Registro fine prod ODL - /// - /// - /// - /// - public bool OdlFineProd(int idxODL, string idxMacchina) - { - bool fatto = false; - using (var dbCtx = new MoonProContext(_configuration)) - { - try - { - var IdxODL = new SqlParameter("@IdxODL", idxODL); - var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); - var result = dbCtx - .Database - .ExecuteSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacc); - fatto = result != 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante OdlFineProd{Environment.NewLine}{exc}"); - } - } - return fatto; - } /// /// Attrezzo stesso ODL dell'altra tavola /// @@ -878,7 +953,33 @@ namespace MP.Data.Controllers return fatto; } - + /// + /// Registro fine prod ODL + /// + /// + /// + /// + public bool OdlFineProd(int idxODL, string idxMacchina) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var IdxODL = new SqlParameter("@IdxODL", idxODL); + var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); + var result = dbCtx + .Database + .ExecuteSqlRaw("EXEC stp_ODL_fineProd @IdxODL, @IdxMacchina", IdxODL, IdxMacc); + fatto = result != 0; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlFineProd{Environment.NewLine}{exc}"); + } + } + return fatto; + } /// /// Fix ODL per macchine SLAVE @@ -946,6 +1047,33 @@ namespace MP.Data.Controllers return fatto; } + /// + /// Ultimo ODL data macchina + /// + /// + /// + public List OdlLastByMacc(string idxMacchina) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); + dbResult = dbCtx + .DbSetODL + .FromSqlRaw("EXEC stp_ODL_getLastByMacchina @IdxMacchina", IdxMacchina) + .AsNoTracking() + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlLastByMacc{Environment.NewLine}{exc}"); + } + } + return dbResult; + } + /// /// Elenco ODL data macchina e periodo /// @@ -977,34 +1105,6 @@ namespace MP.Data.Controllers return dbResult; } - /// - /// Ultimo ODL data macchina - /// - /// - /// - public List OdlLastByMacc(string idxMacchina) - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - try - { - var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); - dbResult = dbCtx - .DbSetODL - .FromSqlRaw("EXEC stp_ODL_getLastByMacchina @IdxMacchina", IdxMacchina) - .AsNoTracking() - .ToList(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante OdlLastByMacc{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - - /// /// Riapertura ULTIMO ODL data macchina /// @@ -1032,8 +1132,6 @@ namespace MP.Data.Controllers return dbResult; } - - /// /// Setup ODL Postumo /// @@ -1137,6 +1235,9 @@ namespace MP.Data.Controllers /// /// /// + /// + /// + /// /// public bool OdlUpdate(int idxODL, int matrOpr, decimal tCRichAttr, int pzPallet, string note) { @@ -1174,11 +1275,16 @@ namespace MP.Data.Controllers using (var dbCtx = new MoonProContext(_configuration)) { var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina); - dbResult = dbCtx - .DbSetPzProd - .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) - .AsNoTracking() - .ToList(); + try + { + dbResult = dbCtx + .DbSetPzProd + .FromSqlRaw("EXEC stp_PzProd_getByMacchina @IdxMacchina", IdxMacchina) + .AsNoTracking() + .ToList(); + } + catch + { } } return dbResult; } @@ -1454,6 +1560,7 @@ namespace MP.Data.Controllers /// public async Task RegScartiInsert(RegistroScartiModel newRec) { + await Task.Delay(1); bool fatto = false; using (var dbCtx = new MoonProContext(_configuration)) { @@ -1464,11 +1571,14 @@ namespace MP.Data.Controllers var Note = new SqlParameter("@Note", newRec.Note); var MatrOpr = new SqlParameter("@MatrOpr", newRec.MatrOpr); - var result = await dbCtx - .Database - .ExecuteSqlRawAsync("exec dbo.stp_RS_insert @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr); + var result = dbCtx + .DbSetRegWithCheck + .FromSqlRaw("exec dbo.stp_RS_Insert_withCheck @idxMacchina, @DataOra, @Causale, @Qta, @Note, @MatrOpr", IdxMacchina, DataOra, Causale, Qta, Note, MatrOpr) + .AsNoTracking() + .ToList(); // indico eseguito! - fatto = result > 0; + // -1 = restituisce una select + fatto = result.Count > 0; } return fatto; } diff --git a/MP.Data/DTO/userTknDTO.cs b/MP.Data/DTO/userTknDTO.cs new file mode 100644 index 00000000..bc9a8db5 --- /dev/null +++ b/MP.Data/DTO/userTknDTO.cs @@ -0,0 +1,15 @@ +using MP.Data.DatabaseModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DTO +{ + public class userTknDTO + { + public AnagOperatoriModel currOpr { get; set; } = null; + public DateTime expTime { get; set; } = DateTime.Now; + } +} diff --git a/MP.Data/DatabaseModels/RegCheckModel.cs b/MP.Data/DatabaseModels/RegCheckModel.cs new file mode 100644 index 00000000..1c18a6ed --- /dev/null +++ b/MP.Data/DatabaseModels/RegCheckModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + public partial class RegCheckModel + { + #region Public Properties + [Key] + public string IdxMacchina { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index 43503dc5..b36b607f 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -78,6 +78,7 @@ namespace MP.Data public virtual DbSet DbSetRegControlli { get; set; } public virtual DbSet DbSetRegScarti { get; set; } public virtual DbSet DbSetRegDich { get; set; } + public virtual DbSet DbSetRegWithCheck { get; set; } public virtual DbSet DbSetStAct { get; set; } diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 6d751191..cd063eb6 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -1,7 +1,9 @@ using Blazored.LocalStorage; using Blazored.SessionStorage; +using EgwCoreLib.Utils; using Microsoft.Extensions.Configuration; using MP.Data.DatabaseModels; +using MP.Data.DTO; using Newtonsoft.Json; using NLog; using StackExchange.Redis; @@ -24,13 +26,15 @@ namespace MP.Data.Services #region Public Constructors - public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore) + public MessageService(IConfiguration configuration, ILocalStorageService genLocalStorage, ISessionStorageService sessStore, TabDataService tdService, SharedMemService smServ) { _configuration = configuration; // gestione sessioni in browser localStorage = genLocalStorage; sessionStore = sessStore; + TDService = tdService; + SMService = smServ; // setup compoenti REDIS redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); @@ -45,10 +49,38 @@ namespace MP.Data.Services public event Action EA_PageUpdated = null!; + public event Action EA_ResetFooterTimer = null!; + #endregion Public Events #region Public Properties +#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 + + public DateTime dtLastAction { get; set; } = DateTime.Now; + public string CognomeNome { get @@ -92,8 +124,7 @@ namespace MP.Data.Services { get { - int answ = 102; - //int answ = -1; + int answ = -1; if (_rigaOper != null) { answ = _rigaOper.MatrOpr; @@ -211,6 +242,32 @@ namespace MP.Data.Services await sessionStore.SetItemAsync(KeyCommText, Valore); } + public string DecryptData(string encData) + { + return SteamCrypto.DecryptString(encData, Constants.passPhrase); + } + + public string EncryptData(string rawData) + { + return SteamCrypto.EncryptString(rawData, Constants.passPhrase); + } + + /// + /// Restituisce il record OperatoreDTO da localstorage + /// + /// + public async Task GetCurrOperDtoAsync() + { + string answ = ""; + var result = await localStorage.GetItemAsync("currTkn"); + if (result != null) + { + //var data = JsonConvert.DeserializeObject(result); + answ = result; + } + return answ; + } + /// /// Restituisce il valore Ipv4 del Device da localstorage /// @@ -241,6 +298,21 @@ namespace MP.Data.Services return answ; } + /// + /// Restituisce ultima matrOpr registrata da localstorage + /// + /// + public async Task GetLastMatrOprAsync() + { + int answ = -1; + var result = await localStorage.GetItemAsync("lastMatrOpr"); + if (!string.IsNullOrEmpty(result)) + { + answ = int.Parse(result); + } + return answ; + } + /// /// Recupero dati MSE x macchina /// @@ -262,7 +334,7 @@ namespace MP.Data.Services /// public async Task IdxMaccGet() { - return await sessionStore.GetItemAsync("CurrMach"); + return await localStorage.GetItemAsync("CurrMach"); } /// @@ -270,7 +342,22 @@ namespace MP.Data.Services /// public async Task IdxMaccSet(string machSel) { - await sessionStore.SetItemAsync("CurrMach", machSel); + await localStorage.SetItemAsync("CurrMach", machSel); + } + /// + /// Scrive sul local storage pagina corrente + /// + public async Task LastOpenedPageGet() + { + return await localStorage.GetItemAsync("LastPage"); + } + + /// + /// Ottiene sul local storage pagina corrente + /// + public async Task LastOpenedPageSet(string lastPage) + { + await localStorage.SetItemAsync("LastPage", lastPage); } /// @@ -299,6 +386,18 @@ namespace MP.Data.Services return hasKey; } + /// + /// scrive il record OperatoreDTO nel localstorage + /// + /// + public async Task SetCurrOperDtoAsync(string currTkn) + { + bool answ = false; + await localStorage.SetItemAsync("currTkn", currTkn); + answ = true; + return answ; + } + /// /// Scrive il valore di IPV4 del device nel localstoragee /// @@ -339,6 +438,60 @@ namespace MP.Data.Services return answ; } + protected int expDays { get; set; } = 0; + + public async Task DoLogIn(string decodValue) + { + bool answ = false; + expDays = SMService.GetConfInt("cookieDayExpire"); + var expDT = DateTime.Now.AddDays(expDays); + // decifro i valori.. + var decrVal = DecryptData(decodValue); + var opData = JsonConvert.DeserializeObject(decrVal); + if (opData != null) + { + var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey); + if (rigaOpr != null) + { + userTknDTO newUserTkn = new userTknDTO() + { + currOpr = rigaOpr, + expTime = expDT + }; + + var jsonTkn = JsonConvert.SerializeObject(newUserTkn); + string hash = TDService.EncryptData(jsonTkn); + RigaOper = rigaOpr; + await SetLastMatrOprAsync(rigaOpr.MatrOpr); + await SetCurrOperDtoAsync(hash); + await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash); + answ = true; + //if (LastOpenedPage != "" && CurrMacc != "") + //{ + // NavMan.NavigateTo(LastOpenedPage); + //} + //else + //{ + // NavMan.NavigateTo("status-map"); + //} + } + } + return answ; + } + + + /// + /// Salva matrOpr nel localstorage + /// + /// + public async Task SetLastMatrOprAsync(int matrOpr) + { + bool answ = false; + await localStorage.SetItemAsync("lastMatrOpr", matrOpr); + answ = true; + return answ; + } + /// /// Recupero singola preferenza utente /// @@ -377,6 +530,30 @@ namespace MP.Data.Services return done; } + /// + /// Recupero singola preferenza utente se presente, oppure imposto quella di default + /// indicata e la rendo + /// + /// + /// + public string UserPrefSetup(string chiave, string defValue) + { + string answ = defValue; + var currDict = UsersPrefDict; + if (currDict.ContainsKey(chiave)) + { + answ = currDict[chiave]; + } + else + { + if (MatrOpr > 0) + { + UserPrefSave(chiave, defValue); + } + } + return answ; + } + #endregion Public Methods #region Protected Fields @@ -401,6 +578,8 @@ namespace MP.Data.Services #region Protected Properties protected ILocalStorageService localStorage { get; set; } = null!; + protected TabDataService TDService { get; set; } = null!; + protected SharedMemService SMService { get; set; } = null!; protected ISessionStorageService sessionStore { get; set; } = null!; @@ -483,243 +662,5 @@ namespace MP.Data.Services } #endregion Private Methods - -#if false - public event Action EA_DateChanged = null!; - public event Action EA_CalModeChanged = null!; - - public event Action EA_TimbUpd = null!; -#endif - -#if false - public RegAttivitaModel? clonedRA { get; set; } = null; - - /// - /// Calcola HASH del codice impiego = payload utente - /// - /// - public string HashDip - { - get - { - DataValidator cDV = new DataValidator(_rigaOper); - string hash = cDV.HashDip; - return hash; - } - } -#endif -#if false - public bool IsActive - { - get - { - bool answ = false; - if (_rigaOper != null && _rigaOper.Attivo != null) - { - answ = (bool)_rigaOper.Attivo; - } - return answ; - } - } - - public bool isRicTimb { get; set; } = false; - - public CalendarModeEnum.modoControllo modoCal { get; set; } = CalendarModeEnum.modoControllo.showCalendar; -#endif - -#if false - /// - /// Indica ultima azione compiuta - /// - public string LastAction - { - get => lastAction; - set - { - if (lastAction != value) - { - lastAction = value; - } - } - } - - /// - /// Indica se il prossimo stato timbratura sia entrata - /// - public bool NextIsEntrata - { - get => nextIsEntrata; - set - { - if (nextIsEntrata != value) - { - nextIsEntrata = value; - } - } - } - - public string PageIcon - { - get => _pageIcon; - set - { - if (_pageIcon != value) - { - _pageIcon = value; - ReportPageUpd(); - } - } - } - - public string PageName - { - get => _pageName; - set - { - if (_pageName != value) - { - _pageName = value; - ReportPageUpd(); - } - } - } - - public bool PayloadOk { get; set; } = false; - public RegAttivitaModel? recordRA { get; set; } = null; -#endif -#if false - public string SearchVal - { - get => _searchVal; - set - { - if (_searchVal != value) - { - _searchVal = value; - - if (EA_DipUpdated != null) - { - EA_DipUpdated?.Invoke(); - } - } - } - } - - public int selWeekNum { get; set; } = 0; - public int selYear { get; set; } = DateTime.Today.Year; - - public bool ShowSearch - { - get => showSearch; - set - { - if (showSearch != value) - { - showSearch = value; - } - } - } - - public DateTime targetDate { get; set; } = DateTime.Today; - public DateTime targetDateMancTimb { get; set; } -#endif -#if false - - public void ReportDateChange() - { - if (EA_DateChanged != null) - { - EA_DateChanged?.Invoke(); - } - } - - public void setModeCalendar() - { - modoCal = CalendarModeEnum.modoControllo.showCalendar; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - public void setModeGauge() - { - modoCal = CalendarModeEnum.modoControllo.showGauge; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - public void setModeProj() - { - modoCal = CalendarModeEnum.modoControllo.showProj; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - public void setModeTempRil() - { - modoCal = CalendarModeEnum.modoControllo.showTempRil; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - public void setModeRichTimb() - { - modoCal = CalendarModeEnum.modoControllo.showTimbr; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - public void setModeShowWeek() - { - modoCal = CalendarModeEnum.modoControllo.showWeek; - if (EA_CalModeChanged != null) - { - EA_CalModeChanged?.Invoke(); - } - } - - public void ReportTimbratura() - { - if (EA_TimbUpd != null) - { - EA_TimbUpd?.Invoke(); - } - } -#endif -#if false - private string _pageIcon = ""; - private string _pageName = ""; -#endif -#if false - private string _searchVal = ""; - private bool showSearch; -#endif - -#if false - private string lastAction { get; set; } = ""; - private bool nextIsEntrata { get; set; } = true; -#endif - -#if false - private void ReportPageUpd() - { - if (EA_PageUpdated != null) - { - EA_PageUpdated?.Invoke(); - } - } - - private void ReportSearch() - { - if (EA_DipUpdated != null) - { - EA_DipUpdated?.Invoke(); - } - } -#endif } } \ No newline at end of file diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index d73c08cc..baa9cbb9 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1,4 +1,5 @@ -using Microsoft.EntityFrameworkCore; +using EgwCoreLib.Utils; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using MP.Data.DatabaseModels; using MP.Data.DTO; @@ -10,7 +11,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; -using System.Drawing.Drawing2D; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -375,7 +376,7 @@ namespace MP.Data.Services result = dbTabController.CommentiGetLastByMacc(idxMacchina, numDays); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, FastCache); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); } if (result == null) { @@ -512,6 +513,36 @@ namespace MP.Data.Services } return answ; } + /// + /// Recupera il valore in formato DOUBLE + /// + /// Valore da cercare + /// Int in cui salvare il valore se trovato + /// + public bool ConfigGetVal(string chiave, ref double varObj) + { + bool answ = false; + // se mancasse provo a configurare.. + if (CurrConfig == null || CurrConfig.Count == 0) + { + SetupConfig(); + } + if (CurrConfig != null && CurrConfig.Count > 0) + { + // sistemo i parametri opzionali... + ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave); + if (risultato != null) + { + NumberStyles numStyle; + CultureInfo culture; + numStyle = NumberStyles.Number; + culture = CultureInfo.InvariantCulture; + //culture = CultureInfo.CreateSpecificCulture("en-US"); + answ = double.TryParse(risultato.Valore, numStyle, culture, out varObj); + } + } + return answ; + } /// /// Recupera il valore in formato BOOL @@ -567,6 +598,11 @@ namespace MP.Data.Services return dbTabController.DDB_getNext(idxMacchina, inizioStato); } + public string DecryptData(string encData) + { + return SteamCrypto.DecryptString(encData, Constants.passPhrase); + } + public void Dispose() { // Clear database controller @@ -598,6 +634,45 @@ namespace MP.Data.Services return answ; } + /// + /// Elenco operatori + /// + /// + public async Task> ElencoOperatori() + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ElencoOpr"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbTabController.ElencoOperatori(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, LongCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"ElencoOperatori | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + public string EncryptData(string rawData) + { + return SteamCrypto.EncryptString(rawData, Constants.passPhrase); + } + /// /// Elimina una riga in EventList se trovata /// @@ -653,7 +728,7 @@ namespace MP.Data.Services result = await dbTabController.EvListGetLastBySearch(idxMacchina, dtLimit, idxTipo, maxRec); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, LongCache); } if (result == null) { @@ -817,7 +892,7 @@ namespace MP.Data.Services result = await Task.FromResult(dbTabController.ListPODLByMacc(idxMacchina, onlyFree, onlyDirect)); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, LongCache); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); } if (result == null) { @@ -1057,6 +1132,49 @@ namespace MP.Data.Services return answ; } + /// + /// Recupera un valore MSE x una macchina sub specifica + /// + /// + /// + /// + /// + public MappaStatoExpl MseGetSub(string idxMacc, string idxMacchSub, bool forceDb) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + MappaStatoExpl result = new MappaStatoExpl(); + // cerco in redis... + string currKey = $"{Constants.redisMseKeySingle}:{idxMacchSub}"; + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue && !forceDb) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"Read from REDIS: {ts.TotalMilliseconds}ms"); + } + else + { + var rawResult = dbTabController.MseGetSub(idxMacc, idxMacchSub); + if (rawResult != null && rawResult.Count > 0) + { + result = rawResult.FirstOrDefault(); + } + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, UltraLongCache); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms"); + } + if (result == null) + { + result = new MappaStatoExpl(); + } + return result; + } + /// /// ODL da key /// @@ -1094,6 +1212,31 @@ namespace MP.Data.Services return result; } + /// + /// Clear operazione setup ODL (annullamento) + /// + /// + /// + /// + public async Task OdlClearSetup(int idxODL, string idxMacchina) + { + bool answ = false; + try + { + // inserisco evento + answ = dbTabController.OdlClearSetup(idxODL, idxMacchina); + await FlushCache("ODL"); + await FlushCache("PODL"); + await FlushCache("VSODL"); + } + catch (Exception exc) + { + string logMsg = $"Eccezione in OdlUpdate | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}"; + Log.Error(logMsg); + } + return answ; + } + /// /// ODL corrente macchina /// @@ -1130,32 +1273,6 @@ namespace MP.Data.Services return result; } - /// - /// Registro fine prod ODL - /// - /// - /// - /// - public async Task OdlFineProd(int idxODL, string idxMacchina) - { - bool answ = false; - try - { - // inserisco evento - answ = dbTabController.OdlFineProd(idxODL, idxMacchina); - await FlushCache("ODL"); - await FlushCache("PODL"); - await FlushCache("VSODL"); - } - catch (Exception exc) - { - string logMsg = $"Eccezione in OdlFineProd | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}"; - Log.Error(logMsg); - } - return answ; - } - - /// /// Attrezzo stesso ODL dell'altra tavola /// @@ -1182,14 +1299,39 @@ namespace MP.Data.Services return answ; } - /// - /// Fix ODL per macchine SLAVE - /// - /// - /// - /// - /// - public async Task OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert) + /// + /// Registro fine prod ODL + /// + /// + /// + /// + public async Task OdlFineProd(int idxODL, string idxMacchina) + { + bool answ = false; + try + { + // inserisco evento + answ = dbTabController.OdlFineProd(idxODL, idxMacchina); + await FlushCache("ODL"); + await FlushCache("PODL"); + await FlushCache("VSODL"); + } + catch (Exception exc) + { + string logMsg = $"Eccezione in OdlFineProd | idxODL: {idxODL} | idxMacchina: {idxMacchina}{Environment.NewLine}{exc}"; + Log.Error(logMsg); + } + return answ; + } + + /// + /// Fix ODL per macchine SLAVE + /// + /// + /// + /// + /// + public async Task OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert) { bool answ = false; try @@ -1275,34 +1417,6 @@ namespace MP.Data.Services return result; } - /// - /// Riapertura ULTIMO ODL data macchina - /// - /// - /// - public ODLModel OdlReopenOdlMacc(string idxMacchina) - { - string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); - ODLModel result = new ODLModel(); - // cerco in redis... - string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST"; - var results = dbTabController.OdlReopenOdlMacc(idxMacchina); - // riordino - result = results.FirstOrDefault(); - // serializzp e salvo... - var rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, UltraLongCache); - if (result == null) - { - result = new ODLModel(); - } - sw.Stop(); - Log.Debug($"OdlReopenOdlMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms"); - return result; - } - /// /// Elenco ODL data macchina e periodo /// @@ -1331,7 +1445,7 @@ namespace MP.Data.Services result = result.OrderByDescending(x => x.DataInizio).ToList(); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, FastCache); } if (result == null) { @@ -1342,6 +1456,35 @@ namespace MP.Data.Services return result; } + /// + /// Riapertura ULTIMO ODL data macchina + /// + /// + /// + public async Task OdlReopenOdlMacc(string idxMacchina) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + ODLModel result = new ODLModel(); + // cerco in redis... + string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST"; + var results = await Task.FromResult(dbTabController.OdlReopenOdlMacc(idxMacchina)); + // riordino + result = results.FirstOrDefault(); + // svuoto cache + await FlushCache("ODL"); + await FlushCache("PODL"); + await FlushCache("VSODL"); + if (result == null) + { + result = new ODLModel(); + } + sw.Stop(); + Log.Debug($"OdlReopenOdlMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + /// /// Setup ODL Postumo /// @@ -1354,7 +1497,7 @@ namespace MP.Data.Services try { // inserisco evento - answ = dbTabController.OdlSetupPostumo(idxODL, idxMacchina); + answ = await Task.FromResult(dbTabController.OdlSetupPostumo(idxODL, idxMacchina)); await FlushCache("ODL"); await FlushCache("PODL"); await FlushCache("VSODL"); @@ -1380,7 +1523,7 @@ namespace MP.Data.Services try { // inserisco evento - answ = dbTabController.OdlSetupPromPostuma(idxPromOdl, matrOpr, idxMacchina); + answ = await Task.FromResult(dbTabController.OdlSetupPromPostuma(idxPromOdl, matrOpr, idxMacchina)); await FlushCache("ODL"); await FlushCache("PODL"); await FlushCache("VSODL"); @@ -1411,7 +1554,7 @@ namespace MP.Data.Services try { // inserisco evento - answ = dbTabController.OdlSplit(idxODL, matrOpr, idxMacchina, TCRich, pzPallet, note, startNewOdl, qtyRich); + answ = await Task.FromResult(dbTabController.OdlSplit(idxODL, matrOpr, idxMacchina, TCRich, pzPallet, note, startNewOdl, qtyRich)); await FlushCache("ODL"); await FlushCache("PODL"); await FlushCache("VSODL"); @@ -1429,6 +1572,9 @@ namespace MP.Data.Services /// /// /// + /// + /// + /// /// public async Task OdlUpdate(int idxODL, int matrOpr, decimal tCRichAttr, int pzPallet, string note) { @@ -1449,6 +1595,117 @@ namespace MP.Data.Services return answ; } + /// + /// Delete dell'oggetto opr serializzato + /// + /// + /// + public async Task OperatoreDeleteRedis(int matrOpr) + { + string source = "REDIS"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + bool answ = false; + // cerco in redis... + string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + var done = await ExecFlushRedisPattern(currKey); + if (done) + { + answ = true; + } + } + sw.Stop(); + Log.Debug($"OperatoreDeleteRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + await Task.Delay(1); + return answ; + } + + /// + /// Scrive l'hash dell'oggetto curr opr + /// + /// + /// + public async Task OperatoreGetRedis(int matrOpr) + { + string source = "REDIS"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + string answ = ""; + // cerco in redis... + string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + //var encrData = SteamCrypto.DecryptString(rawData, passPhrase); + //answ = JsonConvert.DeserializeObject(rawData); + answ = rawData; + } + if (answ == null) + { + answ = ""; + } + sw.Stop(); + Log.Debug($"OperatoreGetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + await Task.Delay(1); + return answ; + } + + /// + /// Log in operatore + /// + /// matricola operatore + /// Auth Key + /// + public async Task OperatoreSearch(int matrOpr, string authKey) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + AnagOperatoriModel answ = null; + answ = dbTabController.OperatoreSearch(matrOpr, authKey); + if (answ == null) + { + answ = new AnagOperatoriModel(); + } + sw.Stop(); + Log.Debug($"LoginOperatore | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + await Task.Delay(1); + return answ; + } + + /// + /// legge l'hash dell'oggetto curr opr + /// + /// + /// + public async Task OperatoreSetRedis(int matrOpr, string currOpr) + { + setExpDays(); + string source = "REDIS"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + string answ = ""; + // cerco in redis... + string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}"; + //RedisValue rawData = await redisDb.StringGetAsync(currKey); + // serializzo e salvo... + //rawData = JsonConvert.SerializeObject(currOpr); + answ = currOpr; + //var encrData = SteamCrypto.EncryptString(rawData, passPhrase); + await redisDb.StringSetAsync(currKey, currOpr, ConfigCache); + if (answ == null) + { + answ = ""; + } + sw.Stop(); + Log.Debug($"OperatoreSetRedis | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + await Task.Delay(1); + return answ; + } + /// /// Stato prod macchina /// @@ -1537,7 +1794,7 @@ namespace MP.Data.Services result = await Task.FromResult(dbTabController.PODLExp_getByKey(idxPODL)); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, FastCache); } if (result == null) { @@ -2517,7 +2774,7 @@ namespace MP.Data.Services result = dbIocController.VMSFDGetAll(); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); } if (result == null) { @@ -2591,7 +2848,7 @@ namespace MP.Data.Services result = dbIocController.VMSFDGetByMacc(idxMacc); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, LongCache); } if (result == null) { @@ -2656,7 +2913,7 @@ namespace MP.Data.Services result = await Task.FromResult(dbTabController.VSCS_getAll()); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, UltraLongCache); + await redisDb.StringSetAsync(currKey, rawData, LongCache); } if (result == null) { @@ -2729,7 +2986,7 @@ namespace MP.Data.Services result = await Task.FromResult(dbTabController.VSOdlGetUnused(idxMacchina, showAll, numDayAdd)); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, LongCache); + await redisDb.StringSetAsync(currKey, rawData, UltraFastCache); } if (result == null) { @@ -2744,6 +3001,8 @@ namespace MP.Data.Services #region Protected Fields + protected int expMinutes = 1; + /// /// Oggetto per connessione a REDIS /// @@ -2756,6 +3015,27 @@ namespace MP.Data.Services #endregion Protected Fields + #region Protected Properties + + /// + /// Durata cache data dal valore in config + /// + protected TimeSpan ConfigCache + { + get => TimeSpan.FromMinutes(expMinutes); + } + + #endregion Protected Properties + + #region Protected Methods + + protected void setExpDays() + { + ConfigGetVal("TAB_dtTimerScadLogin", ref expMinutes); + } + + #endregion Protected Methods + #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); @@ -2771,6 +3051,7 @@ namespace MP.Data.Services private string DataSource = ""; private string redisBaseKey = "MP:TAB:Cache"; + private string redisUserDataKey = "MP:TAB:Users"; #endregion Private Fields diff --git a/MP.Land/Components/CmpFooter.razor b/MP.Land/Components/CmpFooter.razor index 75e13002..1ba50c22 100644 --- a/MP.Land/Components/CmpFooter.razor +++ b/MP.Land/Components/CmpFooter.razor @@ -4,7 +4,7 @@
    @adesso - Egalware + Egalware  
    diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 2cc99106..424ea1e4 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2311.1009 + 6.16.2311.1619 @@ -44,6 +44,8 @@ + + diff --git a/MP.Land/Pages/About.razor b/MP.Land/Pages/About.razor index 945c6f4d..58a78d18 100644 --- a/MP.Land/Pages/About.razor +++ b/MP.Land/Pages/About.razor @@ -6,7 +6,7 @@
    -
    +
    @@ -16,7 +16,7 @@ @@ -41,51 +41,51 @@

    Info installazione


    -
    +
    Remote Server:
    -
    +
    @ServerStatus
    -
    +
    Cliente:
    -
    +
    @Installazione
    -
    +
    App:
    -
    +
    @Applicazione
    -
    +
    Licenze:
    -
    +
    @Licenze
    -
    +
    Scadenza:
    -
    +
    @($"{Scadenza:yyyy/MM/dd}")
    -
    +
    Key
    -
    - @MastKey +
    +
    diff --git a/MP.Land/Pages/Contacts.razor b/MP.Land/Pages/Contacts.razor index d621d0db..0c2f4157 100644 --- a/MP.Land/Pages/Contacts.razor +++ b/MP.Land/Pages/Contacts.razor @@ -5,7 +5,7 @@
    -
    +
    @@ -15,7 +15,7 @@ diff --git a/MP.Land/Pages/Index.razor b/MP.Land/Pages/Index.razor index 1d0d640f..95835196 100644 --- a/MP.Land/Pages/Index.razor +++ b/MP.Land/Pages/Index.razor @@ -3,7 +3,7 @@ @using MP.Land.Data @using MP.Land.Components -
    +

    MAPO Land

    @@ -24,7 +24,7 @@
    -
    +
    @if (ListRecords == null) { diff --git a/MP.Land/Pages/SysInfo.razor b/MP.Land/Pages/SysInfo.razor index f4e8ffe2..810db569 100644 --- a/MP.Land/Pages/SysInfo.razor +++ b/MP.Land/Pages/SysInfo.razor @@ -9,7 +9,7 @@
    -
    +
    @@ -19,7 +19,7 @@ diff --git a/MP.Land/Pages/UpdateManager.razor b/MP.Land/Pages/UpdateManager.razor index 454cea83..8e50d9b2 100644 --- a/MP.Land/Pages/UpdateManager.razor +++ b/MP.Land/Pages/UpdateManager.razor @@ -4,7 +4,7 @@ @using MP.Land.Components @inject LicenseService LicServ -
    +
    @@ -43,7 +43,7 @@
    } -
    +
    @if (ListRecords == null) { diff --git a/MP.Land/Pages/UserQr.razor b/MP.Land/Pages/UserQr.razor index 9f46b8c4..02a5b38c 100644 --- a/MP.Land/Pages/UserQr.razor +++ b/MP.Land/Pages/UserQr.razor @@ -3,7 +3,7 @@ @using MP.Land.Data @using MP.Land.Components -
    +
    @if (ListRecords == null) diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 2076f49f..609a99c8 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

    Versione: 6.16.2311.1009

    +

    Versione: 6.16.2311.1619


    Note di rilascio:
      diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index cf39a0ed..1cc366fe 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2311.1009 +6.16.2311.1619 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index e09e8ed5..faf03670 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2311.1009 + 6.16.2311.1619 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/wwwroot/img/LogoEgalware.svg b/MP.Land/wwwroot/img/LogoEgalware.svg new file mode 100644 index 00000000..afcdb10c --- /dev/null +++ b/MP.Land/wwwroot/img/LogoEgalware.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/MP.Land/wwwroot/img/LogoEgalwareBianco.svg b/MP.Land/wwwroot/img/LogoEgalwareBianco.svg new file mode 100644 index 00000000..acb59f58 --- /dev/null +++ b/MP.Land/wwwroot/img/LogoEgalwareBianco.svg @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MP.SPEC/Components/FLStatusList.razor.cs b/MP.SPEC/Components/FLStatusList.razor.cs index f25e8b8c..d86c17dc 100644 --- a/MP.SPEC/Components/FLStatusList.razor.cs +++ b/MP.SPEC/Components/FLStatusList.razor.cs @@ -116,7 +116,7 @@ namespace MP.SPEC.Components { idxMaccLast = IdxMaccSel; lastPeriodo = CurrPeriodo; - ListComplete = await MDataServ.ParetoFluxLog(IdxMaccSel, CurrPeriodo.Inizio, CurrPeriodo.Fine); + ListComplete = await MDataServ.FluxLogPareto(IdxMaccSel, CurrPeriodo.Inizio, CurrPeriodo.Fine); TotalCount = ListComplete.Count; TotalRecords = ListComplete.Sum(x => x.Qty); FluxList = ListComplete.Select(x => x.CodFlux).ToList(); diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 12593937..e16335c4 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -98,7 +98,7 @@ namespace MP.SPEC.Components SearchRecords = null; ListRecords = null; DateTime dataFrom = DateTime.Today.AddMonths(-1); - DateTime dataTo = DateTime.Now.AddMinutes(5); + DateTime dataTo = DateTime.Now.AddDays(1); if (SelFilter != null && SelFilter.dtMin != null) { dataFrom = (DateTime)SelFilter.dtMin; diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs index 1ccadf88..09bcab53 100644 --- a/MP.SPEC/Components/ParamsFilter.razor.cs +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -204,7 +204,7 @@ namespace MP.SPEC.Components currFilt.LiveUpdate = true; currFilt.CurrPage = 0; currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; - currFilt.dtMax = RoundDatetime(5); + currFilt.dtMax = DateTime.Today.AddDays(1); //RoundDatetime(5); currFilt.dtSnapMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot); SelFilter = currFilt; } diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 509f488a..f4957287 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -800,6 +800,41 @@ namespace MP.SPEC.Data return result; } + /// + /// Elenco Gruppi + /// + /// + public async Task> FluxLogPareto(string idxMacchina, DateTime dtFrom, DateTime dtTo) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string source = "DB"; + List? result = new List(); + // cerco in redis... + string redKey = $"{Utils.redisParetoFLKey}:{idxMacchina}:{dtFrom:yyyyMMdd}:{dtTo:yyyyMMdd}"; + RedisValue rawData = await redisDb.StringGetAsync(redKey); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.FluxLogPareto(idxMacchina, dtFrom, dtTo)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(redKey, rawData, getRandTOut(redisLongTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ParetoFluxLog Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Stored manutenzione del DB /// @@ -1248,41 +1283,6 @@ namespace MP.SPEC.Data return result; } - /// - /// Elenco Gruppi - /// - /// - public async Task> ParetoFluxLog(string idxMacchina, DateTime dtFrom, DateTime dtTo) - { - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string source = "DB"; - List? result = new List(); - // cerco in redis... - string redKey = $"{Utils.redisParetoFLKey}:{idxMacchina}:{dtFrom:yyyyMMdd}:{dtTo:yyyyMMdd}"; - RedisValue rawData = await redisDb.StringGetAsync(redKey); - if (!string.IsNullOrEmpty($"{rawData}")) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = await Task.FromResult(dbController.ParetoFluxLog(idxMacchina, dtFrom, dtTo)); - // serializzo e salvo... - rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(redKey, rawData, getRandTOut(redisLongTimeCache)); - } - if (result == null) - { - result = new List(); - } - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ParetoFluxLog Read from {source}: {ts.TotalMilliseconds}ms"); - return result; - } - /// /// Eliminazione record selezionato /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index e5ed1dd8..2217a6fb 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2311.1016 + 6.16.2312.1117 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 8d44feee..416babf1 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

      Versione: 6.16.2311.1016

      +

      Versione: 6.16.2312.1117


      Note di rilascio:
      • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index e1f886bd..37708e5b 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2311.1016 +6.16.2312.1117 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index a93e69cf..40e59b61 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2311.1016 + 6.16.2312.1117 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false