Fix generazione ART x nuovi KIT

This commit is contained in:
Samuele Locatelli
2025-05-07 15:02:47 +02:00
parent b657e01129
commit 5cc3ca11e6
8 changed files with 56 additions and 16 deletions
+28 -5
View File
@@ -493,9 +493,9 @@ namespace MP.Data.Controllers
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetConfig
.Where(x => x.Chiave == updRec.Chiave)
.FirstOrDefault();
.DbSetConfig
.Where(x => x.Chiave == updRec.Chiave)
.FirstOrDefault();
if (dbResult != null)
{
dbResult.Valore = updRec.Valore;
@@ -2131,17 +2131,40 @@ namespace MP.Data.Controllers
/// Esegue upsert record
/// </summary>
/// <param name="editRec"></param>
public bool TemplateKitUpsert(TemplateKitModel editRec)
/// <param name="codAzienda"></param>
public bool TemplateKitUpsert(TemplateKitModel editRec, string codAzienda)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
// verifico preliminarmente articolo...
var recArt = dbCtx
.DbSetArticoli
.FirstOrDefault(x => x.CodArticolo == editRec.CodArtParent);
// se mancasse...
if (recArt == null)
{
// aggiungo!
AnagArticoliModel newRecArt = new AnagArticoliModel()
{
CodArticolo = editRec.CodArtParent,
Tipo = "KIT",
DescArticolo = $"Articolo KIT - {DateTime.Now:yyyy-MM-dd HH:mm:ss}",
Disegno = "",
Azienda = codAzienda
};
dbCtx
.DbSetArticoli
.Add(newRecArt);
}
// proseguo col KIT
var actRec = dbCtx
.DbSetTempKit
.Where(x => x.CodArtParent == editRec.CodArtParent && x.CodArtChild == editRec.CodArtChild)
.FirstOrDefault();
// se ci fosse aggiorno...
// se NON ci fosse aggiungo...
if (actRec == null)
{
dbCtx
+3 -2
View File
@@ -2350,11 +2350,12 @@ namespace MP.SPEC.Data
/// Esegue salvataggio record + svuotamento cache
/// </summary>
/// <param name="currRecord"></param>
public async Task<bool> TemplateKitUpsert(TemplateKitModel currRecord)
/// <param name="codAzienda"></param>
public async Task<bool> TemplateKitUpsert(TemplateKitModel currRecord, string codAzienda)
{
bool fatto = false;
// salvo
fatto = dbController.TemplateKitUpsert(currRecord);
fatto = dbController.TemplateKitUpsert(currRecord, codAzienda);
// svuoto cache
RedisValue pattern = $"{Utils.redisKitTempl}:*";
await ExecFlushRedisPatternAsync(pattern);
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2504.2810</Version>
<Version>6.16.2505.714</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+13 -4
View File
@@ -5,9 +5,18 @@
<div class="d-flex justify-content-between">
<div class="px-0">
<div class="d-flex justify-content-between">
<div class="px-2">
<span class="fs-3 mb-0">KIT</span>
<small class="small">Definizione KIT multiprodotto per singolo ciclo | <b>@kitCount</b> Kit disp.</small>
<div class="d-flex">
<div class="px-2">
<span class="fs-3 mb-0 fw-bold">KIT</span>
</div>
<div class="px-2">
<div class="small">
Definizione KIT multiprodotto per singolo ciclo
</div>
<div class="small">
Azienda: <b>@CodAzienda</b> | <b>@kitCount</b> Kit disp.
</div>
</div>
</div>
</div>
</div>
@@ -188,4 +197,4 @@
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="SetNumRec" numPageChanged="SetNumPage" totalCount="totalCount" showLoading="isLoading" />
}
</div>
</div>
</div>
+8 -1
View File
@@ -174,13 +174,15 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
}
protected string CodAzienda = "***";
protected async Task DoUpdate(TemplateKitModel selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler salvare le modifiche?"))
return;
await Task.Delay(1);
var done = await MDService.TemplateKitUpsert(selRec);
var done = await MDService.TemplateKitUpsert(selRec, CodAzienda);
EditRecord = null;
ReloadData();
await Task.Delay(1);
@@ -194,6 +196,11 @@ namespace MP.SPEC.Pages
{
int.TryParse(rawVal, out minChar);
}
rawVal = MDService.ConfigTryGet("AZIENDA");
if (!string.IsNullOrEmpty(rawVal))
{
CodAzienda = rawVal;
}
rawVal = MDService.ConfigTryGet("SPEC_Kit_enabCount");
if (!string.IsNullOrEmpty(rawVal))
{
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2504.2810</h4>
<h4>Versione: 6.16.2505.714</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2504.2810
6.16.2505.714
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2504.2810</version>
<version>6.16.2505.714</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>