527 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			527 lines
		
	
	
		
			20 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Data;
							 | 
						|||
| 
								 | 
							
								using System.Data.SqlClient;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using AspNet = System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.HSSE.HiddenInspection
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class RishAnalysis : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 定义项
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 项目id
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        public string ProjectId
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                return (string)ViewState["ProjectId"];
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            set
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                ViewState["ProjectId"] = value;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 加载页面
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Funs.DropDownPageSize(this.ddlPageSize);
							 | 
						|||
| 
								 | 
							
								                ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
							 | 
						|||
| 
								 | 
							
								                this.txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
							 | 
						|||
| 
								 | 
							
								                this.txtStartTime.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                this.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								                ProjectService.InitProjectDropDownList(this.drpProject, false);
							 | 
						|||
| 
								 | 
							
								                this.drpProject.SelectedValue = this.ProjectId;
							 | 
						|||
| 
								 | 
							
								                this.drpProject.Enabled = false;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                UnitService.InitUnitDropDownList(this.drpUnit, this.ProjectId, true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                BindGrid();
							 | 
						|||
| 
								 | 
							
								              
							 | 
						|||
| 
								 | 
							
								            } 
							 | 
						|||
| 
								 | 
							
								            this.AnalyseData();
							 | 
						|||
| 
								 | 
							
								        } 
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 绑定数据
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void BindGrid()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var getDatas = DataStatisticsService.HazardRegisterStatistics(this.drpProject.SelectedValue, this.drpUnit.SelectedValue, Funs.GetNewDateTime(this.txtStartTime.Text), Funs.GetNewDateTime(this.txtEndTime.Text));
							 | 
						|||
| 
								 | 
							
								            DataTable tb = this.GetPagedDataTable(Grid1, getDatas);
							 | 
						|||
| 
								 | 
							
								            Grid1.RecordCount = tb.Rows.Count;
							 | 
						|||
| 
								 | 
							
								            var table = this.GetPagedDataTable(Grid1, tb);
							 | 
						|||
| 
								 | 
							
								            Grid1.DataSource = table;
							 | 
						|||
| 
								 | 
							
								            Grid1.DataBind();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 查询
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 查询
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void TextBox_TextChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 排序、分页、关闭窗口
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 分页
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 排序
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Grid1_Sort(object sender, GridSortEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 分页显示条数下拉框
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 导出按钮
							 | 
						|||
| 
								 | 
							
								        /// 导出按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnOut_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Response.ClearContent();
							 | 
						|||
| 
								 | 
							
								            string filename = Funs.GetNewFileName();
							 | 
						|||
| 
								 | 
							
								            Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("HSE巡检统计" + filename, System.Text.Encoding.UTF8) + ".xls");
							 | 
						|||
| 
								 | 
							
								            Response.ContentType = "application/excel";
							 | 
						|||
| 
								 | 
							
								            Response.ContentEncoding = System.Text.Encoding.UTF8;
							 | 
						|||
| 
								 | 
							
								            this.Grid1.PageSize = this.Grid1.RecordCount;
							 | 
						|||
| 
								 | 
							
								            BindGrid();
							 | 
						|||
| 
								 | 
							
								            Response.Write(GetGridTableHtml(Grid1));
							 | 
						|||
| 
								 | 
							
								            Response.End();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 导出方法
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="grid"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        private string GetGridTableHtml(Grid grid)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            StringBuilder sb = new StringBuilder();
							 | 
						|||
| 
								 | 
							
								            sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
							 | 
						|||
| 
								 | 
							
								            sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
							 | 
						|||
| 
								 | 
							
								            sb.Append("<tr>");
							 | 
						|||
| 
								 | 
							
								            foreach (GridColumn column in grid.Columns)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                sb.AppendFormat("<td>{0}</td>", column.HeaderText);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            sb.Append("</tr>");
							 | 
						|||
| 
								 | 
							
								            foreach (GridRow row in grid.Rows)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                sb.Append("<tr>");
							 | 
						|||
| 
								 | 
							
								                foreach (GridColumn column in grid.Columns)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    string html = row.Values[column.ColumnIndex].ToString();
							 | 
						|||
| 
								 | 
							
								                    if (column.ColumnID == "tfPageIndex")
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        html = (row.FindControl("lblPageIndex") as AspNet.Label).Text;
							 | 
						|||
