diff --git a/EgwCoreLib.Lux.Core/Generic/BalanceReqDTO.cs b/EgwCoreLib.Lux.Core/Generic/BalanceReqDTO.cs index 255749e6..d1461fb0 100644 --- a/EgwCoreLib.Lux.Core/Generic/BalanceReqDTO.cs +++ b/EgwCoreLib.Lux.Core/Generic/BalanceReqDTO.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace EgwCoreLib.Lux.Core.Generic +namespace EgwCoreLib.Lux.Core.Generic { /// /// Definizione richiesta di bilanciamento per il calcolo diff --git a/EgwCoreLib.Lux.Core/Generic/DirectAssignReqDto.cs b/EgwCoreLib.Lux.Core/Generic/DirectAssignReqDto.cs new file mode 100644 index 00000000..47efdba8 --- /dev/null +++ b/EgwCoreLib.Lux.Core/Generic/DirectAssignReqDto.cs @@ -0,0 +1,17 @@ +namespace EgwCoreLib.Lux.Core.Generic +{ + public class DirectAssignReqDto + { + #region Public Properties + + /// + /// Dizionario associazioni Part + estimTime + /// + public Dictionary DictPartAssign { get; set; } = new Dictionary(); + public int OrderRowID { get; set; } = 0; + public int ProdAssignID { get; set; } = 0; + public List TagsList { get; set; } = new List(); + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs b/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs index 120bdf02..2fb3a33a 100644 --- a/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs +++ b/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs @@ -59,14 +59,6 @@ namespace EgwCoreLib.Lux.Core.RestPayload #region Public Properties - /// - /// Elenco Macchine in formato stringa join - /// - public string ListMachinesJoin - { - get => string.Join(", ", machineCalcResults.Select(x => x.Name).OrderBy(x => x).ToList()); - } - /// /// Elenco effettivo macchine /// @@ -75,6 +67,14 @@ namespace EgwCoreLib.Lux.Core.RestPayload get => machineCalcResults.Select(x => x.Name).OrderBy(x => x).ToList(); } + /// + /// Elenco Macchine in formato stringa join + /// + public string ListMachinesJoin + { + get => string.Join(", ", machineCalcResults.Select(x => x.Name).OrderBy(x => x).ToList()); + } + /// /// Elenco delle etichette parts non OK /// @@ -83,13 +83,6 @@ namespace EgwCoreLib.Lux.Core.RestPayload get => listUnWorkable ?? new List(); } - /// - /// Elenco etichette parts OK - /// - public List ListWorkable - { - get => listWorkable ?? new List(); - } /// /// Elenco parts vincolate (=non ogni impianto) /// @@ -98,6 +91,14 @@ namespace EgwCoreLib.Lux.Core.RestPayload get => listVincolated ?? new List(); } + /// + /// Elenco etichette parts OK + /// + public List ListWorkable + { + get => listWorkable ?? new List(); + } + /// /// Dettaglio combinazioni carico di lavoro /// @@ -140,6 +141,11 @@ namespace EgwCoreLib.Lux.Core.RestPayload get => numOkVin; } + public int NumParts + { + get => listComplete?.Count() ?? 0; + } + /// /// Tempo massimo complessivo in ORE /// @@ -173,8 +179,8 @@ namespace EgwCoreLib.Lux.Core.RestPayload private List? listComplete = null; private List? listUnWorkable = null; - private List? listWorkable = null; private List? listVincolated = null; + private List? listWorkable = null; private List machineCalcResults = new List(); private int numKo = 0; private int numOk = 0; diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index b6536973..9d5a0daf 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -12,7 +12,6 @@ using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using NLog; using System.Globalization; -using System.Linq; using static EgwCoreLib.Lux.Core.Enums; namespace EgwCoreLib.Lux.Data.Controllers @@ -3367,6 +3366,34 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } + /// + /// Reset impostazione ProdItem x ripartire senza settings + /// + /// + /// + internal async Task ProdItemResetOrderAssign(int orderRowID) + { + int numItem = 0; + //using (DataLayerContext dbCtx = new DataLayerContext(_config)) + using (DataLayerContext dbCtx = new DataLayerContext()) + { + try + { + numItem = await dbCtx.DbSetProdItem + .Where(p => p.OrderRowID == orderRowID) + .ExecuteUpdateAsync(setters => setters + .SetProperty(p => p.ProdAssignID, (int?)null) + .SetProperty(p => p.EstimTime, 0) + ); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ProdItemResetOrderAssign{Environment.NewLine}{exc}"); + } + } + return numItem; + } + internal async Task> ProdPlantGetAllAsync() { List dbResult = new List(); diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 65f4d16d..153062b8 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -1609,7 +1609,7 @@ namespace EgwCoreLib.Lux.Data.Services sw.Start(); List? result = new List(); // cerco in redis... - string currKey = $"{redisBaseKey}:ProdAssign:OrdRow:{OrderRowID}"; + string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}"; RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue && rawData.Length() > 2) { @@ -1645,7 +1645,7 @@ namespace EgwCoreLib.Lux.Data.Services sw.Start(); List? result = new List(); // cerco in redis... - string currKey = $"{redisBaseKey}:ProdAssign:OrdRow:{OrderRowID}"; + string currKey = $"{redisBaseKey}:ProdAssign:OrdRowId:{OrderRowID}"; RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue && rawData.Length() > 2) { @@ -1680,7 +1680,10 @@ namespace EgwCoreLib.Lux.Data.Services // calcolo int fatto = await dbController.ProdItemBulkAssignItems(OrderRowId, ProdAssignId, itemsToAssign); // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdItems:*"); + //await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdItems:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdItems:OrdRowId:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdAssign:OrdRowId:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OrderRows:*"); sw.Stop(); Log.Debug($"ProdItemBulkAssignItems in {sw.Elapsed.TotalMilliseconds} ms"); return fatto; @@ -1721,6 +1724,20 @@ namespace EgwCoreLib.Lux.Data.Services return result; } + /// + /// Reset assegnazioni x ProdItems dato OrderRowID + /// + /// + /// + public async Task ProdItemResetOrderAssign(int orderRowID) + { + int result = await dbController.ProdItemResetOrderAssign(orderRowID); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdItems:OrdRowId:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:ProdAssign:OrdRowId:*"); + await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:OrderRows:*"); + return result; + } + /// /// Elenco completo plant gestiti /// diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index f0fdef3d..f437f8f5 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2512.2415 + 0.9.2512.2417 diff --git a/Lux.UI/Components/Compo/OrderRowMan.razor b/Lux.UI/Components/Compo/OrderRowMan.razor index dac1b5ed..e9ccbe36 100644 --- a/Lux.UI/Components/Compo/OrderRowMan.razor +++ b/Lux.UI/Components/Compo/OrderRowMan.razor @@ -454,7 +454,7 @@ else if (WorkLoadRecord != null) { if (CurrEditMode == EditMode.WorkLoadDetailTime) { - + } else if (CurrEditMode == EditMode.WorkLoadDetailTag) { diff --git a/Lux.UI/Components/Compo/OrderRowMan.razor.cs b/Lux.UI/Components/Compo/OrderRowMan.razor.cs index 7abc5c5f..721c71fe 100644 --- a/Lux.UI/Components/Compo/OrderRowMan.razor.cs +++ b/Lux.UI/Components/Compo/OrderRowMan.razor.cs @@ -8,6 +8,7 @@ using EgwCoreLib.Lux.Data.DbModel.Utils; using EgwCoreLib.Lux.Data.Migrations; using EgwCoreLib.Lux.Data.Services; using Lux.UI.Components.Compo.WorkLoad; +using Lux.UI.Components.Pages; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Cors.Infrastructure; @@ -1816,5 +1817,46 @@ namespace Lux.UI.Components.Compo } #endregion Private Methods + + /// + /// Esegue assegnazione diretta valori ricevuti + /// + /// + /// + private async Task DirectAssign(DirectAssignReqDto updInfo) + { + if (updInfo != null) + { + int numDone= await DLService.ProdItemBulkAssignItems(updInfo.OrderRowID, updInfo.ProdAssignID, updInfo.DictPartAssign); + // fix display + + await ForceOrderReload(updInfo.OrderRowID); + } + } + /// + /// Esegue reset assegnazioni + /// + /// + /// + private async Task ResetAssign(int OrderRowID) + { + await DLService.ProdItemResetOrderAssign(OrderRowID); + await ForceOrderReload(OrderRowID); + } + + private async Task ForceOrderReload(int OrderRowID) + { + // chiudo modale... + ClosePopup(); + // rileggo i dati! + await ReloadData(); + // recupero il record con orderId indicato + var item = ListRecords.FirstOrDefault(x => x.Original.OrderRowID == OrderRowID); + if (item != null) + { + // seleziono nuovamente i dati... + await ShowWLD(item, EditMode.WorkLoadDetailTime); + } + } } } \ No newline at end of file diff --git a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor index ec84dda7..3972ec9d 100644 --- a/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor +++ b/Lux.UI/Components/Compo/WorkLoad/TimeEstim.razor @@ -26,7 +26,7 @@