diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionGroupModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionGroupModel.cs index 1e5990be..dafa73d2 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionGroupModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionGroupModel.cs @@ -79,10 +79,29 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// /// Tempo stimato complessivo + /// - se BarQty = 0 --> MAX + /// - se BarQty > 0 --> SUM /// [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; + } + } /// /// Elenco dei Plants riferiti nel gruppo diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index e326b6a6..8961479b 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2601.1315 + 0.9.2601.1318 diff --git a/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor b/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor index 60b0c55d..e0e835e7 100644 --- a/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor +++ b/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor @@ -146,20 +146,25 @@ + @if (ListBalancedDet!=null) + @foreach (var item in ListBalancedDet) + { - FAST | 35 | 03:55 + @item.MachineName - SAOMAD | 98 | 05:40 + Bar @item.TotalBarQty | Time: @FormatEstTime(item.TotalTime) + + } + + + @FormatEstTime(BalancedTotalTime) - +9:15 - - - @($"{DateTime.Today.AddDays(1):ddd yyyy.MM.dd}") + @* @($"{DateTime.Today.AddDays(1):ddd yyyy.MM.dd}") *@ diff --git a/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor.cs b/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor.cs index df869258..4e517747 100644 --- a/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor.cs +++ b/Lux.UI/Components/Compo/Planner/BalanceProgGroup.razor.cs @@ -5,15 +5,34 @@ namespace Lux.UI.Components.Compo.Planner { public partial class BalanceProgGroup { + #region Public Properties [Parameter] public List? AllRecords { get; set; } = null; - Dictionary> 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 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> 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? ListBalancedDet { get; set; } = new(); + + #endregion Private Properties } } \ No newline at end of file diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index a02c5661..b34d8183 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 0.9.2601.1315 + 0.9.2601.1318 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index be2c9d50..5d3275e5 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES - Versione: 0.9.2601.1315 + Versione: 0.9.2601.1318 Note di rilascio: diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index deaca5f6..4295b4f7 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2601.1315 +0.9.2601.1318 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index af5888e2..659366b5 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2601.1315 + 0.9.2601.1318 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false