diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index 6db78a0d..6e1127b4 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -466,59 +466,6 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } - /// - /// Elenco record ProductionGroup dato OrderRow - /// - /// - internal async Task> ProdGroupByOrderRow(int OrderRowID) - { - List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - dbResult = await dbCtx - .DbSetProdGroup - .Where(x => x.OrderRowID == OrderRowID) - .Include(i => i.ItemsNav) - .ToListAsync(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante ProdGroupByOrderRow{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - - /// - /// Elenco record ProductionGroup dato Stato dell'OrderRow - /// - /// - internal async Task> ProdGroupByOrderState(OrderStates reqState) - { - List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - dbResult = await dbCtx - .DbSetProdGroup - .Include(o => o.OrderRowNav) - .Where(x => x.OrderRowNav.OrderRowState == reqState) - .Include(i => i.ItemsNav) - .ToListAsync(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante ProdGroupByOrderState{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - /// /// Add record di un singolo ProdGroup da fase Balance /// diff --git a/EgwCoreLib.Lux.Data/Repository/Production/IProductionGroupRepository.cs b/EgwCoreLib.Lux.Data/Repository/Production/IProductionGroupRepository.cs new file mode 100644 index 00000000..439505ec --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Production/IProductionGroupRepository.cs @@ -0,0 +1,13 @@ +using EgwCoreLib.Lux.Data.DbModel.Production; +using static EgwCoreLib.Lux.Core.Enums; + +namespace EgwCoreLib.Lux.Data.Repository.Production +{ + public interface IProductionGroupRepository + { + Task> GetByOrderRowAsync(int orderRowID); + + Task> GetByOrderStateAsync(OrderStates reqState); + + } +} diff --git a/EgwCoreLib.Lux.Data/Repository/Production/ProductionGroupRepository.cs b/EgwCoreLib.Lux.Data/Repository/Production/ProductionGroupRepository.cs new file mode 100644 index 00000000..cbc7a3d8 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Production/ProductionGroupRepository.cs @@ -0,0 +1,50 @@ +using EgwCoreLib.Lux.Data.DbModel.Production; +using Microsoft.EntityFrameworkCore; +using static EgwCoreLib.Lux.Core.Enums; + +namespace EgwCoreLib.Lux.Data.Repository.Production +{ + public class ProductionGroupRepository : BaseRepository, IProductionGroupRepository + { + #region Public Constructors + + public ProductionGroupRepository(IDbContextFactory ctxFactory) : base(ctxFactory) + { + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Elenco record ProductionGroup dato OrderRow + /// + /// + public async Task> GetByOrderRowAsync(int orderRowID) + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetProdGroup + .AsNoTracking() + .Where(x => x.OrderRowID == orderRowID) + .Include(i => i.ItemsNav) + .ToListAsync(); + } + + /// + /// Elenco record ProductionGroup dato Stato dell'OrderRow + /// + /// + public async Task> GetByOrderStateAsync(OrderStates reqState) + { + await using var dbCtx = await CreateContextAsync(); + return await dbCtx.DbSetProdGroup + .AsNoTracking() + .Include(o => o.OrderRowNav) + .Where(x => x.OrderRowNav.OrderRowState == reqState) + .Include(i => i.ItemsNav) + .ToListAsync(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 6cd73db1..995bfffb 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -287,74 +287,6 @@ namespace EgwCoreLib.Lux.Data.Services return result; } - /// - /// Recupera ProdGroup dato POR - /// - /// - /// - public async Task> ProdGroupByOrderRow(int OrderRowID) - { - using var activity = StartActivity(); - string source = "DB"; - List? result = new List(); - // cerco in redis... - string currKey = $"{redisBaseKey}:ProdGroup:OrdRowId:{OrderRowID}"; - RedisValue rawData = await _redisDb.StringGetAsync(currKey); - if (rawData.HasValue && rawData.Length() > 2) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = await dbController.ProdGroupByOrderRow(OrderRowID); - // serializzo e salvo con config x evitare loop... - rawData = JsonConvert.SerializeObject(result, JSSettings); - await _redisDb.StringSetAsync(currKey, rawData, LongCache); - } - if (result == null) - { - result = new List(); - } - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return result; - } - - /// - /// Elenco record ProductionGroup dato Stato dell'OrderRow - /// - /// - /// - public async Task> ProdGroupByOrderState(OrderStates reqState) - { - using var activity = StartActivity(); - string source = "DB"; - List? result = new List(); - // cerco in redis... - string currKey = $"{redisBaseKey}:ProdGroup:OrdRowState:{reqState}"; - RedisValue rawData = await _redisDb.StringGetAsync(currKey); - if (rawData.HasValue && rawData.Length() > 2) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = await dbController.ProdGroupByOrderState(reqState); - // serializzo e salvo con config x evitare loop... - rawData = JsonConvert.SerializeObject(result, JSSettings); - await _redisDb.StringSetAsync(currKey, rawData, LongCache); - } - if (result == null) - { - result = new List(); - } - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return result; - } - /// /// Assegnazione in blocco degli item agli ODL corrispondenti /// diff --git a/EgwCoreLib.Lux.Data/Services/Production/IProductionGroupService.cs b/EgwCoreLib.Lux.Data/Services/Production/IProductionGroupService.cs new file mode 100644 index 00000000..55c18be0 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Production/IProductionGroupService.cs @@ -0,0 +1,12 @@ +using EgwCoreLib.Lux.Data.DbModel.Production; +using static EgwCoreLib.Lux.Core.Enums; + +namespace EgwCoreLib.Lux.Data.Services.Production +{ + public interface IProductionGroupService + { + Task> GetByOrderRowAsync(int orderRowID); + + Task> GetByOrderStateAsync(OrderStates reqState); + } +} diff --git a/EgwCoreLib.Lux.Data/Services/Production/ProductionGroupService.cs b/EgwCoreLib.Lux.Data/Services/Production/ProductionGroupService.cs new file mode 100644 index 00000000..b6afc23e --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Production/ProductionGroupService.cs @@ -0,0 +1,59 @@ +using EgwCoreLib.Lux.Data.DbModel.Production; +using EgwCoreLib.Lux.Data.Repository.Production; +using Microsoft.Extensions.Configuration; +using StackExchange.Redis; +using static EgwCoreLib.Lux.Core.Enums; + +namespace EgwCoreLib.Lux.Data.Services.Production +{ + public class ProductionGroupService : BaseServ, IProductionGroupService + { + #region Public Constructors + + public ProductionGroupService( + IConfiguration config, + IConnectionMultiplexer redis, + IProductionGroupRepository repo) : base(config, redis) + { + _className = "ProductionGroup"; + _repo = repo; + } + + #endregion Public Constructors + + #region Public Methods + + public async Task> GetByOrderRowAsync(int orderRowID) + { + return await TraceAsync($"{_className}.ByOrdRow", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:ByOrdRow:{orderRowID}", + async () => await _repo.GetByOrderRowAsync(orderRowID), + UltraLongCache + ); + }); + } + + public async Task> GetByOrderStateAsync(OrderStates reqState) + { + return await TraceAsync($"{_className}.ByOrdState", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:ByOrdState:{reqState}", + async () => await _repo.GetByOrderStateAsync(reqState), + UltraLongCache + ); + }); + } + + #endregion Public Methods + + #region Private Fields + + private readonly string _className; + private readonly IProductionGroupRepository _repo; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 52096a05..99d0a10e 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2603.1818 + 1.1.2603.1819 diff --git a/Lux.UI/Components/Compo/OrderRowMan.razor.cs b/Lux.UI/Components/Compo/OrderRowMan.razor.cs index 9713dd2e..cc6fc481 100644 --- a/Lux.UI/Components/Compo/OrderRowMan.razor.cs +++ b/Lux.UI/Components/Compo/OrderRowMan.razor.cs @@ -366,8 +366,6 @@ namespace Lux.UI.Components.Compo [Inject] private IEnvirParamService EPService { get; set; } = null!; - [Inject] - private IProductionPlantService PPService { get; set; } = null!; /// /// Costo totale calcolato x offerta @@ -492,6 +490,12 @@ namespace Lux.UI.Components.Compo [Inject] private IOrderService OrdService { get; set; } = null!; + [Inject] + private IProductionGroupService PGService { get; set; } = null!; + + [Inject] + private IProductionPlantService PPService { get; set; } = null!; + [Inject] private ProdService PService { get; set; } = null!; @@ -1771,7 +1775,7 @@ namespace Lux.UI.Components.Compo SelRecord = mergeRec.Original; WorkLoadRecord = mergeRec.WorkLoad; // recupero i prodassign data... - List? curList = await DLService.ProdGroupByOrderRow(SelRecord.OrderRowID); + List? curList = await PGService.GetByOrderRowAsync(SelRecord.OrderRowID); #if false // se non avessi tutte le macchine configurate --> chiamo fix! if (curList == null || curList.Count == 0 || curList.Count < AllProdPlant.Count()) diff --git a/Lux.UI/Components/Pages/WorkLoadBalance.razor.cs b/Lux.UI/Components/Pages/WorkLoadBalance.razor.cs index 0f207ffe..6e21359b 100644 --- a/Lux.UI/Components/Pages/WorkLoadBalance.razor.cs +++ b/Lux.UI/Components/Pages/WorkLoadBalance.razor.cs @@ -93,6 +93,8 @@ namespace Lux.UI.Components.Pages [Inject] private IProductionBatchService PBService { get; set; } = null!; [Inject] + private IProductionGroupService PGService { get; set; } = null!; + [Inject] private IProductionOdlService POService { get; set; } = null!; [Inject] @@ -120,7 +122,7 @@ namespace Lux.UI.Components.Pages { await DLService.SaveProdEstimateAsync(currRec.OrderRowUID, currRec.Envir, currRec.ProdEstimate); // rileggo... - var ListEstimated = await DLService.ProdGroupByOrderState(OrderStates.Estimated); + var ListEstimated = await PGService.GetByOrderStateAsync(OrderStates.Estimated); listProgGroup = ListEstimated?.Where(x => x.OrderRowID == OrderRowID).ToList() ?? new(); } } @@ -403,7 +405,7 @@ namespace Lux.UI.Components.Pages { // prendo solo ordini stimati (NON ancora bilanciati o pianificati) ListEstimRecords = await OrdRService.GetByStateMinAsync(OrderStates.Estimated, PeriodoSel.Inizio, PeriodoSel.Fine); - ListBalancedRecords = await DLService.ProdGroupByOrderState(OrderStates.Assigned); + ListBalancedRecords = await PGService.GetByOrderStateAsync(OrderStates.Assigned); ListOdl = await POService.GetUnassignAsync(); } diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 1b0f853b..cee5edb7 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.1818 + 1.1.2603.1819 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 99afd8e4..6ad93267 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,33 @@ LUX - Web Windows MES -

Versione: 1.1.2603.1818

+

Versione: 1.1.2603.1819

+
Note di rilascio: +
    +
  • + Ultime modifiche: +
      {{LAST-CHANGES}}
    +
  • +
  • + v.0.9.* → +
      +
    • Versione preliminare
    • +
    • Release dotNet8
    • +
    • Integrazione EFCore
    • +
    +
  • +
+
+
+ +
+ +
+ + + LUX - Web Windows MES +

Versione: 1.1.2603.1819


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index b7202442..0ec63097 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1,2 @@ -1.1.2603.1818 +1.1.2603.1819 +1.1.2603.1819 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 70c53cc6..8236cd29 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,13 @@ - 1.1.2603.1818 + 1.1.2603.1819 + http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip + http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html + false + + + + 1.1.2603.1819 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false