diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRepository.cs index 67c55576..63f369db 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/IOfferRepository.cs @@ -31,7 +31,6 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales Task UpdateAsync(OfferModel entity); - Task UpdateCostAsync(int offerId); #endregion Public Methods } diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs index 5b5a932c..4a83f58b 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/IOrderRepository.cs @@ -29,8 +29,6 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales Task UpdateAsync(OrderModel entity); - Task UpdateCostAsync(int OrderID); - #endregion Public Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/OfferRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/OfferRepository.cs index 9a61342a..99c51145 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/OfferRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/OfferRepository.cs @@ -1,9 +1,6 @@ -using EgwCoreLib.Lux.Core.RestPayload; -using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Sales; -using EgwCoreLib.Lux.Data.Domains; using Microsoft.EntityFrameworkCore; -using Newtonsoft.Json; using static EgwCoreLib.Lux.Core.Enums; namespace EgwCoreLib.Lux.Data.Repository.Sales @@ -267,66 +264,6 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales return await dbCtx.SaveChangesAsync() > 0; } - public async Task UpdateCostAsync(int OfferID) - { - await using var dbCtx = await CreateContextAsync(); - - // recupero righe offerta... - var offRowList = await dbCtx - .DbSetOfferRow - .Where(x => x.OfferID == OfferID) - .ToListAsync(); - - // If no rows found, nothing to update - if (offRowList.Count == 0) return false; - - // recupero l'elenco degli itemGroup gestiti - var itemGroupList = await dbCtx - .DbSetItemGroup - .ToListAsync(); - - // recupero il subset item da BOM / BomAlt... - var bomGenList = await dbCtx - .DbSetItem - .Where(x => (x.ItemType == Core.Enums.ItemClassType.Bom || x.ItemType == Core.Enums.ItemClassType.BomAlt)) - .ToListAsync(); - - // ciclo! - foreach (var currRec in offRowList) - { - // se contiene qualcosa x BOM... - if (!string.IsNullOrEmpty(currRec.ItemBOM) && currRec.ItemBOM.Length > 2) - { - // deserializzo - var bomList = JsonConvert.DeserializeObject>(currRec.ItemBOM); - // se ho trovato elementi... - if (bomList != null) - { - // calcolo il NUOVO costo e lo aggiorno... - double totCost = 0; - double totPrice = 0; - int totItemQty = 0; - int numGroupOk = 0; - int numItemOk = 0; - int numElems = bomList.Count; - // validazione e completamento BOM - BomCalculator.Validate(itemGroupList, bomGenList, ref bomList, null, ref totCost, ref totPrice, ref totItemQty, ref numGroupOk, ref numItemOk); - // salvo BOM... - string itemBom = JsonConvert.SerializeObject(bomList); - currRec.ItemBOM = itemBom; - // salvo arrotondato alla 3° decimale - currRec.BomCost = Math.Round(totCost, 3); - currRec.BomPrice = Math.Round(totPrice, 3); - currRec.BomOk = numElems == numGroupOk; - currRec.ItemOk = numElems == numItemOk; - currRec.ProdItemQty = totItemQty; - dbCtx.Entry(currRec).State = EntityState.Modified; - } - } - } - - return await dbCtx.SaveChangesAsync() > 0; - } #endregion Public Methods } diff --git a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs index e0948b71..a2c76d7b 100644 --- a/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Sales/OrderRepository.cs @@ -1,10 +1,7 @@ -using EgwCoreLib.Lux.Core.RestPayload; -using EgwCoreLib.Lux.Data.DbModel.Items; +using EgwCoreLib.Lux.Data.DbModel.Items; using EgwCoreLib.Lux.Data.DbModel.Production; using EgwCoreLib.Lux.Data.DbModel.Sales; -using EgwCoreLib.Lux.Data.Domains; using Microsoft.EntityFrameworkCore; -using Newtonsoft.Json; using static EgwCoreLib.Lux.Core.Enums; namespace EgwCoreLib.Lux.Data.Repository.Sales @@ -283,67 +280,6 @@ namespace EgwCoreLib.Lux.Data.Repository.Sales return await dbCtx.SaveChangesAsync() > 0; } - public async Task UpdateCostAsync(int OrderID) - { - await using var dbCtx = await CreateContextAsync(); - - // recupero righe Orderta... - var offRowList = await dbCtx - .DbSetOrderRow - .Where(x => x.OrderID == OrderID) - .ToListAsync(); - - // If no rows found, nothing to update - if (offRowList.Count == 0) return false; - - // recupero l'elenco degli itemGroup gestiti - var itemGroupList = await dbCtx - .DbSetItemGroup - .ToListAsync(); - - // recupero il subset item da BOM / BomAlt... - var bomGenList = await dbCtx - .DbSetItem - .Where(x => (x.ItemType == Core.Enums.ItemClassType.Bom || x.ItemType == Core.Enums.ItemClassType.BomAlt)) - .ToListAsync(); - - // ciclo! - foreach (var currRec in offRowList) - { - // se contiene qualcosa x BOM... - if (!string.IsNullOrEmpty(currRec.ItemBOM) && currRec.ItemBOM.Length > 2) - { - // deserializzo - var bomList = JsonConvert.DeserializeObject>(currRec.ItemBOM); - // se ho trovato elementi... - if (bomList != null) - { - // calcolo il NUOVO costo e lo aggiorno... - double totCost = 0; - double totPrice = 0; - int totItemQty = 0; - int numGroupOk = 0; - int numItemOk = 0; - int numElems = bomList.Count; - // validazione e completamento BOM - BomCalculator.Validate(itemGroupList, bomGenList, ref bomList, null, ref totCost, ref totPrice, ref totItemQty, ref numGroupOk, ref numItemOk); - // salvo BOM... - string itemBom = JsonConvert.SerializeObject(bomList); - currRec.ItemBOM = itemBom; - // salvo arrotondato alla 3° decimale - currRec.BomCost = Math.Round(totCost, 3); - currRec.BomPrice = Math.Round(totPrice, 3); - currRec.BomOk = numElems == numGroupOk; - currRec.ItemOk = numElems == numItemOk; - currRec.ProdItemQty = totItemQty; - dbCtx.Entry(currRec).State = EntityState.Modified; - } - } - } - - return await dbCtx.SaveChangesAsync() > 0; - } - #endregion Public Methods } } diff --git a/EgwCoreLib.Lux.Data/Services/Sales/OfferService.cs b/EgwCoreLib.Lux.Data/Services/Sales/OfferService.cs index d2648439..2da858b9 100644 --- a/EgwCoreLib.Lux.Data/Services/Sales/OfferService.cs +++ b/EgwCoreLib.Lux.Data/Services/Sales/OfferService.cs @@ -127,6 +127,9 @@ namespace EgwCoreLib.Lux.Data.Services.Sales { // 1. Recupero dati var rows = await _repo.GetRowsAsync(OfferId); + if (rows.Count == 0) + return false; + var itemGroups = await _repo.GetItemGroupsAsync(); var bomItems = await _repo.GetBomItemsAsync(); diff --git a/EgwCoreLib.Lux.Data/Services/Sales/OrderService.cs b/EgwCoreLib.Lux.Data/Services/Sales/OrderService.cs index a5324715..297d6d2d 100644 --- a/EgwCoreLib.Lux.Data/Services/Sales/OrderService.cs +++ b/EgwCoreLib.Lux.Data/Services/Sales/OrderService.cs @@ -118,6 +118,9 @@ namespace EgwCoreLib.Lux.Data.Services.Sales { // 1. Recupero dati var rows = await _repo.GetRowsAsync(OrderId); + if (rows.Count == 0) + return false; + var itemGroups = await _repo.GetItemGroupsAsync(); var bomItems = await _repo.GetBomItemsAsync(); diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 07ab3aeb..1f03b985 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2603.2317 + 1.1.2603.2318 diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 88531093..dba447dd 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 - 1.1.2603.2317 + 1.1.2603.2318 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index e20dcab3..d3d96c19 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2603.2317

+

Versione: 1.1.2603.2318


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index ecd866d3..c6e1443e 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2603.2317 +1.1.2603.2318 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 9ccb15fb..2b77c29a 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2603.2317 + 1.1.2603.2318 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false