2023-06-29 16:45:45 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2023-03-24 18:03:17 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class LargeEngineering : 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();
|
2023-10-30 11:13:57 +08:00
|
|
|
|
BLL.ProjectService.InitCNCECShowProjectDropDownList(this.drpProject, true);
|
2023-03-24 18:03:17 +08:00
|
|
|
|
LargerHazard = (from x in Funs.DB.Solution_LargerHazard
|
2023-06-29 16:45:45 +08:00
|
|
|
|
join y in Funs.DB.Base_Project on x.ProjectId equals y.ProjectId
|
|
|
|
|
|
where y.ProjectState == Const.ProjectState_1
|
|
|
|
|
|
select x).ToList();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
// 绑定表格t
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-10 14:33:21 +08:00
|
|
|
|
public static List<Model.Solution_LargerHazard> LargerHazard = new List<Model.Solution_LargerHazard>();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
2023-10-30 11:13:57 +08:00
|
|
|
|
string strSql = @"select ProjectId,ProjectCode, ProjectName from Base_Project where IsCNCECShow=1";
|
2023-03-24 18:03:17 +08:00
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
|
string cpara = string.Empty;
|
|
|
|
|
|
if (this.drpProject.SelectedValue != Const._Null)
|
|
|
|
|
|
{
|
|
|
|
|
|
strSql += " AND projectId = @projectId"; ///状态为已完成
|
|
|
|
|
|
listStr.Add(new SqlParameter("@projectId", this.drpProject.SelectedValue));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
2023-06-29 16:45:45 +08:00
|
|
|
|
|
|
|
|
|
|
this.OutputSummaryData(); ///取合计值
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static int allCount1 = 0, allCount2 = 0, allCount3 = 0, allCount4 = 0, allCount5 = 0, allCount6 = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 计算合计
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void OutputSummaryData()
|
|
|
|
|
|
{
|
|
|
|
|
|
JObject summary = new JObject
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "ProjectName", "合计" },
|
|
|
|
|
|
{ "Count1", allCount1.ToString() },
|
|
|
|
|
|
{ "Count2", allCount2.ToString() },
|
|
|
|
|
|
{ "Count3", allCount3.ToString() },
|
|
|
|
|
|
{ "Count4", allCount4.ToString() },
|
|
|
|
|
|
{ "Count5", allCount5.ToString() },
|
|
|
|
|
|
{ "Count6", allCount6.ToString() }
|
|
|
|
|
|
};
|
|
|
|
|
|
Grid1.SummaryData = summary;
|
2023-03-24 18:03:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
|
#region Grid双击事件 编辑
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Grid行双击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void EditData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("LargeEngineeringItem.aspx?projectId={0}", Grid1.SelectedRowID, "查看 - ")));
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2023-03-24 18:03:17 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取危大工程数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count1(object projectId)
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
int cout1 = 0;
|
|
|
|
|
|
allCount1 = LargerHazard.Where(x => x.IsSuperLargerHazard == false || !x.IsSuperLargerHazard.HasValue).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
2023-06-29 16:45:45 +08:00
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && (x.IsSuperLargerHazard == false || !x.IsSuperLargerHazard.HasValue)).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取超危大工程数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count2(object projectId)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cout1 = 0;
|
2023-06-29 16:45:45 +08:00
|
|
|
|
allCount2 = LargerHazard.Where(x => x.IsSuperLargerHazard == true).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.IsSuperLargerHazard == true).Count();
|
|
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在施危大工程数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count3(object projectId)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cout1 = 0;
|
2023-06-29 16:45:45 +08:00
|
|
|
|
allCount3 = LargerHazard.Where(x => x.States == Const.State_2).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.States == Const.State_2).Count();
|
|
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 审批完成数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count4(object projectId)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cout1 = 0;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
allCount4 = LargerHazard.Where(x => x.States == Const.State_1).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.States == Const.State_1).Count();
|
|
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 培训人次数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count5(object projectId)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cout1 = 0;
|
2023-06-29 16:45:45 +08:00
|
|
|
|
allCount5 = LargerHazard.Sum(x => x.TrainPersonNum ?? 0);
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString()).Sum(x => x.TrainPersonNum ?? 0);
|
2023-03-24 18:03:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 完工个数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected int Count6(object projectId)
|
|
|
|
|
|
{
|
|
|
|
|
|
int cout1 = 0;
|
2023-06-29 16:45:45 +08:00
|
|
|
|
allCount6 = LargerHazard.Where(x => x.States == Const.State_3).Count();
|
2023-03-24 18:03:17 +08:00
|
|
|
|
if (projectId != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
cout1 = LargerHazard.Where(x => x.ProjectId == projectId.ToString() && x.States == Const.State_3).Count();
|
|
|
|
|
|
}
|
|
|
|
|
|
return cout1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|