- Aggiounta navigazione dettaglio scansioni
This commit is contained in:
Samuele Locatelli
2022-12-19 11:39:16 +01:00
parent 243c451bef
commit d4e1c17790
11 changed files with 318 additions and 189 deletions
+40 -5
View File
@@ -127,8 +127,10 @@ namespace MP.Data.Controllers
/// <summary>
/// Elenco Scansioni Totali
/// </summary>
/// <param name="Udc"></param>
/// <param name="InveSessId"></param>
/// <returns></returns>
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;
}
/// <summary>
/// Elenco Scansioni dato lotto e sessione
/// </summary>
/// <param name="Lotto"></param>
/// <param name="InveSessId"></param>
/// <returns></returns>
public List<ScanDataModel> ScanByLottoSession(string Lotto, int InveSessId)
{
List<ScanDataModel> dbResult = new List<ScanDataModel>();
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;
}
/// <summary>
/// Elenco Scansioni per valore, operatore e sessione
/// </summary>
@@ -443,7 +478,7 @@ namespace MP.Data.Controllers
#region gestione UDC
/// <summary>
/// elenco udc
/// elenco Udc
/// </summary>
/// <returns></returns>
public List<AnagUdcModel> ElencoUdc()
@@ -461,7 +496,7 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// check udc
/// check Udc
/// </summary>
/// <param name="Udc"></param>
/// <returns></returns>
+145 -119
View File
@@ -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<AnagMagModel>? ElencoMagazzini;
private List<AnagOperatoriModel>? elencoOperatori;
private List<InventorySessionModel>? elencoSessioni;
private List<InventorySessionModel>? 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<AnagMagModel>();
}
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<bool>("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<bool>("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<InventorySessionModel>? elencoSessioni;
private List<InventorySessionModel>? SearchRecords;
private List<AnagOperatoriModel>? elencoOperatori;
private List<AnagMagModel>? ElencoMagazzini;
#endregion Private Methods
}
}
+1 -1
View File
@@ -49,7 +49,7 @@
@if (currRecord != null)
{
<div class="col-3">
<LotScanDetail LottoSel="@currRecord.Lotto"></LotScanDetail>
<LotScanDetail LottoSel="@currRecord.Lotto" InveSessID="@currRecord.InveSessID" CodArtSel="@currRecord.CodArticolo"></LotScanDetail>
</div>
}
</div>
+43 -47
View File
@@ -1,48 +1,44 @@
<h3>@LottoSel</h3>
<table class="table table-striped">
<thead>
<tr>
<th>
@*@if (currRecord != null)
{
<button @onclick="() => resetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}*@
</th>
<th scope="col">Lotto</th>
<th scope="col">Cod.Art.</th>
<th scope="col">Descrizione Articolo</th>
<th scope="col" class="text-end"># Colli</th>
<th scope="col" class="text-end">Qty Tot</th>
</tr>
</thead>
<tbody>
@*@if (elencoTotLotto != null)
{
@foreach (var item in elencoTotLotto)
{
<tr class="@checkSelect(item)">
<td>
<button class="btn btn-primary btn-sm" @onclick="() => selRecord(item)"><i class="fa-solid fa-magnifying-glass"></i></button>
</td>
<td>
@item.Lotto
</td>
<td>
@item.CodArticolo
</td>
<td class="small textCondensed">
@item.DescrArt
</td>
<td class="text-end">
@item.NumColli
</td>
<td class="text-end">
@($"{item.TotLotto:N2}")
</td>
<div class="card">
<div class="card-header bg-primary text-light">
<div class="d-flex justify-content-between">
<div class="px-1">
<b>@LottoSel</b>
</div>
<div class="px-1 text-end">
<b>@CodArtSel</b>
</div>
</div>
</div>
<div class="card-body p-0 mb-0">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">DTime</th>
<th scope="col">User</th>
<th scope="col" class="text-end">Qty</th>
</tr>
}
}*@
</tbody>
</table>
</thead>
<tbody>
@if (ListRecords != null)
{
@foreach (var item in ListRecords)
{
<tr>
<td class="small textCondensed">
<span class="small">
@($"{item.DtScan:yy.MM.dd HH:mm:ss}")
</span>
</td>
<td class="small textCondensed">
@item.CodArticolo
</td>
<td class="text-end">
<b>@($"{item.Qty:N2}")</b>
</td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
+46
View File
@@ -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<ScanDataModel>? SearchRecords;
protected List<ScanDataModel>? ListRecords;
public bool isLoading { get; set; }
[Inject]
protected MiDataService MIService { get; set; } = null!;
}
}
+27 -1
View File
@@ -669,7 +669,12 @@ namespace MP.INVE.Data
return result;
}
}
/// <summary>
/// Scansioni dati UDC e sessione
/// </summary>
/// <param name="udc"></param>
/// <param name="inveSessId"></param>
/// <returns></returns>
public ScanDataModel ScanByUdcSession(string udc, int inveSessId)
{
string source = "";
@@ -684,6 +689,27 @@ namespace MP.INVE.Data
return result;
}
/// <summary>
/// Scansioni dato lotto e sessione
/// </summary>
/// <param name="lotto"></param>
/// <param name="inveSessId"></param>
/// <returns></returns>
public async Task<List<ScanDataModel>> ScanByLottoSession(string lotto, int inveSessId)
{
string source = "";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
List<ScanDataModel>? result = new List<ScanDataModel>();
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<ScanDataModel> ScanByValueSessionOpr(string scanData, int inveSessId, string Opr)
{
string source = "";
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2212.1910</Version>
<Version>6.16.2212.1911</Version>
</PropertyGroup>
<ItemGroup>
+12 -12
View File
@@ -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
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.1910</h4>
<h4>Versione: 6.16.2212.1911</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.1910
6.16.2212.1911
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.1910</version>
<version>6.16.2212.1911</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>