From d4e1c17790135955fab2d92a9af81ad440d3f3a5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Dec 2022 11:39:16 +0100 Subject: [PATCH] INVE: - Aggiounta navigazione dettaglio scansioni --- MP.Data/Controllers/MpInveController.cs | 45 +++- MP.INVE/Components/InveSessionList.razor.cs | 264 +++++++++++--------- MP.INVE/Components/ListTotLotto.razor | 2 +- MP.INVE/Components/LotScanDetail.razor | 90 ++++--- MP.INVE/Components/LotScanDetail.razor.cs | 46 ++++ MP.INVE/Data/MiDataService.cs | 28 ++- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Invio.razor.cs | 24 +- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 11 files changed, 318 insertions(+), 189 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index e371b009..297f3c01 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -127,8 +127,10 @@ namespace MP.Data.Controllers /// /// Elenco Scansioni Totali /// + /// + /// /// - public ScanDataModel ScanByUdcSession(string udc, int InveSessId) + public ScanDataModel ScanByUdcSession(string Udc, int InveSessId) { ScanDataModel dbResult = new ScanDataModel(); using (var dbCtx = new MoonPro_InveContext(_configuration)) @@ -137,7 +139,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbScanData - .Where(x => (x.ScanValue == udc) && (x.InveSessID == InveSessId)) + .Where(x => (x.ScanValue == Udc) && (x.InveSessID == InveSessId)) .AsNoTracking() .OrderByDescending(x => x.DtScan) .FirstOrDefault(); @@ -146,7 +148,7 @@ namespace MP.Data.Controllers { dbResult = dbCtx .DbScanData - .Where(x => (x.ScanValue == udc)) + .Where(x => (x.ScanValue == Udc)) .AsNoTracking() .OrderByDescending(x => x.DtScan) .FirstOrDefault(); @@ -154,6 +156,39 @@ namespace MP.Data.Controllers } return dbResult; } + + /// + /// Elenco Scansioni dato lotto e sessione + /// + /// + /// + /// + public List ScanByLottoSession(string Lotto, int InveSessId) + { + List dbResult = new List(); + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + if (InveSessId != 0) + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.Lotto == Lotto) && (x.InveSessID == InveSessId)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .ToList(); + } + else + { + dbResult = dbCtx + .DbScanData + .Where(x => (x.Lotto == Lotto)) + .AsNoTracking() + .OrderByDescending(x => x.DtScan) + .ToList(); + } + } + return dbResult; + } /// /// Elenco Scansioni per valore, operatore e sessione /// @@ -443,7 +478,7 @@ namespace MP.Data.Controllers #region gestione UDC /// - /// elenco udc + /// elenco Udc /// /// public List ElencoUdc() @@ -461,7 +496,7 @@ namespace MP.Data.Controllers return dbResult; } /// - /// check udc + /// check Udc /// /// /// diff --git a/MP.INVE/Components/InveSessionList.razor.cs b/MP.INVE/Components/InveSessionList.razor.cs index 02c22582..9946e90d 100644 --- a/MP.INVE/Components/InveSessionList.razor.cs +++ b/MP.INVE/Components/InveSessionList.razor.cs @@ -1,27 +1,28 @@ -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; using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.INVE.Data; namespace MP.INVE.Components { public partial class InveSessionList : IDisposable { + #region Public Properties + + public string currIdMag { get; set; } + + public int currIdSess { get; set; } + + [Parameter] + public SelectInveSessionParams currParams { get; set; } = null!; + + [Parameter] + public bool isLoading { get; set; } + + #endregion Public Properties + + #region Public Methods public void Dispose() { @@ -31,8 +32,123 @@ namespace MP.INVE.Components SearchRecords = null; GC.Collect(); } - private int magazzino { get; set; } = 0; + + #endregion Public Methods + + #region Protected Properties + + protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + + protected string rawCode + { + get + { + string answ = ""; + answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; + return answ; + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task getCurrSess(int idSess, string idMag) + { + currIdSess = idSess; + currIdMag = idMag; + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + + protected override async Task OnParametersSetAsync() + { + await reloadData(); + await popola(); + } + + protected async Task popola() + { + await Task.Delay(1); + if (reqNew) + { + elencoOperatori = MIDataservice.ElencoOperatori(); + ElencoMagazzini = MIDataservice.ElencoMagazzini(); + } + } + + #endregion Protected Methods + + #region Private Fields + + private List? ElencoMagazzini; + private List? elencoOperatori; + private List? elencoSessioni; + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private string authKey + { + get => currParams.authKey; + set => currParams.authKey = value; + } + + [Inject] + private IConfiguration Configuration { get; set; } = null!; + + private int currPage + { + get => currParams.CurrPage; + set + { + currParams.CurrPage = value; + StateHasChanged(); + } + } + private string desc { get; set; } = ""; + private DateTime dtEnd { get; set; } = DateTime.Now; + private DateTime dtStart { get; set; } = DateTime.Now.AddMonths(-1); + + private string idOperatore + { + get => currParams.idOperatore; + set => currParams.idOperatore = value; + } + + private bool inCorso + { + get => currParams.inCorso; + set => currParams.inCorso = value; + } + + private int magazzino { get; set; } = 0; + + [Inject] + private MiDataService MIDataservice { get; set; } = null!; + + private int numRecord + { + get => currParams.NumRec; + set + { + currParams.NumRec = value; + StateHasChanged(); + } + } + private bool reqNew { get => currParams.reqNew; @@ -44,40 +160,10 @@ namespace MP.INVE.Components get => currParams.TotCount; set => currParams.TotCount = value; } - private int numRecord - { - get => currParams.NumRec; - set - { - currParams.NumRec = value; - StateHasChanged(); - } - } - private int currPage - { - get => currParams.CurrPage; - set - { - currParams.CurrPage = value; - StateHasChanged(); - } - } - private string idOperatore - { - get => currParams.idOperatore; - set => currParams.idOperatore = value; - } - private string authKey - { - get => currParams.authKey; - set => currParams.authKey = value; - } - private bool inCorso - { - get => currParams.inCorso; - set => currParams.inCorso = value; - } + #endregion Private Properties + + #region Private Methods private void closeNew() { @@ -86,38 +172,16 @@ namespace MP.INVE.Components ElencoMagazzini = new List(); } - private DateTime dtStart { get; set; } = DateTime.Now.AddMonths(-1); - private DateTime dtEnd { get; set; } = DateTime.Now; - - protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; } - - - protected string rawCode + private async Task deleteSession(InventorySessionModel session) { - get + var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare una nuova sessione per il magazzino selezionato?"); + if (alert) { - string answ = ""; - answ = $"{BaseUrlTab}IdSessione={currIdSess}&IdMag={currIdMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}"; - return answ; + await MIDataservice.deleteSessione(session); + NavManager.NavigateTo(NavManager.Uri, true); + await reloadData(); } } - protected async Task popola() - { - await Task.Delay(1); - if (reqNew) - { - elencoOperatori = MIDataservice.ElencoOperatori(); - ElencoMagazzini = MIDataservice.ElencoMagazzini(); - } - } - - protected async Task getCurrSess(int idSess, string idMag) - { - currIdSess = idSess; - currIdMag = idMag; - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); - } private async Task insertNewSession() { @@ -144,22 +208,7 @@ namespace MP.INVE.Components closeNew(); } } - protected override async Task OnParametersSetAsync() - { - await reloadData(); - await popola(); - } - private async Task deleteSession(InventorySessionModel session) - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare una nuova sessione per il magazzino selezionato?"); - if (alert) - { - await MIDataservice.deleteSessione(session); - NavManager.NavigateTo(NavManager.Uri, true); - await reloadData(); - } - } private async Task reloadData() { elencoSessioni = null; @@ -180,29 +229,6 @@ namespace MP.INVE.Components isLoading = false; } - [Parameter] - public SelectInveSessionParams currParams { get; set; } = null!; - - [Parameter] - public bool isLoading { get; set; } - - public int currIdSess { get; set; } - public string currIdMag { get; set; } - - [Inject] - private MiDataService MIDataservice { get; set; } = null!; - [Inject] - private IConfiguration Configuration { get; set; } = null!; - [Inject] - protected ILocalStorageService localStorage { get; set; } = null!; - [Inject] - protected NavigationManager NavManager { get; set; } = null!; - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - private List? elencoSessioni; - private List? SearchRecords; - private List? elencoOperatori; - private List? ElencoMagazzini; + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index 7439738a..72d45a9b 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -49,7 +49,7 @@ @if (currRecord != null) {
- +
} \ No newline at end of file diff --git a/MP.INVE/Components/LotScanDetail.razor b/MP.INVE/Components/LotScanDetail.razor index 50c73f98..d677160c 100644 --- a/MP.INVE/Components/LotScanDetail.razor +++ b/MP.INVE/Components/LotScanDetail.razor @@ -1,48 +1,44 @@ -

