Update display bilanciamento

This commit is contained in:
Samuele Locatelli
2026-01-13 18:40:47 +01:00
parent 15633a06cd
commit 745dc5cddf
8 changed files with 95 additions and 19 deletions
@@ -79,10 +79,29 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production
/// <summary>
/// Tempo stimato complessivo
/// - se BarQty = 0 --> MAX
/// - se BarQty > 0 --> SUM
/// </summary>
[NotMapped]
public decimal TotalEstimTime => WorkGroupList?.Sum(x => x.Value.Time) ?? 0;
public decimal TotalEstimTime
{
get
{
decimal answ = 0;
if (WorkGroupList != null && WorkGroupList.Count > 0)
{
if (WorkGroupList?.FirstOrDefault().Value.BarQty > 0)
{
answ = WorkGroupList?.Sum(x => x.Value.Time) ?? 0;
}
else
{
answ = WorkGroupList?.Max(x => x.Value.Time) ?? 0;
}
}
return answ;
}
}
/// <summary>
/// Elenco dei Plants riferiti nel gruppo
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.9.2601.1315</Version>
<Version>0.9.2601.1318</Version>
</PropertyGroup>
<ItemGroup>
@@ -146,20 +146,25 @@
<tr class="fw-bold">
<td></td>
<td class="text-center">
@if (ListBalancedDet!=null)
@foreach (var item in ListBalancedDet)
{
<div class="d-flex justify-content-between">
<div class="px-0">
FAST | 35 | 03:55
@item.MachineName
</div>
<div class="px-0">
SAOMAD | 98 | 05:40
Bar @item.TotalBarQty | Time: @FormatEstTime(item.TotalTime)
</div>
</div>
}
</td>
<td class="text-end fs-2">
<b>@FormatEstTime(BalancedTotalTime)</b>
</td>
<td class="text-end">
<b>+9:15</b>
</td>
<td class="text-end">
<div>@($"{DateTime.Today.AddDays(1):ddd yyyy.MM.dd}")</div>
@* <div>@($"{DateTime.Today.AddDays(1):ddd yyyy.MM.dd}")</div> *@
</td>
</tr>
</tfoot>
@@ -5,15 +5,34 @@ namespace Lux.UI.Components.Compo.Planner
{
public partial class BalanceProgGroup
{
#region Public Properties
[Parameter]
public List<ProductionGroupModel>? AllRecords { get; set; } = null;
Dictionary<string, List<ProductionGroupModel>> DictGrouped = new();
#endregion Public Properties
#region Protected Properties
protected decimal BalancedTotalTime
{
get => AllRecords?.Sum(x => x.TotalEstimTime) ?? 0;
}
#endregion Protected Properties
#region Protected Methods
protected string FormatEstTime(decimal totSeconds)
{
var tSpan = TimeSpan.FromSeconds((double)totSeconds);
string answ = EgwCoreLib.Lux.Core.DtUtils.FormatDateTime(tSpan, 24 * 366);
return answ;
}
protected override void OnParametersSet()
{
if (AllRecords != null )
if (AllRecords != null)
{
// Supponendo che 'listaOriginale' sia la tua List<ProductionGroupModel>
DictGrouped = AllRecords
@@ -22,14 +41,47 @@ namespace Lux.UI.Components.Compo.Planner
g => g.Key, // La chiave del dizionario è l'OrderRowNav.OrderRowUID
g => g.ToList() // Il valore è la lista di oggetti raggruppati
);
ListBalancedDet = AllRecords?
.SelectMany(pg => pg.WorkGroupList) // appiattisce tutti i dizionari
.GroupBy(kvp => kvp.Key) // raggruppa per la chiave del dizionario
.Select(g => new GroupDetail
{
MachineName = g.Key,
TotalTime = g.Sum(x => x.Value.Time),
TotalBarQty = g.Sum(x => x.Value.BarQty)
})
.ToList();
}
}
protected string FormatEstTime(decimal totSeconds)
#endregion Protected Methods
#region Private Fields
private Dictionary<string, List<ProductionGroupModel>> DictGrouped = new();
#endregion Private Fields
#region Protected Classes
protected class GroupDetail
{
var tSpan = TimeSpan.FromSeconds((double)totSeconds);
string answ = EgwCoreLib.Lux.Core.DtUtils.FormatDateTime(tSpan);
return answ;
#region Public Properties
public string MachineName { get; set; } = "";
public int TotalBarQty { get; set; } = 0;
public decimal TotalTime { get; set; } = 0;
#endregion Public Properties
}
#endregion Protected Classes
#region Private Properties
private List<GroupDetail>? ListBalancedDet { get; set; } = new();
#endregion Private Properties
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>0.9.2601.1315</Version>
<Version>0.9.2601.1318</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 0.9.2601.1315</h4>
<h4>Versione: 0.9.2601.1318</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2601.1315
0.9.2601.1318
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2601.1315</version>
<version>0.9.2601.1318</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>