FIX gestione stored x pareto stati
This commit is contained in:
@@ -497,8 +497,8 @@ bool setLastStatusVal(Dictionary<string, string> dataList)
|
||||
void calcParetoStatus()
|
||||
{
|
||||
// ricalcolo ogni 60" +/- 3sec
|
||||
int minPeriod = 57000;
|
||||
int maxPeriod = 63000;
|
||||
int minPeriod = 5700;
|
||||
int maxPeriod = 6300;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -507,6 +507,8 @@ void calcParetoStatus()
|
||||
DateTime fine = DateTime.Today.AddDays(1);
|
||||
// recupero pareto da DB
|
||||
var newStatus = dbController.ParetoStatusMach(MachineId, inizio, fine);
|
||||
// riordino...
|
||||
newStatus = newStatus.OrderByDescending(x => x.TotDuration).ToList();
|
||||
// serializzo e salvo
|
||||
string rawData = JsonConvert.SerializeObject(newStatus);
|
||||
mpStatusParetoSendPipe.saveAndSendMessage(Constants.STATUS_PARETO_KEY, rawData);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using MP.MONO.Core.DTO;
|
||||
using MP.MONO.Data.DbModels;
|
||||
using MP.MONO.Data.DTO;
|
||||
using MySqlConnector;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using static MP.MONO.Core.Enums;
|
||||
@@ -922,9 +923,12 @@ namespace MP.MONO.Data.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
var machId = new MySqlParameter("machine_id", MachineId);
|
||||
var dtFrom = new MySqlParameter("dt_from",from);
|
||||
var dtTo = new MySqlParameter("dt_to", to);
|
||||
dbResult = localDbCtx
|
||||
.DbSetParetoStatus
|
||||
. OrderByDescending(x => x.TotDuration)
|
||||
.FromSqlRaw<ParetoStatusModel>("CALL stp_paretoStatus({0},{1},{2});", MachineId, from.ToString("yyyy-MM-dd"), to.ToString("yyyy-MM-dd"))
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
|
||||
Reference in New Issue
Block a user