| 
								 | 
							
								                    }else if(column.ColumnIndex == 6)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        html = (row.FindControl("DataCountRate") as AspNet.Label).Text;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    sb.AppendFormat("<td>{0}</td>", html);
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                sb.Append("</tr>");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            sb.Append("</table>");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            return sb.ToString();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion     
							 | 
						|||
| 
								 | 
							
								        protected string ConvertDataCountRate(object dataCountRate)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string res = string.Empty;
							 | 
						|||
| 
								 | 
							
								            if (dataCountRate != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                res = ((float)dataCountRate).ToString("0.00");
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return res;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 统计
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 统计分析
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void BtnAnalyse_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.AnalyseData();
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + ");},1000);  ");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        public string legend = "[]";
							 | 
						|||
| 
								 | 
							
								        public string xAxis = "[]";
							 | 
						|||
| 
								 | 
							
								        public string series = "[]";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 统计方法
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private void AnalyseData()
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (this.rblState.SelectedValue == "0")
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                string strSql = @" select u.UnitId,u.unitName,
							 | 
						|||
| 
								 | 
							
								                             count(*)    as allnum,
							 | 
						|||
| 
								 | 
							
								                             Sum(case when States= 1 or States is null then 1 else 0 end) as todo,
							 | 
						|||
| 
								 | 
							
								                             Sum(case when States= 3 or States =2 then 1 else 0 end) as finish
							 | 
						|||
| 
								 | 
							
								                             from HSSE_Hazard_HazardRegister r left join Base_Unit u on r.ResponsibleUnit = u.UnitId
							 | 
						|||
| 
								 | 
							
								                             where u.UnitId is not null and ProjectId=@ProjectId and States != '4' and ProblemTypes = '1'
							 | 
						|||
| 
								 | 
							
								                            ";
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += " and CheckTime >='" + this.txtStartRectificationTime.Text.Trim() + "' ";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                strSql += " group by u.UnitId,u.unitName ";
							 | 
						|||
| 
								 | 
							
								                List<SqlParameter> listStr = new List<SqlParameter>();
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								                DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
							 | 
						|||
| 
								 | 
							
								                legend = "[\"全部\", \"待整改\", \"已整改\"]";
							 | 
						|||
| 
								 | 
							
								                xAxis = "[";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                string series1 = "[";
							 | 
						|||
| 
								 | 
							
								                string series2 = "[";
							 | 
						|||
| 
								 | 
							
								                string series3 = "[";
							 | 
						|||
| 
								 | 
							
								                if (tb != null)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    foreach (DataRow dr in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        xAxis += "\"" + dr["unitName"].ToString() + "\",";
							 | 
						|||
| 
								 | 
							
								                        series1 += "" + dr["allnum"].ToString() + ",";
							 | 
						|||
| 
								 | 
							
								                        series2 += "" + dr["todo"].ToString() + ",";
							 | 
						|||
| 
								 | 
							
								                        series3 += "" + dr["finish"].ToString() + ",";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                xAxis = xAxis.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                xAxis += "]";
							 | 
						|||
| 
								 | 
							
								                series1 = series1.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                series1 += "]";
							 | 
						|||
| 
								 | 
							
								                series2 = series2.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                series2 += "]";
							 | 
						|||
| 
								 | 
							
								                series3 = series3.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                series3 += "]";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                series = @"[{
							 | 
						|||
| 
								 | 
							
								                                name: '全部',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar',
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                            show: true,
							 | 
						|||
| 
								 | 
							
								                                            position: 'top'
							 | 
						|||
| 
								 | 
							
								                                        }, 
							 | 
						|||
| 
								 | 
							
								                                barWidth: 20,
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: " + series1 + @"
							 | 
						|||
| 
								 | 
							
								                            },
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                name: '待整改',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar', 
							 | 
						|||
| 
								 | 
							
								                                barWidth: 20,
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                            show: true,
							 | 
						|||
| 
								 | 
							
								                                            position: 'top'
							 | 
						|||
| 
								 | 
							
								                                        }, 
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: " + series2 + @"
							 | 
						|||
| 
								 | 
							
								                            },
							 | 
						|||
