Fix selezione interventi nel periodo
This commit is contained in:
@@ -440,7 +440,8 @@ namespace MP.MONO.Data.Controllers
|
||||
/// <summary>
|
||||
/// Recupero elenco Task Schedulati (ultimi dato "skip")
|
||||
/// </summary>
|
||||
/// <param name="MachineId"></param>
|
||||
/// <param name="MachineId">Macchina selezionata</param>
|
||||
/// <param name="maxRemain">Finestra di ore per cui msotrare interventi che scadono solo in questa</param>
|
||||
/// <param name="skipRec"></param>
|
||||
/// <param name="numRec"></param>
|
||||
/// <param name="showCompleted"></param>
|
||||
@@ -454,6 +455,7 @@ namespace MP.MONO.Data.Controllers
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetSMTask
|
||||
.Include(i => i.CounterNav)
|
||||
.Where(x => x.PMTaskeNav.MachineId == MachineId && (x.DtExecution == DateTime.MinValue || showCompleted))
|
||||
.Include(m => m.PMTaskeNav.MachGroupNav)
|
||||
.Include(m => m.CounterNav)
|
||||
|
||||
@@ -4,28 +4,30 @@
|
||||
|
||||
@inject CurrentDataService MMDataService
|
||||
|
||||
|
||||
<p>...deve mostrare quelli in scadenza nel periodo richeisto, es 10/15 gg...</p>
|
||||
@if (@ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
<div class="small row">
|
||||
<div class="col-4">
|
||||
<p>...deve mostrare quelli in scadenza nel periodo richiesto, es 10/15 gg...</p>
|
||||
@if (@ListRecords != null && ListRecords.Count > 0)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<div class="d-flex w-100 justify-content-between" title="order">
|
||||
<div>@item.Title</div>
|
||||
<div>
|
||||
<h5> <b>@item.Value</b></h5>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<ul class="list-group">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<li class="list-group-item list-group-item-action">
|
||||
<div class="d-flex w-100 justify-content-between" title="order">
|
||||
<div>@item.Title</div>
|
||||
<div>
|
||||
<h5> <b>@item.Value</b></h5>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
<li class="list-group-item list-group-item-action">...Calendar???</li>
|
||||
</ul>
|
||||
}
|
||||
<li class="list-group-item list-group-item-action">...Calendar???</li>
|
||||
</ul>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace MP.MONO.UI.Components
|
||||
public double maxVal { get; set; } = 100;
|
||||
|
||||
[Parameter]
|
||||
public int redLim { get; set; } = 24 * 3;
|
||||
public int redLim { get; set; } = 10;
|
||||
|
||||
[Parameter]
|
||||
public int yelLim { get; set; } = 24 * 5;
|
||||
public int yelLim { get; set; } = 20;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<td>@record.CounterNav.Description</td>
|
||||
<td>@record.PMTaskeNav.JobDescription</td>
|
||||
<td>
|
||||
@if (record.CountRemainVal <= yelLim)
|
||||
@if (record.CountRemainVal <= hourLim)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="() => ShowConfirm(record.SMTaskId)" title="Show Activity Record Panel"><i class="bi bi-check-square"></i></button>
|
||||
}
|
||||
|
||||
@@ -15,24 +15,30 @@ namespace MP.MONO.UI.Components
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private int _MaxRecord = 200;
|
||||
private int _MaxRecord = 2000;
|
||||
private bool _showCompleted = false;
|
||||
|
||||
/// <summary>
|
||||
/// Valore limite (in ore) per permettere di chiudere un intervento
|
||||
/// </summary>
|
||||
private int hourLim = 24 * 1;
|
||||
|
||||
private List<ScheduledMaintModel>? ListRecords = null;
|
||||
|
||||
// FARE!!! filtro macchina
|
||||
private int MachineId = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Valore limite (in ore) per indicare come rosso una scadenza
|
||||
/// Valore limite (in %) per indicare come rosso una scadenza
|
||||
/// </summary>
|
||||
private int redLim = 24 * 2;
|
||||
private int redLim = 10;
|
||||
|
||||
private List<ScheduledMaintModel>? SearchRecords = null;
|
||||
|
||||
/// <summary>
|
||||
/// Valore limite (in ore) per indicare come giallo una scadenza
|
||||
/// Valore limite (in %) per indicare come giallo una scadenza
|
||||
/// </summary>
|
||||
private int yelLim = 24 * 7;
|
||||
private int yelLim = 20;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -60,7 +66,26 @@ namespace MP.MONO.UI.Components
|
||||
private string execName { get; set; } = "";
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int LimitDayPeriod { get; set; } = 7;
|
||||
private int _limitDayPeriod { get; set; } = 7;
|
||||
|
||||
private int LimitDayPeriod
|
||||
{
|
||||
get => _limitDayPeriod;
|
||||
set
|
||||
{
|
||||
if (_limitDayPeriod != value)
|
||||
{
|
||||
_limitDayPeriod = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int maxRemainHour
|
||||
{
|
||||
get => LimitDayPeriod * 24;
|
||||
}
|
||||
|
||||
private int MaxRecord
|
||||
{
|
||||
@@ -156,7 +181,7 @@ namespace MP.MONO.UI.Components
|
||||
|
||||
private async Task RegenTask()
|
||||
{
|
||||
await MMDataService.createMissingSchedTask(MachineId);
|
||||
await MMDataService.SchedMaintTaskCreateMissing(MachineId);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
@@ -165,7 +190,7 @@ namespace MP.MONO.UI.Components
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
await Task.Delay(1);
|
||||
SearchRecords = await MMDataService.SchedMaintTaskGetFilt(MachineId, 0, MaxRecord, showCompleted);
|
||||
SearchRecords = await MMDataService.SchedMaintTaskGetFilt(MachineId, maxRemainHour, 0, MaxRecord, showCompleted);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -85,17 +85,6 @@ namespace MP.MONO.UI.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<bool> createMissingSchedTask(int machineId)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
bool answ = await dbController.SchedMaintTaskCreateMissing(machineId);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata chiamata a createMissingSchedTask: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
@@ -334,11 +323,25 @@ namespace MP.MONO.UI.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int skipRec, int numRec, bool showCompleted)
|
||||
public async Task<bool> SchedMaintTaskCreateMissing(int machineId)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
List<ScheduledMaintModel>? dbResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
|
||||
bool answ = await dbController.SchedMaintTaskCreateMissing(machineId);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata chiamata a createMissingSchedTask: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec, bool showCompleted)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// ricerca sul DB "raw"
|
||||
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
|
||||
// filtro ulteriormente ora...
|
||||
var dbResult = rawResult.Where(x => x.CountRemainVal <= maxRemain || maxRemain == 0).ToList();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB SchedMaintTaskGetFilt: {ts.TotalMilliseconds} ms");
|
||||
|
||||
Reference in New Issue
Block a user