Fix dati x lettura solo macc valide (=con dati flux)

This commit is contained in:
Samuele Locatelli
2022-09-15 10:31:39 +02:00
parent ce92f70eb0
commit 6da702e31f
5 changed files with 63 additions and 25 deletions
+19 -10
View File
@@ -406,6 +406,25 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco id Macchine che abbiano dati FLuxLog
/// </summary>
/// <returns></returns>
public List<string> MacchineWithFlux()
{
List<string> dbResult = new List<string>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetFluxLog
.AsNoTracking()
.Select(i => i.IdxMacchina)
.Distinct()
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco da tabella MappaStatoExpl
/// </summary>
@@ -436,16 +455,6 @@ namespace MP.Data.Controllers
List<string> dbResult = new List<string>();
using (var dbCtx = new MoonProContext(_configuration))
{
//var rawData = dbCtx
// .DbSetFluxLog
// .AsNoTracking()
// .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
// .GroupBy(i => i.CodFlux)
// .Select(group => group.First())
// .ToList();
// dbResult = rawData
// .Select(x => x.CodFlux)
// .ToList();
dbResult = dbCtx
.DbSetFluxLog
.AsNoTracking()
+19 -6
View File
@@ -10,6 +10,10 @@ namespace MP.SPEC.Components
{
#region Public Properties
[Parameter]
public EventCallback<int> TotRecordChanged { get; set; }
[Parameter]
public bool LiveUpdate { get; set; }
@@ -211,15 +215,24 @@ namespace MP.SPEC.Components
set => MessageService.numRecord = value;
}
private string SearchVal
{
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
}
private int _totalCount = 0;
private int totalCount
{
get => MessageService.totalCount;
set => MessageService.totalCount = value;
get => _totalCount;
set
{
if (_totalCount != value)
{
_totalCount = value;
//var pUpd = Task.Run(async () => await TotRecordChanged.InvokeAsync(value));
//pUpd.Wait();
TotRecordChanged.InvokeAsync(value);
}
}
//get => MessageService.totalCount;
//set => MessageService.totalCount = value;
}
#endregion Private Properties
+8
View File
@@ -391,6 +391,14 @@ namespace MP.SPEC.Data
{
return Task.FromResult(dbController.MacchineGetAll());
}
/// <summary>
/// Elenco ID macchine con dati FluxLog gestite
/// </summary>
/// <returns></returns>
public Task<List<string>> MacchineWithFlux()
{
return Task.FromResult(dbController.MacchineWithFlux());
}
public async Task<List<MappaStatoExpl>> MseGetAll()
{
+2 -2
View File
@@ -39,7 +39,7 @@
{
foreach (var item in ListMacchine)
{
<option value="@item.IdxMacchina">@item.IdxMacchina</option>
<option value="@item">@item</option>
}
}
</select>
@@ -61,7 +61,7 @@
</div>
</div>
<div class="card-body">
<ListPARAMS SelMacchina="@selMacchina" SelFlux="@selFlux" LiveUpdate="@liveUpdate" MaxRecord="@maxRecord"></ListPARAMS>
<ListPARAMS SelMacchina="@selMacchina" SelFlux="@selFlux" LiveUpdate="@liveUpdate" MaxRecord="@maxRecord" TotRecordChanged="@updateTotal"></ListPARAMS>
</div>
<div class="card-footer py-1">
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
+15 -7
View File
@@ -49,10 +49,15 @@ namespace MP.SPEC.Pages
protected void ForceReloadPage(int newNum)
{
liveUpdate = newNum == 1;
liveUpdate = newNum == 1;
currPage = newNum;
}
protected void updateTotal(int newTotCount)
{
totalCount = newTotCount;
}
protected override async Task OnInitializedAsync()
{
// abilito ricerca...
@@ -60,7 +65,7 @@ namespace MP.SPEC.Pages
// resetto search
MsgService.SearchVal = "";
ListMacchine = await MDService.MacchineGetAll();
ListMacchine = await MDService.MacchineWithFlux();
// carico dati
lastUpdate = $"Updated: {DateTime.Now:yyyy/MM/dd HH:mm:ss}";
await reloadFilters();
@@ -98,7 +103,7 @@ namespace MP.SPEC.Pages
private List<string>? ListFlux;
private List<MP.Data.DatabaseModels.Macchine>? ListMacchine;
private List<string>? ListMacchine;
#endregion Private Fields
@@ -127,8 +132,8 @@ namespace MP.SPEC.Pages
if (_selFlux != value)
{
isLoading = true;
ForceReloadPage(1);
_selFlux = value;
ForceReloadPage(1);
isLoading = false;
}
}
@@ -143,17 +148,20 @@ namespace MP.SPEC.Pages
if (_selMacchina != value)
{
isLoading = true;
ForceReloadPage(1);
_selMacchina = value;
ForceReloadPage(1);
isLoading = false;
}
}
}
private int _totalCount = 0;
private int totalCount
{
get => MsgService.totalCount;
set => MsgService.totalCount = value;
get => _totalCount;
set => _totalCount = value;
//get => MsgService.totalCount;
//set => MsgService.totalCount = value;
}
private int maxRecord