From c4d604f2016a34b72bc3cd835798ab9a8e6dd440 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 27 Dec 2022 16:09:53 +0100 Subject: [PATCH] fix gestione uri con valori estratti e messi in dizionario --- MP.Data/DTO/UriDTO.cs | 16 +++++ MP.INVE/Components/ListQrOpr.razor.cs | 2 +- MP.INVE/Components/ProcSess.razor | 23 +++++++ MP.INVE/Components/ProcSess.razor.cs | 97 +++++++++++++++++++++++++++ MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Jumper.razor | 19 +++++- MP.INVE/Pages/Jumper.razor.cs | 20 +++++- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 10 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 MP.Data/DTO/UriDTO.cs create mode 100644 MP.INVE/Components/ProcSess.razor create mode 100644 MP.INVE/Components/ProcSess.razor.cs diff --git a/MP.Data/DTO/UriDTO.cs b/MP.Data/DTO/UriDTO.cs new file mode 100644 index 00000000..2cacf030 --- /dev/null +++ b/MP.Data/DTO/UriDTO.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DTO +{ + public class UriDTO + { + public int MatrOpr { get; set; } = 0; + public int IdSessione { get; set; } = 0; + public string IdMag { get; set; } = ""; + public string UserAuthKey { get; set; } = ""; + } +} diff --git a/MP.INVE/Components/ListQrOpr.razor.cs b/MP.INVE/Components/ListQrOpr.razor.cs index f3f0fdc7..00a84acc 100644 --- a/MP.INVE/Components/ListQrOpr.razor.cs +++ b/MP.INVE/Components/ListQrOpr.razor.cs @@ -65,7 +65,7 @@ namespace MP.INVE.Components get { string answ = ""; - answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}"; + answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}&IdSessione=0&IdMag=0"; return answ; } } diff --git a/MP.INVE/Components/ProcSess.razor b/MP.INVE/Components/ProcSess.razor new file mode 100644 index 00000000..2d3a5591 --- /dev/null +++ b/MP.INVE/Components/ProcSess.razor @@ -0,0 +1,23 @@ +@if (lastScanSessione != "0" && !string.IsNullOrEmpty(lastScanSessione)) +{ + @if (sessioneScelta != null) + { +
+
+ Id sessione: +
+ @sessioneScelta.InveSessID +
+ Descrizione sessione: +
+ @sessioneScelta.Description +
+ Descrizione magazzino: +
+ @sessioneScelta.AnagMagNav.DescMag +
+
+ +
+ } +} \ No newline at end of file diff --git a/MP.INVE/Components/ProcSess.razor.cs b/MP.INVE/Components/ProcSess.razor.cs new file mode 100644 index 00000000..1335f1df --- /dev/null +++ b/MP.INVE/Components/ProcSess.razor.cs @@ -0,0 +1,97 @@ +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.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; +using MP.INVE.Pages; +using Blazored.LocalStorage; +using MP.Data.DTO; + +namespace MP.INVE.Components +{ + public partial class ProcSess + { + [Parameter] + public string lastScanSessione { get; set; } = "0"; + [Parameter] + public int idOpr { get; set; } = 0; + [Parameter] + public string authKey { get; set; } = ""; + + [Inject] + protected MiDataService MIService { get; set; } = null!; + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + [Inject] + protected MessageService MsgService { get; set; } = null!; + + + protected InventorySessionModel? sessioneScelta = new InventorySessionModel(); + protected List? elencoSessioni = new List(); + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + } + + protected override async Task OnParametersSetAsync() + { + await Task.Delay(1); + await reloadData(false); + } + private async Task reloadData(bool first) + { + await Task.Delay(1); + if (lastScanSessione != null) + { + sessioneScelta = MIService.InventSessByID(int.Parse(lastScanSessione)); + } + } + protected async void connetti(int sessionId, string magazzinoId) + { + var decrypt = MIService.DeriptData(authKey); + var log = MIService.loginOperatore(idOpr, decrypt); + if (log) + { + if (sessioneScelta != null) + { + + //string hash = MIService.EncriptData(sessioneScelta.authKey); +#if false + OperatoreDTO sessionOpr = new OperatoreDTO + { + MatrOpr = idOpr, + Nome = sessioneScelta.Nome, + Cognome = sessioneScelta.Cognome, + hashAuthKey = authKey, + dtExp = DateTime.Now.AddMinutes(1) + }; +#endif + +#if false + await localStorage.SetItemAsync("MatrOpr", currOpr); + localStorage.SetItemAsync("idSessione", inveSessionId); + await MsgService.setCurrOperDtoAsync(sessionOpr); +#endif + + NavManager.NavigateTo($"Acquisizione?idSess={sessionId}&idOpr={idOpr}&codMag={magazzinoId}"); + } + } + } + } +} \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index f8971233..c8f36ae9 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.2712 + 6.16.2212.2716 diff --git a/MP.INVE/Pages/Jumper.razor b/MP.INVE/Pages/Jumper.razor index f7641b76..680dc112 100644 --- a/MP.INVE/Pages/Jumper.razor +++ b/MP.INVE/Pages/Jumper.razor @@ -6,12 +6,27 @@ } else { - Selezionare l'operatore + @if (idOpr == "0") + { + Selezionare l'operatore + } + else + { + Selezionare la sessione + } @**@ + @json @if (rawScan != "") { - + @if (idOpr == "0") + { + + } + @*@if(inveSessionId == 0) + { + + }*@ } } diff --git a/MP.INVE/Pages/Jumper.razor.cs b/MP.INVE/Pages/Jumper.razor.cs index b3d0bd80..b574639a 100644 --- a/MP.INVE/Pages/Jumper.razor.cs +++ b/MP.INVE/Pages/Jumper.razor.cs @@ -5,6 +5,9 @@ using Microsoft.AspNetCore.WebUtilities; using MP.Data.DatabaseModels; using MP.Data.DTO; using MP.INVE.Data; +using Newtonsoft.Json; +using System.Numerics; +using System.Web; namespace MP.INVE.Pages { @@ -19,7 +22,7 @@ namespace MP.INVE.Pages protected string idOpr { get; set; } = ""; protected int inveSessionId { get; set; } = 0; - protected bool isFullUrl{ get; set; } = false; + protected bool isFullUrl { get; set; } = false; [Inject] protected ILocalStorageService localStorage { get; set; } = null!; @@ -86,8 +89,11 @@ namespace MP.INVE.Pages } } } + string json = ""; + Dictionary uriProc = new Dictionary(); protected void saveScan(string newScan) { + uriProc.Clear(); if (!string.IsNullOrEmpty(newScan)) { //eseguo split su "?" e divido in due il link @@ -95,9 +101,17 @@ namespace MP.INVE.Pages //eseguo split su "&" e divido il rimanente del link ottenendo così le variabili singole var uriProc2 = uriProc1[1].Split("&"); //eseguo split su "=" ottenendo il valore delle variabili - var uriProc3 = uriProc2[0].Split("="); + string[] uriProc3; - rawScan = uriProc3[1]; + for (int i = 0; i < uriProc2.Length; i++) + { + uriProc3 = uriProc2[i].Split("="); + uriProc.Add(uriProc3[0], uriProc3[1]); + } + + json = JsonConvert.SerializeObject(uriProc); + + rawScan = uriProc["MatrOpr"]; } } protected string rawScan { get; set; } = null!; diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index aaf7c534..4bfea4a3 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.2712

+

Versione: 6.16.2212.2716


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 6cf964bb..75554f4e 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.2712 +6.16.2212.2716 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 37182588..e1bc1acb 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.2712 + 6.16.2212.2716 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false