| 
								 | 
							
								                            {
							 | 
						|||
| 
								 | 
							
								                                name: '已整改',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar', 
							 | 
						|||
| 
								 | 
							
								                                barWidth: 20,
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                            show: true,
							 | 
						|||
| 
								 | 
							
								                                            position: 'top'
							 | 
						|||
| 
								 | 
							
								                                        }, 
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: " + series3 + @"
							 | 
						|||
| 
								 | 
							
								                            }]";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string strSql = @" select u.UnitId,u.unitName,r.RegisterTypesId,t.RegisterTypesName,
							 | 
						|||
| 
								 | 
							
								                             count(*)    as allnum,
							 | 
						|||
| 
								 | 
							
								                             Sum(case when States= 1 or States is null then 1 else 0 end) as todo,
							 | 
						|||
| 
								 | 
							
								                             Sum(case when States= 3 or States = 2 then 1 else 0 end) as finish
							 | 
						|||
| 
								 | 
							
								                             from HSSE_Hazard_HazardRegister r left join Base_Unit u on r.ResponsibleUnit = u.UnitId 
							 | 
						|||
| 
								 | 
							
															 left join HSSE_Hazard_HazardRegisterTypes t on r.RegisterTypesId=t.RegisterTypesId
							 | 
						|||
| 
								 | 
							
								                             where u.UnitId is not null and r.RegisterTypesId is not null and  ProjectId=@ProjectId and States != '4' and ProblemTypes = '1'
							 | 
						|||
| 
								 | 
							
								                              ";
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += " and CheckTime >='" + this.txtStartRectificationTime.Text.Trim() + "' ";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    strSql += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                strSql += " group by u.UnitId,u.unitName ,r.RegisterTypesId,t.RegisterTypesName ";
							 | 
						|||
| 
								 | 
							
								                List<SqlParameter> listStr = new List<SqlParameter>();
							 | 
						|||
| 
								 | 
							
								                listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                SqlParameter[] parameter = listStr.ToArray();
							 | 
						|||
| 
								 | 
							
								                DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
							 | 
						|||
| 
								 | 
							
								                Dictionary<string, Dictionary<string, string>> data = new Dictionary<string, Dictionary<string, string>>();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                legend = "[";
							 | 
						|||
| 
								 | 
							
								                xAxis = "[";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                HashSet<string> xdic = new HashSet<string>();
							 | 
						|||
