20240102安全风险提交方法调整,数据修正
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using BLL;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -25,6 +26,9 @@ namespace FineUIPro.Web.DataShow
|
||||
BLL.ProjectService.InitCNCECShowProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
BindGrid();
|
||||
// 合计
|
||||
OutputSummaryData();
|
||||
this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(Const.UnitId_SEDIN) + ")";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -244,5 +248,47 @@ namespace FineUIPro.Web.DataShow
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData()
|
||||
{
|
||||
string strSql = @"select ProjectId,ProjectCode, ProjectName ,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a
|
||||
LEFT JOIN Hazard_HazardList AS B ON A.HazardListId=B.HazardListId
|
||||
where B.ProjectId=p.ProjectId AND B.States = '2'
|
||||
and (a.HazardLevel='1' or a.HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel='1'))),0) as Count1,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a
|
||||
LEFT JOIN Hazard_HazardList AS B ON A.HazardListId=B.HazardListId
|
||||
where B.ProjectId=p.ProjectId AND B.States = '2'
|
||||
and (a.HazardLevel='2' or a.HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel='2'))),0) as Count2,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a
|
||||
LEFT JOIN Hazard_HazardList AS B ON A.HazardListId=B.HazardListId
|
||||
where B.ProjectId=p.ProjectId AND B.States = '2'
|
||||
and (a.HazardLevel='3' or a.HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel='3'))),0) as Count3,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a
|
||||
LEFT JOIN Hazard_HazardList AS B ON A.HazardListId=B.HazardListId
|
||||
where B.ProjectId=p.ProjectId AND B.States = '2'
|
||||
and (a.HazardLevel='4' or a.HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel='4'))),0) as Count4
|
||||
from Base_Project as P where 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;
|
||||
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"]);
|
||||
}
|
||||
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());
|
||||
Grid1.SummaryData = summary;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user