Bozza scan

This commit is contained in:
zaccaria.majid
2022-11-23 15:27:23 +01:00
parent a703d57769
commit a1c83136bd
14 changed files with 263 additions and 49 deletions
+6 -1
View File
@@ -1,2 +1,7 @@
<input value="@rawScan" class="fs-3" @ref="@target"/>
<input value="@rawScan" class="fs-3 mb-2" @ref="@target" style="width: 17rem;" />
<div class="col-12">
<ProcSuggestion currParams="@currParams"></ProcSuggestion>
</div>
+8 -1
View File
@@ -14,6 +14,7 @@ using Microsoft.JSInterop;
using MP.INVE;
using MP.INVE.Shared;
using MP.INVE.Components;
using MP.INVE.Data;
namespace MP.INVE.Components
{
@@ -29,10 +30,16 @@ namespace MP.INVE.Components
// all'apertura del componente -_> focus su txtbox scan (e anche dopo input)
}
private ElementReference target;
protected string lastScan { get; set; } = "";
protected string rawScan { get; set; } = "";
public SelectScanParams currParams = new SelectScanParams();
protected string rawScan
{
get => currParams.UDC;
set => currParams.UDC = value;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
+17 -9
View File
@@ -1,7 +1,5 @@
<h3>ProcSuggestion</h3>
@*ci dovranno andare i dati di riconoscimento:
@*ci dovranno andare i dati di riconoscimento:
<h3>ProcSuggestion</h3>
<ul>
<li>tipo di oggetto (UDC MAG = univoco, generico semilav / mat prima, lotto...)</li>
@@ -10,12 +8,22 @@
<li>totalmente ignoto</li>
</ul>*@
<div class="card" style="width: 18rem;">
<img src="..." class="card-img-top" alt="...">
<div class="card">
<div class="card-body">
<h5 class="card-title">Card title</h5>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
<div class="card-title d-flex justify-content-between">
@if (udc != null)
{
<span class="fs-2 fw-bold">
@udc.UDC
</span>
<span class="fs-5 py-1 fw-bold">
@tipo
</span>
}
</div>
<ul class="list-group list-group-flush">
<li class="list-group-item">An item</li>
</ul>
</div>
</div>
@@ -14,10 +14,43 @@ using Microsoft.JSInterop;
using MP.INVE;
using MP.INVE.Shared;
using MP.INVE.Components;
using MP.INVE.Data;
using MP.Data.DatabaseModels;
namespace MP.INVE.Components
{
public partial class ProcSuggestion
{
[Inject]
private MiDataService MIService { get; set; } = null!;
[Parameter]
public SelectScanParams currParams { get; set; } = null!;
protected string rawScan
{
get => currParams.UDC;
set => currParams.UDC = value;
}
private string tipo { get; set; } = "";
public List<AnagUdcModel>? searchrecords;
public AnagUdcModel? udc;
protected override async Task OnInitializedAsync()
{
//await FilterChanged.InvokeAsync(actFilter);
await Task.Delay(1);
searchrecords = MIService.ElencoUDC();
udc = searchrecords.Where(x => x.UDC == rawScan).FirstOrDefault();
if (udc != null)
{
if (udc.UDC.Contains("MFI"))
{
tipo = "FINITO";
}
}
}
}
}
+67 -2
View File
@@ -219,6 +219,69 @@ namespace MP.INVE.Data
return result;
}
public List<AnagUdcModel> ElencoUDC()
{
string source = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<AnagUdcModel>? result = new List<AnagUdcModel>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisUdcBaseAddr);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagUdcModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.ElencoUdc();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisUdcBaseAddr, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
{
result = new List<AnagUdcModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ElencoUDC Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
public List<AnagLottoModel> ElencoLotti()
{
string source = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<AnagLottoModel>? result = new List<AnagLottoModel>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisLottiBaseAddr);
if (!string.IsNullOrEmpty($"{rawData}"))
{
result = JsonConvert.DeserializeObject<List<AnagLottoModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.ElencoLotti();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSetAsync(redisLottiBaseAddr, rawData, getRandTOut(redisLongTimeCache));
source = "DB";
}
if (result == null)
{
result = new List<AnagLottoModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ElencoLotti Read from {source}: {ts.TotalMilliseconds}ms");
return result;
}
public string EncriptData(string rawData)
{
return SteamCrypto.EncryptString(rawData, passPhrase);
@@ -388,8 +451,10 @@ namespace MP.INVE.Data
#region Private Fields
private const string redisBaseAddr = "MP:INVE";
private const string redisSessionBaseAddr = ":Session:";
private const string redisOperatoriBaseAddr = ":Operatore:";
private const string redisSessionBaseAddr = ":Session";
private const string redisOperatoriBaseAddr = ":Operatore";
private const string redisUdcBaseAddr = ":UDC";
private const string redisLottiBaseAddr = ":Lotti";
private const string redisElencoOperatori = redisBaseAddr + redisOperatoriBaseAddr + ":ListOperatori";
private const string redisOperatoreLogged = redisBaseAddr + redisOperatoriBaseAddr + ":OperatoreLogged";
private const string redisSessionCurrList = redisBaseAddr + redisSessionBaseAddr + ":ListSessHist";
+55
View File
@@ -0,0 +1,55 @@
using MP.Data;
namespace MP.INVE.Data
{
public class SelectScanParams
{
#region Public Constructors
public SelectScanParams()
{ }
#endregion Public Constructors
#region Public Properties
public int CurrPage { get; set; } = 1;
public int NumRec { get; set; } = 10;
public int TotCount { get; set; } = 0;
public int MaxRecord { get; set; } = 100;
public string UDC { get; set; } = "";
#endregion Public Properties
#region Public Methods
public override bool Equals(object obj)
{
if (!(obj is SelectScanParams item))
return false;
if (MaxRecord != item.MaxRecord)
return false;
if (TotCount != item.TotCount)
return false;
if (NumRec != item.NumRec)
if (CurrPage != item.CurrPage)
return false;
if (UDC != item.UDC)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2211.2310</Version>
<Version>6.16.2211.2315</Version>
</PropertyGroup>
<ItemGroup>
+1 -5
View File
@@ -2,7 +2,7 @@
<div class="card">
<div class="card mb-5">
<div class="card-header">
<h3>Acquisizione</h3>
</div>
@@ -11,9 +11,6 @@
<div class="col-12">
<CodeScan></CodeScan>
</div>
<div class="col-12">
<ProcSuggestion></ProcSuggestion>
</div>
<div class="col-12">
<ProcOperat></ProcOperat>
</div>
@@ -28,7 +25,6 @@
</div>
}
</div>
<span> @idOPeratore @authKey </span>
</div>
+16 -26
View File
@@ -1,32 +1,22 @@
@page "/Test"
<h3>Test</h3>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
Button with data-bs-target
</button>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div>
Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
<div class="d-flex justify-content-between">
<div class="card">
<div>GIUSTO</div>
<div class="card-body">
<div class="img-fluid" id="qrCodeImg_101"></div>
</div>
<div class="dropdown mt-3">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown">
Dropdown button
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</div>
<div class="card">
<div>SBAGLIATO</div>
<div class="card-body">
<div class="img-fluid" id="qrCodeImg_102"></div>
</div>
</div>
<div class="card">
<div>GIUSTO</div>
<div class="card-body">
<div class="img-fluid" id="qrCodeImg_103"></div>
</div>
</div>
</div>
@code {
}
+54
View File
@@ -0,0 +1,54 @@
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.INVE.Data;
using MP.Data.DatabaseModels;
namespace MP.INVE.Pages
{
public partial class Test
{
[Inject]
MiDataService MIService { get; set; } = null!;
[Inject]
IJSRuntime JSRuntime { get; set; } = null!;
List<AnagUdcModel>? elencoUDC;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
//elencoUDC = MIService.ElencoUDC().Take(4).ToList();
//await getId();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}");
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", "20MFI000000001");
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{102}");
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{102}", "20MSL000000002");
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{103}");
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{103}", "21MFI000000013");
}
}
private string CodUDC { get; set; } = null!;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2211.2310</h4>
<h4>Versione: 6.16.2211.2315</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2310
6.16.2211.2315
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2310</version>
<version>6.16.2211.2315</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>
+2 -1
View File
@@ -19,6 +19,7 @@
"redisLongTimeCache": "15",
"MpIoBaseUrl": "http://localhost:20967/",
"BaseUrl": "https://iis01.egalware.com/mp/inve/Acquisizione?",
"BaseUrlJumper": "https://iis01.egalware.com/mp/inve/jumper?"
"BaseUrlJumper": "https://iis01.egalware.com/mp/inve/jumper?",
"BaseUrlJumperTest": "https://Localhost:7212/jumper?"
}
}