Renaming metodi x FluxLogPareto
This commit is contained in:
@@ -611,7 +611,6 @@ namespace MP.Data.Controllers
|
||||
numRecProc += numRec;
|
||||
if (numRec > maxItem)
|
||||
{
|
||||
|
||||
List<Periodo> listPeriodi = new List<Periodo>();
|
||||
|
||||
switch (valMode)
|
||||
@@ -713,6 +712,27 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ParetoFluxLogDTO> FluxLogPareto(string idxMacchina, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
List<ParetoFluxLogDTO> dbResult = new List<ParetoFluxLogDTO>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo))
|
||||
.AsNoTracking()
|
||||
.GroupBy(x => x.CodFlux)
|
||||
.Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() })
|
||||
.OrderByDescending(x => x.Qty)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stored manutenzione del DB
|
||||
/// </summary>
|
||||
@@ -1270,27 +1290,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<ParetoFluxLogDTO> ParetoFluxLog(string idxMacchina, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
List<ParetoFluxLogDTO> dbResult = new List<ParetoFluxLogDTO>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetFluxLog
|
||||
.Where(x => (string.IsNullOrEmpty(idxMacchina) || x.IdxMacchina == idxMacchina) && (dtFrom <= x.dtEvento && x.dtEvento <= dtTo))
|
||||
.AsNoTracking()
|
||||
.GroupBy(x => x.CodFlux)
|
||||
.Select(g => new ParetoFluxLogDTO() { IdxMacchina = idxMacchina, CodFlux = g.Key, Qty = g.Count() })
|
||||
.OrderByDescending(x => x.Qty)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stato prod macchina
|
||||
/// </summary>
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
idxMaccLast = IdxMaccSel;
|
||||
lastPeriodo = CurrPeriodo;
|
||||
ListComplete = await MDataServ.ParetoFluxLog(IdxMaccSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
ListComplete = await MDataServ.FluxLogPareto(IdxMaccSel, CurrPeriodo.Inizio, CurrPeriodo.Fine);
|
||||
TotalCount = ListComplete.Count;
|
||||
TotalRecords = ListComplete.Sum(x => x.Qty);
|
||||
FluxList = ListComplete.Select(x => x.CodFlux).ToList();
|
||||
|
||||
@@ -800,6 +800,41 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ParetoFluxLogDTO>> FluxLogPareto(string idxMacchina, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string source = "DB";
|
||||
List<ParetoFluxLogDTO>? result = new List<ParetoFluxLogDTO>();
|
||||
// cerco in redis...
|
||||
string redKey = $"{Utils.redisParetoFLKey}:{idxMacchina}:{dtFrom:yyyyMMdd}:{dtTo:yyyyMMdd}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ParetoFluxLogDTO>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.FluxLogPareto(idxMacchina, dtFrom, dtTo));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ParetoFluxLogDTO>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ParetoFluxLog Read from {source}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stored manutenzione del DB
|
||||
/// </summary>
|
||||
@@ -1248,41 +1283,6 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<ParetoFluxLogDTO>> ParetoFluxLog(string idxMacchina, DateTime dtFrom, DateTime dtTo)
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string source = "DB";
|
||||
List<ParetoFluxLogDTO>? result = new List<ParetoFluxLogDTO>();
|
||||
// cerco in redis...
|
||||
string redKey = $"{Utils.redisParetoFLKey}:{idxMacchina}:{dtFrom:yyyyMMdd}:{dtTo:yyyyMMdd}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(redKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ParetoFluxLogDTO>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.ParetoFluxLog(idxMacchina, dtFrom, dtTo));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(redKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<ParetoFluxLogDTO>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"ParetoFluxLog Read from {source}: {ts.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record selezionato
|
||||
/// </summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2311.1016</Version>
|
||||
<Version>6.16.2311.1714</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2311.1016</h4>
|
||||
<h4>Versione: 6.16.2311.1714</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.1016
|
||||
6.16.2311.1714
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.1016</version>
|
||||
<version>6.16.2311.1714</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user