diff --git a/MP-TAB3/Components/InsManual.razor b/MP-TAB3/Components/InsManual.razor index dd370a41..cd36b533 100644 --- a/MP-TAB3/Components/InsManual.razor +++ b/MP-TAB3/Components/InsManual.razor @@ -266,5 +266,5 @@ @if (showProgress) { - -} + +} \ No newline at end of file diff --git a/MP-TAB3/Components/InsManual.razor.cs b/MP-TAB3/Components/InsManual.razor.cs index 294aa501..bbac7de9 100644 --- a/MP-TAB3/Components/InsManual.razor.cs +++ b/MP-TAB3/Components/InsManual.razor.cs @@ -33,6 +33,19 @@ namespace MP_TAB3.Components #region Protected Properties + protected DateTime dtCurr + { + get => selDtCurr; + set + { + if (selDtCurr != value) + { + selDtCurr = value; + dtMonthStart = new DateTime(value.Year, value.Month, 1); + } + } + } + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -226,13 +239,11 @@ namespace MP_TAB3.Components await Task.Delay(1); } - private string idxMacc = ""; - private DateTime dtMonthStart = new DateTime(2000, 1, 1); - #endregion Protected Methods #region Private Fields + private int currVal = 0; private Dictionary DateCFF = new Dictionary(); /// @@ -265,6 +276,7 @@ namespace MP_TAB3.Components /// private bool doSearchArt = false; + private DateTime dtMonthStart = new DateTime(2000, 1, 1); private InsManualiModel? EditRecord = null; /// @@ -272,8 +284,14 @@ namespace MP_TAB3.Components /// private bool enableEditTime = false; + private int expTimeMsec = 1000; + private string idxMacc = ""; + private int nextVal = 0; + private string progressTitle = "Approvazione Giornata"; private List SeqStatus = new List(); + private bool showProgress = false; + #endregion Private Fields #region Private Properties @@ -281,22 +299,6 @@ namespace MP_TAB3.Components private bool confProdActive { get; set; } = false; private MappaStatoExpl? currRecMSE { get; set; } = null; - - protected DateTime dtCurr - { - get => selDtCurr; - set - { - if (selDtCurr != value) - { - selDtCurr = value; - dtMonthStart = new DateTime(value.Year, value.Month, 1); - } - } - } - // - private DateTime selDtCurr { get; set; } = DateTime.Today; - private List? ListDay { get; set; } = new List(); private List? ListDTO { get; set; } = new List(); @@ -313,6 +315,9 @@ namespace MP_TAB3.Components /// private Dictionary ListTCiclo { get; set; } = new Dictionary(); + // + private DateTime selDtCurr { get; set; } = DateTime.Today; + private bool showDetail { get; set; } = false; #endregion Private Properties @@ -376,23 +381,22 @@ namespace MP_TAB3.Components return; // esegue stored - bool fatto = false; - progressTitle = "Avvio processo"; showProgress = true; + await Task.Delay(10); + bool fatto = false; + progressTitle = "Registrazione conferma giornaliera"; currVal = 0; - nextVal = 20; + nextVal = 90; await InvokeAsync(StateHasChanged); if (RecMSE != null) { - currVal = 20; - nextVal = 90; - progressTitle = "Start conferma giornaliera"; + await Task.Delay(10); await InvokeAsync(StateHasChanged); - string IdxMacc = RecMSE.IdxMacchina; - fatto = await TabDServ.InsManFreezeDay(IdxMacc, dtCurr); + await Task.Delay(10); + fatto = await TabDServ.InsManFreezeDay(RecMSE.IdxMacchina, dtCurr); currVal = 90; nextVal = 100; - progressTitle = "Ricalcolo giornata"; + progressTitle = "Ricalcolo Giornata"; await InvokeAsync(StateHasChanged); EditRecord = null; ReloadData(); @@ -401,11 +405,6 @@ namespace MP_TAB3.Components } return; } - private int currVal = 0; - private int nextVal = 0; - private int expTimeMsec = 100; - private bool showProgress = false; - private string progressTitle = "Approvazione Giornata"; private bool IsTimeInfoOk(DateTime reqDate, bool reloadDay) { diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 8039b9a8..a3e62c7d 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -699,7 +699,7 @@ namespace MP.Data.Controllers /// /// /// - public bool InsManFreezeDay(string idxMacchina, DateTime dtCurr) + public async Task InsManFreezeDay(string idxMacchina, DateTime dtCurr) { bool fatto = false; using (var dbCtx = new MoonProContext(_configuration)) @@ -707,9 +707,9 @@ namespace MP.Data.Controllers var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); var DataElab = new SqlParameter("@DataElab", dtCurr); - var dbResult = dbCtx + var dbResult = await dbCtx .Database - .ExecuteSqlRaw("EXEC stp_IM_ElaboraInsManuali @IdxMacchina, @DataElab", IdxMacc, DataElab); + .ExecuteSqlRawAsync("EXEC stp_IM_ElaboraInsManuali @IdxMacchina, @DataElab", IdxMacc, DataElab); fatto = dbResult > 0; } diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 135a9b11..92c6b5cb 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1195,14 +1195,16 @@ namespace MP.Data.Services public async Task InsManFreezeDay(string idxMacchina, DateTime dtCurr) { bool fatto = false; + Stopwatch sw = new Stopwatch(); + sw.Start(); Log.Info($"Inizio InsManFreezeDay | idxMacchina: {idxMacchina}"); // salvo - fatto = dbTabController.InsManFreezeDay(idxMacchina, dtCurr); - Log.Info($"Fine stored | idxMacchina: {idxMacchina}"); + fatto = await dbTabController.InsManFreezeDay(idxMacchina, dtCurr); // svuoto cache RedisValue pattern = $"{redisBaseKey}:InsMan:*"; await ExecFlushRedisPatternAsync(pattern); - Log.Info($"Fine InsManFreezeDay | idxMacchina: {idxMacchina}"); + sw.Stop(); + Log.Info($"Fine InsManFreezeDay | idxMacchina: {idxMacchina} | elapsed: {sw.Elapsed.TotalMilliseconds:N2} ms"); return fatto; }