749d633704
- gestione nuovo tipo di allarmi - db doppia registrazione
595 lines
23 KiB
C#
595 lines
23 KiB
C#
using MP.MONO.Core;
|
|
using MP.MONO.Core.CONF;
|
|
using MP.MONO.Core.DTO;
|
|
using MP.MONO.Data;
|
|
using MP.MONO.Data.Controllers;
|
|
using MP.MONO.Data.DbModels;
|
|
using Newtonsoft.Json;
|
|
using NLog;
|
|
using StackExchange.Redis;
|
|
using System.Diagnostics;
|
|
|
|
namespace MP.MONO.UI.Data
|
|
{
|
|
public class CurrentDataService : IDisposable
|
|
{
|
|
#region Public Fields
|
|
|
|
/// <summary>
|
|
/// Controller dati da DB
|
|
/// </summary>
|
|
public static MpDbController dbController = null!;
|
|
|
|
#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)
|
|
{
|
|
_logger = logger;
|
|
_configuration = configuration;
|
|
|
|
// setup compoenti REDIS
|
|
this.redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
|
|
this.redisDb = this.redisConn.GetDatabase();
|
|
// setup canali pub/sub
|
|
actLogPipe = new MessagePipe(redisConn, Constants.ACT_LOG_M_QUEUE);
|
|
alarmPipe = new MessagePipe(redisConn, Constants.ALARM_M_QUEUE);
|
|
machEvPipe = new MessagePipe(redisConn, Constants.EVENT_LOG_M_QUEUE);
|
|
parametersPipe = new MessagePipe(redisConn, Constants.PARAMS_M_QUEUE);
|
|
productionPipe = new MessagePipe(redisConn, Constants.PROD_M_QUEUE);
|
|
machStatsPipe = new MessagePipe(redisConn, Constants.MACH_STATS_M_QUEUE);
|
|
maintPipe = new MessagePipe(redisConn, Constants.MAINT_STATS_M_QUEUE);
|
|
statusPipe = new MessagePipe(redisConn, Constants.STATUS_M_QUEUE);
|
|
toolsPipe = new MessagePipe(redisConn, Constants.TOOLS_M_QUEUE);
|
|
|
|
// conf DB
|
|
string connStr = _configuration.GetConnectionString("MP.MONO.Data");
|
|
if (string.IsNullOrEmpty(connStr))
|
|
{
|
|
_logger.LogError("ConnString empty!");
|
|
}
|
|
else
|
|
{
|
|
dbController = new MpDbController();
|
|
_logger.LogInformation("DbController OK");
|
|
}
|
|
}
|
|
|
|
#endregion Public Constructors
|
|
|
|
#region Public Properties
|
|
|
|
public MessagePipe actLogPipe { get; set; } = null!;
|
|
public MessagePipe alarmPipe { get; set; } = null!;
|
|
public MessagePipe machEvPipe { get; set; } = null!;
|
|
public MessagePipe machStatsPipe { get; set; } = null!;
|
|
public MessagePipe maintPipe { get; set; } = null!;
|
|
public MessagePipe parametersPipe { get; set; } = null!;
|
|
public MessagePipe productionPipe { get; set; } = null!;
|
|
public MessagePipe statusPipe { get; set; } = null!;
|
|
public MessagePipe toolsPipe { get; set; } = null!;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
|
|
/// <summary>
|
|
/// Elenco records anagrafica allarmi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<AlarmListModel>> AlarmListGetAll()
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.AlarmListGetAll();
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB AlarmListGetAll: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Inserisce nuovo record in anagrafica allarmi dato testo (o restituisce se esistente)
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<AlarmListModel?> AlarmListInsert(string AlarmText)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.AlarmListInsert(AlarmText);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB AlarmListInsert: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Chiude ultimo record dato Id (se fossero + di 1 chiude tutti...)
|
|
/// </summary>
|
|
/// <param name="AlarmId">Id Allarme</param>
|
|
/// <returns></returns>
|
|
public async Task<bool> AlarmRecCloseActive(int AlarmId)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = await dbController.AlarmRecCloseActive(AlarmId);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB AlarmRecCloseActive: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<AlarmLogModel>> AlarmLogGetFilt(int machineId, int skipRec, int numRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.AlarmLogGetFilt(machineId, skipRec, numRec);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB AlarmLogGetFilt: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.DataLogGetFilt(machineId, fluxType, inizio, fine);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB ParamLogGetFilt: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
// Clear database controller
|
|
dbController.Dispose();
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getActLog()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.ACT_LOG_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conf allarmi (da ADAPTER) senza valori silenziati da app
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<BaseAlarmBankConf>> getAlarmConfig()
|
|
{
|
|
List<BaseAlarmBankConf>? dbResult = new List<BaseAlarmBankConf>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.ALARMS_CONF_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<BaseAlarmBankConf>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<BaseAlarmBankConf>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<string>> getAlarms()
|
|
{
|
|
List<string>? dbResult = new List<string>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.ALARM_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<string>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<string>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ri-abilita un record PM disabilitato
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <param name="forceDelete"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> PMTaskEnableRecord(PrevMaintTaskModel currRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
bool answ = await dbController.PMTaskEnableRecord(currRec);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata chiamata a PMTaskEnableRecord: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(answ);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Eliminazione Record
|
|
/// </summary>
|
|
/// <param name="currRec"></param>
|
|
/// <param name="forceDelete"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> PMTaskDeleteRecord(PrevMaintTaskModel currRec, bool forceDelete)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
bool answ = await dbController.PMTaskDeleteRecord(currRec, forceDelete);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata chiamata a PMTaskDeleteRecord: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(answ);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Conf allarmi IMPOSTATA con valori silenziati
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<BaseAlarmBankConf>> getAlarmSetup()
|
|
{
|
|
List<BaseAlarmBankConf>? dbResult = new List<BaseAlarmBankConf>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.ALARMS_SETT_KEY);
|
|
//se non avessi trovato valori cerco quelli di setup...
|
|
if (string.IsNullOrEmpty(rawData))
|
|
{
|
|
rawData = await redisDb.StringGetAsync(Constants.ALARMS_CONF_KEY);
|
|
}
|
|
// ora provo a deserializzare
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<BaseAlarmBankConf>>(rawData);
|
|
}
|
|
// altrimenti imposto vuoto
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<BaseAlarmBankConf>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getEventHist()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.EVENT_LOG_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getMaintenance()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.MAINT_STATS_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<MachineMode>> getModesList()
|
|
{
|
|
List<MachineMode>? dbResult = new List<MachineMode>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.MODE_CONF_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<MachineMode>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<MachineMode>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getParameters()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.PARAMS_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<ProductionDTO> getProd()
|
|
{
|
|
ProductionDTO? dbResult = new ProductionDTO();
|
|
string rawData = await redisDb.StringGetAsync(Constants.PROD_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<ProductionDTO>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new ProductionDTO();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getStats()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.MACH_STATS_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<MachineDTO> getStatus()
|
|
{
|
|
MachineDTO? dbResult = new MachineDTO();
|
|
string rawData = await redisDb.StringGetAsync(Constants.STATUS_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<MachineDTO>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new MachineDTO();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<MachineStatus>> getStatusList()
|
|
{
|
|
List<MachineStatus>? dbResult = new List<MachineStatus>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.STATUS_CONF_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<MachineStatus>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<MachineStatus>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
public async Task<List<DisplayDataDTO>> getTools()
|
|
{
|
|
List<DisplayDataDTO>? dbResult = new List<DisplayDataDTO>();
|
|
string rawData = await redisDb.StringGetAsync(Constants.TOOLS_CURR_KEY);
|
|
if (!string.IsNullOrEmpty(rawData))
|
|
{
|
|
dbResult = JsonConvert.DeserializeObject<List<DisplayDataDTO>>(rawData);
|
|
}
|
|
if (dbResult == null)
|
|
{
|
|
dbResult = new List<DisplayDataDTO>();
|
|
}
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera elenco task Schedulati
|
|
/// </summary>
|
|
/// <param name="machineId"></param>
|
|
/// <param name="skipRec"></param>
|
|
/// <param name="numRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<PrevMaintTaskModel>> PrevMaintTaskGetFilt(int machineId, int skipRec, int numRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
List<PrevMaintTaskModel>? dbResult = dbController.PrevMaintTaskGetFilt(machineId, skipRec, numRec);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB PrevMaintTaskGetFilt: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Effettua upsert del record di manutenzione
|
|
/// </summary>
|
|
/// <param name="editRec"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> PrevMaintTaskUpdate(PrevMaintTaskModel editRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
bool dbResult = await dbController.PrevMaintTaskUpdate(editRec);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata upsert DB per PrevMaintTaskUpdate: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera elenco task pending
|
|
/// </summary>
|
|
/// <param name="machineId"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> SchedMaintTaskCreateMissing(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);
|
|
}
|
|
|
|
/// <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<PendingMaintModel>> SchedMaintTaskGetByPMTask(int MachineId, int PMTaskId, int skipRec, int numRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
// ricerca sul DB "raw"
|
|
List<PendingMaintModel>? 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<PendingMaintModel>> SchedMaintTaskGetFilt(int machineId, int maxRemain, int skipRec, int numRec)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
// ricerca sul DB "raw"
|
|
List<PendingMaintModel>? rawResult = dbController.SchedMaintTaskGetFilt(machineId, skipRec, numRec);
|
|
// 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");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Registro esecuzione task schedualto
|
|
/// </summary>
|
|
/// <param name="MachineId"></param>
|
|
/// <param name="SMTaskId"></param>
|
|
/// <param name="ExecDT"></param>
|
|
/// <param name="ExecUser"></param>
|
|
/// <returns></returns>
|
|
public async Task<bool> SchedMaintTaskSetDone(int MachineId, int SMTaskId, DateTime ExecDT, string ExecUser)
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
bool answ = await dbController.SchedMaintTaskSetDone(MachineId, SMTaskId, ExecDT, ExecUser);
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata chiamata a SchedMaintTaskSetDone: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(answ);
|
|
}
|
|
|
|
public async Task<bool> setAlarmSetup(List<BaseAlarmBankConf> alarmConf)
|
|
{
|
|
bool answ = false;
|
|
string rawData = JsonConvert.SerializeObject(alarmConf);
|
|
await redisDb.StringSetAsync(Constants.ALARMS_SETT_KEY, rawData);
|
|
return await Task.FromResult(answ);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Recupera elenco contatori ammessi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<CounterModel>> PMCounterModelGetAll()
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.PMCounterModelGetAll();
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB PMCounterModelGetAll: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
/// <summary>
|
|
/// Recupera elenco Gruppi Macchina PM ammessi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<PMMGroupModel>> PMMachGroupGetAll()
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.PMMachGroupGetAll();
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB PMMachGroupGetAll: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
/// <summary>
|
|
/// Recupera elenco Topics PM ammessi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<PMTaskTopicModel>> PMTaskTopicGetAll()
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.PMTaskTopicGetAll();
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB PMTaskTopicGetAll: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
/// <summary>
|
|
/// Recupera elenco User Team PM ammessi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public async Task<List<PMUTModel>> PMUTeamGetAll()
|
|
{
|
|
Stopwatch stopWatch = new Stopwatch();
|
|
stopWatch.Start();
|
|
var dbResult = dbController.PMUTeamGetAll();
|
|
stopWatch.Stop();
|
|
TimeSpan ts = stopWatch.Elapsed;
|
|
Log.Trace($"Effettuata lettura da DB PMUTeamGetAll: {ts.TotalMilliseconds} ms");
|
|
return await Task.FromResult(dbResult);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |