101 lines
2.8 KiB
C#
101 lines
2.8 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using MP.Data.DbModels;
|
|
using MP.SPEC.Data;
|
|
|
|
namespace MP.SPEC.Components.ProdKit
|
|
{
|
|
public partial class Manager
|
|
{
|
|
#region Protected Properties
|
|
|
|
[Inject]
|
|
protected MpDataService MDService { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
isLoading = false;
|
|
if (string.IsNullOrEmpty(padCodXdl))
|
|
{
|
|
padCodXdl = MDService.ConfigTryGet("padCodXdl");
|
|
}
|
|
currPodlRec = null;
|
|
|
|
// Verifico chiave Kit o la rigenero
|
|
if (string.IsNullOrEmpty(keyFilt))
|
|
{
|
|
DateTime adesso = DateTime.Now;
|
|
keyFilt = $"KIT_{adesso:yyMMdd}_{adesso:HHmmss}";
|
|
}
|
|
ReloadData();
|
|
}
|
|
|
|
private string keyFilt = "";
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private string padCodXdl = "00000";
|
|
|
|
private bool isLoading = false;
|
|
|
|
/// <summary>
|
|
/// Salvataggio su Tab WIP dei dati del PODL ricevuto...
|
|
/// </summary>
|
|
/// <param name="selRec"></param>
|
|
protected void SavePodl(PODLExpModel selRec)
|
|
{
|
|
if (currPodlRec == null || currPodlRec.IdxPromessa != selRec.IdxPromessa)
|
|
{
|
|
if (selRec != null)
|
|
{
|
|
// chiamo tentativo update!
|
|
WipSetupKitModel newRec = new WipSetupKitModel()
|
|
{
|
|
KeyFilt = keyFilt,
|
|
CodArt = selRec.CodArticolo,
|
|
CodOrd = selRec.KeyRichiesta,
|
|
DescArt = selRec.DescArticolo,
|
|
Qta = selRec.NumPezzi,
|
|
DataIns = DateTime.Now
|
|
};
|
|
bool fatto = MDService.WipKitUpsert(newRec);
|
|
}
|
|
currPodlRec = selRec;
|
|
// rileggoi
|
|
ReloadData();
|
|
}
|
|
}
|
|
private void ForceReloadData(bool doReload)
|
|
{
|
|
isLoading = true;
|
|
if (doReload)
|
|
{
|
|
listWSM = new List<WipSetupKitModel>();
|
|
}
|
|
ReloadData();
|
|
}
|
|
|
|
|
|
private void ReloadData()
|
|
{
|
|
listWSM = MDService.WipKitFilt(keyFilt);
|
|
listTSM = MDService.TksScore(keyFilt, 1000, true);
|
|
isLoading = false;
|
|
}
|
|
|
|
|
|
private List<WipSetupKitModel> listWSM = new List<WipSetupKitModel>();
|
|
private List<TksScoreModel> listTSM = new List<TksScoreModel>();
|
|
|
|
/// <summary>
|
|
/// Record PODL corrente da inserire
|
|
/// </summary>
|
|
private PODLExpModel? currPodlRec = null;
|
|
|
|
#endregion Private Fields
|
|
}
|
|
} |