using global::Microsoft.AspNetCore.Components; using MP.Data.DbModels; using MP.Data.Services; namespace MP_TAB3.Components { public partial class ProdPlanMan { #region Public Properties [Parameter] public MappaStatoExplModel? RecMSE { get; set; } = null; [Parameter] public string IdxMacchSub { get; set; } = ""; [Parameter] public EventCallback E_MachSel { get; set; } #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(1); IdxMaccSel = selIdxMacc; await Task.Delay(1); await doUpdate(); isProcessing = false; await E_MachSel.InvokeAsync(selIdxMacc); } 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 } }