+
+ @if (item.Qta <= 0)
+ {
+
+ }
+ else
+ {
+
+ }
+
@item.Qta
×pz
+
+ @if (item.Qta >= item.QtaMax)
+ {
+
+ }
+ else
+ {
+
+ }
+
diff --git a/MP-TAB-SERV/Components/ScrapKitMan.razor.cs b/MP-TAB-SERV/Components/ScrapKitMan.razor.cs
index 3d1f352c..6d554b82 100644
--- a/MP-TAB-SERV/Components/ScrapKitMan.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapKitMan.razor.cs
@@ -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
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 ListComplete { get; set; } = new List();
protected List ListPaged { get; set; } = new List();
@@ -27,6 +34,19 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
+ protected async Task DeleteKitSplit()
+ {
+ if (!await JSRuntime.InvokeAsync("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;
}
}
+ ///
+ /// Modifica qty del record
+ ///
+ ///
+ ///
+ ///
+ protected async Task modQty(RegistroScartiKitModel currItem, int delta)
+ {
+ currItem.Qta += delta;
+ await TabDServ.RegScartiKitUpdateQty(currItem);
+ }
#endregion Protected Methods
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor b/MP-TAB-SERV/Components/ScrapMan.razor
index c9045a34..ba4c722d 100644
--- a/MP-TAB-SERV/Components/ScrapMan.razor
+++ b/MP-TAB-SERV/Components/ScrapMan.razor
@@ -8,7 +8,7 @@
@if (enableScarti)
{
-
+
}
else
@@ -77,21 +77,23 @@
@item.Qta
-
+
@if (item.Tipo == "KIT")
{
×
-
+ }
}
else
@@ -127,7 +129,7 @@
{
|
-
+
|
}
diff --git a/MP-TAB-SERV/Components/ScrapMan.razor.cs b/MP-TAB-SERV/Components/ScrapMan.razor.cs
index 6d23dc6d..6128ee3c 100644
--- a/MP-TAB-SERV/Components/ScrapMan.razor.cs
+++ b/MP-TAB-SERV/Components/ScrapMan.razor.cs
@@ -21,7 +21,7 @@ namespace MP_TAB_SERV.Components
/// Aggiorno valori produzione alla data richiesta...
///
///
- 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()
diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj
index 9e717cc6..752a02b0 100644
--- a/MP-TAB-SERV/MP-TAB-SERV.csproj
+++ b/MP-TAB-SERV/MP-TAB-SERV.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 6.16.2312.1412
+ 6.16.2312.1413
enable
MP_TAB_SERV
diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html
index fe09f92f..a1d18744 100644
--- a/MP-TAB-SERV/Resources/ChangeLog.html
+++ b/MP-TAB-SERV/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
-
Versione: 6.16.2312.1412
+
Versione: 6.16.2312.1413
Note di rilascio:
-
diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt
index 7c19e07a..098ff125 100644
--- a/MP-TAB-SERV/Resources/VersNum.txt
+++ b/MP-TAB-SERV/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2312.1412
+6.16.2312.1413
diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml
index 0f924aed..eaa29062 100644
--- a/MP-TAB-SERV/Resources/manifest.xml
+++ b/MP-TAB-SERV/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2312.1412
+ 6.16.2312.1413
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html
false
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index 2162756a..f04927a0 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -1603,6 +1603,54 @@ namespace MP.Data.Controllers
return fatto;
}
+ ///
+ /// Elimina scarti KIT dato record parent (e lo resetta)
+ ///
+ ///
+ ///
+ 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;
+ }
+ ///
+ /// Aggiorna un record scarti KIT ( SE ESISTE...)
+ ///
+ ///
+ ///
+ 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;
+ }
+
///
/// Elenco scarti KIT dato record parent
///
diff --git a/MP.Data/DatabaseModels/RegistroScartiKitModel.cs b/MP.Data/DatabaseModels/RegistroScartiKitModel.cs
index ed84ff8b..1980ca3a 100644
--- a/MP.Data/DatabaseModels/RegistroScartiKitModel.cs
+++ b/MP.Data/DatabaseModels/RegistroScartiKitModel.cs
@@ -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;
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index 0e93a842..4132f126 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -2122,6 +2122,54 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Aggiunta record RegistroScarti
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
+ ///
+ /// Elimina elenco RSK da parent
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
///
/// Restituisce elenco RSK filtrato x parent
///
@@ -2158,30 +2206,6 @@ namespace MP.Data.Services
return result;
}
- ///
- /// Aggiunta record RegistroScarti
- ///
- ///
- ///
- public async Task 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;
- }
-
///
/// Split record RegistroScarti --> RegistroScartiKit
///
@@ -2206,6 +2230,31 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Update qty record singolo articolo di un KIT Scarti
+ ///
+ ///
+ ///
+ public async Task 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;
+ }
+
///
/// Resetta (rileggendo) i dati della macchina
///