From ac6695e7b03668663c2293d31d9ba02f7d27dbee Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 16 Mar 2026 11:27:33 +0100 Subject: [PATCH] Completato porting/estrazione Template e Template Row da DataLayer --- .../Controllers/LuxController.cs | 497 ------------------ .../Catalog/ITemplateRowRepository.cs | 28 + .../Catalog/TemplateRowRepository.cs | 130 +++++ .../Services/Catalog/ITemplateRowService.cs | 29 + .../Services/Catalog/ITemplateService.cs | 2 +- .../Services/Catalog/TemplateRowService.cs | 292 ++++++++++ .../Services/Catalog/TemplateService.cs | 6 +- .../Services/DataLayerServices.cs | 220 -------- Lux.API/Lux.API.csproj | 2 +- Lux.API/Program.cs | 2 + Lux.UI/Components/Compo/OfferRowMan.razor.cs | 5 +- .../Compo/Templates/TemplateRowList.razor.cs | 59 +-- Lux.UI/Lux.UI.csproj | 2 +- Lux.UI/Program.cs | 2 + Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 17 files changed, 511 insertions(+), 771 deletions(-) create mode 100644 EgwCoreLib.Lux.Data/Repository/Catalog/ITemplateRowRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRowRepository.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Catalog/ITemplateRowService.cs create mode 100644 EgwCoreLib.Lux.Data/Services/Catalog/TemplateRowService.cs diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index cda27c72..bc84e117 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -1,6 +1,5 @@ using EgwCoreLib.Lux.Core.Generic; using EgwCoreLib.Lux.Core.RestPayload; -using EgwCoreLib.Lux.Data.DbModel.Catalog; using EgwCoreLib.Lux.Data.DbModel.Config; using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; @@ -4451,383 +4450,6 @@ namespace EgwCoreLib.Lux.Data.Controllers return dbResult; } - /// - /// Elenco filtrato (parent) TemplateRow da DB - /// - /// - /// - internal async Task> TemplateRowByParentAsync(int templateID) - { - List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - dbResult = await dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateID == templateID) - .Include(r => r.SellingItemNav) - .ToListAsync(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowByParentAsync{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - - /// - /// Esegue il cloning completo di un TemplateRow e di TUTTE le relative righe... - /// - /// - /// - internal async Task TemplateRowCloneAsync(TemplateRowModel rec2clone) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - DateTime adesso = DateTime.Now; - // recupero offerta... - var currRec = await dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateRowID == rec2clone.TemplateRowID) - .Include(x => x.SellingItemNav) - .FirstOrDefaultAsync(); - - // se trovo --> duplico! - if (currRec != null) - { - // cerco ultimo rec... - var lastRec = await dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateID == rec2clone.TemplateID) - .OrderByDescending(x => x.RowNum) - .FirstOrDefaultAsync(); - int rowNum = lastRec != null ? lastRec.RowNum + 1 : 1; - - TemplateRowModel newRec = new TemplateRowModel() - { - Name = rec2clone.Name, - Envir = rec2clone.Envir, - AwaitBom = rec2clone.AwaitBom, - AwaitPrice = rec2clone.AwaitPrice, - BomCost = rec2clone.BomCost, - BomOk = rec2clone.BomOk, - BomPrice = rec2clone.BomPrice, - FileName = rec2clone.FileName, - FileResource = rec2clone.FileResource, - FileSize = rec2clone.FileSize, - Inserted = rec2clone.Inserted, - ItemBOM = rec2clone.ItemBOM, - ItemJCD = rec2clone.ItemJCD, - ItemOk = rec2clone.ItemOk, - ItemSteps = rec2clone.ItemSteps, - ItemTags = rec2clone.ItemTags, - JobID = rec2clone.JobID, - Note = rec2clone.Note, - ProdItemQty = rec2clone.ProdItemQty, - Qty = rec2clone.Qty, - RowNum = rowNum, - SellingItemID = rec2clone.SellingItemID, - SellingItemNav = rec2clone.SellingItemNav, - SerStruct = rec2clone.SerStruct, - StepCost = rec2clone.StepCost, - StepFlowTime = rec2clone.StepFlowTime, - StepLeadTime = rec2clone.StepLeadTime, - StepPrice = rec2clone.StepPrice, - TemplateID = rec2clone.TemplateID, - TemplateRowUID = rec2clone.TemplateRowDtx - }; - //newRec.TemplateRowUID = newRec.TemplateRowDtx; - - // infine aggiungo riga ordine e relativi child - dbCtx.DbSetTemplateRow.Add(newRec); - } - - // salvo TUTTI i cambiamenti... - var result = await dbCtx.SaveChangesAsync(); - answ = result > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowCloneAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Eliminazione record - /// - /// - /// - internal async Task TemplateRowDeleteAsync(TemplateRowModel rec2del) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - var currRec = dbCtx - .DbSetTemplateRow - .Where(x => rec2del.TemplateRowID == rec2del.TemplateRowID) - .FirstOrDefault(); - // se trovato --> elimino - if (currRec != null) - { - dbCtx.DbSetTemplateRow.Remove(rec2del); - } - // salvo... - int numAct = await dbCtx.SaveChangesAsync(); - answ = numAct > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowDeleteAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Aggiornamento valore UID non calcolato + ritorno elenco UID da aggiornare - /// - /// - /// - internal List TemplateRowFixUid(int TemplateID) - { - List answ = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - var currList = dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateID == TemplateID) - .ToList(); - // se trovato --> verifico valori differenti, aggiorno e restituisco da calcolare - if (currList != null) - { - var list2fix = currList.Where(x => string.IsNullOrEmpty(x.TemplateRowUID) || x.TemplateRowUID != x.TemplateRowDtx).ToList(); - if (list2fix != null && list2fix.Count > 0) - { - // salvo elenco - answ = list2fix.Select(x => x.TemplateRowDtx).ToList(); - // sistemo UID - foreach (var item in list2fix) - { - item.TemplateRowUID = item.TemplateRowDtx; - dbCtx.Entry(item).State = EntityState.Modified; - } - // salvo... - var result = dbCtx.SaveChanges(); - } - } - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowFixUid{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Elenco completo TemplateRow da DB - /// - /// - internal async Task> TemplateRowGetAllAsync() - { - List dbResult = new List(); - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - dbResult = await dbCtx - .DbSetTemplateRow - .Include(r => r.SellingItemNav) - .ToListAsync(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowGetAllAsync{Environment.NewLine}{exc}"); - } - } - return dbResult; - } - - /// - /// Effettua update stato await BOM/PRICE per l template indicato - /// - /// ID singola riga offerta - /// Se non nullo è il nuovo stato await BOM - /// Se non nullo è stato await Price - /// - internal async Task TemplateRowUpdateAwaitStateAsync(int TemplateRowID, bool? awaitBom, bool? awaitPrice) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - // recupero righe offerta... - var currRec = dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateRowID == TemplateRowID) - .FirstOrDefault(); - - // aggiorno parametri (se inviati) - if (currRec != null) - { - currRec.AwaitBom = awaitBom ?? currRec.AwaitBom; - currRec.AwaitPrice = awaitPrice ?? currRec.AwaitPrice; - dbCtx.Entry(currRec).State = EntityState.Modified; - } - - // salvo i cambiamenti... - var result = await dbCtx.SaveChangesAsync(); - answ = result > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowUpdateAwaitStateAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Aggiorno sul DB i dati del file associato - /// - /// - /// - internal async Task TemplateRowUpdateFileDataAsync(TemplateRowModel updRec) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - // recupero righe Template... - var currRec = dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateRowID == updRec.TemplateRowID) - .FirstOrDefault(); - - // aggiorno parametri (se inviati) - if (currRec != null) - { - currRec.FileName = updRec.FileName; - currRec.FileResource = updRec.FileResource; - currRec.FileSize = updRec.FileSize; - currRec.SerStruct = updRec.SerStruct; - dbCtx.Entry(currRec).State = EntityState.Modified; - } - - // salvo i cambiamenti... - var result = await dbCtx.SaveChangesAsync(); - answ = result > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowUpdateFileDataAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Effettua update serStruct per il Template indicato - /// - /// ID singola Riga Template - /// Valore serializzatoe - /// - internal async Task TemplateRowUpdateSerStructAsync(int TemplateRowID, string serStruct) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - // recupero righe offerta... - var currRec = dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateRowID == TemplateRowID) - .FirstOrDefault(); - - // aggiorno parametri (se inviati) - if (currRec != null) - { - currRec.SerStruct = serStruct; - dbCtx.Entry(currRec).State = EntityState.Modified; - } - - // salvo i cambiamenti... - var result = await dbCtx.SaveChangesAsync(); - answ = result > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowUpdateSerStructAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - /// - /// Add record TemplateRow - /// - /// - /// - internal async Task TemplateRowUpsertAsync(TemplateRowModel updRec) - { - bool answ = false; - //using (DataLayerContext dbCtx = new DataLayerContext(_config)) - using (DataLayerContext dbCtx = new DataLayerContext()) - { - try - { - // recupero offerta... - var currRec = dbCtx - .DbSetTemplateRow - .Where(x => x.TemplateRowID == updRec.TemplateRowID) - .FirstOrDefault(); - - // se non trovo aggiungo - if (currRec == null) - { - dbCtx.DbSetTemplateRow.Add(updRec); - } - // altrimenti aggiorno - else - { - dbCtx.Entry(currRec).CurrentValues.SetValues(updRec); - } - - // salvo TUTTI i cambiamenti... - var result = await dbCtx.SaveChangesAsync(); - answ = result > 0; - } - catch (Exception exc) - { - Log.Error($"Eccezione durante TemplateRowUpsertAsync{Environment.NewLine}{exc}"); - } - } - return answ; - } - - internal bool UpdateCodGroup(List bomList) { bool answ = false; @@ -4873,124 +4495,5 @@ namespace EgwCoreLib.Lux.Data.Controllers #endregion Private Fields - #region Private Methods - -#if false - /// - /// Esegue completamento e la validazione dei dati BOM da lista articoli + gruppi, - /// validando i dati stessi - /// - /// Elenco ItemGroup da considerare - /// Item di tipo BOM/BomAlt AMMESSI - /// Lista BOM ricevuta da validare - /// Lista BOM precedente da confrontare x scelta alternativi - /// Costo netto componenti BOM calcolato - /// Prezzo complessivo calcolato (con aggiunta marginalità) - /// Numero toale di item dello step BOM - /// Controllo coerenza calcoli sui gruppi list2upd - /// Controllo coerenza calcoli su num list2upd - private static void validateBom(List itemGroupList, List bomGenList, ref List bomList, List? bomListPrev, ref double totCost, ref double totPrice, ref int totItemQty, ref int numGroupOk, ref int numItemOk) - { - double margin = 0; - // ciclo x ogni elemento della BOM, cercando x gruppo e ExtItemCode - foreach (var item in bomList) - { - // init del margine - margin = 0; - // verifico item group esistente... - if (itemGroupList.Where(x => x.CodGroup == item.ClassCode).Count() > 0) - { - numGroupOk++; - } - - // 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.PriceEff = item.Price; - // dovrei recuperare margine da BOM... da rivedere, x ora cablato 20%... - margin = 0.2; - } - else - { - /************************************************* - * Ricerca costo item: - * - se ho un itemID --> cerco record ESATTO e sostituisco descrizioni & co... - * - se non ho itemID --> cerco dati di selezione + qtyRange - *************************************************/ - ItemModel? recCost = null; - bool selExact = item.ItemID > 0; - if (selExact) - { - recCost = bomGenList - .Where(x => x.ItemID == item.ItemID) - .FirstOrDefault(); - } - else - { - recCost = bomGenList - .Where(x => x.CodGroup == item.ClassCode - && x.ItemIDParent == 0 // voglio NON sia un record CHILD - && x.ExtItemCode == item.ItemCode - && item.Qty >= x.QtyMin - && item.Qty < x.QtyMax) - .OrderByDescending(x => x.Cost) - .FirstOrDefault(); - // 2025.09.24: se ho un elenco item della BOM precedente - if (bomListPrev != null && bomListPrev.Count > 0 && recCost != null) - { - // ...cerco item trovato come PARENT di altri item - var listAlt = bomGenList.Where(x => x.ItemIDParent == recCost.ItemID).ToList(); - - // che cerco nella nella BOM precedente... - var result = listAlt - .Join( - bomListPrev, - l1 => l1.ItemID, - l2 => l2.ItemID, - (l1, l2) => l1) - .ToList(); - // nel caso ne trovassi solo 1 uso quello al posto del recCost... - if (result.Count == 1) - { - recCost = result.FirstOrDefault(); - } - } - } - - // se trovato valorizzo! - if (recCost != null) - { - numItemOk++; - item.ItemID = recCost.ItemID; - //item.PriceEff = recCost.BomCost * (1 + recCost.Margin); - item.PriceEff = recCost.Cost; - // se selezione esatta sovrascrivo altri valori - if (selExact) - { - item.ItemCode = recCost.ExtItemCode; - //item.DescriptionCode = recCost.Name; - } - margin = recCost.Margin; - } - else - { - item.ItemID = 0; - item.PriceEff = 0; - } - } - // ...e aggiorno totale - totCost += item.TotalCost; - // e prezzo totale compreso margine - totPrice += item.TotalCost * (1 + margin); - totItemQty += item.ItemQty; - } - } -#endif - - #endregion Private Methods } } \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Catalog/ITemplateRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Catalog/ITemplateRowRepository.cs new file mode 100644 index 00000000..7a781266 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Catalog/ITemplateRowRepository.cs @@ -0,0 +1,28 @@ +using EgwCoreLib.Lux.Data.DbModel.Catalog; + +namespace EgwCoreLib.Lux.Data.Repository.Utils +{ + public interface ITemplateRowRepository : IBaseRepository + { + #region Public Methods + + void Add(TemplateRowModel entity); + + Task CloneAsync(TemplateRowModel rec2clone); + + void Delete(TemplateRowModel entity); + + Task> GetAllWithNavAsync(); + + Task GetRowAsync(int templateRowId); + + Task> GetRowsAsync(int templateId); + + Task SaveRowsAsync(List rows); + + void Update(TemplateRowModel entity); + + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRowRepository.cs b/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRowRepository.cs new file mode 100644 index 00000000..f79a6cb9 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRowRepository.cs @@ -0,0 +1,130 @@ +using EgwCoreLib.Lux.Data.DbModel.Catalog; +using Microsoft.EntityFrameworkCore; + +namespace EgwCoreLib.Lux.Data.Repository.Utils +{ + public class TemplateRowRepository : BaseRepository, ITemplateRowRepository + { + #region Public Constructors + + public TemplateRowRepository(DataLayerContext db) : base(db) + { + } + + #endregion Public Constructors + + #region Public Methods + + public void Add(TemplateRowModel entity) => _dbCtx.DbSetTemplateRow.Add(entity); + + /// + /// Esegue il cloning completo di un Template e di TUTTE le relative righe... + /// + /// + /// + public async Task CloneAsync(TemplateRowModel rec2clone) + { + var currRec = await _dbCtx.DbSetTemplateRow + .FirstOrDefaultAsync(x => x.TemplateRowID == rec2clone.TemplateRowID); + + if (currRec == null) + return false; + + // cerco ultimo rec... + var lastRec = await _dbCtx + .DbSetTemplateRow + .Where(x => x.TemplateID == rec2clone.TemplateID) + .OrderByDescending(x => x.RowNum) + .FirstOrDefaultAsync(); + int rowNum = lastRec != null ? lastRec.RowNum + 1 : 1; + + var newRec = new TemplateRowModel() + { + Name = rec2clone.Name, + Envir = rec2clone.Envir, + AwaitBom = rec2clone.AwaitBom, + AwaitPrice = rec2clone.AwaitPrice, + BomCost = rec2clone.BomCost, + BomOk = rec2clone.BomOk, + BomPrice = rec2clone.BomPrice, + FileName = rec2clone.FileName, + FileResource = rec2clone.FileResource, + FileSize = rec2clone.FileSize, + Inserted = rec2clone.Inserted, + ItemBOM = rec2clone.ItemBOM, + ItemJCD = rec2clone.ItemJCD, + ItemOk = rec2clone.ItemOk, + ItemSteps = rec2clone.ItemSteps, + ItemTags = rec2clone.ItemTags, + JobID = rec2clone.JobID, + Note = rec2clone.Note, + ProdItemQty = rec2clone.ProdItemQty, + Qty = rec2clone.Qty, + RowNum = rowNum, + SellingItemID = rec2clone.SellingItemID, + SellingItemNav = rec2clone.SellingItemNav, + SerStruct = rec2clone.SerStruct, + StepCost = rec2clone.StepCost, + StepFlowTime = rec2clone.StepFlowTime, + StepLeadTime = rec2clone.StepLeadTime, + StepPrice = rec2clone.StepPrice, + TemplateID = rec2clone.TemplateID, + TemplateRowUID = rec2clone.TemplateRowDtx + }; + + _dbCtx.DbSetTemplateRow.Add(newRec); + + return await _dbCtx.SaveChangesAsync() > 0; + } + + public void Delete(TemplateRowModel entity) => _dbCtx.DbSetTemplateRow.Remove(entity); + + public async Task> GetAllWithNavAsync() + { + return await _dbCtx.DbSetTemplateRow + .Include(o => o.SellingItemNav) + .AsNoTracking() + .ToListAsync(); + } + + public async Task GetRowAsync(int templateRowId) + { + return await _dbCtx.DbSetTemplateRow + .FirstOrDefaultAsync(x => x.TemplateRowID == templateRowId); + } + + public async Task> GetRowsAsync(int templateId) + { + return await _dbCtx.DbSetTemplateRow + .Where(x => x.TemplateID == templateId) + .Include(r => r.SellingItemNav) + .ToListAsync(); + } + + public async Task SaveRowsAsync(List rows) + { + foreach (var row in rows) + _dbCtx.Entry(row).State = EntityState.Modified; + + return await _dbCtx.SaveChangesAsync() > 0; + } + + public void Update(TemplateRowModel entity) + { + // Recuperiamo l'entità tracciata dal context + var trackedEntity = _dbCtx.DbSetTemplateRow.Local.FirstOrDefault(x => x.TemplateID == entity.TemplateID); + + if (trackedEntity != null) + { + // Aggiorna i valori dell'entità tracciata con quelli della nuova + _dbCtx.Entry(trackedEntity).CurrentValues.SetValues(entity); + } + else + { + _dbCtx.DbSetTemplateRow.Update(entity); + } + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateRowService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateRowService.cs new file mode 100644 index 00000000..05800a62 --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateRowService.cs @@ -0,0 +1,29 @@ +using EgwCoreLib.Lux.Data.DbModel.Catalog; + +namespace EgwCoreLib.Lux.Data.Services.Utils +{ + public interface ITemplateRowService + { + #region Public Methods + + Task CloneAsync(TemplateRowModel rec2clone); + + Task DeleteAsync(TemplateRowModel model); + + Task> FixRowUidAsync(int templateId); + + Task> GetAllAsync(); + + Task> GetByParentAsync(int templateId); + + Task UpdateAwaitStateAsync(int templateRowId, bool? awaitBom, bool? awaitPrice, bool flushCache = false); + + Task UpdateFileDataAsync(TemplateRowModel updRec); + + Task UpdateSerStructAsync(int TemplateRowID, string serStruct); + + Task UpsertAsync(TemplateRowModel upsRec); + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs index 6928fd95..dd6c4247 100644 --- a/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs +++ b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs @@ -14,7 +14,7 @@ namespace EgwCoreLib.Lux.Data.Services.Utils Task UpsertAsync(TemplateModel upsRec); - Task UpdateCostAsync(int TemplateID); + Task UpdateCostAsync(int templateId); #endregion Public Methods } diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/TemplateRowService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateRowService.cs new file mode 100644 index 00000000..eb137a0d --- /dev/null +++ b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateRowService.cs @@ -0,0 +1,292 @@ +using EgwCoreLib.Lux.Data.DbModel.Catalog; +using EgwCoreLib.Lux.Data.Repository.Utils; +using Microsoft.Extensions.Configuration; +using StackExchange.Redis; + +namespace EgwCoreLib.Lux.Data.Services.Utils +{ + public class TemplateRowService : BaseServ, ITemplateRowService + { + #region Public Constructors + + public TemplateRowService( + IConfiguration config, + IConnectionMultiplexer redis, + ITemplateRowRepository repo) : base(config, redis) + { + _repo = repo; + } + + #endregion Public Constructors + + #region Public Methods + + /// + /// Esegue il cloning completo di un Template e di TUTTE le relative righe... + /// + /// + /// + public async Task CloneAsync(TemplateRowModel rec2clone) + { + return await TraceAsync("TemplateRow.Clone", async (activity) => + { + // eseguo clone + var result = await _repo.CloneAsync(rec2clone); + + // se eseguito, pulisco la cache correlata + if (result) + { + // Invalido sia la lista classi che eventuali dettagli correlati + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + return result; + }); + } + + /// + /// Eliminazione record + /// + /// + /// + public async Task DeleteAsync(TemplateRowModel rec2del) + { + return await TraceAsync("TemplateRow.Delete", async (activity) => + { + var dbResult = await _repo.GetRowAsync(rec2del.TemplateRowID); + if (dbResult == null) return false; + + _repo.Delete(dbResult); + bool success = await _repo.SaveChangesAsync(); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return success; + }); + } + + /// + /// Effettua fix UID righe child del temoplate indicato e restituisce elenco UID da chiamare x refresh + /// + /// Key + /// + public async Task> FixRowUidAsync(int templateId) + { + return await TraceAsync("TemplateRow.FixRowUidAsync", async (activity) => + { + // 1. Recupero righe + var rows = await _repo.GetRowsAsync(templateId); + + // 2. Trovo quelle da sistemare + var list2fix = rows + .Where(x => string.IsNullOrEmpty(x.TemplateRowUID) || + x.TemplateRowUID != x.TemplateRowDtx) + .ToList(); + + // 3. Se non c’è nulla da fare → ritorno + if (list2fix.Count == 0) + return new List(); + + // 4. Preparo la lista da restituire + var result = list2fix + .Select(x => x.TemplateRowDtx) + .ToList(); + + // 5. Aggiorno i record + foreach (var row in list2fix) + row.TemplateRowUID = row.TemplateRowDtx; + + // 6. Salvo + bool success = await _repo.SaveRowsAsync(list2fix); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return result; + }); + } + + /// + /// Elenco completo TemplateRow da DB + /// + /// + public async Task> GetAllAsync() + { + return await TraceAsync("TemplateRow.GetAll", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:TemplateRow:ALL", + async () => await _repo.GetAllWithNavAsync() + ); + }); + } + + /// + /// Elenco filtrato (parent) TemplateRow da DB + /// + /// + /// + public async Task> GetByParentAsync(int templateId) + { + + return await TraceAsync("TemplateRow.GetByParent", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:TemplateRow:{templateId}", + async () => await _repo.GetRowsAsync(templateId) + ); + }); + } + + public async Task UpdateAwaitStateAsync(int templateRowId, bool? awaitBom, bool? awaitPrice, bool flushCache = false) + { + return await TraceAsync("TemplateRow.UpdateAwaitState", async (activity) => + { + var currRec = await _repo.GetRowAsync(templateRowId); + + if (currRec == null) + return false; + + if (awaitBom.HasValue) + currRec.AwaitBom = awaitBom.Value; + + if (awaitPrice.HasValue) + currRec.AwaitPrice = awaitPrice.Value; + + //_repo.Update(currRec); + + activity?.SetTag("db.operation", "UPDATE"); + + bool success = await _repo.SaveChangesAsync(); + + if (success && flushCache) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return success; + }); + } + + /// + /// Effettua update delle info legate al file per il Template indicato + /// + /// Riga Template coi dati da aggiornare + /// + public async Task UpdateFileDataAsync(TemplateRowModel updRec) + { + return await TraceAsync("TemplateRow.UpdateFileData", async (activity) => + { + var currRec = await _repo.GetRowAsync(updRec.TemplateRowID); + + if (currRec == null) + return false; + + currRec.FileName = updRec.FileName; + currRec.FileResource = updRec.FileResource; + currRec.FileSize = updRec.FileSize; + currRec.SerStruct = updRec.SerStruct; + + //_repo.Update(currRec); + + activity?.SetTag("db.operation", "UPDATE"); + + bool success = await _repo.SaveChangesAsync(); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return success; + }); + } + + /// + /// Effettua update del valore serializzato della Riga Template + /// + /// ID Riga Template da aggiornare + /// Serializzazione oggetto (es JWD) + /// + public async Task UpdateSerStructAsync(int TemplateRowID, string serStruct) + { + return await TraceAsync("TemplateRow.UpdateSerStruct", async (activity) => + { + var currRec = await _repo.GetRowAsync(TemplateRowID); + + if (currRec == null) + return false; + + currRec.SerStruct = serStruct; + + //_repo.Update(currRec); + + activity?.SetTag("db.operation", "UPDATE"); + + bool success = await _repo.SaveChangesAsync(); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return success; + }); + } + + /// + /// Upsert record TemplateRow + /// + /// + /// + public async Task UpsertAsync(TemplateRowModel upsRec) + { + return await TraceAsync("TemplateRow.Upsert", async (activity) => + { + var currRec = await _repo.GetRowAsync(upsRec.TemplateRowID); + + string operation = "UPDATE"; + + if (currRec != null) + { + _repo.Update(upsRec); + } + else + { + operation = "INSERT"; + _repo.Add(upsRec); + } + + activity?.SetTag("db.operation", operation); + + bool success = await _repo.SaveChangesAsync(); + + if (success) + { + await ClearCacheAsync($"{_redisBaseKey}:Template:*"); + await ClearCacheAsync($"{_redisBaseKey}:TemplateRows:*"); + } + + return success; + }); + } + + #endregion Public Methods + + #region Private Fields + + private readonly ITemplateRowRepository _repo; + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs index 47f68a77..e1294b31 100644 --- a/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs +++ b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs @@ -146,14 +146,14 @@ namespace EgwCoreLib.Lux.Data.Services.Utils /// /// Effettua update dei costi di tutte le righe del template indicato /// - /// + /// /// - public async Task UpdateCostAsync(int TemplateID) + public async Task UpdateCostAsync(int templateId) { return await TraceAsync("Template.Upsert", async (activity) => { // 1. Recupero dati - var rows = await _repo.GetRowsAsync(TemplateID); + var rows = await _repo.GetRowsAsync(templateId); var itemGroups = await _repo.GetItemGroupsAsync(); var bomItems = await _repo.GetBomItemsAsync(); diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 100ac6fe..8d77fa60 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -1,7 +1,6 @@ using EgwCoreLib.Lux.Core.Generic; using EgwCoreLib.Lux.Core.RestPayload; using EgwCoreLib.Lux.Data.Controllers; -using EgwCoreLib.Lux.Data.DbModel.Catalog; using EgwCoreLib.Lux.Data.DbModel.Config; using EgwCoreLib.Lux.Data.DbModel.Cost; using EgwCoreLib.Lux.Data.DbModel.Items; @@ -2630,225 +2629,6 @@ namespace EgwCoreLib.Lux.Data.Services return result; } - /// - /// Elenco filtrato (parent) TemplateRow da DB - /// - /// - /// - public async Task> TemplateRowByParentAsync(int templateID) - { - using var activity = StartActivity(); - string source = "DB"; - List? result = new List(); - // cerco in redis... - string currKey = $"{redisBaseKey}:TemplateRow:{templateID}"; - RedisValue rawData = await _redisDb.StringGetAsync(currKey); - //if (!string.IsNullOrEmpty($"{rawData}")) - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = await dbController.TemplateRowByParentAsync(templateID); - // 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(); - } - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return result; - } - - /// - /// Esegue clone completo del TemplateRow indicato e svuota la cache - /// - /// - /// - public async Task TemplateRowCloneAsync(TemplateRowModel rec2clone) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // calcolo - bool fatto = await dbController.TemplateRowCloneAsync(rec2clone); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - /// - /// Effettua eliminazione del TemplateRow - /// - /// Riga Offerta coi dati da aggiornare - /// - public async Task TemplateRowDeleteAsync(TemplateRowModel updRec) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // calcolo - bool fatto = await dbController.TemplateRowDeleteAsync(updRec); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - /// - /// Effettua fix UID righe child del temoplate indicato e restituisce elenco UID da chiamare x refresh - /// - /// Key - /// - public async Task> TemplateRowFixUid(int TemplateID) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - List answ = new List(); - // calcolo - answ = dbController.TemplateRowFixUid(TemplateID); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return answ; - } - - /// - /// Elenco completo TemplateRow da DB - /// - /// - public async Task> TemplateRowGetAllAsync() - { - using var activity = StartActivity(); - string source = "DB"; - List? result = new List(); - // cerco in redis... - string currKey = $"{redisBaseKey}:TemplateRow:ALL"; - RedisValue rawData = await _redisDb.StringGetAsync(currKey); - //if (!string.IsNullOrEmpty($"{rawData}")) - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = await dbController.TemplateRowGetAllAsync(); - // 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(); - } - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return result; - } - - /// - /// Effettua update stato await BOM/PRICE per il Template indicato - /// - /// ID singola Riga Template - /// Se non nullo è il nuovo stato await BOM - /// Se non nullo è stato await Price - /// Indica se svuotare la cache - /// - public async Task TemplateRowUpdateAwaitStateAsync(int TemplateRowID, bool? awaitBom, bool? awaitPrice, bool flushCache = false) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // aggiorno - bool fatto = await dbController.TemplateRowUpdateAwaitStateAsync(TemplateRowID, awaitBom, awaitPrice); - if (flushCache) - { - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - } - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - /// - /// Effettua update delle info legate al file per il Template indicato - /// - /// Riga Template coi dati da aggiornare - /// - public async Task TemplateRowUpdateFileDataAsync(TemplateRowModel updRec) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // calcolo - bool fatto = await dbController.TemplateRowUpdateFileDataAsync(updRec); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - /// - /// Effettua update del valore serializzato della Riga Template - /// - /// ID Riga Template da aggiornare - /// Serializzazione oggetto (es JWD) - /// - public async Task TemplateRowUpdateSerStructAsync(int TemplateRowID, string serStruct) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // calcolo - bool fatto = await dbController.TemplateRowUpdateSerStructAsync(TemplateRowID, serStruct); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - /// - /// Effettua Add complessivo record TemplateRow - /// - /// Key - /// - public async Task TemplateRowUpsertAsync(TemplateRowModel updRec) - { - using var activity = StartActivity(); - string source = "DB+REDIS"; - // calcolo - bool fatto = await dbController.TemplateRowUpsertAsync(updRec); - // svuoto cache... - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:Template:*"); - await ExecFlushRedisPatternAsync((RedisValue)$"{redisBaseKey}:TemplateRow:*"); - // aggiunta tags + log - activity?.SetTag("data.source", source); - LogTrace($"{source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); - return fatto; - } - - #endregion Public Methods #region Protected Fields diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index aa93ed13..f244c142 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2603.1609 + 1.1.2603.1611 diff --git a/Lux.API/Program.cs b/Lux.API/Program.cs index d06f67bd..718ba4c9 100644 --- a/Lux.API/Program.cs +++ b/Lux.API/Program.cs @@ -166,11 +166,13 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // Servizi dati con interfaccia builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // Da rivedere!!! #if false diff --git a/Lux.UI/Components/Compo/OfferRowMan.razor.cs b/Lux.UI/Components/Compo/OfferRowMan.razor.cs index f54c71e1..40cc3678 100644 --- a/Lux.UI/Components/Compo/OfferRowMan.razor.cs +++ b/Lux.UI/Components/Compo/OfferRowMan.razor.cs @@ -293,6 +293,9 @@ namespace Lux.UI.Components.Compo [Inject] private ITemplateService TService { get; set; } = default!; + [Inject] + private ITemplateRowService TRService { get; set; } = default!; + [Inject] private FileService FService { get; set; } = default!; @@ -1432,7 +1435,7 @@ namespace Lux.UI.Components.Compo { // leggo cataloghi e template relativi... ListAllCatalog = await TService.GetAllAsync(); - ListTemplateAll = await DLService.TemplateRowGetAllAsync(); + ListTemplateAll = await TRService.GetAllAsync(); // lettura config setup varie da DB/Cache Redis AllConfEnvir = await DLService.ConfEnvirParamGetAllAsync(); diff --git a/Lux.UI/Components/Compo/Templates/TemplateRowList.razor.cs b/Lux.UI/Components/Compo/Templates/TemplateRowList.razor.cs index c4e81237..e22d85ce 100644 --- a/Lux.UI/Components/Compo/Templates/TemplateRowList.razor.cs +++ b/Lux.UI/Components/Compo/Templates/TemplateRowList.razor.cs @@ -291,6 +291,9 @@ namespace Lux.UI.Components.Compo.Templates get => CurrParent.TemplateID; } + [Inject] + private ITemplateRowService TRService { get; set; } = default!; + #endregion Private Properties #region Private Methods @@ -345,12 +348,11 @@ namespace Lux.UI.Components.Compo.Templates // ...se ho editing if (EditRecord != null) { - bool updateBom = false; // SE richiesto salvataggio... if (doSave) { // salvo su DB! - await DLService.TemplateRowUpdateSerStructAsync(EditRecord.TemplateRowID, prevJwd); + await TRService.UpdateSerStructAsync(EditRecord.TemplateRowID, prevJwd); // salvo nel record corrente! EditRecord.SerStruct = prevJwd; } @@ -500,9 +502,9 @@ namespace Lux.UI.Components.Compo.Templates StepPrice = rec2clone.StepPrice, }; // salvo sul DB - await DLService.TemplateRowUpsertAsync(newRec); + await TRService.UpsertAsync(newRec); // chiamo update record che non hanno UID x questo ordine - var list2fix = await DLService.TemplateRowFixUid(TemplateID); + var list2fix = await TRService.FixRowUidAsync(TemplateID); if (list2fix != null && list2fix.Count > 0) { // rileggo i miei record... @@ -538,7 +540,7 @@ namespace Lux.UI.Components.Compo.Templates if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler eliminare il template selezionato?{Environment.NewLine}---------------------------{Environment.NewLine}Env: {curRec.Envir} | {curRec.Name}")) return; - await DLService.TemplateRowDeleteAsync(curRec); + await TRService.DeleteAsync(curRec); // elimino cache img await ICService.DeleteSvgAsync(curRec.TemplateRowUID, curRec.Envir); // rileggo @@ -624,11 +626,11 @@ namespace Lux.UI.Components.Compo.Templates private async Task DoSave(TemplateRowModel updRec) { // salvo record - await DLService.TemplateRowUpsertAsync(updRec); + await TRService.UpsertAsync(updRec); EditRecord = null; SelRecord = null; // faccio fix UID del gruppo... - await DLService.TemplateRowFixUid(TemplateID); + await TRService.FixRowUidAsync(TemplateID); await ReloadData(); UpdateTable(); } @@ -774,27 +776,19 @@ namespace Lux.UI.Components.Compo.Templates var listCalc = SorListCalc(); foreach (var item in listCalc) { - await DLService.TemplateRowUpdateAwaitStateAsync(item.TemplateRowID, true, true); + await TRService.UpdateAwaitStateAsync(item.TemplateRowID, true, true); } await InvokeAsync(StateHasChanged); // verifica preliminare UID - await DLService.TemplateRowFixUid(TemplateID); + await TRService.FixRowUidAsync(TemplateID); - // fixme todo da riverificare con calcolo BOM funzionante -#if false - // rileggo i record... - await ReloadData(); -#endif // ricalcolo di tutte le BOM e relativi prezzi... foreach (var item in listCalc) { // chiedo BOM e immagine await reqBomUpdate(item); } -#if false - await DoRecalcOffer(); -#endif } /// @@ -1087,7 +1081,7 @@ namespace Lux.UI.Components.Compo.Templates // leggo i dati principali if (CurrParent != null) { - AllRecords = await DLService.TemplateRowByParentAsync(CurrParent.TemplateID); + AllRecords = await TRService.GetByParentAsync(CurrParent.TemplateID); } else { @@ -1105,7 +1099,7 @@ namespace Lux.UI.Components.Compo.Templates // salvo richiesta BOM su record currRec.AwaitBom = true; currRec.AwaitPrice = true; - await DLService.TemplateRowUpdateAwaitStateAsync(currRec.TemplateRowID, true, true); + await TRService.UpdateAwaitStateAsync(currRec.TemplateRowID, true, true); // preparo la domanda serializzata Dictionary DictExec = new Dictionary(); @@ -1221,22 +1215,6 @@ namespace Lux.UI.Components.Compo.Templates await reqBomUpdate(currRec); } -#if false - /// - /// Calcolo URL immagine - /// - /// - /// - /// - private string imgUrl(string imgUid, string env) - { - // cast string su env.. - EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW; - Enum.TryParse(env, out envir); - return ICService.ImageUrl($"{apiUrl}/{imgBasePath}", false, imgUid, envir); - } -#endif - /// /// Salvataggio dei dati del file caricato /// @@ -1321,7 +1299,7 @@ namespace Lux.UI.Components.Compo.Templates foreach (var item in AllRecords) { item.AwaitPrice = awaitPrice; - await DLService.TemplateRowUpdateAwaitStateAsync(item.TemplateRowID, null, awaitPrice, flushCache); + await TRService.UpdateAwaitStateAsync(item.TemplateRowID, null, awaitPrice, flushCache); } } @@ -1409,7 +1387,7 @@ namespace Lux.UI.Components.Compo.Templates EditRecord.FileName = file.Name; EditRecord.FileSize = rawContent.LongCount(); // salvo sul DB i dati (nome, nome sicuro, size...) - await DLService.TemplateRowUpdateFileDataAsync(EditRecord); + await TRService.UpdateFileDataAsync(EditRecord); // parametri richiesta fileArgs.Add("Mode", $"{(int)Egw.Window.Data.Enums.QuestionModes.PREVIEW}"); @@ -1424,13 +1402,6 @@ namespace Lux.UI.Components.Compo.Templates calcRequestDTO.EnvType = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM; calcRequestDTO.DictExec = fileArgs; await ICService.CallRestPost($"{apiUrl}/{genericBasePath}", $"{calcTag}/{EditRecord.TemplateRowUID}", calcRequestDTO); - - // ora chiedo anche la BOM! - -#if false - // salvo in locale il file: SISTEMARE PERMESSI - saveFileContent(EditFileRecord.OfferRowUID, trustedFileName, rawContent); -#endif } } } diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 405b1e6d..f45f3917 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.1609 + 1.1.2603.1611 diff --git a/Lux.UI/Program.cs b/Lux.UI/Program.cs index 17ce35e5..6f348444 100644 --- a/Lux.UI/Program.cs +++ b/Lux.UI/Program.cs @@ -204,11 +204,13 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // Servizi dati con interfaccia builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); // Da rivedere!!! #if false diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 92310169..23a1e7a3 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2603.1609

+

Versione: 1.1.2603.1611


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index b398ff8e..02f785c3 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2603.1609 +1.1.2603.1611 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 8766c98f..3dc3b4ab 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2603.1609 + 1.1.2603.1611 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false