2022-03-15 17:36:38 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using BLL;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.HiddenInspection
|
|
|
|
|
{
|
|
|
|
|
public partial class RiskAnalysisChart : PageBase
|
|
|
|
|
{
|
2023-09-22 17:36:00 +08:00
|
|
|
|
#region 加载页面
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(this.drpUnit, this.CurrUser.LoginProjectId, Const.ProjectUnitType_2, true);
|
|
|
|
|
this.drpRegisterTypes.DataTextField = "RegisterTypesName";
|
|
|
|
|
this.drpRegisterTypes.DataValueField = "RegisterTypesId";
|
|
|
|
|
this.drpRegisterTypes.DataSource = BLL.HSSE_Hazard_HazardRegisterTypesService.GetHazardRegisterTypesList("1"); //安全巡检类型
|
|
|
|
|
this.drpRegisterTypes.DataBind();
|
|
|
|
|
Funs.FineUIPleaseSelect(drpRegisterTypes);
|
|
|
|
|
}
|
|
|
|
|
this.AnalyseData();
|
|
|
|
|
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 统计
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计分析
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.AnalyseData();
|
2023-09-22 17:36:00 +08:00
|
|
|
|
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend+","+xAxis+","+series+ "); pie( '',"+ xPieAxis+", "+seriesPie+") ; },1000); ");
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public string legend = "[]";
|
|
|
|
|
public string xAxis="[]";
|
|
|
|
|
public string series="[]";
|
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
|
|
|
|
|
public string xPieAxis = "[]";
|
|
|
|
|
|
|
|
|
|
public string seriesPie = "[]";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 统计方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void AnalyseData()
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
|
|
|
|
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 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()))
|
|
|
|
|
{
|
2024-01-03 14:12:27 +08:00
|
|
|
|
strSql += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
2023-07-03 14:46:37 +08:00
|
|
|
|
|
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and r.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and r.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
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 = "[";
|
|
|
|
|
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,
|
2023-09-04 19:38:45 +08:00
|
|
|
|
barGap:'5%',
|
2022-03-15 17:36:38 +08:00
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series1 + @"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '待整改',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 20,
|
2023-09-04 19:38:45 +08:00
|
|
|
|
barGap:'5%',
|
2022-03-15 17:36:38 +08:00
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
position: 'top'
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series2 + @"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '已整改',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 20,
|
2023-09-04 19:38:45 +08:00
|
|
|
|
barGap:'5%',
|
2022-03-15 17:36:38 +08:00
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
position: 'top'
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series3 + @"
|
|
|
|
|
}]";
|
|
|
|
|
|
2024-01-03 14:12:27 +08:00
|
|
|
|
|
|
|
|
|
string strSql1 = @" select r.RegisterTypesId,t.RegisterTypesName,
|
2023-09-22 17:36:00 +08:00
|
|
|
|
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 HSSE_Hazard_HazardRegisterTypes t on r.RegisterTypesId=t.RegisterTypesId
|
|
|
|
|
where ProjectId=@ProjectId and States != '4' and ProblemTypes = '1'
|
|
|
|
|
";
|
2024-01-03 14:12:27 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime >='" + this.txtStartRectificationTime.Text.Trim() + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
strSql1 += " group by r.RegisterTypesId,t.RegisterTypesName ";
|
|
|
|
|
List<SqlParameter> listStr1 = new List<SqlParameter>();
|
|
|
|
|
listStr1.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parameter1 = listStr1.ToArray();
|
|
|
|
|
DataTable tb1 = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
|
|
|
|
if (tb1 != null)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis = "[";
|
|
|
|
|
seriesPie = "[";
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr in tb1.Rows)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis += " '" + dr["RegisterTypesName"].ToString() + "' ,";
|
|
|
|
|
seriesPie += " { name:'" + dr["RegisterTypesName"].ToString() + "', value:" + dr["allnum"].ToString() + "} ,";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
xPieAxis = xPieAxis.TrimEnd(',');
|
|
|
|
|
seriesPie = seriesPie.TrimEnd(',');
|
|
|
|
|
xPieAxis += "]";
|
|
|
|
|
seriesPie += "]";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (this.rblState.SelectedValue == "2")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strSql = @" select a.CheckManId,b.UserName,
|
|
|
|
|
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 a left join Sys_User b on a.CheckManId = b.UserId
|
|
|
|
|
where a.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") + "' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and a.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and a.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
strSql += " group by a.CheckManId,b.UserName ";
|
|
|
|
|
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 = "[";
|
|
|
|
|
foreach (DataRow dr in tb.Rows)
|
|
|
|
|
{
|
|
|
|
|
xAxis += "\"" + dr["UserName"].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,
|
|
|
|
|
barGap:'5%',
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series1 + @"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '待整改',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 20,
|
|
|
|
|
barGap:'5%',
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
position: 'top'
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series2 + @"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '已整改',
|
|
|
|
|
type: 'bar',
|
|
|
|
|
barWidth: 20,
|
|
|
|
|
barGap:'5%',
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
position: 'top'
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: " + series3 + @"
|
|
|
|
|
}]";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strSql1 = @" select 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 HSSE_Hazard_HazardRegisterTypes t on r.RegisterTypesId=t.RegisterTypesId
|
|
|
|
|
where ProjectId=@ProjectId and States != '4' and ProblemTypes = '1'
|
|
|
|
|
";
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime >='" + this.txtStartRectificationTime.Text.Trim() + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
strSql1 += " group by r.RegisterTypesId,t.RegisterTypesName ";
|
|
|
|
|
List<SqlParameter> listStr1 = new List<SqlParameter>();
|
|
|
|
|
listStr1.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
|
|
|
|
|
|
SqlParameter[] parameter1 = listStr1.ToArray();
|
|
|
|
|
DataTable tb1 = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
|
|
|
|
if (tb1 != null)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis = "[";
|
|
|
|
|
seriesPie = "[";
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr in tb1.Rows)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis += " '" + dr["RegisterTypesName"].ToString() + "' ,";
|
|
|
|
|
seriesPie += " { name:'" + dr["RegisterTypesName"].ToString() + "', value:" + dr["allnum"].ToString() + "} ,";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
xPieAxis = xPieAxis.TrimEnd(',');
|
|
|
|
|
seriesPie = seriesPie.TrimEnd(',');
|
|
|
|
|
xPieAxis += "]";
|
|
|
|
|
seriesPie += "]";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
|
|
|
|
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 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") + "' ";
|
|
|
|
|
}
|
2023-07-03 14:46:37 +08:00
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and r.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " and r.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
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()))
|
|
|
|
|
{
|
2024-01-03 14:12:27 +08:00
|
|
|
|
data.Add(dr["unitName"].ToString(), new Dictionary<string, string>());
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
temp = data[dr["unitName"].ToString()];
|
|
|
|
|
if (!temp.ContainsKey(dr["RegisterTypesName"].ToString()))
|
|
|
|
|
{
|
2024-01-03 14:12:27 +08:00
|
|
|
|
temp.Add(dr["RegisterTypesName"].ToString(), "0");
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
2024-01-03 14:12:27 +08:00
|
|
|
|
temp[dr["RegisterTypesName"].ToString()] = dr["allnum"].ToString();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 += @"{
|
2024-01-03 14:12:27 +08:00
|
|
|
|
name: '" + unit + @"[全部]',
|
2022-03-15 17:36:38 +08:00
|
|
|
|
type: 'bar',
|
|
|
|
|
stack: '全部',
|
|
|
|
|
barWidth: 10,
|
|
|
|
|
label: {
|
|
|
|
|
show: true,
|
|
|
|
|
position: 'top'
|
|
|
|
|
},
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: 'series'
|
|
|
|
|
},
|
|
|
|
|
data: [" + tempseries.TrimEnd(',') + @"]
|
|
|
|
|
},";
|
|
|
|
|
}
|
2024-01-03 14:12:27 +08:00
|
|
|
|
data = new Dictionary<string, Dictionary<string, string>>();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
foreach (DataRow dr in tb.Rows)
|
|
|
|
|
{
|
|
|
|
|
xdic.Add(dr["RegisterTypesName"].ToString());
|
2024-01-03 14:12:27 +08:00
|
|
|
|
Dictionary<string, string> temp = null;
|
2022-03-15 17:36:38 +08:00
|
|
|
|
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");
|
|
|
|
|
}
|
2024-01-03 14:12:27 +08:00
|
|
|
|
temp[dr["RegisterTypesName"].ToString()] = dr["todo"].ToString();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
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");
|
|
|
|
|
}
|
2024-01-03 14:12:27 +08:00
|
|
|
|
temp[dr["RegisterTypesName"].ToString()] = dr["finish"].ToString();
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|
|
|
|
|
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 += "]";
|
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-03 14:12:27 +08:00
|
|
|
|
string strSql1 = @" select r.RegisterTypesId,t.RegisterTypesName,
|
2023-09-22 17:36:00 +08:00
|
|
|
|
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 HSSE_Hazard_HazardRegisterTypes t on r.RegisterTypesId=t.RegisterTypesId
|
|
|
|
|
where ProjectId=@ProjectId and States != '4' and ProblemTypes = '1'
|
|
|
|
|
";
|
2024-01-03 14:12:27 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime >='" + this.txtStartRectificationTime.Text.Trim() + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and CheckTime <'" + DateTime.Parse(this.txtEndRectificationTime.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd") + "' ";
|
|
|
|
|
}
|
2023-09-22 17:36:00 +08:00
|
|
|
|
|
2024-01-03 14:12:27 +08:00
|
|
|
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.ResponsibleUnit='" + drpUnit.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
if (drpRegisterTypes.SelectedValue != BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql1 += " and r.RegisterTypesId='" + drpRegisterTypes.SelectedValue + "' ";
|
|
|
|
|
}
|
|
|
|
|
strSql1 += " group by r.RegisterTypesId,t.RegisterTypesName ";
|
|
|
|
|
List<SqlParameter> listStr1 = new List<SqlParameter>();
|
|
|
|
|
listStr1.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
2023-09-22 17:36:00 +08:00
|
|
|
|
|
2024-01-03 14:12:27 +08:00
|
|
|
|
SqlParameter[] parameter1 = listStr1.ToArray();
|
|
|
|
|
DataTable tb1 = SQLHelper.GetDataTableRunText(strSql1, parameter1);
|
|
|
|
|
if (tb1 != null)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis = "[";
|
|
|
|
|
seriesPie = "[";
|
|
|
|
|
|
|
|
|
|
foreach (DataRow dr in tb1.Rows)
|
|
|
|
|
{
|
|
|
|
|
xPieAxis += " '" + dr["RegisterTypesName"].ToString() + "' ,";
|
|
|
|
|
seriesPie += " { name:'" + dr["RegisterTypesName"].ToString() + "', value:" + dr["allnum"].ToString() + "} ,";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
xPieAxis = xPieAxis.TrimEnd(',');
|
|
|
|
|
seriesPie = seriesPie.TrimEnd(',');
|
|
|
|
|
xPieAxis += "]";
|
|
|
|
|
seriesPie += "]";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
|
|
|
|
// this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1130, 450, this.ckbShow.Checked));
|
|
|
|
|
//#endregion
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// #region 按检查项
|
|
|
|
|
|
|
|
|
|
// ///按检查项
|
|
|
|
|
// DataTable dtTime = new DataTable();
|
|
|
|
|
// dtTime.Columns.Add("检查项", typeof(string));
|
|
|
|
|
// dtTime.Columns.Add("总数量", typeof(string));
|
|
|
|
|
// dtTime.Columns.Add("待整改", typeof(string));
|
|
|
|
|
// dtTime.Columns.Add("已整改", typeof(string));
|
|
|
|
|
|
|
|
|
|
// var types = from x in Funs.DB.HSSE_Hazard_HazardRegisterTypes where x.HazardRegisterType == "1" orderby x.TypeCode select x;
|
|
|
|
|
// foreach (var item in types)
|
|
|
|
|
// {
|
|
|
|
|
// DataRow rowTime = dtTime.NewRow();
|
|
|
|
|
// Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem();
|
|
|
|
|
// rowTime["检查项"] = item.RegisterTypesName;
|
|
|
|
|
// var typeHazad = hazardRegisters.Where(x => x.RegisterTypesId == item.RegisterTypesId);
|
|
|
|
|
// rowTime["总数量"] = typeHazad.Count();
|
|
|
|
|
// rowTime["待整改"] = typeHazad.Where(x => x.States == "1" || x.States == null).Count();
|
|
|
|
|
// rowTime["已整改"] = typeHazad.Where(x => x.States == "3" || x.States == "2").Count();
|
|
|
|
|
// dtTime.Rows.Add(rowTime);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// // this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "巡检问题分析", this.drpChartType.SelectedValue, 1100, 330, this.ckbShow.Checked));
|
|
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 图形
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 图形变换
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void drpChartType_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.AnalyseData();
|
2023-09-22 17:36:00 +08:00
|
|
|
|
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + "); pie( ''," + xPieAxis + ", " + seriesPie + ") ; },1000); ");
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e)
|
2022-03-15 17:36:38 +08:00
|
|
|
|
{
|
|
|
|
|
this.AnalyseData();
|
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + "); pie( ''," + xPieAxis + ", " + seriesPie + ") ; },1000); ");
|
2022-03-15 17:36:38 +08:00
|
|
|
|
|
2023-09-22 17:36:00 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
2022-03-15 17:36:38 +08:00
|
|
|
|
}
|