- aggiunta dettaglio composizione KIT
This commit is contained in:
Samuele Locatelli
2025-05-10 17:11:47 +02:00
parent 5edbe0e41b
commit 45aac2c576
11 changed files with 114 additions and 98 deletions
+23 -1
View File
@@ -360,6 +360,28 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Restitusice elenco articoli dato tipo (es KIT)
/// </summary>
/// <param name="tipo"></param>
/// <param name="azienda"></param>
/// </summary>
/// <returns></returns>
public List<AnagArticoliModel> ArticoliGetByTipo(string tipo, string azienda = "*")
{
List<AnagArticoliModel> dbResult = new List<AnagArticoliModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetArticoli
.AsNoTracking()
.Where(x => x.Tipo.ToUpper() == tipo.ToUpper() && (azienda == "*" || x.Azienda.ToUpper() == azienda.ToUpper()))
.OrderBy(x => x.CodArticolo)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco tabella Articoli da filtro
/// </summary>
@@ -397,7 +419,7 @@ namespace MP.Data.Controllers
dbResult = dbCtx
.DbSetArticoli
.AsNoTracking()
.Where(x => (azienda == "*" || x.Azienda.ToLower().Equals(azienda.ToLower())) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal)))
.Where(x => (azienda == "*" || x.Azienda.ToUpper() == azienda.ToUpper()) && (string.IsNullOrEmpty(searchVal) || x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal)))
.OrderBy(x => x.CodArticolo)
.Take(numRecord)
.ToList();
+3 -3
View File
@@ -1,4 +1,5 @@
@using MP.SPEC.Components
@using MP.SPEC.Components.ProdKit
@using MP.SPEC.Data
@if (ListRecords == null || isLoading)
@@ -15,8 +16,7 @@ else
<div class="@mainCss">
@if (showKitDetail)
{
@* <KitDetailModal CodArtParent="@CodArtParent" ListRecords="@ListKitTemplate" EC_Close="() => KitToggleDetail(null)"></KitDetailModal> *@
<b>dettaglio kit!</b>
<KitDetailModal CodArtParent="@CodArtParent" ListRecords="@ListKitTemplate" EC_Close="() => KitToggleDetail(null)"></KitDetailModal>
}
<table class="table table-sm table-striped">
<thead>
@@ -118,7 +118,7 @@ else
@record.CodArticolo
@if (CheckIsKit(record.CodArticolo))
{
<button class="btn btn-sm btn-info" @onclick="() => KitToggleDetail(record.CodArticolo)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
<button class="ms-2 btn btn-sm btn-info small" @onclick="() => KitToggleDetail(record.CodArticolo)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
}
</div>
<div class="small textConsensed text-secondary">@record.DescArticolo</div>
+41 -32
View File
@@ -95,6 +95,21 @@ namespace MP.SPEC.Components
#region Protected Methods
/// <summary>
/// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio
/// </summary>
/// <param name="CodArticolo"></param>
/// <returns></returns>
protected bool CheckIsKit(string CodArticolo)
{
bool answ = false;
if (ListArtKit != null && ListArtKit.Count > 0)
{
answ = ListArtKit.Count(x => x.CodArticolo == CodArticolo) > 0;
}
return answ;
}
protected async Task cloneRecord(PODLExpModel selRec)
{
currRecord = null;
@@ -105,24 +120,6 @@ namespace MP.SPEC.Components
header = "Duplica PODL";
}
private bool showKitDetail = false;
private string CodArtParent = "";
protected void KitToggleDetail(string? selCodArt)
{
CodArtParent = selCodArt??"";
if (!string.IsNullOrEmpty(CodArtParent))
{
ListKitTemplate = MDService.TemplateKitFilt(CodArtParent, "");
}
else
{
ListKitTemplate = null;
}
showKitDetail = !showKitDetail;
}
private List<TemplateKitModel>? ListKitTemplate = null;
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
@@ -140,18 +137,6 @@ namespace MP.SPEC.Components
await Task.Delay(1);
}
/// <summary>
/// Verifica se sia un articolo di tipo "KIT" x mostrare show dettaglio
/// </summary>
/// <param name="CodArticolo"></param>
/// <returns></returns>
protected bool CheckIsKit(string CodArticolo)
{
bool answ = false;
return answ;
}
protected void doShowRecipeArch(PODLExpModel selRec)
{
currRecord = selRec;
@@ -175,9 +160,24 @@ namespace MP.SPEC.Components
await RecordEdit.InvokeAsync(selRec);
}
protected void KitToggleDetail(string? selCodArt)
{
CodArtParent = selCodArt ?? "";
if (!string.IsNullOrEmpty(CodArtParent))
{
ListKitTemplate = MDService.TemplateKitFilt(CodArtParent, "");
}
else
{
ListKitTemplate = null;
}
showKitDetail = !showKitDetail;
}
protected override async Task OnInitializedAsync()
{
ListStati = await MDService.AnagStatiComm();
ListArtKit = MDService.ArticoliGetByTipo("KIT", "*");
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
if (!string.IsNullOrEmpty(strMachRecipe))
{
@@ -329,7 +329,7 @@ namespace MP.SPEC.Components
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private string CodArtParent = "";
private string currRecipeArchPath = "";
/// <summary>
@@ -339,8 +339,17 @@ namespace MP.SPEC.Components
private PODLExpModel? currRecord = null;
/// <summary>
/// Elenco articoli tipo KIT
/// </summary>
private List<AnagArticoliModel>? ListArtKit;
private List<TemplateKitModel>? ListKitTemplate = null;
private List<PODLExpModel>? ListRecords;
/// <summary>
/// Elenco stati
/// </summary>
private List<ListValuesModel>? ListStati;
private bool MachineWithRecipe = false;
@@ -356,7 +365,7 @@ namespace MP.SPEC.Components
private List<string> odlCurrList = new List<string>();
private List<PODLExpModel>? SearchRecords;
private bool showKitDetail = false;
private bool showRecipeArch = false;
private bool showRecipeConf = false;
@@ -1,5 +1,5 @@
<dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
<div class="modal-dialog shadow">
<div class="modal-dialog shadow shadow-lg">
<div class="modal-content p-2">
<div class="modal-title d-flex justify-content-between">
<div class="px-0">
@@ -9,7 +9,7 @@
<button class="btn btn-outline-dark" @onclick="() => ReqClose()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body">
<div class="modal-body px-1">
@if (ListRecords == null)
{
<LoadingData></LoadingData>
@@ -94,7 +94,9 @@ namespace MP.SPEC.Components.ProdKit
protected override async Task OnInitializedAsync()
{
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
#if false
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
#endif
DateTime oggi = DateTime.Today;
ActFilter = new SelectXdlParams()
{
@@ -16,60 +16,6 @@
{
@if (doShowDetail)
{
@* <dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
<div class="modal-dialog">
<div class="modal-content p-2">
<div class="modal-title d-flex justify-content-between">
<div class="px-0">
<h4>Dettaglio KIT <b>@CodArtParent</b></h4>
</div>
<div class="px-0">
<button class="btn btn-outline-dark" @onclick="() => KitToggleDetail(null)"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body">
@if (ListKitTemplate == null)
{
<LoadingData></LoadingData>
}
else if (totalKitCount == 0)
{
<div class="alert alert-warning text-center display-4">
Nessun record trovato
</div>
}
else
{
<table class="table table-sm table-striped">
<thead>
<tr>
<th><i class="fa-solid fa-sitemap"></i> Cod Kit (Parent)</th>
<th><i class="fa-solid fa-file"></i> Articolo (Child)</th>
<th class="text-end"><i class="fa-solid fa-hashtag"></i> Art/Kit Qty</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListKitTemplate)
{
<tr>
<td>
@record.CodArtParent
</td>
<td>
@record.CodArtChild
</td>
<td class="text-end">
<div>@record.Qty</div>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
</div>
</dialog> *@
<KitDetailModal CodArtParent="@CodArtParent" ListRecords="@ListKitTemplate" EC_Close="() => KitToggleDetail(null)"></KitDetailModal>
}
<table class="table table-sm table-striped">
+38 -1
View File
@@ -336,6 +336,44 @@ namespace MP.SPEC.Data
return fatto;
}
/// <summary>
/// Restitusice elenco articoli dato tipo (es KIT)
/// </summary>
/// <param name="tipo"></param>
/// <param name="azienda"></param>
/// <returns></returns>
public List<AnagArticoliModel> ArticoliGetByTipo(string tipo, string azienda = "*")
{
List<AnagArticoliModel>? result = new List<AnagArticoliModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string sKey = string.IsNullOrEmpty(tipo) ? "ALL" : tipo;
string currKey = $"{Utils.redisArtList}:{azienda}:Tipo:{sKey}";
// cerco in redis dato valore sel idxMaccSel...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<AnagArticoliModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = dbController.ArticoliGetByTipo(tipo);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<AnagArticoliModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ArticoliGetByTipo | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Restitusice elenco articoli cercati
/// </summary>
@@ -2107,7 +2145,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco PODL per composizione KIT (Async) non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2505.918</Version>
<Version>6.16.2505.1017</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2505.918</h4>
<h4>Versione: 6.16.2505.1017</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2505.918
6.16.2505.1017
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2505.918</version>
<version>6.16.2505.1017</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>