diff --git a/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRepository.cs b/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRepository.cs index 8a7e9bba..ea9d2273 100644 --- a/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRepository.cs +++ b/EgwCoreLib.Lux.Data/Repository/Catalog/TemplateRepository.cs @@ -139,7 +139,9 @@ public async Task GetByIdAsync(int TemplateID) { await using var dbCtx = await CreateContextAsync(); - return await dbCtx.DbSetTemplate.FirstOrDefaultAsync(x => x.TemplateID == TemplateID); + return await dbCtx.DbSetTemplate + .Include(x => x.TemplateRowNav) + .FirstOrDefaultAsync(x => x.TemplateID == TemplateID); } /// diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs index 05332799..44673cc7 100644 --- a/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs +++ b/EgwCoreLib.Lux.Data/Services/Catalog/ITemplateService.cs @@ -24,6 +24,12 @@ /// Task> GetAllAsync(); + /// + /// Recupera un Template per ID + /// + /// ID del record da recuperare + Task GetByIdAsync(int recId); + /// /// Effettua update dei costi di tutte le righe del template indicato /// diff --git a/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs index e6e0d0ba..c525664f 100644 --- a/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs +++ b/EgwCoreLib.Lux.Data/Services/Catalog/TemplateService.cs @@ -76,6 +76,19 @@ }); } + /// + public async Task GetByIdAsync(int recId) + { + // Uso helper TraceAsync che gestisce automaticamente StartActivity, Log e Exception tracking + return await TraceAsync($"{_className}.GetById", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:GetById:{recId}", + async () => await _repo.GetByIdAsync(recId) + ); + }); + } + /// public async Task UpdateCostAsync(int templateId) { diff --git a/Lux.API/Controllers/ReportController.cs b/Lux.API/Controllers/ReportController.cs index 18d69755..25606377 100644 --- a/Lux.API/Controllers/ReportController.cs +++ b/Lux.API/Controllers/ReportController.cs @@ -1,4 +1,5 @@ using EgwCoreLib.Lux.Data.DbModel.Sales; +using EgwCoreLib.Lux.Data.Services.Catalog; using EgwCoreLib.Lux.Data.Services.Sales; namespace Lux.API.Controllers @@ -13,10 +14,14 @@ namespace Lux.API.Controllers /// Costruttore metodo /// /// - public ReportController(IOfferService offService, IOrderService ordService) + public ReportController( + IOfferService offService, + IOrderService ordService, + ITemplateService tplService) { _offService = offService; _ordService = ordService; + _tplService = tplService; // Configurazione serializzatore JSON per risolvere errore di loop circolare JSSettings = new JsonSerializerSettings() { @@ -40,7 +45,7 @@ namespace Lux.API.Controllers Stopwatch sw = new Stopwatch(); sw.Start(); // recupera dal DB l'offerta con le righe relative - OfferModel? offData = await _offService.GetByIdAsync(id); + var offData = await _offService.GetByIdAsync(id); sw.Stop(); Log.Info($"Offert | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms"); @@ -65,6 +70,25 @@ namespace Lux.API.Controllers return Ok(ordData); } + /// + /// Chiamata GET: riceve TemplateID, restituisce Json Template (catalogo) + righe + /// GET: api/report/offert/1 + /// + /// id univoco + /// + [HttpGet("template/{id}")] + public async Task Template(int id) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + // recupera dal DB l'offerta con le righe relative + var ordData = await _tplService.GetByIdAsync(id); + + sw.Stop(); + Log.Info($"Template | {id} | {sw.Elapsed.TotalMilliseconds:N3} ms"); + return Ok(ordData); + } + /// /// Chiamata GET: riceve ELENCO Offerte dato periodo /// GET: api/report/offert-list/?from=2026-01-01&to=2026-04-01 @@ -104,6 +128,7 @@ namespace Lux.API.Controllers private static Logger Log = LogManager.GetCurrentClassLogger(); private IOfferService _offService; private IOrderService _ordService; + private ITemplateService _tplService; private JsonSerializerSettings JSSettings; #endregion Private Fields diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index a19aee72..90c5b0ff 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2604.0215 + 1.1.2604.0912 diff --git a/Lux.Report.Data/Services/FileService.cs b/Lux.Report.Data/Services/FileService.cs index 6aa13bc9..21df2a7c 100644 --- a/Lux.Report.Data/Services/FileService.cs +++ b/Lux.Report.Data/Services/FileService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Lux.Report.Data.Services +namespace Lux.Report.Data.Services { /// /// Gestione IO File-based @@ -87,6 +81,14 @@ namespace Lux.Report.Data.Services return File.Exists(fullPath); } + /// + public bool FolderExists(string folderPath) + { + // calcolo path file... + string fullPath = Path.Combine(basePath, folderPath); + return Directory.Exists(fullPath); + } + /// public List ListFile(string folderPath, string pattern, bool hideDot) { diff --git a/Lux.Report.Data/Services/IFileService.cs b/Lux.Report.Data/Services/IFileService.cs index 4b0ff2ec..caf41a26 100644 --- a/Lux.Report.Data/Services/IFileService.cs +++ b/Lux.Report.Data/Services/IFileService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Lux.Report.Data.Services +namespace Lux.Report.Data.Services { /// /// Interfaccia servizio gestione IO File-based @@ -44,6 +38,13 @@ namespace Lux.Report.Data.Services /// bool FileExists(string filePath); + /// + /// Verifica esistenza Folder richiesto + /// + /// + /// + bool FolderExists(string folderPath); + /// /// Elenco file trovati in folder richiesta dato pattern /// diff --git a/Lux.Report.Data/Reports/OfferReport.Designer.cs b/Lux.Report.Data/Template/OfferReport.Designer.cs similarity index 99% rename from Lux.Report.Data/Reports/OfferReport.Designer.cs rename to Lux.Report.Data/Template/OfferReport.Designer.cs index 720387d5..58c03fd3 100644 --- a/Lux.Report.Data/Reports/OfferReport.Designer.cs +++ b/Lux.Report.Data/Template/OfferReport.Designer.cs @@ -1,4 +1,4 @@ -namespace Lux.Report.Data.Reports +namespace Lux.Report.Data.Template { partial class OfferReport { diff --git a/Lux.Report.Data/Reports/OfferReport.cs b/Lux.Report.Data/Template/OfferReport.cs similarity index 88% rename from Lux.Report.Data/Reports/OfferReport.cs rename to Lux.Report.Data/Template/OfferReport.cs index 309e53da..d882d819 100644 --- a/Lux.Report.Data/Reports/OfferReport.cs +++ b/Lux.Report.Data/Template/OfferReport.cs @@ -1,11 +1,6 @@ using DevExpress.DataAccess.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -namespace Lux.Report.Data.Reports +namespace Lux.Report.Data.Template { public partial class OfferReport : DevExpress.XtraReports.UI.XtraReport { diff --git a/Lux.Report.Data/Reports/OfferReport.resx b/Lux.Report.Data/Template/OfferReport.resx similarity index 100% rename from Lux.Report.Data/Reports/OfferReport.resx rename to Lux.Report.Data/Template/OfferReport.resx diff --git a/Lux.Report.Manager/Components/Compo/ReportDesigner.razor.cs b/Lux.Report.Manager/Components/Compo/ReportDesigner.razor.cs index dc967a6d..447108a9 100644 --- a/Lux.Report.Manager/Components/Compo/ReportDesigner.razor.cs +++ b/Lux.Report.Manager/Components/Compo/ReportDesigner.razor.cs @@ -1,76 +1,15 @@ -using DevExpress.Blazor.Reporting; -using DevExpress.DataAccess; -using DevExpress.DataAccess.Json; -using DevExpress.Drawing.Internal.Fonts.Interop; -using DevExpress.Security; -using DevExpress.XtraReports; -using DevExpress.XtraReports.UI; -using Lux.Report.Data.Reports; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.WebUtilities; namespace Lux.Report.Manager.Components.Compo { public partial class ReportDesigner { - #region Protected Methods + #region Public Properties [Parameter] public string ReportPathName { get; set; } = ""; + #endregion Public Properties - private string reportName = ""; - - private string pdfUrl - { - get => $"download-offer?id={oID}"; - } - private int oID = 0; - protected string FileName(string fullName) - { - return Path.GetFileName(fullName); - } - protected override void OnInitialized() - { - // fix nome report - reportName = FileName(ReportPathName); -#if false - // calcolo i parametri x IMG e Json da conf - string apiUrl = _config.GetValue("ServerConf:ApiBaseUrl") ?? "https://iis01.egalware.com/lux/srv/api"; - string imgUrl = _config.GetValue("ServerConf:ImageUrl") ?? "image"; - string dataUrl = _config.GetValue("ServerConf:DataUrl") ?? "report/offert/"; - - string imgFullUrl = $"{apiUrl}/{imgUrl}/"; - string dataFullUrl = $"{apiUrl}/{dataUrl}"; - - //cerco id da URL x offerta da mostrare - var uri = NavManager.ToAbsoluteUri(NavManager.Uri); - if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("OfferId", out var offerId)) - { - int.TryParse(offerId, out oID); - currReport = new OfferReport(dataFullUrl, oID); - currReport.Parameters["pImgPath"].Value = imgFullUrl; - } -#endif - } - - #endregion Protected Methods - - #region Private Fields - - private OfferReport currReport = new(); - private DxReportViewer? reportViewer; - - #endregion Private Fields - - #region Private Properties - - [Inject] - private IConfiguration _config { get; set; } = null!; - - [Inject] - private NavigationManager NavManager { get; set; } = null!; - - #endregion Private Properties } } \ No newline at end of file diff --git a/Lux.Report.Manager/Lux.Report.Manager.csproj b/Lux.Report.Manager/Lux.Report.Manager.csproj index 61f28d3f..bab62fb2 100644 --- a/Lux.Report.Manager/Lux.Report.Manager.csproj +++ b/Lux.Report.Manager/Lux.Report.Manager.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2604.0911 + 1.1.2604.0912 diff --git a/Lux.Report.Server/Components/Pages/Reports.razor.cs b/Lux.Report.Server/Components/Pages/Reports.razor.cs index d2ed2cff..14a8f5c9 100644 --- a/Lux.Report.Server/Components/Pages/Reports.razor.cs +++ b/Lux.Report.Server/Components/Pages/Reports.razor.cs @@ -125,6 +125,12 @@ namespace Lux.Report.Server.Components.Pages var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query); RepType = query.TryGetValue("repType", out var rep) ? rep.ToString() : ""; + // verifico esistenza folder... + string dirPath = Path.Combine("reports", RepType); + if (!FService.FolderExists(dirPath) || string.IsNullOrEmpty(RepType)) + { + repType = "Offerta"; + } SelFile = query.TryGetValue("selFile", out var sel) ? sel.ToString() : ""; ReqID = query.TryGetValue("reqId", out var rID) ? rID.ToString() : "0"; forceRepType = !string.IsNullOrEmpty(RepType); diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index f902e27e..0bd86a2d 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.2604.0215 + 1.1.2604.0912 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index ee5ef654..1bc5c748 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2604.0911

+

Versione: 1.1.2604.0912


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index 8c0957be..401af6a7 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2604.0911 +1.1.2604.0912 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index dec177d4..7a49cf58 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2604.0911 + 1.1.2604.0912 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false