Update metodi x nuove chaimate test non ancora completate

This commit is contained in:
Samuele Locatelli
2025-09-12 15:01:54 +02:00
parent 0a9a31d293
commit 4a9655d8f1
10 changed files with 88 additions and 16 deletions
+13 -4
View File
@@ -7,7 +7,7 @@
/// <summary>
/// Offerta aperta (da confermare)
/// </summary>
Open,
Open,
/// <summary>
/// Offerta convertita in ordine
/// </summary>
@@ -32,9 +32,9 @@
/// <summary>
/// Tipologia item
/// </summary>
public enum ItemClassType
{
ND=0,
public enum ItemClassType
{
ND = 0,
/// <summary>
/// Item acquistato
/// </summary>
@@ -56,5 +56,14 @@
/// </summary>
BomAlt
}
public enum EngineQueryType
{
None = 0,
Preview,
Bom,
HardwareModelList
}
}
}
@@ -1,4 +1,5 @@
using EgwCoreLib.Lux.Core.RestPayload;
using EgwMultiEngineManager.Data;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using NLog;
@@ -182,6 +183,22 @@ namespace EgwCoreLib.Lux.Data.Services
return done;
}
/// <summary>
/// Salva e invia su channel img redis SVG per il doc richiesto
/// </summary>
/// <param name="uid"></param>
/// <param name="rawData"></param>
public async Task<bool> SaveHmlAsync(string uid, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env, string rawData)
{
// salvo img in cache
string currKey = $"{redisBaseKey}:{env}:HML:{uid.Replace("/", ":")}";
var done = await _redisService.SetAsync(currKey, rawData);
// invio notifica nuova svg generata sul canale... viene inviato solo svg con ID nel canale
string notifyChannel = $"{hmlChannel}:{uid}";
long numSent = await _redisService.PublishAsync(notifyChannel, rawData);
return done;
}
/// <summary>
/// Salva e invia su channel img redis SVG per il doc richiesto
/// </summary>
@@ -229,6 +246,7 @@ namespace EgwCoreLib.Lux.Data.Services
private readonly string bomChannel = "bom:item";
private readonly string cacheTag = "svgfile";
private readonly string calcTag = "svgpreview";
private readonly string hmlChannel = "hml:item";
private readonly string imgBasePath = "";
private readonly string liveTag = "svg";
+42 -5
View File
@@ -1,4 +1,5 @@
using EgwCoreLib.Lux.Data.Services;
using EgwCoreLib.Lux.Core;
using EgwCoreLib.Lux.Data.Services;
using EgwMultiEngineManager.Data;
using Microsoft.AspNetCore.Mvc;
using NLog;
@@ -63,7 +64,7 @@ namespace Lux.API.Controllers
DictExec.Add("Jwd", currJwd);
int nId = 1;
// da modificare con tipo richiesta...
QuestionDTO currArgs = new QuestionDTO(nId, Constants.EXECENVIRONMENTS.WINDOW, DictExec);
QuestionDTO currArgs = new QuestionDTO(nId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, DictExec);
await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs);
svgContent = "DONE";
@@ -73,6 +74,42 @@ namespace Lux.API.Controllers
return Ok(svgContent);
}
/// <summary>
/// Chiamata POST: riceve Json in formato serializzato, invia richiesta calcolo modo 3 (HardwareModelList)
/// PUT: api/window/bom/00000000-0000-0000-0000-000000000000
/// </summary>
/// <param name="id">id oggetto</param>
/// <returns></returns>
[HttpPost("hwlist/{id}")]
public async Task<ActionResult<string>> getHardwareList(string id, [FromBody] string currJwd)
{
Stopwatch sw = new Stopwatch();
sw.Start();
string hwContent = "";
// se messaggio vuoto --> uso default!
currJwd = string.IsNullOrEmpty(currJwd) ? demoJwd : currJwd;
// ...se ricevo percorso --> leggo json raw
if (!string.IsNullOrEmpty(currJwd))
{
Dictionary<string, string> DictExec = new Dictionary<string, string>();
DictExec.Add("Mode", $"{(int)Enums.EngineQueryType.HardwareModelList}");
// UID cablato x ora...
DictExec.Add("UID", id);
DictExec.Add("Jwd", currJwd);
int nId = 1;
// da modificare con tipo richiesta...
QuestionDTO currArgs = new QuestionDTO(nId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, DictExec);
await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs);
hwContent = "DONE";
}
sw.Stop();
Log.Info($"getBom | {sw.Elapsed.TotalMilliseconds:N3} ms");
return Ok(hwContent);
}
/// <summary>
/// Chiamata GET: restituisce file SVG (da file o da cache)
/// PUT: api/window/svg/00000000-0000-0000-0000-000000000000
@@ -104,7 +141,7 @@ namespace Lux.API.Controllers
/// <returns></returns>
[HttpGet("svgfile/{id}")]
[HttpGet("svg-file/{id}")]
public async Task<ActionResult<string>> svgFile(string id, Constants.EXECENVIRONMENTS env = Constants.EXECENVIRONMENTS.WINDOW)
public async Task<ActionResult<string>> svgFile(string id, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS env = EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW)
{
Stopwatch sw = new Stopwatch();
sw.Start();
@@ -120,7 +157,7 @@ namespace Lux.API.Controllers
string svgContent = await _imgService.LoadSvgAsync(id, env);
// se vuoto --> leggo img logo...
if(string.IsNullOrEmpty(svgContent))
if (string.IsNullOrEmpty(svgContent))
{
string filePath = Path.Combine("DemoImg", "LogoEgalware.svg");
svgContent = await System.IO.File.ReadAllTextAsync(filePath);
@@ -166,7 +203,7 @@ namespace Lux.API.Controllers
DictExec.Add("Jwd", currJwd);
int nId = 1;
// da modificare con tipo richiesta...
QuestionDTO currArgs = new QuestionDTO(nId, Constants.EXECENVIRONMENTS.WINDOW, DictExec);
QuestionDTO currArgs = new QuestionDTO(nId, EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS.WINDOW, DictExec);
await _redisService.PublishAsync(pubChannel, currArgs.sProcessArgs);
svgContent = "DONE";
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.9.2509.0416</Version>
<Version>0.9.2509.0516</Version>
</PropertyGroup>
<ItemGroup>
+9 -1
View File
@@ -51,7 +51,7 @@ namespace Lux.API.Services
string UID = retData.Args["UID"];
await cacheService.SaveSvgAsync(UID, retData.ExecEnvironment, newSvg);
}
if(retData.Args.ContainsKey("BOM"))
if (retData.Args.ContainsKey("BOM"))
{
// salvo BOM ricevuta
string newBom = retData.Args["BOM"];
@@ -59,6 +59,14 @@ namespace Lux.API.Services
await cacheService.SaveBomAsync(UID, retData.ExecEnvironment, newBom);
await dbService.SaveBomAsync(UID, retData.ExecEnvironment, newBom);
}
if (retData.Args.ContainsKey("HardwareModelList"))
{
// salvo HardwareList ricevuta
string newHml = retData.Args["HardwareModelList"];
string UID = retData.Args["UID"];
await cacheService.SaveHmlAsync(UID, retData.ExecEnvironment, newHml);
await dbService.SaveHamlAsync(UID, retData.ExecEnvironment, newHml);
}
}
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
<Version>0.9.2509.0416</Version>
<Version>0.9.2509.1215</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>LUX - Web Windows MES</i>
<h4>Versione: 0.9.2509.0416</h4>
<h4>Versione: 0.9.2509.1215</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2509.0416
0.9.2509.1215
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2509.0416</version>
<version>0.9.2509.1215</version>
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>
File diff suppressed because one or more lines are too long