Ok gestione eliminazione KIT

This commit is contained in:
Samuele Locatelli
2026-05-30 09:58:24 +02:00
parent 26e8ca0370
commit 79024ddcac
9 changed files with 142 additions and 125 deletions
@@ -101,8 +101,7 @@ namespace MP.SPEC.Components.ProdKit
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione PODL + Istanze KIT: sei sicuro di voler procedere?"))
return;
// da provare...
var done = MDService.PodlIstKitDelete(selRec.IdxPromessa);
var done = await MDService.PodlIstKitDeleteAsync(selRec.IdxPromessa);
ReloadData();
await EC_ListUpdated.InvokeAsync(true);
}
@@ -301,7 +300,7 @@ namespace MP.SPEC.Components.ProdKit
{
isLoading = true;
// reset preliminare...
ListRecordsPODL = new List<PODLExpModel>();
ListRecordsPODL?.Clear();
var filtRecordsPODL = PodlRecords
.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta) && x.KeyRichiesta.StartsWith("KIT"))
+22 -20
View File
@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data;
using MP.Data.DbModels;
using MP.SPEC.Data;
using MP.SPEC.Services;
@@ -12,6 +11,9 @@ namespace MP.SPEC.Components.ProdKit
{
#region Public Properties
[Parameter]
public SelectXdlParams ActFilter { get; set; } = new SelectXdlParams();
[Parameter]
public EventCallback<PODLExpModel> EC_RecordSel { get; set; }
@@ -22,10 +24,11 @@ namespace MP.SPEC.Components.ProdKit
public EventCallback<bool> PagerResetReq { get; set; }
[Parameter]
public EventCallback<int> UpdateRecordCount { get; set; }
public List<PODLExpModel> AllRecords { get; set; } = null!;
private List<PODLExpModel> SelRecords = new();
[Parameter]
public SelectXdlParams ActFilter { get; set; } = new SelectXdlParams();
public EventCallback<int> UpdateRecordCount { get; set; }
#endregion Public Properties
@@ -49,7 +52,6 @@ namespace MP.SPEC.Components.ProdKit
public void Dispose()
{
currRecord = null;
SearchRecords = null;
ListRecords = null;
GC.Collect();
}
@@ -88,6 +90,11 @@ namespace MP.SPEC.Components.ProdKit
get => string.IsNullOrEmpty(SearchVal) ? "btn-secondary" : "btn-primary";
}
protected string sSearchtCss
{
get => string.IsNullOrEmpty(searchVal) ? "btn-secondary" : "btn-primary";
}
#endregion Protected Properties
#region Protected Methods
@@ -110,7 +117,7 @@ namespace MP.SPEC.Components.ProdKit
if (!lastFilter.Equals(ActFilter) || true)
{
lastFilter = ActFilter.clone();
await ReloadData();
await ReloadDataAsync();
}
}
@@ -124,15 +131,17 @@ namespace MP.SPEC.Components.ProdKit
});
}
protected async Task ReloadData()
protected async Task ReloadDataAsync()
{
ListRecords = null;
isLoading = true;
SearchRecords = await MDService.POdlToKitListGetFiltAsync(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd);
#if false
AllRecords = await MDService.POdlToKitListGetFiltAsync(hasOdl, StatoSel, macchina, reparto, selDtStart, selDtEnd);
#endif
// rivedere filtro FixMe ToDo!!!
// filtro tenendo SOLO se hanno keyRichiesta CodExt + ATTIVI + NON KIT | Hard Coded...
SearchRecords = SearchRecords
SelRecords = AllRecords
.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta) && x.Attivabile && !x.KeyRichiesta.StartsWith("KIT"))
.ToList();
@@ -152,7 +161,7 @@ namespace MP.SPEC.Components.ProdKit
currPage = 1;
if (forceUpdate)
{
await ReloadData();
await ReloadDataAsync();
}
}
@@ -179,7 +188,7 @@ namespace MP.SPEC.Components.ProdKit
protected async Task UpdateData()
{
currRecord = null;
await ReloadData();
await ReloadDataAsync();
}
#endregion Protected Methods
@@ -197,15 +206,8 @@ namespace MP.SPEC.Components.ProdKit
/// </summary>
private List<string> odlCurrList = new List<string>();
private List<PODLExpModel>? SearchRecords;
private string searchVal = "";
protected string sSearchtCss
{
get => string.IsNullOrEmpty(searchVal) ? "btn-secondary" : "btn-primary";
}
#endregion Private Fields
#region Private Properties
@@ -298,9 +300,9 @@ namespace MP.SPEC.Components.ProdKit
private void UpdateTable()
{
totalCount = 0;
if (SearchRecords != null)
if (SelRecords != null)
{
var filtRec = new List<PODLExpModel>(SearchRecords);
var filtRec = new List<PODLExpModel>(SelRecords);
// se ho ricerca filtro!
if (!string.IsNullOrEmpty(searchVal))
{
@@ -310,7 +312,7 @@ namespace MP.SPEC.Components.ProdKit
{
int.TryParse(searchVal.Replace("PODL", ""), out idxPodl);
}
filtRec = SearchRecords
filtRec = AllRecords
.Where(x => (x.KeyRichiesta.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)
|| x.KeyBCode.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)
|| (x.IdxPromessa == idxPodl && idxPodl > 0))
+1 -1
View File
@@ -10,7 +10,7 @@
@if (DoAddNew)
{
<div class="col-6 mb-1 px-1">
<KitPodlMan PadCodXdl="@padCodXdl" EC_RecordSel="SavePodl" ActFilter="@ActFilt"></KitPodlMan>
<KitPodlMan AllRecords="@listPOdl2Kit" PadCodXdl="@padCodXdl" EC_RecordSel="SavePodl" ActFilter="@ActFilt"></KitPodlMan>
</div>
<div class="col-6 mb-1 px-1">
<KitComposer SearchRecords="@listWSM" KeyFilt="@keyFilt" EC_ListUpdated="ForceReloadData" EC_ListCleared="ForceReset"></KitComposer>
+3 -1
View File
@@ -129,6 +129,7 @@ namespace MP.SPEC.Components.ProdKit
private List<PODLExpModel> listPOdlCheck = new List<PODLExpModel>();
private List<TksScoreModel> listTSM = new List<TksScoreModel>();
private List<WipSetupKitModel> listWSM = new List<WipSetupKitModel>();
private List<PODLExpModel> listPOdl2Kit = new List<PODLExpModel>();
private string padCodXdl = "00000";
private string userName = "";
private string userNameFull = "";
@@ -187,6 +188,7 @@ namespace MP.SPEC.Components.ProdKit
{
listPOdlCheck = new List<PODLExpModel>();
listPOdlAct = await MDService.POdlListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd);
listPOdl2Kit = await MDService.POdlToKitListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd);
listWSM = await MDService.WipKitFiltAsync(keyFilt);
listTSM = await MDService.TksScoreAsync(keyFilt, 1000, true);
listIKP = await MDService.IstKitFiltAsync("", "");
@@ -199,7 +201,7 @@ namespace MP.SPEC.Components.ProdKit
// continuo con PODL
if (!string.IsNullOrEmpty(codArtKit))
{
listPOdlCheck = MDService.ListPODL_ByCodArt(codArtKit, true);
listPOdlCheck = await MDService.ListPODL_ByCodArtAsync(codArtKit, true);
}
isLoading = false;
}