diff --git a/SGGL/FineUIPro.Web/common/mainMenu_HSSE.aspx.cs b/SGGL/FineUIPro.Web/common/mainMenu_HSSE.aspx.cs index bbc9f94e..b47823a4 100644 --- a/SGGL/FineUIPro.Web/common/mainMenu_HSSE.aspx.cs +++ b/SGGL/FineUIPro.Web/common/mainMenu_HSSE.aspx.cs @@ -244,16 +244,22 @@ namespace FineUIPro.Web List listType = new List(); List listTAll = new List(); List listTNo = new List(); + + string strSql = @"select b.RegisterTypesName ,count(*) allr ,sum(case when states=3 then 1 else 0 end) finish from HSSE_Hazard_HazardRegister a left join HSSE_Hazard_HazardRegisterTypes b on a.RegisterTypesId = b.RegisterTypesId + where a.ProjectId='" + this.ProjectId + @"' and b.RegisterTypesName is not null + group by b.RegisterTypesName"; + DataTable tb = SQLHelper.GetDataTableRunText(strSql, null); + var getTypes = HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1"); - if (getTypes.Count() > 0) + if (tb!=null && tb.Rows.Count>0) { - foreach (var item in getTypes) + foreach (DataRow item in tb.Rows) { - listType.Add(item.RegisterTypesName); - var unitHazardRegisters = getHazardRegisterLists.Where(x => x.RegisterTypesId == item.RegisterTypesId); - var noW = unitHazardRegisters.Where(x => x.States == "3"); - listTAll.Add(unitHazardRegisters.Count()); - listTNo.Add(unitHazardRegisters.Count() - noW.Count()); + listType.Add(item["RegisterTypesName"].ToString()); + //var unitHazardRegisters = getHazardRegisterLists.Where(x => x.RegisterTypesId == item.RegisterTypesId); + //var noW = unitHazardRegisters.Where(x => x.States == "3"); + listTAll.Add(int.Parse(item["allr"].ToString())); + listTNo.Add(int.Parse(item["allr"].ToString()) - int.Parse(item["finish"].ToString())); } CheckTypeALLCount = JsonConvert.SerializeObject(listTAll); CheckTypeNoCount = JsonConvert.SerializeObject(listTNo);