Demo grafico allarmi
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
|
||||
<canvas id="@Id"></canvas>
|
||||
@@ -1,174 +0,0 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.MONO.Data;
|
||||
|
||||
namespace MP.MONO.UI.Components.Chart
|
||||
{
|
||||
public partial class Line
|
||||
{
|
||||
#region Private Properties
|
||||
|
||||
private List<chartJsData.chartJsTSerie> _DataTS { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public double AspRatio { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public List<string> backColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<chartJsData.chartJsTSerie> DataTS
|
||||
{
|
||||
get
|
||||
{
|
||||
return _DataTS;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_DataTS = value;
|
||||
//var pUpd = Task.Run(async () => await renderChart());
|
||||
//pUpd.Wait();
|
||||
}
|
||||
}
|
||||
|
||||
protected string Id { get; set; } = "CurrId";
|
||||
|
||||
[Parameter]
|
||||
public string ChartId
|
||||
{
|
||||
get
|
||||
{
|
||||
return Id;
|
||||
}
|
||||
set
|
||||
{
|
||||
Id = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public List<string> Labels { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public List<string> lineColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public int lTens { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string MaxValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public string MinValue { get; set; } = "0";
|
||||
|
||||
[Parameter]
|
||||
public List<string> pointColor { get; set; } = new List<string>();
|
||||
|
||||
[Parameter]
|
||||
public string Title { get; set; } = "Demo Line";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui:
|
||||
/// https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/
|
||||
/// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name = "firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await renderChart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione rendering componente
|
||||
///
|
||||
/// partendo da qui:
|
||||
/// https://www.williamleme.com/posts/2020/003-chartjs-blazor/
|
||||
/// https://www.puresourcecode.com/dotnet/blazor/using-chart-js-with-blazor/
|
||||
/// https://www.tutorialsteacher.com/csharp/csharp-anonymous-type
|
||||
/// </summary>
|
||||
/// <param name = "firstRender"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task renderChart()
|
||||
{
|
||||
// creazione di un oggetto anonymous type con tutte le opzioni da passare a chart.js
|
||||
var config = new
|
||||
{
|
||||
type = "line",
|
||||
options = new
|
||||
{
|
||||
responsive = true,
|
||||
scales = new
|
||||
{
|
||||
yAxes = new
|
||||
{
|
||||
display = true,
|
||||
position = "right",
|
||||
ticks = new
|
||||
{
|
||||
maxTicksLimit = 10
|
||||
}
|
||||
|
||||
,
|
||||
suggestedMin = MinValue != MaxValue ? MinValue : "auto",
|
||||
suggestedMax = MinValue != MaxValue ? MaxValue : "auto"
|
||||
}
|
||||
|
||||
,
|
||||
xAxes = new
|
||||
{
|
||||
type = "time",
|
||||
distribution = "linear",
|
||||
}
|
||||
}
|
||||
|
||||
,
|
||||
plugins = new
|
||||
{
|
||||
legend = new
|
||||
{
|
||||
display = false
|
||||
}
|
||||
|
||||
,
|
||||
}
|
||||
|
||||
,
|
||||
Animation = false,
|
||||
AspectRatio = AspRatio == 0 ? "auto" : $"{AspRatio}"
|
||||
}
|
||||
|
||||
,
|
||||
data = new
|
||||
{
|
||||
labels = Labels,
|
||||
datasets = new[]{new
|
||||
{
|
||||
data = DataTS, pointBorderColor = backColor, borderColor = lineColor, backgroundColor = backColor, fill = true, PointRadius = 2, BorderWidth = 1, lineTension = lTens, stepped = false, label = Title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
await JSRuntime.InvokeVoidAsync("setup", Id, config);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
@using MP.MONO.UI.Components.ChartJS
|
||||
|
||||
<div class="row">
|
||||
@if (RawData == null || RawData.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" style="max-height: 10em; 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.ToString("N2")%</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<BarPlot Id="ParetoOee" AspRatio="3" Data="@DatiParetoOee" Labels="@LabelParetoOee" Legenda="Pareto OEE Macchine" lineColor="@lineColors" backColor="@bgColors"></BarPlot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,184 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.MONO.Data;
|
||||
using MP.MONO.UI.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MP.MONO.UI.Components
|
||||
{
|
||||
public partial class ChartAlarms
|
||||
{
|
||||
#region Private Properties
|
||||
|
||||
private List<double> DatiParetoOee
|
||||
{
|
||||
get => ParetoData.Select(x => x.value).ToList();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
//protected SelectData _currFilter { get; set; } = new SelectData();
|
||||
|
||||
protected List<MP.MONO.Data.DTO.AlarmFreqDTO> _rawData { get; set; } = new List<MP.MONO.Data.DTO.AlarmFreqDTO>();
|
||||
|
||||
/// <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");
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> lineColor
|
||||
{
|
||||
get => solidColors("1");
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <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; }
|
||||
|
||||
protected List<ChartKV> ParetoData { get; set; } = new List<ChartKV>();
|
||||
|
||||
//[Inject]
|
||||
//protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected List<chartJsData.chartJsTSerie> TSData { get; set; } = new List<chartJsData.chartJsTSerie>();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public List<MP.MONO.Data.DTO.AlarmFreqDTO> RawData
|
||||
{
|
||||
get => _rawData;
|
||||
set
|
||||
{
|
||||
// salvo valori
|
||||
_rawData = value;
|
||||
if (value != null)
|
||||
{
|
||||
// ricalcolo charting data
|
||||
recalcData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private Dictionary<DateTime, double> calcTSData(DateTime inizio, List<double> yData)
|
||||
{
|
||||
Dictionary<DateTime, double> answ = new Dictionary<DateTime, double>();
|
||||
// usando i dati ricevuti aggiunge variabile x = tempo crescente
|
||||
int idx = 0;
|
||||
foreach (var item in yData)
|
||||
{
|
||||
answ.Add(inizio.AddHours(idx), item);
|
||||
idx++;
|
||||
}
|
||||
// restituisco!
|
||||
return answ;
|
||||
}
|
||||
|
||||
private void recalcData()
|
||||
{
|
||||
if (RawData != null)
|
||||
{
|
||||
ParetoData = RawData
|
||||
.GroupBy(x => x.MachineId)
|
||||
.Select(y => new ChartKV() { label = y.First().MachineId.ToString(), value = Math.Round(y.Average(c => c.EventCount) * 100, 2) })
|
||||
.OrderByDescending(x => x.value)
|
||||
.ToList();
|
||||
|
||||
TSData = RawData
|
||||
.GroupBy(x => x.MachineId)
|
||||
.Select(r => new chartJsData.chartJsTSerie() { x = DateTime.Now, y = Math.Round(r.Average(c => c.EventCount) * 100, 2) })
|
||||
.OrderBy(o => o.x)
|
||||
.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> semaphColors(int numRecords, string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
// verde...
|
||||
for (int i = 0; i < numRecords / 3; i++)
|
||||
{
|
||||
answ.Add($"rgba(54, 235, 82, {alpha})");
|
||||
}
|
||||
// arancione
|
||||
for (int i = 0; i < numRecords / 3; i++)
|
||||
{
|
||||
answ.Add($"rgba(255, 206, 86, {alpha})");
|
||||
}
|
||||
while (answ.Count < numRecords)
|
||||
{
|
||||
answ.Add($"rgba(255, 99, 132, {alpha}");
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera colori sfondo 33% rosso / arancione / giallo
|
||||
/// </summary>
|
||||
/// <param name="numRecords"></param>
|
||||
/// <returns></returns>
|
||||
protected List<string> solidColors(string alpha)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
answ.Add($"rgba(54, 162, 235, {alpha})");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
<PieChart Id="PieControlli" AspRatio="1" LegendPos="bottom" Data="@DatiPareto" Labels="@LabelPareto" lineColor="@lineColors" backColor="@bgColors" Title="Esito Controlli"></PieChart>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<Line Id="NumControlli" AspRatio="6" DataTS="@DatiPlot" Labels="@LabelPlot" lineColor="@lineColor" backColor="@lineColor" lTens="0" Title="Num Controlli"></Line>
|
||||
<BarPlot Id="ParetoOee" AspRatio="3" Data="@Dat" Labels="s" Legenda="Pareto OEE Macchine" lineColor="@lineColors" backColor="@bgColors"></BarPlot>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-1
@@ -131,4 +131,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.2.2209.2309</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Components\ChartController.razor.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
<Content Remove="Components\ChartController.razor" />
|
||||
<Content Remove="Components\Chart\BarPlot.razor" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.MONO.Core\MP.MONO.Core.csproj" />
|
||||
<ProjectReference Include="..\MP.MONO.Data\MP.MONO.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.multiax.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="appsettings.ufficio.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Conf\lic.multiax.demo.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.NB-SAM.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.WKS-R9-SAM.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.file">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="logs\.placeholder.file">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="temp\OUT.csv">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
<!--<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\obfuscate.ps1 -CurrConfig $(ConfigurationName)" />-->
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,66 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.2.2209.2309</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.MONO.Core\MP.MONO.Core.csproj" />
|
||||
<ProjectReference Include="..\MP.MONO.Data\MP.MONO.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="appsettings.multiax.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Update="appsettings.ufficio.json">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Conf\lic.multiax.demo.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.NB-SAM.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.WKS-R9-SAM.file">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Conf\lic.file">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="logs\.placeholder.file">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="temp\OUT.csv">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
<!--<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\obfuscate.ps1 -CurrConfig $(ConfigurationName)" />-->
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -5,11 +5,17 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<Version>1.2.2209.2216</Version>
|
||||
<Version>1.2.2209.2310</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Components\ChartController.razor.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
<Content Remove="Components\ChartController.razor" />
|
||||
<Content Remove="Components\Chart\BarPlot.razor" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -184,9 +184,6 @@
|
||||
<td class="text-nowrap">
|
||||
@record.DtStart.ToString("yyyy.MM.dd HH:mm:ss")
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
@record.DtEnd.ToString("yyyy.MM.dd HH:mm:ss")
|
||||
</td>
|
||||
<td>
|
||||
<div class="">@record.AlarmListNav.FullValue</div>
|
||||
</td>
|
||||
@@ -205,9 +202,6 @@
|
||||
<td class="text-nowrap">
|
||||
@record.DtStart.ToString("yyyy.MM.dd HH:mm:ss")
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
@record.DtEnd.ToString("yyyy.MM.dd HH:mm:ss")
|
||||
</td>
|
||||
<td>
|
||||
<div class="text-success">@record.AlarmListNav.FullValue</div>
|
||||
</td>
|
||||
|
||||
@@ -11,8 +11,12 @@
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ShowCharts == true)
|
||||
{
|
||||
<ChartControlli RawData="SearchRecords"></ChartControlli>
|
||||
}
|
||||
<ChartAlarms RawData="SearchRecords"></ChartAlarms>
|
||||
}@*
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<DetailOee currRecord="@currRecord"></DetailOee>
|
||||
}*@
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
@@ -25,31 +29,20 @@
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped table-responsive-lg small">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>DateTime start</th>
|
||||
<th><div class="">Error</div></th>
|
||||
<th><div class="">Status</div></th>
|
||||
<th><div class="float-end">Duration</div></th>
|
||||
<th>Macchina</th>
|
||||
<th class="text-right">Durata</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="bg-danger">
|
||||
<td class="text-nowrap">
|
||||
@record.DtStart.ToString("yyyy.MM.dd HH:mm:ss")
|
||||
</td>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="">@record.AlarmListNav.FullValue</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="">Fixing...</div>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<div class="float-end">@TimeSpan.FromMinutes(@record.Duration)</div>
|
||||
<div>@record.MachineId</div>
|
||||
<div class="small">@record.EventCount</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -60,7 +53,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" exportRequested="ExportCsv" fileName="@fileName" />
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ using MP.MONO.UI.Shared;
|
||||
using MP.MONO.UI.Components;
|
||||
using MP.MONO.Data.DbModels;
|
||||
using MP.MONO.UI.Data;
|
||||
using MP.MONO.Data.DTO;
|
||||
using System.Diagnostics.Tracing;
|
||||
|
||||
namespace MP.MONO.UI.Pages
|
||||
{
|
||||
@@ -23,11 +25,12 @@ namespace MP.MONO.UI.Pages
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private AlarmRecModel currRecord = null;
|
||||
private AlarmFreqDTO currRecord = null;
|
||||
|
||||
private string fileName = "Controlli.csv";
|
||||
private List<AlarmRecModel>? ListRecords = null!;
|
||||
private List<AlarmRecModel>? SearchRecords = null!;
|
||||
private string fileName = "OEE.csv";
|
||||
private List<AlarmFreqDTO> ListRecords;
|
||||
|
||||
private List<AlarmFreqDTO> SearchRecords;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -37,6 +40,18 @@ namespace MP.MONO.UI.Pages
|
||||
|
||||
private int _numRecord { get; set; } = 10;
|
||||
|
||||
//private SelectData currFilter
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return MessageService.OEE_Filter;
|
||||
// }
|
||||
// set
|
||||
// {
|
||||
// MessageService.OEE_Filter = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => _currPage;
|
||||
@@ -45,12 +60,17 @@ namespace MP.MONO.UI.Pages
|
||||
if (_currPage != value)
|
||||
{
|
||||
_currPage = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//private string fullPath
|
||||
//{
|
||||
// get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}";
|
||||
//}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
@@ -61,18 +81,30 @@ namespace MP.MONO.UI.Pages
|
||||
if (_numRecord != value)
|
||||
{
|
||||
_numRecord = value;
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowCharts { get; set; } = false;
|
||||
private bool ShowCharts { get; set; } = true;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
//[Inject]
|
||||
//protected MessageService MessageService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
//[Inject]
|
||||
//protected MpStatsService StatService { get; set; }
|
||||
|
||||
protected int totalCount
|
||||
{
|
||||
get
|
||||
@@ -85,20 +117,29 @@ namespace MP.MONO.UI.Pages
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
//protected int machine { get; set; } = ListRecords.Select(x => x.MachineId).FirstOrDefault();
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task reloadData()
|
||||
//private async void clearFile()
|
||||
//{
|
||||
// await Task.Run(() => File.Delete(fullPath));
|
||||
//}
|
||||
|
||||
//private async Task ExportCsv()
|
||||
//{
|
||||
// isLoading = true;
|
||||
// // calcolo nome file
|
||||
// // salvo davvero!
|
||||
// await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath);
|
||||
// isLoading = false;
|
||||
//}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = MP.MONO.UI.Data.CurrentDataService.dbController.AlarmRecGetFilt(int.Parse(ListRecords.Select(x=>x.MachineId)), 0, 200);
|
||||
SearchRecords = MP.MONO.UI.Data.CurrentDataService.dbController.AlarmRecGetParetoFreq(1, DateTime.Now.AddDays(-1), DateTime.Now);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -107,6 +148,16 @@ namespace MP.MONO.UI.Pages
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
//protected async Task DoFilter(SelectData newFilter)
|
||||
//{
|
||||
// clearFile();
|
||||
// currRecord = null;
|
||||
// SearchRecords = null;
|
||||
// ListRecords = null;
|
||||
// currFilter = newFilter;
|
||||
// await ReloadData();
|
||||
//}
|
||||
|
||||
protected void ForceReload(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
@@ -119,42 +170,67 @@ namespace MP.MONO.UI.Pages
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
//clearFile();
|
||||
numRecord = 10;
|
||||
await reloadData();
|
||||
//MessageService.ShowSearch = false;
|
||||
//MessageService.PageName = "TRS/OEE %";
|
||||
//MessageService.PageIcon = "oi oi-monitor";
|
||||
//MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
SearchRecords = MP.MONO.UI.Data.CurrentDataService.dbController.AlarmRecGetParetoFreq(1, DateTime.Now.AddDays(-1), DateTime.Now);
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
//clearFile();
|
||||
//StatService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
//protected async Task ResetFilter(SelectData newFilter)
|
||||
//{
|
||||
// clearFile();
|
||||
// currRecord = null;
|
||||
// SearchRecords = null;
|
||||
// ListRecords = null;
|
||||
// currFilter = SelectData.Init(5, 7);
|
||||
// await ReloadData();
|
||||
//}
|
||||
|
||||
protected void Select(AlarmFreqDTO selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected async Task ToggleChart(bool doShow)
|
||||
{
|
||||
ShowCharts = !ShowCharts;
|
||||
if (ShowCharts)
|
||||
{
|
||||
await reloadData();
|
||||
await ReloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int IdxMacchina)
|
||||
public string checkSelect(DateTime DtStart, double EventCount, int IdxMacchina)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.MachineId == IdxMacchina) ? "table-info" : "";
|
||||
answ = (currRecord.MachineId == IdxMacchina && currRecord.EventCount == EventCount) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -167,6 +243,14 @@ namespace MP.MONO.UI.Pages
|
||||
//MessageService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
}
|
||||
|
||||
// public void OnSeachUpdated()
|
||||
// {
|
||||
// InvokeAsync(() =>
|
||||
// {
|
||||
// UpdateData();
|
||||
// StateHasChanged();
|
||||
// });
|
||||
// }
|
||||
public async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>MAPO-MONO</i>
|
||||
<h4>Version: 1.2.2209.2216</h4>
|
||||
<h4>Version: 1.2.2209.2310</h4>
|
||||
<br /> Release Note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.2.2209.2216
|
||||
1.2.2209.2310
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.2.2209.2216</version>
|
||||
<version>1.2.2209.2310</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user