fix gestione uri con valori estratti e messi in dizionario

This commit is contained in:
zaccaria.majid
2022-12-27 16:09:53 +01:00
parent bce9d71316
commit c4d604f201
10 changed files with 175 additions and 10 deletions
+16
View File
@@ -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; } = "";
}
}
+1 -1
View File
@@ -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;
}
}
+23
View File
@@ -0,0 +1,23 @@
@if (lastScanSessione != "0" && !string.IsNullOrEmpty(lastScanSessione))
{
@if (sessioneScelta != null)
{
<div class="card">
<div class="card-body text-center">
<span class="fw-bold fs-5">Id sessione:</span>
<div class="fs-4">
@sessioneScelta.InveSessID
</div>
<span class="fw-bold fs-5">Descrizione sessione:</span>
<div class="fs-4">
@sessioneScelta.Description
</div>
<span class="fw-bold fs-5">Descrizione magazzino:</span>
<div class="fs-4">
@sessioneScelta.AnagMagNav.DescMag
</div>
</div>
<button class="btn btn-sm btn-success" @onclick="()=>connetti(sessioneScelta.InveSessID, sessioneScelta.AnagMagNav.CodMag)">Connetti</button>
</div>
}
}
+97
View File
@@ -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<InventorySessionModel>? elencoSessioni = new List<InventorySessionModel>();
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}");
}
}
}
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2212.2712</Version>
<Version>6.16.2212.2716</Version>
</PropertyGroup>
<ItemGroup>
+17 -2
View File
@@ -6,12 +6,27 @@
}
else
{
<span class="fs-4">Selezionare l'operatore</span>
@if (idOpr == "0")
{
<span class="fs-4">Selezionare l'operatore</span>
}
else
{
<span class="fs-4">Selezionare la sessione</span>
}
@*<input type="text" class="form-control" @bind="@idOpr" />*@
<CodeScan lastRawScan="saveScan"></CodeScan>
@json
@if (rawScan != "")
{
<ProcOperatore lastScanOperatore="@rawScan" sessionId="@inveSessionId" magazzinoId="@codMag"></ProcOperatore>
@if (idOpr == "0")
{
<ProcOperatore lastScanOperatore="@rawScan" sessionId="@inveSessionId" magazzinoId="@codMag"></ProcOperatore>
}
@*@if(inveSessionId == 0)
{
<ProcSess lastScanSessione="@rawScan" idOpr="@int.Parse(idOpr)" authKey="@authKey"></ProcSess>
}*@
}
}
+17 -3
View File
@@ -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<string, string> uriProc = new Dictionary<string, string>();
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!;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.2712</h4>
<h4>Versione: 6.16.2212.2716</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.2712
6.16.2212.2716
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.2712</version>
<version>6.16.2212.2716</version>
<url>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>