Continuo dettaglio scarti KIT
This commit is contained in:
@@ -1,12 +1,74 @@
|
||||
<div class="bg-info p-3">
|
||||
|
||||
<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
|
||||
<div class="bg-info p-2">
|
||||
<div class="bg-dark">
|
||||
|
||||
<h3>ScrapKitMan</h3>
|
||||
dettaglio gestione kit
|
||||
<div class="d-flex justify-content-between">
|
||||
<table class="table table-light table-sm table-striped">
|
||||
<thead>
|
||||
<tr class="text-start1">
|
||||
<th class="fs-5">
|
||||
Esplosione scarti KIT
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (TotalCount == 0)
|
||||
{
|
||||
<tr>
|
||||
<td class="p-0">
|
||||
<div class="alert fs-4">No record found</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListPaged)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-5 small">
|
||||
<div>
|
||||
Art: <b>@item.CodArticolo</b>
|
||||
</div>
|
||||
<div class="@($"text-{item.cssClass}")">
|
||||
<i class="@item.icona"></i> @item.Descrizione
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 px-0 text-center text-nowrap d-flex justify-content-center">
|
||||
<div>
|
||||
<b class="fs-2">@item.Qta</b>
|
||||
</div>
|
||||
<div class="ps-1 fs-4">
|
||||
×<span>pz</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5 text-end small">
|
||||
<div class="text-truncate">
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
|
||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<b>@item.Operatore</b>
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small text-secondary">
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<span>Nota: <b>@item.Note</b></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Data.DatabaseModels;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
|
||||
namespace MP_TAB_SERV.Components
|
||||
{
|
||||
public partial class ScrapKitMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public RegistroScartiModel ParentKit { get; set; } = null!;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
|
||||
|
||||
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void UpdateTable()
|
||||
{
|
||||
// esegue paginazione
|
||||
if (TotalCount > NumRecPage)
|
||||
{
|
||||
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
ListPaged = ListComplete;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private bool isProcessing = false;
|
||||
|
||||
private int NumRecPage = 10;
|
||||
|
||||
private int PageNum = 1;
|
||||
|
||||
private int TotalCount = 0;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isProcessing = true;
|
||||
await Task.Delay(1);
|
||||
if (ParentKit != null)
|
||||
{
|
||||
ListComplete = await TabDServ.RegScartiKitGetFilt(ParentKit);
|
||||
TotalCount = ListComplete.Count;
|
||||
// esegue paginazione
|
||||
UpdateTable();
|
||||
}
|
||||
isProcessing = false;
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -49,70 +49,81 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in ListPaged)
|
||||
@if (TotalCount == 0)
|
||||
{
|
||||
<tr class="@selectedCss(item)">
|
||||
<td>
|
||||
<div class="row">
|
||||
<div class="col-5 small">
|
||||
<div>
|
||||
Art: <b>@item.CodArticolo</b>
|
||||
</div>
|
||||
<div class="@($"text-{item.cssClass}")">
|
||||
<i class="@item.icona"></i> @item.Descrizione
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 px-0 text-center text-nowrap d-flex justify-content-center">
|
||||
<div>
|
||||
<b class="fs-2">@item.Qta</b>
|
||||
</div>
|
||||
<div class="ps-1 fs-4">
|
||||
×
|
||||
@if (item.Tipo == "KIT")
|
||||
{
|
||||
<button class="btn btn-info" @onclick="()=>ShowKitDetail(item)" title="KIT">
|
||||
@if (item.KitSplit)
|
||||
{
|
||||
<i class="fa-solid fa-box-open"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-box"></i>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>pz</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5 text-end small">
|
||||
<div class="text-truncate">
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
|
||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<b>@item.Operatore</b>
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small text-secondary">
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<span>Nota: <b>@item.Note</b></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<tr>
|
||||
<td class="p-0">
|
||||
<div class="alert fs-4">No record found</div>
|
||||
</td>
|
||||
</tr>
|
||||
@if(item.Equals(selItem))
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in ListPaged)
|
||||
{
|
||||
<tr>
|
||||
<tr class="@selectedCss(item)">
|
||||
<td>
|
||||
<ScrapKitMan></ScrapKitMan>
|
||||
<div class="row">
|
||||
<div class="col-5 small">
|
||||
<div>
|
||||
Art: <b>@item.CodArticolo</b>
|
||||
</div>
|
||||
<div class="@($"text-{item.cssClass}")">
|
||||
<i class="@item.icona"></i> @item.Descrizione
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 px-0 text-center text-nowrap d-flex justify-content-center">
|
||||
<div>
|
||||
<b class="fs-2">@item.Qta</b>
|
||||
</div>
|
||||
<div class="ps-1 fs-4">
|
||||
×
|
||||
@if (item.Tipo == "ART")
|
||||
{
|
||||
<button class="btn btn-info" @onclick="()=>ShowKitDetail(item)" title="KIT">
|
||||
@if (item.KitSplit)
|
||||
{
|
||||
<i class="fa-solid fa-box-open"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-box"></i>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>pz</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-5 text-end small">
|
||||
<div class="text-truncate">
|
||||
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
|
||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
</div>
|
||||
<div class="text-truncate">
|
||||
<b>@item.Operatore</b>
|
||||
<i class="fa fa-user" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 small text-secondary">
|
||||
@if (!string.IsNullOrEmpty(item.Note))
|
||||
{
|
||||
<span>Nota: <b>@item.Note</b></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@if (item.Equals(selItem))
|
||||
{
|
||||
<tr>
|
||||
<td class="p-0">
|
||||
<ScrapKitMan ParentKit="item"></ScrapKitMan>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -40,25 +40,23 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
|
||||
|
||||
protected bool enableScarti { get; set; } = true;
|
||||
protected List<RegistroScartiModel> ListComplete { get; set; } = new List<RegistroScartiModel>();
|
||||
protected List<RegistroScartiModel> ListPaged { get; set; } = new List<RegistroScartiModel>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
[Inject]
|
||||
protected SharedMemService SMServ { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected TabDataService TabDServ { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool enableScarti { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
@@ -73,22 +71,23 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void SaveNumRec(int newNum)
|
||||
{
|
||||
NumRecPage = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void SavePage(int newNum)
|
||||
{
|
||||
PageNum = newNum;
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
protected string selectedCss(RegistroScartiModel currItem)
|
||||
{
|
||||
return currItem.Equals(selItem) ? "table-info" : "";
|
||||
}
|
||||
|
||||
protected async Task SetMacc(string selIdxMacc)
|
||||
{
|
||||
isProcessing = true;
|
||||
@@ -115,7 +114,18 @@ namespace MP_TAB_SERV.Components
|
||||
await doUpdate();
|
||||
}
|
||||
|
||||
|
||||
protected void ShowKitDetail(RegistroScartiModel currItem)
|
||||
{
|
||||
// faccio toggle show item (se era già selezionato --> null!)
|
||||
if (!currItem.Equals(selItem))
|
||||
{
|
||||
selItem = currItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
selItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateTable()
|
||||
{
|
||||
@@ -132,32 +142,13 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
protected void ShowKitDetail(RegistroScartiModel currItem)
|
||||
{
|
||||
// faccio toggle show item (se era già selezionato --> null!)
|
||||
if (!currItem.Equals(selItem))
|
||||
{
|
||||
selItem = currItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
selItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected string selectedCss(RegistroScartiModel currItem)
|
||||
{
|
||||
return currItem.Equals(selItem) ? "table-info" : "";
|
||||
}
|
||||
|
||||
private RegistroScartiModel? selItem = null;
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private bool isProcessing = false;
|
||||
private int NumRecPage = 10;
|
||||
private int PageNum = 1;
|
||||
private RegistroScartiModel? selItem = null;
|
||||
private int TotalCount = 0;
|
||||
private bool useOdl = false;
|
||||
|
||||
|
||||
@@ -1445,13 +1445,9 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// Restituisce elenco Ultimi RC macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="dataFrom"></param>
|
||||
/// <param name="dataTo"></param>
|
||||
/// <returns></returns>
|
||||
/// Restituisce elenco Ultimi RC macchina </summary> <param name="idxMacchina"></param>
|
||||
/// <param name="idxODL"></param> <param name="dataFrom"></param> <param
|
||||
/// name="dataTo"></param> <returns></returns>
|
||||
public List<RegistroControlliModel> RegControlliLast(string idxMacchina)
|
||||
{
|
||||
List<RegistroControlliModel> dbResult = new List<RegistroControlliModel>();
|
||||
@@ -1607,6 +1603,29 @@ namespace MP.Data.Controllers
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco scarti KIT dato record parent
|
||||
/// </summary>
|
||||
/// <param name="parentRec"></param>
|
||||
/// <returns></returns>
|
||||
public List<RegistroScartiKitModel> RegScartiKitGetFilt(RegistroScartiModel parentRec)
|
||||
{
|
||||
List<RegistroScartiKitModel> dbResult = new List<RegistroScartiKitModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var IdxMacc = new SqlParameter("@IdxMacchina", parentRec.IdxMacchina);
|
||||
var DtRif = new SqlParameter("@DataRif", parentRec.DataOra);
|
||||
var Causale = new SqlParameter("@Causale", parentRec.Causale);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetRegScartiKit
|
||||
.FromSqlRaw("EXEC stp_RSK_getByFilt @IdxMacchina, @DataRif, @Causale", IdxMacc, DtRif, Causale)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScartiKit in tab RSK esplodendo x kit
|
||||
/// </summary>
|
||||
|
||||
@@ -49,5 +49,10 @@ namespace MP.Data.DatabaseModels
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2122,6 +2122,42 @@ namespace MP.Data.Services
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RSK filtrato x parent
|
||||
/// </summary>
|
||||
/// <param name="ParentRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<RegistroScartiKitModel>> RegScartiKitGetFilt(RegistroScartiModel ParentRec)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<RegistroScartiKitModel>? result = new List<RegistroScartiKitModel>();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:RegScartiKit:{ParentRec.IdxMacchina}:{ParentRec.DataOra:yyyyyMMdd-HHmm}:{ParentRec.Causale}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<RegistroScartiKitModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbTabController.RegScartiKitGetFilt(ParentRec);
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<RegistroScartiKitModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"RegScartiKitGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiunta record RegistroScarti
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user