From f68a3a291cb222129c69800c7aa2b8983cbc17fc Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 19 Jan 2026 10:38:43 +0100 Subject: [PATCH] Update e re-test creazione ordini --- .../RestPayload/EstimReqPayloadDTO.cs | 17 ---- .../Controllers/LuxController.cs | 11 ++- .../Production/ProductionBatchModel.cs | 10 -- .../DbModel/Production/ProductionItemModel.cs | 2 +- .../EgwCoreLib.Lux.Data.csproj | 4 +- EgwCoreLib.Lux.Data/Services/ProdService.cs | 16 +++- Lux.API/Controllers/ProdController.cs | 92 ------------------- Lux.API/Lux.API.csproj | 2 +- .../Components/Compo/WorkLoad/JobQueue.razor | 2 +- .../Compo/WorkLoad/JobQueueDisplay.razor | 3 + Lux.UI/Components/Pages/Offers.razor.cs | 2 +- Lux.UI/Components/Pages/Orders.razor | 2 +- Lux.UI/Lux.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 16 files changed, 34 insertions(+), 137 deletions(-) diff --git a/EgwCoreLib.Lux.Core/RestPayload/EstimReqPayloadDTO.cs b/EgwCoreLib.Lux.Core/RestPayload/EstimReqPayloadDTO.cs index 5454954e..4b06479d 100644 --- a/EgwCoreLib.Lux.Core/RestPayload/EstimReqPayloadDTO.cs +++ b/EgwCoreLib.Lux.Core/RestPayload/EstimReqPayloadDTO.cs @@ -16,23 +16,6 @@ namespace EgwCoreLib.Lux.Core.RestPayload /// public string TaskUID { get; set; } = ""; -#if false - /// - /// Batch di produzione di riferimento - /// - public int ProductionBatchID { get; set; } = 0; - - /// - /// ID Ordine di origine - /// - public int OrderID { get; set; } = 0; - - /// - /// ID univoco riga ordine - /// - public int OrderRowID { get; set; } = 0; -#endif - /// /// Filename (ove presente) /// diff --git a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs index a17b8231..291f63c2 100644 --- a/EgwCoreLib.Lux.Data/Controllers/LuxController.cs +++ b/EgwCoreLib.Lux.Data/Controllers/LuxController.cs @@ -2645,6 +2645,7 @@ namespace EgwCoreLib.Lux.Data.Controllers //using (DataLayerContext dbCtx = new DataLayerContext(_config)) using (DataLayerContext dbCtx = new DataLayerContext()) { + using var transaction = await dbCtx.Database.BeginTransactionAsync(); try { DateTime adesso = DateTime.Now; @@ -2734,7 +2735,6 @@ namespace EgwCoreLib.Lux.Data.Controllers #if false orderId = newRec.OrderID; #endif - using var transaction = await dbCtx.Database.BeginTransactionAsync(); // sistemo UID... foreach (var item in newRec.OrderRowNav) { @@ -2766,7 +2766,8 @@ namespace EgwCoreLib.Lux.Data.Controllers OrderRowNav = item, ItemCode = i, ExtItemCode = $"{item.OrderRowCode}-{i:000}", - ProdBatchID = null + ProdBatchID = null, + ProdItemTag=null //nullo e POI verrà sistemato }) .ToList(); } @@ -2775,9 +2776,11 @@ namespace EgwCoreLib.Lux.Data.Controllers // salvo ulteriori variazioni await dbCtx.SaveChangesAsync(); +#if false //FixMe ToDo: da eliminare, sostituita dalla seguente e nuova // faccio ora una chiamata alla Stored Procedure per "riempire" le label degli ID appena creati - await dbCtx.Database.ExecuteSqlRawAsync("CALL stp_ProdItem_UpdateProdLabel(0);"); + await dbCtx.Database.ExecuteSqlRawAsync("CALL stp_ProdItem_UpdateProdLabel(0);"); +#endif // tutti gli ordini e anno corrente... await dbCtx.Database.ExecuteSqlRawAsync("CALL stp_ProdItem_UpdateProdItemTag(0,0);"); @@ -2788,8 +2791,8 @@ namespace EgwCoreLib.Lux.Data.Controllers catch (Exception exc) { #if false - await transaction.RollbackAsync(); #endif + await transaction.RollbackAsync(); Log.Error($"Eccezione durante OrderFromOffer{Environment.NewLine}{exc}"); } } diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs index 85ceeba3..46733fea 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionBatchModel.cs @@ -31,16 +31,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// public string BatchTag { get; set; } = ""; -#if false - /// - /// Old UID calcolata - /// - public string ProdBatchUID - { - get => $"B.{ProductionBatchID:X16}"; - } - -#endif /// /// Descrizione /// diff --git a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs index a86c93d1..e1eb712a 100644 --- a/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs +++ b/EgwCoreLib.Lux.Data/DbModel/Production/ProductionItemModel.cs @@ -57,7 +57,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production /// Etichetta dell'item, nel formato con contatore annuale /// PI.2025.000000x8 /// - public string ProdItemTag { get; set; } = ""; + public string? ProdItemTag { get; set; } = null; /// /// Tempo stimato di esecuzione pezzo diff --git a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj index 2252b51c..0bccb604 100644 --- a/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj +++ b/EgwCoreLib.Lux.Data/EgwCoreLib.Lux.Data.csproj @@ -61,10 +61,10 @@ - + Always - + Always diff --git a/EgwCoreLib.Lux.Data/Services/ProdService.cs b/EgwCoreLib.Lux.Data/Services/ProdService.cs index 3aafc50c..e44e4809 100644 --- a/EgwCoreLib.Lux.Data/Services/ProdService.cs +++ b/EgwCoreLib.Lux.Data/Services/ProdService.cs @@ -19,11 +19,12 @@ namespace EgwCoreLib.Lux.Data.Services _redisService = redisService; chPub = _config.GetValue("ServerConf:ChannelPub") ?? ""; queueCalcKey = (RedisKey)$"{redisBaseKey}:CalcQueue"; - queueWaitKey = (RedisKey)$"{queueCalcKey}:Wait"; + queueDoneKey = (RedisKey)$"{queueCalcKey}:Done"; queueRunKey = (RedisKey)$"{queueCalcKey}:Run"; + queueWaitKey = (RedisKey)$"{queueCalcKey}:Wait"; + redisOrderDoneKey = $"{redisBaseKey}:OrderDone"; redisOrderReqKey = $"{redisBaseKey}:OrderReq"; redisOrderRunKey = $"{redisBaseKey}:OrderRun"; - redisOrderDoneKey = $"{redisBaseKey}:OrderDone"; Log.Info($"ProdService | Init OK"); } @@ -267,7 +268,12 @@ namespace EgwCoreLib.Lux.Data.Services private RedisKey queueCalcKey; /// - /// Coda RUN + /// Key della coda redis delle richieste già completate x PROD Engine + /// + private RedisKey queueDoneKey; + + /// + /// Coda processi in RUN /// private RedisKey queueRunKey; @@ -301,6 +307,10 @@ namespace EgwCoreLib.Lux.Data.Services rKey = queueRunKey; break; + case QueueType.done: + rKey = queueDoneKey; + break; + default: rKey = queueCalcKey; break; diff --git a/Lux.API/Controllers/ProdController.cs b/Lux.API/Controllers/ProdController.cs index bb07cd02..e4714462 100644 --- a/Lux.API/Controllers/ProdController.cs +++ b/Lux.API/Controllers/ProdController.cs @@ -318,97 +318,5 @@ namespace Lux.API.Controllers #endregion Private Fields -#if false - [HttpPost("enqueue")] - /// - /// Accodamento richiesta di calcolo prod - /// - /// Tipo richiesta - /// UID (riga ordine) - /// Contenuto della richiesta come QuestionDTO - /// - public async Task EnqueueRequest(string reqType, string reqUid, CalcRequestDTO currRequest) - { - bool done = false; - int nId = 1; - // salvo su cache x successivo reinvio da currRequest - QuestionDTO calcRequest = new QuestionDTO(nId, currRequest.EnvType, currRequest.DictExec); - // salvo in cache contenuto della richiesta x UID - string currKey = $"{redisOrderReqKey}:{reqUid.Replace("/", ":")}"; - done = await _redisService.SetAsync(currKey, calcRequest.sProcessArgs); - // accodo la nuova richiesta - //RedisKey queueKey = (RedisKey)$"{redisBaseKey}:OrderQueue:{reqType}"; - _redisService.QueuePush(queueKey, (RedisValue)reqUid); - // dizionario richieste: è il serializzato dell'elenco degli UID da calcolare... - var currList = await _redisService.QueueListAllAsync(queueKey); - Dictionary calcDict = new Dictionary(); - calcDict.Add("ReqLen", $"{calcDict.Count}"); - string listReq = JsonConvert.SerializeObject(currList); - calcDict.Add("ReqList", listReq); - // preparo richiesta di calcolo x UID da inviare - QuestionDTO chRequest = new QuestionDTO(nId, currRequest.EnvType, calcDict); - // invio sul channel redis della richiesta di processing - await _redisService.PublishAsync(chPub, chRequest.sProcessArgs); - // ritorno - return done; - } - - /// - /// Chiamata GET: - /// - elenco delle richieste di stima da eseguire - /// - vengono registrate come "passate" al calcolo alla data-ora della richiesta - /// GET: api/Prod/estimation - /// - /// - [HttpGet("estimation")] - public async Task>> EstimationRequestQueue() - { - Stopwatch sw = new Stopwatch(); - sw.Start(); - var listReq = new List(); - // vado a recuperare da REDIS elenco degli ordini NON ancora associati ad 1/+ prod - - // opzione 1: restituisco TUTTI ordini NON ancora eseguiti - // opzione 2: restituisco dall'inizio solo max(n) non ancora eseguiti? (es primi 5 ordini) - - // genero elenco degli ordini e per ogni ordine aggiungo il Dict - await Task.Delay(100); - - // opzione 1: per tutti gli ordini ritornato registro data-ora invio e tolgo dalla coda... - // opzione 2: aspetto conferma dal sistema che li ha presi in carico e registro data-ora... - - sw.Stop(); - Log.Info($"EstimationRequestQueue | {sw.Elapsed.TotalMilliseconds:N3} ms"); - return Ok(listReq); - } - /// - /// Chiamata GET: - /// - elenco delle richieste di ottimizzazione/nesting da eseguire - /// - vengono registrate come "passate" al calcolo alla data-ora della richiesta - /// GET: api/Prod/estimation - /// - /// - [HttpGet("optmization")] - public async Task>> OptimitionRequestQueue() - { - Stopwatch sw = new Stopwatch(); - sw.Start(); - var listReq = new List(); - // vado a recuperare da REDIS elenco degli ordini NON ancora associati ad 1/+ prod - - // opzione 1: restituisco TUTTI ordini NON ancora eseguiti - // opzione 2: restituisco dall'inizio solo max(n) non ancora eseguiti? (es primi 5 ordini) - - // genero elenco degli ordini e per ogni ordine aggiungo il Dict - await Task.Delay(100); - - // opzione 1: per tutti gli ordini ritornato registro data-ora invio e tolgo dalla coda... - // opzione 2: aspetto conferma dal sistema che li ha presi in carico e registro data-ora... - - sw.Stop(); - Log.Info($"EstimationRequestQueue | {sw.Elapsed.TotalMilliseconds:N3} ms"); - return Ok(listReq); - } -#endif } } \ No newline at end of file diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index dfcf7503..c5751dc7 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 0.9.2601.1618 + 0.9.2601.1910 diff --git a/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor b/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor index fde5df86..e56a4704 100644 --- a/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor +++ b/Lux.UI/Components/Compo/WorkLoad/JobQueue.razor @@ -2,7 +2,7 @@
  1. -
    Job Eseguiti
    +
    Coda Job @QueueType
    @if (QueueAll.Count > 0 && EnableReset) {
    diff --git a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor index ea1e51ec..4c7cfe24 100644 --- a/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor +++ b/Lux.UI/Components/Compo/WorkLoad/JobQueueDisplay.razor @@ -81,4 +81,7 @@ *@
    +
    + +
\ No newline at end of file diff --git a/Lux.UI/Components/Pages/Offers.razor.cs b/Lux.UI/Components/Pages/Offers.razor.cs index 743b853f..f207f994 100644 --- a/Lux.UI/Components/Pages/Offers.razor.cs +++ b/Lux.UI/Components/Pages/Offers.razor.cs @@ -253,7 +253,7 @@ namespace Lux.UI.Components.Pages EnvType = newOrd.Envir }; reqKey = $"{cMode}:{cSubMode}:{rigaOrd.OrderRowUID}"; - await PService.EnqueueRequest("Estimation", reqKey, calcReq); + await PService.EnqueueRequest("Create", reqKey, calcReq); // parto dalla history attuale var currHist = newOrd.LogHistory; diff --git a/Lux.UI/Components/Pages/Orders.razor b/Lux.UI/Components/Pages/Orders.razor index 1b486048..3f946d3e 100644 --- a/Lux.UI/Components/Pages/Orders.razor +++ b/Lux.UI/Components/Pages/Orders.razor @@ -152,7 +152,7 @@ else Code Calcoli
- +
diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 44edb833..e259dda1 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.2601.1618 + 0.9.2601.1910 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 9b826878..99c32b8c 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 0.9.2601.1618

+

Versione: 0.9.2601.1910


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index b45ee0cc..5db554f2 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -0.9.2601.1618 +0.9.2601.1910 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 33990636..45ce4b2f 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 0.9.2601.1618 + 0.9.2601.1910 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false