COmpletato display x integrazione dichiarazioni operatore

This commit is contained in:
Samuele Locatelli
2022-02-26 18:16:21 +01:00
parent efa11f9452
commit 2e2639b94f
17 changed files with 197 additions and 316 deletions
+6 -16
View File
@@ -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
}
/// <summary>
/// Elenco tabella Macchine
/// Elenco da tabella Macchine
/// </summary>
/// <returns></returns>
public List<DatabaseModels.Macchine> MacchineGetAll()
@@ -313,13 +310,6 @@ namespace MP.Data.Controllers
List<DatabaseModels.UserActionLog> dbResult = new List<DatabaseModels.UserActionLog>();
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);
+1 -4
View File
@@ -42,10 +42,6 @@ namespace MP.Data
public virtual DbSet<ODL> DbSetODL { get; set; }
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
#if false
public virtual DbSet<TurniPareto> DbSetTurniPareto { get; set; }
public virtual DbSet<TurniParetoOdl> DbSetTurniParetoOdl { get; set; }
#endif
public virtual DbSet<UserActionLog> DbSetUserLog { get; set; }
#endregion Public Properties
@@ -142,6 +138,7 @@ namespace MP.Data
entity.Property(e => e.Nome).HasMaxLength(50);
});
modelBuilder.Entity<DdbTurni>(entity =>
{
entity.HasNoKey();
@@ -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
+55 -57
View File
@@ -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<double> DatiParetoOee
{
get => ParetoData.Select(x => x.value).ToList();
}
#endregion Protected Fields
private List<chartJsData.chartJsTSerie> DatiTrs
{
get => TSData;
}
private List<string> LabelParetoOee
{
get => ParetoData.Select(x => x.label).ToList();
}
private List<string> 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<MP.Data.DatabaseModels.TurniOee> _rawData { get; set; } = new List<MP.Data.DatabaseModels.TurniOee>();
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> bgColors
{
get => semaphColors(ParetoData.Count, "0.3");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColor
{
get => solidColors("1");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> 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<double> DatiParetoOee
{
get => ParetoData.Select(x => x.value).ToList();
}
private List<string> LabelParetoOee
{
get => ParetoData.Select(x => x.label).ToList();
}
private List<chartJsData.chartJsTSerie> DatiTrs
{
get => TSData;
}
private List<string> LabelTrs
{
get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList();
}
private Dictionary<DateTime, double> calcTSData(DateTime inizio, List<double> yData)
{
Dictionary<DateTime, double> answ = new Dictionary<DateTime, double>();
@@ -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;
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColor
{
get => solidColors("1");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColors
{
get => semaphColors(ParetoData.Count, "1");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> bgColors
{
get => semaphColors(ParetoData.Count, "0.3");
}
#endregion Protected Methods
}
}
+57 -131
View File
@@ -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<double> PieVC = new PieChart<double>();
protected LineChart<double> TimeSerieVC = new LineChart<double>();
#endif
#endregion Protected Fields
#region Private Properties
private List<double> DatiPareto
{
get => ParetoData.Select(x => x.value).ToList();
}
private List<chartJsData.chartJsTSerie> DatiPlot
{
get => TSData;
}
private List<string> LabelPareto
{
get => ParetoData.Select(x => x.label).ToList();
}
private List<string> 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<MP.Data.DatabaseModels.UserActionLog> _rawData { get; set; } = new List<MP.Data.DatabaseModels.UserActionLog>();
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> bgColors
{
get => semaphColors(ParetoData.Count, "0.3");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColor
{
get => solidColors("1");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> 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<string> 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
/// </summary>
/// <param name="numRecords"></param>
@@ -199,56 +175,6 @@ namespace MP.Stats.Components
return answ;
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> bgColors
{
get => semaphColors(ParetoData.Count, "0.3");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColor
{
get => solidColors("1");
}
/// <summary>
/// Genera colori sfondo 33% rosso / arancione / giallo
/// </summary>
/// <param name="numRecords"></param>
/// <returns></returns>
protected List<string> lineColors
{
get => semaphColors(ParetoData.Count, "1");
}
private List<double> DatiPareto
{
get => ParetoData.Select(x => x.value).ToList();
}
private List<chartJsData.chartJsTSerie> DatiPlot
{
get => TSData;
}
private List<string> LabelPareto
{
get => ParetoData.Select(x => x.label).ToList();
}
private List<string> LabelPlot
{
get => TSData.Select(r => $"{r.x:yyyy-MM-dd}").ToList();
}
#endregion Protected Methods
}
}
+15 -1
View File
@@ -34,7 +34,7 @@
<div class="col">
<div class="form-group mb-0">
<label for="idxMacc" class="small">macchina:</label>
<InputSelect @bind-Value="@IdxMacchina" id="maccSel" class="form-control form-control-sm" title="idxMacc">
<InputSelect @bind-Value="@IdxMacchina" id="maccSel" class="form-control form-control-sm" title="Macchina">
@foreach (var item in ddlMacchine)
{
<option value="@item.ValueField">@item.LabelField</option>
@@ -42,6 +42,20 @@
</InputSelect>
</div>
</div>
@if (ActionsEnabled)
{
<div class="col">
<div class="form-group mb-0">
<label for="idxMacc" class="small">azione:</label>
<InputSelect @bind-Value="@Azione" id="azioneSel" class="form-control form-control-sm" title="Azione">
@foreach (var item in ddlAzioni)
{
<option value="@item.ValueField">@item.LabelField</option>
}
</InputSelect>
</div>
</div>
}
<div class="col">
<div class="form-group mb-0">
<div class="input-group input-group-sm">
+28 -5
View File
@@ -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<AutocompleteModel> ddlArticoli { get; set; }
private List<AutocompleteModel> ddlCommesse { get; set; }
private List<AutocompleteModel> ddlMacchine { get; set; }
private List<AutocompleteModel> 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;
/// <summary>
/// Indica se filtrare ANCHE le azioni (x tab UL)
/// </summary>
[Parameter]
public bool ActionsEnabled { get; set; } = false;
[Parameter]
public EventCallback<SelectData> 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()
+21 -11
View File
@@ -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<List<AutocompleteModel>> AzioniList()
{
List<AutocompleteModel> answ = new List<AutocompleteModel>();
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<List<AutocompleteModel>> CommesseGetSearch(int numRecord, string searchVal = "")
{
List<AutocompleteModel> answ = new List<AutocompleteModel>();
@@ -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);
+3
View File
@@ -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; } = "*";
/// <summary>
/// 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;
}
+6 -1
View File
@@ -4,11 +4,16 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.14.2202.2614</Version>
<Version>6.15.2202.2618</Version>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Pages\UserDecl.razor.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="compilerconfig.json" />
<Content Remove="Pages\UserDecl.razor" />
</ItemGroup>
<ItemGroup>
+1 -2
View File
@@ -1,11 +1,10 @@
@page "/UserLog"
@*@page "/userlog/{IdxMacchina}"*@
@using MP.Stats.Components
<div class="card">
<div class="card-header table-primary p-1">
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true"></SelectionFilter>
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart" ChartEnabled="true" ActionsEnabled="true"></SelectionFilter>
</div>
<div class="card-body py-0 px-1">
@if (ShowCharts == true)
-9
View File
@@ -231,15 +231,6 @@ namespace MP.Stats.Pages
MessageService.EA_SearchUpdated -= OnSeachUpdated;
}
// public void OnSeachUpdated()
// {
// InvokeAsync(() =>
// {
// UpdateData();
// StateHasChanged();
// });
// }
public async void OnSeachUpdated()
{
await InvokeAsync(() =>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.14.2202.2614</h4>
<h4>Versione: 6.15.2202.2618</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.14.2202.2614
6.15.2202.2618
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.14.2202.2614</version>
<version>6.15.2202.2618</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
-6
View File
@@ -42,12 +42,6 @@
<span class="oi oi-warning" aria-hidden="true" title="Registro Scarti"></span> Registro Scarti
</NavLink>
</li>
@*
<li class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata">
<span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data
</NavLink>
</li>*@
</ul>
</div>
+1 -1
View File
@@ -1 +1 @@
6.14.
6.15.