diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs index 4d21334c..20c982fc 100644 --- a/MP.Data/Controllers/MpStatsController.cs +++ b/MP.Data/Controllers/MpStatsController.cs @@ -1,13 +1,10 @@ -using System; +using Microsoft.Data.SqlClient; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using NLog; +using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Configuration; -using NLog; -using Microsoft.Extensions.Configuration; -using Microsoft.EntityFrameworkCore; -using Microsoft.Data.SqlClient; namespace MP.Data.Controllers { @@ -96,7 +93,7 @@ namespace MP.Data.Controllers } /// - /// Elenco tabella Macchine + /// Elenco da tabella Macchine /// /// public List MacchineGetAll() @@ -313,13 +310,6 @@ namespace MP.Data.Controllers List dbResult = new List(); using (var dbCtx = new MoonPro_STATSContext(_configuration)) { - //dbResult = dbCtx - // .DbSetUserLog - // .Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal)) - // .OrderByDescending(x => x.DataOraRif) - // .Take(numRecord) - // .ToList(); - var dataFrom = new SqlParameter("@dataFrom", DataStart); var dataTo = new SqlParameter("@dataTo", DataEnd); var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina); diff --git a/MP.Data/MoonPro_STATSContext.cs b/MP.Data/MoonPro_STATSContext.cs index f95c3ef2..02f17741 100644 --- a/MP.Data/MoonPro_STATSContext.cs +++ b/MP.Data/MoonPro_STATSContext.cs @@ -42,10 +42,6 @@ namespace MP.Data public virtual DbSet DbSetODL { get; set; } public virtual DbSet DbSetScarti { get; set; } public virtual DbSet DbSetTurniOee { get; set; } -#if false - public virtual DbSet DbSetTurniPareto { get; set; } - public virtual DbSet DbSetTurniParetoOdl { get; set; } -#endif public virtual DbSet DbSetUserLog { get; set; } #endregion Public Properties @@ -142,6 +138,7 @@ namespace MP.Data entity.Property(e => e.Nome).HasMaxLength(50); }); + modelBuilder.Entity(entity => { entity.HasNoKey(); diff --git a/MP.Stats/Components/ChartControlli.razor.cs b/MP.Stats/Components/ChartControlli.razor.cs index 32ba8fc7..8ac9c307 100644 --- a/MP.Stats/Components/ChartControlli.razor.cs +++ b/MP.Stats/Components/ChartControlli.razor.cs @@ -14,75 +14,6 @@ namespace MP.Stats.Components protected const string EsitoOK = "Esito: OK"; - protected object lineChartOptions = new - { - Scales = new - { - XAxes = new object[] - { - new { - Display = true - } - }, - YAxes = new object[] - { - new { - Display = true, - ticks= new { - suggestedMin = 0 - } - } - } - }, - Tooltips = new - { - Mode = "nearest", - Intersect = false - }, - Hover = new - { - Mode = "nearest", - Intersect = false - }, - Animation = false, - AspectRatio = 4.9 - }; - - protected object pieChartOptions = new - { - Scales = new - { - XAxes = new object[] - { - new { - Display = false - } - }, - YAxes = new object[] - { - new { - Display = false - } - } - }, - Legend = new - { - Display = false - }, - Tooltips = new - { - Mode = "nearest", - Intersect = false - }, - Hover = new - { - Mode = "nearest", - Intersect = false - }, - Animation = false, - AspectRatio = 1 - }; - #endregion Protected Fields #region Private Properties diff --git a/MP.Stats/Components/ChartOEE.razor.cs b/MP.Stats/Components/ChartOEE.razor.cs index a74d0f3a..06222f42 100644 --- a/MP.Stats/Components/ChartOEE.razor.cs +++ b/MP.Stats/Components/ChartOEE.razor.cs @@ -1,19 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using MP.Data; using MP.Stats.Data; +using System; +using System.Collections.Generic; +using System.Linq; namespace MP.Stats.Components { public partial class ChartOEE { - #region Protected Fields + #region Private Properties + private List DatiParetoOee + { + get => ParetoData.Select(x => x.value).ToList(); + } - #endregion Protected Fields + private List DatiTrs + { + get => TSData; + } + + private List LabelParetoOee + { + get => ParetoData.Select(x => x.label).ToList(); + } + + private List LabelTrs + { + get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); + } + + #endregion Private Properties #region Protected Properties @@ -21,6 +39,36 @@ namespace MP.Stats.Components protected List _rawData { get; set; } = new List(); + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List bgColors + { + get => semaphColors(ParetoData.Count, "0.3"); + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List lineColor + { + get => solidColors("1"); + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List lineColors + { + get => semaphColors(ParetoData.Count, "1"); + } + [Inject] protected MessageService MessageService { get; set; } @@ -55,25 +103,6 @@ namespace MP.Stats.Components #region Private Methods - - private List DatiParetoOee - { - get => ParetoData.Select(x => x.value).ToList(); - } - private List LabelParetoOee - { - get => ParetoData.Select(x => x.label).ToList(); - } - - private List DatiTrs - { - get => TSData; - } - private List LabelTrs - { - get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); - } - private Dictionary calcTSData(DateTime inizio, List yData) { Dictionary answ = new Dictionary(); @@ -88,7 +117,6 @@ namespace MP.Stats.Components return answ; } - private void recalcData() { if (RawData != null) @@ -149,36 +177,6 @@ namespace MP.Stats.Components return answ; } - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List lineColor - { - get => solidColors("1"); - } - - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List lineColors - { - get => semaphColors(ParetoData.Count, "1"); - } - - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List bgColors - { - get => semaphColors(ParetoData.Count, "0.3"); - } - #endregion Protected Methods } } \ No newline at end of file diff --git a/MP.Stats/Components/ChartUserLog.razor.cs b/MP.Stats/Components/ChartUserLog.razor.cs index 1bc1cbd8..54867f48 100644 --- a/MP.Stats/Components/ChartUserLog.razor.cs +++ b/MP.Stats/Components/ChartUserLog.razor.cs @@ -1,10 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using MP.Data; using MP.Stats.Data; +using System.Collections.Generic; +using System.Linq; namespace MP.Stats.Components { @@ -16,88 +14,68 @@ namespace MP.Stats.Components protected const string EsitoOK = "Esito: OK"; - protected object lineChartOptions = new - { - Scales = new - { - XAxes = new object[] - { - new { - Display = true - } - }, - YAxes = new object[] - { - new { - Display = true, - ticks= new { - suggestedMin = 0 - } - } - } - }, - Tooltips = new - { - Mode = "nearest", - Intersect = false - }, - Hover = new - { - Mode = "nearest", - Intersect = false - }, - Animation = false, - AspectRatio = 4.9 - }; - - protected object pieChartOptions = new - { - Scales = new - { - XAxes = new object[] - { - new { - Display = false - } - }, - YAxes = new object[] - { - new { - Display = false - } - } - }, - Legend = new - { - Display = false - }, - Tooltips = new - { - Mode = "nearest", - Intersect = false - }, - Hover = new - { - Mode = "nearest", - Intersect = false - }, - Animation = false, - AspectRatio = 1 - }; - -#if false - protected PieChart PieVC = new PieChart(); - protected LineChart TimeSerieVC = new LineChart(); -#endif - #endregion Protected Fields + #region Private Properties + + private List DatiPareto + { + get => ParetoData.Select(x => x.value).ToList(); + } + + private List DatiPlot + { + get => TSData; + } + + private List LabelPareto + { + get => ParetoData.Select(x => x.label).ToList(); + } + + private List LabelPlot + { + get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); + } + + #endregion Private Properties + #region Protected Properties protected SelectData _currFilter { get; set; } = new SelectData(); protected List _rawData { get; set; } = new List(); + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List bgColors + { + get => semaphColors(ParetoData.Count, "0.3"); + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List lineColor + { + get => solidColors("1"); + } + + /// + /// Genera colori sfondo 33% rosso / arancione / giallo + /// + /// + /// + protected List lineColors + { + get => semaphColors(ParetoData.Count, "1"); + } + [Inject] protected MessageService MessageService { get; set; } @@ -132,7 +110,6 @@ namespace MP.Stats.Components #region Private Methods - private List GetLineChartLabels() { var answ = TSData.Select(x => x.x.ToString("ddd dd.MM")).ToList(); @@ -161,7 +138,6 @@ namespace MP.Stats.Components #region Protected Methods - /// Genera colori sfondo 33% rosso / arancione / giallo /// /// @@ -199,56 +175,6 @@ namespace MP.Stats.Components return answ; } - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List bgColors - { - get => semaphColors(ParetoData.Count, "0.3"); - } - - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List lineColor - { - get => solidColors("1"); - } - - /// - /// Genera colori sfondo 33% rosso / arancione / giallo - /// - /// - /// - protected List lineColors - { - get => semaphColors(ParetoData.Count, "1"); - } - - private List DatiPareto - { - get => ParetoData.Select(x => x.value).ToList(); - } - - private List DatiPlot - { - get => TSData; - } - - private List LabelPareto - { - get => ParetoData.Select(x => x.label).ToList(); - } - - private List LabelPlot - { - get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList(); - } - #endregion Protected Methods } } \ No newline at end of file diff --git a/MP.Stats/Components/SelectionFilter.razor b/MP.Stats/Components/SelectionFilter.razor index a8c45f07..77962901 100644 --- a/MP.Stats/Components/SelectionFilter.razor +++ b/MP.Stats/Components/SelectionFilter.razor @@ -34,7 +34,7 @@
- + @foreach (var item in ddlMacchine) { @@ -42,6 +42,20 @@
+ @if (ActionsEnabled) + { +
+
+ + + @foreach (var item in ddlAzioni) + { + + } + +
+
+ }
diff --git a/MP.Stats/Components/SelectionFilter.razor.cs b/MP.Stats/Components/SelectionFilter.razor.cs index 32dc4f39..14cd8c0e 100644 --- a/MP.Stats/Components/SelectionFilter.razor.cs +++ b/MP.Stats/Components/SelectionFilter.razor.cs @@ -1,10 +1,9 @@ -using System; +using Microsoft.AspNetCore.Components; +using MP.Stats.Data; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; -using MP.Stats.Components; -using MP.Stats.Data; namespace MP.Stats.Components { @@ -23,12 +22,29 @@ namespace MP.Stats.Components private List ddlArticoli { get; set; } private List ddlCommesse { get; set; } private List ddlMacchine { get; set; } + private List ddlAzioni { get; set; } private string selectedSearchValue { get; set; } = "*"; #endregion Private Properties #region Protected Properties + protected string Azione + { + get + { + return SelFilter.Azione; + } + set + { + if (!SelFilter.Azione.Equals(value)) + { + SelFilter.Azione = value; + reportChange(); + } + } + } + protected string CodArticolo { get @@ -170,6 +186,12 @@ namespace MP.Stats.Components [Parameter] public bool CommessaEnabled { get; set; } = true; + /// + /// Indica se filtrare ANCHE le azioni (x tab UL) + /// + [Parameter] + public bool ActionsEnabled { get; set; } = false; + [Parameter] public EventCallback filterChanged { get; set; } @@ -190,9 +212,10 @@ namespace MP.Stats.Components private async Task reloadData() { - ddlMacchine = await StatService.MachineList(); ddlArticoli = await StatService.ArticoliGetSearch(-1, SearchArt); + ddlAzioni = await StatService.AzioniList(); ddlCommesse = await StatService.CommesseGetSearch(-1, SearchArt); + ddlMacchine = await StatService.MachineList(); } private void reportChange() diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index 998de3db..b45a0299 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -1,17 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using System.Configuration; -using System.Text; +using Microsoft.Extensions.Caching.Distributed; +using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using MP.Data; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json; +using System; +using System.Collections.Generic; using System.Diagnostics; -using NLog; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace MP.Stats.Data { @@ -107,7 +104,7 @@ namespace MP.Stats.Data protected string getCacheKey(string TableName, SelectData CurrFilter) { - string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:A_{CurrFilter.CodArticolo}:K_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}"; + string answ = $"{TableName}:M_{CurrFilter.IdxMacchina}:AZ_{CurrFilter.Azione}:ART_{CurrFilter.CodArticolo}:KR_{CurrFilter.KeyRichiesta}:O_{CurrFilter.IdxOdl}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}"; return answ; } @@ -168,6 +165,14 @@ namespace MP.Stats.Data return await Task.FromResult(answ); } + public Task> AzioniList() + { + List answ = new List(); + answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" }); + answ.AddRange(dbController.ActionsGetAll().Select(x => new AutocompleteModel { LabelField = $"{x.Descrizione}", ValueField = x.Azione}).ToList()); + return Task.FromResult(answ); + } + public Task> CommesseGetSearch(int numRecord, string searchVal = "") { List answ = new List(); @@ -404,6 +409,11 @@ namespace MP.Stats.Data Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); dbResult = dbController.StatUserLogGetAll(CurrFilter.DateStart, CurrFilter.DateEnd, CurrFilter.IdxMacchina, CurrFilter.IdxOdl, CurrFilter.KeyRichiesta, CurrFilter.CodArticolo); + // se richiesto filtro azioni effettuo ora selezione... + if (CurrFilter.Azione != "*") + { + dbResult= dbResult.Where(x => x.Azione == CurrFilter.Azione).ToList(); + } rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt); diff --git a/MP.Stats/Data/SelectData.cs b/MP.Stats/Data/SelectData.cs index 6279c601..62decfe8 100644 --- a/MP.Stats/Data/SelectData.cs +++ b/MP.Stats/Data/SelectData.cs @@ -29,6 +29,7 @@ namespace MP.Stats.Data public string IdxMacchina { get; set; } = "*"; public int IdxOdl { get; set; } = -999; public string KeyRichiesta { get; set; } = "*"; + public string Azione { get; set; } = "*"; /// /// Numero record da recuperare, tipicamente la decina della pag corrente (10 * PageSize) @@ -88,6 +89,8 @@ namespace MP.Stats.Data return false; if (KeyRichiesta != item.KeyRichiesta) return false; + if (Azione != item.Azione) + return false; return true; } diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index f1397d70..85f0116d 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,11 +4,16 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.14.2202.2614 + 6.15.2202.2618 + + + + + diff --git a/MP.Stats/Pages/UserLog.razor b/MP.Stats/Pages/UserLog.razor index 99b67e2d..db3fc832 100644 --- a/MP.Stats/Pages/UserLog.razor +++ b/MP.Stats/Pages/UserLog.razor @@ -1,11 +1,10 @@ @page "/UserLog" -@*@page "/userlog/{IdxMacchina}"*@ @using MP.Stats.Components
- +
@if (ShowCharts == true) diff --git a/MP.Stats/Pages/UserLog.razor.cs b/MP.Stats/Pages/UserLog.razor.cs index 60d89b56..b16d3a2c 100644 --- a/MP.Stats/Pages/UserLog.razor.cs +++ b/MP.Stats/Pages/UserLog.razor.cs @@ -231,15 +231,6 @@ namespace MP.Stats.Pages MessageService.EA_SearchUpdated -= OnSeachUpdated; } - // public void OnSeachUpdated() - // { - // InvokeAsync(() => - // { - // UpdateData(); - // StateHasChanged(); - // }); - // } - public async void OnSeachUpdated() { await InvokeAsync(() => diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index b01f90e0..b0b5db37 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

Versione: 6.14.2202.2614

+

Versione: 6.15.2202.2618


Note di rilascio:
    diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index e2efed23..180ab3c7 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.14.2202.2614 +6.15.2202.2618 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index 9328c8ef..ecb90abe 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.14.2202.2614 + 6.15.2202.2618 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Shared/NavMenu.razor b/MP.Stats/Shared/NavMenu.razor index 402b8c10..39754f97 100644 --- a/MP.Stats/Shared/NavMenu.razor +++ b/MP.Stats/Shared/NavMenu.razor @@ -42,12 +42,6 @@ Registro Scarti - @* - *@
diff --git a/MajMin.vers b/MajMin.vers index c4e3f49d..5ab0e94e 100644 --- a/MajMin.vers +++ b/MajMin.vers @@ -1 +1 @@ -6.14. \ No newline at end of file +6.15. \ No newline at end of file