动火作业
This commit is contained in:
parent
267c35191f
commit
8f7a43078c
@ -2453,6 +2453,55 @@ namespace APT.BaseData.Services.DomainServices
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private bool BackUpdateNew_FOFireJob(T_PF_APPROVE entityInt, T_PF_APPROVE modelApp, List<T_PF_APPROVE_DETAIL> listAppDetail, T_FM_NOTIFICATION_TASK taskFinish, List<T_FM_NOTIFICATION_TASK> listTaskNext, bool isLast = false)
|
||||
{
|
||||
#region 审批公用
|
||||
|
||||
if (modelApp == null)
|
||||
{
|
||||
string taskCodeCheck = String.Empty;
|
||||
bool result = GetApproject2(entityInt, ref modelApp, ref listAppDetail, ref taskFinish, ref taskCodeCheck, ref isLast, ref listTaskNext);
|
||||
if (!result)
|
||||
{
|
||||
throw new Exception("审批失败!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
if (!isLast)
|
||||
{
|
||||
this.UnifiedCommit(() =>
|
||||
{
|
||||
if (modelApp != null)
|
||||
UpdateEntityNoCommit(modelApp); //保存主表
|
||||
if (listAppDetail != null && listAppDetail.Count > 0)//添加组合数据 修改的安全库、隐患库
|
||||
BantchSaveEntityNoCommit(listAppDetail);
|
||||
if (taskFinish != null)
|
||||
UpdateEntityNoCommit(taskFinish);
|
||||
if (listTaskNext != null && listTaskNext.Count > 0)
|
||||
BantchSaveEntityNoCommit(listTaskNext);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = this.GetEntity<T_FO_FIRE_JOB>(modelApp.DATA_ID);
|
||||
entity.STATUS = PFStandardStatus.Archived;
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (modelApp != null)
|
||||
UpdateEntityNoCommit(modelApp); //保存主表
|
||||
if (listAppDetail != null && listAppDetail.Count > 0)//添加组合数据 修改的安全库、隐患库
|
||||
BantchSaveEntityNoCommit(listAppDetail);
|
||||
if (taskFinish != null)
|
||||
UpdateEntityNoCommit(taskFinish);
|
||||
if (listTaskNext != null && listTaskNext.Count > 0)
|
||||
BantchSaveEntityNoCommit(listTaskNext);
|
||||
if (entity != null)
|
||||
this.UpdateEntityNoCommit(entity);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 关键许可工作票外包
|
||||
/// </summary>
|
||||
@ -7454,6 +7503,9 @@ namespace APT.BaseData.Services.DomainServices
|
||||
case "FO/FOCrucialLicenseJob/BackUpdateNew":
|
||||
result = BackUpdateNew_FOCrucialLicenseJob(entityInt, modelApp, listAppDetail, taskFinish, listTaskNext, isLast);
|
||||
break;
|
||||
case "FO/FOFireJob/BackUpdateNew":
|
||||
result = BackUpdateNew_FOFireJob(entityInt, modelApp, listAppDetail, taskFinish, listTaskNext, isLast);
|
||||
break;
|
||||
case "FO/FOJobEventRecord/BackUpdateNew":
|
||||
result = BackUpdateNew_FOJobEventRecord(entityInt, modelApp, listAppDetail, taskFinish, listTaskNext, isLast);
|
||||
break;
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.BaseData.Domain.Entities;
|
||||
using APT.BaseData.Domain.Entities.FM;
|
||||
using APT.BaseData.Domain.Enums;
|
||||
using APT.BaseData.Domain.IServices;
|
||||
using APT.BaseData.Domain.IServices.FM;
|
||||
using APT.BaseData.Services.DomainServices;
|
||||
using APT.BaseData.Services.Services.FM;
|
||||
using APT.Infrastructure.Core;
|
||||
using APT.MS.Domain.Entities.FO;
|
||||
using APT.MS.Domain.Enums;
|
||||
using APT.Utility;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
@ -14,6 +22,21 @@ namespace APT.FO.WebApi.Controllers
|
||||
[Route("api/FO/FOFireJob")]
|
||||
public partial class FireJobController : AuthorizeApiController<T_FO_FIRE_JOB>
|
||||
{
|
||||
IFMFlowPermitService MFlowPermitService { get; set; }
|
||||
IPFCodeRuleService CodeRuleService { get; set; }
|
||||
IPFApproveCallBackService ApproveCallBackService { get; set; }
|
||||
IFMNotificationTaskService NotificationTaskService { get; set; }
|
||||
/// <summary>
|
||||
/// FOPreOperSch
|
||||
/// </summary>
|
||||
/// <param name="codeRuleService"></param>
|
||||
public FireJobController(IPFCodeRuleService codeRuleService, IFMFlowPermitService mFlowPermitService, IPFApproveCallBackService approveCallBackService, IFMNotificationTaskService notificationTaskService)
|
||||
{
|
||||
CodeRuleService = codeRuleService;
|
||||
MFlowPermitService = mFlowPermitService;
|
||||
ApproveCallBackService = approveCallBackService;
|
||||
NotificationTaskService = notificationTaskService;
|
||||
}
|
||||
[HttpPost, Route("GetEdit")]
|
||||
public JsonActionResult<T_FO_FIRE_JOB> GetEdit([FromBody] KeywordFilter filter)
|
||||
{
|
||||
@ -124,6 +147,47 @@ namespace APT.FO.WebApi.Controllers
|
||||
var userList = new List<T_FO_FIRE_JOB_USER>();
|
||||
if (users != null && users.Any())
|
||||
{
|
||||
var userTypes = this.GetEntities<T_FO_USER_TYPE>(t => t.NAME == "动火操作人员" || t.NAME == "瓦检员" || t.NAME == "喷水人员", new BaseFilter(entity.ORG_ID));
|
||||
var userTypeIds = userTypes.Select(m => m.ID).ToList();
|
||||
var dhUser = userTypes.FirstOrDefault(t => t.NAME == "动火操作人员");
|
||||
if (dhUser == null)
|
||||
{
|
||||
throw new Exception("人员类别未维护动火操作人员,请到系统管理添加名称为动火操作人员的人员类别");
|
||||
}
|
||||
else
|
||||
{
|
||||
var dhUserHas = users.FirstOrDefault(t => t.USER_TYPE_ID == dhUser.ID);
|
||||
if (dhUserHas == null)
|
||||
{
|
||||
throw new Exception("作业人员必须要有动火操作人员,请到用户列表配置对应人员类型");
|
||||
}
|
||||
}
|
||||
var wjUser = userTypes.FirstOrDefault(t => t.NAME == "瓦检员");
|
||||
if (wjUser == null)
|
||||
{
|
||||
throw new Exception("人员类别未维护瓦检员,请到系统管理添加名称为瓦检员的人员类别");
|
||||
}
|
||||
else
|
||||
{
|
||||
var wjUserHas = users.FirstOrDefault(t => t.USER_TYPE_ID == wjUser.ID);
|
||||
if (wjUserHas == null)
|
||||
{
|
||||
throw new Exception("作业人员必须要有瓦检员,请到用户列表配置对应人员类型");
|
||||
}
|
||||
}
|
||||
var psUser = userTypes.FirstOrDefault(t => t.NAME == "喷水人员");
|
||||
if (psUser == null)
|
||||
{
|
||||
throw new Exception("人员类别未维护喷水人员,请到系统管理添加名称为喷水人员的人员类别");
|
||||
}
|
||||
else
|
||||
{
|
||||
var psUserHas = users.FirstOrDefault(t => t.USER_TYPE_ID == psUser.ID);
|
||||
if (psUserHas == null)
|
||||
{
|
||||
throw new Exception("作业人员必须要有喷水人员,请到用户列表配置对应人员类型");
|
||||
}
|
||||
}
|
||||
foreach (var item in users)
|
||||
{
|
||||
item.ORG_ID = entity.ORG_ID;
|
||||
@ -144,6 +208,10 @@ namespace APT.FO.WebApi.Controllers
|
||||
userList.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("作业人员不能为空");
|
||||
}
|
||||
var fireFiles = entity.Nav_FireFiles;
|
||||
if (fireFiles != null && fireFiles.Any())
|
||||
{
|
||||
@ -180,6 +248,62 @@ namespace APT.FO.WebApi.Controllers
|
||||
monitorFileList.Add(item);
|
||||
}
|
||||
}
|
||||
if (entity.PUBLISH != null && entity.PUBLISH.Equals("SaveAndNotify"))
|
||||
{
|
||||
//触发审批
|
||||
entity.STATUS = BaseData.Domain.Enums.PF.PFStandardStatus.Approving;
|
||||
//取审批流水码
|
||||
var sysFilter = new SystemCodeFilter();
|
||||
sysFilter.CodeType = (int)PFCodeRuleType.审批流编码;
|
||||
sysFilter.Count = 1;
|
||||
sysFilter.OrgId = entity.ORG_ID;
|
||||
var codes = CodeRuleService.NewGenSerial(sysFilter);
|
||||
var serialCode = codes.Split(new char[] { ',' });
|
||||
var department = this.GetEntity<T_FM_DEPARTMENT>(t => t.ID == departmentId);
|
||||
var param = Enum.GetName(typeof(FMDepartmentType), department.DEPARTMENT_TYPE);
|
||||
if (department.DEPARTMENT_STATUS == 2)
|
||||
{
|
||||
param = "公司";
|
||||
}
|
||||
MFlowPermitService.InsertApprove(serialCode[0], "FO038", param, entity.ID, "FO039_SHOWPRINT", entity.TaskID, true, () =>
|
||||
{
|
||||
if (detailFileIds != null && detailFileIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_DETAIL_FILE>(detailFileIds);
|
||||
if (detailIds != null && detailIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_DETAIL>(detailIds);
|
||||
if (userFileIds != null && userFileIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_USER_FILE>(userFileIds);
|
||||
if (userIds != null && userIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_USER>(userIds);
|
||||
if (fileIds != null && fileIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_FILE>(fileIds);
|
||||
if (fireFileIds != null && fireFileIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_FIRE_FILE>(fireFileIds);
|
||||
if (monitorFileIds != null && monitorFileIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_MONITOR_FILE>(monitorFileIds);
|
||||
if (riskIds != null && riskIds.Any())
|
||||
this.BantchDeleteEntityNoCommit<T_FO_FIRE_JOB_RISK>(riskIds);
|
||||
if (entity != null)
|
||||
UpdateEntityNoCommit(entity);
|
||||
if (detailList != null && detailList.Any())
|
||||
this.BantchSaveEntityNoCommit(detailList);
|
||||
if (detailFileList != null && detailFileList.Any())
|
||||
this.BantchSaveEntityNoCommit(detailFileList);
|
||||
if (userList != null && userList.Any())
|
||||
this.BantchSaveEntityNoCommit(userList);
|
||||
if (userFileList != null && userFileList.Any())
|
||||
this.BantchSaveEntityNoCommit(userFileList);
|
||||
if (riskList != null && riskList.Any())
|
||||
this.BantchSaveEntityNoCommit(riskList);
|
||||
if (monitorFileList != null && monitorFileList.Any())
|
||||
this.BantchSaveEntityNoCommit(monitorFileList);
|
||||
if (fireFileList != null && fireFileList.Any())
|
||||
this.BantchSaveEntityNoCommit(fireFileList);
|
||||
if (fileList != null && fileList.Any())
|
||||
this.BantchSaveEntityNoCommit(fileList);
|
||||
}, null, null, null, null, null, "FO039_SHOWPRINT", null, "动火作业工作票", FMTASKTYPE.JobSite);
|
||||
return true;
|
||||
}
|
||||
this.UnifiedCommit(() =>
|
||||
{
|
||||
if (detailFileIds != null && detailFileIds.Any())
|
||||
@ -220,5 +344,69 @@ namespace APT.FO.WebApi.Controllers
|
||||
return true;
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 回调函数
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("BackUpdateNew")]
|
||||
public JsonActionResult<bool> BackUpdateNew([FromBody] T_PF_APPROVE entity)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
return ApproveCallBackService.CallBackNew("FO/FOFireJob/BackUpdateNew", entity);
|
||||
});
|
||||
}
|
||||
/// <summary>
|
||||
/// 驳回
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("RejectUpdate")]
|
||||
public JsonActionResult<bool> RejectUpdate([FromBody] T_PF_APPROVE model)
|
||||
{
|
||||
return SafeExecute(() =>
|
||||
{
|
||||
//公共 获取审批流信息
|
||||
T_PF_APPROVE modelApp = null;
|
||||
List<T_PF_APPROVE_DETAIL> listAppDetail = null;
|
||||
T_FM_NOTIFICATION_TASK taskFinish = null;
|
||||
string Msg = string.Empty;
|
||||
bool ResultGetInfo = ApproveCallBackService.GetApproject(model, ref modelApp, ref listAppDetail, ref taskFinish, ref Msg);
|
||||
if (!ResultGetInfo)
|
||||
throw new Exception("驳回失败!");
|
||||
|
||||
if (modelApp == null || listAppDetail == null)
|
||||
throw new Exception("获取驳回信息失败!");
|
||||
var entity = this.GetEntity<T_FO_FIRE_JOB>(model.DATA_ID, new string[] { "Nav_ApplyUser" });
|
||||
entity.STATUS = BaseData.Domain.Enums.PF.PFStandardStatus.Rejected;
|
||||
var persons = this.GetEntities<T_FO_FIRE_JOB_USER>(t => t.FIRE_JOB_ID == model.DATA_ID, new BaseFilter(entity.ORG_ID));
|
||||
if (persons.Any())
|
||||
persons.ForEach(t => { t.DEAL_STATUS = 0; t.Nav_User = null; });
|
||||
//直接驳回给申请人
|
||||
T_FM_NOTIFICATION_TASK notice = NotificationTaskService.InsertUserNoticeTaskModel("动火作业工作票已被驳回", entity.ID, entity.ORG_ID, (Guid)entity.APPLY_USER_ID, entity.Nav_ApplyUser.NAME, DateTime.Now,
|
||||
DateTime.Now.AddHours(24), (int)FMNoticeTypeEnum.消息, "FO038");
|
||||
//当前节点其他审核人待办消除
|
||||
var taskOtherIds = this.GetEntities<T_FM_NOTIFICATION_TASK>(t => t.SOURCE_DATA_ID == model.ID && t.NOTICE_STATUS == 0, new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (entity != null)
|
||||
this.UpdateEntityNoCommit(entity);
|
||||
if (notice != null)
|
||||
this.UpdateEntityNoCommit(notice);
|
||||
if (modelApp != null)
|
||||
UpdateEntityNoCommit(modelApp);
|
||||
if (listAppDetail != null && listAppDetail.Count > 0)
|
||||
BantchUpdateEntityNoCommit(listAppDetail);
|
||||
if (persons != null && persons.Any())
|
||||
BantchUpdateEntityNoCommit(persons);
|
||||
if (taskOtherIds != null && taskOtherIds.Any())
|
||||
BantchDeleteEntityNoCommit<T_FM_NOTIFICATION_TASK>(taskOtherIds);
|
||||
if (taskFinish != null)
|
||||
UpdateEntityNoCommit(taskFinish);
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user