This commit is contained in:
zaccaria.majid
2023-09-29 09:20:12 +02:00
3 changed files with 113 additions and 18 deletions
@@ -31,6 +31,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2308.216" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2308.216" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0-rc.1.23421.29" />
</ItemGroup>
+110 -17
View File
@@ -1,4 +1,5 @@
@attribute [RenderModeAuto]
@using NLog;
@attribute [RenderModeAuto]
@* @attribute [RenderModeServer] *@
@inject HttpClient Http
@@ -8,21 +9,78 @@
<MP_TAB.Client.Components.TcHistoryFilter Title="Storico Tempi Ciclo" SearchMinChar="@SearchMinChar" E_CodArt="SelCodArt" E_IdxMacc="SelIdxMacc" MatrOpr="@MatrOpr"></MP_TAB.Client.Components.TcHistoryFilter>
</div>
<div class="card-body">
@if (isLoading)
{
<i>...loading...</i>
}
else
{
<b>griglia risultati</b>
@if (ListODL != null && ListODL.Count > 0)
{
foreach (var item in ListODL)
<table class="table table-striped table-sm">
<thead>
<tr>
<th>Articolo</th>
<th>TCiclo</th>
<th>Note</th>
<th>Periodo</th>
<th class="text-end">Impianto</th>
</tr>
</thead>
<tbody>
@if (isLoading)
{
<p>@item.IdxOdl</p>
@for (int i = 0; i < NumRecPage; i++)
{
<tr class="placeholder-glow">
<td>
<div class="placeholder col-4"></div>
<small class="placeholder col-8"></small>
</td>
<td>
<div class="placeholder col-6"></div>
<small class="placeholder col-6"></small>
</td>
<td><span class="placeholder col-12"></span></td>
<td><span class="placeholder col-12"></span></td>
<td class="text-end">
<div class="placeholder col-10"></div>
<small class="placeholder col-10"></small>
</td>
</tr>
}
}
}
}
else
{
@if (ListODL == null || ListODL.Count == 0)
{
<tr>
<td colspan="5">
<div class="alert alert-warning fs-5 w-100">Nessun record trovato</div>
</td>
</tr>
}
else
{
foreach (var item in ListODL)
{
<tr>
<td>
<div>@item.CodArticolo</div>
<small class="text-secondary">@item.DescArticolo</small>
</td>
<td>
<div>@item.Tcassegnato.ToString("N3")</div>
<small class="text-secondary">@item.Tcassegnato.ToString("N3")</small>
</td>
<td>@item.Note</td>
<td>@item.DataInizio --&gt; @item.DataFine</td>
<td class="text-end">
<div>@item.IdxMacchina</div>
<small class="text-secondary">@item.NumPezzi pz</small>
</td>
</tr>
<p>@item.IdxOdl</p>
}
}
}
</tbody>
</table>
</div>
<div class="card-footer">
<EgwCoreLib.Razor.DataPager currPage="@PageNum" PageSize="@NumRecPage" totalCount="@TotalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
</div>
</div>
@@ -39,6 +97,11 @@
protected string BaseAddr = "";
protected bool isLoading = false;
protected int NumRecPage = 10;
protected int TotalCount = 0;
protected int PageNum = 1;
protected List<ODLExpModel> ListComplete { get; set; } = new List<ODLExpModel>();
protected List<ODLExpModel> ListODL { get; set; } = new List<ODLExpModel>();
protected override async Task OnInitializedAsync()
@@ -64,13 +127,43 @@
if (!string.IsNullOrEmpty(CodArt))
{
string ApiUrl = $"{BaseAddr}api/ODL/GetODL?CodArt={CodArt}&IdxMacchina={IdxMacc}";
var rawData = await Http.GetFromJsonAsync<List<ODLExpModel>>(ApiUrl);
if (rawData != null)
try
{
ListODL = rawData;
var rawData = await Http.GetFromJsonAsync<List<ODLExpModel>>(ApiUrl);
if (rawData != null)
{
ListComplete = rawData;
TotalCount = ListComplete.Count;
// esegue paginazione
if (TotalCount > NumRecPage)
{
ListODL = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
}
else
{
ListODL = ListComplete;
}
}
}
catch (Exception exc)
{
Log.Error($"Error on dataload{Environment.NewLine}{exc}");
}
}
isLoading = false;
}
protected async Task SavePage(int newNum)
{
PageNum = newNum;
await ReloadData();
}
protected async Task SaveNumRec(int newNum)
{
NumRecPage = newNum;
await ReloadData();
}
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
}
+1 -1
View File
@@ -61,7 +61,7 @@ namespace MP.Data.Services
/// <param name="CodArt">Cod articolo</param>
/// <param name="IdxMacchina">Macchina selezionata</param>
/// <returns></returns>
public async Task<List<ODLExpModel>> ListODLFilt(string CodArt, string IdxMacchina)
public async Task<List<ODLExpModel>> ListODLFilt(string CodArt, string IdxMacchina="*")
{
// setup parametri costanti
bool inCorso = false;