diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 606121bd..6ccddc81 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -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 /// /// - public bool TemplateKitUpsert(TemplateKitModel editRec) + /// + 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 diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 9519e703..c5926387 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -2350,11 +2350,12 @@ namespace MP.SPEC.Data /// Esegue salvataggio record + svuotamento cache /// /// - public async Task TemplateKitUpsert(TemplateKitModel currRecord) + /// + public async Task 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); diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 0f4e97ee..85b6abb4 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2504.2810 + 6.16.2505.714 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/KIT.razor b/MP.SPEC/Pages/KIT.razor index 22887a4a..068ddba4 100644 --- a/MP.SPEC/Pages/KIT.razor +++ b/MP.SPEC/Pages/KIT.razor @@ -5,9 +5,18 @@
-
- KIT - Definizione KIT multiprodotto per singolo ciclo | @kitCount Kit disp. +
+
+ KIT +
+
+
+ Definizione KIT multiprodotto per singolo ciclo +
+
+ Azienda: @CodAzienda | @kitCount Kit disp. +
+
@@ -188,4 +197,4 @@ }
-
\ No newline at end of file + diff --git a/MP.SPEC/Pages/KIT.razor.cs b/MP.SPEC/Pages/KIT.razor.cs index 59b4c8e9..bbd982d5 100644 --- a/MP.SPEC/Pages/KIT.razor.cs +++ b/MP.SPEC/Pages/KIT.razor.cs @@ -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("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)) { diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index ff0bc42f..4b65a8d0 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.2810

+

Versione: 6.16.2505.714


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 1d58ac2d..a906f32d 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.2810 +6.16.2505.714 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 97d0d864..ef315968 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.2810 + 6.16.2505.714 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false