176 lines
4.7 KiB
C#
176 lines
4.7 KiB
C#
using global::Microsoft.AspNetCore.Components;
|
|
using MP.Data.DatabaseModels;
|
|
using MP.Data.Services;
|
|
using NLog;
|
|
using static EgwCoreLib.Utils.DtUtils;
|
|
|
|
namespace MP_TAB_SERV.Components
|
|
{
|
|
public partial class ControlsMan
|
|
{
|
|
#region Public Properties
|
|
|
|
[Parameter]
|
|
public MappaStatoExpl? RecMSE { get; set; } = null;
|
|
|
|
#endregion Public Properties
|
|
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// Aggiorno valori produzione alla data richiesta...
|
|
/// </summary>
|
|
/// <param name="newDate"></param>
|
|
public async Task doUpdate()
|
|
{
|
|
isProcessing = true;
|
|
await Task.Delay(1);
|
|
if (!string.IsNullOrEmpty(IdxMaccSel))
|
|
{
|
|
ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, idxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false);
|
|
TotalCount = ListComplete.Count;
|
|
// esegue paginazione
|
|
UpdateTable();
|
|
}
|
|
isProcessing = false;
|
|
await Task.Delay(1);
|
|
}
|
|
|
|
#endregion Public Methods
|
|
|
|
#region Protected Fields
|
|
|
|
protected int idxOdl = 0;
|
|
protected bool isProcessing = false;
|
|
protected string noteKo = "";
|
|
protected int NumRecPage = 10;
|
|
protected int PageNum = 1;
|
|
protected bool showNote = false;
|
|
protected int TotalCount = 0;
|
|
|
|
#endregion Protected Fields
|
|
|
|
#region Protected Properties
|
|
|
|
protected string ConfTitle
|
|
{
|
|
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
|
|
}
|
|
|
|
protected List<RegistroControlliModel> ListComplete { get; set; } = new List<RegistroControlliModel>();
|
|
protected List<RegistroControlliModel> ListPaged { get; set; } = new List<RegistroControlliModel>();
|
|
|
|
[Inject]
|
|
protected MessageService MServ { get; set; } = null!;
|
|
|
|
[Inject]
|
|
protected TabDataService TabDServ { get; set; } = null!;
|
|
|
|
#endregion Protected Properties
|
|
|
|
#region Protected Methods
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await Task.Delay(1);
|
|
if (RecMSE != null)
|
|
{
|
|
IdxMaccSel = RecMSE.IdxMacchina;
|
|
CurrPeriodo = new Periodo(PeriodSet.ThisWeek);
|
|
await doUpdate();
|
|
}
|
|
}
|
|
|
|
protected async Task SaveKo()
|
|
{
|
|
isProcessing = true;
|
|
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, false, noteKo, DateTime.Now);
|
|
showInsert = false;
|
|
showNote = false;
|
|
await doUpdate();
|
|
isProcessing = false;
|
|
}
|
|
|
|
protected void SaveNumRec(int newNum)
|
|
{
|
|
NumRecPage = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
protected async Task SaveOk()
|
|
{
|
|
isProcessing = true;
|
|
await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, true, noteKo, DateTime.Now);
|
|
showInsert = false;
|
|
showNote = false;
|
|
await doUpdate();
|
|
isProcessing = false;
|
|
}
|
|
|
|
protected void SavePage(int newNum)
|
|
{
|
|
PageNum = newNum;
|
|
UpdateTable();
|
|
}
|
|
|
|
protected async Task SetMacc(string selIdxMacc)
|
|
{
|
|
isProcessing = true;
|
|
await Task.Delay(10);
|
|
IdxMaccSel = selIdxMacc;
|
|
await doUpdate();
|
|
isProcessing = false;
|
|
await Task.Delay(10);
|
|
}
|
|
|
|
protected async Task SetPeriodo(Periodo newPeriodo)
|
|
{
|
|
CurrPeriodo = newPeriodo;
|
|
await doUpdate();
|
|
}
|
|
|
|
protected void ShowKo()
|
|
{
|
|
showNote = true;
|
|
}
|
|
|
|
protected void ToggleBtn()
|
|
{
|
|
showInsert = !showInsert;
|
|
if (showInsert)
|
|
{
|
|
noteKo = "";
|
|
showNote = false;
|
|
}
|
|
}
|
|
|
|
protected void UpdateTable()
|
|
{
|
|
// esegue paginazione
|
|
if (TotalCount > NumRecPage)
|
|
{
|
|
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
|
|
}
|
|
else
|
|
{
|
|
ListPaged = ListComplete;
|
|
}
|
|
}
|
|
|
|
#endregion Protected Methods
|
|
|
|
#region Private Fields
|
|
|
|
private static Logger Log = LogManager.GetCurrentClassLogger();
|
|
private bool showInsert = false;
|
|
|
|
#endregion Private Fields
|
|
|
|
#region Private Properties
|
|
|
|
private Periodo CurrPeriodo { get; set; } = new Periodo();
|
|
private string IdxMaccSel { get; set; } = "";
|
|
|
|
#endregion Private Properties
|
|
}
|
|
} |