2023-03-29 14:32:57 +08:00
|
|
|
|
using BLL;
|
2023-11-11 16:02:42 +08:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
2023-03-29 14:32:57 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
|
|
|
{
|
|
|
|
|
public partial class ProjectDivision : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 加载页面
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
|
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
|
|
|
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
|
|
|
|
// 绑定表格t
|
|
|
|
|
BindGrid();
|
2023-11-11 16:02:42 +08:00
|
|
|
|
|
|
|
|
|
//合计
|
|
|
|
|
OutputSummaryData();
|
2023-06-10 10:55:18 +08:00
|
|
|
|
this.Panel1.Title = "工程划分数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + ")";
|
2023-03-29 14:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载页面
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
string strSql = @"SELECT P.ProjectId,P.ProjectCode,P.ProjectName
|
|
|
|
|
,(SELECT COUNT(*) FROM Project_Installation AS A WHERE A.ProjectId =P.ProjectId AND A.SuperInstallationId='0') AS count1
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_UnitWork AS B WHERE B.ProjectId =P.ProjectId) AS count2
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_DivisionProject AS C WHERE C.ProjectId =P.ProjectId AND C.SubItemType= '1') AS count3
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_DivisionProject AS D WHERE D.ProjectId =P.ProjectId AND D.SubItemType= '3') AS count4
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_BreakdownProject AS E WHERE E.ProjectId =P.ProjectId ) AS count5
|
|
|
|
|
FROM Base_Project AS P
|
2023-11-02 15:40:43 +08:00
|
|
|
|
WHERE P.ProjectState = 1 and (P.ProjectState2 is null or P.ProjectState2 !=9) ";
|
2023-03-29 14:32:57 +08:00
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND P.projectId = @projectId"; ///状态为已完成
|
|
|
|
|
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
|
|
|
|
//{
|
|
|
|
|
// strSql += " AND h.RegisterDate >=@StartTime";
|
|
|
|
|
// listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
|
|
|
|
//}
|
|
|
|
|
//if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
|
|
|
|
//{
|
|
|
|
|
// strSql += " AND h.RegisterDate <=@EndTime";
|
|
|
|
|
// listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
|
|
|
|
//}
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 排序
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分页显示条数下拉框
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关闭弹出窗
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-11-11 16:02:42 +08:00
|
|
|
|
|
|
|
|
|
#region 合计
|
|
|
|
|
private void OutputSummaryData() {
|
|
|
|
|
string strSql = @"SELECT P.ProjectId,P.ProjectCode,P.ProjectName
|
|
|
|
|
,(SELECT COUNT(*) FROM Project_Installation AS A WHERE A.ProjectId =P.ProjectId AND A.SuperInstallationId='0') AS count1
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_UnitWork AS B WHERE B.ProjectId =P.ProjectId) AS count2
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_DivisionProject AS C WHERE C.ProjectId =P.ProjectId AND C.SubItemType= '1') AS count3
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_DivisionProject AS D WHERE D.ProjectId =P.ProjectId AND D.SubItemType= '3') AS count4
|
|
|
|
|
,(SELECT COUNT(*) FROM WBS_BreakdownProject AS E WHERE E.ProjectId =P.ProjectId ) AS count5
|
|
|
|
|
FROM Base_Project AS P
|
|
|
|
|
WHERE P.ProjectState = 1 ";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
|
|
|
|
|
int count1 =0, count2=0, count3=0, count4=0, count5 = 0;
|
|
|
|
|
|
|
|
|
|
foreach (DataRow row in tb.Rows)
|
|
|
|
|
{
|
|
|
|
|
count1 += Convert.ToInt32(row["count1"]);
|
|
|
|
|
count2 += Convert.ToInt32(row["count2"]);
|
|
|
|
|
count3 += Convert.ToInt32(row["count3"]);
|
|
|
|
|
count4 += Convert.ToInt32(row["count4"]);
|
|
|
|
|
count5 += Convert.ToInt32(row["count5"]);
|
|
|
|
|
}
|
|
|
|
|
JObject summary = new JObject();
|
|
|
|
|
summary.Add("ProjectName", "合计:");
|
|
|
|
|
summary.Add("count1", count1.ToString());
|
|
|
|
|
summary.Add("count2", count2.ToString());
|
|
|
|
|
summary.Add("count3", count3.ToString());
|
|
|
|
|
summary.Add("count4", count4.ToString());
|
|
|
|
|
summary.Add("count5", count5.ToString());
|
|
|
|
|
Grid1.SummaryData = summary;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2023-03-29 14:32:57 +08:00
|
|
|
|
}
|
|
|
|
|
}
|