120 lines
3.6 KiB
C#
120 lines
3.6 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.JSInterop;
|
|
using MP.Data.DbModels;
|
|
using MP.SPEC.Data;
|
|
|
|
namespace MP.SPEC.Components.ProdKit
|
|
{
|
|
public partial class KitVerify
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public List<PODLExpModel> AllRecPODL { get; set; } = new List<PODLExpModel>();
|
|
|
|
[Parameter]
|
|
public List<TksScoreModel> AllRecTSM { get; set; } = new List<TksScoreModel>();
|
|
|
|
[Parameter]
|
|
public List<WipSetupKitModel> AllRecWSM { get; set; } = new List<WipSetupKitModel>();
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_KitCreated { get; set; }
|
|
|
|
[Parameter]
|
|
public string KeyFilt { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public List<PODLExpModel> PodlRecords { get; set; } = new List<PODLExpModel>();
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected IJSRuntime JSRuntime { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected MpDataService MDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected void KitToggleDetail(TksScoreModel? currRec)
|
|
{
|
|
CodArtParent = currRec != null ? currRec.CodArtParent : "";
|
|
if (!string.IsNullOrEmpty(CodArtParent))
|
|
{
|
|
ListKitTemplate = MDService.TemplateKitFilt(CodArtParent, "");
|
|
totalKitCount = ListKitTemplate.Count;
|
|
ListRecKitPODL = PodlRecords
|
|
.Where(x => !string.IsNullOrEmpty(x.KeyRichiesta)
|
|
&& x.KeyRichiesta.StartsWith("KIT")
|
|
&& x.CodArticolo==CodArtParent)
|
|
.ToList();
|
|
}
|
|
else
|
|
{
|
|
ListKitTemplate = null;
|
|
totalKitCount = 0;
|
|
}
|
|
doShowDetail = !doShowDetail;
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
ReloadData();
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private string CodArtParent = "";
|
|
private bool doShowDetail = false;
|
|
private List<TemplateKitModel>? ListKitTemplate = null;
|
|
private List<PODLExpModel> ListRecPODL = new List<PODLExpModel>();
|
|
private List<PODLExpModel> ListRecKitPODL = new List<PODLExpModel>();
|
|
private List<TksScoreModel> ListRecScore = new List<TksScoreModel>();
|
|
|
|
/// <summary>
|
|
/// Num record composizione kit...
|
|
/// </summary>
|
|
private int numRecWsm = 0;
|
|
|
|
private int totalKitCount = 0;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Methods
|
|
|
|
/// <summary>
|
|
/// Crea una NUOVA istanza KIT
|
|
/// </summary>
|
|
/// <param name="currRec">Record selezionato da generare x Assieme/KIT</param>
|
|
private async Task DoCreatePOdl(TksScoreModel currRec)
|
|
{
|
|
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Confermi di voler creare il PODL del KIT selezionato?"))
|
|
return;
|
|
|
|
// eseguo stored...
|
|
bool fatto = MDService.IstKitInsertByWKS(currRec.CodArtParent, KeyFilt);
|
|
if (fatto)
|
|
{
|
|
// segnalo update
|
|
await EC_KitCreated.InvokeAsync(true);
|
|
}
|
|
}
|
|
|
|
private void ReloadData()
|
|
{
|
|
ListRecScore = AllRecTSM.ToList();
|
|
ListRecPODL = AllRecPODL.ToList();
|
|
|
|
numRecWsm = AllRecWSM.Count();
|
|
}
|
|
|
|
#endregion Private Methods
|
|
}
|
|
} |