危险源管理模块接入真实数据库:新增危大/超危工程、风险控制清单、安全验收、安全巡检、临时用电管理(含前端页面、BLL/API服务、WebAPI控制器、Model项、SQL脚本与接口文档)

排除 CreateModel.bat(含明文sa密码与本地服务器名,未入库)
This commit is contained in:
2026-08-24 11:07:59 +08:00
parent 4925a6c4b0
commit 55944d732a
323 changed files with 9806 additions and 922 deletions
@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.HSSE.HazardousMG
{
/// <summary>
/// 编辑安全防护验收页面
/// </summary>
public partial class SafetyAcceptanceEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string AcceptanceId
{
get
{
return (string)ViewState["AcceptanceId"];
}
set
{
ViewState["AcceptanceId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.InitDropDownList();
this.AcceptanceId = Request.Params["AcceptanceId"];
if (!string.IsNullOrEmpty(this.AcceptanceId))
{
////编辑:回填数据
Model.HSSE_SafetyAcceptance info = BLL.SafetyAcceptanceService.GetById(this.AcceptanceId);
if (info != null)
{
this.ddlHazardProject.SelectedValue = info.HazardProjectId;
this.ddlAcceptanceResult.SelectedValue = info.AcceptanceResult;
this.txtRemark.Text = info.Remark;
}
}
}
}
/// <summary>
/// 初始化危大、超危清单下拉
/// </summary>
private void InitDropDownList()
{
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
return;
}
List<Model.HSSE_HazardProject> projects = BLL.HazardProjectService.GetList(this.CurrUser.LoginProjectId);
foreach (Model.HSSE_HazardProject p in projects)
{
this.ddlHazardProject.Items.Add(new FineUIPro.ListItem(p.ProjectName + "" + p.ProjectCode + "", p.HazardProjectId));
}
}
#endregion
#region
/// <summary>
/// 保存按钮事件
/// </summary>
protected void btnSave_Click(object sender, EventArgs e)
{
if (this.CurrUser == null || string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
Alert.ShowInTop("请先选择项目!", MessageBoxIcon.Warning);
return;
}
////新增时先生成主键,保证附件能挂到同一记录
if (string.IsNullOrEmpty(this.AcceptanceId))
{
this.AcceptanceId = Guid.NewGuid().ToString();
}
////校验附件是否已上传
Model.AttachFile attach = BLL.Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.AcceptanceId);
if (attach == null || string.IsNullOrEmpty(attach.AttachUrl))
{
Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning);
return;
}
////根据所选清单回填工程名称
string hazardProjectName = string.Empty;
Model.HSSE_HazardProject project = BLL.HazardProjectService.GetById(this.ddlHazardProject.SelectedValue);
if (project != null)
{
hazardProjectName = project.ProjectName;
}
Model.HSSE_SafetyAcceptance info = new Model.HSSE_SafetyAcceptance
{
AcceptanceId = this.AcceptanceId,
ProjectId = this.CurrUser.LoginProjectId,
HazardProjectId = this.ddlHazardProject.SelectedValue,
HazardProjectName = hazardProjectName,
AcceptanceResult = this.ddlAcceptanceResult.SelectedValue,
AcceptanceMan = this.CurrUser.UserName,
AcceptanceDate = DateTime.Now,
Remark = this.txtRemark.Text.Trim()
};
////存在则更新,不存在则新增(服务层已处理)
BLL.SafetyAcceptanceService.Update(info);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
/// <summary>
/// 上传附件
/// </summary>
protected void btnAttach_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.AcceptanceId))
{
this.AcceptanceId = Guid.NewGuid().ToString();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/SafetyAcceptance&menuId={1}", this.AcceptanceId, BLL.Const.SafetyAcceptanceMenuId)));
}
#endregion
}
}