Files
mapo-core/MP-TAB3/Components/TechSheetMan.razor.cs
T
Samuele Locatelli c8bb1065c7 Fix naming (maybe)
2023-12-18 11:40:46 +01:00

113 lines
2.8 KiB
C#

using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
namespace MP_TAB3.Components
{
public partial class TechSheetMan
{
#region Public Properties
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
#endregion Public Properties
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<ST_AnagGruppi> ListGruppi { get; set; } = new List<ST_AnagGruppi>();
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected async Task ClearOdl()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler resettare?"))
return;
if (IdxOdl > 0)
{
await TabDServ.ST_CheckCleanByOdl(IdxOdl);
}
checkReset();
}
protected async Task ForceRefresh()
{
isProcessing = true;
await InvokeAsync(StateHasChanged);
await ReloadData();
isProcessing = false;
}
protected override async Task OnParametersSetAsync()
{
if (RecMSE != null)
{
CodArticolo = RecMSE.CodArticolo;
IdxMaccSel = RecMSE.IdxMacchina;
IdxOdl = RecMSE.IdxOdl ?? 0;
}
await ReloadData();
checkReset();
}
#endregion Protected Methods
#region Private Fields
private string CodArticolo = "";
private bool inAttr = false;
private bool isProcessing = false;
#endregion Private Fields
#region Private Properties
private string IdxMaccSel { get; set; } = "";
private int IdxOdl { get; set; } = 0;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Verifica visibilit reset
/// </summary>
private void checkReset()
{
// condizioni booleane
inAttr = false;
// SOLO SE ho articolo senn niente reset...
if (!string.IsNullOrEmpty(CodArticolo))
{
// controllo se la macchina in attrezzaggio...
var rigaStato = TabDServ.StatoMacchina(IdxMaccSel);
if (rigaStato != null)
{
inAttr = (rigaStato.IdxStato == 2);
}
}
#if false
cmp_ST_objCheck.checkInputData();
#endif
}
private async Task ReloadData()
{
ListGruppi = await TabDServ.ST_AnagGruppiList();
}
#endregion Private Methods
}
}