diff --git a/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs b/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs index 2fb3a33a..1a84fa1b 100644 --- a/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs +++ b/EgwCoreLib.Lux.Core/RestPayload/WorkLoadDetailDTO.cs @@ -16,7 +16,7 @@ namespace EgwCoreLib.Lux.Core.RestPayload #region Public Constructors /// - /// Init classe aprtendo dal valore serializzato di una stima di lavorabilità di un item d'ordine minimo (POR) + /// Init classe partendo dal valore serializzato di una stima di lavorabilità di un item d'ordine minimo (POR) /// /// /// diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index 3bde228c..71a9c955 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -1,4 +1,5 @@ -using EgwCoreLib.Lux.Core.RestPayload; +using EgwCoreLib.Lux.Core.Generic; +using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.DbModel.Config; using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; @@ -12,6 +13,8 @@ using Microsoft.Extensions.Configuration; using Newtonsoft.Json; using NLog; using System.Globalization; +using System.Reflection.PortableExecutable; +using System.Security.AccessControl; using static EgwCoreLib.Lux.Core.Enums; namespace EgwCoreLib.Lux.Data.Controllers @@ -3082,6 +3085,108 @@ namespace EgwCoreLib.Lux.Data.Controllers } } } + // elimina eventuali oggetti ProductionGroup precedenti + List listProdGroup2Rem = await dbCtx + .DbSetProdGroup + .Where(x => x.OrderRowID == currRec.OrderRowID) + .ToListAsync(); + // rimuovo... + if (listProdGroup2Rem != null && listProdGroup2Rem.Count > 0) + { + dbCtx.DbSetProdGroup.RemoveRange(listProdGroup2Rem); + } + + // preparo x add nuovi ProductionGroup da analisi ritorno stime + List listProdGroup2Add = new List(); + // 1: non lavorabili... + if (currWLD.ListUnWorkable.Count > 0) + { + // calcolo il dizionario degli elementi... + Dictionary newWorkGroupList = new(); + ProdMachineDetailDto detProd = new ProdMachineDetailDto() + { + TagList = currWLD.ListUnWorkable + }; + newWorkGroupList.Add("", detProd); + string rawWGL = JsonConvert.SerializeObject(newWorkGroupList); + ProductionGroupModel newRec = new ProductionGroupModel() + { + OrderRowID = currRec.OrderRowID, + GrpType = ProdGroupType.UnWorkable, + WorkGroupListRaw = rawWGL + }; + listProdGroup2Add.Add(newRec); + } + + // dizionario x macchina delle parts.. + var machineTags = currWLD.MachineCalcResults + .ToDictionary( + m => m.Name, + m => m.PartList + .Where(p => p.CalcResult == EgwCoreLib.Lux.Core.Enums.PartVerificationResult.MACHINABLE) + .ToList() + ); + + // 2: vincolati + if (currWLD.ListVincolated.Count > 0) + { + // calcolo il dizionario degli elementi... + Dictionary newWorkGroupList = new(); + // converto il dizionario... + foreach (var item in machineTags) + { + ProdMachineDetailDto detProd = new ProdMachineDetailDto() + { + TagList = item.Value + .Where(x => currWLD.ListVincolated.Contains(x.Tag)) + .Select(x => x.Tag) + .ToList(), + Time = item.Value + .Where(x => currWLD.ListVincolated.Contains(x.Tag)) + .Sum(x => (double)x.Time) + }; + newWorkGroupList.Add(item.Key, detProd); + } + string rawWGL = JsonConvert.SerializeObject(newWorkGroupList); + ProductionGroupModel newRec = new ProductionGroupModel() + { + OrderRowID = currRec.OrderRowID, + GrpType = ProdGroupType.UnWorkable, + WorkGroupListRaw = rawWGL + }; + listProdGroup2Add.Add(newRec); + } + + // 4: bilanciabili + if (currWLD.ListWorkable.Count > 0) + { + // calcolo il dizionario degli elementi... + Dictionary newWorkGroupList = new(); + // converto il dizionario... + foreach (var item in machineTags) + { + ProdMachineDetailDto detProd = new ProdMachineDetailDto() + { + TagList = item.Value + .Select(x => x.Tag) + .ToList(), + Time = item.Value + .Sum(x => (double)x.Time) + }; + newWorkGroupList.Add(item.Key, detProd); + } + string rawWGL = JsonConvert.SerializeObject(newWorkGroupList); + ProductionGroupModel newRec = new ProductionGroupModel() + { + OrderRowID = currRec.OrderRowID, + GrpType = ProdGroupType.UnWorkable, + WorkGroupListRaw = rawWGL + }; + listProdGroup2Add.Add(newRec); + } + + // aggiungo i record... + dbCtx.DbSetProdGroup.AddRange(listProdGroup2Add); } // salvo TUTTI i cambiamenti... diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 75f0822d..b5f705a6 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -1894,22 +1894,6 @@ namespace EgwCoreLib.Lux.Data.Services { // salvo info balance nel record del DB relativo all'oggetto richiesto await dbController.OrderRowUpsertProdEst(uID, prodEstim); -#if false - List? bomList = null; - try - { - // deserializzo la Bom... - bomList = JsonConvert.DeserializeObject>(prodEstim); - } - catch { } - if (bomList != null) - { - // verifico 1:1 gli item ricevuti dalla BOM sul DB con eventuale insert in anagrafica dei nuovi - dbController.ItemUpsertFromBom(bomList); - // salvo la BOM nel record del DB relativo all'oggetto richiesto - dbController.OfferUpsertFromBom(uID, bomList); - } -#endif } } diff --git a/Lux.API/Controllers/ProdController.cs b/Lux.API/Controllers/ProdController.cs index 799e6121..bb07cd02 100644 --- a/Lux.API/Controllers/ProdController.cs +++ b/Lux.API/Controllers/ProdController.cs @@ -173,10 +173,10 @@ namespace Lux.API.Controllers /// /// [HttpGet("rep-answer/{uid}")] - public async Task> ReplayAnswer(string id, int env) + public async Task> ReplayAnswer(string uid, int env) { Constants.EXECENVIRONMENTS envir = (Constants.EXECENVIRONMENTS)env; - string rawData = await EMProc.LoadRawData(id, envir); + string rawData = await EMProc.LoadRawData(uid, envir); bool saved = false; // provo a riprcessare... var retData = JsonConvert.DeserializeObject(rawData); diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index fa6d2fc4..5bf05b63 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2601.0912 + 0.9.2601.0915 diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 28d6b6d0..c7f592d2 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.0912 + 0.9.2601.0915 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 49b84d5e..83ed8d3a 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2601.0912

+

Versione: 0.9.2601.0915


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 875bcfc0..a4e06966 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2601.0912 +0.9.2601.0915 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index b70defec..cba3fae8 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2601.0912 + 0.9.2601.0915 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false