diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index 7e897b13..8676906a 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -451,8 +451,12 @@ namespace EgwCoreLib.Lux.Data.Controllers { try { + // prendo solo elementi a prezzo 0 da salvare sul DB + var item2save = bomList + .Where(x => x.Price == 0) + .ToList(); // ciclo x ogni elemento della BOM, cercando x gruppo e ExtItemCode - foreach (var item in bomList) + foreach (var item in item2save) { var currRec = dbCtx .DbSetItem @@ -602,26 +606,37 @@ namespace EgwCoreLib.Lux.Data.Controllers { numGroupOk++; } - // cerco nella tab in memoria che ho precaricato il costo... cercando x dati di selezione + qtyRange - var recCost = bomGenList - .Where(x => x.CodGroup == item.ClassCode - && x.ExtItemCode == item.ItemCode - && item.Qty >= x.QtyMin - && item.Qty < x.QtyMax) - .OrderByDescending(x => x.Cost) - .FirstOrDefault(); - // se trovato valorizzo! - if (recCost != null) + // 2025.09.16: se il prezzo arriva dalla BOM calcolata uso quello... + if (item.Price > 0) { + // conto l'item numItemOk++; - item.ItemID = recCost.ItemID; - item.Price = recCost.Cost * (1 + recCost.Margin) * item.Qty; + // ...e aggiorno totale totCost += item.Price; } else { - item.ItemID = 0; - item.Price = 0; + // cerco nella tab in memoria che ho precaricato il costo... cercando x dati di selezione + qtyRange + var recCost = bomGenList + .Where(x => x.CodGroup == item.ClassCode + && x.ExtItemCode == item.ItemCode + && item.Qty >= x.QtyMin + && item.Qty < x.QtyMax) + .OrderByDescending(x => x.Cost) + .FirstOrDefault(); + // se trovato valorizzo! + if (recCost != null) + { + numItemOk++; + item.ItemID = recCost.ItemID; + item.Price = recCost.Cost * (1 + recCost.Margin) * item.Qty; + totCost += item.Price; + } + else + { + item.ItemID = 0; + item.Price = 0; + } } } // salvo BOM... @@ -689,27 +704,42 @@ namespace EgwCoreLib.Lux.Data.Controllers { numGroupOk++; } - // cerco nella tab in memoria che ho precaricato il costo... cercando x dati di selezione + qtyRange - var recCost = bomGenList - .Where(x => x.CodGroup == item.ClassCode - && x.ExtItemCode == item.ItemCode - && item.Qty >= x.QtyMin - && item.Qty < x.QtyMax) - .OrderByDescending(x => x.Cost) - .FirstOrDefault(); - // se trovato valorizzo! - if (recCost != null) + + // 2025.09.16: se il prezzo arriva dalla BOM calcolata uso quello... + if (item.Price > 0) { + // resetto ItemID ma NON il prezzo + item.ItemID = 0; + // conto l'item numItemOk++; - item.ItemID = recCost.ItemID; - item.Price = recCost.Cost * (1 + recCost.Margin) * item.Qty; + // ...e aggiorno totale totCost += item.Price; } else { - item.ItemID = 0; - item.Price = 0; + // cerco nella tab in memoria che ho precaricato il costo... cercando x dati di selezione + qtyRange + var recCost = bomGenList + .Where(x => x.CodGroup == item.ClassCode + && x.ExtItemCode == item.ItemCode + && item.Qty >= x.QtyMin + && item.Qty < x.QtyMax) + .OrderByDescending(x => x.Cost) + .FirstOrDefault(); + // se trovato valorizzo! + if (recCost != null) + { + numItemOk++; + item.ItemID = recCost.ItemID; + item.Price = recCost.Cost * (1 + recCost.Margin) * item.Qty; + totCost += item.Price; + } + else + { + item.ItemID = 0; + item.Price = 0; + } } + } // salvo BOM... string itemBom = JsonConvert.SerializeObject(bomList); diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 25ef60f4..925d0900 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2509.1615 + 0.9.2509.1616 diff --git a/Lux.API/appsettings.Development.json b/Lux.API/appsettings.Development.json index 02f2251b..c294297e 100644 --- a/Lux.API/appsettings.Development.json +++ b/Lux.API/appsettings.Development.json @@ -7,7 +7,7 @@ }, "ServerConf": { "BaseUrl": "/lux/srv/", - "PubChannel": "EgwDevEngineInput", - "SubChannel": "EgwDevEngineOutput" + "PubChannel": "EgwEngineInput", + "SubChannel": "EgwEngineOutput" } } diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 92173f60..4945f73c 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.2509.1615 + 0.9.2509.1616 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 27d5cee5..78f74a85 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2509.1615

+

Versione: 0.9.2509.1616


Note di rilascio: