安全危害因素清单【第二版】
This commit is contained in:
Binary file not shown.
@@ -147,6 +147,10 @@
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>bin\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DataVisualization" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
@@ -2549,6 +2553,7 @@
|
||||
<Content Include="PZHGL\ProjectData\ProjectMapView.aspx" />
|
||||
<Content Include="PZHGL\ProjectData\ProjectPageData.aspx" />
|
||||
<Content Include="PZHGL\ProjectData\ProjectPageDataSave.aspx" />
|
||||
<Content Include="ReportManage\HazardFactor\HazardFactorSafetyIn.aspx" />
|
||||
<Content Include="ReportManage\HazardFactor\HazardFactorSafetySummary.aspx" />
|
||||
<Content Include="ReportManage\HazardFactor\HazardFactorSafety.aspx" />
|
||||
<Content Include="ReportManage\HazardFactor\HazardFactorSafetyView.aspx" />
|
||||
@@ -17277,6 +17282,13 @@
|
||||
<Compile Include="PZHGL\ProjectData\ProjectPageDataSave.aspx.designer.cs">
|
||||
<DependentUpon>ProjectPageDataSave.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ReportManage\HazardFactor\HazardFactorSafetyIn.aspx.cs">
|
||||
<DependentUpon>HazardFactorSafetyIn.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ReportManage\HazardFactor\HazardFactorSafetyIn.aspx.designer.cs">
|
||||
<DependentUpon>HazardFactorSafetyIn.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ReportManage\HazardFactor\HazardFactorSafetySummary.aspx.cs">
|
||||
<DependentUpon>HazardFactorSafetySummary.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
|
||||
@@ -40,22 +40,22 @@
|
||||
<f:DropDownList ID="drpMonth" AutoPostBack="true" EnableSimulateTree="true" runat="server"
|
||||
Width="160px" LabelWidth="50px" Label="月份" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
</f:DropDownList>
|
||||
<f:RadioButtonList runat="server" ID="rbState" Label="状态" Width="260px" LabelWidth="50px" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
<f:RadioButtonList runat="server" ID="rbState" Label="状态" Width="260px" LabelWidth="50px" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
<f:RadioItem Text="全部" Value="" Selected="true" />
|
||||
<f:RadioItem Text="未提交" Value="0" />
|
||||
<f:RadioItem Text="已提交" Value="1" />
|
||||
</f:RadioButtonList>
|
||||
<f:RadioButtonList runat="server" ID="rbIllegality" Label="违法" Width="220px" LabelWidth="50px" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
<f:RadioButtonList runat="server" ID="rbIllegality" Label="违法" Width="220px" LabelWidth="50px" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
<f:RadioItem Text="全部" Value="" Selected="true" />
|
||||
<f:RadioItem Text="是" Value="1" />
|
||||
<f:RadioItem Text="否" Value="0" />
|
||||
</f:RadioButtonList>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
<%--<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Hidden="true">
|
||||
</f:Button>--%>
|
||||
<f:Button ID="btnNew" ToolTip="新增" Text="新增" Icon="Add" EnablePostBack="false" runat="server" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" ToolTip="导入" Text="导入" Icon="ApplicationGet" runat="server" OnClick="btnImport_Click" Hidden="true">
|
||||
</f:Button>
|
||||
<f:Button ID="btnOut" OnClick="btnOut_Click" runat="server" Text="导出" ToolTip="导出" Icon="FolderUp"
|
||||
EnableAjax="false" DisableControlBeforePostBack="false">
|
||||
</f:Button>
|
||||
@@ -89,7 +89,7 @@
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="120px" ColumnID="Consequence" DataField="Consequence" SortField="Consequence" FieldType="String" HeaderText="主要后果" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField Width="50px" RenderAsStaticField="true" DataField="Illegality" SortField="Illegality" HeaderText="违法" HeaderTextAlign="Center" TextAlign="Center">
|
||||
<f:CheckBoxField Width="50px" RenderAsStaticField="true" DataField="Illegality" SortField="Illegality" HeaderText="违法" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
<f:GroupField ColumnID="GroupField2" runat="server" HeaderText="固有风险评价" HeaderTextAlign="Center">
|
||||
<Columns>
|
||||
@@ -99,9 +99,9 @@
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="70px" ColumnID="BaseRiskScore" DataField="BaseRiskScore" SortField="BaseRiskScore" FieldType="int" HeaderText="得分" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="BaseRiskGrade" DataField="BaseRiskGrade" SortField="BaseRiskGrade" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<f:RenderField Width="100px" ColumnID="BaseRiskLevel" DataField="BaseRiskLevel" SortField="BaseRiskLevel" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField Width="65px" RenderAsStaticField="true" DataField="BaseRiskAcceptabity" SortField="BaseRiskAcceptabity" HeaderText="可接受" HeaderTextAlign="Center" TextAlign="Center">
|
||||
<f:CheckBoxField Width="65px" RenderAsStaticField="true" DataField="BaseRiskAcceptabity" SortField="BaseRiskAcceptabity" HeaderText="可接受" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
</Columns>
|
||||
</f:GroupField>
|
||||
@@ -115,7 +115,7 @@
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="70px" ColumnID="NetRiskScore" DataField="NetRiskScore" SortField="NetRiskScore" FieldType="int" HeaderText="得分" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="NetRiskGrade" DataField="NetRiskGrade" SortField="NetRiskGrade" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<f:RenderField Width="100px" ColumnID="NetRiskLevel" DataField="NetRiskLevel" SortField="NetRiskLevel" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField Width="65px" RenderAsStaticField="true" DataField="NetRiskAcceptabity" SortField="NetRiskAcceptabity" HeaderText="可接受" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
|
||||
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// 导入按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("HazardFactorSafetyIn.aspx?ProjectId={0}", this.ProjectId, "导入 - ")));
|
||||
}
|
||||
|
||||
#region 导出按钮
|
||||
|
||||
/// <summary>
|
||||
@@ -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;
|
||||
|
||||
+9
@@ -113,6 +113,15 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnNew;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnOut 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<Items>
|
||||
<f:NumberBox ID="txtBaseRiskScore" runat="server" Label="得分" LabelAlign="Right" NoDecimal="true" NoNegative="true" EmptyText="0" Readonly="true">
|
||||
</f:NumberBox>
|
||||
<f:TextBox ID="txtBaseRiskGrade" runat="server" Label="风险级别" Readonly="true">
|
||||
<f:TextBox ID="txtBaseRiskLevel" runat="server" Label="风险级别" Readonly="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
@@ -108,7 +108,7 @@
|
||||
<Items>
|
||||
<f:NumberBox ID="txtNetRiskScore" runat="server" Label="得分" LabelAlign="Right" NoDecimal="true" NoNegative="true" EmptyText="0" Readonly="true">
|
||||
</f:NumberBox>
|
||||
<f:TextBox ID="txtNetRiskGrade" runat="server" Label="风险级别" MaxLength="20" Readonly="true" Enabled="true">
|
||||
<f:TextBox ID="txtNetRiskLevel" runat="server" Label="风险级别" MaxLength="20" Readonly="true" Enabled="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -168,13 +168,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
protected global::FineUIPro.NumberBox txtBaseRiskScore;
|
||||
|
||||
/// <summary>
|
||||
/// txtBaseRiskGrade 控件。
|
||||
/// txtBaseRiskLevel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtBaseRiskGrade;
|
||||
protected global::FineUIPro.TextBox txtBaseRiskLevel;
|
||||
|
||||
/// <summary>
|
||||
/// rblBaseRiskAcceptabity 控件。
|
||||
@@ -249,13 +249,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
protected global::FineUIPro.NumberBox txtNetRiskScore;
|
||||
|
||||
/// <summary>
|
||||
/// txtNetRiskGrade 控件。
|
||||
/// txtNetRiskLevel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtNetRiskGrade;
|
||||
protected global::FineUIPro.TextBox txtNetRiskLevel;
|
||||
|
||||
/// <summary>
|
||||
/// rblNetRiskAcceptabity 控件。
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<%@ Page Language="C#" CodeBehind="HazardFactorSafetyIn.aspx.cs" Inherits="FineUIPro.Web.ReportManage.HazardFactor.HazardFactorSafetyIn" %>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<script runat="server">
|
||||
|
||||
</script>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head runat="server">
|
||||
<title>导入</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="form1" runat="server">
|
||||
<f:PageManager ID="PageManager1" AutoSizePanelID="SimpleForm1" runat="server" OnCustomEvent="PageManager1_CustomEvent" />
|
||||
<f:Form ID="SimpleForm1" ShowBorder="false" ShowHeader="false" AutoScroll="true"
|
||||
BodyPadding="10px" runat="server" RedStarPosition="BeforeText" LabelAlign="Right">
|
||||
<Toolbars>
|
||||
<f:Toolbar ID="Toolbar2" Position="Top" ToolbarAlign="Right" runat="server">
|
||||
<Items>
|
||||
<f:HiddenField ID="hdFileName" runat="server">
|
||||
</f:HiddenField>
|
||||
<f:Button ID="btnAudit" Icon="ApplicationEdit" runat="server" ToolTip="审核" ValidateForms="SimpleForm1" Text="审核"
|
||||
OnClick="btnAudit_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnImport" Icon="ApplicationGet" runat="server" ToolTip="导入" ValidateForms="SimpleForm1" Text="导入"
|
||||
OnClick="btnImport_Click">
|
||||
</f:Button>
|
||||
<f:Button ID="btnDownLoad" runat="server" Icon="ApplicationGo" ToolTip="下载模板" OnClick="btnDownLoad_Click" Text="下载模板">
|
||||
</f:Button>
|
||||
<f:HiddenField ID="hdCheckResult" runat="server">
|
||||
</f:HiddenField>
|
||||
<%-- <f:HiddenField ID="hdCheckResult" runat="server" Text="1">
|
||||
</f:HiddenField>--%>
|
||||
</Items>
|
||||
</f:Toolbar>
|
||||
</Toolbars>
|
||||
<Rows>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:FileUpload runat="server" ID="fuAttachUrl" EmptyText="选择要导入的文件" Label="选择要导入的文件"
|
||||
LabelWidth="150px">
|
||||
</f:FileUpload>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
<f:FormRow>
|
||||
<Items>
|
||||
<f:Grid ID="gvErrorInfo" ShowBorder="true" EnableAjax="false" ShowHeader="false" Title="危害因素清单" EnableCollapse="true"
|
||||
runat="server" BoxFlex="1" AllowCellEditing="true" ClicksToEdit="2" AllowSorting="true"
|
||||
SortDirection="DESC" EnableColumnLines="true" ForceFit="true" AllowPaging="true" IsDatabasePaging="true" PageSize="10"
|
||||
EnableRowDoubleClickEvent="true" AllowFilters="true" EnableTextSelection="True">
|
||||
<Columns>
|
||||
<f:TemplateField ColumnID="tfPageIndex" Width="40px" HeaderText="序号" HeaderTextAlign="Center" TextAlign="Center"
|
||||
EnableLock="true" Locked="False">
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="lblPageIndex" runat="server" Text='<%# gvErrorInfo.PageIndex * gvErrorInfo.PageSize + Container.DataItemIndex + 1 %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</f:TemplateField>
|
||||
<f:BoundField DataField="Row" HeaderText="错误行号" Width="50px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Column" HeaderText="错误列" Width="100px">
|
||||
</f:BoundField>
|
||||
<f:BoundField DataField="Reason" HeaderText="错误类型" MinWidth="220px">
|
||||
</f:BoundField>
|
||||
</Columns>
|
||||
</f:Grid>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
</Rows>
|
||||
</f:Form>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -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 定义变量
|
||||
|
||||
/// <summary>
|
||||
/// 上传预设的虚拟路径
|
||||
/// </summary>
|
||||
private string initPath = Const.ExcelUrl;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 错误集合
|
||||
/// </summary>
|
||||
public static List<Model.ErrorInfo> errorInfos = new List<Model.ErrorInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// </summary>
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
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<string> validLevelStrings = new List<string> { "低风险", "一般风险", "较大风险", "重大风险" };
|
||||
|
||||
#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 下载模板
|
||||
|
||||
/// <summary>
|
||||
/// 下载模板按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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")));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载导入模板
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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 审核
|
||||
/// <summary>
|
||||
/// 审核
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 审核Excel并展示校验结果
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验Excel数据(仅校验)
|
||||
/// </summary>
|
||||
/// <param name="pds"></param>
|
||||
/// <param name="import">true:导入;false:审核</param>
|
||||
/// <returns></returns>
|
||||
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<ErrorInfo>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 校验单行并生成实体(字段顺序与新模板一致)
|
||||
/// </summary>
|
||||
private (List<ErrorInfo> lstError, Model.HazardFactor_Safety entity) ValidateRowAndBuildEntity(DataRow row, string displayRow, bool import)
|
||||
{
|
||||
List<ErrorInfo> lstError = new List<ErrorInfo>();
|
||||
// 新模板字段顺序
|
||||
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 导入
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 导入Excel到数据库
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验并保存数据到数据库
|
||||
/// </summary>
|
||||
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<ErrorInfo>();
|
||||
var toInsert = new List<Model.HazardFactor_Safety>();
|
||||
|
||||
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 // 导入
|
||||
}
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能导致不正确的行为,如果
|
||||
// 重新生成代码,则所做更改将丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
{
|
||||
|
||||
|
||||
public partial class HazardFactorSafetyIn
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// form1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// PageManager1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.PageManager PageManager1;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleForm1 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Form SimpleForm1;
|
||||
|
||||
/// <summary>
|
||||
/// Toolbar2 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Toolbar Toolbar2;
|
||||
|
||||
/// <summary>
|
||||
/// hdFileName 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdFileName;
|
||||
|
||||
/// <summary>
|
||||
/// btnAudit 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnAudit;
|
||||
|
||||
/// <summary>
|
||||
/// btnImport 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnImport;
|
||||
|
||||
/// <summary>
|
||||
/// btnDownLoad 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Button btnDownLoad;
|
||||
|
||||
/// <summary>
|
||||
/// hdCheckResult 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.HiddenField hdCheckResult;
|
||||
|
||||
/// <summary>
|
||||
/// fuAttachUrl 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.FileUpload fuAttachUrl;
|
||||
|
||||
/// <summary>
|
||||
/// gvErrorInfo 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.Grid gvErrorInfo;
|
||||
|
||||
/// <summary>
|
||||
/// lblPageIndex 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label lblPageIndex;
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,11 @@
|
||||
<f:RadioItem Text="是" Value="1" />
|
||||
<f:RadioItem Text="否" Value="0" />
|
||||
</f:RadioButtonList>
|
||||
<f:RadioButtonList runat="server" ID="rbDedupe" Label="去重" Width="320px" LabelWidth="50px" AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged">
|
||||
<f:RadioItem Text="不去重" Value="" />
|
||||
<f:RadioItem Text="按年去重" Value="1" Selected="true" />
|
||||
<f:RadioItem Text="按月去重" Value="0" />
|
||||
</f:RadioButtonList>
|
||||
<f:ToolbarFill ID="ToolbarFill1" runat="server">
|
||||
</f:ToolbarFill>
|
||||
|
||||
@@ -101,7 +106,7 @@
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="70px" ColumnID="BaseRiskScore" DataField="BaseRiskScore" SortField="BaseRiskScore" FieldType="int" HeaderText="得分" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="BaseRiskGrade" DataField="BaseRiskGrade" SortField="BaseRiskGrade" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<f:RenderField Width="100px" ColumnID="BaseRiskLevel" DataField="BaseRiskLevel" SortField="BaseRiskLevel" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField Width="65px" RenderAsStaticField="true" DataField="BaseRiskAcceptabity" SortField="BaseRiskAcceptabity" HeaderText="可接受" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
@@ -117,7 +122,7 @@
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="70px" ColumnID="NetRiskScore" DataField="NetRiskScore" SortField="NetRiskScore" FieldType="int" HeaderText="得分" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:RenderField Width="100px" ColumnID="NetRiskGrade" DataField="NetRiskGrade" SortField="NetRiskGrade" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
<f:RenderField Width="100px" ColumnID="NetRiskLevel" DataField="NetRiskLevel" SortField="NetRiskLevel" FieldType="String" HeaderText="风险级别" TextAlign="Center" HeaderTextAlign="Center">
|
||||
</f:RenderField>
|
||||
<f:CheckBoxField Width="65px" RenderAsStaticField="true" DataField="NetRiskAcceptabity" SortField="NetRiskAcceptabity" HeaderText="可接受" HeaderTextAlign="Center" TextAlign="Center">
|
||||
</f:CheckBoxField>
|
||||
|
||||
@@ -55,7 +55,24 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
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;
|
||||
|
||||
+9
@@ -95,6 +95,15 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rbIllegality;
|
||||
|
||||
/// <summary>
|
||||
/// rbDedupe 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.RadioButtonList rbDedupe;
|
||||
|
||||
/// <summary>
|
||||
/// ToolbarFill1 控件。
|
||||
/// </summary>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<Items>
|
||||
<f:NumberBox ID="txtBaseRiskScore" runat="server" Label="得分" LabelAlign="Right" NoDecimal="true" NoNegative="true" EmptyText="0" Readonly="true">
|
||||
</f:NumberBox>
|
||||
<f:TextBox ID="txtBaseRiskGrade" runat="server" Label="风险级别" Readonly="true">
|
||||
<f:TextBox ID="txtBaseRiskLevel" runat="server" Label="风险级别" Readonly="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
@@ -108,7 +108,7 @@
|
||||
<Items>
|
||||
<f:NumberBox ID="txtNetRiskScore" runat="server" Label="得分" LabelAlign="Right" NoDecimal="true" NoNegative="true" EmptyText="0" Readonly="true">
|
||||
</f:NumberBox>
|
||||
<f:TextBox ID="txtNetRiskGrade" runat="server" Label="风险级别" MaxLength="20" Readonly="true" Enabled="true">
|
||||
<f:TextBox ID="txtNetRiskLevel" runat="server" Label="风险级别" MaxLength="20" Readonly="true" Enabled="true">
|
||||
</f:TextBox>
|
||||
</Items>
|
||||
</f:FormRow>
|
||||
|
||||
@@ -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;
|
||||
|
||||
+4
-4
@@ -168,13 +168,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
protected global::FineUIPro.NumberBox txtBaseRiskScore;
|
||||
|
||||
/// <summary>
|
||||
/// txtBaseRiskGrade 控件。
|
||||
/// txtBaseRiskLevel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtBaseRiskGrade;
|
||||
protected global::FineUIPro.TextBox txtBaseRiskLevel;
|
||||
|
||||
/// <summary>
|
||||
/// rblBaseRiskAcceptabity 控件。
|
||||
@@ -249,13 +249,13 @@ namespace FineUIPro.Web.ReportManage.HazardFactor
|
||||
protected global::FineUIPro.NumberBox txtNetRiskScore;
|
||||
|
||||
/// <summary>
|
||||
/// txtNetRiskGrade 控件。
|
||||
/// txtNetRiskLevel 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::FineUIPro.TextBox txtNetRiskGrade;
|
||||
protected global::FineUIPro.TextBox txtNetRiskLevel;
|
||||
|
||||
/// <summary>
|
||||
/// rblNetRiskAcceptabity 控件。
|
||||
|
||||
Reference in New Issue
Block a user