From 3b7dab23bf0b4741f0edf9ceee7a3c648720a11d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 26 Jun 2026 17:36:03 +0200 Subject: [PATCH] Fix assegnazione diretta prodgroup --- .../Components/Compo/WorkLoad/TimeEstim.razor | 14 ++-- .../Compo/WorkLoad/TimeEstim.razor.cs | 64 +++++++++++-------- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor index e84f951b..17cc83d7 100644 --- a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor +++ b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor @@ -79,14 +79,14 @@
- @if (AllProdGroup != null && AllProdGroup.Count > 0) + @if (BalancePlantList != null && BalancePlantList.Count > 0) {
- @foreach (var item in AllProdGroup) + @foreach (var item in DictPercReq) {
- @item.PlantListJoin - + @item.Key +
}
@@ -126,7 +126,7 @@
Vincolati: @DetailRecord.NumOkVin
- +
@@ -156,7 +156,9 @@ foreach (var wld in item.WorkGroupList) { - + + + @wld.Key diff --git a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor.cs b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor.cs index e081444b..5aa45824 100644 --- a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor.cs +++ b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor.cs @@ -71,6 +71,7 @@ namespace Lux.UI.Components.Compo.WorkLoad #region Private Fields + private List BalancePlantList = new(); private BalanceReqDto cBalanceReq = new BalanceReqDto(); /// @@ -205,40 +206,40 @@ namespace Lux.UI.Components.Compo.WorkLoad private void PrepareSendReq() { DictPercReq.Clear(); - var cList = AllProdGroup; +#if false + var cList = AllProdGroup; +#endif + var cList = BalancePlantList; double stdPerc = 1.0; if (cList != null && cList.Count > 1) { stdPerc = 1.0 / (cList.Count - 1); } - // da rivedere -#if false - //if (cList != null) - //{ - // // valutare se determinare EXT/manuale in modo diverso da ProdPlantModel - // switch (CurrMode) - // { - // case SetMode.None: - // break; + if (cList != null) + { + // valutare se determinare EXT/manuale in modo diverso da ProdPlantModel + switch (CurrMode) + { + case SetMode.None: + break; - // case SetMode.Balance: - // DictPercReq = cList.ToDictionary(x => x.ProdPlantCod, x => x.ProdPlantCod != "EXT" ? stdPerc : 0.0); - // break; + //case SetMode.Balance: + // DictPercReq = cList.ToDictionary(x => x.ProdPlantCod, x => x.ProdPlantCod != "EXT" ? stdPerc : 0.0); + // break; - // case SetMode.AssignOk: - // DictPercReq = cList.ToDictionary(x => x.ProdPlantCod, x => 0.0); - // break; + case SetMode.AssignOk: + DictPercReq = cList.ToDictionary(x => x, x => stdPerc); + break; - // case SetMode.AssignUnwork: - // DictPercReq = cList.ToDictionary(x => x.ProdPlantCod, x => x.ProdPlantCod == "EXT" ? 1.0 : 0.0); - // break; + //case SetMode.AssignUnwork: + // DictPercReq = cList.ToDictionary(x => x.ProdPlantCod, x => x.ProdPlantCod == "EXT" ? 1.0 : 0.0); + // break; - // default: - // break; - // } - //} -#endif + default: + break; + } + } } /// @@ -296,7 +297,7 @@ namespace Lux.UI.Components.Compo.WorkLoad private void ToggleAssignMode(List listTag, SetMode reqMode) { - // se era gi� attivo --> chiude... altrimenti assegna! + // se era gia attivo --> chiude... altrimenti assegna! CurrMode = CurrMode == reqMode ? SetMode.None : reqMode; // ora imposto secondo modo... if (CurrMode == reqMode) @@ -306,6 +307,19 @@ namespace Lux.UI.Components.Compo.WorkLoad } } + private void ToggleAssignVincMode(ProductionGroupModel currGroup, SetMode reqMode) + { + // se era gia attivo --> chiude... altrimenti assegna! + CurrMode = CurrMode == reqMode ? SetMode.None : reqMode; + // ora imposto secondo modo... + if (CurrMode == reqMode) + { + cBalanceReq.TagList = currGroup.WorkGroupList.Values.FirstOrDefault()?.TagList ?? new(); + BalancePlantList = currGroup.PlantList; + PrepareSendReq(); + } + } + private decimal TotMaxTimeRatio(decimal currTime) { return DetailRecord.TotMaxTime > 0 ? currTime / DetailRecord.TotMaxTime : (decimal)0.0;