CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.cs

165 lines
7.4 KiB
C#
Raw Normal View History

2024-01-29 10:02:33 +08:00
using System;
using System.Collections.Generic;
2024-01-30 09:30:40 +08:00
using System.Data;
2024-01-29 10:02:33 +08:00
using System.Linq;
2024-01-30 09:30:40 +08:00
using BLL;
2024-01-29 10:02:33 +08:00
namespace FineUIPro.Web.Transfer.Chart
{
2024-01-30 09:30:40 +08:00
public partial class PunchlistFrom : PageBase
2024-01-29 10:02:33 +08:00
{
2024-01-30 09:30:40 +08:00
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-01-29 10:02:33 +08:00
protected void Page_Load(object sender, EventArgs e)
{
2024-01-30 09:30:40 +08:00
if (!IsPostBack)
{
}
}
#endregion
#region
/// <summary>
/// 统计分析
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void BtnAnalyse_Click(object sender, EventArgs e)
{
this.AnalyseData();
}
/// <summary>
/// 统计方法
/// </summary>
private void AnalyseData()
{
2024-01-30 15:26:48 +08:00
var forms = from x in Funs.DB.Transfer_PunchlistFrom
where x.ProjectId == this.CurrUser.LoginProjectId
select x;
if (!string.IsNullOrEmpty(this.txtStartTime.Text.Trim()))
2024-01-30 09:30:40 +08:00
{
2024-01-30 15:26:48 +08:00
forms = forms.Where(x => x.PUNCH_ITEM_FINISH_DATE >= Funs.GetNewDateTime(this.txtStartTime.Text.Trim()));
2024-01-30 09:30:40 +08:00
}
2024-01-30 15:26:48 +08:00
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
2024-01-30 09:30:40 +08:00
{
2024-01-30 15:26:48 +08:00
forms = forms.Where(x => x.PUNCH_ITEM_FINISH_DATE <= Funs.GetNewDateTime(this.txtEndTime.Text.Trim()));
2024-01-30 09:30:40 +08:00
}
2024-01-30 15:26:48 +08:00
var list = new List<string> { "Testing", "Pre-Commissioning", "PSSR", "Commissioning" };
2024-01-30 09:30:40 +08:00
if (this.rblState.SelectedValue == "0")
{
2024-01-30 15:26:48 +08:00
#region Identified during/by统计
2024-01-30 09:30:40 +08:00
if (this.drpChartType.SelectedValue != "Pie") //非饼形图
{
///按单位统计
DataTable dtTime = new DataTable();
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("Identified during/by", typeof(string));
2024-01-30 09:30:40 +08:00
dtTime.Columns.Add("总数量", typeof(string));
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("A数量", typeof(string));
dtTime.Columns.Add("B数量", typeof(string));
dtTime.Columns.Add("C数量", typeof(string));
foreach (var item in list)
2024-01-30 09:30:40 +08:00
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
2024-01-30 15:26:48 +08:00
rowTime["Identified during/by"] = item;
var types = forms.Where(x => x.Identified == item);
rowTime["总数量"] = types.Count();
rowTime["A数量"] = types.Where(x => x.Category == "A").Count();
rowTime["B数量"] = types.Where(x => x.Category == "B").Count();
rowTime["C数量"] = types.Where(x => x.Category == "C").Count();
2024-01-30 09:30:40 +08:00
dtTime.Rows.Add(rowTime);
}
2024-01-30 15:26:48 +08:00
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
2024-01-30 09:30:40 +08:00
}
else //饼形图
{
DataTable dtTime = new DataTable();
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("Identified during/by", typeof(string));
2024-01-30 09:30:40 +08:00
dtTime.Columns.Add("总数量", typeof(string));
2024-01-30 15:26:48 +08:00
foreach (var item in list)
2024-01-30 09:30:40 +08:00
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
2024-01-30 15:26:48 +08:00
rowTime["Identified during/by"] = item;
var types = forms.Where(x => x.Identified == item);
rowTime["总数量"] = types.Count();
2024-01-30 09:30:40 +08:00
dtTime.Rows.Add(rowTime);
}
2024-01-30 15:26:48 +08:00
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1130, 550, this.ckbShow.Checked));
2024-01-30 09:30:40 +08:00
}
#endregion
}
else
{
2024-01-30 15:26:48 +08:00
#region Discipline
var disciplines = from x in Funs.DB.Base_TransferMajor orderby x.DisciplineCode select x;
2024-01-30 09:30:40 +08:00
if (this.drpChartType.SelectedValue != "Pie") //非饼形图
{
///按检查项
DataTable dtTime = new DataTable();
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("Discipline", typeof(string));
2024-01-30 09:30:40 +08:00
dtTime.Columns.Add("总数量", typeof(string));
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("A数量", typeof(string));
dtTime.Columns.Add("B数量", typeof(string));
dtTime.Columns.Add("C数量", typeof(string));
foreach (var item in disciplines)
2024-01-30 09:30:40 +08:00
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
2024-01-30 15:26:48 +08:00
rowTime["Discipline"] = item.Discipline;
2024-02-01 11:01:07 +08:00
var types = forms.Where(x => x.Discipline == item.Discipline || x.Discipline==item.DisciplineCode);
2024-01-30 15:26:48 +08:00
rowTime["总数量"] = types.Count();
rowTime["A数量"] = types.Where(x => x.Category == "A").Count();
rowTime["B数量"] = types.Where(x => x.Category == "B").Count();
rowTime["C数量"] = types.Where(x => x.Category == "C").Count();
2024-01-30 09:30:40 +08:00
dtTime.Rows.Add(rowTime);
}
2024-01-29 10:02:33 +08:00
2024-01-30 15:26:48 +08:00
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
2024-01-30 09:30:40 +08:00
}
else //饼形图
{
///按问题类型
DataTable dtTime = new DataTable();
2024-01-30 15:26:48 +08:00
dtTime.Columns.Add("Discipline", typeof(string));
2024-01-30 09:30:40 +08:00
dtTime.Columns.Add("总数量", typeof(string));
2024-01-30 15:26:48 +08:00
foreach (var item in disciplines)
2024-01-30 09:30:40 +08:00
{
DataRow rowTime = dtTime.NewRow();
Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
2024-01-30 15:26:48 +08:00
rowTime["Discipline"] = item.Discipline;
2024-02-01 11:01:07 +08:00
var types = forms.Where(x => x.Discipline == item.Discipline || x.Discipline == item.DisciplineCode);
2024-01-30 15:26:48 +08:00
rowTime["总数量"] = types.Count();
2024-01-30 09:30:40 +08:00
dtTime.Rows.Add(rowTime);
}
2024-01-30 15:26:48 +08:00
this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "尾项分析", this.drpChartType.SelectedValue, 1100, 550, this.ckbShow.Checked));
2024-01-30 09:30:40 +08:00
}
#endregion
}
}
#endregion
#region
/// <summary>
/// 图形变换
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void drpChartType_SelectedIndexChanged(object sender, EventArgs e)
{
this.AnalyseData();
}
protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e)
{
this.AnalyseData();
2024-01-29 10:02:33 +08:00
}
2024-01-30 09:30:40 +08:00
#endregion
2024-01-29 10:02:33 +08:00
}
}