2025-08-25 09:56:57 +08:00
|
|
|
|
using APT.BaseData.Domain.IServices.FM;
|
|
|
|
|
|
using APT.BaseData.Domain.IServices;
|
|
|
|
|
|
using APT.Infrastructure.Core;
|
|
|
|
|
|
using APT.MS.Domain.Entities.SK;
|
|
|
|
|
|
using APT.Utility;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using APT.BaseData.Domain.Entities.FM;
|
|
|
|
|
|
using APT.BaseData.Domain.Enums;
|
|
|
|
|
|
using APT.MS.Domain.Enums.SK;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using APT.BaseData.Domain.Entities;
|
|
|
|
|
|
using APT.BaseData.Domain.Enums.PF;
|
|
|
|
|
|
using APT.MS.Domain.Enums;
|
|
|
|
|
|
using APT.MS.Domain.Entities.FO;
|
|
|
|
|
|
using APT.MS.Domain.Entities.SC.BI;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace APT.SK.WebApi.Controllers.Api
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("api/SK/SKDoublePreventMechanism")]
|
|
|
|
|
|
public partial class DoublePreventMechanismController : AuthorizeApiController<T_SK_DOUBLE_PREVENT_MECHANISM>
|
|
|
|
|
|
{
|
|
|
|
|
|
IPFApproveCallBackService ApproveCallBackService { get; set; }
|
|
|
|
|
|
IFMNotificationTaskService NotificationTaskService { get; set; }
|
|
|
|
|
|
IPFCodeRuleService CodeRuleService { get; set; }
|
|
|
|
|
|
IFMFlowPermitService MFlowPermitService { get; set; }
|
|
|
|
|
|
public DoublePreventMechanismController(IFMNotificationTaskService notificationTaskService, IFMFlowPermitService mFlowPermitService, IPFCodeRuleService codeRuleService, IPFApproveCallBackService approveCallBackService)
|
|
|
|
|
|
{
|
|
|
|
|
|
NotificationTaskService = notificationTaskService;
|
|
|
|
|
|
MFlowPermitService = mFlowPermitService;
|
|
|
|
|
|
CodeRuleService = codeRuleService;
|
|
|
|
|
|
ApproveCallBackService = approveCallBackService;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="entity"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost, Route("FullUpdate")]
|
|
|
|
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_SK_DOUBLE_PREVENT_MECHANISM entity)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SafeExecute<bool>(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var details = entity.Nav_DoubleDetails;
|
|
|
|
|
|
entity.Nav_DoubleDetails = null;
|
|
|
|
|
|
var files = entity.Nav_DoubleFiles;
|
|
|
|
|
|
entity.Nav_DoubleFiles = null;
|
|
|
|
|
|
if (entity.APPLY_DEPARTMENT_ID == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.APPLY_DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (entity.APPLY_USER_ID == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
entity.APPLY_USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Guid> detailIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> detailDepartIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> detailPostIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> departDetailIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> measureIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> contentIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> departIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> postIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> hiddenIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> basicIds = new List<Guid>();
|
|
|
|
|
|
List<Guid> fileIds = new List<Guid>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST> detailPostList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART> detailDepartList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART_DETAIL> departDetailList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART_DETAIL>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES> measureList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST> postList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_DEPART> departList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_DEPART>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT> contentList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN> hiddenList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>();
|
|
|
|
|
|
List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC> basicList = new List<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>();
|
|
|
|
|
|
if (details != null && details.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
var first = details.FirstOrDefault(t => t.AREA_ID != entity.RISK_AREA_ID);
|
|
|
|
|
|
if (first != null && entity.RISK_AREA_ID != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("主表的检查区域与子表的辨识区域需保持一致!");
|
|
|
|
|
|
}
|
|
|
|
|
|
detailIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(t => t.DOUBLE_PREVENT_MECHANISM_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
detailPostIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
measureIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
detailDepartIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
departDetailIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART_DETAIL>(t => detailDepartIds.Contains(t.MECHANISM_DETAIL_DEPART_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
contentIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(t => measureIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
basicIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
hiddenIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
postIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
departIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_DEPART>(t => postIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST_ID), new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
foreach (var item in details)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (item.Nav_DoubleDetailMeasures != null && item.Nav_DoubleDetailMeasures.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item2 in item.Nav_DoubleDetailMeasures)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (item2.Nav_DetailMeasureContents != null && item2.Nav_DetailMeasureContents.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item3 in item2.Nav_DetailMeasureContents)
|
|
|
|
|
|
{
|
|
|
|
|
|
item3.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item3.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_ID = item2.ID;
|
|
|
|
|
|
contentList.Add(item3);
|
|
|
|
|
|
if (item3.Nav_DetailMeasureContentHiddens != null && item3.Nav_DetailMeasureContentHiddens.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item4 in item3.Nav_DetailMeasureContentHiddens)
|
|
|
|
|
|
{
|
|
|
|
|
|
item4.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item4.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID = item3.ID;
|
|
|
|
|
|
hiddenList.Add(item4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item3.Nav_DetailMeasureContentBasics != null && item3.Nav_DetailMeasureContentBasics.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item4 in item3.Nav_DetailMeasureContentBasics)
|
|
|
|
|
|
{
|
|
|
|
|
|
item4.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item4.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID = item3.ID;
|
|
|
|
|
|
basicList.Add(item4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item3.Nav_DetailMeasureContentPosts != null && item3.Nav_DetailMeasureContentPosts.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item4 in item3.Nav_DetailMeasureContentPosts)
|
|
|
|
|
|
{
|
|
|
|
|
|
item4.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item4.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID = item3.ID;
|
|
|
|
|
|
if (item4.Nav_DetailPosts != null && item4.Nav_DetailPosts.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item5 in item4.Nav_DetailPosts)
|
|
|
|
|
|
{
|
|
|
|
|
|
item5.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item5.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST_ID = item4.ID;
|
|
|
|
|
|
departList.Add(item5);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
item4.Nav_DetailPosts = null;
|
|
|
|
|
|
postList.Add(item4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
item3.Nav_DetailMeasureContentHiddens = null;
|
|
|
|
|
|
item3.Nav_DetailMeasureContentBasics = null;
|
|
|
|
|
|
item3.Nav_DetailMeasureContentPosts = null;
|
|
|
|
|
|
}
|
2025-09-20 13:03:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-25 09:56:57 +08:00
|
|
|
|
item2.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item2.DOUBLE_PREVENT_MECHANISM_DETAIL_ID = item.ID;
|
|
|
|
|
|
item2.Nav_DetailMeasureContents = null;
|
|
|
|
|
|
measureList.Add(item2);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var departType = "";
|
2025-09-20 13:03:07 +08:00
|
|
|
|
if (item.Nav_DetailPosts != null && item.Nav_DetailPosts.Any())
|
2025-08-25 09:56:57 +08:00
|
|
|
|
{
|
|
|
|
|
|
foreach (var item2 in item.Nav_DetailPosts)
|
|
|
|
|
|
{
|
|
|
|
|
|
item2.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item2.DOUBLE_PREVENT_MECHANISM_DETAIL_ID = item.ID;
|
2025-09-20 13:03:07 +08:00
|
|
|
|
departType = departType + item2.DEPARTMENT_TYPE.GetDescription() + ",";
|
2025-08-25 09:56:57 +08:00
|
|
|
|
detailPostList.Add(item2);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.EVALUATE_LEVEL == SKEvaluateLevelEnum.重大风险)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!departType.Contains("公司级"))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(item.RISK_NAME + ",重大风险管控层级必须包含公司级");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.EVALUATE_LEVEL == SKEvaluateLevelEnum.较大风险)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!departType.Contains("部门级") && !departType.Contains("公司级"))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(item.RISK_NAME + ",较大风险管控层级必须大于部门级");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.EVALUATE_LEVEL == SKEvaluateLevelEnum.一般风险)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!departType.Contains("部门级") && !departType.Contains("公司级") && !departType.Contains("车间级"))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(item.RISK_NAME + ",一般风险管控层级必须大于车间级");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.EVALUATE_LEVEL == SKEvaluateLevelEnum.低风险)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!departType.Contains("部门级") && !departType.Contains("公司级") && !departType.Contains("车间级") && !departType.Contains("班组级"))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception(item.RISK_NAME + ",低风险管控层级必须大于班组级");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.Nav_DetailDeparts != null && item.Nav_DetailDeparts.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item2 in item.Nav_DetailDeparts)
|
|
|
|
|
|
{
|
|
|
|
|
|
item2.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item2.DOUBLE_PREVENT_MECHANISM_DETAIL_ID = item.ID;
|
|
|
|
|
|
if (item2.Nav_DepartDetails != null && item2.Nav_DepartDetails.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item3 in item2.Nav_DepartDetails)
|
|
|
|
|
|
{
|
|
|
|
|
|
item3.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item3.MECHANISM_DETAIL_DEPART_ID = item2.ID;
|
|
|
|
|
|
departDetailList.Add(item3);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
item2.Nav_DepartDetails = null;
|
|
|
|
|
|
detailDepartList.Add(item2);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
item.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item.DOUBLE_PREVENT_MECHANISM_ID = entity.ID;
|
|
|
|
|
|
item.Nav_DoubleDetailMeasures = null;
|
|
|
|
|
|
item.Nav_DetailDeparts = null;
|
|
|
|
|
|
item.Nav_DetailPosts = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (files != null && files.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
fileIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_FILE>(t => t.DOUBLE_PREVENT_MECHANISM_ID == entity.ID, new BaseFilter(entity.ORG_ID)).Select(t => t.ID).ToList();
|
|
|
|
|
|
foreach (var item in files)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.ORG_ID = entity.ORG_ID;
|
|
|
|
|
|
item.DOUBLE_PREVENT_MECHANISM_ID = entity.ID;
|
|
|
|
|
|
item.Nav_ImgFile = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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[] { ',' });
|
|
|
|
|
|
MFlowPermitService.InsertApprove(serialCode[0], "SK026", "", entity.ID, "SK026_SHOWPRINT", entity.TaskID, true, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (departIds != null && departIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_DEPART>(departIds);
|
|
|
|
|
|
if (postIds != null && postIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>(postIds);
|
|
|
|
|
|
if (hiddenIds != null && hiddenIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>(hiddenIds);
|
|
|
|
|
|
if (basicIds != null && basicIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>(basicIds);
|
|
|
|
|
|
if (contentIds != null && contentIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(contentIds);
|
|
|
|
|
|
if (measureIds != null && measureIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(measureIds);
|
|
|
|
|
|
if (departDetailIds != null && departDetailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART_DETAIL>(departDetailIds);
|
|
|
|
|
|
if (detailDepartIds != null && detailDepartIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(detailDepartIds);
|
|
|
|
|
|
if (detailPostIds != null && detailPostIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(detailPostIds);
|
|
|
|
|
|
if (detailIds != null && detailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(detailIds);
|
|
|
|
|
|
if (fileIds != null && fileIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_FILE>(fileIds);
|
|
|
|
|
|
if (entity != null)
|
|
|
|
|
|
UpdateEntityNoCommit(entity);
|
|
|
|
|
|
if (files != null && files.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(files);
|
|
|
|
|
|
if (details != null && details.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(details);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("风险明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (detailPostList != null && detailPostList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(detailPostList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("管控层级明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (detailDepartList != null && detailDepartList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(detailDepartList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("辨识岗位明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (departDetailList != null && departDetailList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(departDetailList);
|
|
|
|
|
|
if (measureList != null && measureList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(measureList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("管控措施明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (contentList != null && contentList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(contentList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("检查内容明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (hiddenList != null && hiddenList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(hiddenList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("隐患明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (basicList != null && basicList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(basicList);
|
|
|
|
|
|
if (postList != null && postList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(postList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("检查层级明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (departList != null && departList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(departList);
|
|
|
|
|
|
}, null, null, null, null, null, "SK026_SHOWPRINT", null, "风险检查关联表审批");
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.UnifiedCommit(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (departIds != null && departIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_DEPART>(departIds);
|
|
|
|
|
|
if (postIds != null && postIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>(postIds);
|
|
|
|
|
|
if (hiddenIds != null && hiddenIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>(hiddenIds);
|
|
|
|
|
|
if (basicIds != null && basicIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>(basicIds);
|
|
|
|
|
|
if (contentIds != null && contentIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(contentIds);
|
|
|
|
|
|
if (measureIds != null && measureIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(measureIds);
|
|
|
|
|
|
if (departDetailIds != null && departDetailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART_DETAIL>(departDetailIds);
|
|
|
|
|
|
if (detailDepartIds != null && detailDepartIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(detailDepartIds);
|
|
|
|
|
|
if (detailPostIds != null && detailPostIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(detailPostIds);
|
|
|
|
|
|
if (detailIds != null && detailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(detailIds);
|
|
|
|
|
|
if (fileIds != null && fileIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_FILE>(fileIds);
|
|
|
|
|
|
if (entity != null)
|
|
|
|
|
|
UpdateEntityNoCommit(entity);
|
|
|
|
|
|
if (files != null && files.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(files);
|
|
|
|
|
|
if (details != null && details.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(details);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("风险明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (detailPostList != null && detailPostList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(detailPostList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("管控层级明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (detailDepartList != null && detailDepartList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(detailDepartList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("辨识岗位明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (departDetailList != null && departDetailList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(departDetailList);
|
|
|
|
|
|
if (measureList != null && measureList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(measureList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("管控措施明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (contentList != null && contentList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(contentList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("检查内容明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (hiddenList != null && hiddenList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(hiddenList);
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("隐患明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (basicList != null && basicList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(basicList);
|
|
|
|
|
|
if (postList != null && postList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(postList);
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new Exception("检查层级明细不能为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (departList != null && departList.Any())
|
|
|
|
|
|
BantchSaveEntityNoCommit(departList);
|
|
|
|
|
|
});
|
|
|
|
|
|
return true;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据主键删除数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id">主键ID</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet, Route("SKDelete")]
|
|
|
|
|
|
public JsonActionResult<bool> SKDelete(string id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SafeExecute(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var detailIds = new List<Guid>();
|
|
|
|
|
|
var fileIds = new List<Guid>();
|
|
|
|
|
|
var measureIds = new List<Guid>();
|
|
|
|
|
|
var departIds = new List<Guid>();
|
|
|
|
|
|
var postIds = new List<Guid>();
|
|
|
|
|
|
var contentIds = new List<Guid>();
|
|
|
|
|
|
var hiddenIds = new List<Guid>();
|
|
|
|
|
|
var contentPostIds = new List<Guid>();
|
|
|
|
|
|
var contentBasicIds = new List<Guid>();
|
|
|
|
|
|
var approveIds = new List<Guid>();
|
|
|
|
|
|
var approveDetailIds = new List<Guid>();
|
|
|
|
|
|
var taskIds = new List<Guid>();
|
|
|
|
|
|
var bitaskIds = new List<Guid>();
|
|
|
|
|
|
var identity = this.GetEntity<T_SK_DOUBLE_PREVENT_MECHANISM>(id);
|
|
|
|
|
|
if (identity != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
detailIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(t => t.DOUBLE_PREVENT_MECHANISM_ID == identity.ID, new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
fileIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_FILE>(t => t.DOUBLE_PREVENT_MECHANISM_ID == identity.ID, new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
measureIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
departIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
postIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
contentIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(t => measureIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
hiddenIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
contentPostIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
contentBasicIds = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>(t => contentIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
approveIds = this.GetEntities<T_PF_APPROVE>(t => t.DATA_ID == identity.ID, new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
approveDetailIds = this.GetEntities<T_PF_APPROVE_DETAIL>(t => approveIds.Contains(t.APPROVE_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
taskIds = this.GetEntities<T_FM_NOTIFICATION_TASK>(t => t.SOURCE_DATA_ID == identity.ID || approveIds.Contains((Guid)t.SOURCE_DATA_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
bitaskIds = this.GetEntities<T_BI_NOTIFICATION_TASK_NEW>(t => taskIds.Contains((Guid)t.TASK_ID), new BaseFilter(identity.ORG_ID)).Select(m => m.ID).ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
UnifiedCommit(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (contentBasicIds != null && contentBasicIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_BASIC>(contentBasicIds);
|
|
|
|
|
|
if (contentPostIds != null && contentPostIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_POST>(contentPostIds);
|
|
|
|
|
|
if (hiddenIds != null && hiddenIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT_HIDDEN>(hiddenIds);
|
|
|
|
|
|
if (contentIds != null && contentIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(contentIds);
|
|
|
|
|
|
if (postIds != null && postIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(postIds);
|
|
|
|
|
|
if (departIds != null && departIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(departIds);
|
|
|
|
|
|
if (measureIds != null && measureIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(measureIds);
|
|
|
|
|
|
if (fileIds != null && fileIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_FILE>(fileIds);
|
|
|
|
|
|
if (detailIds != null && detailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(detailIds);
|
|
|
|
|
|
if (identity != null)
|
|
|
|
|
|
this.DeleteEntityNoCommit(identity);
|
|
|
|
|
|
if (approveDetailIds != null && approveDetailIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_PF_APPROVE_DETAIL>(approveDetailIds);
|
|
|
|
|
|
if (approveIds != null && approveIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_PF_APPROVE>(approveIds);
|
|
|
|
|
|
if (taskIds != null && taskIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_FM_NOTIFICATION_TASK>(taskIds);
|
|
|
|
|
|
if (bitaskIds != null && bitaskIds.Any())
|
|
|
|
|
|
this.BantchDeleteEntityNoCommit<T_BI_NOTIFICATION_TASK_NEW>(bitaskIds);
|
|
|
|
|
|
});
|
|
|
|
|
|
return true;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获得单条实体数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="filter">过滤实体</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost, Route("SKGet")]
|
|
|
|
|
|
public JsonActionResult<T_SK_DOUBLE_PREVENT_MECHANISM> SKGet([FromBody] KeywordFilter filter)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SafeExecute(() =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var id = filter.FilterGroup.Rules.FirstOrDefault(t => t.Field == "ID").Value.ToString();
|
|
|
|
|
|
if (string.IsNullOrEmpty(id))
|
|
|
|
|
|
this.ThrowError("060010");
|
|
|
|
|
|
filter.IgnoreDataRule = true;
|
|
|
|
|
|
var result = this.GetEntity<T_SK_DOUBLE_PREVENT_MECHANISM>(id, new string[] { "Nav_ApplyUser", "Nav_ApplyDepartment","Nav_RiskArea","Nav_Contents",
|
|
|
|
|
|
"Nav_DoubleFiles.Nav_ImgFile"});
|
|
|
|
|
|
if (result != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var details = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL>(t => t.DOUBLE_PREVENT_MECHANISM_ID == result.ID, new BaseFilter(filter.OrgId), "Nav_Area", "Nav_Type", "Nav_RiskName", "Nav_SCOREL", "Nav_SCOREE", "Nav_SCOREC");
|
|
|
|
|
|
if (details.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
var detailIds = details.Select(t => t.ID).ToList();
|
|
|
|
|
|
var departs = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_DEPART>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(filter.OrgId), "Nav_Department", "Nav_DepartDetails.Nav_Post");
|
|
|
|
|
|
var posts = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_POST>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(filter.OrgId), "Nav_Department", "Nav_User");
|
|
|
|
|
|
var measures = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES>(t => detailIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID), new BaseFilter(filter.OrgId));
|
|
|
|
|
|
//, "Nav_DetailMeasureContents.Nav_DetailMeasureContentBasics.Nav_Law",
|
|
|
|
|
|
// "Nav_DetailMeasureContents.Nav_Contents", "Nav_DetailMeasureContents.Nav_DetailMeasureContentPosts.Nav_Department",
|
|
|
|
|
|
// "Nav_DetailMeasureContents.Nav_DetailMeasureContentPosts.Nav_CheckType", "Nav_DetailMeasureContents.Nav_DetailMeasureContentPosts.Nav_DetailPosts.Nav_Post",
|
|
|
|
|
|
// "Nav_DetailMeasureContents.Nav_DetailMeasureContentHiddens"
|
|
|
|
|
|
var measureIds = measures.Select(t => t.ID).ToList();
|
|
|
|
|
|
var measureContents = this.GetEntities<T_SK_DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_CONTENT>(t => measureIds.Contains(t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_ID), new BaseFilter(filter.OrgId), "Nav_DetailMeasureContentBasics.Nav_Law",
|
|
|
|
|
|
"Nav_Contents", "Nav_DetailMeasureContentPosts.Nav_Department", "Nav_DetailMeasureContentPosts.Nav_CheckType", "Nav_DetailMeasureContentPosts.Nav_DetailPosts.Nav_Post", "Nav_DetailMeasureContentHiddens");
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var detail in details)
|
|
|
|
|
|
{
|
|
|
|
|
|
var measureTemps = measures.Where(t => t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID == detail.ID).ToList();
|
|
|
|
|
|
detail.Nav_DoubleDetailMeasures = measureTemps.OrderBy(t => t.NUM).ToList();
|
|
|
|
|
|
if (detail.Nav_DoubleDetailMeasures != null && detail.Nav_DoubleDetailMeasures.Any())
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item2 in detail.Nav_DoubleDetailMeasures)
|
|
|
|
|
|
{
|
|
|
|
|
|
var measureContentTemps = measureContents.Where(t => t.DOUBLE_PREVENT_MECHANISM_DETAIL_MEASURES_ID == item2.ID).ToList();
|
|
|
|
|
|
item2.Nav_DetailMeasureContents = measureContentTemps.OrderBy(t => t.NUM).ToList();
|
|
|
|
|
|
item2.Nav_DetailMeasureContents.ForEach(t => t.Nav_DetailMeasureContentHiddens.OrderBy(m => m.NUM));
|
|
|
|
|
|
item2.Nav_DetailMeasureContents.ForEach(t => t.Nav_DetailMeasureContentPosts.OrderBy(m => m.CHECK_TYPE).ThenBy(t => t.DEPARTMENT_ID));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var departTemps = departs.Where(t => t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID == detail.ID).ToList();
|
|
|
|
|
|
detail.Nav_DetailDeparts = departTemps.OrderBy(m => m.Nav_Department.NUM).ToList();
|
|
|
|
|
|
var postTemps = posts.Where(t => t.DOUBLE_PREVENT_MECHANISM_DETAIL_ID == detail.ID).ToList();
|
|
|
|
|
|
detail.Nav_DetailPosts = postTemps.OrderBy(t => t.DEPARTMENT_TYPE).ThenBy(m => m.Nav_Department.NUM).ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.Nav_DoubleDetails = details.OrderBy(m => m.MineType).ThenBy(m => m.AREA_ID).ThenBy(n => n.TYPE_ID).ToList();
|
|
|
|
|
|
if (result.STATUS == PFStandardStatus.Rejected)
|
|
|
|
|
|
{
|
|
|
|
|
|
result.CONTEXT = ApproveCallBackService.RejectContent(result.ID);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
});
|
|
|
|
|
|
//var result = WitEntity(null, filter);
|
|
|
|
|
|
//if (result != null && result.Data != null)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (result.Data.Nav_DoubleDetails != null && result.Data.Nav_DoubleDetails.Any())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// foreach (var item in result.Data.Nav_DoubleDetails)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// item.Nav_DetailPosts.OrderBy(t => t.DEPARTMENT_TYPE).ThenBy(m => m.DEPARTMENT_ID);
|
|
|
|
|
|
// if (item.Nav_DoubleDetailMeasures != null && item.Nav_DoubleDetailMeasures.Any())
|
|
|
|
|
|
// {
|
|
|
|
|
|
// foreach (var item2 in item.Nav_DoubleDetailMeasures)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// item2.Nav_DetailMeasureContents.ForEach(t => t.Nav_DetailMeasureContentHiddens.OrderBy(m => m.NUM));
|
|
|
|
|
|
// item2.Nav_DetailMeasureContents.ForEach(t => t.Nav_DetailMeasureContentPosts.OrderBy(m => m.CHECK_TYPE).ThenBy(t => t.DEPARTMENT_ID));
|
|
|
|
|
|
// item2.Nav_DetailMeasureContents.OrderBy(t => t.NUM);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// item.Nav_DoubleDetailMeasures.OrderBy(t => t.NUM);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// result.Data.Nav_DoubleDetails.OrderBy(t => t.MineType).ThenBy(m=>m.AREA_ID);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (result.Data.STATUS == PFStandardStatus.Rejected)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// result.Data.CONTEXT = ApproveCallBackService.RejectContent(result.Data.ID);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <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("SK/SKDoublePreventMechanism/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_SK_DOUBLE_PREVENT_MECHANISM>(model.DATA_ID, new string[] { "Nav_ApplyUser" });
|
|
|
|
|
|
entity.STATUS = PFStandardStatus.Rejected;
|
|
|
|
|
|
T_FM_NOTIFICATION_TASK notice = new T_FM_NOTIFICATION_TASK();
|
|
|
|
|
|
if (entity.APPLY_USER_ID != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
//发消息
|
|
|
|
|
|
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.消息, "SK026");
|
|
|
|
|
|
}
|
|
|
|
|
|
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 (taskFinish != null)
|
|
|
|
|
|
UpdateEntityNoCommit(taskFinish);
|
|
|
|
|
|
});
|
|
|
|
|
|
return true;
|
|
|
|
|
|
//return ApproveCallBackService.CallReject("HM/HMLicenseAnalysis/RejectUpdate", id);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|