inizio modulo daily stats
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_DailyStatsList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_DailyStatsList" %>
|
||||
|
||||
<%@ Register Src="~/WebUserControls/cmp_numRow.ascx" TagPrefix="uc1" TagName="cmp_numRow" %>
|
||||
<%@ Register Src="~/WebUserControls/cmp_BatchStatsPlot.ascx" TagPrefix="uc1" TagName="cmp_BatchStatsPlot" %>
|
||||
|
||||
<div class="row" runat="server" id="divGraph">
|
||||
<div class="col-12">
|
||||
<uc1:cmp_BatchStatsPlot runat="server" id="cmp_BatchStatsPlot" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<b class="text-uppercase"><%: traduci("BatchPreviewStats") %></b>
|
||||
</div>
|
||||
<div class="col-8 text-right small">
|
||||
<%: traduci("PlotGraph") %>
|
||||
<asp:CheckBox runat="server" ID="chkPlotGraph" AutoPostBack="true" OnCheckedChanged="chkPlotGraph_CheckedChanged" />
|
||||
<asp:DropDownList runat="server" ID="ddlType" AutoPostBack="true" OnSelectedIndexChanged="ddlType_SelectedIndexChanged">
|
||||
<asp:ListItem Text="Yeld" Value="Yeld"></asp:ListItem>
|
||||
<asp:ListItem Text="# Materials" Value="NumMat"></asp:ListItem>
|
||||
<asp:ListItem Text="# Sheets" Value="NumSheets"></asp:ListItem>
|
||||
<asp:ListItem Text="# Models" Value="NumModel"></asp:ListItem>
|
||||
<asp:ListItem Text="# Kits" Value="NumKit"></asp:ListItem>
|
||||
<asp:ListItem Text="# Parts" Value="NumParts"></asp:ListItem>
|
||||
<asp:ListItem Text="# Painted" Value="NumPainted"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
|
|
||||
<%: traduci("ShowLast") %>:
|
||||
<asp:TextBox runat="server" ID="txtNumShow" Text="100" AutoPostBack="true" TextMode="Number" OnTextChanged="txtNumShow_TextChanged" />
|
||||
|
|
||||
<uc1:cmp_numRow runat="server" ID="cmp_numRow" numRow="10" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 textCondens px-0">
|
||||
<asp:GridView ID="grView" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="BatchID" DataSourceID="ods" CssClass="table table-sm table-striped text-right" AllowSorting="false" OnPageIndexChanged="grView_PageIndexChanged">
|
||||
<HeaderStyle CssClass="default" />
|
||||
<PagerStyle CssClass="active GridPager" />
|
||||
<PagerSettings Mode="NumericFirstLast" />
|
||||
<SelectedRowStyle CssClass="table-info" />
|
||||
<EmptyDataTemplate>
|
||||
<%: traduci("NoRecord") %>
|
||||
</EmptyDataTemplate>
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Takt" SortExpression="Takt" ItemStyle-CssClass="text-left" HeaderStyle-CssClass="text-left">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="Label1" runat="server" Text='<%# Eval("Takt") %>' ToolTip='<%# Eval("BatchID") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:BoundField DataField="AvgYeld" HeaderText="Yeld %" SortExpression="AvgYeld" DataFormatString="{0:P2}" />
|
||||
<asp:BoundField DataField="NumMat" HeaderText="# Materials" SortExpression="NumMat" />
|
||||
<asp:BoundField DataField="NumSheets" HeaderText="# Sheets" SortExpression="NumSheets" />
|
||||
<asp:BoundField DataField="NumModel" HeaderText="# Model" SortExpression="NumModel" />
|
||||
<asp:BoundField DataField="NumKit" HeaderText="# Kit" SortExpression="NumKit" />
|
||||
<asp:BoundField DataField="NumParts" HeaderText="# Parts" SortExpression="NumParts" />
|
||||
<asp:BoundField DataField="NumPainted" HeaderText="# Painted" SortExpression="NumPainted" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
<asp:ObjectDataSource ID="ods" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="getLast" TypeName="AppData.DS_AppTableAdapters.BatchStatsTableAdapter">
|
||||
<SelectParameters>
|
||||
<asp:ControlParameter ControlID="txtNumShow" DefaultValue="20" Name="ShowMax" PropertyName="Text" Type="Int32" />
|
||||
</SelectParameters>
|
||||
</asp:ObjectDataSource>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Web.UI;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_DailyStatsList : BaseUserControl
|
||||
{
|
||||
#region Protected Properties
|
||||
|
||||
protected int ShowLast
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 100;
|
||||
int.TryParse(txtNumShow.Text, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
txtNumShow.Text = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void Cmp_numRow_eh_doRefresh(object sender, EventArgs e)
|
||||
{
|
||||
// recupero num righe ed aggiorno...
|
||||
grView.PageSize = cmp_numRow.numRow;
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
private void updateGraph()
|
||||
{
|
||||
cmp_BatchStatsPlot.PlotType = ddlType.SelectedValue;
|
||||
cmp_BatchStatsPlot.ShowLast = ShowLast;
|
||||
cmp_BatchStatsPlot.Legend = traduci($"rep_{ddlType.SelectedValue}");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void chkPlotGraph_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
protected void ddlPlaces_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
protected void grView_PageIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caricamento pagina
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
cmp_numRow.numRow = 10;
|
||||
grView.PageSize = cmp_numRow.numRow;
|
||||
divGraph.Visible = false;
|
||||
ddlType.Visible = false;
|
||||
}
|
||||
cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh;
|
||||
}
|
||||
|
||||
protected void txtNumShow_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
doUpdate();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void doUpdate()
|
||||
{
|
||||
divGraph.Visible = chkPlotGraph.Checked;
|
||||
ddlType.Visible = chkPlotGraph.Checked;
|
||||
if (chkPlotGraph.Checked)
|
||||
{
|
||||
updateGraph();
|
||||
}
|
||||
grView.DataBind();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_DailyStatsList
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// divGraph control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divGraph;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_BatchStatsPlot control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_BatchStatsPlot cmp_BatchStatsPlot;
|
||||
|
||||
/// <summary>
|
||||
/// chkPlotGraph control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CheckBox chkPlotGraph;
|
||||
|
||||
/// <summary>
|
||||
/// ddlType control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList ddlType;
|
||||
|
||||
/// <summary>
|
||||
/// txtNumShow control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox txtNumShow;
|
||||
|
||||
/// <summary>
|
||||
/// cmp_numRow control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::NKC_WF.WebUserControls.cmp_numRow cmp_numRow;
|
||||
|
||||
/// <summary>
|
||||
/// grView control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.GridView grView;
|
||||
|
||||
/// <summary>
|
||||
/// ods control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_DailyStatsPlot.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_DailyStatsPlot" %>
|
||||
|
||||
<%--https://www.chartjs.org/--%>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 px-2">
|
||||
<h4>Batch Stats Plot</h4>
|
||||
</div>
|
||||
<div class="col-12 px-2">
|
||||
<asp:HiddenField runat="server" ID="hfShowLast" Value="10" />
|
||||
<asp:HiddenField runat="server" ID="hfPlotType" Value="" />
|
||||
<asp:HiddenField runat="server" ID="hfLegend" Value="" />
|
||||
<canvas id="myChartTS" height="200"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
// funzione eseguita se successo al caricamento
|
||||
function OnSuccess_(reponse) {
|
||||
// recupero dati restituiti
|
||||
var dataTS = reponse;
|
||||
//console.log('Received data', dataTS);
|
||||
|
||||
// preparo etichette
|
||||
var labelsTS = dataTS.map(function (item) {
|
||||
return item['x'];
|
||||
});
|
||||
//console.log('labels data', labels);
|
||||
|
||||
var myOptions = {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
yAxes: [{
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
},
|
||||
}],
|
||||
},
|
||||
animation: {
|
||||
duration: 250
|
||||
},
|
||||
};
|
||||
|
||||
// recupero obj chart
|
||||
var ctx = document.getElementById('myChartTS').getContext('2d');
|
||||
|
||||
var chart = new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: labelsTS,
|
||||
|
||||
datasets: [{
|
||||
label: '<%=hfLegend.Value %>',
|
||||
borderColor: 'rgb(7, 173, 236)',
|
||||
lineTension: 0,
|
||||
//steppedLine: false,
|
||||
data: dataTS
|
||||
}]
|
||||
},
|
||||
options: myOptions
|
||||
});
|
||||
}
|
||||
// errore in reload!
|
||||
function OnErrorCall_(repo) {
|
||||
alert("Errore recupero dati grafico!");
|
||||
}
|
||||
// effettuo plotting grafico TimeSerie!
|
||||
function plotTS() {
|
||||
//console.log("api/BatchStats/<%=hfShowLast.Value %>?PlotType=<%=hfPlotType.Value%>");
|
||||
// caricamento pagina
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "../api/BatchStats/<%=hfShowLast.Value %>?PlotType=<%=hfPlotType.Value%>",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
success: OnSuccess_,
|
||||
error: OnErrorCall_
|
||||
});
|
||||
}
|
||||
|
||||
// funzione di drawing ad OGNI pageload!
|
||||
function pageLoad() {
|
||||
// chiamo recupero dati + plot della TS
|
||||
plotTS();
|
||||
//console.log('pageLoad!');
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_DailyStatsPlot : System.Web.UI.UserControl
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Legend
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfLegend.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfLegend.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string PlotType
|
||||
{
|
||||
get
|
||||
{
|
||||
return hfPlotType.Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfPlotType.Value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int ShowLast
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
int.TryParse(hfShowLast.Value, out answ);
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
hfShowLast.Value = $"{value}";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
|
||||
|
||||
public partial class cmp_DailyStatsPlot
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// hfShowLast control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfShowLast;
|
||||
|
||||
/// <summary>
|
||||
/// hfPlotType control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfPlotType;
|
||||
|
||||
/// <summary>
|
||||
/// hfLegend control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.HiddenField hfLegend;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_dailyStats.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_dailyStats" %>
|
||||
|
||||
<h1>Daily Stats</h1>
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_dailyStats : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace NKC_WF.WebUserControls
|
||||
{
|
||||
public partial class cmp_dailyStats
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user