From a1c83136bdb86147fc2a3414af3f05cf0a8553dc Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 23 Nov 2022 15:27:23 +0100 Subject: [PATCH] Bozza scan --- MP.INVE/Components/CodeScan.razor | 7 ++- MP.INVE/Components/CodeScan.razor.cs | 9 ++- MP.INVE/Components/ProcSuggestion.razor | 26 +++++--- MP.INVE/Components/ProcSuggestion.razor.cs | 33 +++++++++++ MP.INVE/Data/MiDataService.cs | 69 +++++++++++++++++++++- MP.INVE/Data/SelectScanParams.cs | 55 +++++++++++++++++ MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Acquisizione.razor | 6 +- MP.INVE/Pages/Test.razor | 42 +++++-------- MP.INVE/Pages/Test.razor.cs | 54 +++++++++++++++++ MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- MP.INVE/appsettings.json | 3 +- 14 files changed, 263 insertions(+), 49 deletions(-) create mode 100644 MP.INVE/Data/SelectScanParams.cs create mode 100644 MP.INVE/Pages/Test.razor.cs diff --git a/MP.INVE/Components/CodeScan.razor b/MP.INVE/Components/CodeScan.razor index 3fd88bb3..30f0aa3c 100644 --- a/MP.INVE/Components/CodeScan.razor +++ b/MP.INVE/Components/CodeScan.razor @@ -1,2 +1,7 @@  - \ No newline at end of file + + + +
+ +
\ No newline at end of file diff --git a/MP.INVE/Components/CodeScan.razor.cs b/MP.INVE/Components/CodeScan.razor.cs index 8ae73d5a..9a1e6ea4 100644 --- a/MP.INVE/Components/CodeScan.razor.cs +++ b/MP.INVE/Components/CodeScan.razor.cs @@ -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) { diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index f9885076..a83689fd 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -1,7 +1,5 @@ -

ProcSuggestion

- - -@*ci dovranno andare i dati di riconoscimento: +@*ci dovranno andare i dati di riconoscimento: +

ProcSuggestion

*@ -
- ... +
-
Card title
-

Some quick example text to build on the card title and make up the bulk of the card's content.

- Go somewhere +
+ @if (udc != null) + { + + @udc.UDC + + + @tipo + + } +
+
    +
  • An item
  • +
diff --git a/MP.INVE/Components/ProcSuggestion.razor.cs b/MP.INVE/Components/ProcSuggestion.razor.cs index 4f4ea761..4e557bd4 100644 --- a/MP.INVE/Components/ProcSuggestion.razor.cs +++ b/MP.INVE/Components/ProcSuggestion.razor.cs @@ -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? 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"; + } + } + } + } } \ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 6d826b34..dd2b6258 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -219,6 +219,69 @@ namespace MP.INVE.Data return result; } + public List ElencoUDC() + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisUdcBaseAddr); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{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(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ElencoUDC Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List ElencoLotti() + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisLottiBaseAddr); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{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(); + } + 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"; diff --git a/MP.INVE/Data/SelectScanParams.cs b/MP.INVE/Data/SelectScanParams.cs new file mode 100644 index 00000000..d6257110 --- /dev/null +++ b/MP.INVE/Data/SelectScanParams.cs @@ -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 + } +} \ No newline at end of file diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 3403d56a..74a263e8 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.2310 + 6.16.2211.2315 diff --git a/MP.INVE/Pages/Acquisizione.razor b/MP.INVE/Pages/Acquisizione.razor index f77e8fb6..7af48484 100644 --- a/MP.INVE/Pages/Acquisizione.razor +++ b/MP.INVE/Pages/Acquisizione.razor @@ -2,7 +2,7 @@ -
+

Acquisizione

@@ -11,9 +11,6 @@
-
- -
@@ -28,7 +25,6 @@
}
- @idOPeratore @authKey
diff --git a/MP.INVE/Pages/Test.razor b/MP.INVE/Pages/Test.razor index be6e0035..5d849a45 100644 --- a/MP.INVE/Pages/Test.razor +++ b/MP.INVE/Pages/Test.razor @@ -1,32 +1,22 @@ @page "/Test" -

Test

- - -
-
-
Offcanvas
- -
-
-
- Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc. +
+
+
GIUSTO
+
+
- +
+
SBAGLIATO
+
+
+
+
+
+
GIUSTO
+
+
- -@code { - -} diff --git a/MP.INVE/Pages/Test.razor.cs b/MP.INVE/Pages/Test.razor.cs new file mode 100644 index 00000000..6ae918e7 --- /dev/null +++ b/MP.INVE/Pages/Test.razor.cs @@ -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? 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!; + } +} \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 953220cf..ebd950e4 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2211.2310

+

Versione: 6.16.2211.2315


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 0c4130fc..ab2beada 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2310 +6.16.2211.2315 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 97ca34de..c16f13ff 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2310 + 6.16.2211.2315 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 diff --git a/MP.INVE/appsettings.json b/MP.INVE/appsettings.json index 0e6a99e2..61265b54 100644 --- a/MP.INVE/appsettings.json +++ b/MP.INVE/appsettings.json @@ -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?" } }