Merge branch 'feature/AddCharting' into develop
This commit is contained in:
@@ -168,13 +168,6 @@ namespace MP.Data.Controllers
|
||||
{
|
||||
List<DatabaseModels.DdbTurni> dbResult = new List<DatabaseModels.DdbTurni>();
|
||||
|
||||
//dbResult = dbCtx
|
||||
// .
|
||||
// .Where(x => x.Descrizione.Contains(searchVal) || x.IdxMacchina.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
// .OrderByDescending(x => x.InizioStato)
|
||||
// .Take(numRecord)
|
||||
// .ToList();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
@@ -269,60 +262,6 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella TurniPareto da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.TurniPareto> StatTurniParetoGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.TurniPareto> dbResult = new List<DatabaseModels.TurniPareto>();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTurniPareto
|
||||
.FromSqlRaw("EXEC stp_UI_ParetoTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella TurniParetoOdl da filtro
|
||||
/// </summary>
|
||||
/// <param name="DataStart"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <param name="IdxMacchina"></param>
|
||||
/// <param name="DataEnd"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.TurniParetoOdl> StatTurniParetoOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.TurniParetoOdl> dbResult = new List<DatabaseModels.TurniParetoOdl>();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTurniParetoOdl
|
||||
.FromSqlRaw("EXEC stp_UI_ParetoTurniOdl_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella UserLog da filtro
|
||||
/// </summary>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class TurniPareto
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string ClasseTempo { get; set; }
|
||||
public string CodArticolo { get; set; }
|
||||
public string CodMacchina { get; set; }
|
||||
public DateTime DataRif { get; set; }
|
||||
public string DescArticolo { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public int IdxStato { get; set; }
|
||||
public double? TotPeriodo { get; set; }
|
||||
public int? TotPz { get; set; }
|
||||
public string Turno { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class TurniParetoOdl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string ClasseTempo { get; set; }
|
||||
public string CodArticolo { get; set; }
|
||||
public string CodMacchina { get; set; }
|
||||
public DateTime DataRif { get; set; }
|
||||
public string DescArticolo { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public int? IdxOdl { get; set; }
|
||||
public int IdxStato { get; set; }
|
||||
public string KeyRichiesta { get; set; }
|
||||
public double? TotPeriodo { get; set; }
|
||||
public int? TotPz { get; set; }
|
||||
public string Turno { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,11 @@
|
||||
<RootNamespace>MP.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="DatabaseModels\TurniPareto.cs" />
|
||||
<Compile Remove="DatabaseModels\TurniParetoOdl.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
|
||||
|
||||
@@ -43,8 +43,10 @@ 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
|
||||
@@ -103,72 +105,6 @@ namespace MP.Data
|
||||
.HasMaxLength(5);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TurniPareto>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToView("v_UI_Pareto_Turni");
|
||||
|
||||
entity.Property(e => e.ClasseTempo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataRif).HasColumnType("datetime");
|
||||
|
||||
entity.Property(e => e.DescArticolo).HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.TotPeriodo).HasColumnName("totPeriodo");
|
||||
|
||||
entity.Property(e => e.Turno)
|
||||
.IsRequired()
|
||||
.HasMaxLength(5);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<TurniParetoOdl>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToView("v_UI_Pareto_TurniOdl");
|
||||
|
||||
entity.Property(e => e.ClasseTempo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataRif).HasColumnType("datetime");
|
||||
|
||||
entity.Property(e => e.DescArticolo).HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxOdl).HasColumnName("IdxODL");
|
||||
|
||||
entity.Property(e => e.KeyRichiesta).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.TotPeriodo).HasColumnName("totPeriodo");
|
||||
|
||||
entity.Property(e => e.Turno)
|
||||
.IsRequired()
|
||||
.HasMaxLength(5);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
@using MP.Stats.Data
|
||||
|
||||
<div class="row">
|
||||
@if (ListScarti == null || ListScarti.Count == 0)
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-secondary text-center h4"><span class="oi oi-graph"></span> No Chart Data</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2 pr-0" style="max-height: 15em; overflow:hidden; overflow-y: auto;">
|
||||
<ul class="list-group list-group-sm small">
|
||||
@foreach (var item in @ParetoData)
|
||||
{
|
||||
<li class="list-group-item p-1 d-flex justify-content-between align-items-center">
|
||||
@item.label
|
||||
<span class="badge badge-primary badge-pill">@item.value</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<BarChart @ref="ParetoGuasti" TItem="double" OptionsObject="barChartOptions" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<LineChart @ref="NumGuasti" TItem="double" OptionsObject="lineChartOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,245 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Blazorise.Charts;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.Stats.Data;
|
||||
|
||||
namespace MP.Stats.Components
|
||||
{
|
||||
public partial class ChartScarti
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected object barChartOptions = new
|
||||
{
|
||||
Scales = new
|
||||
{
|
||||
XAxes = new object[]
|
||||
{
|
||||
new {
|
||||
Display = false
|
||||
}
|
||||
},
|
||||
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 = 2.5
|
||||
};
|
||||
|
||||
protected object lineChartOptions = new
|
||||
{
|
||||
Scales = new
|
||||
{
|
||||
XAxes = new object[]
|
||||
{
|
||||
new {
|
||||
Display = true,
|
||||
//type = "time"
|
||||
}
|
||||
},
|
||||
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 = 2.5
|
||||
};
|
||||
|
||||
protected LineChart<double> NumGuasti;
|
||||
|
||||
protected BarChart<double> ParetoGuasti;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.Data.DatabaseModels.ResScarti> _listScarti { get; set; } = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
[Inject]
|
||||
protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<ChartTS> TSData { get; set; } = new List<ChartTS>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.Data.DatabaseModels.ResScarti> ListScarti
|
||||
{
|
||||
get => _listScarti;
|
||||
set
|
||||
{
|
||||
// salvo valori
|
||||
_listScarti = value;
|
||||
if (value != null)
|
||||
{
|
||||
// ricalcolo charting data
|
||||
recalcData();
|
||||
var dataReload = Task.Run(async () =>
|
||||
{
|
||||
await HandleRedraw();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private BarChartDataset<double> GetBarChartDataset()
|
||||
{
|
||||
var answ = new BarChartDataset<double>
|
||||
{
|
||||
Label = "Pareto Causali Scarto",
|
||||
Data = ParetoData.Select(x => x.value).ToList(),
|
||||
BackgroundColor = backgroundColors(ParetoData.Count),
|
||||
//BorderColor = borderColors,
|
||||
HoverBorderWidth = 5
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> GetBarChartLabels()
|
||||
{
|
||||
var answ = ParetoData.Select(x => x.label).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
private LineChartDataset<double> GetLineChartDataset()
|
||||
{
|
||||
var answ = new LineChartDataset<double>
|
||||
{
|
||||
Label = "Numero Scarti Periodo",
|
||||
Data = TSData.Select(x => x.Value).ToList(),
|
||||
BackgroundColor = backgroundColors(1),
|
||||
Fill = true,
|
||||
PointRadius = 2,
|
||||
SteppedLine = true,
|
||||
BorderDash = new List<int> { }
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
private List<string> GetLineChartLabels()
|
||||
{
|
||||
var answ = TSData.Select(x => x.TLabel.ToString("ddd dd.MM")).ToList();
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void recalcData()
|
||||
{
|
||||
if (ListScarti != null)
|
||||
{
|
||||
ParetoData = ListScarti
|
||||
.GroupBy(x => x.Causale)
|
||||
.Select(y => new ChartKV() { label = y.First().Descrizione, value = y.Sum(c => c.Qta) })
|
||||
.OrderByDescending(x => x.value)
|
||||
.ToList();
|
||||
|
||||
TSData = ListScarti
|
||||
.GroupBy(x => x.DataOraRif.Date)
|
||||
.Select(y => new ChartTS() { TLabel = y.First().DataOraRif.Date, Value = y.Sum(c => c.Qta) })
|
||||
.OrderBy(x => x.TLabel)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> backgroundColors(int numRecords)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
// rosso...
|
||||
for (int i = 0; i < numRecords / 3; i++)
|
||||
{
|
||||
answ.Add(ChartColor.FromRgba(255, 99, 132, 0.4f));
|
||||
}
|
||||
// arancione
|
||||
for (int i = 0; i < numRecords / 3; i++)
|
||||
{
|
||||
answ.Add(ChartColor.FromRgba(255, 206, 86, 0.4f));
|
||||
}
|
||||
while (answ.Count < numRecords)
|
||||
{
|
||||
answ.Add(ChartColor.FromRgba(54, 82, 235, 0.4f));
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
//protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
//{
|
||||
// if (firstRender)
|
||||
// {
|
||||
// await HandleRedraw();
|
||||
// }
|
||||
//}
|
||||
protected async Task HandleRedraw()
|
||||
{
|
||||
if (ParetoGuasti != null)
|
||||
{
|
||||
await ParetoGuasti.Clear();
|
||||
await ParetoGuasti.AddLabelsDatasetsAndUpdate(GetBarChartLabels(), GetBarChartDataset());
|
||||
}
|
||||
if (NumGuasti != null)
|
||||
{
|
||||
await NumGuasti.Clear();
|
||||
await NumGuasti.AddLabelsDatasetsAndUpdate(GetLineChartLabels(), GetLineChartDataset());
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -2,63 +2,82 @@
|
||||
@using MP.Stats.Data
|
||||
|
||||
<EditForm Model="@SelFilter">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtInizio" class="small">inizio:</label>
|
||||
<InputDateTime id="dtInizio" class="form-control form-control-sm" @bind-Value="@DateStart"></InputDateTime>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtFine" class="small">fine:</label>
|
||||
<InputDateTime id="dtFine" class="form-control form-control-sm" @bind-Value="@DateEnd"></InputDateTime>
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
@foreach (var item in ddlMacchine)
|
||||
<label for="btnReset" class="small">chart</label><br />
|
||||
<Button id="btnReset" class="btn btn-info btn-sm" Clicked="toggleChart">
|
||||
@if (chartVisible)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
<span class="oi oi-chevron-top"></span>
|
||||
}
|
||||
</InputSelect>
|
||||
else
|
||||
{
|
||||
<span class="oi oi-chevron-bottom"></span>
|
||||
}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">commessa:</label>
|
||||
<div class="p-2">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtInizio" class="small">inizio:</label>
|
||||
<InputDateTime id="dtInizio" class="form-control form-control-sm" @bind-Value="@DateStart"></InputDateTime>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchCom" placeholder="search (> @minChar char)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@KeyRichiesta" id="KeyRich" class="form-control form-control-sm" title="Macchina">
|
||||
@foreach (var item in ddlCommesse)
|
||||
{
|
||||
<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">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">articolo:</label>
|
||||
<div class="col">
|
||||
<div class="form-group mb-0">
|
||||
<label for="dtFine" class="small">fine:</label>
|
||||
<InputDateTime id="dtFine" class="form-control form-control-sm" @bind-Value="@DateEnd"></InputDateTime>
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
@foreach (var item in ddlMacchine)
|
||||
{
|
||||
<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">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">commessa:</label>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchCom" placeholder="search (> @minChar char)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@KeyRichiesta" id="KeyRich" class="form-control form-control-sm" title="Macchina">
|
||||
@foreach (var item in ddlCommesse)
|
||||
{
|
||||
<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">
|
||||
<div class="input-group-prepend">
|
||||
<label class="input-group-text">articolo:</label>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchArt" placeholder="search (> @minChar char)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@CodArticolo" class="form-control form-control-sm" title="Macchina">
|
||||
@foreach (var item in ddlArticoli)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
<input class="form-control form-control-sm" @bind="@SearchArt" placeholder="search (> @minChar char)" />
|
||||
</div>
|
||||
<InputSelect @bind-Value="@CodArticolo" class="form-control form-control-sm" title="Macchina">
|
||||
@foreach (var item in ddlArticoli)
|
||||
{
|
||||
<option value="@item.ValueField">@item.LabelField</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-right">
|
||||
<div class="p-2">
|
||||
<div class="form-group mb-0">
|
||||
<label for="btnReset" class="small">reset</label><br />
|
||||
<Button id="btnReset" class="btn btn-info btn-sm btn-block" Clicked="resetFilter"><span class="oi oi-loop-circular"></span></Button>
|
||||
|
||||
@@ -150,6 +150,12 @@ namespace MP.Stats.Components
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> chartsToggle { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool chartVisible { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<SelectData> filterChanged { get; set; }
|
||||
|
||||
@@ -194,6 +200,11 @@ namespace MP.Stats.Components
|
||||
filterReset.InvokeAsync(SelFilter);
|
||||
}
|
||||
|
||||
protected void toggleChart()
|
||||
{
|
||||
chartsToggle.InvokeAsync(chartVisible);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Data
|
||||
{
|
||||
public class ChartKV
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string label { get; set; } = "";
|
||||
public double value { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Stats.Data
|
||||
{
|
||||
public class ChartTS
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime TLabel { get; set; } = DateTime.Now;
|
||||
public double Value { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -135,12 +135,13 @@ namespace MP.Stats.Data
|
||||
return Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public Task<List<AutocompleteModel>> ArticoliList(string searchVal)
|
||||
public async Task<List<AutocompleteModel>> ArticoliList(string searchVal)
|
||||
{
|
||||
List<AutocompleteModel> answ = new List<AutocompleteModel>();
|
||||
answ.Add(new AutocompleteModel { LabelField = "--- TUTTE ---", ValueField = "*" });
|
||||
answ.AddRange(dbController.MacchineGetAll().Select(x => new AutocompleteModel { LabelField = x.IdxMacchina, ValueField = x.IdxMacchina }).ToList());
|
||||
return Task.FromResult(answ);
|
||||
var listMacchine = dbController.MacchineGetAll();
|
||||
answ.AddRange(listMacchine.Select(x => new AutocompleteModel { LabelField = x.IdxMacchina, ValueField = x.IdxMacchina }).ToList());
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
public Task<List<AutocompleteModel>> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
@@ -242,7 +243,7 @@ namespace MP.Stats.Data
|
||||
{
|
||||
//return Task.FromResult(dbController.StatScartiGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
List<MP.Data.DatabaseModels.ResScarti> dbResult = new List<MP.Data.DatabaseModels.ResScarti>();
|
||||
string cacheKey = getCacheKey("MP:STATS:SCARTI", CurrFilter);
|
||||
string cacheKey = getCacheKey("MP:STATS:SCARTI:RAW", CurrFilter);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
@@ -286,16 +287,6 @@ namespace MP.Stats.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.TurniPareto[]> StatTurniParetoGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatTurniParetoGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
}
|
||||
|
||||
public Task<MP.Data.DatabaseModels.TurniParetoOdl[]> StatTurniParetoOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, string searchVal = "")
|
||||
{
|
||||
return Task.FromResult(dbController.StatTurniParetoOdlGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
}
|
||||
|
||||
public async Task<List<MP.Data.DatabaseModels.UserActionLog>> StatUserLogGetAll(SelectData CurrFilter, string searchVal = "")
|
||||
{
|
||||
//return Task.FromResult(dbController.StatUserLogGetAll(DataStart, DataEnd, IdxMacchina, IdxODL, KeyRichiesta, CodArticolo).ToArray());
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter" chartVisible="ShowCharts" chartsToggle="ToggleChart"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartScarti ListScarti="@SearchRecords"></ChartScarti>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace MP.Stats.Pages
|
||||
private int currPage { get; set; } = 1;
|
||||
private bool isLoading { get; set; } = false;
|
||||
private int numRecord { get; set; } = 10;
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -127,6 +128,15 @@ namespace MP.Stats.Pages
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
protected async Task ToggleChart(bool doShow)
|
||||
{
|
||||
ShowCharts = !ShowCharts;
|
||||
if (ShowCharts)
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@using MP.Stats.Components
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header table-primary py-1">
|
||||
<div class="card-header table-primary p-1">
|
||||
<SelectionFilter SelFilter="currFilter" filterChanged="DoFilter" filterReset="ResetFilter"></SelectionFilter>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
|
||||
Reference in New Issue
Block a user