diff --git a/DataBase/版本日志/SGGLDB_WH_V2024-01-02(安全风险等级修正脚本).sql b/DataBase/版本日志/SGGLDB_WH_V2024-01-02(安全风险等级修正脚本).sql new file mode 100644 index 00000000..a0e497dd --- /dev/null +++ b/DataBase/版本日志/SGGLDB_WH_V2024-01-02(安全风险等级修正脚本).sql @@ -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 \ No newline at end of file diff --git a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs index 45bb3e9a..fd6c1e92 100644 --- a/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs +++ b/SGGL/BLL/ZHGL/DataSync/ProjectDataSync/Project_HSSEData_HSSEService.cs @@ -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; } diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx index 02bd9eb8..0040ef16 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx +++ b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx @@ -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"> @@ -72,8 +73,7 @@ - - + diff --git a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs index 1a7ab495..e9e18080 100644 --- a/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs +++ b/SGGL/FineUIPro.Web/DataShow/SecurityRisk.aspx.cs @@ -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 /// 定义变量 /// private static IQueryable getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem - where x.IsStart == true - select x; + where (x.IsStart == true || x.State == "1") + select x; /// /// /// @@ -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 listStr = new List(); + 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 } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/common/main_new0.aspx.cs b/SGGL/FineUIPro.Web/common/main_new0.aspx.cs index e89c0e3c..9e3f804d 100644 --- a/SGGL/FineUIPro.Web/common/main_new0.aspx.cs +++ b/SGGL/FineUIPro.Web/common/main_new0.aspx.cs @@ -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; }