- Aggiunta ricerca dettaglio KIT x ODL/PODL
This commit is contained in:
Samuele Locatelli
2025-05-15 17:13:34 +02:00
parent 5019dfca60
commit 9b65b068fc
11 changed files with 174 additions and 61 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
@if (showKitDetail)
{
<MP_TAB3.Components.ProdKIT.KitDetailModal CodArtParent="@CodArtParent" ListRecords="@ListKitTemplate" EC_Close="() => KitToggleDetail(null)"></MP_TAB3.Components.ProdKIT.KitDetailModal>
<MP_TAB3.Components.ProdKIT.KitDetailModal ListTK="@ListKitTemplate" ListPODL="@ListPOdlKit" EC_Close="() => KitToggleDetail(null, 0)"></MP_TAB3.Components.ProdKIT.KitDetailModal>
}
<div class="col-12 my-1">
<div class="card">
@@ -90,7 +90,7 @@
{
@if (CheckIsKit(CurrOdl.CodArticolo))
{
<button class="mx-1 btn btn-sm btn-outline-dark small" @onclick="() => KitToggleDetail(CurrOdl.CodArticolo)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
<button class="mx-1 btn btn-sm btn-outline-dark small" @onclick="() => KitToggleDetail(CurrOdl.CodArticolo, 0)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
}
@CurrOdl.DescArticolo
}
@@ -98,7 +98,7 @@
{
@if (CheckIsKit(CurrPodl.CodArticolo))
{
<button class="mx-1 btn btn-sm btn-outline-dark small" @onclick="() => KitToggleDetail(CurrPodl.CodArticolo)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
<button class="mx-1 btn btn-sm btn-outline-dark small" @onclick="() => KitToggleDetail(CurrPodl.CodArticolo, CurrPodl.IdxPromessa)" title="Mostra dettaglio"><i class="fa-solid fa-search"></i></button>
}
@CurrPodl.DescArticolo
}
+12 -5
View File
@@ -68,17 +68,24 @@ namespace MP_TAB3.Components
return answ;
}
protected void KitToggleDetail(string? selCodArt)
protected void KitToggleDetail(string? selCodArt, int idxPOdl)
{
CodArtParent = selCodArt ?? "";
if (!string.IsNullOrEmpty(CodArtParent))
if (!string.IsNullOrEmpty(selCodArt))
{
ListKitTemplate = TDService.TemplateKitFilt(CodArtParent, "");
ListKitTemplate = TDService.TemplateKitFilt(selCodArt, "");
}
else
{
ListKitTemplate = null;
}
if (idxPOdl>0)
{
ListPOdlKit = TDService.POdlListByKitParent(idxPOdl);
}
else
{
ListPOdlKit = null;
}
showKitDetail = !showKitDetail;
}
@@ -102,7 +109,6 @@ namespace MP_TAB3.Components
#region Private Fields
private string CodArtParent = "";
/// <summary>
/// Elenco articoli tipo KIT
@@ -110,6 +116,7 @@ namespace MP_TAB3.Components
private List<AnagArticoliModel>? ListArtKit;
private List<TemplateKitModel>? ListKitTemplate = null;
private List<PODLExpModel>? ListPOdlKit;
private bool showKitDetail = false;
+62 -12
View File
@@ -3,18 +3,18 @@
<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>
<h3>Dettaglio KIT</h3>
</div>
<div class="px-0">
<button class="btn btn-outline-dark" @onclick="() => ReqClose()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body px-1">
@if (ListRecords == null)
@if (ListTK == null && ListPODL == null)
{
<LoadingData></LoadingData>
}
else if (totalKitCount == 0)
else if (numIstKit == 0)
{
<div class="alert alert-warning text-center display-4">
Nessun record trovato
@@ -22,7 +22,56 @@
}
else
{
<table class="table table-sm table-striped">
if (ListPODL != null)
{
<div class="text-center">
<h4>PODL KIT &rarr; Ordini</h4>
</div>
<table class="table table-sm table-striped">
<thead>
<tr>
<th><i class="fa-solid fa-key"></i> PODL</th>
<th><i class="fa-solid fa-object-group"></i> Cod Ord</th>
<th><i class="fa-solid fa-sitemap"></i> Cod Art</th>
<th class="text-end"><i class="fa-solid fa-hashtag"></i> Qty</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListPODL)
{
<tr>
<td>
<div>@record.IdxPromessa</div>
</td>
<td>
<div>@record.KeyRichiesta</div>
</td>
<td>
<div>@record.CodArticolo</div>
</td>
<td class="text-end">
<div>@record.NumPezzi</div>
</td>
</tr>
}
</tbody>
</table>
}
}
</div>
<div class="modal-footer d-flex justify-content-between px-0">
@if (numTempKit == 0)
{
<div class="alert alert-warning text-center display-4">
Nessun record trovato
</div>
}
else
{
<div class="text-center">
<b>Template KIT</b>
</div>
<table class="table table-success table-sm opacity-75 table-striped small">
<thead>
<tr>
<th><i class="fa-solid fa-sitemap"></i> Cod Kit (Parent)</th>
@@ -31,7 +80,7 @@
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
@foreach (var record in ListTK)
{
<tr>
<td>
@@ -55,25 +104,26 @@
@code {
[Parameter]
public string CodArtParent { get; set; } = "";
[Parameter]
public EventCallback<bool> EC_Close { get; set; }
[Parameter]
public List<PODLExpModel>? ListPODL { get; set; } = null;
[Parameter]
public List<TemplateKitModel>? ListRecords { get; set; } = null;
public List<TemplateKitModel>? ListTK { get; set; } = null;
protected override void OnParametersSet()
{
// base.OnParametersSet();
totalKitCount = ListRecords != null ? ListRecords.Count() : 0;
numTempKit = ListTK != null ? ListTK.Count() : 0;
numIstKit = ListPODL != null ? ListPODL.Count() : 0;
}
private int totalKitCount = 0;
protected async void ReqClose()
{
await EC_Close.InvokeAsync(true);
}
private int numTempKit = 0;
private int numIstKit = 0;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2505.1312</Version>
<Version>6.16.2505.1517</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB3</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2505.1312</h4>
<h4>Versione: 6.16.2505.1517</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2505.1312
6.16.2505.1517
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2505.1312</version>
<version>6.16.2505.1517</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+21
View File
@@ -823,6 +823,27 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Elenco PODL in un istanza KIT dall'ID del parent
/// </summary>
/// <param name="IdxPodlParent">IDX PODL parent</param>
/// <returns></returns>
public List<PODLExpModel> ListPODL_ByKitParent(int IdxPodlParent)
{
List<PODLExpModel> dbResult = new List<PODLExpModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var pIdxPodlParent = new SqlParameter("@IdxPodlParent", IdxPodlParent);
dbResult = dbCtx
.DbSetPODLExp
.FromSqlRaw("EXEC stp_PODL_getByParentKitIdx @IdxPodlParent", pIdxPodlParent)
.AsNoTracking()
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco PODL macchina
/// </summary>
+36
View File
@@ -2435,6 +2435,42 @@ namespace MP.Data.Services
return result;
}
/// <summary>
/// Elenco PODL in un istanza KIT dall'ID del parent
/// </summary>
/// <param name="IdxPodlParent">IDX PODL parent</param>
/// <returns></returns>
public List<PODLExpModel> POdlListByKitParent(int IdxPodlParent)
{
List<PODLExpModel>? result = new List<PODLExpModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{Utils.redisPOdlList}_kit:ByParent:{IdxPodlParent}";
// cerco in redis dato valore sel idxMaccSel...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = dbTabController.ListPODL_ByKitParent(IdxPodlParent);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, LongCache);
}
if (result == null)
{
result = new List<PODLExpModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"POdlListByKitParent | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Restituisce il contapezzi salvato per la macchina
/// </summary>
@@ -309,7 +309,6 @@ namespace MP.SPEC.Components.ProdKit
ListRecordsPODL = new List<PODLExpModel>();
ListRecordsPODL = PodlRecords
//.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta))
.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta) && x.KeyRichiesta.StartsWith("KIT"))
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
+36 -36
View File
@@ -2063,6 +2063,42 @@ namespace MP.SPEC.Data
return fatto;
}
/// <summary>
/// Elenco PODL in un istanza KIT dall'ID del parent
/// </summary>
/// <param name="IdxPodlParent">IDX PODL parent</param>
/// <returns></returns>
public List<PODLExpModel> POdlListByKitParent(int IdxPodlParent)
{
List<PODLExpModel>? result = new List<PODLExpModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{Utils.redisPOdlList}_kit:ByParent:{IdxPodlParent}";
// cerco in redis dato valore sel idxMaccSel...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = dbController.ListPODL_ByKitParent(IdxPodlParent);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
}
if (result == null)
{
result = new List<PODLExpModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"POdlListByKitParent | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>
@@ -2145,42 +2181,6 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco PODL in un istanza KIT dall'ID del parent
/// </summary>
/// <param name="IdxPodlParent">IDX PODL parent</param>
/// <returns></returns>
public List<PODLExpModel> POdlListByKitParent(int IdxPodlParent)
{
List<PODLExpModel>? result = new List<PODLExpModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{Utils.redisPOdlList}_kit:ByParent:{IdxPodlParent}";
// cerco in redis dato valore sel idxMaccSel...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<PODLExpModel>>($"{rawData}");
readType = "REDIS";
}
else
{
result = dbController.ListPODL_ByKitParent(IdxPodlParent);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
}
if (result == null)
{
result = new List<PODLExpModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"POdlListByKitParent | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco PODL per composizione KIT (Async) non avviati filtrati x articolo, KeyRich (che contiene stato)
/// </summary>