2021-04-30 10:28:37 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
|
|
|
|
namespace BLL
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 危险性较大的工程清单
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static class LargerHazardService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据危险性较大的工程清单ID获取危险性较大的工程清单信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="LargerHazardName"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static Model.Solution_LargerHazard GetLargerHazardByHazardId(string hazardId)
|
|
|
|
|
{
|
|
|
|
|
return Funs.DB.Solution_LargerHazard.FirstOrDefault(e => e.HazardId == hazardId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加安全危险性较大的工程清单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="largerHazard"></param>
|
|
|
|
|
public static void AddLargerHazard(Model.Solution_LargerHazard largerHazard)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.Solution_LargerHazard newLargerHazard = new Model.Solution_LargerHazard
|
|
|
|
|
{
|
|
|
|
|
HazardId = largerHazard.HazardId,
|
|
|
|
|
HazardCode = largerHazard.HazardCode,
|
|
|
|
|
HazardType = largerHazard.HazardType,
|
|
|
|
|
ProjectId = largerHazard.ProjectId,
|
|
|
|
|
Address = largerHazard.Address,
|
|
|
|
|
ExpectedTime = largerHazard.ExpectedTime,
|
|
|
|
|
IsArgument = largerHazard.IsArgument,
|
|
|
|
|
RecordTime = largerHazard.RecordTime,
|
|
|
|
|
RecardMan = largerHazard.RecardMan,
|
|
|
|
|
Remark = largerHazard.Remark,
|
|
|
|
|
States = largerHazard.States,
|
2023-06-07 18:55:33 +08:00
|
|
|
|
TrainPersonNum = largerHazard.TrainPersonNum,
|
|
|
|
|
IsSuperLargerHazard = largerHazard.IsSuperLargerHazard,
|
2021-04-30 10:28:37 +08:00
|
|
|
|
Descriptions = largerHazard.Descriptions
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
db.Solution_LargerHazard.InsertOnSubmit(newLargerHazard);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
////增加一条编码记录
|
|
|
|
|
BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectLargerHazardListMenuId, largerHazard.ProjectId, null, largerHazard.HazardId, largerHazard.RecordTime);
|
2025-03-25 21:54:21 +08:00
|
|
|
|
//判断是否有数据 有数据则更新 没有数据则添加
|
|
|
|
|
var majorPlanApproval = BLL.MajorPlanApprovalService.GetMajorPlanApprovalById(largerHazard.HazardId);
|
|
|
|
|
if (majorPlanApproval != null)
|
|
|
|
|
{
|
|
|
|
|
UpdateMajorPlanApproval(largerHazard);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AddMajorPlanApproval(largerHazard);
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改安全危险性较大的工程清单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="largerHazard"></param>
|
|
|
|
|
public static void UpdateLargerHazard(Model.Solution_LargerHazard largerHazard)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.Solution_LargerHazard newLargerHazard = db.Solution_LargerHazard.FirstOrDefault(e => e.HazardId == largerHazard.HazardId);
|
|
|
|
|
if (newLargerHazard != null)
|
|
|
|
|
{
|
|
|
|
|
newLargerHazard.HazardCode = largerHazard.HazardCode;
|
|
|
|
|
newLargerHazard.HazardType = largerHazard.HazardType;
|
|
|
|
|
newLargerHazard.ProjectId = largerHazard.ProjectId;
|
|
|
|
|
newLargerHazard.Address = largerHazard.Address;
|
|
|
|
|
newLargerHazard.ExpectedTime = largerHazard.ExpectedTime;
|
|
|
|
|
newLargerHazard.IsArgument = largerHazard.IsArgument;
|
|
|
|
|
newLargerHazard.Remark = largerHazard.Remark;
|
2023-06-26 11:16:55 +08:00
|
|
|
|
newLargerHazard.RecordTime = largerHazard.RecordTime;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
newLargerHazard.States = largerHazard.States;
|
2023-06-07 18:55:33 +08:00
|
|
|
|
newLargerHazard.TrainPersonNum = largerHazard.TrainPersonNum;
|
|
|
|
|
newLargerHazard.IsSuperLargerHazard = largerHazard.IsSuperLargerHazard;
|
2021-04-30 10:28:37 +08:00
|
|
|
|
newLargerHazard.Descriptions = largerHazard.Descriptions;
|
|
|
|
|
db.SubmitChanges();
|
2025-03-25 21:54:21 +08:00
|
|
|
|
//判断是否有数据 有数据则更新 没有数据则添加
|
|
|
|
|
var majorPlanApproval = BLL.MajorPlanApprovalService.GetMajorPlanApprovalById(largerHazard.HazardId);
|
|
|
|
|
if (majorPlanApproval != null)
|
|
|
|
|
{
|
|
|
|
|
UpdateMajorPlanApproval(largerHazard);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AddMajorPlanApproval(largerHazard);
|
|
|
|
|
}
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据危险性较大的工程清单ID删除对应危险性较大的工程清单记录信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="superviseCheckReportId"></param>
|
|
|
|
|
public static void DeleteLargerHazard(string hazardId)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
var largerHazard = (from x in db.Solution_LargerHazard where x.HazardId == hazardId select x).FirstOrDefault();
|
|
|
|
|
if (largerHazard != null)
|
|
|
|
|
{
|
|
|
|
|
////删除审核流程表
|
|
|
|
|
BLL.CommonService.DeleteFlowOperateByID(largerHazard.HazardId);
|
|
|
|
|
///删除编码表记录
|
|
|
|
|
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(largerHazard.HazardId);
|
|
|
|
|
////删除附件表
|
|
|
|
|
BLL.CommonService.DeleteAttachFileById(largerHazard.HazardId);
|
|
|
|
|
db.Solution_LargerHazard.DeleteOnSubmit(largerHazard);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-25 21:54:21 +08:00
|
|
|
|
|
|
|
|
|
#region 同时编辑一条到质量管理中的危大(超危大)工程专项施工管理
|
|
|
|
|
private static void AddMajorPlanApproval(Model.Solution_LargerHazard largerHazard)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.Comprehensive_MajorPlanApproval newMajorPlanApproval = new Model.Comprehensive_MajorPlanApproval();
|
|
|
|
|
newMajorPlanApproval.MajorPlanApprovalId = largerHazard.HazardId;
|
|
|
|
|
newMajorPlanApproval.PlanCode = largerHazard.HazardCode;
|
|
|
|
|
newMajorPlanApproval.HazardType = largerHazard.HazardType;
|
|
|
|
|
newMajorPlanApproval.ProjectId = largerHazard.ProjectId;
|
|
|
|
|
newMajorPlanApproval.UnitWorkId = largerHazard.Address;
|
|
|
|
|
newMajorPlanApproval.ExpectedTime = largerHazard.ExpectedTime;
|
|
|
|
|
newMajorPlanApproval.IsReview = largerHazard.IsArgument;
|
|
|
|
|
newMajorPlanApproval.ApprovalDate = largerHazard.RecordTime;
|
|
|
|
|
newMajorPlanApproval.CompileMan = largerHazard.RecardMan;
|
|
|
|
|
newMajorPlanApproval.States = largerHazard.States;
|
|
|
|
|
newMajorPlanApproval.TrainPersonNum = largerHazard.TrainPersonNum;
|
|
|
|
|
newMajorPlanApproval.SchemeType = largerHazard.IsSuperLargerHazard.HasValue ? "超危大工程" : "危大工程";
|
|
|
|
|
db.Comprehensive_MajorPlanApproval.InsertOnSubmit(newMajorPlanApproval);
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void UpdateMajorPlanApproval(Model.Solution_LargerHazard largerHazard)
|
|
|
|
|
{
|
|
|
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
|
Model.Comprehensive_MajorPlanApproval newMajorPlanApproval = db.Comprehensive_MajorPlanApproval.FirstOrDefault(e => e.MajorPlanApprovalId == largerHazard.HazardId);
|
|
|
|
|
if (newMajorPlanApproval != null)
|
|
|
|
|
{
|
|
|
|
|
newMajorPlanApproval.MajorPlanApprovalId = largerHazard.HazardId;
|
|
|
|
|
newMajorPlanApproval.PlanCode = largerHazard.HazardCode;
|
|
|
|
|
newMajorPlanApproval.HazardType = largerHazard.HazardType;
|
|
|
|
|
newMajorPlanApproval.ProjectId = largerHazard.ProjectId;
|
|
|
|
|
newMajorPlanApproval.UnitWorkId = largerHazard.Address;
|
|
|
|
|
newMajorPlanApproval.ExpectedTime = largerHazard.ExpectedTime;
|
|
|
|
|
newMajorPlanApproval.IsReview = largerHazard.IsArgument;
|
|
|
|
|
newMajorPlanApproval.ApprovalDate = largerHazard.RecordTime;
|
|
|
|
|
newMajorPlanApproval.States = largerHazard.States;
|
|
|
|
|
newMajorPlanApproval.TrainPersonNum = largerHazard.TrainPersonNum;
|
|
|
|
|
newMajorPlanApproval.SchemeType = largerHazard.IsSuperLargerHazard.HasValue ? "超危大工程" : "危大工程";
|
|
|
|
|
db.SubmitChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2021-04-30 10:28:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|