Merge branch 'Release/Update202506_08'

This commit is contained in:
Samuele Locatelli
2025-07-08 09:27:04 +02:00
10 changed files with 274 additions and 227 deletions
+11 -6
View File
@@ -10,11 +10,6 @@
<button class="btn btn-outline-dark" @onclick="() => SearchMaccToggle()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
@* <div class="input-group input-group-lg my-2 shadow">
<span class="input-group-text bg-dark text-light bg-gradient">Sel. Impianti:</span>
<span class="form-control">@ListSelected</span>
<span class="input-group-text bg-dark text-light bg-gradient">(@numSelected / @MaxSelection)</span>
</div> *@
</div>
<div class="modal-body px-2">
<div class="input-group mb-3">
@@ -26,7 +21,17 @@
<table class="table table-sm table-striped">
<thead>
<tr>
<th><button class="btn btn-sm @CssClear" @onclick="ClearSel" title="Reset Selezione"><i class="fa-solid fa-rotate"></i></button></th>
<th>
@if (AllSelected)
{
<button class="btn btn-outline-dark border-0" @onclick="() => ToggleAllSel()"><i class="fa-solid fa-toggle-on"></i></button>
}
else
{
<button class="btn btn-outline-secondary border-0" @onclick="() => ToggleAllSel()"><i class="fa-solid fa-toggle-off"></i></button>
}
@* <button class="btn btn-sm @CssClear" @onclick="ClearSel" title="Reset Selezione"><i class="fa-solid fa-rotate"></i></button> *@
</th>
<th>Cod.</th>
<th>Nome</th>
</tr>
+44 -15
View File
@@ -40,20 +40,6 @@ namespace MP.Stats.Components
get => string.IsNullOrEmpty(SearchVal) ? "btn-outline-secondary" : "btn-primary";
}
protected string CheckSelect(AutocompleteModel currRec)
{
string answ = "";
if (CurrList.Contains(currRec.ValueField))
{
answ = "table-info";
}
else if (numSelected >= MaxSelection)
{
answ = "opacity-25";
}
return answ;
}
protected List<AutocompleteModel> ListRecords { get; set; } = null!;
protected string ListSelected
@@ -85,6 +71,20 @@ namespace MP.Stats.Components
#region Protected Methods
protected string CheckSelect(AutocompleteModel currRec)
{
string answ = "";
if (CurrList.Contains(currRec.ValueField))
{
answ = "table-info";
}
else if (numSelected >= MaxSelection)
{
answ = "opacity-25";
}
return answ;
}
protected void ClearSel()
{
CurrList.Clear();
@@ -128,7 +128,35 @@ namespace MP.Stats.Components
ReloadData();
}
protected async Task ToggleSel(string newVal)
/// <summary>
/// Esegue toggle selezione fino a numMax in aggiunta e rimuovendo tutti se era true
/// </summary>
protected async Task ToggleAllSel()
{
AllSelected = !AllSelected;
if (AllSelected)
{
foreach (var record in ListRecords)
{
if (!CurrList.Contains(record.ValueField))
{
CurrList.Add(record.ValueField);
}
// controllo superamento
if (CurrList.Count() >= MaxSelection)
{
return;
}
}
}
else
{
CurrList.Clear();
}
await EC_ListUpdated.InvokeAsync(CurrList);
}
protected void ToggleSel(string newVal)
{
if (!CurrList.Contains(newVal))
{
@@ -147,6 +175,7 @@ namespace MP.Stats.Components
#region Private Fields
private string _searchVal = "";
private bool AllSelected = false;
private int currPage = 1;
private int numRecord = 10;
private int totalCount = 0;
+2 -18
View File
@@ -194,19 +194,6 @@ namespace MP.Stats.Components
protected List<AutocompleteModel> ddlMacchineMult
{
get => ddlMacchine.Where(x => x.ValueField != "*").ToList();
#if false
{
List<AutocompleteModel> answ = new List<AutocompleteModel>();
foreach (var item in ddlMacchine)
{
if (!ListIdxMaccSel.Contains(item.ValueField) && item.ValueField != "*")
{
answ.Add(item);
}
}
return answ;
}
#endif
}
protected List<string> ListIdxMaccSel
@@ -217,11 +204,8 @@ namespace MP.Stats.Components
}
set
{
if (!SelFilter.ListIdxMaccSel.SequenceEqual(value))
{
SelFilter.ListIdxMaccSel = value;
reportChange();
}
SelFilter.ListIdxMaccSel = value;
reportChange();
}
}
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2507.0714</Version>
<Version>6.16.2507.0714</Version>
<Version>6.16.2507.0809</Version>
<Version>6.16.2507.0809</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+197 -166
View File
@@ -7,191 +7,222 @@
<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)
@if (isLoading)
{
<ChartEnergy RawData="SearchRecords" DynMode="dynMode" HideCurrent="true" ShowRem="true" EC_IdxMaccRem="RemoveMachine"></ChartEnergy>
}
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
<LoadingData Title="Loading Data" DisplaySize="LoadingData.CtrlSize.Large" DisplayMode="LoadingData.SpinMode.Growl"></LoadingData>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Macchina</th>
<th>Commessa/ODL</th>
<th>Articolo</th>
<th>Inizio</th>
<th>Fine</th>
@if (dynMode)
{
<th class="text-end">@Traduci("MP-STATS_TotCount01")</th>
@if (numCount > 1)
{
<th class="text-end">@Traduci("MP-STATS_TotCount02")</th>
}
@if (numCount > 2)
{
<th class="text-end">@Traduci("MP-STATS_TotCount03")</th>
}
<th class="text-end">@Traduci("MP-STATS_TotEn01")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn01")/Unit</th>
@if (numTotEn > 1)
{
<th class="text-end">@Traduci("MP-STATS_TotEn02")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn02")/Unit</th>
}
@if (numTotEn > 2)
{
<th class="text-end">@Traduci("MP-STATS_TotEn03")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn03")/Unit</th>
}
}
else
{
<th class="text-end">Unit</th>
<th class="text-end">Energy</th>
<th class="text-end">Gas</th>
}
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
string textCss = CheckCurrent(record);
<tr class="@textCss">
<td>@record.IdxMacchina</td>
<td>
<div>@record.KeyRichiesta</div>
<div class="small">@record.IdxOdl</div>
</td>
<td>
@record.CodArticolo
<div class="small">@record.DescArticolo</div>
</td>
<td class="@textCss">@record.DataInizio</td>
<td class="@textCss">@record.DataFine</td>
@if (dynMode)
{
<td class="text-end @textCss">@($"{record.TotCount01:N0}") @GetUM("TotCount01")</td>
@if (numCount > 1)
if (MaccSelValid)
{
if (ShowCharts == true)
{
<ChartEnergy RawData="SearchRecords" DynMode="dynMode" HideCurrent="true" ShowRem="true" EC_IdxMaccRem="RemoveMachine"></ChartEnergy>
}
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (TotalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Macchina</th>
<th>Commessa/ODL</th>
<th>Articolo</th>
<th>Inizio</th>
<th>Fine</th>
@if (dynMode)
{
<td class="text-end @textCss">@($"{record.TotCount02:N0}") @GetUM("TotCount02")</td>
}
@if (numCount > 2)
{
<td class="text-end @textCss">@($"{record.TotCount03:N0}") @GetUM("TotCount03")</td>
}
<td class="text-end @textCss">
<div>
@($"{record.TotEn01:N2}") @GetUM("TotEn01")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn01, record.TotCount01).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount01")
</div>
<th class="text-end">@Traduci("MP-STATS_TotCount01")</th>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn01, record.TotCount02).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount02")
</div>
<th class="text-end">@Traduci("MP-STATS_TotCount02")</th>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn01, record.TotCount03).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount03")
</div>
<th class="text-end">@Traduci("MP-STATS_TotCount03")</th>
}
<th class="text-end">@Traduci("MP-STATS_TotEn01")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn01")/Unit</th>
@if (numTotEn > 1)
{
<th class="text-end">@Traduci("MP-STATS_TotEn02")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn02")/Unit</th>
}
@if (numTotEn > 2)
{
<th class="text-end">@Traduci("MP-STATS_TotEn03")</th>
<th class="text-end">@Traduci("MP-STATS_TotEn03")/Unit</th>
}
</td>
@if (numTotEn > 1)
{
<td class="text-end @textCss">
<div>
@($"{record.TotEn02:N2}") @GetUM("TotEn02")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn02, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
</div>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn02, record.TotCount02).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount02")
</div>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn02, record.TotCount03).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount03")
</div>
}
</td>
}
@if (numTotEn > 2)
else
{
<td class="text-end @textCss">
<div>
@($"{record.TotEn03:N2}") @GetUM("TotEn03")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn03, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
</div>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn03, record.TotCount02).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount02")
</div>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn03, record.TotCount03).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount03")
</div>
}
</td>
<th class="text-end">Unit</th>
<th class="text-end">Energy</th>
<th class="text-end">Gas</th>
}
}
else
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<td class="text-end @textCss">@(record.TotCount.ToString("N0")) m</td>
<td class="text-end @textCss">
<div>
@record.TotWatt.ToString("N2") kWh
</div>
<small>
@righDiv(record.TotWatt, record.TotCount).ToString("N3") kWh/m
</small>
</td>
<td class="text-end @textCss">
<div>
@record.TotGas.ToString("N2") m<sup>3</sup>
</div>
<small>
@righDiv(record.TotGas, record.TotCount).ToString("N3") m<sup>3</sup>/m
</small>
</td>
string textCss = CheckCurrent(record);
<tr class="@textCss">
<td>@record.IdxMacchina</td>
<td>
<div>@record.KeyRichiesta</div>
<div class="small">@record.IdxOdl</div>
</td>
<td>
@record.CodArticolo
<div class="small">@record.DescArticolo</div>
</td>
<td class="@textCss">@record.DataInizio</td>
<td class="@textCss">@record.DataFine</td>
@if (dynMode)
{
<td class="text-end @textCss">@($"{record.TotCount01:N0}") @GetUM("TotCount01")</td>
@if (numCount > 1)
{
<td class="text-end @textCss">@($"{record.TotCount02:N0}") @GetUM("TotCount02")</td>
}
@if (numCount > 2)
{
<td class="text-end @textCss">@($"{record.TotCount03:N0}") @GetUM("TotCount03")</td>
}
<td class="text-end @textCss">
<div>
@($"{record.TotEn01:N2}") @GetUM("TotEn01")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn01, record.TotCount01).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount01")
</div>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn01, record.TotCount02).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount02")
</div>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn01, record.TotCount03).ToString("N3") @GetUM("TotEn01")/@GetUM("TotCount03")
</div>
}
</td>
@if (numTotEn > 1)
{
<td class="text-end @textCss">
<div>
@($"{record.TotEn02:N2}") @GetUM("TotEn02")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn02, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
</div>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn02, record.TotCount02).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount02")
</div>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn02, record.TotCount03).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount03")
</div>
}
</td>
}
@if (numTotEn > 2)
{
<td class="text-end @textCss">
<div>
@($"{record.TotEn03:N2}") @GetUM("TotEn03")
</div>
</td>
<td class="text-end @textCss">
<div class="small">
@righDiv(record.TotEn03, record.TotCount01).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount01")
</div>
@if (numCount > 1)
{
<div class="small">
@righDiv(record.TotEn03, record.TotCount02).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount02")
</div>
}
@if (numCount > 2)
{
<div class="small">
@righDiv(record.TotEn03, record.TotCount03).ToString("N3") @GetUM("TotEn02")/@GetUM("TotCount03")
</div>
}
</td>
}
}
else
{
<td class="text-end @textCss">@(record.TotCount.ToString("N0")) m</td>
<td class="text-end @textCss">
<div>
@record.TotWatt.ToString("N2") kWh
</div>
<small>
@righDiv(record.TotWatt, record.TotCount).ToString("N3") kWh/m
</small>
</td>
<td class="text-end @textCss">
<div>
@record.TotGas.ToString("N2") m<sup>3</sup>
</div>
<small>
@righDiv(record.TotGas, record.TotCount).ToString("N3") m<sup>3</sup>/m
</small>
</td>
}
</tr>
}
</tr>
}
</tbody>
</table>
</tbody>
<tfoot>
<tr>
<td colspan="10">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" exportEnabled="true" exportRequested="ExportCsv" fileName="@fileName" totalCount="TotalCount" showLoading="isLoading" />
</td>
</tr>
</tfoot>
</table>
</div>
</div>
}
}
else
{
<div class="alert alert-info my-2">
<div class="fs-4 d-flex justify-content-around">
<div>
Selezionare impianti (fino a @MaxDisplay) per visualizzare i dati
</div>
<div>
# Impianti: <b>@NumMacc</b> | # Rec tot: <b>@TotalCount.ToString("N0")</b>
</div>
</div>
</div>
</div>
}
}
</div>
<div class="card-footer py-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" exportEnabled="true" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+14 -16
View File
@@ -35,7 +35,9 @@ namespace MP.Stats.Pages
protected string fileName = "ODL_Energy.csv";
protected int totalCount = 0;
protected List<AutocompleteModel> ListMacchine = new List<AutocompleteModel>();
protected int NumMacc = 0;
protected int TotalCount = 0;
#endregion Protected Fields
@@ -44,6 +46,14 @@ namespace MP.Stats.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; }
/// <summary>
/// Verifica validità selezione macchine
/// </summary>
protected bool MaccSelValid
{
get => currFilter.MaccSelValid;
}
[Inject]
protected Data.MessageService MServ { get; set; }
@@ -215,7 +225,7 @@ namespace MP.Stats.Pages
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
private bool ShowCharts { get; set; } = false;
private bool ShowCharts { get; set; } = true;
#endregion Private Properties
@@ -262,6 +272,7 @@ namespace MP.Stats.Pages
{
ConfigList = await StatService.ConfigGetAll();
ListMacchine = await StatService.MachineList(true);
NumMacc = ListMacchine.Count();
dynMode = confVal("STATS_EnergyMode") == "Dynamic";
var sNumCount = confVal("STATS_EnergyNumCount");
int.TryParse(confVal("STATS_EnergyNumCount"), out numCount);
@@ -269,8 +280,6 @@ namespace MP.Stats.Pages
int.TryParse(confVal("STATS_EnergyMaxSelect"), out MaxDisplay);
}
protected List<AutocompleteModel> ListMacchine = new List<AutocompleteModel>();
private async Task ReloadData()
{
if (SearchRecords != null)
@@ -296,7 +305,7 @@ namespace MP.Stats.Pages
tempRec = null;
}
}
totalCount = SearchRecords.Count;
TotalCount = SearchRecords.Count;
DisplayData();
}
@@ -312,21 +321,10 @@ namespace MP.Stats.Pages
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();
}
+1 -1
View File
@@ -23,7 +23,7 @@
<div class="alert alert-info my-2">
<div class="fs-4 d-flex justify-content-around">
<div>
Selezionare impianti per attivare grafici (fino a @MaxDisplay)
Selezionare impianti (fino a @MaxDisplay) per attivare grafici
</div>
<div>
# Impianti: <b>@NumMacc</b> | # Rec tot: <b>@TotalCount.ToString("N0")</b>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2507.0714</h4>
<h4>Versione: 6.16.2507.0809</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2507.0714
6.16.2507.0809
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2507.0714</version>
<version>6.16.2507.0809</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>