- Completato aggiunta search x lotti anche testo parziale
- fix paginazione (non c'era)
This commit is contained in:
Samuele Locatelli
2022-12-17 09:46:53 +01:00
parent 89769ca489
commit f016d8dbd7
8 changed files with 304 additions and 226 deletions
+34 -55
View File
@@ -1,57 +1,36 @@
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-1">
<b class="fs-4">Totale lotti</b>
</div>
<div class="px-1">
<div class="input-group">
<label class="input-group-text" for="txtSearch"><i class="fa-solid fa-magnifying-glass"></i></label>
<input type="text" class="form-control" id="txtSearch" @bind="@searchVal">
</div>
</div>
</div>
</div>
<div class="card-body p-1">
<table class="table table-striped">
<thead>
<table class="table table-striped">
<thead>
<tr>
<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>
<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>
<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>
</tr>
</thead>
<tbody>
@if (elencoTotLotto != null)
{
@foreach (var item in elencoTotLotto)
{
<tr>
<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>
</tr>
}
}
</tbody>
</table>
</div>
<div class="card-footer">
<DataPager></DataPager>
</div>
</div>
}
}
</tbody>
</table>
+84 -42
View File
@@ -1,19 +1,4 @@
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.Data.DatabaseModels;
using MP.INVE.Data;
@@ -21,35 +6,72 @@ namespace MP.INVE.Components
{
public partial class ListTotLotto
{
#region Public Properties
[Parameter]
public SelectInvioParams currParams { get; set; } = null!;
[Parameter]
public bool isLoading { get; set; }
[Parameter]
public string searchVal { get; set; } = "";
[Parameter]
public int SessionID { get; set; } = 0;
[Parameter]
public EventCallback<int> updateRecordCount { get; set; }
#endregion Public Properties
#region Public Methods
public void Dispose()
{
elencoTotLotto = null;
SearchRecords = null;
GC.Collect();
}
[Parameter]
public int SessionID { get; set; } = 0;
#endregion Public Methods
#region Protected Fields
protected List<InveSessTotLotModel>? elencoTotLotto;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MiDataService MIService { get; set; } = null!;
private int totalCount
#endregion Protected Properties
#region Protected Methods
protected override async Task OnParametersSetAsync()
{
get => currParams.TotCount;
set
await Task.Delay(1);
if (SessionID != 0)
{
currParams.TotCount = value;
StateHasChanged();
}
}
private int numRecord
{
get => currParams.NumRec;
set
{
currParams.NumRec = value;
StateHasChanged();
await reloadData();
}
}
#endregion Protected Methods
#region Private Fields
private List<InveSessTotLotModel>? SearchRecords;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
private int currPage
{
get => currParams.CurrPage;
@@ -60,20 +82,45 @@ namespace MP.INVE.Components
}
}
protected async override Task OnParametersSetAsync()
private int numRecord
{
await Task.Delay(1);
if (SessionID != 0)
get => currParams.NumRec;
set
{
await reloadData();
currParams.NumRec = value;
StateHasChanged();
}
}
private int totalCount
{
get => _totalCount;
set
{
if (_totalCount != value)
{
_totalCount = value;
updateRecordCount.InvokeAsync(value);
}
}
}
#endregion Private Properties
#region Private Methods
private async Task reloadData()
{
elencoTotLotto = null;
totalCount = 0;
//totalCount = 0;
isLoading = true;
SearchRecords = MIService.InveSessTotLotList(SessionID);
// se ho search --> filtro...
if (!string.IsNullOrEmpty(searchVal))
{
StringComparison strComp = StringComparison.CurrentCultureIgnoreCase;
SearchRecords = SearchRecords.Where(x => x.CodArticolo.Contains(searchVal, strComp) || x.DescrArt.Contains(searchVal, strComp) || x.Lotto.Contains(searchVal, strComp)).ToList();
}
totalCount = SearchRecords.Count;
elencoTotLotto = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
@@ -81,12 +128,7 @@ namespace MP.INVE.Components
await Task.Delay(1);
isLoading = false;
}
protected List<InveSessTotLotModel>? elencoTotLotto;
private List<InveSessTotLotModel>? SearchRecords;
[Parameter]
public SelectInvioParams currParams { get; set; } = null!;
[Parameter]
public bool isLoading { get; set; }
#endregion Private Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.INVE</RootNamespace>
<Version>6.16.2212.1614</Version>
<Version>6.16.2212.1709</Version>
</PropertyGroup>
<ItemGroup>
+24 -4
View File
@@ -12,9 +12,19 @@ else
<div class="card mb-5">
<div class="card-header">
<div class="d-flex justify-content-between">
<h3>Invio</h3>
<a class="btn btn-danger" href="InveSession">TORNA A SESSIONI</a>
<div></div>
<div class="px-2">
<b class="fs-3">Invio</b>
</div>
<div class="px-2">
<a class="btn btn-danger" href="InveSession">TORNA A SESSIONI</a>
</div>
<div class="px-2">
<div class="input-group">
<label class="input-group-text" for="txtSearch"><i class="fa-solid fa-magnifying-glass"></i></label>
<input type="text" class="form-control" id="txtSearch" @bind="@searchVal" title="Campo Ricerca" placeholder="Ricerca [ALT-R]" accesskey="R">
<button @onclick="reset" class="btn btn-success input-group-text"><i class="fa-solid fa-rotate"></i></button>
</div>
</div>
</div>
</div>
<div class="card-body">
@@ -106,7 +116,17 @@ else
{
@if (sessID != 0)
{
<ListTotLotto SessionID="@sessID" currParams="@invioParams" isLoading="@isLoading"></ListTotLotto>
<div class="card">
<div class="card-header">
<b class="fs-4">Totale lotti</b>
</div>
<div class="card-body p-1">
<ListTotLotto SessionID="@sessID" currParams="@invioParams" isLoading="@isLoading" searchVal="@searchVal" updateRecordCount="UpdateTotCount"></ListTotLotto>
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
}
}
</div>
+158 -121
View File
@@ -1,79 +1,75 @@
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 Blazored.LocalStorage;
using MP.Data.DTO;
using MP.Data;
using MP.INVE.Data;
using MP.Data.DatabaseModels;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.DTO;
using MP.INVE.Data;
namespace MP.INVE.Pages
{
public partial class Invio
{
#region Public Properties
[Inject]
public MiDataService MIService { get; set; } = null!;
#endregion Public Properties
#region Protected Fields
protected SelectInvioParams invioParams = new SelectInvioParams();
protected bool isLoading = false;
protected bool mostra = false;
protected SelectInveSessionParams sessParams = new SelectInveSessionParams();
private int totalCount
#endregion Protected Fields
#region Protected Properties
protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; }
protected string codMag { get; set; } = "";
[Inject]
protected MessageService MsgService { get; set; } = null!;
protected string rawCode
{
get => invioParams.TotCount;
set
get
{
if (invioParams.TotCount != value)
{
invioParams.TotCount = value;
}
string answ = "";
answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
return answ;
}
}
private int numRecord
protected string searchVal { get; set; } = "";
protected int sessID { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected async void apriSessione(int sessID)
{
get => invioParams.NumRec;
set
var open = await MIService.CloseOpenSessione(sessID, false);
if (open)
{
if (invioParams.NumRec != value)
{
invioParams.NumRec = value;
}
NavManager.NavigateTo(NavManager.Uri, true);
}
}
private int currPage
protected async void chiudiSessione(int sessID)
{
get => invioParams.CurrPage;
set
var closed = await MIService.CloseOpenSessione(sessID, true);
if (closed)
{
if (invioParams.CurrPage != value)
{
invioParams.CurrPage = value;
}
NavManager.NavigateTo(NavManager.Uri, true);
}
}
private string idOperatore
{
get => sessParams.idOperatore;
set => sessParams.idOperatore = value;
}
private string authKey
{
get => sessParams.authKey;
set => sessParams.authKey = value;
}
protected void ForceReload(int newNum)
{
@@ -84,51 +80,24 @@ namespace MP.INVE.Pages
{
currPage = newNum;
}
protected bool mostra = false;
protected async Task getId()
{
OperatoreDTO local = new OperatoreDTO();
local = await MsgService.getCurrOperDtoAsync();
if (local != null)
{
idOperatore = local.MatrOpr.ToString();
authKey = local.hashAuthKey;
}
}
protected void mostraDati()
{
mostra = true;
}
protected async void chiudiSessione(int sessID)
{
var closed = await MIService.CloseOpenSessione(sessID, true);
if (closed)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
protected async void apriSessione(int sessID)
{
var open = await MIService.CloseOpenSessione(sessID, false);
if (open)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
protected async void trasfSessione(int sessID)
{
var trasf = await MIService.TransferSessione(sessID);
if (trasf)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
protected override async Task OnInitializedAsync()
{
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag))
{
sessID = int.Parse(_inveSessionId);
codMag = _idMag;
}
await reloadData();
}
protected async override Task OnAfterRenderAsync(bool firstRender)
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await Task.Delay(50);
if (firstRender)
@@ -145,33 +114,110 @@ namespace MP.INVE.Pages
}
}
[Inject]
private IConfiguration Configuration { get; set; } = null!;
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
[Inject]
private ILocalStorageService localStorage { get; set; } = null!;
protected string BaseUrlTab { get => $"{Configuration["ServerConf:BaseUrlJumper"]}"; }
protected string rawCode
protected override async Task OnInitializedAsync()
{
get
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("codMag", out var _idMag))
{
string answ = "";
answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr={idOperatore}&UserAuthKey={authKey}";
return answ;
sessID = int.Parse(_inveSessionId);
codMag = _idMag;
}
await reloadData();
}
protected async void trasfSessione(int sessID)
{
var trasf = await MIService.TransferSessione(sessID);
if (trasf)
{
NavManager.NavigateTo(NavManager.Uri, true);
}
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
private InventorySessionModel? sessione;
protected bool isLoading = false;
#endregion Private Fields
#region Private Properties
private int _totalCount { get; set; } = 0;
private string authKey
{
get => sessParams.authKey;
set => sessParams.authKey = value;
}
[Inject]
private IConfiguration Configuration { get; set; } = null!;
private int currPage
{
get => invioParams.CurrPage;
set
{
if (invioParams.CurrPage != value)
{
invioParams.CurrPage = value;
}
}
}
private string idOperatore
{
get => sessParams.idOperatore;
set => sessParams.idOperatore = value;
}
[Inject]
private IJSRuntime JSRuntime { get; set; } = null!;
[Inject]
private ILocalStorageService localStorage { get; set; } = null!;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => invioParams.NumRec;
set
{
if (invioParams.NumRec != value)
{
invioParams.NumRec = value;
}
}
}
private int totalCount
{
get => invioParams.TotCount;
set
{
if (invioParams.TotCount != value)
{
invioParams.TotCount = value;
}
}
}
#endregion Private Properties
#region Private Methods
private async Task reloadData()
{
sessione = null;
isLoading = true;
sessione = MIService.InventSessByID(sessID);
@@ -179,20 +225,11 @@ namespace MP.INVE.Pages
isLoading = false;
}
protected int sessID { get; set; } = 0;
protected string codMag { get; set; } = "";
[Inject]
protected MessageService MsgService { get; set; } = null!;
protected async Task getId()
private void reset()
{
OperatoreDTO local = new OperatoreDTO();
local = await MsgService.getCurrOperDtoAsync();
if (local != null)
{
idOperatore = local.MatrOpr.ToString();
authKey = local.hashAuthKey;
}
searchVal = "";
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOINVE </i>
<h4>Versione: 6.16.2212.1614</h4>
<h4>Versione: 6.16.2212.1709</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2212.1614
6.16.2212.1709
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2212.1614</version>
<version>6.16.2212.1709</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>