This commit is contained in:
zaccaria.majid
2023-12-14 13:12:46 +01:00
11 changed files with 214 additions and 46 deletions
+27 -2
View File
@@ -6,8 +6,13 @@
<table class="table table-light table-sm table-striped mb-0">
<thead>
<tr class="text-start1">
<th class="fs-5">
Esplosione scarti KIT
<th class="fs-5 d-flex justify-content-between">
<div>
Esplosione scarti KIT
</div>
<div>
<button class="btn btn-danger" @onclick="DeleteKitSplit"><i class="fa-solid fa-trash-can"></i> Remove Split</button>
</div>
</th>
</tr>
</thead>
@@ -36,12 +41,32 @@
</div>
</div>
<div class="col-2 px-0 text-center text-nowrap d-flex justify-content-center">
<div class="px-2">
@if (item.Qta <= 0)
{
<button class="btn btn-secondary">&minus;</button>
}
else
{
<button class="btn btn-warning" @onclick="() => modQty(item, -1)">&minus;</button>
}
</div>
<div>
<b class="fs-2">@item.Qta</b>
</div>
<div class="ps-1 fs-4">
<sub> &times;<span>pz</span></sub>
</div>
<div class="px-2">
@if (item.Qta >= item.QtaMax)
{
<button class="btn btn-secondary">&plus;</button>
}
else
{
<button class="btn btn-success" @onclick="() => modQty(item, 1)">&plus;</button>
}
</div>
</div>
<div class="col-5 text-end small">
<div class="text-truncate">
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
@@ -9,6 +10,9 @@ namespace MP_TAB_SERV.Components
{
#region Public Properties
[Parameter]
public EventCallback<bool> E_Updated { get; set; }
[Parameter]
public RegistroScartiModel ParentKit { get; set; } = null!;
@@ -16,6 +20,9 @@ namespace MP_TAB_SERV.Components
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
@@ -27,6 +34,19 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
protected async Task DeleteKitSplit()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il dettaglio del KIT scartato?"))
return;
if (ParentKit != null)
{
await TabDServ.RegScartiKitDelete(ParentKit);
await ReloadData();
await E_Updated.InvokeAsync(true);
}
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
@@ -44,6 +64,17 @@ namespace MP_TAB_SERV.Components
ListPaged = ListComplete;
}
}
/// <summary>
/// Modifica qty del record
/// </summary>
/// <param name="currItem"></param>
/// <param name="delta"></param>
/// <returns></returns>
protected async Task modQty(RegistroScartiKitModel currItem, int delta)
{
currItem.Qta += delta;
await TabDServ.RegScartiKitUpdateQty(currItem);
}
#endregion Protected Methods
+13 -11
View File
@@ -8,7 +8,7 @@
@if (enableScarti)
{
<div class="mb-2">
<ScrapEditor RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
<ScrapEditor RecMSE="@RecMSE" E_Updated="ReloadData"></ScrapEditor>
</div>
}
else
@@ -77,21 +77,23 @@
<b class="fs-2">@item.Qta</b>
</div>
<div class="ps-1 fs-4">
@if (item.Tipo == "KIT")
{
<div class="d-flex justify-content-center align-items-center flex-wrap h-100">
<sub class="pe-1">&times;</sub>
<button class="btn btn-info" @onclick="()=>ShowKitDetail(item)" title="KIT">
@if (item.KitSplit)
{
@if (item.KitSplit)
{
<button class="btn btn-info" @onclick="()=>ShowKitDetail(item)" title="KIT esploso">
<i class="fa-solid fa-box-open"></i>
}
else
{
</button>
}
else
{
<button class="btn btn-secondary" @onclick="()=>ShowKitDetail(item)" title="KIT non esploso">
<i class="fa-solid fa-box"></i>
}
</button>
</button>
}
</div>
}
else
@@ -127,7 +129,7 @@
{
<tr>
<td class="p-0">
<ScrapKitMan ParentKit="item"></ScrapKitMan>
<ScrapKitMan ParentKit="item" E_Updated="ForceReload"></ScrapKitMan>
</td>
</tr>
}
+17 -5
View File
@@ -21,7 +21,7 @@ namespace MP_TAB_SERV.Components
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
/// <param name="newDate"></param>
public async Task doUpdate()
protected async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
@@ -36,6 +36,15 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
}
protected async Task ForceReload(bool DoClose)
{
if (DoClose)
{
selItem = null;
}
await ReloadData();
}
#endregion Public Methods
#region Protected Properties
@@ -67,7 +76,7 @@ namespace MP_TAB_SERV.Components
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-8);
CurrPeriodo = new Periodo(inizio, fine);
await doUpdate();
await ReloadData();
}
}
@@ -93,7 +102,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(1);
IdxMaccSel = selIdxMacc;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -103,7 +112,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(1);
IdxOdl = selIdxOdl;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -111,11 +120,12 @@ namespace MP_TAB_SERV.Components
protected async Task SetPeriodo(Periodo newPeriodo)
{
CurrPeriodo = newPeriodo;
await doUpdate();
await ReloadData();
}
protected async Task ShowKitDetail(RegistroScartiModel currItem)
{
isProcessing = true;
// deve essere != null in primis...
if (currItem != null)
{
@@ -134,6 +144,8 @@ namespace MP_TAB_SERV.Components
selItem = null;
}
}
await ReloadData();
isProcessing = false;
}
protected void UpdateTable()
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2312.1412</Version>
<Version>6.16.2312.1413</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB_SERV</RootNamespace>
</PropertyGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2312.1412</h4>
<h4>Versione: 6.16.2312.1413</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2312.1412
6.16.2312.1413
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2312.1412</version>
<version>6.16.2312.1413</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+48
View File
@@ -1603,6 +1603,54 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Elimina scarti KIT dato record parent (e lo resetta)
/// </summary>
/// <param name="parentRec"></param>
/// <returns></returns>
public bool RegScartiKitDelete(RegistroScartiModel parentRec)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", parentRec.IdxMacchina);
var DtRif = new SqlParameter("@DataOra", parentRec.DataOra);
var Causale = new SqlParameter("@Causale", parentRec.Causale);
var dbResult = dbCtx
.Database
.ExecuteSqlRaw("EXEC stp_RSK_Delete @IdxMacchina, @DataOra, @Causale", IdxMacc, DtRif, Causale);
answ = dbResult != 0;
}
return answ;
}
/// <summary>
/// Aggiorna un record scarti KIT ( SE ESISTE...)
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public RegistroScartiKitModel RegScartiKitUpdateQty(RegistroScartiKitModel currRec)
{
RegistroScartiKitModel dbResult = new RegistroScartiKitModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbSetRegScartiKit
.Where(x => x.IdxMacchina == currRec.IdxMacchina && x.DataOra == currRec.DataOra && x.Causale == currRec.Causale && x.CodArticolo == currRec.CodArticolo)
.FirstOrDefault();
// aggiorno solo QTY
if (dbResult != null)
{
dbResult.Qta = currRec.Qta;
dbCtx.Entry(dbResult).State = EntityState.Modified;
dbCtx.SaveChanges();
}
}
return dbResult;
}
/// <summary>
/// Elenco scarti KIT dato record parent
/// </summary>
@@ -22,6 +22,7 @@ namespace MP.Data.DatabaseModels
public string Operatore { get; set; } = "";
public int Qta { get; set; } = 0;
public int QtaMax { get; set; } = 0;
public string Note { get; set; } = "";
public int MatrOpr { get; set; } = 0;
public DateTime? DataOraProdRec { get; set; } = null;
+73 -24
View File
@@ -2122,6 +2122,54 @@ namespace MP.Data.Services
return result;
}
/// <summary>
/// Aggiunta record RegistroScarti
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
{
bool answ = false;
try
{
// inserisco evento
answ = await dbTabController.RegScartiInsert(newRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiInsert | macchina: {newRec.IdxMacchina} | DataOra: {newRec.DataOra} | Causale: {newRec.Causale} | MatrOpr: {newRec.MatrOpr} | Qta {newRec.Qta} | Note: {newRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Elimina elenco RSK da parent
/// </summary>
/// <param name="ParentRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitDelete(RegistroScartiModel ParentRec)
{
bool answ = false;
try
{
// inserisco evento
answ = dbTabController.RegScartiKitDelete(ParentRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiKitDelete | macchina: {ParentRec.IdxMacchina} | DataOra: {ParentRec.DataOra} | Causale: {ParentRec.Causale} | MatrOpr: {ParentRec.MatrOpr} | Qta {ParentRec.Qta} | Note: {ParentRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Restituisce elenco RSK filtrato x parent
/// </summary>
@@ -2158,30 +2206,6 @@ namespace MP.Data.Services
return result;
}
/// <summary>
/// Aggiunta record RegistroScarti
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
{
bool answ = false;
try
{
// inserisco evento
answ = await dbTabController.RegScartiInsert(newRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiInsert | macchina: {newRec.IdxMacchina} | DataOra: {newRec.DataOra} | Causale: {newRec.Causale} | MatrOpr: {newRec.MatrOpr} | Qta {newRec.Qta} | Note: {newRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Split record RegistroScarti --&gt; RegistroScartiKit
/// </summary>
@@ -2206,6 +2230,31 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Update qty record singolo articolo di un KIT Scarti
/// </summary>
/// <param name="editRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitUpdateQty(RegistroScartiKitModel editRec)
{
bool answ = false;
try
{
// aggiorno record
var updRec = dbTabController.RegScartiKitUpdateQty(editRec);
answ = updRec.Qta == editRec.Qta;
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiKitUpdateQty | macchina: {editRec.IdxMacchina} | DataOra: {editRec.DataOra} | Causale: {editRec.Causale} | MatrOpr: {editRec.MatrOpr} | Qta {editRec.Qta} | Note: {editRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Resetta (rileggendo) i dati della macchina
/// </summary>