diff --git a/DataBase/版本日志/SGGLDB_V2026-04-01-xiaj(安全危害因素).sql b/DataBase/版本日志/SGGLDB_V2026-04-01-xiaj(安全危害因素).sql
index 56c2f66..5d8ee3d 100644
--- a/DataBase/版本日志/SGGLDB_V2026-04-01-xiaj(安全危害因素).sql
+++ b/DataBase/版本日志/SGGLDB_V2026-04-01-xiaj(安全危害因素).sql
@@ -37,13 +37,13 @@ CREATE TABLE [dbo].[HazardFactor_Safety](
[BaseRiskSeverity] [int] NOT NULL,
[BaseRiskProbability] [int] NOT NULL,
[BaseRiskScore] [int] NOT NULL,
- [BaseRiskGrade] [nvarchar](50) NOT NULL,
+ [BaseRiskLevel] [nvarchar](50) NOT NULL,
[BaseRiskAcceptabity] [bit] NOT NULL,
[NetRiskControlMeasures] [nvarchar](500) NULL,
[NetRiskSeverity] [int] NOT NULL,
[NetRiskProbability] [int] NOT NULL,
[NetRiskScore] [int] NOT NULL,
- [NetRiskGrade] [nvarchar](50) NOT NULL,
+ [NetRiskLevel] [nvarchar](50) NOT NULL,
[NetRiskAcceptabity] [bit] NOT NULL,
[AdditionalControlMeasures] [nvarchar](500) NULL,
[ResponsibleDepartment] [nvarchar](50) NULL,
@@ -70,13 +70,13 @@ EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Υ
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskSeverity'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskProbability'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'е÷' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskScore'
-EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ռ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskGrade'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ռ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskLevel'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ɽ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'BaseRiskAcceptabity'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'пƴʩ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskControlMeasures'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskSeverity'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskProbability'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'е÷' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskScore'
-EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ռ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskGrade'
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ռ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskLevel'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'ɽ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'NetRiskAcceptabity'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Ŀƴʩ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'AdditionalControlMeasures'
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'β' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'HazardFactor_Safety', @level2type=N'COLUMN',@level2name=N'ResponsibleDepartment'
diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs
index cf9f0e9..6ac3908 100644
--- a/SGGL/BLL/Common/Const.cs
+++ b/SGGL/BLL/Common/Const.cs
@@ -21,6 +21,15 @@ namespace BLL
public const string SYHSE_LicenceMenuId = "E024F3D5-4E42-4D3B-878D-B5E9825F0CB9";
public const string SYHSE_RiskMenuId = "CDB72049-E754-4782-AAE3-E4E8F6B77F2D";
+ #region 报表管理:危害因素
+
+ ///
+ /// 安全危害因素数据导入模板
+ ///
+ public const string HazardFactorSafetyDataInTemplateUrl = "File\\Excel\\DataIn\\安全危害因素数据导入模板.xlsx";
+
+ #endregion
+
///
/// 焊条发放回收纪录
///
diff --git a/SGGL/BLL/ReportManage/HazardFactor/HazardFactorSafetyService.cs b/SGGL/BLL/ReportManage/HazardFactor/HazardFactorSafetyService.cs
index b7285c5..f53949e 100644
--- a/SGGL/BLL/ReportManage/HazardFactor/HazardFactorSafetyService.cs
+++ b/SGGL/BLL/ReportManage/HazardFactor/HazardFactorSafetyService.cs
@@ -46,13 +46,13 @@ namespace BLL
newModel.BaseRiskSeverity = model.BaseRiskSeverity;
newModel.BaseRiskProbability = model.BaseRiskProbability;
newModel.BaseRiskScore = model.BaseRiskScore;
- newModel.BaseRiskGrade = model.BaseRiskGrade;
+ newModel.BaseRiskLevel = model.BaseRiskLevel;
newModel.BaseRiskAcceptabity = model.BaseRiskAcceptabity;
newModel.NetRiskControlMeasures = model.NetRiskControlMeasures;
newModel.NetRiskSeverity = model.NetRiskSeverity;
newModel.NetRiskProbability = model.NetRiskProbability;
newModel.NetRiskScore = model.NetRiskScore;
- newModel.NetRiskGrade = model.NetRiskGrade;
+ newModel.NetRiskLevel = model.NetRiskLevel;
newModel.NetRiskAcceptabity = model.NetRiskAcceptabity;
newModel.AdditionalControlMeasures = model.AdditionalControlMeasures;
newModel.ResponsibleDepartment = model.ResponsibleDepartment;
@@ -81,13 +81,13 @@ namespace BLL
newModel.BaseRiskSeverity = model.BaseRiskSeverity;
newModel.BaseRiskProbability = model.BaseRiskProbability;
newModel.BaseRiskScore = model.BaseRiskScore;
- newModel.BaseRiskGrade = model.BaseRiskGrade;
+ newModel.BaseRiskLevel = model.BaseRiskLevel;
newModel.BaseRiskAcceptabity = model.BaseRiskAcceptabity;
newModel.NetRiskControlMeasures = model.NetRiskControlMeasures;
newModel.NetRiskSeverity = model.NetRiskSeverity;
newModel.NetRiskProbability = model.NetRiskProbability;
newModel.NetRiskScore = model.NetRiskScore;
- newModel.NetRiskGrade = model.NetRiskGrade;
+ newModel.NetRiskLevel = model.NetRiskLevel;
newModel.NetRiskAcceptabity = model.NetRiskAcceptabity;
newModel.AdditionalControlMeasures = model.AdditionalControlMeasures;
newModel.ResponsibleDepartment = model.ResponsibleDepartment;
diff --git a/SGGL/FineUIPro.Web/File/Excel/DataIn/安全危害因素数据导入模板.xlsx b/SGGL/FineUIPro.Web/File/Excel/DataIn/安全危害因素数据导入模板.xlsx
new file mode 100644
index 0000000..0054822
Binary files /dev/null and b/SGGL/FineUIPro.Web/File/Excel/DataIn/安全危害因素数据导入模板.xlsx differ
diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
index 85914e8..b434268 100644
--- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
+++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj
@@ -147,6 +147,10 @@
+
+ False
+ bin\System.ValueTuple.dll
+
@@ -2549,6 +2553,7 @@
+
@@ -17277,6 +17282,13 @@
ProjectPageDataSave.aspx
+
+ HazardFactorSafetyIn.aspx
+ ASPXCodeBehind
+
+
+ HazardFactorSafetyIn.aspx
+
HazardFactorSafetySummary.aspx
ASPXCodeBehind
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx
index 4cb529e..f570754 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx
@@ -40,22 +40,22 @@
-
+
-
+
- <%--
- --%>
+
+
@@ -89,7 +89,7 @@
-
+
@@ -99,9 +99,9 @@
-
+
-
+
@@ -115,7 +115,7 @@
-
+
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.cs
index 5485c1d..038bcdc 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.cs
@@ -46,7 +46,6 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
////权限按钮方法
this.GetButtonPower();
btnNew.OnClientClick = Window1.GetShowReference("HazardFactorSafetyEdit.aspx") + "return false;";
- //btnImport.OnClientClick = Window1.GetShowReference("HazardFactorSafetyIn.aspx") + "return false;";
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
@@ -236,6 +235,7 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
if (buttonList.Contains(BLL.Const.BtnAdd))
{
this.btnNew.Hidden = false;
+ this.btnImport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnModify))
{
@@ -254,6 +254,16 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
}
#endregion
+ ///
+ /// 导入按钮
+ ///
+ ///
+ ///
+ protected void btnImport_Click(object sender, EventArgs e)
+ {
+ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HazardFactorSafetyIn.aspx?ProjectId={0}", this.ProjectId, "导入 - ")));
+ }
+
#region 导出按钮
///
@@ -264,8 +274,10 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
- string filename = Funs.GetNewFileName();
- Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("安全危害因素清单" + filename, System.Text.Encoding.UTF8) + ".xls");
+ string year = !string.IsNullOrWhiteSpace(this.drpYear.SelectedValue) && this.drpYear.SelectedValue != Const._Null ? $"{this.drpYear.SelectedValue}年" : string.Empty;
+ string month = !string.IsNullOrWhiteSpace(this.drpMonth.SelectedValue) && this.drpMonth.SelectedValue != Const._Null ? $"{this.drpMonth.SelectedValue}月" : string.Empty;
+ string fileName = System.Web.HttpUtility.UrlEncode($"{year}{month}安全危害因素清单" + Funs.GetNewFileName(), System.Text.Encoding.UTF8);
+ Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = 10000;
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.designer.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.designer.cs
index 1048dbe..27a1c94 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafety.aspx.designer.cs
@@ -113,6 +113,15 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
///
protected global::FineUIPro.Button btnNew;
+ ///
+ /// btnImport 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImport;
+
///
/// btnOut 控件。
///
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx
index b8f6649..79f9313 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx
@@ -68,7 +68,7 @@
-
+
@@ -108,7 +108,7 @@
-
+
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.cs
index 773279d..31da6fc 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.cs
@@ -81,13 +81,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
this.txtBaseRiskSeverity.Text = model.BaseRiskSeverity.ToString();
this.txtBaseRiskProbability.Text = model.BaseRiskProbability.ToString();
this.txtBaseRiskScore.Text = model.BaseRiskScore.ToString();
- this.txtBaseRiskGrade.Text = model.BaseRiskGrade;
+ this.txtBaseRiskLevel.Text = model.BaseRiskLevel;
this.rblBaseRiskAcceptabity.SelectedValue = model.BaseRiskAcceptabity ? "1" : "0";
this.txtNetRiskControlMeasures.Text = model.NetRiskControlMeasures;
this.txtNetRiskSeverity.Text = model.NetRiskSeverity.ToString();
this.txtNetRiskProbability.Text = model.NetRiskProbability.ToString();
this.txtNetRiskScore.Text = model.NetRiskScore.ToString();
- this.txtNetRiskGrade.Text = model.NetRiskGrade;
+ this.txtNetRiskLevel.Text = model.NetRiskLevel;
this.rblNetRiskAcceptabity.SelectedValue = model.NetRiskAcceptabity ? "1" : "0";
this.txtAdditionalControlMeasures.Text = model.AdditionalControlMeasures;
this.txtResponsibleDepartment.Text = model.ResponsibleDepartment;
@@ -153,13 +153,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
model.BaseRiskSeverity = int.Parse(this.txtBaseRiskSeverity.Text.Trim());
model.BaseRiskProbability = int.Parse(this.txtBaseRiskProbability.Text.Trim());
model.BaseRiskScore = int.Parse(this.txtBaseRiskScore.Text.Trim());
- model.BaseRiskGrade = this.txtBaseRiskGrade.Text.Trim();
+ model.BaseRiskLevel = this.txtBaseRiskLevel.Text.Trim();
model.BaseRiskAcceptabity = this.rblBaseRiskAcceptabity.SelectedValue == "1";
model.NetRiskControlMeasures = this.txtNetRiskControlMeasures.Text.Trim();
model.NetRiskSeverity = int.Parse(this.txtNetRiskSeverity.Text.Trim());
model.NetRiskProbability = int.Parse(this.txtNetRiskProbability.Text.Trim());
model.NetRiskScore = int.Parse(this.txtNetRiskScore.Text.Trim());
- model.NetRiskGrade = this.txtNetRiskGrade.Text.Trim();
+ model.NetRiskLevel = this.txtNetRiskLevel.Text.Trim();
model.NetRiskAcceptabity = this.rblNetRiskAcceptabity.SelectedValue == "1";
model.AdditionalControlMeasures = this.txtAdditionalControlMeasures.Text.Trim();
model.ResponsibleDepartment = this.txtResponsibleDepartment.Text.Trim();
@@ -232,7 +232,7 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
var riskLevel = RiskLevelService.GetRiskLevelByValue(score);
if (riskLevel != null)
{
- this.txtBaseRiskGrade.Text = riskLevel.RiskLevelName;
+ this.txtBaseRiskLevel.Text = riskLevel.RiskLevelName;
}
}
@@ -271,7 +271,7 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
var riskLevel = RiskLevelService.GetRiskLevelByValue(score);
if (riskLevel != null)
{
- this.txtNetRiskGrade.Text = riskLevel.RiskLevelName;
+ this.txtNetRiskLevel.Text = riskLevel.RiskLevelName;
}
}
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.designer.cs
index 767f4fc..45ffe01 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyEdit.aspx.designer.cs
@@ -168,13 +168,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected global::FineUIPro.NumberBox txtBaseRiskScore;
///
- /// txtBaseRiskGrade 控件。
+ /// txtBaseRiskLevel 控件。
///
///
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
- protected global::FineUIPro.TextBox txtBaseRiskGrade;
+ protected global::FineUIPro.TextBox txtBaseRiskLevel;
///
/// rblBaseRiskAcceptabity 控件。
@@ -249,13 +249,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected global::FineUIPro.NumberBox txtNetRiskScore;
///
- /// txtNetRiskGrade 控件。
+ /// txtNetRiskLevel 控件。
///
///
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
- protected global::FineUIPro.TextBox txtNetRiskGrade;
+ protected global::FineUIPro.TextBox txtNetRiskLevel;
///
/// rblNetRiskAcceptabity 控件。
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx
new file mode 100644
index 0000000..f997f56
--- /dev/null
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx
@@ -0,0 +1,73 @@
+<%@ Page Language="C#" CodeBehind="HazardFactorSafetyIn.aspx.cs" Inherits="FineUIPro.Web.ReportManage.HazardFactor.HazardFactorSafetyIn" %>
+
+
+
+
+
+
+
+ 导入
+
+
+
+
+
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.cs
new file mode 100644
index 0000000..7db36a2
--- /dev/null
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.cs
@@ -0,0 +1,569 @@
+using BLL;
+using Model;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+
+namespace FineUIPro.Web.ReportManage.HazardFactor
+{
+ public partial class HazardFactorSafetyIn : PageBase
+ {
+ #region 定义变量
+
+ ///
+ /// 上传预设的虚拟路径
+ ///
+ private string initPath = Const.ExcelUrl;
+
+
+ ///
+ /// 错误集合
+ ///
+ public static List errorInfos = new List();
+
+ ///
+ /// 项目id
+ ///
+ public string ProjectId
+ {
+ get
+ {
+ return (string)ViewState["ProjectId"];
+ }
+ set
+ {
+ ViewState["ProjectId"] = value;
+ }
+ }
+ ///
+ /// 操作人
+ ///
+ public string CompileMan
+ {
+ get
+ {
+ return (string)ViewState["CompileMan"];
+ }
+ set
+ {
+ ViewState["CompileMan"] = value;
+ }
+ }
+ public string CompileManName
+ {
+ get
+ {
+ return (string)ViewState["CompileManName"];
+ }
+ set
+ {
+ ViewState["CompileManName"] = value;
+ }
+ }
+
+ public static int Cols = 19;//列数
+
+ public static List validLevelStrings = new List { "低风险", "一般风险", "较大风险", "重大风险" };
+
+ #endregion
+
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ this.ProjectId = Request.Params["ProjectId"];
+
+
+ this.CompileMan = this.CurrUser.UserId;
+ this.CompileManName = this.CurrUser.UserName;
+ this.hdFileName.Text = string.Empty;
+ if (errorInfos != null)
+ {
+ errorInfos.Clear();
+ }
+
+ //if (this.CurrUser.UserId == Const.AdminId)
+ //{
+ // this.btnFastImport.Hidden = false;
+ //}
+ }
+ }
+
+ #region 下载模板
+
+ ///
+ /// 下载模板按钮
+ ///
+ ///
+ ///
+ protected void btnDownLoad_Click(object sender, EventArgs e)
+ {
+ //这里要注意了,如果传过来的没有记录
+ PageContext.RegisterStartupScript(Confirm.GetShowReference("确定下载导入模板吗?", String.Empty,
+ MessageBoxIcon.Question, PageManager1.GetCustomEventReference(false, "Confirm_OK"),
+ PageManager1.GetCustomEventReference("Confirm_Cancel")));
+ }
+
+ ///
+ /// 下载导入模板
+ ///
+ ///
+ ///
+ protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
+ {
+ if (e.EventArgument == "Confirm_OK")
+ {
+ string rootPath = Server.MapPath("~/");
+ string uploadfilepath = rootPath + Const.HazardFactorSafetyDataInTemplateUrl;
+ string filePath = Const.HazardFactorSafetyDataInTemplateUrl;
+ string fileName = Path.GetFileName(filePath);
+ FileInfo info = new FileInfo(uploadfilepath);
+ long fileSize = info.Length;
+ Response.ClearContent();
+ Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
+ Response.ContentType = "excel/plain";
+ Response.ContentEncoding = System.Text.Encoding.UTF8;
+ Response.AddHeader("Content-Length", fileSize.ToString().Trim());
+ Response.TransmitFile(uploadfilepath, 0, fileSize);
+ Response.End();
+ }
+ }
+
+ #endregion
+
+ #region 审核
+ ///
+ /// 审核
+ ///
+ ///
+ ///
+ protected void btnAudit_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (this.fuAttachUrl.HasFile == false)
+ {
+ ShowNotify("请您选择Excel文件!", MessageBoxIcon.Warning);
+ return;
+ }
+ string IsXls = Path.GetExtension(this.fuAttachUrl.FileName).ToString().Trim().ToLower();
+ if (IsXls != ".xls" && IsXls != ".xlsx")
+ {
+ ShowNotify("只可以选择Excel文件!", MessageBoxIcon.Warning);
+ return;
+ }
+ if (errorInfos != null)
+ {
+ errorInfos.Clear();
+ }
+ string rootPath = Server.MapPath("~/");
+ string initFullPath = rootPath + initPath;
+ if (!Directory.Exists(initFullPath))
+ {
+ Directory.CreateDirectory(initFullPath);
+ }
+
+ this.hdFileName.Text = BLL.Funs.GetNewFileName() + IsXls;
+ string filePath = initFullPath + this.hdFileName.Text;
+ this.fuAttachUrl.PostedFile.SaveAs(filePath);
+ AuditExcelAndShowResult(filePath);
+ }
+ catch (Exception ex)
+ {
+ ShowNotify("'" + ex.Message + "'", MessageBoxIcon.Warning);
+ }
+ }
+
+ ///
+ /// 审核Excel并展示校验结果
+ ///
+ private void AuditExcelAndShowResult(string fileName)
+ {
+ try
+ {
+ string msg = string.Empty;
+ var dt = BLL.Common.NPOIHelper.ExcelToDataSet(fileName, out msg, true);
+ if (dt != null)
+ {
+ //string rootPath = Server.MapPath("~/");
+ //var localPath = ConfigurationManager.AppSettings["localRoot"];
+ //imgDic = NPOIHelper.ExtractDispimgImagesFromXml(rootPath + initPath + this.hdFileName.Text, localPath + "FileUpload/CheckSpecial");
+ ValidateExcelData(dt.Tables[0], false);
+ hdCheckResult.Text = "1";
+ }
+ }
+ catch (Exception exc)
+ {
+ BLL.ErrLogInfo.WriteLog("", exc);
+ Response.Write(exc);
+ }
+ }
+
+ ///
+ /// 校验Excel数据(仅校验)
+ ///
+ ///
+ /// true:导入;false:审核
+ ///
+ private bool ValidateExcelData(DataTable pds, bool import)
+ {
+ int ic = pds.Columns.Count;
+ if (ic < Cols)
+ {
+ ShowNotify($"导入Excel格式错误!Excel只有{ic}列", MessageBoxIcon.Warning);
+ return false;
+ }
+ int ir = pds.Rows.Count;
+ if (pds == null || ir <= 0)
+ {
+ ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
+ return false;
+ }
+ var errors = new List();
+ for (int i = 1; i < ir; i++)
+ {
+ var (error, _) = ValidateRowAndBuildEntity(pds.Rows[i], (i + 2).ToString(), import);
+ if (error.Any()) { errors.AddRange(error); }
+ }
+ errorInfos.Clear();
+ errorInfos.AddRange(errors);
+ this.gvErrorInfo.DataSource = errorInfos;
+ this.gvErrorInfo.DataBind();
+ if (errors.Count > 0)
+ {
+ ShowNotify("存在校验错误,请查看错误列表并修正后再次导入。", MessageBoxIcon.Warning);
+ return false;
+ }
+ ShowNotify("审核完成,请点击导入!", MessageBoxIcon.Success);
+ return true;
+ }
+
+
+ ///
+ /// 校验单行并生成实体(字段顺序与新模板一致)
+ ///
+ private (List lstError, Model.HazardFactor_Safety entity) ValidateRowAndBuildEntity(DataRow row, string displayRow, bool import)
+ {
+ List lstError = new List();
+ // 新模板字段顺序
+ string rData0 = row[0]?.ToString().Trim(); // 上报年月
+ string rData1 = row[1]?.ToString().Trim(); // 活动区域\场所\设备
+ string rData2 = row[2]?.ToString().Trim(); // 作业内容/步骤
+ string rData3 = row[3]?.ToString().Trim(); // 危害因素描述
+ string rData4 = row[4]?.ToString().Trim(); // 主要后果
+ string rData5 = row[5]?.ToString().Trim(); // 违法
+ string rData6 = row[6]?.ToString().Trim(); // 固有风险-严重性
+ string rData7 = row[7]?.ToString().Trim(); // 固有风险-可能性
+ string rData8 = row[8]?.ToString().Trim(); // 固有风险-得分
+ string rData9 = row[9]?.ToString().Trim(); // 固有风险-风险级别
+ string rData10 = row[10]?.ToString().Trim(); // 固有风险-可接受
+ string rData11 = row[11]?.ToString().Trim(); // 残留风险-现有控制措施
+ string rData12 = row[12]?.ToString().Trim(); // 残留风险-严重性
+ string rData13 = row[13]?.ToString().Trim(); // 残留风险-可能性
+ string rData14 = row[14]?.ToString().Trim(); // 残留风险-得分
+ string rData15 = row[15]?.ToString().Trim(); // 残留风险-风险级别
+ string rData16 = row[16]?.ToString().Trim(); // 残留风险-可接受
+ string rData17 = row[17]?.ToString().Trim(); // 新增或变更的控制措施
+ string rData18 = row[18]?.ToString().Trim(); // 责任部门
+
+ string Year = string.Empty;
+ string Month = string.Empty;
+ string WorkPlace = string.Empty;
+ string JobStep = string.Empty;
+ string Hazard = string.Empty;
+ string Consequence = string.Empty;
+ bool Illegality = false;
+ int BaseRiskSeverity = 0;
+ int BaseRiskProbability = 0;
+ int BaseRiskScore = 0;
+ string BaseRiskLevel = "低风险";
+ bool BaseRiskAcceptabity = false;
+ string NetRiskControlMeasures = string.Empty;
+ int NetRiskSeverity = 0;
+ int NetRiskProbability = 0;
+ int NetRiskScore = 0;
+ string NetRiskLevel = "低风险";
+ bool NetRiskAcceptabity = false;
+ string AdditionalControlMeasures = string.Empty;
+ string ResponsibleDepartment = string.Empty;
+
+
+ // 校验并转换
+ if (!string.IsNullOrEmpty(rData0))
+ {
+ if (!DateTime.TryParse(rData0, out DateTime ct))
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "上报年月", Reason = "上报年月格式错误[正确格式:yyyy-MM,2026-04]" });
+ }
+ else
+ {
+ Year = ct.Year.ToString();
+ Month = ct.Month.ToString();
+ }
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "上报年月", Reason = "不能为空" });
+ }
+ if (!string.IsNullOrEmpty(rData1))
+ {
+ WorkPlace = rData1;
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "活动区域", Reason = "不能为空" });
+ }
+ if (!string.IsNullOrEmpty(rData2))
+ {
+ JobStep = rData2;
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "作业内容", Reason = "不能为空" });
+ }
+ if (!string.IsNullOrEmpty(rData3))
+ {
+ Hazard = rData3;
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "危害因素描述", Reason = "不能为空" });
+ }
+ if (!string.IsNullOrEmpty(rData4))
+ {
+ Consequence = rData4;
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "主要后果", Reason = "不能为空" });
+ }
+ Illegality = !string.IsNullOrEmpty(rData5) && rData5 == "是";
+ if (!string.IsNullOrEmpty(rData6))
+ {
+ if (!int.TryParse(rData6, out int ct))
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "固有风险严重性", Reason = "格式错误" });
+ }
+ else
+ {
+ BaseRiskSeverity = ct;
+ }
+ }
+ if (!string.IsNullOrEmpty(rData7))
+ {
+ if (!int.TryParse(rData7, out int ct))
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "固有风险可能性", Reason = "格式错误" });
+ }
+ else
+ {
+ BaseRiskProbability = ct;
+ }
+ }
+ BaseRiskScore = BaseRiskSeverity * BaseRiskProbability;
+ var baseRiskLevel = RiskLevelService.GetRiskLevelByValue(BaseRiskScore);
+ if (baseRiskLevel != null)
+ {
+ BaseRiskLevel = baseRiskLevel.RiskLevelName;
+ }
+ BaseRiskAcceptabity = !string.IsNullOrEmpty(rData10) && rData10 == "否" ? false : true;
+ if (!string.IsNullOrEmpty(rData11))
+ {
+ NetRiskControlMeasures = rData11;
+ }
+ else
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "现有控制措施", Reason = "不能为空" });
+ }
+
+ if (!string.IsNullOrEmpty(rData12))
+ {
+ if (!int.TryParse(rData12, out int ct))
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "残留风险严重性", Reason = "格式错误" });
+ }
+ else
+ {
+ NetRiskSeverity = ct;
+ }
+ }
+ if (!string.IsNullOrEmpty(rData13))
+ {
+ if (!int.TryParse(rData13, out int ct))
+ {
+ lstError.Add(new ErrorInfo { Row = displayRow, Column = "残留风险可能性", Reason = "格式错误" });
+ }
+ else
+ {
+ NetRiskProbability = ct;
+ }
+ }
+ NetRiskScore = NetRiskSeverity * NetRiskProbability;
+ var netRiskLevel = RiskLevelService.GetRiskLevelByValue(NetRiskScore);
+ if (netRiskLevel != null)
+ {
+ NetRiskLevel = netRiskLevel.RiskLevelName;
+ }
+ NetRiskAcceptabity = !string.IsNullOrEmpty(rData16) && rData16 == "否" ? false : true;
+
+ if (!string.IsNullOrEmpty(rData17))
+ {
+ AdditionalControlMeasures = rData17;
+ }
+ if (!string.IsNullOrEmpty(rData18))
+ {
+ ResponsibleDepartment = rData18;
+ }
+
+ if (lstError.Any())
+ {
+ return (lstError, null);
+ }
+
+ // 其余字段可根据实际业务映射到实体
+ var entity = new Model.HazardFactor_Safety
+ {
+ ID = SQLHelper.GetNewID(typeof(Model.HazardFactor_Safety)),
+ CompileDate=DateTime.Now,
+ CompileMan = this.CompileMan,
+ CompileManName = this.CompileManName,
+ State = int.Parse(BLL.Const.State_1),//默认已提交
+ ProjectId =this.ProjectId,
+ Year = Year,
+ Month = Month,
+ WorkPlace = WorkPlace,
+ JobStep = JobStep,
+ Hazard = Hazard,
+ Consequence = Consequence,
+ Illegality = Illegality,
+ BaseRiskSeverity = BaseRiskSeverity,
+ BaseRiskProbability = BaseRiskProbability,
+ BaseRiskScore = BaseRiskScore,
+ BaseRiskLevel = BaseRiskLevel,
+ BaseRiskAcceptabity = BaseRiskAcceptabity,
+ NetRiskControlMeasures = NetRiskControlMeasures,
+ NetRiskSeverity = NetRiskSeverity,
+ NetRiskProbability = NetRiskProbability,
+ NetRiskScore = NetRiskScore,
+ NetRiskLevel = NetRiskLevel,
+ NetRiskAcceptabity = NetRiskAcceptabity,
+ AdditionalControlMeasures = AdditionalControlMeasures,
+ ResponsibleDepartment = ResponsibleDepartment
+ };
+ return (lstError, entity);
+ }
+
+ #endregion
+
+ #region 导入
+
+ ///
+ /// 导入
+ ///
+ ///
+ ///
+ protected void btnImport_Click(object sender, EventArgs e)
+ {
+ if (hdCheckResult.Text == "1")
+ {
+ if (errorInfos.Count <= 0)
+ {
+ string rootPath = Server.MapPath("~/");
+ var localPath = ConfigurationManager.AppSettings["localRoot"];
+ //imgDic = NPOIHelper.ExtractDispimgImagesFromXml(rootPath + initPath + this.hdFileName.Text, localPath + "FileUpload/CheckSpecial");
+ ImportExcelToDatabase(rootPath + initPath + this.hdFileName.Text, true);
+
+ hdCheckResult.Text = string.Empty;
+ ShowNotify("导入成功!", MessageBoxIcon.Success);
+ PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
+ }
+ else
+ {
+ ShowNotify("请先将错误数据修正,再重新导入提交!", MessageBoxIcon.Warning);
+ }
+ }
+ else
+ {
+ ShowNotify("请先审核要导入的文件!", MessageBoxIcon.Warning);
+ }
+ }
+ ///
+ /// 导入Excel到数据库
+ ///
+ private void ImportExcelToDatabase(string fileName, bool import)
+ {
+ try
+ {
+ string msg = string.Empty;
+ var dt = BLL.Common.NPOIHelper.ExcelToDataSet(fileName, out msg, true);
+ BLL.ErrLogInfo.WriteLog(msg);
+ SaveExcelDataToDatabase(fileName, dt.Tables[0], import);
+ }
+ catch (Exception ex)
+ {
+ ErrLogInfo.WriteLog("", ex);
+ }
+ }
+
+ ///
+ /// 校验并保存数据到数据库
+ ///
+ private bool SaveExcelDataToDatabase(string fileName, DataTable pds, bool import)
+ {
+ int ic = pds.Columns.Count;
+ if (ic < Cols)
+ {
+ ShowNotify($"导入Excel格式错误!Excel只有{ic}列", MessageBoxIcon.Warning);
+ return false;
+ }
+ int ir = pds.Rows.Count;
+ if (pds == null || ir <= 0)
+ {
+ ShowNotify("导入数据为空!", MessageBoxIcon.Warning);
+ return false;
+ }
+ var errors = new List();
+ var toInsert = new List();
+
+ for (int i = 1; i < ir; i++)
+ {
+ var (error, entity) = ValidateRowAndBuildEntity(pds.Rows[i], (i + 2).ToString(), import);
+ if (error.Any())
+ errors.AddRange(error);
+ else
+ toInsert.Add(entity);
+ }
+ if (errors.Count > 0)
+ {
+ errorInfos.Clear();
+ errorInfos.AddRange(errors);
+ this.gvErrorInfo.DataSource = errorInfos;
+ this.gvErrorInfo.DataBind();
+ ShowNotify("存在校验错误,请先审核并修正后再导入。", MessageBoxIcon.Warning);
+ return false;
+ }
+ try
+ {
+ if (toInsert.Any())
+ {
+ Funs.DB.HazardFactor_Safety.InsertAllOnSubmit(toInsert);
+ Funs.DB.SubmitChanges();
+ }
+ ShowNotify($"成功导入 {toInsert.Count} 条记录。", MessageBoxIcon.Success);
+ PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
+ return true;
+ }
+ catch (Exception ex)
+ {
+ ErrLogInfo.WriteLog("导入 安全危害因素清单(HazardFactor_Safety) 失败", ex);
+ ShowNotify("导入失败:" + ex.Message, MessageBoxIcon.Error);
+ return false;
+ }
+ }
+
+ #endregion // 导入
+ }
+}
\ No newline at end of file
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.designer.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.designer.cs
new file mode 100644
index 0000000..a6cd099
--- /dev/null
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyIn.aspx.designer.cs
@@ -0,0 +1,125 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace FineUIPro.Web.ReportManage.HazardFactor
+{
+
+
+ public partial class HazardFactorSafetyIn
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// PageManager1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.PageManager PageManager1;
+
+ ///
+ /// SimpleForm1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Form SimpleForm1;
+
+ ///
+ /// Toolbar2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Toolbar Toolbar2;
+
+ ///
+ /// hdFileName 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.HiddenField hdFileName;
+
+ ///
+ /// btnAudit 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnAudit;
+
+ ///
+ /// btnImport 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnImport;
+
+ ///
+ /// btnDownLoad 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Button btnDownLoad;
+
+ ///
+ /// hdCheckResult 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.HiddenField hdCheckResult;
+
+ ///
+ /// fuAttachUrl 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.FileUpload fuAttachUrl;
+
+ ///
+ /// gvErrorInfo 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.Grid gvErrorInfo;
+
+ ///
+ /// lblPageIndex 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Label lblPageIndex;
+ }
+}
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx
index e7ce94b..e98b185 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx
@@ -53,6 +53,11 @@
+
+
+
+
+
@@ -101,7 +106,7 @@
-
+
@@ -117,7 +122,7 @@
-
+
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.cs
index 4c2d29a..ab34c44 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.cs
@@ -55,7 +55,24 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
StringBuilder sb = new StringBuilder();
List listStr = new List();
- sb.Append("SELECT tbb.ProjectName,tba.* ");
+ string dedupe = rbDedupe.SelectedValue;
+
+ if (!string.IsNullOrWhiteSpace(dedupe))
+ {
+ sb.Append("WITH CTE AS ( ");
+ if (dedupe == "0")
+ {//按月
+ sb.Append("SELECT ROW_NUMBER() OVER (PARTITION BY tba.Year,tba.Month,tba.WorkPlace,tba.JobStep,tba.Hazard,tba.Consequence,tba.Illegality,tba.BaseRiskSeverity,tba.BaseRiskProbability,tba.BaseRiskScore,tba.BaseRiskLevel,tba.BaseRiskAcceptabity,tba.NetRiskControlMeasures,tba.NetRiskSeverity,tba.NetRiskProbability,tba.NetRiskScore,tba.NetRiskLevel,tba.NetRiskAcceptabity,tba.AdditionalControlMeasures ORDER BY CompileDate desc) as rn,tbb.ProjectName,tba.* ");
+ }
+ else
+ {//按年
+ sb.Append("SELECT ROW_NUMBER() OVER (PARTITION BY tba.Year,tba.WorkPlace,tba.JobStep,tba.Hazard,tba.Consequence,tba.Illegality,tba.BaseRiskSeverity,tba.BaseRiskProbability,tba.BaseRiskScore,tba.BaseRiskLevel,tba.BaseRiskAcceptabity,tba.NetRiskControlMeasures,tba.NetRiskSeverity,tba.NetRiskProbability,tba.NetRiskScore,tba.NetRiskLevel,tba.NetRiskAcceptabity,tba.AdditionalControlMeasures ORDER BY CompileDate desc) as rn,tbb.ProjectName,tba.* ");
+ }
+ }
+ else
+ {
+ sb.Append("SELECT tbb.ProjectName,tba.* ");
+ }
sb.Append("FROM HazardFactor_Safety AS tba WITH(NOLOCK) ");
sb.Append("LEFT JOIN Base_Project AS tbb WITH(NOLOCK) ON tbb.ProjectId = tba.ProjectId ");
sb.Append("WHERE 1=1 AND tba.State = 1 ");//取已提交数据
@@ -86,8 +103,16 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
listStr.Add(new SqlParameter("@Illegality", this.rbIllegality.SelectedValue == "1" ? true : false));
}
+
+ if (!string.IsNullOrWhiteSpace(dedupe))
+ {
+ sb.Append(") ");
+ sb.Append("SELECT * FROM CTE WHERE rn = 1; ");
+ }
+
+ string sqlStr = sb.ToString();
SqlParameter[] parameter = listStr.ToArray();
- DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter);
+ DataTable tb = SQLHelper.GetDataTableRunText(sqlStr, parameter);
Grid1.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid1, tb);
@@ -243,8 +268,10 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected void btnOut_Click(object sender, EventArgs e)
{
Response.ClearContent();
- string filename = Funs.GetNewFileName();
- Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("安全危害因素清单" + filename, System.Text.Encoding.UTF8) + ".xls");
+ string year = !string.IsNullOrWhiteSpace(this.drpYear.SelectedValue) && this.drpYear.SelectedValue != Const._Null ? $"{this.drpYear.SelectedValue}年" : string.Empty;
+ string month = !string.IsNullOrWhiteSpace(this.drpMonth.SelectedValue) && this.drpMonth.SelectedValue != Const._Null ? $"{this.drpMonth.SelectedValue}月" : string.Empty;
+ string fileName = System.Web.HttpUtility.UrlEncode($"{year}{month}安全危害因素清单" + Funs.GetNewFileName(), System.Text.Encoding.UTF8);
+ Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xls");
Response.ContentType = "application/excel";
Response.ContentEncoding = System.Text.Encoding.UTF8;
this.Grid1.PageSize = 10000;
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.designer.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.designer.cs
index d737f6e..9701e7d 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetySummary.aspx.designer.cs
@@ -95,6 +95,15 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
///
protected global::FineUIPro.RadioButtonList rbIllegality;
+ ///
+ /// rbDedupe 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::FineUIPro.RadioButtonList rbDedupe;
+
///
/// ToolbarFill1 控件。
///
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx
index d9f9d89..61a2b01 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx
@@ -68,7 +68,7 @@
-
+
@@ -108,7 +108,7 @@
-
+
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.cs
index da255e2..bd803a1 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.cs
@@ -66,13 +66,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
this.txtBaseRiskSeverity.Text = model.BaseRiskSeverity.ToString();
this.txtBaseRiskProbability.Text = model.BaseRiskProbability.ToString();
this.txtBaseRiskScore.Text = model.BaseRiskScore.ToString();
- this.txtBaseRiskGrade.Text = model.BaseRiskGrade;
+ this.txtBaseRiskLevel.Text = model.BaseRiskLevel;
this.rblBaseRiskAcceptabity.SelectedValue = model.BaseRiskAcceptabity ? "1" : "0";
this.txtNetRiskControlMeasures.Text = model.NetRiskControlMeasures;
this.txtNetRiskSeverity.Text = model.NetRiskSeverity.ToString();
this.txtNetRiskProbability.Text = model.NetRiskProbability.ToString();
this.txtNetRiskScore.Text = model.NetRiskScore.ToString();
- this.txtNetRiskGrade.Text = model.NetRiskGrade;
+ this.txtNetRiskLevel.Text = model.NetRiskLevel;
this.rblNetRiskAcceptabity.SelectedValue = model.NetRiskAcceptabity ? "1" : "0";
this.txtAdditionalControlMeasures.Text = model.AdditionalControlMeasures;
this.txtResponsibleDepartment.Text = model.ResponsibleDepartment;
diff --git a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.designer.cs b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.designer.cs
index 4b1f969..02809f8 100644
--- a/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.designer.cs
+++ b/SGGL/FineUIPro.Web/ReportManage/HazardFactor/HazardFactorSafetyView.aspx.designer.cs
@@ -168,13 +168,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected global::FineUIPro.NumberBox txtBaseRiskScore;
///
- /// txtBaseRiskGrade 控件。
+ /// txtBaseRiskLevel 控件。
///
///
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
- protected global::FineUIPro.TextBox txtBaseRiskGrade;
+ protected global::FineUIPro.TextBox txtBaseRiskLevel;
///
/// rblBaseRiskAcceptabity 控件。
@@ -249,13 +249,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
protected global::FineUIPro.NumberBox txtNetRiskScore;
///
- /// txtNetRiskGrade 控件。
+ /// txtNetRiskLevel 控件。
///
///
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
///
- protected global::FineUIPro.TextBox txtNetRiskGrade;
+ protected global::FineUIPro.TextBox txtNetRiskLevel;
///
/// rblNetRiskAcceptabity 控件。
diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs
index 6cf568c..ec73162 100644
--- a/SGGL/Model/Model.cs
+++ b/SGGL/Model/Model.cs
@@ -168567,7 +168567,7 @@ namespace Model
private int _BaseRiskScore;
- private string _BaseRiskGrade;
+ private string _BaseRiskLevel;
private bool _BaseRiskAcceptabity;
@@ -168579,7 +168579,7 @@ namespace Model
private int _NetRiskScore;
- private string _NetRiskGrade;
+ private string _NetRiskLevel;
private bool _NetRiskAcceptabity;
@@ -168623,8 +168623,8 @@ namespace Model
partial void OnBaseRiskProbabilityChanged();
partial void OnBaseRiskScoreChanging(int value);
partial void OnBaseRiskScoreChanged();
- partial void OnBaseRiskGradeChanging(string value);
- partial void OnBaseRiskGradeChanged();
+ partial void OnBaseRiskLevelChanging(string value);
+ partial void OnBaseRiskLevelChanged();
partial void OnBaseRiskAcceptabityChanging(bool value);
partial void OnBaseRiskAcceptabityChanged();
partial void OnNetRiskControlMeasuresChanging(string value);
@@ -168635,8 +168635,8 @@ namespace Model
partial void OnNetRiskProbabilityChanged();
partial void OnNetRiskScoreChanging(int value);
partial void OnNetRiskScoreChanged();
- partial void OnNetRiskGradeChanging(string value);
- partial void OnNetRiskGradeChanged();
+ partial void OnNetRiskLevelChanging(string value);
+ partial void OnNetRiskLevelChanged();
partial void OnNetRiskAcceptabityChanging(bool value);
partial void OnNetRiskAcceptabityChanged();
partial void OnAdditionalControlMeasuresChanging(string value);
@@ -168772,7 +168772,7 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NChar(10) NOT NULL", CanBeNull=false)]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
public string ProjectId
{
get
@@ -168792,7 +168792,7 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPlace", DbType="NChar(10) NOT NULL", CanBeNull=false)]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_WorkPlace", DbType="NVarChar(200) NOT NULL", CanBeNull=false)]
public string WorkPlace
{
get
@@ -168812,7 +168812,7 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobStep", DbType="NChar(10) NOT NULL", CanBeNull=false)]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_JobStep", DbType="NVarChar(200) NOT NULL", CanBeNull=false)]
public string JobStep
{
get
@@ -168832,7 +168832,7 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hazard", DbType="NChar(10) NOT NULL", CanBeNull=false)]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Hazard", DbType="NVarChar(500) NOT NULL", CanBeNull=false)]
public string Hazard
{
get
@@ -168852,7 +168852,7 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Consequence", DbType="NChar(10)")]
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Consequence", DbType="NVarChar(200)")]
public string Consequence
{
get
@@ -168952,22 +168952,22 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BaseRiskGrade", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string BaseRiskGrade
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_BaseRiskLevel", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string BaseRiskLevel
{
get
{
- return this._BaseRiskGrade;
+ return this._BaseRiskLevel;
}
set
{
- if ((this._BaseRiskGrade != value))
+ if ((this._BaseRiskLevel != value))
{
- this.OnBaseRiskGradeChanging(value);
+ this.OnBaseRiskLevelChanging(value);
this.SendPropertyChanging();
- this._BaseRiskGrade = value;
- this.SendPropertyChanged("BaseRiskGrade");
- this.OnBaseRiskGradeChanged();
+ this._BaseRiskLevel = value;
+ this.SendPropertyChanged("BaseRiskLevel");
+ this.OnBaseRiskLevelChanged();
}
}
}
@@ -169072,22 +169072,22 @@ namespace Model
}
}
- [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NetRiskGrade", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
- public string NetRiskGrade
+ [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_NetRiskLevel", DbType="NVarChar(50) NOT NULL", CanBeNull=false)]
+ public string NetRiskLevel
{
get
{
- return this._NetRiskGrade;
+ return this._NetRiskLevel;
}
set
{
- if ((this._NetRiskGrade != value))
+ if ((this._NetRiskLevel != value))
{
- this.OnNetRiskGradeChanging(value);
+ this.OnNetRiskLevelChanging(value);
this.SendPropertyChanging();
- this._NetRiskGrade = value;
- this.SendPropertyChanged("NetRiskGrade");
- this.OnNetRiskGradeChanged();
+ this._NetRiskLevel = value;
+ this.SendPropertyChanged("NetRiskLevel");
+ this.OnNetRiskLevelChanged();
}
}
}