Merge branch 'master' of https://gitee.com/frane-yang/SGGL_CWCEC
This commit is contained in:
		
						commit
						66a56a44af
					
				|  | @ -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,7 +1303,7 @@ namespace BLL | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId | ||||||
|                 where x.ProjectId == projectid && y.RiskLevel == 2 && x.IsStart == true |                 where x.ProjectId == projectid && y.RiskLevel == 2 && (x.IsStart == true || x.State == "1") | ||||||
|                           select x).Count(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -1316,7 +1316,7 @@ namespace BLL | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId | ||||||
|                 where x.ProjectId == projectid && y.RiskLevel == 1 && x.IsStart == true |                 where x.ProjectId == projectid && y.RiskLevel == 1 && (x.IsStart == true || x.State == "1") | ||||||
|                           select x).Count(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -1329,7 +1329,7 @@ namespace BLL | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId | ||||||
|                 where x.ProjectId == projectid && y.RiskLevel == 3 && x.IsStart == true |                 where x.ProjectId == projectid && y.RiskLevel == 3 && (x.IsStart == true || x.State == "1") | ||||||
|                           select x).Count(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -1342,7 +1342,7 @@ namespace BLL | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                 join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId | ||||||
|                 where x.ProjectId == projectid && y.RiskLevel == 4 && x.IsStart == true |                 where x.ProjectId == projectid && y.RiskLevel == 4 && (x.IsStart == true || x.State == "1") | ||||||
|                           select x).Count(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  | @ -19,7 +19,8 @@ | ||||||
|                     runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" |                     runat="server" BoxFlex="1" DataKeyNames="ProjectId" DataIDField="ProjectId" AllowSorting="true" | ||||||
|                     SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" |                     SortField="ProjectName" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true" | ||||||
|                     IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="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> |                     <Toolbars> | ||||||
|                         <f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left"> |                         <f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left"> | ||||||
|                             <Items> |                             <Items> | ||||||
|  | @ -73,7 +74,6 @@ | ||||||
|                                 <asp:Label ID="Label5" runat="server" Text='<%# Count4(Eval("ProjectId")) %>'></asp:Label> |                                 <asp:Label ID="Label5" runat="server" Text='<%# Count4(Eval("ProjectId")) %>'></asp:Label> | ||||||
|                             </ItemTemplate> |                             </ItemTemplate> | ||||||
|                         </f:TemplateField>                           |                         </f:TemplateField>                           | ||||||
|                            |  | ||||||
|                     </Columns> |                     </Columns> | ||||||
|                     <Listeners> |                     <Listeners> | ||||||
|                         <f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" /> |                         <f:Listener Event="beforerowcontextmenu" Handler="onRowContextMenu" /> | ||||||
|  |  | ||||||
|  | @ -1,5 +1,6 @@ | ||||||
| using BLL; | using BLL; | ||||||
| using FineUIPro.Web.BaseInfo; | using FineUIPro.Web.BaseInfo; | ||||||
|  | using Newtonsoft.Json.Linq; | ||||||
| using System; | using System; | ||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Data; | using System.Data; | ||||||
|  | @ -25,6 +26,8 @@ namespace FineUIPro.Web.DataShow | ||||||
|                 BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); |                 BLL.ProjectService.InitProjectDropDownList(this.drpProject, true); | ||||||
|                 // 绑定表格t |                 // 绑定表格t | ||||||
|                 BindGrid(); |                 BindGrid(); | ||||||
|  |                 // 合计 | ||||||
|  |                 OutputSummaryData(); | ||||||
|                 this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")"; |                 this.Panel1.Title = "安全风险数据(" + BLL.UnitService.GetUnitNameByUnitId(BLL.Const.UnitId_CWCEC) + ")"; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | @ -225,7 +228,7 @@ namespace FineUIPro.Web.DataShow | ||||||
|         /// 定义变量 |         /// 定义变量 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         private static IQueryable<Model.Hazard_HazardSelectedItem> getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem |         private static IQueryable<Model.Hazard_HazardSelectedItem> getDataItemLists = from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                                                                                   where x.IsStart == true |                                                                                       where (x.IsStart == true || x.State == "1") | ||||||
|                                                                                       select x; |                                                                                       select x; | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         ///  |         ///  | ||||||
|  | @ -239,10 +242,45 @@ namespace FineUIPro.Web.DataShow | ||||||
|             var getlevel = Funs.DB.Base_RiskLevel.FirstOrDefault(x => x.RiskLevel == level); |             var getlevel = Funs.DB.Base_RiskLevel.FirstOrDefault(x => x.RiskLevel == level); | ||||||
|             if (getlevel != null) |             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; |             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 |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                           join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                           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(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -611,7 +611,7 @@ namespace FineUIPro.Web.common | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                           join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                           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(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -624,7 +624,7 @@ namespace FineUIPro.Web.common | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                           join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                           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(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  | @ -637,7 +637,7 @@ namespace FineUIPro.Web.common | ||||||
|         { |         { | ||||||
|             var result = (from x in Funs.DB.Hazard_HazardSelectedItem |             var result = (from x in Funs.DB.Hazard_HazardSelectedItem | ||||||
|                           join y in Funs.DB.Base_RiskLevel on x.HazardLevel equals y.RiskLevelId |                           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(); |                           select x).Count(); | ||||||
|             return result; |             return result; | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue