Fix ricerca pagina Energy
This commit is contained in:
@@ -12,11 +12,20 @@
|
||||
<div class="col-2">
|
||||
<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)
|
||||
@foreach (var item in @ParetoData.OrderBy(x => x.label).ToList())
|
||||
{
|
||||
<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>
|
||||
<span>
|
||||
@if (ShowRem)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-dark" @onclick="() => RemoveMachine(item.label)"><i class="fa-solid fa-xmark"></i> @item.label</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
@item.label
|
||||
}
|
||||
</span>
|
||||
<span class="badge text-bg-primary rounded-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
@@ -5,6 +5,7 @@ using MP.Data.Services;
|
||||
using MP.Stats.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Components
|
||||
{
|
||||
@@ -15,6 +16,9 @@ namespace MP.Stats.Components
|
||||
[Parameter]
|
||||
public bool DynMode { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<string> EC_IdxMaccRem { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool HideCurrent { get; set; } = false;
|
||||
|
||||
@@ -34,6 +38,9 @@ namespace MP.Stats.Components
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public bool ShowRem { get; set; } = false;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
@@ -122,7 +129,9 @@ namespace MP.Stats.Components
|
||||
#region Private Fields
|
||||
|
||||
private List<string> lineTitles = new List<string>() { "Consumo/UM" };
|
||||
|
||||
private List<string> listMachine = new List<string>();
|
||||
|
||||
private string pieTitle = "Macchina";
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -155,7 +164,9 @@ 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>>();
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -166,7 +177,6 @@ namespace MP.Stats.Components
|
||||
{
|
||||
if (RawData != null)
|
||||
{
|
||||
|
||||
lineTitles = new List<string>();
|
||||
if (DynMode)
|
||||
{
|
||||
@@ -224,6 +234,11 @@ namespace MP.Stats.Components
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RemoveMachine(string idxMacc)
|
||||
{
|
||||
await EC_IdxMaccRem.InvokeAsync(idxMacc);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -37,12 +37,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-nowrap" style="min-width: 15rem;">
|
||||
@if (OnlyEnergy)
|
||||
@if (SelMultiMacc)
|
||||
{
|
||||
<label class="small">macchine sel:</label>
|
||||
<div class="input-group input-group-sm text-nowrap">
|
||||
<button class="btn btn-sm btn-primary" @onclick="ShowAdd"><i class="fa-solid fa-pen"></i></button>
|
||||
<span class="form-control disabled" title="@listSelected">@listSelected</span>
|
||||
<span class="form-control disabled text-truncate" title="@listSelected">@listSelected</span>
|
||||
<button class="btn btn-sm btn-primary" @onclick="ResetSelMacchine"><i class="fa-solid fa-rotate-right"></i></button>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ namespace MP.Stats.Components
|
||||
[Parameter]
|
||||
public bool OnlyEnergy { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public bool SelMultiMacc { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public SelectData SelFilter { get; set; }
|
||||
|
||||
@@ -145,7 +148,7 @@ namespace MP.Stats.Components
|
||||
set
|
||||
{
|
||||
// verifico se sia energy --> multiselect
|
||||
if (OnlyEnergy)
|
||||
if (SelMultiMacc)
|
||||
{
|
||||
if (!ListIdxMaccSel.Contains(value))
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2507.0711</Version>
|
||||
<Version>6.16.2507.0711</Version>
|
||||
<Version>6.16.2507.0714</Version>
|
||||
<Version>6.16.2507.0714</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
|
||||
+18
-17
@@ -4,12 +4,12 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true" OnlyEnergy="true"></SelectionFilter>
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true" OnlyEnergy="true" MaxNumMacc="MaxDisplay" SelMultiMacc="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartEnergy RawData="SearchRecords" DynMode="dynMode" HideCurrent="true"></ChartEnergy>
|
||||
<ChartEnergy RawData="SearchRecords" DynMode="dynMode" HideCurrent="true" ShowRem="true" EC_IdxMaccRem="RemoveMachine"></ChartEnergy>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
@@ -66,7 +66,8 @@
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkCurrent(record)">
|
||||
string textCss = CheckCurrent(record);
|
||||
<tr class="@textCss">
|
||||
<td>@record.IdxMacchina</td>
|
||||
<td>
|
||||
<div>@record.KeyRichiesta</div>
|
||||
@@ -76,25 +77,25 @@
|
||||
@record.CodArticolo
|
||||
<div class="small">@record.DescArticolo</div>
|
||||
</td>
|
||||
<td>@record.DataInizio</td>
|
||||
<td>@record.DataFine</td>
|
||||
<td class="@textCss">@record.DataInizio</td>
|
||||
<td class="@textCss">@record.DataFine</td>
|
||||
@if (dynMode)
|
||||
{
|
||||
<td class="text-end">@($"{record.TotCount01:N0}") @GetUM("TotCount01")</td>
|
||||
<td class="text-end @textCss">@($"{record.TotCount01:N0}") @GetUM("TotCount01")</td>
|
||||
@if (numCount > 1)
|
||||
{
|
||||
<td class="text-end">@($"{record.TotCount02:N0}") @GetUM("TotCount02")</td>
|
||||
<td class="text-end @textCss">@($"{record.TotCount02:N0}") @GetUM("TotCount02")</td>
|
||||
}
|
||||
@if (numCount > 2)
|
||||
{
|
||||
<td class="text-end">@($"{record.TotCount03:N0}") @GetUM("TotCount03")</td>
|
||||
<td class="text-end @textCss">@($"{record.TotCount03:N0}") @GetUM("TotCount03")</td>
|
||||
}
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div>
|
||||
@($"{record.TotEn01:N2}") @GetUM("TotEn01")
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div class="small">
|
||||
@righDiv(record.TotEn01, record.TotCount01).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount01")
|
||||
</div>
|
||||
@@ -113,12 +114,12 @@
|
||||
</td>
|
||||
@if (numTotEn > 1)
|
||||
{
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div>
|
||||
@($"{record.TotEn02:N2}") @GetUM("TotEn02")
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div class="small">
|
||||
@righDiv(record.TotEn02, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
|
||||
</div>
|
||||
@@ -138,12 +139,12 @@
|
||||
}
|
||||
@if (numTotEn > 2)
|
||||
{
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div>
|
||||
@($"{record.TotEn03:N2}") @GetUM("TotEn03")
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div class="small">
|
||||
@righDiv(record.TotEn03, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
|
||||
</div>
|
||||
@@ -164,8 +165,8 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<td class="text-end">@(record.TotCount.ToString("N0")) m</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">@(record.TotCount.ToString("N0")) m</td>
|
||||
<td class="text-end @textCss">
|
||||
<div>
|
||||
@record.TotWatt.ToString("N2") kWh
|
||||
</div>
|
||||
@@ -173,7 +174,7 @@
|
||||
@righDiv(record.TotWatt, record.TotCount).ToString("N3") kWh/m
|
||||
</small>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<td class="text-end @textCss">
|
||||
<div>
|
||||
@record.TotGas.ToString("N2") m<sup>3</sup>
|
||||
</div>
|
||||
|
||||
@@ -35,6 +35,8 @@ namespace MP.Stats.Pages
|
||||
|
||||
protected string fileName = "ODL_Energy.csv";
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
@@ -51,8 +53,6 @@ namespace MP.Stats.Pages
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
[Inject]
|
||||
protected TranslateSrv TradService { get; set; }
|
||||
|
||||
@@ -65,14 +65,15 @@ namespace MP.Stats.Pages
|
||||
/// </summary>
|
||||
/// <param name="testRec"></param>
|
||||
/// <returns></returns>
|
||||
protected string checkCurrent(OdlEnergyModel testRec)
|
||||
protected string CheckCurrent(OdlEnergyModel testRec)
|
||||
{
|
||||
string answ = "";
|
||||
if (testRec != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (testRec.TotCount01 + testRec.TotCount02 + testRec.TotCount03) == 0 || testRec.DataFine == null ? "table-warning opacity-50" : "";
|
||||
answ = (testRec.TotCount01 + testRec.TotCount02 + testRec.TotCount03) == 0 || testRec.DataFine == null ? "text-secondary" : "";
|
||||
//answ = (testRec.TotCount01 + testRec.TotCount02 + testRec.TotCount03) == 0 || testRec.DataFine == null ? "table-info opacity-75" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -184,6 +185,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private bool dynMode = false;
|
||||
private List<OdlEnergyModel> ListRecords;
|
||||
private int MaxDisplay = 20;
|
||||
private int numCount = 1;
|
||||
private int numTotEn = 1;
|
||||
private List<OdlEnergyModel> SearchRecords;
|
||||
@@ -224,7 +226,7 @@ namespace MP.Stats.Pages
|
||||
await Task.Run(() => File.Delete(fullPath));
|
||||
}
|
||||
|
||||
private string convVal(string chiave)
|
||||
private string confVal(string chiave)
|
||||
{
|
||||
string answ = "";
|
||||
if (ConfigList != null && ConfigList.Count > 0)
|
||||
@@ -241,6 +243,8 @@ namespace MP.Stats.Pages
|
||||
private void DisplayData()
|
||||
{
|
||||
ListRecords = SearchRecords
|
||||
.OrderByDescending(x => x.DataInizio)
|
||||
.ThenBy(x => x.IdxMacchina)
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
@@ -257,19 +261,77 @@ namespace MP.Stats.Pages
|
||||
private async Task LoadConfData()
|
||||
{
|
||||
ConfigList = await StatService.ConfigGetAll();
|
||||
dynMode = convVal("STATS_EnergyMode") == "Dynamic";
|
||||
var sNumCount = convVal("STATS_EnergyNumCount");
|
||||
int.TryParse(convVal("STATS_EnergyNumCount"), out numCount);
|
||||
int.TryParse(convVal("STATS_EnergyNumTotEn"), out numTotEn);
|
||||
ListMacchine = await StatService.MachineList(true);
|
||||
dynMode = confVal("STATS_EnergyMode") == "Dynamic";
|
||||
var sNumCount = confVal("STATS_EnergyNumCount");
|
||||
int.TryParse(confVal("STATS_EnergyNumCount"), out numCount);
|
||||
int.TryParse(confVal("STATS_EnergyNumTotEn"), out numTotEn);
|
||||
int.TryParse(confVal("STATS_EnergyMaxSelect"), out MaxDisplay);
|
||||
}
|
||||
|
||||
protected List<AutocompleteModel> ListMacchine = new List<AutocompleteModel>();
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
SearchRecords = await StatService.StatOdlEnergyGetAll(currFilter, MServ.SearchVal);
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
SearchRecords.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = new List<OdlEnergyModel>();
|
||||
}
|
||||
// se seleziona tutte...
|
||||
if (currFilter.ListIdxMaccSel == null || currFilter.ListIdxMaccSel.Count == 0)
|
||||
{
|
||||
SearchRecords = await StatService.StatOdlEnergyGetAll(currFilter, MServ.SearchVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var idxMacc in currFilter.ListIdxMaccSel)
|
||||
{
|
||||
currFilter.IdxMacchina = idxMacc;
|
||||
var tempRec = await StatService.StatOdlEnergyGetAll(currFilter, MServ.SearchVal);
|
||||
SearchRecords.AddRange(tempRec);
|
||||
tempRec = null;
|
||||
}
|
||||
}
|
||||
totalCount = SearchRecords.Count;
|
||||
DisplayData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimina da dict macchina indicata
|
||||
/// </summary>
|
||||
/// <param name="idxMacc"></param>
|
||||
private async Task RemoveMachine(string idxMacc)
|
||||
{
|
||||
// in primis se contiene spazio --> prendo prima aprte che è idxMacc...
|
||||
if (idxMacc.Contains(" "))
|
||||
{
|
||||
var sVals = idxMacc.Split(' ');
|
||||
idxMacc = sVals[0];
|
||||
}
|
||||
// se fosse vuoto --> popolo!
|
||||
if (currFilter.ListIdxMaccSel.Count == 0)
|
||||
{
|
||||
currFilter.ListIdxMaccSel = ListMacchine.Select(x => x.ValueField).ToList();
|
||||
}
|
||||
|
||||
if (currFilter.ListIdxMaccSel.Contains(idxMacc))
|
||||
{
|
||||
currFilter.ListIdxMaccSel.Remove(idxMacc);
|
||||
// se ora fosse vuoto --> resetto!
|
||||
if (currFilter.ListIdxMaccSel.Count == 0)
|
||||
{
|
||||
currFilter.ListIdxMaccSel = ListMacchine.Select(x => x.ValueField).ToList();
|
||||
}
|
||||
|
||||
GC.Collect();
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" ChartEnabled="false" OnlyEnergy="true" MaxNumMacc="MaxDisplay"></SelectionFilter>
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" ChartEnabled="false" OnlyEnergy="true" MaxNumMacc="MaxDisplay" SelMultiMacc="true"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (isLoading)
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace MP.Stats.Pages
|
||||
|
||||
private int MaxDisplay = 10;
|
||||
private int NumMacc = 0;
|
||||
private List<FLModel> PlotRecords;
|
||||
private List<FLModel> PlotRecords = new List<FLModel>();
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario liste valori da mostrare
|
||||
@@ -254,7 +254,14 @@ namespace MP.Stats.Pages
|
||||
private void FiltData()
|
||||
{
|
||||
// in primis suddivido in un dizionario x ogni macchina...
|
||||
PlotRecords = new List<FLModel>();
|
||||
if (PlotRecords != null)
|
||||
{
|
||||
PlotRecords.Clear(); // = new List<FLModel>();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlotRecords = new List<FLModel>();
|
||||
}
|
||||
// per ogni valore recupero timeserie downsampled fino al num max di quelle ottenibili...
|
||||
int numAdd = 0;
|
||||
SelCount = 0;
|
||||
@@ -280,40 +287,51 @@ namespace MP.Stats.Pages
|
||||
private async Task LoadConfData()
|
||||
{
|
||||
ConfigList = await StatService.ConfigGetAll();
|
||||
if (ConfigList.Count > 0)
|
||||
int.TryParse(confVal("STATS_TrendMaxSelect"), out MaxDisplay);
|
||||
CodFluxList = await StatService.FluxTypeList();
|
||||
ListMacchine = await StatService.MachineList(true);
|
||||
}
|
||||
private string confVal(string chiave)
|
||||
{
|
||||
string answ = "";
|
||||
if (ConfigList != null && ConfigList.Count > 0)
|
||||
{
|
||||
var recConf = ConfigList.Where(x => x.Chiave == "STATS_TrendMaxSelect").FirstOrDefault();
|
||||
if (recConf != null)
|
||||
var searchRec = ConfigList.First(x => x.Chiave == chiave);
|
||||
if (searchRec != null)
|
||||
{
|
||||
int.TryParse(recConf.Valore, out MaxDisplay);
|
||||
answ = searchRec.Valore;
|
||||
}
|
||||
}
|
||||
CodFluxList = await StatService.FluxTypeList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected List<AutocompleteModel> ListMacchine = new List<AutocompleteModel>();
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
var listMacchine = await StatService.MachineList(true);
|
||||
NumMacc = listMacchine.Count;
|
||||
NumMacc = ListMacchine.Count;
|
||||
// ciclo caricando info x ogni macchina selezionata...
|
||||
SearchRecords = new Dictionary<string, List<FLModel>>();
|
||||
if (SearchRecords != null)
|
||||
{
|
||||
SearchRecords.Clear();// = new Dictionary<string, List<FLModel>>();
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = new Dictionary<string, List<FLModel>>();
|
||||
}
|
||||
if (currFilter.ListIdxMaccSel.Count > 0)
|
||||
{
|
||||
foreach (var idxMacc in currFilter.ListIdxMaccSel)
|
||||
{
|
||||
currFilter.IdxMacchina = idxMacc;
|
||||
var tempRec = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
|
||||
List<FLModel> tempRec = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
|
||||
SearchRecords.Add(idxMacc, tempRec);
|
||||
tempRec = null;
|
||||
}
|
||||
}
|
||||
|
||||
#if false
|
||||
SearchRecords = await StatService.FluxLogRawData(currFilter, CodFluxSel, MServ.SearchVal);
|
||||
#endif
|
||||
TotalCount = SearchRecords.Count;
|
||||
// se ho un elenco di macchine mostro grafici, altrimenti resoconto
|
||||
|
||||
FiltData();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -334,6 +352,7 @@ namespace MP.Stats.Pages
|
||||
{
|
||||
currFilter.ListIdxMaccSel.Remove(idxMacc);
|
||||
SearchRecords.Remove(idxMacc);
|
||||
GC.Collect();
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2507.0711</h4>
|
||||
<h4>Versione: 6.16.2507.0714</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2507.0711
|
||||
6.16.2507.0714
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2507.0711</version>
|
||||
<version>6.16.2507.0714</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