using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
namespace MP_TAB3.Components
{
public partial class ProdPlanMan
{
#region Public Properties
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
#endregion Public Properties
#region Public Methods
///
/// Aggiorno valori produzione alla data richiesta...
///
///
public async Task doUpdate()
{
isProcessing = true;
await Task.Delay(1);
ListPodl = await TabDServ.ListPODLByMacc(IdxMaccSel, true, OnlyDirect);
isProcessing = false;
await Task.Delay(1);
}
#endregion Public Methods
#region Protected Fields
protected bool OnlyDirect
{
get => onlyDirect;
set
{
if (onlyDirect != value)
{
onlyDirect = value;
var pUpd = Task.Run(async () =>
{
await doUpdate();
});
pUpd.Wait();
}
}
}
private bool onlyDirect { get; set; } = true;
#endregion Protected Fields
#region Protected Properties
protected List ListPodl { get; set; } = new List();
[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;
await doUpdate();
}
}
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
await Task.Delay(10);
IdxMaccSel = selIdxMacc;
await doUpdate();
isProcessing = false;
await Task.Delay(10);
}
protected string TCMinSec(object _TC)
{
string TC_MinSec = "-";
if (_TC != null)
{
double TC = 0;
bool fatto = double.TryParse($"{_TC}", out TC);
if (fatto)
{
TimeSpan ts = TimeSpan.FromMinutes(TC);
if (ts.TotalHours > 1)
{
TC_MinSec = $"{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00} (h:m:s)";
}
else
{
TC_MinSec = $"{ts.Minutes:00}:{ts.Seconds:00} (m:s)";
}
}
}
return TC_MinSec;
}
#endregion Protected Methods
#region Private Fields
private bool isProcessing = false;
#endregion Private Fields
#region Private Properties
private string IdxMaccSel { get; set; } = "";
#endregion Private Properties
}
}