From c4dbae478abe129cd3a120a757d4a620b3e70723 Mon Sep 17 00:00:00 2001 From: gaofei1985 <181547018@qq.com> Date: Tue, 30 Jan 2024 09:30:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user | 2 +- .../Transfer/Chart/PunchlistFrom.aspx | 73 +++++++- .../Transfer/Chart/PunchlistFrom.aspx.cs | 161 ++++++++++++++++- .../Chart/PunchlistFrom.aspx.designer.cs | 163 ++++++++++++++++-- SGGL/FineUIPro.Web/Web.config | 2 +- SGGL/WebAPI/WebAPI.csproj.user | 2 +- 6 files changed, 382 insertions(+), 21 deletions(-) diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user index c4484e3e..f8ca7c7a 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -1,7 +1,7 @@  - Debug|Any CPU + Release|Any CPU true false diff --git a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx index 8a30d823..c7135ea0 100644 --- a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx +++ b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx @@ -1,5 +1,5 @@ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PunchlistFrom.aspx.cs" Inherits="FineUIPro.Web.Transfer.Chart.PunchlistFrom" %> - +<%@ Register Src="~/Controls/ChartControl.ascx" TagName="ChartControl" TagPrefix="uc1" %> @@ -9,8 +9,75 @@
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.cs b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.cs index c64b3db1..9cbf342b 100644 --- a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.cs +++ b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.cs @@ -1,17 +1,168 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; +using BLL; namespace FineUIPro.Web.Transfer.Chart { - public partial class PunchlistFrom : System.Web.UI.Page + public partial class PunchlistFrom : PageBase { + #region 加载页面 + /// + /// 加载页面 + /// + /// + /// protected void Page_Load(object sender, EventArgs e) { - + if (!IsPostBack) + { + } } + #endregion + + #region 统计 + /// + /// 统计分析 + /// + /// + /// + protected void BtnAnalyse_Click(object sender, EventArgs e) + { + this.AnalyseData(); + } + + /// + /// 统计方法 + /// + private void AnalyseData() + { + var hazardRegisters = (from x in Funs.DB.HSSE_Hazard_HazardRegister + where x.ProjectId == this.CurrUser.LoginProjectId + && x.States != "4" && x.ProblemTypes == "1" + select x); + if (!string.IsNullOrEmpty(this.txtStartRectificationTime.Text.Trim())) + { + hazardRegisters = hazardRegisters.Where(x => x.CheckTime >= Funs.GetNewDateTime(this.txtStartRectificationTime.Text.Trim())); + } + if (!string.IsNullOrEmpty(this.txtEndRectificationTime.Text.Trim())) + { + hazardRegisters = hazardRegisters.Where(x => x.CheckTime <= Funs.GetNewDateTime(this.txtEndRectificationTime.Text.Trim())); + } + if (this.rblState.SelectedValue == "0") + { + #region 按单位统计 + if (this.drpChartType.SelectedValue != "Pie") //非饼形图 + { + ///按单位统计 + 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 units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2); + foreach (var item in units) + { + DataRow rowTime = dtTime.NewRow(); + Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem(); + rowTime["单位"] = item.UnitName; + var unitHazad = hazardRegisters.Where(x => x.ResponsibleUnit == item.UnitId); + rowTime["总数量"] = unitHazad.Count(); + rowTime["待整改"] = unitHazad.Where(x => x.States == "1" || x.States == null).Count(); + rowTime["已整改"] = unitHazad.Where(x => x.States == "3" || x.States == "2").Count(); + dtTime.Rows.Add(rowTime); + } + this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1100, 300, this.ckbShow.Checked)); + } + else //饼形图 + { + DataTable dtTime = new DataTable(); + dtTime.Columns.Add("单位", typeof(string)); + dtTime.Columns.Add("总数量", typeof(string)); + + var units = BLL.UnitService.GetUnitByProjectIdUnitTypeList(this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2); + foreach (var item in units) + { + DataRow rowTime = dtTime.NewRow(); + Model.SpTDesktopItem newspItem = new Model.SpTDesktopItem(); + rowTime["单位"] = item.UnitName; + var unitHazad = hazardRegisters.Where(x => x.ResponsibleUnit == item.UnitId); + rowTime["总数量"] = unitHazad.Count(); + dtTime.Rows.Add(rowTime); + } + this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "单位巡检分析", this.drpChartType.SelectedValue, 1130, 450, this.ckbShow.Checked)); + } + #endregion + } + else + { + #region 按检查项 + if (this.drpChartType.SelectedValue != "Pie") //非饼形图 + { + ///按检查项 + 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)); + } + else //饼形图 + { + ///按问题类型 + DataTable dtTime = new DataTable(); + 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(); + dtTime.Rows.Add(rowTime); + } + + this.ChartAccidentTime.CreateChart(BLL.ChartControlService.GetDataSourceChart(dtTime, "巡检问题分析", this.drpChartType.SelectedValue, 1100, 330, this.ckbShow.Checked)); + } + #endregion + } + } + #endregion + + #region 图形 + /// + /// 图形变换 + /// + /// + /// + protected void drpChartType_SelectedIndexChanged(object sender, EventArgs e) + { + this.AnalyseData(); + } + + protected void ckbShow_CheckedChanged(object sender, CheckedEventArgs e) + { + this.AnalyseData(); + } + #endregion } } \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.designer.cs b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.designer.cs index 509734ff..53e81f30 100644 --- a/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.designer.cs +++ b/SGGL/FineUIPro.Web/Transfer/Chart/PunchlistFrom.aspx.designer.cs @@ -1,18 +1,17 @@ //------------------------------------------------------------------------------ -// +// <自动生成> // 此代码由工具生成。 // -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// //------------------------------------------------------------------------------ - -namespace FineUIPro.Web.Transfer.Chart -{ - public partial class PunchlistFrom - { - +namespace FineUIPro.Web.Transfer.Chart { + + + public partial class PunchlistFrom { + /// /// form1 控件。 /// @@ -21,5 +20,149 @@ namespace FineUIPro.Web.Transfer.Chart /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel3; + + /// + /// Form2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form2; + + /// + /// txtStartRectificationTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtStartRectificationTime; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label Label3; + + /// + /// txtEndRectificationTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker txtEndRectificationTime; + + /// + /// drpChartType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpChartType; + + /// + /// ckbShow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckbShow; + + /// + /// BtnAnalyse 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button BtnAnalyse; + + /// + /// rblState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.RadioButtonList rblState; + + /// + /// aa 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Label aa; + + /// + /// Panel4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel4; + + /// + /// TabStrip1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TabStrip TabStrip1; + + /// + /// Tab2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Tab Tab2; + + /// + /// cpAccidentTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ContentPanel cpAccidentTime; + + /// + /// ChartAccidentTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::Web.Controls.ChartControl ChartAccidentTime; } } diff --git a/SGGL/FineUIPro.Web/Web.config b/SGGL/FineUIPro.Web/Web.config index 7c103ddf..59ac7ef4 100644 --- a/SGGL/FineUIPro.Web/Web.config +++ b/SGGL/FineUIPro.Web/Web.config @@ -77,7 +77,7 @@ - + diff --git a/SGGL/WebAPI/WebAPI.csproj.user b/SGGL/WebAPI/WebAPI.csproj.user index 6bc24ada..4edb5e0f 100644 --- a/SGGL/WebAPI/WebAPI.csproj.user +++ b/SGGL/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@  - Debug|Any CPU + Release|Any CPU true