diff --git a/MP.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index eb878fcf..c780a273 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 6.15.2207.2109 + 6.15.2209.1411 diff --git a/MP.Mon/Resources/ChangeLog.html b/MP.Mon/Resources/ChangeLog.html index 0df402d4..b334d059 100644 --- a/MP.Mon/Resources/ChangeLog.html +++ b/MP.Mon/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MON MAPO - Versione: 6.15.2207.2109 + Versione: 6.15.2209.1411 Note di rilascio: diff --git a/MP.Mon/Resources/VersNum.txt b/MP.Mon/Resources/VersNum.txt index 787e6afc..c9f07ebe 100644 --- a/MP.Mon/Resources/VersNum.txt +++ b/MP.Mon/Resources/VersNum.txt @@ -1 +1 @@ -6.15.2207.2109 +6.15.2209.1411 diff --git a/MP.Mon/Resources/manifest.xml b/MP.Mon/Resources/manifest.xml index a7d53eb8..79d28715 100644 --- a/MP.Mon/Resources/manifest.xml +++ b/MP.Mon/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.15.2207.2109 + 6.15.2209.1411 https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/Components/CmpFooter.razor.cs b/MP.SPEC/Components/CmpFooter.razor.cs index 293e02d7..56efcd29 100644 --- a/MP.SPEC/Components/CmpFooter.razor.cs +++ b/MP.SPEC/Components/CmpFooter.razor.cs @@ -38,13 +38,6 @@ namespace MP.SPEC.Components #region Protected Methods - protected override void OnInitialized() - { - var currAssembly = typeof(Program).Assembly.GetName(); - version = currAssembly.Version != null ? currAssembly.Version : new Version(); - StartTimer(); - } - #endregion Protected Methods #region Private Fields diff --git a/MP.SPEC/Components/ListPARAMS.razor b/MP.SPEC/Components/ListPARAMS.razor new file mode 100644 index 00000000..abd14f91 --- /dev/null +++ b/MP.SPEC/Components/ListPARAMS.razor @@ -0,0 +1,62 @@ +@using MP.SPEC.Components +@using MP.SPEC.Data + +@if (ListRecords == null) +{ + +} +else if (totalCount == 0) +{ + Nessun record trovato +} +else +{ + + + + + + + @* resetSel()" class="btn btn-primary btn-sm">*@ + + Data + Macchina + Flusso + Valore + + + + + @foreach (var record in ListRecords) + { + + + @* selRecord(record)" class="btn btn-primary btn-sm">*@ + + + @record.dtEvento + + + @record.IdxMacchina + + + @record.CodFlux + + + @record.Valore + + + @*@if (ArticoloDelEnabled(record.CodArticolo)) + { + deleteRecord(record)" class="btn btn-danger btn-sm"> + }*@ + + + } + + + + +} + + diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs new file mode 100644 index 00000000..1813e0b2 --- /dev/null +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -0,0 +1,158 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.SPEC.Data; + +namespace MP.SPEC.Components +{ + public partial class ListPARAMS + { + #region Public Properties + + [Parameter] + public EventCallback PagerResetReq { get; set; } + + [Parameter] + public string SelMacchina + { + get => _statoMacchina; + set + { + if (_statoMacchina != value) + { + _statoMacchina = value; + var pUpd = Task.Run(async () => await reloadData()); + pUpd.Wait(); + } + } + } + + #endregion Public Properties + + #region Public Methods + + + + public string checkSelect(string IdxMacchina) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.IdxMacchina == IdxMacchina) ? "table-info" : ""; + } + catch + { } + } + return answ; + } + + #endregion Public Methods + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected MpDataService MDService { get; set; } = null!; + + [Inject] + protected MessageService MessageService { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + MessageService.EA_PageUpdated += MessageService_EA_PageUpdated; + MessageService.EA_SearchUpdated += OnSeachUpdated; + + await reloadData(); + } + + protected async void OnSeachUpdated() + { + await InvokeAsync(() => + { + PagerResetReq.InvokeAsync(true); + //currPage = 1; + Task task = UpdateData(); + StateHasChanged(); + }); + } + + protected async Task UpdateData() + { + currRecord = null; + await reloadData(); + } + + #endregion Protected Methods + + #region Private Fields + + + + private string _statoMacchina = "*"; + + private FluxLog? currRecord = null; + + private List? ListRecords; + + private List? SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int currPage + { + get => MessageService.currPage; + set => MessageService.currPage = value; + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => MessageService.numRecord; + set => MessageService.numRecord = value; + } + + private string SearchVal + { + get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal; + } + + private int totalCount + { + get => MessageService.totalCount; + set => MessageService.totalCount = value; + } + + #endregion Private Properties + + #region Private Methods + + private async void MessageService_EA_PageUpdated() + { + await reloadData(); + } + + public async Task reloadData() + { + isLoading = true; + SearchRecords = await MDService.FluxLogGetLastFilt(SelMacchina, "*", 300); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + isLoading = false; + } + + #endregion Private Methods + } +} diff --git a/MP.SPEC/Components/SearchMod.razor b/MP.SPEC/Components/SearchMod.razor index 4081aec0..9b4a379e 100644 --- a/MP.SPEC/Components/SearchMod.razor +++ b/MP.SPEC/Components/SearchMod.razor @@ -3,7 +3,7 @@ @inject MessageService AppMService - + diff --git a/MP.SPEC/Data/MessageService.cs b/MP.SPEC/Data/MessageService.cs index 79ca19ff..f734d170 100644 --- a/MP.SPEC/Data/MessageService.cs +++ b/MP.SPEC/Data/MessageService.cs @@ -8,6 +8,8 @@ public event Action EA_SearchUpdated; + public event Action EA_MacchUpdated; + public event Action EA_ShowSearch; public event Action EA_StatoSearch; @@ -64,6 +66,20 @@ //} } } + private string _selMacchina { get; set; } = "*"; + public string SelMacchina + { + get => _selMacchina; + set + { + _selMacchina = value; + + if (EA_MacchUpdated != null) + { + EA_MacchUpdated?.Invoke(); + } + } + } public bool ShowSearch { diff --git a/MP.SPEC/Pages/PARAMS.razor b/MP.SPEC/Pages/PARAMS.razor index bd1ba9a9..bd3106ef 100644 --- a/MP.SPEC/Pages/PARAMS.razor +++ b/MP.SPEC/Pages/PARAMS.razor @@ -1,31 +1,63 @@ @page "/PARAMS" + + + + + + + PARAMETERS + + + + Valori live + + + + + + + + + + + + + + + --- Tutti --- + @if (ListMacchine != null) + { + foreach (var item in ListMacchine) + { + @item.IdxMacchina + } + } + + + + + --- Tutti --- + @if (ListFlux != null) + { + foreach (var item in ListFlux) + { + @item + } + } + + + + + + *@ + + + + + + -PARAMS -Appunti (eliminabili) - - - - I parametri sono nella tabella FluxLog (in preparazione modello dati + metodi...) --> FluxLogGetLastFilt - - - scopo della apgina è mostrare in "quasi tempo reale" (near realtime) i parametri che si aggiornano - - - la pagina deve avere un card come PODL nel cui header siano mostrate elenco amchcine ed elenco parametri x mostrare tutti / solo uno (filtro) - - - MpDataService --> metodi per elenchi: MacchineGetAll e ParametriGetAll - - - il metodo principale recupera gli ultimi n record (configurabile? mostrare in alto un selettore x indicare quanti "last values" recuperare?) - - - il refgresh idealmente è ogni 2-5 sec (configurabile come sopra?) - - - -@code { - -} diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs new file mode 100644 index 00000000..22e316f2 --- /dev/null +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -0,0 +1,206 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.Data.DatabaseModels; +using MP.SPEC.Components; +using MP.SPEC.Data; + +namespace MP.SPEC.Pages +{ + public partial class PARAMS + { + #region Protected Properties + public void Dispose() + { + //aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + } + + public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + if (!isLoading) + { + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + await InvokeAsync(() => reloadData()); + }); + pUpd.Wait(); + } + } + + + public void StartTimer() + { + int tOutPeriod = 2000; + //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); + aTimer = new System.Timers.Timer(tOutPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + } + private static System.Timers.Timer aTimer = null!; + [Inject] + protected IJSRuntime JSRuntime { get; set; } + + [Inject] + protected MpDataService MDService { get; set; } + + [Inject] + protected MessageService MsgService { get; set; } + + [Inject] + protected NavigationManager NavManager { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + + protected async Task pgResetReq(bool doReset) + { + if (doReset) + { + await pagerODL.resetCurrPage(); + } + } + + protected DataPager pagerODL; + + protected bool reqNew = false; + + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task reqNewPODL() + { + reqNew = !reqNew; + await Task.Delay(1); + } + + protected override async Task OnInitializedAsync() + { + // abilito ricerca... + MsgService.ShowSearch = true; + // resetto search + MsgService.SearchVal = ""; + + MsgService.EA_MacchUpdated += MsgService_EA_MacchUpdated; + //ListAziende = await MDService.ElencoAziende(); + //ListStati = await MDService.AnagStatiComm(); + ListMacchine = await MDService.MacchineGetAll(); + StartTimer(); + // carico dati + await reloadData(); + + } + + private async void MsgService_EA_MacchUpdated() + { + await reloadData(); + } + + private string currAziend { get; set; } = "*"; + + private List? ListAziende; + + #endregion Protected Methods + + #region Private Fields + + private List? ListStati; + + private List? ListMacchine; + + private List? ListFlux; + + #endregion Private Fields + + #region Private Properties + + + + private int currPage + { + get => MsgService.currPage; + set => MsgService.currPage = value; + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => MsgService.numRecord; + set => MsgService.numRecord = value; + } + + + + private string selMacchina + { + get => MsgService.SelMacchina; + set => MsgService.SelMacchina = value; + } + private string selFlux { get; set; } = "*"; + +#if false + private string selStato + { + get => _selStato; + set + { + if (!_selStato.Equals(value)) + { + _selStato = value; + addEnabled = selStato != "*"; + ////StateHasChanged(); + //var pUpd = Task.Run(async () => + //{ + // //await reloadData(); + // await Task.Delay(1); + // await InvokeAsync(() => StateHasChanged()); + //}); + //pUpd.Wait(); + } + } + } +#endif + + + private bool addEnabled = false; + + private int totalCount + { + get => MsgService.totalCount; + set => MsgService.totalCount = value; + } + + #endregion Private Properties + + #region Private Methods + + private async Task reloadData() + { + isLoading = true; + await Task.Delay(1); + ListFlux = await MDService.ParametriGetFilt(selMacchina); + isLoading = false; + await Task.Delay(1); + } + + #endregion Private Methods + } +} diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index da5ea03f..d6bbde29 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -262,11 +262,11 @@ namespace MP.SPEC.Pages #region Private Methods - private async Task navToODL() - { - await Task.Delay(1); - NavManager.NavigateTo("/ODL"); - } + //private async Task navToODL() + //{ + // await Task.Delay(1); + // NavManager.NavigateTo("/ODL"); + //} private async Task reloadData() {
Appunti (eliminabili)