Update e re-test creazione ordini
This commit is contained in:
@@ -16,23 +16,6 @@ namespace EgwCoreLib.Lux.Core.RestPayload
|
||||
/// </summary>
|
||||
public string TaskUID { get; set; } = "";
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Batch di produzione di riferimento
|
||||
/// </summary>
|
||||
public int ProductionBatchID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID Ordine di origine
|
||||
/// </summary>
|
||||
public int OrderID { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID univoco riga ordine
|
||||
/// </summary>
|
||||
public int OrderRowID { get; set; } = 0;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Filename (ove presente)
|
||||
/// </summary>
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,6 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production
|
||||
/// </summary>
|
||||
public string BatchTag { get; set; } = "";
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Old UID calcolata
|
||||
/// </summary>
|
||||
public string ProdBatchUID
|
||||
{
|
||||
get => $"B.{ProductionBatchID:X16}";
|
||||
}
|
||||
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Descrizione
|
||||
/// </summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace EgwCoreLib.Lux.Data.DbModel.Production
|
||||
/// Etichetta dell'item, nel formato con contatore annuale
|
||||
/// PI.2025.000000x8
|
||||
/// </summary>
|
||||
public string ProdItemTag { get; set; } = "";
|
||||
public string? ProdItemTag { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo stimato di esecuzione pezzo
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="SqlScripts\Stored\stp_counterGetBlock.sql">
|
||||
<None Update="SqlScripts\Stored\stp_counterGetNext.sql">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="SqlScripts\Stored\stp_counterGetNext.sql">
|
||||
<None Update="SqlScripts\Stored\stp_counterGetNextBlock.sql">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="SqlScripts\Stored\stp_ProdItem_UpdateProdItemTag.sql">
|
||||
|
||||
@@ -19,11 +19,12 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
_redisService = redisService;
|
||||
chPub = _config.GetValue<string>("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;
|
||||
|
||||
/// <summary>
|
||||
/// Coda RUN
|
||||
/// Key della coda redis delle richieste già completate x PROD Engine
|
||||
/// </summary>
|
||||
private RedisKey queueDoneKey;
|
||||
|
||||
/// <summary>
|
||||
/// Coda processi in RUN
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
@@ -318,97 +318,5 @@ namespace Lux.API.Controllers
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#if false
|
||||
[HttpPost("enqueue")]
|
||||
/// <summary>
|
||||
/// Accodamento richiesta di calcolo prod
|
||||
/// </summary>
|
||||
/// <param name="reqType">Tipo richiesta</param>
|
||||
/// <param name="reqUid">UID (riga ordine)</param>
|
||||
/// <param name="currRequest">Contenuto della richiesta come QuestionDTO</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> 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<string, string> calcDict = new Dictionary<string, string>();
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Chiamata GET:
|
||||
/// - elenco delle richieste di stima da eseguire
|
||||
/// - vengono registrate come "passate" al calcolo alla data-ora della richiesta
|
||||
/// GET: api/Prod/estimation
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("estimation")]
|
||||
public async Task<ActionResult<List<EstimReqPayloadDTO>>> EstimationRequestQueue()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
var listReq = new List<EstimReqPayloadDTO>();
|
||||
// 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<ItemTag, OrderRowUid>
|
||||
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);
|
||||
}
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("optmization")]
|
||||
public async Task<ActionResult<List<EstimReqPayloadDTO>>> OptimitionRequestQueue()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
var listReq = new List<EstimReqPayloadDTO>();
|
||||
// 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<ItemTag, OrderRowUid>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>0.9.2601.1618</Version>
|
||||
<Version>0.9.2601.1910</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="col-12 my-1">
|
||||
<ol class="list-group">
|
||||
<li class="list-group-item align-items-lg-start bg-success text-light d-flex justify-content-between">
|
||||
<div class="px-0">Job Eseguiti</div>
|
||||
<div class="px-0">Coda Job @QueueType</div>
|
||||
@if (QueueAll.Count > 0 && EnableReset)
|
||||
{
|
||||
<div class="px-0">
|
||||
|
||||
@@ -81,4 +81,7 @@
|
||||
</nav> *@
|
||||
|
||||
</div>
|
||||
<div class="col-12 mt-2 mb-0">
|
||||
<JobQueue QueueType="Done" QueueAll="QueueDone"></JobQueue>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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;
|
||||
|
||||
@@ -152,7 +152,7 @@ else
|
||||
Code Calcoli
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<JobQueueDisplay QueueRun="@JobQueueRun" QueueWait="@JobQueueWait" EC_ReRunJob="ReRunJob" EC_ResetQueue="ResetQueue"></JobQueueDisplay>
|
||||
<JobQueueDisplay QueueRun="JobQueueRun" QueueWait="JobQueueWait" QueueDone="JobQueueDone" EC_ReRunJob="ReRunJob" EC_ResetQueue="ResetQueue"></JobQueueDisplay>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>0.9.2601.1618</Version>
|
||||
<Version>0.9.2601.1910</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 0.9.2601.1618</h4>
|
||||
<h4>Versione: 0.9.2601.1910</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2601.1618
|
||||
0.9.2601.1910
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2601.1618</version>
|
||||
<version>0.9.2601.1910</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>
|
||||
|
||||
Reference in New Issue
Block a user