| 
								 | 
							
								                HashSet<string> unitdic = new HashSet<string>();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                foreach (DataRow dr in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    xdic.Add(dr["RegisterTypesName"].ToString());
							 | 
						|||
| 
								 | 
							
								                    unitdic.Add(dr["unitName"].ToString());
							 | 
						|||
| 
								 | 
							
								                    Dictionary<string, string> temp = null;
							 | 
						|||
| 
								 | 
							
								                    if (!data.ContainsKey(dr["unitName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        data.Add(dr["unitName"].ToString(), new Dictionary<string, string>());
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp = data[dr["unitName"].ToString()];
							 | 
						|||
| 
								 | 
							
								                    if (!temp.ContainsKey(dr["RegisterTypesName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        temp.Add(dr["RegisterTypesName"].ToString(), "0");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp[dr["RegisterTypesName"].ToString()] = dr["allnum"].ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                foreach (string types in xdic)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    xAxis += "\"" + types + "\",";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                xAxis = xAxis.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                xAxis += "]";
							 | 
						|||
| 
								 | 
							
								                foreach (string types in unitdic)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    legend += "\"" + types + "[全部]\",";
							 | 
						|||
| 
								 | 
							
								                    legend += "\"" + types + "[未整改]\",";
							 | 
						|||
| 
								 | 
							
								                    legend += "\"" + types + "[已整改]\",";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                legend = legend.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                legend += "]";
							 | 
						|||
| 
								 | 
							
								                series = "[";
							 | 
						|||
| 
								 | 
							
								                foreach (string unit in data.Keys)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    string tempseries = "";
							 | 
						|||
| 
								 | 
							
								                    foreach (string types in xdic)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (data[unit].ContainsKey(types))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "" + data[unit][types] + ",";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "0,";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    series += @"{
							 | 
						|||
| 
								 | 
							
								                                name: '" + unit + @"[全部]',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar',
							 | 
						|||
| 
								 | 
							
								                                stack: '全部',
							 | 
						|||
| 
								 | 
							
								                                barWidth: 10,
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                    show: true,
							 | 
						|||
| 
								 | 
							
								                                    position: 'top'
							 | 
						|||
| 
								 | 
							
								                                }, 
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: [" + tempseries.TrimEnd(',') + @"] 
							 | 
						|||
| 
								 | 
							
								                                },";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                data = new Dictionary<string, Dictionary<string, string>>();
							 | 
						|||
| 
								 | 
							
								                foreach (DataRow dr in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    xdic.Add(dr["RegisterTypesName"].ToString());
							 | 
						|||
| 
								 | 
							
								                    Dictionary<string, string> temp = null;
							 | 
						|||
| 
								 | 
							
								                    if (!data.ContainsKey(dr["unitName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        data.Add(dr["unitName"].ToString(), new Dictionary<string, string>());
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp = data[dr["unitName"].ToString()];
							 | 
						|||
| 
								 | 
							
								                    if (!temp.ContainsKey(dr["RegisterTypesName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        temp.Add(dr["RegisterTypesName"].ToString(), "0");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp[dr["RegisterTypesName"].ToString()] = dr["todo"].ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (string unit in data.Keys)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    string tempseries = "";
							 | 
						|||
| 
								 | 
							
								                    foreach (string types in xdic)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (data[unit].ContainsKey(types))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "" + data[unit][types] + ",";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "0,";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    series += @"{
							 | 
						|||
| 
								 | 
							
								                                name: '" + unit + @"[未整改]',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar',
							 | 
						|||
| 
								 | 
							
								                                stack: '未整改',
							 | 
						|||
| 
								 | 
							
								                                barWidth: 10,
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                    show: true,
							 | 
						|||
| 
								 | 
							
								                                    position: 'top'
							 | 
						|||
| 
								 | 
							
								                                }, 
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: [" + tempseries.TrimEnd(',') + @"] 
							 | 
						|||
| 
								 | 
							
								                                },";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                data = new Dictionary<string, Dictionary<string, string>>();
							 | 
						|||
| 
								 | 
							
								                foreach (DataRow dr in tb.Rows)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    xdic.Add(dr["RegisterTypesName"].ToString());
							 | 
						|||
| 
								 | 
							
								                    Dictionary<string, string> temp = null;
							 | 
						|||
| 
								 | 
							
								                    if (!data.ContainsKey(dr["unitName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        data.Add(dr["unitName"].ToString(), new Dictionary<string, string>());
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp = data[dr["unitName"].ToString()];
							 | 
						|||
| 
								 | 
							
								                    if (!temp.ContainsKey(dr["RegisterTypesName"].ToString()))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        temp.Add(dr["RegisterTypesName"].ToString(), "0");
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    temp[dr["RegisterTypesName"].ToString()] = dr["finish"].ToString();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                foreach (string unit in data.Keys)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    string tempseries = "";
							 | 
						|||
| 
								 | 
							
								                    foreach (string types in xdic)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (data[unit].ContainsKey(types))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "" + data[unit][types] + ",";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            tempseries += "0,";
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    series += @"{
							 | 
						|||
| 
								 | 
							
								                                name: '" + unit + @"[已整改]',
							 | 
						|||
| 
								 | 
							
								                                type: 'bar',
							 | 
						|||
| 
								 | 
							
								                                stack: '已整改',
							 | 
						|||
| 
								 | 
							
								                                barWidth: 10,
							 | 
						|||
| 
								 | 
							
								                                label: {
							 | 
						|||
| 
								 | 
							
								                                    show: true,
							 | 
						|||
| 
								 | 
							
								                                    position: 'top'
							 | 
						|||
| 
								 | 
							
								                                }, 
							 | 
						|||
| 
								 | 
							
								                                emphasis: {
							 | 
						|||
| 
								 | 
							
								                                    focus: 'series'
							 | 
						|||
| 
								 | 
							
								                                },
							 | 
						|||
| 
								 | 
							
								                                data: [" + tempseries.TrimEnd(',') + @"] 
							 | 
						|||
| 
								 | 
							
								                                },";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                series = series.TrimEnd(',');
							 | 
						|||
| 
								 | 
							
								                series += "]";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 图形
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 图形变换 
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void drpChartType_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.AnalyseData();
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(@"setTimeout(function () {  rendChart(" + legend + "," + xAxis + "," + series + ");}, 1000); ");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            this.AnalyseData();
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(@"setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + ");}, 1000);");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |