20240102安全风险数据修正及上报集团方法调整
This commit is contained in:
parent
97015c50ec
commit
65563b6683
|
@ -0,0 +1,12 @@
|
|||
update Hazard_HazardSelectedItem set HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel=1 )
|
||||
where HazardLevel is null or HazardLevel='1'
|
||||
go
|
||||
update Hazard_HazardSelectedItem set HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel=2 )
|
||||
where HazardLevel='2'
|
||||
go
|
||||
update Hazard_HazardSelectedItem set HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel=3 )
|
||||
where HazardLevel='3'
|
||||
go
|
||||
update Hazard_HazardSelectedItem set HazardLevel=(select top 1 RiskLevelId from Base_RiskLevel where RiskLevel=4)
|
||||
where HazardLevel='4'
|
||||
go
|
|
@ -1303,8 +1303,8 @@ namespace BLL
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true
|
||||
select x).Count();
|
||||
where x.ProjectId == projectid && y.RiskLevel == 2 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1316,8 +1316,8 @@ namespace BLL
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true
|
||||
select x).Count();
|
||||
where x.ProjectId == projectid && y.RiskLevel == 1 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1329,8 +1329,8 @@ namespace BLL
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true
|
||||
select x).Count();
|
||||
where x.ProjectId == projectid && y.RiskLevel == 3 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1342,8 +1342,8 @@ namespace BLL
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true
|
||||
select x).Count();
|
||||
where x.ProjectId == projectid && y.RiskLevel == 4 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true"
|
||||
SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true"
|
||||
IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True">
|
||||
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick" EnableTextSelection="True"
|
||||
EnableSummary="true" SummaryPosition="Bottom">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
|
||||
<Items>
|
||||
|
@ -72,8 +73,7 @@
|
|||
<ItemTemplate>
|
||||
<asp:Label ID="Label5" runat="server" Text='<%# Count4(Eval("ProjectId")) %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
|
||||
</f:TemplateField>
|
||||
</Columns>
|
||||
<Listeners>
|
||||
<f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using BLL;
|
||||
using FineUIPro.Web.BaseInfo;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
|
@ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow
|
|||
BLL.ProjectService.InitProjectDropDownList(this.drpProject, true);
|
||||
// 绑定表格t
|
||||
BindGrid();
|
||||
// 合计
|
||||
OutputSummaryData();
|
||||
this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")";
|
||||
}
|
||||
}
|
||||
|
@ -225,8 +228,8 @@ namespace FineUIPro.Web.DataShow
|
|||
/// 定义变量
|
||||
/// </summary>
|
||||
private static IQueryable<Model.Hazard_HazardSelectedItem> getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
where x.IsStart == true
|
||||
select x;
|
||||
where (x.IsStart == true || x.State == "1")
|
||||
select x;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
@ -239,10 +242,45 @@ namespace FineUIPro.Web.DataShow
|
|||
var getlevel = Funs.DB.Base_RiskLevel.FirstOrDefault(x => x.RiskLevel == level);
|
||||
if (getlevel != null)
|
||||
{
|
||||
count = getDataItemLists.Where(x => x.ProjectId == projectId && x.HazardLevel == getlevel.RiskLevelId).Count();
|
||||
string levels = getlevel.RiskLevel.ToString();
|
||||
count = getDataItemLists.Where(x => x.ProjectId == projectId && (x.HazardLevel == getlevel.RiskLevelId || x.HazardLevel == levels)).Count();
|
||||
}
|
||||
return count;
|
||||
|
||||
}
|
||||
|
||||
#region 合计
|
||||
private void OutputSummaryData()
|
||||
{
|
||||
string strSql = @"select ProjectId,ProjectCode, ProjectName ,
|
||||
isnull((select count(*) from Hazard_HazardSelectedItem as a
|
||||
where (a.IsStart=1 or a.State = '1') and a.ProjectId=p.ProjectId
|
||||
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 where (a.IsStart=1 or a.State = '1') and a.ProjectId=p.ProjectId
|
||||
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 where (a.IsStart=1 or a.State = '1') and a.ProjectId=p.ProjectId
|
||||
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 where (a.IsStart=1 or a.State = '1') and a.ProjectId=p.ProjectId
|
||||
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
|
||||
}
|
||||
}
|
|
@ -598,7 +598,7 @@ namespace FineUIPro.Web.common
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where y.RiskLevel == 2 && x.IsStart == true
|
||||
where y.RiskLevel == 2 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ namespace FineUIPro.Web.common
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where y.RiskLevel == 1 && x.IsStart == true
|
||||
where y.RiskLevel == 1 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ namespace FineUIPro.Web.common
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where y.RiskLevel == 3 && x.IsStart == true
|
||||
where y.RiskLevel == 3 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ namespace FineUIPro.Web.common
|
|||
{
|
||||
var result = (from x in Funs.DB.Hazard_HazardSelectedItem
|
||||
join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId
|
||||
where y.RiskLevel == 4 && x.IsStart == true
|
||||
where y.RiskLevel == 4 && (x.IsStart == true || x.State == "1")
|
||||
select x).Count();
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue