platform/wms/Charts.aspx.cs

245 lines
6.2 KiB
C#
Raw Permalink Normal View History

2024-02-18 23:33:54 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DeiNiu.Utils;
using DeiNiu.wms.Logical;
using DevExpress.XtraCharts;
using System.Data;
public partial class wms_Charts : System.Web.UI.Page
{
DataSet dsDaily;
DataSet dsErpOrders;
lCharts lchart = new lCharts();
protected void Page_Load(object sender, EventArgs e)
{
loadDailyData();
loadErpData();
}
private void loadErpData()
{
dsErpOrders = lchart.getErpOderData();
//set erp in orders pie
DataTable dt = dsErpOrders.Tables[0];
Series taskSeries = WebChartInOrders.SeriesSerializable[0];
//Series taskSeries2 = this.WebChartErpOrders.SeriesSerializable[0];
//taskSeries2.Points.Clear();
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
// taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString())));
taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString())));
}
//set erp out orders pie
dt = dsErpOrders.Tables[1];
taskSeries = WebChartOutOrders.SeriesSerializable[0];
// taskSeries2 = this.WebChartErpOrders.SeriesSerializable[1];
taskSeries.Points.Clear();
//taskSeries2.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString())));
// taskSeries2.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["orderCnt"].ToString())));
}
// in out line counts
string day = "";
dt = dsErpOrders.Tables[2];
taskSeries = WebChartInOutLines.SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString());
taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString())));
}
dt = dsErpOrders.Tables[3];
taskSeries = WebChartInOutLines.SeriesSerializable[1];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
day = string.Format("{0}-{1}-{2}", dr["year"].ToString(), dr["month"].ToString(), dr["day"].ToString());
taskSeries.Points.Add(new SeriesPoint(day, Convert.ToInt32(dr["cnt"].ToString())));
}
}
void loadDailyData()
{
dsDaily = lchart.getDailyKanBanData();
setTasks();
setLocs();
setUserTasks();
setTasksSumByStatePie();
setPartTasks();
}
private void setTasksSumByStatePie()
{
DataTable dt = dsDaily.Tables[3];
Series taskSeries = WebChartStatePie.SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
taskSeries.Points.Add(new SeriesPoint(dr["state"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString())));
}
}
void setLocs()
{
DataTable dt = dsDaily.Tables[2];
Series taskSeries = WebChartLocs.SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
// taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["totalCnt"].ToString())));
taskSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), dr["usedPercent"].ToString()) );
}
/*
Series finishedSeries = this.WebChartLocs.SeriesSerializable[1];
finishedSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
finishedSeries.Points.Add(new SeriesPoint(dr["volType"].ToString(), Convert.ToInt32(dr["usedCnt"].ToString())));
}
*/
}
void setUserTasks()
{
DataTable dt = dsDaily.Tables[1];
Series taskSeries = WebChartEmpTasks.SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
taskSeries.Points.Add(new SeriesPoint(dr["emName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString())));
}
}
void setTasks()
{
DataTable dt = dsDaily.Tables[0];
Series taskSeries = this.WebChartTasks.SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
taskSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString())));
}
Series finishedSeries = WebChartTasks.SeriesSerializable[1];
finishedSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
finishedSeries.Points.Add(new SeriesPoint(dr["typeName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString())));
}
}
void setPartTasks()
{
DataTable dt = dsDaily.Tables[4];
Series taskSeries = this.WebChartPartTasks .SeriesSerializable[0];
taskSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
taskSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["taskCnt"].ToString())));
}
Series finishedSeries = WebChartPartTasks.SeriesSerializable[1];
finishedSeries.Points.Clear();
foreach (DataRow dr in dt.Rows)
{
finishedSeries.Points.Add(new SeriesPoint(dr["partName"].ToString(), Convert.ToInt32(dr["finishedCnt"].ToString())));
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
// loadData();// Page_Load(sender, e);
}
protected void WebChartEmpTasks_ObjectSelected(object sender, HotTrackEventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
loadDailyData();
loadErpData();
}
}