20230922
This commit is contained in:
@@ -9,26 +9,26 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
|
||||
{
|
||||
public partial class RiskAnalysisChart : PageBase
|
||||
{
|
||||
#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();
|
||||
|
||||
}
|
||||
#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();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 统计
|
||||
@@ -40,17 +40,21 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
|
||||
protected void BtnAnalyse_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.AnalyseData();
|
||||
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend+","+xAxis+","+series+ ");},1000); ");
|
||||
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend+","+xAxis+","+series+ "); pie( '',"+ xPieAxis+", "+seriesPie+") ; },1000); ");
|
||||
|
||||
}
|
||||
public string legend = "[]";
|
||||
public string xAxis="[]";
|
||||
public string series="[]";
|
||||
|
||||
/// <summary>
|
||||
/// 统计方法
|
||||
/// </summary>
|
||||
private void AnalyseData()
|
||||
|
||||
public string xPieAxis = "[]";
|
||||
|
||||
public string seriesPie = "[]";
|
||||
/// <summary>
|
||||
/// 统计方法
|
||||
/// </summary>
|
||||
private void AnalyseData()
|
||||
{
|
||||
if (this.rblState.SelectedValue == "0")
|
||||
{
|
||||
@@ -152,9 +156,56 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
|
||||
},
|
||||
data: " + series3 + @"
|
||||
}]";
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
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
|
||||
{
|
||||
string strSql = @" select u.UnitId,u.unitName,r.RegisterTypesId,t.RegisterTypesName,
|
||||
count(*) as allnum,
|
||||
@@ -352,11 +403,60 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
|
||||
}
|
||||
series = series.TrimEnd(',');
|
||||
series += "]";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
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 += "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1130, 450, this.ckbShow.Checked));
|
||||
//#endregion
|
||||
@@ -401,18 +501,18 @@ namespace FineUIPro.Web.HSSE.HiddenInspection
|
||||
protected void drpChartType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.AnalyseData();
|
||||
PageContext.RegisterStartupScript(@"setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + ");}, 1000); ");
|
||||
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + "); pie( ''," + xPieAxis + ", " + seriesPie + ") ; },1000); ");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e)
|
||||
protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e)
|
||||
{
|
||||
this.AnalyseData();
|
||||
|
||||
PageContext.RegisterStartupScript(@"setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + ");}, 1000);");
|
||||
PageContext.RegisterStartupScript(@" setTimeout(function () { rendChart(" + legend + "," + xAxis + "," + series + "); pie( ''," + xPieAxis + ", " + seriesPie + ") ; },1000); ");
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user