2021-04-30 10:28:37 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.Solution
|
|
|
|
|
{
|
|
|
|
|
public partial class LargerHazardEdit : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 定义变量
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string HazardId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["HazardId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["HazardId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ProjectId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 加载页面
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载页面
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
2025-03-25 21:54:21 +08:00
|
|
|
|
BLL.UnitWorkService.InitUnitWorkDownList(this.drpAddress, this.CurrUser.LoginProjectId, false);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
//类型
|
|
|
|
|
BLL.ConstValue.InitConstValueDropDownList(this.drpHazardType, ConstValue.Group_LargerHazardType, true);
|
|
|
|
|
//是否需要专家论证
|
|
|
|
|
BLL.ConstValue.InitConstValueRadioButtonList(this.rblIsArgument, ConstValue.Group_0001, "False");
|
2023-06-07 18:55:33 +08:00
|
|
|
|
//是否超危大工程
|
|
|
|
|
BLL.ConstValue.InitConstValueRadioButtonList(this.rblIsSuperLargerHazard, ConstValue.Group_0001, "False");
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.HazardId = Request.Params["HazardId"];
|
|
|
|
|
var largerHazard = BLL.LargerHazardService.GetLargerHazardByHazardId(this.HazardId);
|
|
|
|
|
if (largerHazard != null)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = largerHazard.ProjectId;
|
2025-03-25 21:54:21 +08:00
|
|
|
|
// this.txtLargerHazardCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.HazardId);
|
|
|
|
|
this.txtLargerHazardCode.Text = largerHazard.HazardCode;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(largerHazard.HazardType))
|
|
|
|
|
{
|
|
|
|
|
this.drpHazardType.SelectedValue = largerHazard.HazardType;
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
if (!string.IsNullOrEmpty(largerHazard.Address))
|
|
|
|
|
{
|
|
|
|
|
this.drpAddress.SelectedValue = largerHazard.Address;
|
|
|
|
|
}
|
|
|
|
|
// this.txtAddress.Text = largerHazard.Address;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
if (largerHazard.ExpectedTime != null)
|
|
|
|
|
{
|
|
|
|
|
this.txtExpectedTime.Text = string.Format("{0:yyyy-MM-dd}", largerHazard.ExpectedTime);
|
|
|
|
|
}
|
|
|
|
|
if (largerHazard.RecordTime != null)
|
|
|
|
|
{
|
|
|
|
|
this.txtRecordTime.Text = string.Format("{0:yyyy-MM-dd}", largerHazard.RecordTime);
|
|
|
|
|
}
|
|
|
|
|
if (largerHazard.IsArgument == true)
|
|
|
|
|
{
|
|
|
|
|
this.rblIsArgument.SelectedValue = "True";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.rblIsArgument.SelectedValue = "False";
|
|
|
|
|
}
|
2023-06-07 18:55:33 +08:00
|
|
|
|
if (largerHazard.IsSuperLargerHazard == true)
|
|
|
|
|
{
|
|
|
|
|
this.rblIsSuperLargerHazard.SelectedValue = "True";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.rblIsSuperLargerHazard.SelectedValue = "False";
|
|
|
|
|
}
|
|
|
|
|
if (largerHazard.TrainPersonNum != null)
|
|
|
|
|
{
|
|
|
|
|
this.txtTrainPersonNum.Text = largerHazard.TrainPersonNum.ToString();
|
|
|
|
|
}
|
|
|
|
|
this.drpStates.SelectedValue = largerHazard.States;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.txtRemark.Text = HttpUtility.HtmlDecode(largerHazard.Remark);
|
|
|
|
|
this.txtDescriptions.Text = largerHazard.Descriptions;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
////自动生成编码
|
2025-03-25 21:54:21 +08:00
|
|
|
|
// this.txtLargerHazardCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectLargerHazardListMenuId, this.ProjectId, this.CurrUser.UnitId);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.txtExpectedTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
|
|
|
this.txtRemark.Text = HttpUtility.HtmlDecode("描述");
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.txtRecordTime.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 保存按钮
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (this.drpHazardType.SelectedValue == BLL.Const._Null)
|
|
|
|
|
{
|
|
|
|
|
ShowNotify("请选择类型!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
if (this.drpStates.SelectedValue != "1")
|
|
|
|
|
{
|
|
|
|
|
//判断附件是否必传
|
|
|
|
|
if (!returnFj(this.HazardId + "_1"))
|
|
|
|
|
{
|
2025-04-24 18:14:12 +08:00
|
|
|
|
Alert.ShowInTop("请上传附件1-专项方案", MessageBoxIcon.Warning);
|
2025-03-25 21:54:21 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-24 18:14:12 +08:00
|
|
|
|
if (Convert.ToBoolean(this.rblIsArgument.SelectedValue) && Convert.ToBoolean(this.rblIsSuperLargerHazard.SelectedValue))
|
2025-03-25 21:54:21 +08:00
|
|
|
|
{
|
2025-04-24 18:14:12 +08:00
|
|
|
|
if (!returnFj(this.HazardId + "_2"))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请上传附件2-专家论证报告", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
|
2025-04-24 18:14:12 +08:00
|
|
|
|
if (!returnFj(this.HazardId + "_3"))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请上传附件3-论证会签到表", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
|
2025-04-24 18:14:12 +08:00
|
|
|
|
if (!returnFj(this.HazardId + "_4"))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请上传附件4-论证会会议照片", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!returnFj(this.HazardId + "_5"))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请上传附件5-方案交底记录", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!returnFj(this.HazardId + "_6"))
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请上传附件6-方案交底会议照片", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
this.SaveData(BLL.Const.BtnSave);
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 保存数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
private void SaveData(string type)
|
|
|
|
|
{
|
|
|
|
|
Model.Solution_LargerHazard largerHazard = new Model.Solution_LargerHazard
|
|
|
|
|
{
|
|
|
|
|
HazardCode = this.txtLargerHazardCode.Text.Trim(),
|
|
|
|
|
HazardType = this.drpHazardType.SelectedValue,
|
2025-03-25 21:54:21 +08:00
|
|
|
|
// Address = this.txtAddress.Text.Trim(),
|
|
|
|
|
Address = this.drpAddress.SelectedValue,
|
2021-04-30 10:28:37 +08:00
|
|
|
|
ExpectedTime = Funs.GetNewDateTime(this.txtExpectedTime.Text.Trim()),
|
|
|
|
|
IsArgument = Convert.ToBoolean(this.rblIsArgument.SelectedValue),
|
2023-06-07 18:55:33 +08:00
|
|
|
|
IsSuperLargerHazard = Convert.ToBoolean(this.rblIsSuperLargerHazard.SelectedValue),
|
2025-04-24 18:14:12 +08:00
|
|
|
|
TrainPersonNum = Funs.GetNewIntOrZero(this.txtTrainPersonNum.Text.Trim()),
|
2021-04-30 10:28:37 +08:00
|
|
|
|
Remark = HttpUtility.HtmlEncode(this.txtRemark.Text.Trim()),
|
|
|
|
|
Descriptions = this.txtDescriptions.Text.Trim(),
|
|
|
|
|
RecordTime = Funs.GetNewDateTime(this.txtRecordTime.Text.Trim()),
|
|
|
|
|
ProjectId = this.ProjectId,
|
2023-06-07 18:55:33 +08:00
|
|
|
|
States = this.drpStates.SelectedValue,
|
2021-04-30 10:28:37 +08:00
|
|
|
|
};
|
|
|
|
|
if (!string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
largerHazard.HazardId = this.HazardId;
|
|
|
|
|
BLL.LargerHazardService.UpdateLargerHazard(largerHazard);
|
2025-04-24 18:14:12 +08:00
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, largerHazard.HazardCode, largerHazard.HazardId, BLL.Const.ProjectLargerHazardListMenuId, BLL.Const.BtnModify);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
largerHazard.HazardId = SQLHelper.GetNewID(typeof(Model.Solution_LargerHazard));
|
|
|
|
|
largerHazard.RecardMan = this.CurrUser.UserId;
|
|
|
|
|
this.HazardId = largerHazard.HazardId;
|
|
|
|
|
BLL.LargerHazardService.AddLargerHazard(largerHazard);
|
2025-04-24 18:14:12 +08:00
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, largerHazard.HazardCode, largerHazard.HazardId, BLL.Const.ProjectLargerHazardListMenuId, BLL.Const.BtnAdd);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
2023-06-07 18:55:33 +08:00
|
|
|
|
Project_HSSEData_HSSEService.StatisticalData(this.CurrUser.LoginProjectId, Project_HSSEData_HSSEService.HSSEDateType.ProjectInformation);
|
|
|
|
|
Project_HSSEData_HSSEService.StatisticalData(this.CurrUser.LoginProjectId, Project_HSSEData_HSSEService.HSSEDateType.DangerousProject);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 附件上传
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上传附件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
|
|
|
|
|
//菜单id和质量危大保持一致
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_1", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
2025-04-24 18:14:12 +08:00
|
|
|
|
|
2025-03-25 21:54:21 +08:00
|
|
|
|
protected void btnAttach_Click2(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_2", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnAttach_Click3(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_3", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnAttach_Click4(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_4", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnAttach_Click5(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_5", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnAttach_Click6(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(this.HazardId))
|
|
|
|
|
{
|
|
|
|
|
SaveNew();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format(
|
|
|
|
|
"../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/MajorPlanApproval&menuId={1}",
|
2025-04-24 18:14:12 +08:00
|
|
|
|
this.HazardId + "_6", BLL.Const.MajorPlanApprovalMenuId)));
|
2025-03-25 21:54:21 +08:00
|
|
|
|
}
|
2025-04-24 18:14:12 +08:00
|
|
|
|
|
|
|
|
|
private bool returnFj(string id)
|
|
|
|
|
{
|
2025-03-25 21:54:21 +08:00
|
|
|
|
bool isT = true;
|
|
|
|
|
var model = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == id);
|
2025-04-24 18:14:12 +08:00
|
|
|
|
if (model == null)
|
2025-03-25 21:54:21 +08:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return isT;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void SaveNew()
|
|
|
|
|
{
|
|
|
|
|
Model.Solution_LargerHazard largerHazard = new Model.Solution_LargerHazard
|
|
|
|
|
{
|
|
|
|
|
HazardCode = this.txtLargerHazardCode.Text.Trim(),
|
|
|
|
|
HazardType = this.drpHazardType.SelectedValue,
|
2025-03-25 21:54:21 +08:00
|
|
|
|
// Address = this.txtAddress.Text.Trim(),
|
|
|
|
|
Address = this.drpAddress.SelectedValue,
|
2021-04-30 10:28:37 +08:00
|
|
|
|
ExpectedTime = Funs.GetNewDateTime(this.txtExpectedTime.Text.Trim()),
|
|
|
|
|
IsArgument = Convert.ToBoolean(this.rblIsArgument.SelectedValue),
|
|
|
|
|
Remark = HttpUtility.HtmlEncode(this.txtRemark.Text.Trim()),
|
|
|
|
|
ProjectId = this.ProjectId,
|
2023-06-07 18:55:33 +08:00
|
|
|
|
States = this.drpStates.SelectedValue,
|
2021-04-30 10:28:37 +08:00
|
|
|
|
HazardId = SQLHelper.GetNewID(typeof(Model.Solution_LargerHazard)),
|
|
|
|
|
RecardMan = this.CurrUser.UserId,
|
|
|
|
|
RecordTime = Funs.GetNewDateTime(this.txtRecordTime.Text.Trim())
|
|
|
|
|
};
|
|
|
|
|
this.HazardId = largerHazard.HazardId;
|
|
|
|
|
BLL.LargerHazardService.AddLargerHazard(largerHazard);
|
2025-04-24 18:14:12 +08:00
|
|
|
|
BLL.LogService.AddSys_Log(this.CurrUser, largerHazard.HazardCode, largerHazard.HazardId, BLL.Const.ProjectLargerHazardListMenuId, BLL.Const.BtnAdd);
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|