From e32600f6d39d9d017bb6df340cc5f8f15a93d325 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 9 Nov 2023 15:41:10 +0100 Subject: [PATCH] Fix refresh display status --- MP-TAB-SERV/Components/MachineBlock.razor.cs | 12 +-- MP-TAB-SERV/Components/OdlMan.razor | 66 +++++++++------- MP-TAB-SERV/Components/OdlMan.razor.cs | 81 ++++++++++++++++---- MP-TAB-SERV/Components/SelTempoMSMC.razor | 2 +- MP-TAB-SERV/Components/SelTempoMSMC.razor.cs | 2 +- MP-TAB-SERV/MP-TAB-SERV.csproj | 2 +- MP-TAB-SERV/Pages/StatusMap.razor | 10 +-- MP-TAB-SERV/Pages/StatusMap.razor.cs | 11 +-- MP-TAB-SERV/Resources/ChangeLog.html | 2 +- MP-TAB-SERV/Resources/VersNum.txt | 2 +- MP-TAB-SERV/Resources/manifest.xml | 2 +- MP.Data/Controllers/MpTabController.cs | 2 +- MP.Data/DatabaseModels/PODLExpModel.cs | 14 +++- 13 files changed, 135 insertions(+), 73 deletions(-) diff --git a/MP-TAB-SERV/Components/MachineBlock.razor.cs b/MP-TAB-SERV/Components/MachineBlock.razor.cs index ce34dee6..08617025 100644 --- a/MP-TAB-SERV/Components/MachineBlock.razor.cs +++ b/MP-TAB-SERV/Components/MachineBlock.razor.cs @@ -158,20 +158,16 @@ namespace MP_TAB_SERV.Components } } - protected override async Task OnParametersSetAsync() + protected override void OnParametersSet() { isLoading = RecMSE == null; - await setGaugeVals(); - await Task.Delay(1); + setGaugeVals(); } - protected async Task setGaugeVals() + protected void setGaugeVals() { - await Task.Delay(1); - Log.Info("MBlock 01"); if (RecMSE != null) { - Log.Info("MBlock 02"); innerCircleVals.Clear(); outerCircleVals.Clear(); currMaxVal = int.Parse(RecMSE.NumPezzi.ToString()!); @@ -184,7 +180,7 @@ namespace MP_TAB_SERV.Components { outerCircleVals.Add(new CircleGaugeMulti.CircSegm() { Color = "#1367FD", Value = RecMSE.extraVal }); } - Log.Info("MBlock 03"); + //Log.Trace($"MBlock | {RecMSE.IdxMacchina} | 03"); } else { diff --git a/MP-TAB-SERV/Components/OdlMan.razor b/MP-TAB-SERV/Components/OdlMan.razor index bb2743f1..af703efc 100644 --- a/MP-TAB-SERV/Components/OdlMan.razor +++ b/MP-TAB-SERV/Components/OdlMan.razor @@ -33,7 +33,7 @@ @if (cancelSetupEnabled) { -
+
} @@ -54,9 +54,9 @@

@titleOdlDetail

- @if (idxPOdlSel == 0) + @if (idxPOdlSel == 0 && !inAttr) { - + }
@@ -111,7 +111,14 @@ TCiclo:
- @currPodl.Tcassegnato.ToString("N2") + @if (currOdl != null && currOdl.Tcassegnato > 0) + { + @currOdl.Tcassegnato.ToString("N2") + } + else + { + @currPodl.Tcassegnato.ToString("N2") + }
@@ -153,6 +160,16 @@ @if (!inAttr) { +
+ @if (idxPOdlSel > 0) + { + + } + else + { + + } +
@@ -170,21 +187,14 @@
-
- @if (idxPOdlSel > 0) - { - - } - else - { - } -
} @if (idxPOdlSel > 0 || inAttr) {
- - +
+ + +
@@ -204,26 +214,26 @@ @if (inAttr) { -
+
} -
- -
-
-
- - + else + { +
+
+ + +
+ } +
+
-
+
-
- -
-
+
@*
diff --git a/MP-TAB-SERV/Components/OdlMan.razor.cs b/MP-TAB-SERV/Components/OdlMan.razor.cs index b2f03b15..3e2cf2d3 100644 --- a/MP-TAB-SERV/Components/OdlMan.razor.cs +++ b/MP-TAB-SERV/Components/OdlMan.razor.cs @@ -152,8 +152,7 @@ namespace MP_TAB_SERV.Components // se in attr --> carico podlCurr... if (inAttr && RecMSE != null) { - int currIdxPOdl = RecMSE != null ? RecMSE.IdxPOdl ?? 0 : 0; - currPodl = await TabDServ.PODLExp_getByKey(currIdxPOdl); + await ReloadXDL(false); } } @@ -284,7 +283,7 @@ namespace MP_TAB_SERV.Components idxOdl = idxODLStart; await advStep(currStep++); // faccio refresh e riporto - await refreshData(); + await RefreshData(); await CheckAttr(); // chiudo update... isProcessing = false; @@ -296,8 +295,13 @@ namespace MP_TAB_SERV.Components /// protected async Task OdlSetupStart() { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi inizio della fase di attrezzaggio per l'articolo [{currPodl.CodArticolo}] {currPodl.DescArticolo}?")) + TimeSpan estDur = TimeSpan.FromMinutes((double)tcRichAttr * currPodl.NumPezzi); + string stima = estDur.TotalHours > 1 ? $"{estDur.TotalHours:N1} ore" : $"{estDur.TotalMinutes:N1} min"; + if (!await JSRuntime.InvokeAsync("confirm", $"PODL: {currPodl.IdxPromessa}{Environment.NewLine}Art: [{currPodl.CodArticolo}] {currPodl.DescArticolo}{Environment.NewLine}Pezzi: {currPodl.NumPezzi:N0} * TCiclo: {tcRichAttr:N3}min{Environment.NewLine}Tempo stimato: {stima}{Environment.NewLine}{Environment.NewLine}Confermi inizio della fase di attrezzaggio?")) return; + + //if (!await JSRuntime.InvokeAsync("confirm", $"Confermi inizio della fase di attrezzaggio per l'articolo [{currPodl.CodArticolo}] {currPodl.DescArticolo}?")) + // return; /*************************************************** * comprende gestione machineSlave x fix ODL master --> slave * @@ -489,7 +493,7 @@ namespace MP_TAB_SERV.Components checkBtnStatus(); fixSplitBtn(false); // faccio refresh e riporto - await refreshData(); + await RefreshData(); await CheckAttr(); isProcessing = false; } @@ -622,13 +626,13 @@ namespace MP_TAB_SERV.Components } await advStep(currStep++); // faccio refresh e riporto - await refreshData(); + await RefreshData(); await CheckAttr(); await advStep(currStep++); isProcessing = false; } - protected async Task refreshData() + protected async Task RefreshData() { // refresh tabella dati tablet... TabDServ.RicalcMse(IdxMaccSel, 0); @@ -638,10 +642,8 @@ namespace MP_TAB_SERV.Components { // salvo in LocalStorage... await MServ.SaveMse(ListMSE); -#if false // aggiorno MSE attuale RecMSE = ListMSE.Find(x => x.IdxMacchina == IdxMaccSel); -#endif await E_Updated.InvokeAsync(ListMSE); } // update dati liste ODL @@ -662,7 +664,7 @@ namespace MP_TAB_SERV.Components string baseUrlAdmin = SMServ.GetConf("baseUrlAdmin"); string pageUrlApprODL = SMServ.GetConf("pageUrlApprODL"); string pageUrl = $"{baseUrlAdmin}{pageUrlApprODL}"; - string corpo = $"ODL: {idxOdl} | TC Assegnato: {tcAss} | TC Rich: {tcRich}{Environment.NewLine}{Environment.NewLine}"; + string corpo = $"ODL: {idxOdl} | TC Assegnato: {tcAss:N3} | TC Rich: {tcRich}{Environment.NewLine}{Environment.NewLine}"; corpo += string.Format(corpoChgTc, Environment.NewLine, pageUrl); corpo = corpo.Replace($"{Environment.NewLine}", "
"); MailKitMailData mData = new MailKitMailData() @@ -699,8 +701,22 @@ namespace MP_TAB_SERV.Components // se devo mostrare, carico dati ODL! if (showOdlDetail && RecMSE != null) { - int currIdxPOdl = RecMSE != null ? RecMSE.IdxPOdl ?? 0 : 0; - currPodl = await TabDServ.PODLExp_getByKey(currIdxPOdl); + await ReloadXDL(true); + } + } + + private async Task ReloadXDL(bool reloadFromOdl) + { + int currIdxPOdl = IdxPOdlSel; + if (reloadFromOdl) + { + currIdxPOdl = RecMSE != null ? RecMSE.IdxPOdl ?? 0 : 0; + } + currPodl = await TabDServ.PODLExp_getByKey(currIdxPOdl); + // update a runtime dati ODL se assegnato + if (currPodl.IdxOdl > 0) + { + currOdl = await TabDServ.OdlByIdx(currPodl.IdxOdl, false); } } @@ -709,6 +725,32 @@ namespace MP_TAB_SERV.Components return SMServ.Traduci($"{baseLang}_{lemma}".ToUpper()); } + protected async Task SendFixEndSetup() + { + if (!await JSRuntime.InvokeAsync("confirm", $"Confermi invio FIX chiusura atrtezzaggio ad impianto?")) + return; + + string ts = string.Format("{0:yyMMdd}T{0:HHmmss.fff}Z", DateTime.Now); + string outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{IdxOdl}"; + TabDServ.addTask4Machine(IdxMaccSel, taskType.fixStopSetup, outData); + outData = "Inserita richiesta invio Fix chiusura attrezzaggio " + outData; + lblOut = outData; + // se è master --> chiamo update child! + if (isMaster) + { + // invio eventi ad IOB slave... + var slaveList = SMServ.ListM2S + .Where(x => x.IdxMacchina.Equals(IdxMaccSel, StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + foreach (var machine in slaveList) + { + // invio chiusura attrezzaggio + outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{idxOdl}|master machine:{IdxMaccSel}"; + TabDServ.addTask4Machine(machine.IdxMacchinaSlave, taskType.fixStopSetup, outData); + } + } + } + #endregion Protected Methods #region Private Fields @@ -786,6 +828,7 @@ namespace MP_TAB_SERV.Components } private PODLExpModel currPodl { get; set; } = new PODLExpModel(); + private ODLExpModel currOdl { get; set; } = new ODLExpModel(); /// /// Variabile idxMacc parent x selezione ODL @@ -825,6 +868,11 @@ namespace MP_TAB_SERV.Components } } + private bool endProdDisabled + { + get => !odlOk || needConfProd; + } + private int numPz2Conf { get @@ -848,7 +896,7 @@ namespace MP_TAB_SERV.Components } private string titleOdlDetail { - get => IdxPOdlSel > 0 ? "Verifica parametri attrezzaggio NUOVO PODL" : "Parametri ODL Corrente"; + get => IdxPOdlSel > 0 ? "Verifica parametri attrezzaggio NUOVO PODL" : inAttr ? "Parametri PODL in Attrezzaggio" : "Parametri ODL Corrente"; } private string cssDetailOdl @@ -1174,13 +1222,18 @@ namespace MP_TAB_SERV.Components prodMacchina = rawData.FirstOrDefault() ?? new PzProdModel(); } } + // imposto tcRichAttr in base allo stato... + if (odlOk) + { + tcRichAttr = currPodl.Tcassegnato; ; + } } private async Task ReloadPOdlDetailData() { if (IdxPOdlSel > 0) { - currPodl = await TabDServ.PODLExp_getByKey(IdxPOdlSel); + await ReloadXDL(false); // controllo se � cambiato PODL if (IdxPOdlSel != lastIdxPOdl) { diff --git a/MP-TAB-SERV/Components/SelTempoMSMC.razor b/MP-TAB-SERV/Components/SelTempoMSMC.razor index 380f5379..76a84cea 100644 --- a/MP-TAB-SERV/Components/SelTempoMSMC.razor +++ b/MP-TAB-SERV/Components/SelTempoMSMC.razor @@ -23,6 +23,6 @@ }
- @lblTempo + → @lblTempo
diff --git a/MP-TAB-SERV/Components/SelTempoMSMC.razor.cs b/MP-TAB-SERV/Components/SelTempoMSMC.razor.cs index 11a1b619..19fdc160 100644 --- a/MP-TAB-SERV/Components/SelTempoMSMC.razor.cs +++ b/MP-TAB-SERV/Components/SelTempoMSMC.razor.cs @@ -218,7 +218,7 @@ namespace MP_TAB_SERV.Components { get { - string answ = tcMode == "mc" ? $"--> {TempoMS.TotalMinutes:N0}:{TempoMS:ss} (min:sec)" : $"--> {TempoMC:0.000} (min.cent)"; + string answ = tcMode == "mc" ? $"{TempoMS.TotalMinutes:N0}:{TempoMS:ss} (min:sec)" : $"{TempoMC:0.000} (min.cent)"; return answ; } } diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index fd8b09d0..56514f72 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2311.909 + 6.16.2311.915 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/StatusMap.razor b/MP-TAB-SERV/Pages/StatusMap.razor index 72bf0725..250dd569 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor +++ b/MP-TAB-SERV/Pages/StatusMap.razor @@ -2,17 +2,11 @@ @page "/home" @page "/status-map" - +
@if (ListMSE == null || ListMSE.Count == 0 || isCalcSize) { - @*@for (int i = 0; i < 10; i++) - { -
- @* -
- }*@ - + } else { diff --git a/MP-TAB-SERV/Pages/StatusMap.razor.cs b/MP-TAB-SERV/Pages/StatusMap.razor.cs index de20447a..49cfeb7b 100644 --- a/MP-TAB-SERV/Pages/StatusMap.razor.cs +++ b/MP-TAB-SERV/Pages/StatusMap.razor.cs @@ -96,6 +96,8 @@ namespace MP_TAB_SERV.Pages { await getWDim(); isCalcSize = false; + ListMSE = await MDataService.MseGetAll(); + await InvokeAsync(StateHasChanged); } if (ListMSE != null) { @@ -104,21 +106,20 @@ namespace MP_TAB_SERV.Pages } } - protected override async Task OnInitializedAsync() + protected override void OnInitialized() { var df = MServ.UserPrefGet("DefCardMode"); ShowCard = df == "shrink" ? false : true; isCalcSize = true; ListMSE = null; SetupConf(); - ListMSE = await MDataService.MseGetAll(); } - protected async Task RefreshData(List newList) + protected void SaveData(List newList) { + //await Task.Delay(1); ListMSE = newList; - await InvokeAsync(StateHasChanged); - //Log.Trace("StatusMap | RefreshData"); + //await InvokeAsync(StateHasChanged); } #endregion Protected Methods diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index 514eae7a..ffefa68b 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2311.909

+

Versione: 6.16.2311.915


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index c3aa4abd..8fd925f8 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2311.909 +6.16.2311.915 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index 5ea45187..cb13f8ba 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2311.909 + 6.16.2311.915 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 40800ec6..58d01c22 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -782,7 +782,7 @@ namespace MP.Data.Controllers var OnlyUnused = new SqlParameter("@onlyUnused", onlyUnused); dbResult = dbCtx .DbSetODLExp - .FromSqlRaw("EXEC stp_ODL_getByIdx @IdxOdl, @onlyUnused", IdxOdl, onlyUnused) + .FromSqlRaw("EXEC stp_ODL_getByIdx @IdxOdl, @onlyUnused", IdxOdl, OnlyUnused) .AsNoTracking() .ToList(); } diff --git a/MP.Data/DatabaseModels/PODLExpModel.cs b/MP.Data/DatabaseModels/PODLExpModel.cs index ff1c3cfc..018da8b1 100644 --- a/MP.Data/DatabaseModels/PODLExpModel.cs +++ b/MP.Data/DatabaseModels/PODLExpModel.cs @@ -47,10 +47,18 @@ namespace MP.Data.DatabaseModels get { string answ = "*"; - var allData = KeyRichiesta.Split('_'); - if (allData.Length > 0) + if (!string.IsNullOrEmpty(KeyRichiesta)) { - answ = allData[0]; + try + { + var allData = KeyRichiesta.Split('_'); + if (allData.Length > 0) + { + answ = allData[0]; + } + } + catch + { } } return answ; }