- update x mostrare interventi in scadenza
- aggiunta stored x recuperare interventi da parent schedulato
This commit is contained in:
@@ -22,6 +22,27 @@ namespace MP.MONO.UI.Data
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static ILogger<CurrentDataService> _logger = null!;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private ConnectionMultiplexer redisConn = null!;
|
||||
|
||||
//ISubscriber sub = redis.GetSubscriber();
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public CurrentDataService(IConfiguration configuration, ILogger<CurrentDataService> logger, IConnectionMultiplexer redisConn)
|
||||
@@ -334,12 +355,39 @@ namespace MP.MONO.UI.Data
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec, bool showCompleted)
|
||||
/// <summary>
|
||||
/// Recupero elenco Task Schedulati dati Macchina ed intervento "master"
|
||||
/// </summary>
|
||||
/// <param name="MachineId">Macchina selezionata</param>
|
||||
/// <param name="PMTaskId">ID del PMTask parent</param>
|
||||
/// <param name="skipRec">Num record da saltare</param>
|
||||
/// <param name="numRec">num rec da recuperare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetByPMTask(int MachineId, int PMTaskId, int skipRec, int numRec)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// ricerca sul DB "raw"
|
||||
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec, showCompleted);
|
||||
List<ScheduledMaintModel>? dbResult = dbController.SchedMaintTaskGetByPMTask(MachineId, PMTaskId, skipRec, numRec);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB SchedMaintTaskGetByPMTask: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero elenco Task Schedulati (ultimi dato "skip")
|
||||
/// </summary>
|
||||
/// <param name="MachineId">Macchina selezionata</param>
|
||||
/// <param name="skipRec">Num record da saltare</param>
|
||||
/// <param name="numRec">num rec da recuperare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ScheduledMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
// ricerca sul DB "raw"
|
||||
List<ScheduledMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec);
|
||||
// filtro ulteriormente ora...
|
||||
var dbResult = rawResult.Where(x => x.CountRemainVal <= maxRemain || maxRemain == 0).ToList();
|
||||
stopWatch.Stop();
|
||||
@@ -376,24 +424,5 @@ namespace MP.MONO.UI.Data
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
private static ILogger<CurrentDataService> _logger = null!;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto per connessione a REDIS
|
||||
/// </summary>
|
||||
private ConnectionMultiplexer redisConn = null!;
|
||||
|
||||
//ISubscriber sub = redis.GetSubscriber();
|
||||
/// <summary>
|
||||
/// Oggetto DB redis da impiegare x chiamate R/W
|
||||
/// </summary>
|
||||
private IDatabase redisDb = null!;
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user