@LottoSel

- - - - - - - - - - - - - - - @*@if (elencoTotLotto != null) - { - @foreach (var item in elencoTotLotto) - { - - - - - - - +
+
+
+
+ @LottoSel +
+
+ @CodArtSel +
+
+
+
+
- @*@if (currRecord != null) - { - - }*@ - LottoCod.Art.Descrizione Articolo# ColliQty Tot
- - - @item.Lotto - - @item.CodArticolo - - @item.DescrArt - - @item.NumColli - - @($"{item.TotLotto:N2}") -
+ + + + + - } - }*@ - -
DTimeUserQty
\ No newline at end of file + + + @if (ListRecords != null) + { + @foreach (var item in ListRecords) + { + + + + @($"{item.DtScan:yy.MM.dd HH:mm:ss}") + + + + @item.CodArticolo + + + @($"{item.Qty:N2}") + + + } + } + + + + diff --git a/MP.INVE/Components/LotScanDetail.razor.cs b/MP.INVE/Components/LotScanDetail.razor.cs index 753aa186..4f7c71d0 100644 --- a/MP.INVE/Components/LotScanDetail.razor.cs +++ b/MP.INVE/Components/LotScanDetail.razor.cs @@ -14,6 +14,8 @@ using Microsoft.JSInterop; using MP.INVE; using MP.INVE.Shared; using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; namespace MP.INVE.Components { @@ -22,5 +24,49 @@ namespace MP.INVE.Components [Parameter] public string LottoSel { get; set; } = ""; + + [Parameter] + public string CodArtSel { get; set; } = ""; + [Parameter] + public int InveSessID { get; set; } = 0; + + protected override async Task OnParametersSetAsync() + { + await reloadData(); + } + + private async Task reloadData() + { + ListRecords = null; + //totalCount = 0; + isLoading = true; + SearchRecords = await MIService.ScanByLottoSession(LottoSel, InveSessID); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords;//.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + await Task.Delay(1); + isLoading = false; + } + + private int _totalCount { get; set; } = 0; + private int totalCount + { + get => _totalCount; + set + { + if (_totalCount != value) + { + _totalCount = value; + //updateRecordCount.InvokeAsync(value); + } + } + } + private List? SearchRecords; + protected List? ListRecords; + public bool isLoading { get; set; } + + [Inject] + protected MiDataService MIService { get; set; } = null!; } } \ No newline at end of file diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 1392243c..d0bccb35 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -669,7 +669,12 @@ namespace MP.INVE.Data return result; } } - + /// + /// Scansioni dati UDC e sessione + /// + /// + /// + /// public ScanDataModel ScanByUdcSession(string udc, int inveSessId) { string source = ""; @@ -684,6 +689,27 @@ namespace MP.INVE.Data return result; } + /// + /// Scansioni dato lotto e sessione + /// + /// + /// + /// + public async Task> ScanByLottoSession(string lotto, int inveSessId) + { + string source = ""; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + result = dbController.ScanByLottoSession(lotto, inveSessId); + source = "DB"; + stopWatch.Stop(); + await Task.Delay(1); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ScanByLottoSession Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public List ScanByValueSessionOpr(string scanData, int inveSessId, string Opr) { string source = ""; diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 74efc817..9d06efae 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1910 + 6.16.2212.1911 diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index c305f1fe..f2cdbfb4 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -128,6 +128,13 @@ namespace MP.INVE.Pages await reloadData(); } + protected async Task returnToSessions() + { + await resetCacheSessInv(); + // ritorno pagina... + NavManager.NavigateTo("InveSession", true); + } + protected async void trasfSessione(int sessID) { var trasf = await MIService.TransferSessione(sessID); @@ -215,18 +222,6 @@ namespace MP.INVE.Pages } } - protected async Task returnToSessions() - { - await resetCacheSessInv(); - // ritorno pagina... - NavManager.NavigateTo("InveSession", true); - } - - private async Task resetCacheSessInv() - { - await MIService.FlushSessInvCache(); - } - #endregion Private Properties #region Private Methods @@ -245,6 +240,11 @@ namespace MP.INVE.Pages searchVal = ""; } + private async Task resetCacheSessInv() + { + await MIService.FlushSessInvCache(); + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 7758f8a0..945beb08 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.1910

+

Versione: 6.16.2212.1911


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index c76fe32d..fd2f65f4 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1910 +6.16.2212.1911 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 043551f1..857bbfb1 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1910 + 6.16.2212.1911 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