Update selezione filtro tipo flusso in Trend
This commit is contained in:
@@ -296,13 +296,33 @@ namespace MP.Data.Controllers
|
||||
.DbSetFL
|
||||
.Where(x =>
|
||||
(IdxMacchina == "*" || x.IdxMacchina == IdxMacchina)
|
||||
&& (fluxType == "" || x.FluxType == fluxType)
|
||||
&& (fluxType == "*" || x.FluxType == fluxType)
|
||||
&& (x.dtEvento >= DtStart && x.dtEvento <= DtEnd))
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tipi flusso disponibili
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<string> FluxTypeList()
|
||||
{
|
||||
List<string> dbResult = new List<string>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetFL
|
||||
.Select(x => x.FluxType)
|
||||
.Distinct()
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella ODL da filtro
|
||||
/// </summary>
|
||||
|
||||
@@ -90,10 +90,10 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="d-flex justify-content-between pt-0 pb-1 px-1 fontSmall text-uppercase">
|
||||
<div class="px-1 pe-0">TC.</div>
|
||||
<div class="px-1 ps-0">std @getMinSec(@CurrRecord.TCAssegnato)</div>
|
||||
<div class="px-1 ps-0">act @getMinSec(@CurrRecord.TCLavRT)</div>
|
||||
<div class="d-flex justify-content-between pt-0 pb-1 px-1 fontSmall text-uppercase2">
|
||||
<div class="px-1 pe-0">TC. Act</div>
|
||||
@* <div class="px-1 ps-0">std @getMinSec(@CurrRecord.TCAssegnato)</div> *@
|
||||
<div class="px-1 ps-0">@getMinSec(@CurrRecord.TCLavRT) <small>[@getMinSec(@CurrRecord.TCAssegnato)]</small></div>
|
||||
</div>
|
||||
}
|
||||
@if (hasRow(5))
|
||||
|
||||
@@ -41,7 +41,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col machBlock"> </div>
|
||||
<div class="col p-0"> </div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -176,37 +176,37 @@ a,
|
||||
@media all and (min-width: 320px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 1.6em;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 800px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 1.7em;
|
||||
font-size: 1.6em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 1024px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 1.8em;
|
||||
font-size: 1.7em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 1440px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 1.9em;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 1980px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 2em;
|
||||
font-size: 1.9em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 3960px) {
|
||||
.statusMap .ui-title,
|
||||
.statusMap .ui-li-aside {
|
||||
font-size: 2.1em;
|
||||
font-size: 2em;
|
||||
}
|
||||
}
|
||||
/* END: gestione layout dinamico mappa... */
|
||||
|
||||
@@ -186,37 +186,37 @@ a, .btn-link {
|
||||
|
||||
@media all and (min-width: 320px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 1.6em;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 800px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 1.7em;
|
||||
font-size: 1.6em;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 1024px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 1.8em;
|
||||
font-size: 1.7em;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 1440px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 1.9em;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media all and (min-width: 1980px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 2.0em;
|
||||
font-size: 1.9em;
|
||||
}
|
||||
}
|
||||
@media all and (min-width: 3960px) {
|
||||
.statusMap .ui-title, .statusMap .ui-li-aside {
|
||||
font-size: 2.1em;
|
||||
font-size: 2.0em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,21 +1,22 @@
|
||||
@using ChartJs
|
||||
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2">
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<div class="col-2">
|
||||
<div class="card shadow">
|
||||
<div class="card-body p-1">
|
||||
<div>
|
||||
<label class="form-label small">Tipo Flusso</label>
|
||||
<select @bind="@CodFluxSel" class="form-select">
|
||||
<option value="*">-- TUTTI --</option>
|
||||
@foreach (var item in CodFluxList)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
<label class="form-label small">Periodo Analisi</label>
|
||||
<ul class="list-group list-group-sm small">
|
||||
<li class="list-group-item align-items-center bg-dark text-light fs-5">
|
||||
Sel.Dettaglio
|
||||
</li>
|
||||
@foreach (PeriodoSel sPer in Enum.GetValues(typeof(PeriodoSel)))
|
||||
{
|
||||
<li class="list-group-item align-items-center p-1">
|
||||
@@ -25,26 +26,30 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-100">
|
||||
</div>
|
||||
<div class="border" style="max-height: 14em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<i>selezione ITEM da mostrare, tra quelli POSSIBILI dato periodo...</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="border" style="max-height: 14em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<i>selezione ITEM da mostrare, tra quelli POSSIBILI dato periodo...</i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
@if (RawData == null || RawData.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
@* <div class="col-2">
|
||||
<PieChart Id="PieODL" AspRatio="1" LegendPos="bottom" Data="@DatiPareto" Labels="@LabelPareto" lineColor="@lineColors" backColor="@bgColors" Title="@pieTitle"></PieChart>
|
||||
</div> *@
|
||||
<div class="col">
|
||||
<div class="text-center">
|
||||
<b>@pSel</b> Detail
|
||||
@@ -56,8 +61,8 @@
|
||||
<MultiLine Id="plotAll" AspRatio="3" DataTSList="@TSDataMulti" Labels="@LabelPlot" lineColor="@lineColors" backColor="@bgColors" lTens="0" Titles="@lineTitles" Stepped="false"></MultiLine>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,12 @@ namespace MP.Stats.Components
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<string> CodFluxList { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_CodFluxSel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<FLModel> RawData
|
||||
{
|
||||
@@ -34,9 +40,17 @@ namespace MP.Stats.Components
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
#region Protected Enums
|
||||
|
||||
#endregion Protected Fields
|
||||
protected enum PeriodoSel
|
||||
{
|
||||
Day,
|
||||
Week,
|
||||
Month,
|
||||
Year
|
||||
}
|
||||
|
||||
#endregion Protected Enums
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
@@ -50,8 +64,22 @@ namespace MP.Stats.Components
|
||||
{
|
||||
get => semaphColors(ParetoData.Count, "0.3");
|
||||
}
|
||||
|
||||
protected List<string> bgColorsDet { get; set; } = new List<string>();
|
||||
|
||||
protected string CodFluxSel
|
||||
{
|
||||
get => codFluxSel;
|
||||
set
|
||||
{
|
||||
if (codFluxSel != value)
|
||||
{
|
||||
codFluxSel = value;
|
||||
EC_CodFluxSel.InvokeAsync(value).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
@@ -69,6 +97,7 @@ namespace MP.Stats.Components
|
||||
{
|
||||
get => semaphColors(ParetoData.Count, "1");
|
||||
}
|
||||
|
||||
protected List<string> lineColorsDet { get; set; } = new List<string>();
|
||||
|
||||
[Inject]
|
||||
@@ -84,7 +113,34 @@ namespace MP.Stats.Components
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo alternat full / quasi grigi (x preious data)
|
||||
/// </summary>
|
||||
/// <param name="numRecords">numero record CURRENT</param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> cpColors(int numRecords, string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
// ciclo x numRecords-1
|
||||
for (int j = 0; j < numRecords; j++)
|
||||
{
|
||||
r = 54 + (180 - 54) * j / numRecords;
|
||||
g = 86 + (35 - 86) * j / numRecords;
|
||||
b = 254 + (180 - 254) * j / numRecords;
|
||||
answ.Add($"rgba({r}, {g}, {b}, {alpha}");
|
||||
answ.Add($"rgba({(510 + r) / 3},{(510 + g) / 3},{(510 + b) / 3}, {alpha}");
|
||||
}
|
||||
// chiude
|
||||
while (answ.Count < numRecords)
|
||||
{
|
||||
answ.Add($"rgba(180, 180, 35, {alpha})");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
@@ -127,12 +183,20 @@ namespace MP.Stats.Components
|
||||
|
||||
private List<string> lineTitles = new List<string>() { "Consumo/UM" };
|
||||
private List<string> lineTitlesDet = new List<string>() { "Consumo/UM" };
|
||||
private List<string> listMachine = new List<string>();
|
||||
private string pieTitle = "Macchina";
|
||||
|
||||
/// <summary>
|
||||
/// Modalità selezione
|
||||
/// </summary>
|
||||
private PeriodoSel pSel;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string codFluxSel { get; set; }
|
||||
|
||||
private List<double> DatiPareto
|
||||
{
|
||||
get => ParetoData.Select(x => x.value).ToList();
|
||||
@@ -152,6 +216,7 @@ namespace MP.Stats.Components
|
||||
{
|
||||
get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList();
|
||||
}
|
||||
|
||||
private List<string> LabelPlotDet { get; set; } = new List<string>();
|
||||
|
||||
private int numMachine
|
||||
@@ -162,17 +227,119 @@ namespace MP.Stats.Components
|
||||
private List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
private List<chartJsData.chartJsTSerie> TSData { get; set; } = new List<chartJsData.chartJsTSerie>();
|
||||
private List<List<chartJsData.chartJsTSerie>> TSDataMulti { get; set; } = new List<List<chartJsData.chartJsTSerie>>();
|
||||
|
||||
/// <summary>
|
||||
/// TimeSeries su scala DAY
|
||||
/// </summary>
|
||||
private List<List<chartJsData.chartJsTSerie>> TSDataMultiDetail { get; set; } = new List<List<chartJsData.chartJsTSerie>>();
|
||||
|
||||
private List<string> listMachine = new List<string>();
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private double cDouble(string origValue)
|
||||
{
|
||||
double dblVal = 0;
|
||||
double.TryParse(origValue, NumberStyles.Any, CultureInfo.InvariantCulture, out dblVal);
|
||||
return dblVal;
|
||||
}
|
||||
|
||||
private string CssBtn(PeriodoSel reqMode)
|
||||
{
|
||||
string answ = "btn-outline-primary";
|
||||
if (reqMode == pSel)
|
||||
{
|
||||
answ = "btn-primary text-light";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private DateTime GetFirstDayOfWeek(DateTime date)
|
||||
{
|
||||
int offset = date.DayOfWeek - DayOfWeek.Sunday;
|
||||
return date.AddDays(-offset);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ritorna dettaglio dato macchina e tipo (current o prev)
|
||||
/// </summary>
|
||||
/// <param name="idxMacc">Macchina richiesta</param>
|
||||
/// <param name="codFlux">Flusso richiesto</param>
|
||||
/// <param name="recapMode">Modo recap (se null --> intero periodo)</param>
|
||||
/// <param name="isCurrent">Indica se iin caso di recap sia periodo corrente/precedente</param>
|
||||
/// <returns></returns>
|
||||
private List<chartJsData.chartJsTSerie> GetTSDetail(string idxMacc, string codFlux, PeriodoSel? recapMode, bool isCurrent = true)
|
||||
{
|
||||
List<chartJsData.chartJsTSerie> answ = new();
|
||||
if (!recapMode.HasValue)
|
||||
{
|
||||
answ = RawData
|
||||
.Where(x => x.IdxMacchina == idxMacc)
|
||||
.Select(r => new chartJsData.chartJsTSerie() { x = r.dtEvento, y = cDouble(r.Valore) })
|
||||
.OrderBy(o => o.x)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
// fake fix: indietro 7 gg...
|
||||
DateTime dataRif = DateTime.Today;//.AddDays(-7);
|
||||
TimeSpan deltaOld = new TimeSpan(0);
|
||||
DateTime dtStart = dataRif;
|
||||
DateTime inizio = dataRif;
|
||||
DateTime fine = inizio.AddDays(1);
|
||||
double startVal = 0;
|
||||
switch (recapMode)
|
||||
{
|
||||
case PeriodoSel.Day:
|
||||
inizio = isCurrent ? dataRif : dataRif.AddDays(-1);
|
||||
fine = inizio.AddDays(1);
|
||||
deltaOld = TimeSpan.FromDays(1);
|
||||
break;
|
||||
|
||||
case PeriodoSel.Week:
|
||||
inizio = isCurrent ? GetFirstDayOfWeek(dataRif) : GetFirstDayOfWeek(dataRif).AddDays(-7);
|
||||
fine = inizio.AddDays(7);
|
||||
deltaOld = TimeSpan.FromDays(7);
|
||||
break;
|
||||
|
||||
case PeriodoSel.Month:
|
||||
inizio = isCurrent ? new DateTime(dataRif.Year, dataRif.Month, 1) : new DateTime(dataRif.Year, dataRif.Month, 1).AddMonths(-1);
|
||||
fine = inizio.AddMonths(1);
|
||||
deltaOld = inizio.AddMonths(1).Subtract(inizio);
|
||||
break;
|
||||
|
||||
case PeriodoSel.Year:
|
||||
inizio = isCurrent ? new DateTime(dataRif.Year, 1, 1) : new DateTime(dataRif.Year, 1, 1).AddYears(-1);
|
||||
fine = inizio.AddYears(1);
|
||||
deltaOld = inizio.AddYears(1).Subtract(inizio);
|
||||
break;
|
||||
|
||||
case null:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// calcolo il minimo...
|
||||
var listRaw = RawData
|
||||
.Where(x => x.IdxMacchina == idxMacc && x.dtEvento >= inizio && x.dtEvento < fine)
|
||||
.OrderBy(o => o.dtEvento)
|
||||
.ToList();
|
||||
var firstRec = listRaw
|
||||
.FirstOrDefault();
|
||||
if (firstRec != null)
|
||||
{
|
||||
startVal = cDouble(firstRec.Valore);
|
||||
dtStart = firstRec.dtEvento.Date;
|
||||
}
|
||||
|
||||
answ = listRaw
|
||||
.Select(r => new chartJsData.chartJsTSerie() { x = isCurrent ? r.dtEvento : r.dtEvento.Add(deltaOld), y = cDouble(r.Valore) - startVal })
|
||||
.OrderBy(o => o.x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void RecalcData()
|
||||
{
|
||||
if (RawData != null)
|
||||
@@ -234,7 +401,7 @@ namespace MP.Stats.Components
|
||||
// LabelPlotDet = currPlot.Select(r => $"{r.x:yyyy-MM-dd}").ToList();
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -243,140 +410,6 @@ namespace MP.Stats.Components
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime GetFirstDayOfWeek(DateTime date)
|
||||
{
|
||||
int offset = date.DayOfWeek - DayOfWeek.Sunday;
|
||||
return date.AddDays(-offset);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo alternat full / quasi grigi (x preious data)
|
||||
/// </summary>
|
||||
/// <param name="numRecords">numero record CURRENT</param>
|
||||
/// <param name="alpha"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> cpColors(int numRecords, string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
// ciclo x numRecords-1
|
||||
for (int j = 0; j < numRecords; j++)
|
||||
{
|
||||
r = 54 + (180 - 54) * j / numRecords;
|
||||
g = 86 + (35 - 86) * j / numRecords;
|
||||
b = 254 + (180 - 254) * j / numRecords;
|
||||
answ.Add($"rgba({r}, {g}, {b}, {alpha}");
|
||||
answ.Add($"rgba({(510 + r) / 3},{(510 + g) / 3},{(510 + b) / 3}, {alpha}");
|
||||
}
|
||||
// chiude
|
||||
while (answ.Count < numRecords)
|
||||
{
|
||||
answ.Add($"rgba(180, 180, 35, {alpha})");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ritorna dettaglio dato macchina e tipo (current o prev)
|
||||
/// </summary>
|
||||
/// <param name="idxMacc">Macchina richiesta</param>
|
||||
/// <param name="codFlux">Flusso richiesto</param>
|
||||
/// <param name="recapMode">Modo recap (se null --> intero periodo)</param>
|
||||
/// <param name="isCurrent">Indica se iin caso di recap sia periodo corrente/precedente</param>
|
||||
/// <returns></returns>
|
||||
private List<chartJsData.chartJsTSerie> GetTSDetail(string idxMacc, string codFlux, PeriodoSel? recapMode, bool isCurrent = true)
|
||||
{
|
||||
List<chartJsData.chartJsTSerie> answ = new();
|
||||
if (!recapMode.HasValue)
|
||||
{
|
||||
answ = RawData
|
||||
.Where(x => x.IdxMacchina == idxMacc)
|
||||
.Select(r => new chartJsData.chartJsTSerie() { x = r.dtEvento, y = cDouble(r.Valore) })
|
||||
.OrderBy(o => o.x)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
// fake fix: indietro 7 gg...
|
||||
DateTime dataRif = DateTime.Today;//.AddDays(-7);
|
||||
TimeSpan deltaOld = new TimeSpan(0);
|
||||
DateTime dtStart = dataRif;
|
||||
DateTime inizio = dataRif;
|
||||
DateTime fine = inizio.AddDays(1);
|
||||
double startVal = 0;
|
||||
switch (recapMode)
|
||||
{
|
||||
case PeriodoSel.Day:
|
||||
inizio = isCurrent ? dataRif : dataRif.AddDays(-1);
|
||||
fine = inizio.AddDays(1);
|
||||
deltaOld = TimeSpan.FromDays(1);
|
||||
break;
|
||||
case PeriodoSel.Week:
|
||||
inizio = isCurrent ? GetFirstDayOfWeek(dataRif) : GetFirstDayOfWeek(dataRif).AddDays(-7);
|
||||
fine = inizio.AddDays(7);
|
||||
deltaOld = TimeSpan.FromDays(7);
|
||||
break;
|
||||
case PeriodoSel.Month:
|
||||
inizio = isCurrent ? new DateTime(dataRif.Year, dataRif.Month, 1) : new DateTime(dataRif.Year, dataRif.Month, 1).AddMonths(-1);
|
||||
fine = inizio.AddMonths(1);
|
||||
deltaOld = inizio.AddMonths(1).Subtract(inizio);
|
||||
break;
|
||||
case PeriodoSel.Year:
|
||||
inizio = isCurrent ? new DateTime(dataRif.Year, 1, 1) : new DateTime(dataRif.Year, 1, 1).AddYears(-1);
|
||||
fine = inizio.AddYears(1);
|
||||
deltaOld = inizio.AddYears(1).Subtract(inizio);
|
||||
break;
|
||||
|
||||
|
||||
case null:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// calcolo il minimo...
|
||||
var listRaw = RawData
|
||||
.Where(x => x.IdxMacchina == idxMacc && x.dtEvento >= inizio && x.dtEvento < fine)
|
||||
.OrderBy(o => o.dtEvento)
|
||||
.ToList();
|
||||
var firstRec = listRaw
|
||||
.FirstOrDefault();
|
||||
if (firstRec != null)
|
||||
{
|
||||
startVal = cDouble(firstRec.Valore);
|
||||
dtStart = firstRec.dtEvento.Date;
|
||||
}
|
||||
|
||||
answ = listRaw
|
||||
.Select(r => new chartJsData.chartJsTSerie() { x = isCurrent ? r.dtEvento : r.dtEvento.Add(deltaOld), y = cDouble(r.Valore) - startVal })
|
||||
.OrderBy(o => o.x)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
private double cDouble(string origValue)
|
||||
{
|
||||
double dblVal = 0;
|
||||
double.TryParse(origValue, NumberStyles.Any, CultureInfo.InvariantCulture, out dblVal);
|
||||
return dblVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modalità selezione
|
||||
/// </summary>
|
||||
private PeriodoSel pSel;
|
||||
|
||||
protected enum PeriodoSel
|
||||
{
|
||||
Day,
|
||||
Week,
|
||||
Month,
|
||||
Year
|
||||
}
|
||||
|
||||
private void SetModo(PeriodoSel newModo)
|
||||
{
|
||||
pSel = newModo;
|
||||
@@ -384,16 +417,6 @@ namespace MP.Stats.Components
|
||||
RecalcData();
|
||||
}
|
||||
|
||||
private string CssBtn(PeriodoSel reqMode)
|
||||
{
|
||||
string answ = "btn-outline-primary";
|
||||
if (reqMode == pSel)
|
||||
{
|
||||
answ = "btn-primary text-light";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -457,7 +457,7 @@ namespace MP.Stats.Data
|
||||
List<FLModel> result = new List<FLModel>();
|
||||
// cerco in redis...
|
||||
DateTime adesso = DateTime.Now;
|
||||
string currKey = getCacheKey($"{redisBaseKey}:FL_DATA", CurrFilter);
|
||||
string currKey = getCacheKey($"{redisBaseKey}:FL_DATA:FT_{fluxType}", CurrFilter);
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
@@ -480,6 +480,43 @@ namespace MP.Stats.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco di tipi flusso disponibili
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> FluxTypeList()
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<string> result = new List<string>();
|
||||
// cerco in redis...
|
||||
DateTime adesso = DateTime.Now;
|
||||
string currKey = $"{redisBaseKey}:FTList";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.FluxTypeList();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<string>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"FluxTypeList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche ODL
|
||||
/// </summary>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2503.1118</Version>
|
||||
<Version>6.16.2503.1118</Version>
|
||||
<Version>6.16.2503.1207</Version>
|
||||
<Version>6.16.2503.1207</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<div class="col-12">
|
||||
<HomeButton NavLink="oee" Icon="oi oi-monitor" Descript="TRS/OEE %" />
|
||||
<HomeButton NavLink="Energy" Icon="oi oi-bar-chart" Descript="ENERGY" />
|
||||
<HomeButton NavLink="trend-analysis" Icon="fa-solid fa-arrow-trend-up" Descript="TREND" />
|
||||
<HomeButton NavLink="reportodl" Icon="oi oi-book" Descript="Report ODL" />
|
||||
<HomeButton NavLink="diario" Icon="oi oi-clipboard" Descript="Diario Produzione" />
|
||||
<HomeButton NavLink="userlog" Icon="oi oi-document" Descript="User ActionLog" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" ChartEnabled="false"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
<ChartTrends RawData="SearchRecords"></ChartTrends>
|
||||
<ChartTrends RawData="SearchRecords" EC_CodFluxSel="SetCodFlux" CodFluxList="@CodFluxList"></ChartTrends>
|
||||
</div>
|
||||
<div class="card-footer text-end">
|
||||
#rec: @totalCount
|
||||
|
||||
@@ -33,12 +33,15 @@ namespace MP.Stats.Pages
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string CodFluxSel = "*";
|
||||
protected string fileName = "TrendAnalysis.csv";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<string> CodFluxList { get; set; } = new List<string>() { "Energy", "Parameter" };
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
@@ -96,6 +99,17 @@ namespace MP.Stats.Pages
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio codflux
|
||||
/// </summary>
|
||||
/// <param name="newCodFlux"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task SetCodFlux(string newCodFlux)
|
||||
{
|
||||
CodFluxSel = newCodFlux;
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Traduzione lemma richeisto (lingua default="IT")
|
||||
/// </summary>
|
||||
@@ -155,11 +169,12 @@ namespace MP.Stats.Pages
|
||||
private async Task LoadConfData()
|
||||
{
|
||||
ConfigList = await StatService.ConfigGetAll();
|
||||
CodFluxList = await StatService.FluxTypeList();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = await StatService.FluxLogRawData(currFilter, "Energy", MServ.SearchVal);
|
||||
SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2503.1118</h4>
|
||||
<h4>Versione: 6.16.2503.1207</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2503.1118
|
||||
6.16.2503.1207
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2503.1118</version>
|
||||
<version>6.16.2503.1207</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user