From c02f446b9c88f80b095204979548ff6c13e6dd84 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 3 Nov 2025 18:42:04 +0100 Subject: [PATCH] Update decodifica servizi PNG --- .../EgwCoreLib.Lux.Core.csproj | 4 +- .../EgwCoreLib.Lux.Data.csproj | 2 +- EgwCoreLib.Lux.Data/Services/BaseServ.cs | 1 + .../Services/ImageCacheService.cs | 13 +++++++ Lux.API/Controllers/ImageController.cs | 39 ++++++++++++++++++- Lux.API/Lux.API.csproj | 2 +- Lux.UI.Client/Lux.UI.Client.csproj | 2 +- Lux.UI/Components/Compo/ItemEdit.razor | 2 +- Lux.UI/Components/Compo/OfferRowMan.razor.cs | 7 ++-- Lux.UI/Lux.UI.csproj | 4 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 13 files changed, 66 insertions(+), 16 deletions(-) diff --git a/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj b/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj index 74d46620..4f572545 100644 --- a/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj +++ b/EgwCoreLib.Lux.Core/EgwCoreLib.Lux.Core.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj index aef8dd92..72990480 100644 --- a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj +++ b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj @@ -27,7 +27,7 @@ - + diff --git a/EgwCoreLib.Lux.Data/Services/BaseServ.cs b/EgwCoreLib.Lux.Data/Services/BaseServ.cs index 3fb4e7a3..ee1bc5a1 100644 --- a/EgwCoreLib.Lux.Data/Services/BaseServ.cs +++ b/EgwCoreLib.Lux.Data/Services/BaseServ.cs @@ -88,6 +88,7 @@ namespace EgwCoreLib.Lux.Data.Services }; // Configurazione pipe dei messaggi + PipePng = new MessagePipe(redisConn, pngChannel); PipeSvg = new MessagePipe(redisConn, svgChannel); PipeBom = new MessagePipe(RedisConn, bomChannel); PipeUpdate = new MessagePipe(RedisConn, updateChannel); diff --git a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs index 1f21ecbe..274b47be 100644 --- a/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs +++ b/EgwCoreLib.Lux.Data/Services/ImageCacheService.cs @@ -132,6 +132,19 @@ namespace EgwCoreLib.Lux.Data.Services return fullUrl; } + /// + /// Recupera img redis PNG x id item richiesto + /// + /// UID item + /// Environment item + public string LoadPng(string imgUid, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS envir = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW) + { + // recupero img da cache + string currKey = $"{redisBaseKey}:{envir}:Img:Png:{imgUid.Replace("/", ":")}"; + var rawVal = _redisService.Get(currKey); + return $"{rawVal}"; + } + /// /// Recupera img redis SVG x id item richiesto /// diff --git a/Lux.API/Controllers/ImageController.cs b/Lux.API/Controllers/ImageController.cs index fe195fe8..9501e2d2 100644 --- a/Lux.API/Controllers/ImageController.cs +++ b/Lux.API/Controllers/ImageController.cs @@ -1,6 +1,9 @@ -using Microsoft.AspNetCore.Http; +using EgwCoreLib.Lux.Data.Services; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using NLog; using System.Diagnostics; +using System.Text; namespace Lux.API.Controllers { @@ -8,8 +11,9 @@ namespace Lux.API.Controllers [ApiController] public class ImageController : ControllerBase { - public ImageController(ILogger logger) + public ImageController(ImageCacheService imgServ, ILogger logger) { + _imgService = imgServ; _logger = logger; } /// @@ -31,6 +35,37 @@ namespace Lux.API.Controllers return File(bytes, "image/svg+xml"); } + + /// + /// Chiamata GET: restituisce file PNG (da file o da cache) + /// PUT: api/image/png/00000000-0000-0000-0000-000000000000 + /// + /// id oggetto + /// + [HttpGet("png/{id}")] + public async Task png(string id) + { + Stopwatch sw = new Stopwatch(); + sw.Start(); + string base64Encoded = ""; + byte[] decodedBytes = new byte[0]; + // ...se ricevo percorso --> leggo jwd/svg cablato + if (!string.IsNullOrEmpty(id)) + { + // bonifica nome svg da + base64Encoded = _imgService.LoadPng(id, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.BEAM); + // converto base64 + decodedBytes = Convert.FromBase64String(base64Encoded); + + } + sw.Stop(); + Log.Info($"pngString | {sw.Elapsed.TotalMilliseconds:N3} ms"); + //return Ok(decodedString); + return File(decodedBytes, "image/png"); + } + + private ImageCacheService _imgService { get; set; } private readonly ILogger _logger; + private static Logger Log = LogManager.GetCurrentClassLogger(); } } diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index 51960586..2918b445 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2511.0315 + 0.9.2511.0318 diff --git a/Lux.UI.Client/Lux.UI.Client.csproj b/Lux.UI.Client/Lux.UI.Client.csproj index a81f17d9..ea08062c 100644 --- a/Lux.UI.Client/Lux.UI.Client.csproj +++ b/Lux.UI.Client/Lux.UI.Client.csproj @@ -9,7 +9,7 @@ - + diff --git a/Lux.UI/Components/Compo/ItemEdit.razor b/Lux.UI/Components/Compo/ItemEdit.razor index e0b49963..2add8884 100644 --- a/Lux.UI/Components/Compo/ItemEdit.razor +++ b/Lux.UI/Components/Compo/ItemEdit.razor @@ -49,7 +49,7 @@
- + @* *@
diff --git a/Lux.UI/Components/Compo/OfferRowMan.razor.cs b/Lux.UI/Components/Compo/OfferRowMan.razor.cs index 14a3b21c..72375eeb 100644 --- a/Lux.UI/Components/Compo/OfferRowMan.razor.cs +++ b/Lux.UI/Components/Compo/OfferRowMan.razor.cs @@ -604,7 +604,7 @@ namespace Lux.UI.Components.Compo private Dictionary currGroupShape = new Dictionary(); - private string currOptXml = ""; + private Dictionary currHwOption = new Dictionary(); private int currPage = 1; @@ -792,9 +792,10 @@ namespace Lux.UI.Components.Compo { if (currArgs.msgUid.Equals($"{hwOptChannel}:{EditRecord.OfferRowUID}")) { - currOptXml = currArgs.newMessage; + var rawDict = JsonConvert.DeserializeObject>(currArgs.newMessage) ?? new Dictionary(); + currHwOption = rawDict; // salvo in live data... - CurrData.OptionsXml = currOptXml; + CurrData.DictOptionsXml = currHwOption; } await InvokeAsync(StateHasChanged); } diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 46f751fa..9b58d213 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.2511.0315 + 0.9.2511.0318 @@ -17,7 +17,7 @@ - + diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 1a58a1dd..277c271a 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2511.0315

+

Versione: 0.9.2511.0318


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index bcb2da7f..081d5110 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2511.0315 +0.9.2511.0318 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index b146abcd..803dc1a4 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2511.0315 + 0.9.2511.0318 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false