diff --git a/MP-TAB3/Components/IobInfoMan.razor b/MP-TAB3/Components/IobInfoMan.razor index 1c68b7f6..e4c887e8 100644 --- a/MP-TAB3/Components/IobInfoMan.razor +++ b/MP-TAB3/Components/IobInfoMan.razor @@ -6,11 +6,15 @@
@if(infosIob.iType == MP.Data.Objects.Enums.IobType.rPi) { - + } - else if (infosIob.iType == MP.Data.Objects.Enums.IobType.WIN || infosIob.iType == MP.Data.Objects.Enums.IobType.ND) + else if (infosIob.iType == MP.Data.Objects.Enums.IobType.WIN) { - + + } + else if (infosIob.iType == MP.Data.Objects.Enums.IobType.ND) + { + }
diff --git a/MP-TAB3/Components/MachineBlock.razor b/MP-TAB3/Components/MachineBlock.razor index e9114edf..9db94763 100644 --- a/MP-TAB3/Components/MachineBlock.razor +++ b/MP-TAB3/Components/MachineBlock.razor @@ -3,10 +3,17 @@
- - + + + + + + + + +
@@ -19,10 +26,16 @@ else
No data
- - + + + + + + + +
@@ -33,8 +46,8 @@ else { if (Width > 640) { -
- @RecMSE.CodMacchina +
+ @RecMSE.CodMacchina
@@ -44,10 +57,15 @@ else
-
-
-
- @RecMSE.DescrizioneStato:   @(FormatDurata(RecMSE.Durata)) +
+
+
+
+ @RecMSE.DescrizioneStato +
+
+ @(FormatDurata(RecMSE.Durata)) +
@@ -92,8 +110,8 @@ else } else { -
- @RecMSE.CodMacchina +
+ @RecMSE.CodMacchina
@@ -103,10 +121,10 @@ else
-
+
-
+
@RecMSE.DescrizioneStato
@@ -156,57 +174,6 @@ else
- @*
-
-
-
- @RecMSE.Nome -
- @RecMSE.DescrizioneStato:   @(FormatDurata(RecMSE.Durata)) -
-
- @if (showCard) - { -
-
-
-
-  @($"{RecMSE.PezziConf}") -
- @if (datiProdAct != null && datiProdAct.PzConfScarto > 0) - { -
-
- @($"(- {datiProdAct.PzConfScarto})") -
-
- } -
-
-
-
-  @($"{RecMSE.PezziProd}") -
-
-
-
-
- -
-
-
-
ART.
-
@RecMSE.CodArticolo
-
-
-
ORD.
-
@($"ODL{RecMSE.IdxOdl:00000000}")
-
-
-
- } -
-
*@ } } else @@ -286,7 +253,7 @@ else
-
+
@RecMSE.DescrizioneStato @@ -296,12 +263,15 @@ else
-
-
- @* *@ - + @if (enableDisegno) + { +
+
+ @* *@ + +
-
+ }
} @@ -309,7 +279,7 @@ else } } -@if (showDraw && RecMSE != null) +@if (enableDisegno && showDraw && RecMSE != null) { string docUrl = string.IsNullOrEmpty(RecMSE.Disegno) ? $"disegni/{RecMSE.CodArticolo}.pdf" : $"disegni/{RecMSE.Disegno}.pdf"; diff --git a/MP-TAB3/Components/MachineBlock.razor.cs b/MP-TAB3/Components/MachineBlock.razor.cs index 3a525255..c2395ae0 100644 --- a/MP-TAB3/Components/MachineBlock.razor.cs +++ b/MP-TAB3/Components/MachineBlock.razor.cs @@ -81,30 +81,35 @@ namespace MP_TAB3.Components #endregion Public Methods - /// - /// CSS Class x overlay (effetto spento x macchina spenta/ sGr) - /// - protected string overlayCss - { - get - { - string answ = ""; - if (RecMSE != null) - { - answ = RecMSE.Semaforo == "sGr" ? "bg-dark opacity-50" : ""; - } - return answ; - } - } + #region Protected Fields + + protected string baseCss = "sem"; + + protected int currMaxVal = 1000; + + protected List innerCircleVals = new List(); + + protected int kaFactor = 60 / 2; + + protected int maxVal = 1000; + + protected List outerCircleVals = new List(); + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected IConfiguration config { get; set; } = null!; /// /// CSS Class bordo da stato macchina /// - protected string borderCss + protected string cssClassBorder { get { - string answ = "border-2"; + string answ = "border-3"; if (RecMSE != null) { switch (RecMSE.Semaforo) @@ -117,7 +122,6 @@ namespace MP_TAB3.Components answ += " border-danger"; break; - case "sGr": answ += " border-dark"; break; @@ -140,14 +144,30 @@ namespace MP_TAB3.Components } /// - /// CSS calss x testo (se descr lunga scorre...) + /// CSS Class x overlay (effetto spento x macchina spenta/ sGr) /// - protected string textDescrCss + protected string cssClassOverlay + { + get + { + string answ = ""; + if (RecMSE != null) + { + answ = RecMSE.Semaforo == "sGr" ? "bg-dark opacity-50" : ""; + } + return answ; + } + } + + /// + /// CSS class x testo (se descr lunga scorre...) + /// + protected string cssClassTextDescr { get { string answ = "text-nowrap"; - if (RecMSE != null && RecMSE.DescrizioneStato.Length > 18) + if (RecMSE != null && RecMSE.DescrizioneStato.Length >= 17) { answ = " scroll-left"; } @@ -155,22 +175,6 @@ namespace MP_TAB3.Components } } - #region Protected Fields - - protected string baseCss = "sem"; - protected int currMaxVal = 1000; - protected List innerCircleVals = new List(); - protected int kaFactor = 60 / 2; - protected int maxVal = 1000; - protected List outerCircleVals = new List(); - - #endregion Protected Fields - - #region Protected Properties - - [Inject] - protected IConfiguration config { get; set; } = null!; - protected ProdAdvDispl.ProdCounter CurrCount { get @@ -217,18 +221,18 @@ namespace MP_TAB3.Components { if (firstRender) { - //await getWDim(); await InvokeAsync(StateHasChanged); } isLoading = RecMSE == null; isMobile = await JSRuntime.InvokeAsync("isDevice"); await Task.Delay(1); - //return base.OnAfterRenderAsync(firstRender); } protected override async Task OnInitializedAsync() { isLoading = true; + // abilitazione disegni... + TabDServ.ConfigGetVal("enableDisegno", ref enableDisegno); // se configurata uso cartella virtuale... altrimenti cartella processo var sImgBasePath = config.GetValue("OptConf:ImgBasePath"); if (!string.IsNullOrEmpty(sImgBasePath)) @@ -318,6 +322,7 @@ namespace MP_TAB3.Components #region Private Fields private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private bool enableDisegno = false; private string imgBasePath = ""; private bool isLoading = false; diff --git a/MP-TAB3/Components/MachineBlock.razor.css b/MP-TAB3/Components/MachineBlock.razor.css index 536f7f6f..461d2fd7 100644 --- a/MP-TAB3/Components/MachineBlock.razor.css +++ b/MP-TAB3/Components/MachineBlock.razor.css @@ -1,16 +1,4 @@ -/* Bordi */ -/*.rCAll { - border-radius: 10px; -} - -.rCTop { - border-radius: 10px 10px 0 0; -} - -.rCBot { - border-radius: 0 0 10px 10px; -}*/ -.mapBlock { +.mapBlock { font-family: 'Open Sans Condensed', sans-serif; color: #FFF; background-image: linear-gradient(#111, #000); @@ -35,7 +23,6 @@ position: relative; width: 70%; white-space: nowrap; - /*display: inline-block;*/ } .scroll-left span { /*display: inline-block;*/ @@ -69,9 +56,6 @@ .sVe { text-align: left; background: #198754; - /*background: rgba(0,255,80,.6);*/ - /*padding: 0px 4px 0px 4px;*/ - /*color: Yellow;*/ color: #fff; } .sGi { @@ -79,21 +63,17 @@ background: #ffc107; background: rgba(255, 220, 0, 0.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } .sRo { text-align: left; background-color: #e2001a; background: rgba(240, 0, 10, 0.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } .sBl { text-align: left; background: #3690FF; background: rgba(0, 80, 255, 0.6); - /*padding: 0px 4px 0px 4px;*/ - /*color: Yellow;*/ color: #fff; } .sGr { @@ -101,18 +81,19 @@ background-color: #bcbcbc; background: rgba(180, 180, 180, 0.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } /*end semafori */ .card-body { background-color: currentColor; background-image: linear-gradient(121deg, rgba(255, 255, 255, 0.2) -0.71%, rgba(255, 255, 255, 0.05) 97.66%); - border-radius: 0 0 15px 15px; } .imgFitToSize { height: 11rem; object-fit: cover; - border-radius: 15px 15px 0 0; +} +.pholderHeight { + height: 6rem; + object-fit: cover; } @media (max-width: 640.98px) { .imgFitToSize { @@ -121,7 +102,7 @@ .card-body { background-color: transparent; } -} -.statusCard { - border-radius: 0.5rem; + .pholderHeight { + height: 4rem; + } } \ No newline at end of file diff --git a/MP-TAB3/Components/MachineBlock.razor.less b/MP-TAB3/Components/MachineBlock.razor.less index 1a4ffc33..2ef91c54 100644 --- a/MP-TAB3/Components/MachineBlock.razor.less +++ b/MP-TAB3/Components/MachineBlock.razor.less @@ -1,16 +1,4 @@ -/* Bordi */ -/*.rCAll { - border-radius: 10px; -} - -.rCTop { - border-radius: 10px 10px 0 0; -} - -.rCBot { - border-radius: 0 0 10px 10px; -}*/ - + .mapBlock { font-family: 'Open Sans Condensed', sans-serif; color: #FFF; @@ -37,7 +25,6 @@ position: relative; width: 70%; white-space: nowrap; - /*display: inline-block;*/ } .scroll-left span { @@ -72,9 +59,6 @@ .sVe { text-align: left; background: #198754; - /*background: rgba(0,255,80,.6);*/ - /*padding: 0px 4px 0px 4px;*/ - /*color: Yellow;*/ color: #fff; } @@ -83,7 +67,6 @@ background: #ffc107; background: rgba(255,220,0,.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } .sRo { @@ -91,15 +74,12 @@ background-color: #e2001a; background: rgba(240,0,10,.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } .sBl { text-align: left; background: #3690FF; background: rgba(0,80,255,.6); - /*padding: 0px 4px 0px 4px;*/ - /*color: Yellow;*/ color: #fff; } @@ -108,19 +88,21 @@ background-color: #bcbcbc; background: rgba(180,180,180,.6); color: #fff; - /*padding: 0px 4px 0px 4px;*/ } /*end semafori */ .card-body { background-color: currentColor; background-image: linear-gradient(121deg, rgba(255, 255, 255, 0.20) -0.71%, rgba(255, 255, 255, 0.05) 97.66%); - border-radius: 0 0 15px 15px } .imgFitToSize { height: 11rem; object-fit: cover; - border-radius: 15px 15px 0 0; +} + +.pholderHeight { + height: 6rem; + object-fit: cover; } @media (max-width: 640.98px){ @@ -130,11 +112,9 @@ .card-body{ background-color: transparent; } + .pholderHeight { + height: 4rem; + } } - - -.statusCard { - border-radius: 0.5rem; -} diff --git a/MP-TAB3/Components/MachineBlock.razor.min.css b/MP-TAB3/Components/MachineBlock.razor.min.css index 4b64d50a..04344d49 100644 --- a/MP-TAB3/Components/MachineBlock.razor.min.css +++ b/MP-TAB3/Components/MachineBlock.razor.min.css @@ -1 +1 @@ -.mapBlock{font-family:'Open Sans Condensed',sans-serif;color:#fff;background-image:linear-gradient(#111,#000);min-width:8em;}.labelTop{padding:.1em;width:auto;min-height:0;top:0;left:auto;bottom:auto;color:#fff;background:#2200de;background:rgba(33,36,39,.75);border-radius:15px 15px 0 0;}.scroll-left{height:1.5em;overflow:hidden;position:relative;width:70%;white-space:nowrap;}.scroll-left span{position:absolute;width:100%;height:100%;margin:0;line-height:1.5em;-moz-transform:translateX(0%);-webkit-transform:translateX(0%);transform:translateX(0%);-moz-animation:scroll-left 8s ease infinite;-webkit-animation:scroll-left 8s ease infinite;animation:scroll-left 8s ease infinite;}@keyframes scroll-left{0%{transform:translateX(0%);}30%{transform:translateX(0%);}80%{transform:translateX(-50%);}}.sVe{text-align:left;background:#198754;color:#fff;}.sGi{text-align:left;background:#ffc107;background:rgba(255,220,0,.6);color:#fff;}.sRo{text-align:left;background-color:#e2001a;background:rgba(240,0,10,.6);color:#fff;}.sBl{text-align:left;background:#3690ff;background:rgba(0,80,255,.6);color:#fff;}.sGr{text-align:left;background-color:#bcbcbc;background:rgba(180,180,180,.6);color:#fff;}.card-body{background-color:currentColor;background-image:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);border-radius:0 0 15px 15px;}.imgFitToSize{height:11rem;object-fit:cover;border-radius:15px 15px 0 0;}@media(max-width:640.98px){.imgFitToSize{height:8rem;}.card-body{background-color:transparent;}}.statusCard{border-radius:.5rem;} \ No newline at end of file +.mapBlock{font-family:'Open Sans Condensed',sans-serif;color:#fff;background-image:linear-gradient(#111,#000);min-width:8em;}.labelTop{padding:.1em;width:auto;min-height:0;top:0;left:auto;bottom:auto;color:#fff;background:#2200de;background:rgba(33,36,39,.75);border-radius:15px 15px 0 0;}.scroll-left{height:1.5em;overflow:hidden;position:relative;width:70%;white-space:nowrap;}.scroll-left span{position:absolute;width:100%;height:100%;margin:0;line-height:1.5em;-moz-transform:translateX(0%);-webkit-transform:translateX(0%);transform:translateX(0%);-moz-animation:scroll-left 8s ease infinite;-webkit-animation:scroll-left 8s ease infinite;animation:scroll-left 8s ease infinite;}@keyframes scroll-left{0%{transform:translateX(0%);}30%{transform:translateX(0%);}80%{transform:translateX(-50%);}}.sVe{text-align:left;background:#198754;color:#fff;}.sGi{text-align:left;background:#ffc107;background:rgba(255,220,0,.6);color:#fff;}.sRo{text-align:left;background-color:#e2001a;background:rgba(240,0,10,.6);color:#fff;}.sBl{text-align:left;background:#3690ff;background:rgba(0,80,255,.6);color:#fff;}.sGr{text-align:left;background-color:#bcbcbc;background:rgba(180,180,180,.6);color:#fff;}.card-body{background-color:currentColor;background-image:linear-gradient(121deg,rgba(255,255,255,.2) -.71%,rgba(255,255,255,.05) 97.66%);}.imgFitToSize{height:11rem;object-fit:cover;}.pholderHeight{height:6rem;object-fit:cover;}@media(max-width:640.98px){.imgFitToSize{height:8rem;}.card-body{background-color:transparent;}.pholderHeight{height:4rem;}} \ No newline at end of file diff --git a/MP-TAB3/Components/MseSampler.razor b/MP-TAB3/Components/MseSampler.razor deleted file mode 100644 index 5f282702..00000000 --- a/MP-TAB3/Components/MseSampler.razor +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/MP-TAB3/Components/MseSampler.razor.cs b/MP-TAB3/Components/MseSampler.razor.cs deleted file mode 100644 index 8f32699b..00000000 --- a/MP-TAB3/Components/MseSampler.razor.cs +++ /dev/null @@ -1,162 +0,0 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; -using NLog; - -namespace MP_TAB3.Components -{ - public partial class MseSampler : IDisposable - { - #region Public Properties - - [Parameter] - public EventCallback> E_Updated { get; set; } - - /// Moltiplicatore campionamento: - /// HF: se > 1 (mappa) - /// LF: se < 1 (dettaglio) - [Parameter] - public double SampleMult { get; set; } = 1; - - #endregion Public Properties - - #region Public Methods - - public void Dispose() - { - if (aTimer != null) - { - disposeTimer(); - } - } - - #endregion Public Methods - - #region Protected Fields - - protected int fastTimerMSec = 3000; - - #endregion Protected Fields - - #region Protected Properties - - [Inject] - protected IConfiguration config { get; set; } = null!; - - protected int fastRefreshMs - { - get - { - // tempo variabile tra +/- 10% del target (SampleMult) della freq standard di update MSE - int answ = ((int)(fastTimerMSec / SampleMult * rnd.Next(900, 1100))) / 1000; - return answ; - } - } - - [Inject] - protected MessageService MServ { get; set; } = null!; - - [Inject] - protected StatusData SDService { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - - protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) - { - try - { - var pUpd = Task.Run(async () => - { - numCall++; - // se supero limite --> resetto - if (numCall >= maxCall) - { - StartTimer(); - numCall = 0; - } - else - { - aTimer.Interval = fastRefreshMs; - await InvokeAsync(RefreshData); - } - }); - pUpd.Wait(); - } - catch (Exception exc) - { - Log.Error($"Eccezione durante MseSampler.ElapsedTimer{Environment.NewLine}{exc}"); - } - } - - protected override void OnInitialized() - { - SetupConf(); - StartTimer(); - } - - protected void StartTimer() - { - if (aTimer != null) - { - disposeTimer(); - } - aTimer = new System.Timers.Timer(fastRefreshMs); - aTimer.Elapsed += ElapsedTimer; - aTimer.Enabled = true; - aTimer.Start(); - Log.Info("MseSampler Timer started!"); - } - - #endregion Protected Methods - - #region Private Fields - - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - - private System.Timers.Timer aTimer = null!; - - /// - /// max chimate prima di fare dispose/GC - /// - private int maxCall = 10; - - /// - /// Numero chiamate al sampler - /// - private int numCall = 0; - - private Random rnd = new Random(); - - #endregion Private Fields - - #region Private Methods - - private void disposeTimer() - { - aTimer.Elapsed -= ElapsedTimer; - aTimer.Stop(); - aTimer.Dispose(); - GC.Collect(); - Log.Info("MseSampler Timer Disposed!"); - } - - private async Task RefreshData() - { - List ListMSE = await SDService.MseGetAll(); - await MServ.SaveMse(ListMSE); - await E_Updated.InvokeAsync(ListMSE); - } - - private void SetupConf() - { - // sistemo i parametri opzionali... - fastTimerMSec = config.GetValue("OptConf:msRefresh"); - maxCall = config.GetValue("OptConf:samplerMaxCall"); - Log.Trace($"MseSampler setupConf | Effettuato setup parametri | fastRefreshMSec: {fastTimerMSec} | maxCall: {maxCall}"); - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP-TAB3/Components/ProdStopMan.razor b/MP-TAB3/Components/ProdStopMan.razor index fc8b18af..4c503858 100644 --- a/MP-TAB3/Components/ProdStopMan.razor +++ b/MP-TAB3/Components/ProdStopMan.razor @@ -1,4 +1,4 @@ -
+
diff --git a/MP-TAB3/Components/ScrapEditor.razor b/MP-TAB3/Components/ScrapEditor.razor index 3a89797c..12545c99 100644 --- a/MP-TAB3/Components/ScrapEditor.razor +++ b/MP-TAB3/Components/ScrapEditor.razor @@ -42,11 +42,11 @@
- @foreach (var item in ListComplete) + @foreach (var item in listCauScarto) {
diff --git a/MP-TAB3/Components/ScrapEditor.razor.cs b/MP-TAB3/Components/ScrapEditor.razor.cs index e339a29d..96ef8169 100644 --- a/MP-TAB3/Components/ScrapEditor.razor.cs +++ b/MP-TAB3/Components/ScrapEditor.razor.cs @@ -32,7 +32,7 @@ namespace MP_TAB3.Components } protected string errMsg { get; set; } = ""; - protected List ListComplete { get; set; } = new List(); + protected List listCauScarto { get; set; } = new List(); [Inject] protected MessageService MServ { get; set; } = null!; @@ -124,7 +124,11 @@ namespace MP_TAB3.Components protected async Task ReloadData() { - ListComplete = await TabServ.VSCS_getAll(); + var rawData = await TabServ.VSCS_getAll(); + listCauScarto = rawData + .Where(x => x.isEnabled) + .OrderBy(x => x.label) + .ToList(); } protected void resetDate() diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 60e338b8..b9b8d4f5 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,13 +3,18 @@ net6.0 enable - 6.16.2402.2610 + 6.16.2402.2620 enable MP_TAB3 + + + + + diff --git a/MP-TAB3/Pages/Alarms.razor b/MP-TAB3/Pages/Alarms.razor index cba45328..f5d9ac9b 100644 --- a/MP-TAB3/Pages/Alarms.razor +++ b/MP-TAB3/Pages/Alarms.razor @@ -1,6 +1,6 @@ @page "/alarms" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/Alarms.razor.cs b/MP-TAB3/Pages/Alarms.razor.cs index de6fd6db..3826af2b 100644 --- a/MP-TAB3/Pages/Alarms.razor.cs +++ b/MP-TAB3/Pages/Alarms.razor.cs @@ -1,74 +1,15 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class Alarms : IDisposable + public partial class Alarms { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - #endregion Protected Methods - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/BasePage.razor b/MP-TAB3/Pages/BasePage.razor new file mode 100644 index 00000000..c65238fb --- /dev/null +++ b/MP-TAB3/Pages/BasePage.razor @@ -0,0 +1,2 @@ + + diff --git a/MP-TAB3/Pages/BasePage.razor.cs b/MP-TAB3/Pages/BasePage.razor.cs new file mode 100644 index 00000000..6045369a --- /dev/null +++ b/MP-TAB3/Pages/BasePage.razor.cs @@ -0,0 +1,160 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data; +using MP.Data.Services; +using Newtonsoft.Json; +using NLog.Fluent; + +namespace MP_TAB3.Pages +{ + /// + /// Pagina base da cui ereditare metodi x refresh dati da RedisChannel (MessagePipe) + /// + public partial class BasePage : IDisposable + { + #region Public Properties + + /// + /// Dato di dettaglio MSE per macchina + /// + public MappaStatoExpl? CurrMSE { get; set; } = null; + + /// + /// Macchina selezionata + /// + public string IdxMacc { get; set; } = ""; + + [Inject] + public MessageService MsgServ { get; set; } = null!; + + [Inject] + public TabDataFeeder TDFeeder { get; set; } = null!; + + #endregion Public Properties + + #region Public Methods + + /// + /// Metodo dispose + /// + public virtual void Dispose() + { + IdxMacc = ""; + CurrMSE = null; + TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage; + } + + #endregion Public Methods + + #region Protected Methods + + /// + /// Override Oninit x aggancio evento update da MessagePipe + /// + /// + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + await ReloadData(); + TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage; + } + + /// + /// Metodo refresh con controllo salvataggio in LocalStorage ogni 5 sec + /// + /// + /// + protected async Task RefreshData(List ListMSE) + { + // se vecchio salvo sul browser... + if (DateTime.Now.Subtract(lastSave).TotalSeconds > 5) + { + // salvo in LocalStorage... + await MsgServ.SaveMse(ListMSE); + lastSave = DateTime.Now; + } + if (!string.IsNullOrEmpty(IdxMacc)) + { + var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); + if (rawData != null) + { + CurrMSE = rawData; + } + else + { + await RefreshMBlock(); + } + } + } + + /// + /// Refresh con rilettura da LocalStorage + /// + /// + protected async Task RefreshMBlock() + { + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + } + + #endregion Protected Methods + + #region Private Fields + + /// + /// DateTime ultimo salvataggio in LocalStorage + /// + private DateTime lastSave = DateTime.Now; + + #endregion Private Fields + + #region Private Methods + + /// + /// Ricevuto nuovi dati da mostrare! + /// + /// + /// + /// + private void DataPipe_EA_NewMessage(object? sender, EventArgs e) + { + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly List --> allarmi + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + try + { + List? dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); + if (dataList != null) + { + InvokeAsync(() => RefreshData(dataList)); + } + } + catch + { } + } + InvokeAsync(() => + { + StateHasChanged(); + }); + } + + protected virtual async Task ReloadData() + { + if (string.IsNullOrEmpty(IdxMacc)) + { + IdxMacc = await MsgServ.IdxMaccGet(); + } + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP-TAB3/Pages/Controls.razor b/MP-TAB3/Pages/Controls.razor index 8a35b6c9..7892ea01 100644 --- a/MP-TAB3/Pages/Controls.razor +++ b/MP-TAB3/Pages/Controls.razor @@ -1,6 +1,6 @@ @page "/controls" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null || IsLoading) { diff --git a/MP-TAB3/Pages/Controls.razor.cs b/MP-TAB3/Pages/Controls.razor.cs index 0668beed..5063203f 100644 --- a/MP-TAB3/Pages/Controls.razor.cs +++ b/MP-TAB3/Pages/Controls.razor.cs @@ -1,29 +1,14 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class Controls : IDisposable + public partial class Controls { #region Public Methods - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } #endregion Public Methods #region Protected Properties - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; #endregion Protected Properties @@ -38,27 +23,10 @@ namespace MP_TAB3.Pages protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - protected void SetMacc(string selIdxMacc) { IdxMaccSubSel = selIdxMacc; @@ -69,24 +37,14 @@ namespace MP_TAB3.Pages #region Private Fields private string IdxMaccSubSel = ""; + private bool IsLoading = false; #endregion Private Fields #region Private Methods - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } + #endregion Private Methods } diff --git a/MP-TAB3/Pages/Declarations.razor b/MP-TAB3/Pages/Declarations.razor index bdb96323..313b80e4 100644 --- a/MP-TAB3/Pages/Declarations.razor +++ b/MP-TAB3/Pages/Declarations.razor @@ -1,6 +1,7 @@ @page "/declarations" +@inherits BasePage + - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/Declarations.razor.cs b/MP-TAB3/Pages/Declarations.razor.cs index ab991087..5c213f37 100644 --- a/MP-TAB3/Pages/Declarations.razor.cs +++ b/MP-TAB3/Pages/Declarations.razor.cs @@ -1,57 +1,15 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class Declarations : IDisposable + public partial class Declarations { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - protected void SetMacc(string selIdxMacc) { IdxMaccSubSel = selIdxMacc; @@ -64,22 +22,5 @@ namespace MP_TAB3.Pages private string IdxMaccSubSel = ""; #endregion Private Fields - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/Index.razor.cs b/MP-TAB3/Pages/Index.razor.cs index 3c9cb87a..746aa7a8 100644 --- a/MP-TAB3/Pages/Index.razor.cs +++ b/MP-TAB3/Pages/Index.razor.cs @@ -1,3 +1,11 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data; +using MP.Data.Services; +using MP_TAB3.Shared; +using NLog.Fluent; +using Newtonsoft.Json; + namespace MP_TAB3.Pages { public partial class Index : IDisposable @@ -18,16 +26,6 @@ namespace MP_TAB3.Pages await Task.Delay(1); } - protected override async Task OnInitializedAsync() - { - await Task.Delay(1); - } - - protected override async Task OnParametersSetAsync() - { - await Task.Delay(1); - } - #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/IobInfo.razor b/MP-TAB3/Pages/IobInfo.razor index 35077c37..23e0b152 100644 --- a/MP-TAB3/Pages/IobInfo.razor +++ b/MP-TAB3/Pages/IobInfo.razor @@ -1,6 +1,6 @@ @page "/iob-info" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/IobInfo.razor.cs b/MP-TAB3/Pages/IobInfo.razor.cs index d33ea89f..697e057a 100644 --- a/MP-TAB3/Pages/IobInfo.razor.cs +++ b/MP-TAB3/Pages/IobInfo.razor.cs @@ -1,74 +1,15 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class IobInfo : IDisposable + public partial class IobInfo { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - #endregion Protected Methods - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/MachineDetail.razor b/MP-TAB3/Pages/MachineDetail.razor index 08344cab..4f85bf6d 100644 --- a/MP-TAB3/Pages/MachineDetail.razor +++ b/MP-TAB3/Pages/MachineDetail.razor @@ -1,6 +1,7 @@ @page "/machine-detail" - +@inherits BasePage + @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/MachineDetail.razor.cs b/MP-TAB3/Pages/MachineDetail.razor.cs index a74043db..b3665fac 100644 --- a/MP-TAB3/Pages/MachineDetail.razor.cs +++ b/MP-TAB3/Pages/MachineDetail.razor.cs @@ -1,31 +1,13 @@ using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; using MP.Data.Services; using NLog; namespace MP_TAB3.Pages { - public partial class MachineDetail : IDisposable + public partial class MachineDetail { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - #region Protected Properties - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - [Inject] protected SharedMemService MStor { get; set; } = null!; @@ -38,39 +20,15 @@ namespace MP_TAB3.Pages protected override async Task OnInitializedAsync() { - await ReloadData(); + await base.OnInitializedAsync(); + // recupero parametri configurazione... + await setupConf(); if (enableSchedaTecnica) { checkLottiOdl(); } } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await RefreshMBlock(); - } - } - } - - protected async Task RefreshMBlock() - { - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - protected void SetMacc(string selIdxMacc) { IdxMaccSubSel = selIdxMacc; @@ -84,6 +42,7 @@ namespace MP_TAB3.Pages private bool enableMagLotti = false; private bool enableSchedaTecnica = false; private string IdxMaccSubSel = ""; + private DateTime lastSave = DateTime.Now; #endregion Private Fields @@ -113,27 +72,7 @@ namespace MP_TAB3.Pages #endif } - private async Task ReloadData() - { - try - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - } - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - catch (Exception exc) - { - Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); - } - // recupero parametri configurazione... - await setupConf(); - } + private async Task setupConf() { diff --git a/MP-TAB3/Pages/Notes.razor b/MP-TAB3/Pages/Notes.razor index de63c2db..605e8610 100644 --- a/MP-TAB3/Pages/Notes.razor +++ b/MP-TAB3/Pages/Notes.razor @@ -1,6 +1,6 @@ @page "/notes" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/Notes.razor.cs b/MP-TAB3/Pages/Notes.razor.cs index 62ac74b4..b3a17ebd 100644 --- a/MP-TAB3/Pages/Notes.razor.cs +++ b/MP-TAB3/Pages/Notes.razor.cs @@ -1,74 +1,15 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class Notes : IDisposable + public partial class Notes { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - #endregion Protected Methods - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/ODL.razor b/MP-TAB3/Pages/ODL.razor index 85cdcb6b..daf48433 100644 --- a/MP-TAB3/Pages/ODL.razor +++ b/MP-TAB3/Pages/ODL.razor @@ -1,6 +1,6 @@ @page "/odl" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/ODL.razor.cs b/MP-TAB3/Pages/ODL.razor.cs index 238d4da1..9ce9d862 100644 --- a/MP-TAB3/Pages/ODL.razor.cs +++ b/MP-TAB3/Pages/ODL.razor.cs @@ -1,64 +1,12 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; -using NLog; - namespace MP_TAB3.Pages { - public partial class ODL : IDisposable + public partial class ODL { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { - await ReloadData(); - } - - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await RefreshMBlock(); - } - } - } - - protected async Task RefreshMBlock() - { - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } + await base.OnInitializedAsync(); } protected void SetMacc(string selIdxMacc) @@ -70,33 +18,8 @@ namespace MP_TAB3.Pages #region Private Fields - private static Logger Log = LogManager.GetCurrentClassLogger(); private string IdxMaccSubSel = ""; #endregion Private Fields - - #region Private Methods - - private async Task ReloadData() - { - try - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - } - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - catch (Exception exc) - { - Log.Error($"Eccezione in ReloadData{Environment.NewLine}{exc}"); - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/Parameters.razor b/MP-TAB3/Pages/Parameters.razor index 3ecd6b07..92671371 100644 --- a/MP-TAB3/Pages/Parameters.razor +++ b/MP-TAB3/Pages/Parameters.razor @@ -1,7 +1,6 @@ @page "/parameters" +@inherits BasePage - - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/Parameters.razor.cs b/MP-TAB3/Pages/Parameters.razor.cs index b4cddaaa..7e1680d4 100644 --- a/MP-TAB3/Pages/Parameters.razor.cs +++ b/MP-TAB3/Pages/Parameters.razor.cs @@ -1,74 +1,14 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; - namespace MP_TAB3.Pages { - public partial class Parameters : IDisposable + public partial class Parameters { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { - await ReloadData(); - } - - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); + await base.OnInitializedAsync(); } #endregion Protected Methods - - #region Private Methods - - private async Task ReloadData() - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/ProdPlan.razor b/MP-TAB3/Pages/ProdPlan.razor index 4130f6ac..6dae82d0 100644 --- a/MP-TAB3/Pages/ProdPlan.razor +++ b/MP-TAB3/Pages/ProdPlan.razor @@ -1,6 +1,6 @@ @page "/prod-plan" +@inherits BasePage - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/ProdPlan.razor.cs b/MP-TAB3/Pages/ProdPlan.razor.cs index c7e206f2..4c08742e 100644 --- a/MP-TAB3/Pages/ProdPlan.razor.cs +++ b/MP-TAB3/Pages/ProdPlan.razor.cs @@ -1,88 +1,15 @@ -using global::Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; -using NLog; - namespace MP_TAB3.Pages { - public partial class ProdPlan : IDisposable + public partial class ProdPlan { - #region Public Methods - - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - - #endregion Public Methods - - #region Protected Properties - - protected MappaStatoExpl? CurrMSE { get; set; } = null; - protected string IdxMacc { get; set; } = ""; - - [Inject] - protected MessageService MsgServ { get; set; } = null!; - - #endregion Protected Properties - #region Protected Methods protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - await InvokeAsync(StateHasChanged); - } - #endregion Protected Methods - - #region Private Fields - - private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); - - #endregion Private Fields - - #region Private Methods - - private async Task ReloadData() - { - try - { - if (string.IsNullOrEmpty(IdxMacc)) - { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); - } - } - } - catch (Exception exc) - { - Log.Error($"Eccerione in ReloadData{Environment.NewLine}{exc}"); - } - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP-TAB3/Pages/ProdStop.razor b/MP-TAB3/Pages/ProdStop.razor index 12aa29a2..e7f1d040 100644 --- a/MP-TAB3/Pages/ProdStop.razor +++ b/MP-TAB3/Pages/ProdStop.razor @@ -1,7 +1,6 @@ @page "/prod-stop" +@inherits BasePage - - @if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null) { diff --git a/MP-TAB3/Pages/ProdStop.razor.cs b/MP-TAB3/Pages/ProdStop.razor.cs index 2a167041..bf96c3ab 100644 --- a/MP-TAB3/Pages/ProdStop.razor.cs +++ b/MP-TAB3/Pages/ProdStop.razor.cs @@ -7,26 +7,24 @@ using NLog; namespace MP_TAB3.Pages { - public partial class ProdStop : IDisposable + public partial class ProdStop { #region Public Methods - public void Dispose() - { - IdxMacc = ""; - CurrMSE = null; - //GC.Collect(); - } - #endregion Public Methods #region Protected Fields protected int dltMinRealtime = 1; + protected bool isProcessing = false; + protected int minAnticipoRicalcolo = 1; + protected bool rdm_ChkOnly = false; + protected int rdm_nEvCheck = 1; + protected int rdm_nEvStep = 1; #endregion Protected Fields @@ -35,13 +33,11 @@ namespace MP_TAB3.Pages protected string alertCss { get; set; } = "alert-danger"; - protected MappaStatoExpl? CurrMSE { get; set; } = null; protected DateTime DtRif { get; set; } = DateTime.Now; protected List events2show { get; set; } = new List(); - protected string IdxMacc { get; set; } = ""; /// /// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra @@ -65,9 +61,6 @@ namespace MP_TAB3.Pages [Inject] protected StatusData MDataService { get; set; } = null!; - [Inject] - protected MessageService MServ { get; set; } = null!; - [Inject] protected NavigationManager NavMan { get; set; } = null!; @@ -209,7 +202,7 @@ namespace MP_TAB3.Pages if (ListMSE != null) { // salvo in LocalStorage... - await MServ.SaveMse(ListMSE); + await MsgServ.SaveMse(ListMSE); // aggiorno MSE attuale CurrMSE = ListMSE.Find(x => x.IdxMacchina == IdxMacc); } @@ -217,13 +210,14 @@ namespace MP_TAB3.Pages // se non era realtime --> rimando a commenti if (needReload) { - await MServ.LastOpenedPageSet("notes"); + await MsgServ.LastOpenedPageSet("notes"); NavMan.NavigateTo("notes"); } } protected override async Task OnInitializedAsync() { + await base.OnInitializedAsync(); dltMinRealtime = SMServ.GetConfInt("dltMinRealtime"); minAnticipoRicalcolo = SMServ.GetConfInt("minAnticipoRicalcolo"); rdm_nEvStep = SMServ.GetConfInt("rdm_nEvStep"); @@ -233,22 +227,7 @@ namespace MP_TAB3.Pages await ReloadData(); } - protected async Task RefreshData(List newList) - { - var ListMSE = newList; - if (!string.IsNullOrEmpty(IdxMacc)) - { - var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc); - if (rawData != null) - { - CurrMSE = rawData; - } - else - { - await ReloadData(); - } - } - } + protected void SetDate(DateTime newDate) { @@ -267,25 +246,23 @@ namespace MP_TAB3.Pages private int MatrOpr { - get => MServ.MatrOpr; + get => MsgServ.MatrOpr; } #endregion Private Properties #region Private Methods - private async Task ReloadData() + + + protected override async Task ReloadData() { if (string.IsNullOrEmpty(IdxMacc)) { try { - IdxMacc = await MServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) - { - CurrMSE = await MServ.GetMachineMse(IdxMacc); - } + await base.ReloadData(); + // recupero eventi var eventsAll = await TabDServ.AnagEventiGetByMacch(IdxMacc); if (eventsAll != null) { @@ -295,7 +272,7 @@ namespace MP_TAB3.Pages catch (Exception exc) { Log.Error($"ProdStop: Eccezione in reloadData {Environment.NewLine}{exc}"); - await MServ.LastOpenedPageSet("/"); + await MsgServ.LastOpenedPageSet("/"); } } } diff --git a/MP-TAB3/Pages/RegNewDevice.razor b/MP-TAB3/Pages/RegNewDevice.razor index acfef946..f16cb53f 100644 --- a/MP-TAB3/Pages/RegNewDevice.razor +++ b/MP-TAB3/Pages/RegNewDevice.razor @@ -41,12 +41,12 @@ } -@if (oprsList.Count > 0) +@if (oprList.Count > 0) {
Selezionare un operatore