Update pagina Scarti
This commit is contained in:
@@ -188,10 +188,26 @@ namespace MP.Stats.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.ResScarti[]> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
public async Task<List<MP.Data.DatabaseModels.ResScarti>> StatScartiGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
// filtra e restituisce SOLO i primi record...
|
||||
return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
//return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResScarti> dbResult = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
string cacheKey = getCacheKey("MP:STATS:SCARTI", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
dbResult = JsonConvert.DeserializeObject<List<MP.Data.DatabaseModels.ResScarti>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.StatScartiGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo);
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt);
|
||||
}
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.TurniOee>> StatTurniOeeGetAllAsync(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
|
||||
+10
-12
@@ -5,26 +5,24 @@
|
||||
<div class="card">
|
||||
<div class="card-header table-primary">
|
||||
<div class="row">
|
||||
<div class="col-6 col-lg-3 h2">Registro Scarti</div>
|
||||
<div class="col-6 col-lg-9">
|
||||
<div class="col-6 h2">Registro Scarti</div>
|
||||
<div class="col-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0">
|
||||
@if (currRecord != null)
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
</div>
|
||||
@if (totalCount == 0 || ListRecords == null)
|
||||
{
|
||||
@*<BasketEditor Basket="@currBasket" DataReset="ResetData" DataUpdated="UpdateData"></BasketEditor>*@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:70%"></div>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12 table-secondary">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
@@ -70,6 +68,6 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@SearchRecords.Count()" />
|
||||
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="@totalCount" showLoading="@isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -14,9 +14,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti currRecord = null;
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] ListRecords;
|
||||
|
||||
private MP.Data.DatabaseModels.ResScarti[] SearchRecords;
|
||||
private List<MP.Data.DatabaseModels.ResScarti> ListRecords;
|
||||
private List<MP.Data.DatabaseModels.ResScarti> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -24,6 +23,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private SelectData currFilter { get; set; } = new SelectData();
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -42,14 +42,28 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
answ = SearchRecords.Count;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatScartiGetAll(currFilter.DateStart, currFilter.DateEnd, currFilter.IdxMacchina, currFilter.IdxOdl, currFilter.KeyRichiesta, currFilter.CodArticolo, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToArray();
|
||||
isLoading = true;
|
||||
SearchRecords = await StatService.StatScartiGetAll(currFilter, MessageService.SearchVal);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
@@ -58,6 +72,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected async Task DoFilter(SelectData newFilter)
|
||||
{
|
||||
SearchRecords = null;
|
||||
ListRecords = null;
|
||||
currFilter = newFilter;
|
||||
await reloadData();
|
||||
}
|
||||
@@ -76,6 +92,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
numRecord = 10;
|
||||
currFilter = SelectData.Init(5, 7);
|
||||
MessageService.ShowSearch = false;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
await reloadData();
|
||||
|
||||
Reference in New Issue
Block a user