fix gestione selezoine sessioni

This commit is contained in:
zaccaria.majid
2022-12-27 17:20:40 +01:00
parent 7aa1ded434
commit 409b93daba
4 changed files with 43 additions and 26 deletions
+8 -5
View File
@@ -1,23 +1,26 @@
@if (lastScanSessione != "0" && !string.IsNullOrEmpty(lastScanSessione))
{
@if (sessioneScelta != null)
@if (currSess != 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
@currSess.InveSessID
</div>
<span class="fw-bold fs-5">Descrizione sessione:</span>
<div class="fs-4">
@sessioneScelta.Description
@currSess.Description
</div>
<span class="fw-bold fs-5">Descrizione magazzino:</span>
<div class="fs-4">
@sessioneScelta.AnagMagNav.DescMag
@if (currSess.AnagMagNav != null)
{
@currSess.AnagMagNav.DescMag
}
</div>
</div>
<button class="btn btn-sm btn-success" @onclick="()=>connetti(sessioneScelta.InveSessID, sessioneScelta.AnagMagNav.CodMag)">Connetti</button>
<button class="btn btn-sm btn-success" @onclick="()=>connetti(currSess.InveSessID, currSess.AnagMagNav.CodMag)">Connetti</button>
</div>
}
}
+4 -5
View File
@@ -41,8 +41,7 @@ namespace MP.INVE.Components
protected MessageService MsgService { get; set; } = null!;
protected InventorySessionModel? sessioneScelta = new InventorySessionModel();
protected List<InventorySessionModel>? elencoSessioni = new List<InventorySessionModel>();
protected InventorySessionModel? currSess = new InventorySessionModel();
protected override async Task OnInitializedAsync()
{
@@ -59,16 +58,16 @@ namespace MP.INVE.Components
await Task.Delay(1);
if (lastScanSessione != null)
{
sessioneScelta = MIService.InventSessByID(int.Parse(lastScanSessione));
currSess = MIService.InventSessByID(int.Parse(lastScanSessione));
}
}
protected async void connetti(int sessionId, string magazzinoId)
protected void connetti(int sessionId, string magazzinoId)
{
var decrypt = MIService.DeriptData(authKey);
var log = MIService.loginOperatore(idOpr, decrypt);
if (log)
{
if (sessioneScelta != null)
if (currSess != null)
{
//string hash = MIService.EncriptData(sessioneScelta.authKey);
+2 -3
View File
@@ -16,17 +16,16 @@ else
}
@*<input type="text" class="form-control" @bind="@idOpr" />*@
<CodeScan lastRawScan="saveScan"></CodeScan>
@json
@if (rawScan != "")
{
@if (string.IsNullOrEmpty(idOpr))
{
<ProcOperatore lastScanOperatore="@rawScan" sessionId="@inveSessionId" magazzinoId="@codMag"></ProcOperatore>
}
@*@if(inveSessionId == 0)
else if(inveSessionId == 0)
{
<ProcSess lastScanSessione="@rawScan" idOpr="@int.Parse(idOpr)" authKey="@authKey"></ProcSess>
}*@
}
}
}
+29 -13
View File
@@ -46,26 +46,36 @@ namespace MP.INVE.Pages
{
await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idMag", out var _codMag))
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr))
{
if (!string.IsNullOrEmpty(_matrOpr))
{
idOpr = _matrOpr;
}
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey))
{
if (!string.IsNullOrEmpty(_authKey))
{
authKey = _authKey;
}
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId))
{
if (_inveSessionId != 0)
{
inveSessionId = int.Parse(_inveSessionId);
}
}
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("idMag", out var _codMag))
{
if (!string.IsNullOrEmpty(_codMag))
{
codMag = _codMag;
}
if (inveSessionId != 0)
{
inveSessionId = int.Parse(_inveSessionId);
}
}
#if false
if (!string.IsNullOrEmpty(idOpr) && !string.IsNullOrEmpty(authKey))
{
isFullUrl = true;
@@ -100,13 +110,14 @@ namespace MP.INVE.Pages
NavManager.NavigateTo($"Acquisizione?idSess={inveSessionId}&idOpr={idOpr}&codMag={codMag}");
}
}
}
}
#endif
}
string json = "";
Dictionary<string, string> uriProc = new Dictionary<string, string>();
Dictionary<string, string> uriProcDict = new Dictionary<string, string>();
protected void saveScan(string newScan)
{
uriProc.Clear();
uriProcDict.Clear();
if (!string.IsNullOrEmpty(newScan))
{
//eseguo split su "?" e divido in due il link
@@ -118,12 +129,17 @@ namespace MP.INVE.Pages
for (int i = 0; i < uriProc2.Length; i++)
{
uriProc3 = uriProc2[i].Split("=");
uriProc.Add(uriProc3[0], uriProc3[1]);
uriProcDict.Add(uriProc3[0], uriProc3[1]);
}
json = JsonConvert.SerializeObject(uriProc);
rawScan = uriProc["MatrOpr"];
if (string.IsNullOrEmpty(idOpr))
{
rawScan = uriProcDict["MatrOpr"];
}
else
{
rawScan = uriProcDict["IdSessione"];
}
}
}
protected string rawScan { get; set; } = null!;