This commit is contained in:
wyw 2025-11-20 10:01:46 +08:00
commit 6ff810eba7

View File

@ -8,6 +8,8 @@ using APT.BaseData.Services.DomainServices;
using APT.BaseData.Services.Services.FM; using APT.BaseData.Services.Services.FM;
using APT.Infrastructure.Core; using APT.Infrastructure.Core;
using APT.MS.Domain.Entities.BS; using APT.MS.Domain.Entities.BS;
using APT.MS.Domain.Entities.FO;
using APT.MS.Domain.Entities.HM;
using APT.MS.Domain.Entities.SC.PE; using APT.MS.Domain.Entities.SC.PE;
using APT.MS.Domain.Entities.SK; using APT.MS.Domain.Entities.SK;
using APT.MS.Domain.Enums; using APT.MS.Domain.Enums;
@ -97,6 +99,11 @@ namespace APT.SK.WebApi.Controllers.Api
public List<OperateLogList> logList { get; set; } public List<OperateLogList> logList { get; set; }
} }
public class OperateLogList { public class OperateLogList {
[Description("数据ID")]
public Guid? ID { get; set; }
[Description("表单编号")]
public string CODE { get; set; }
[Description("待办名称")] [Description("待办名称")]
public string NAME { get; set; } public string NAME { get; set; }
[Description("待办人")] [Description("待办人")]
@ -109,8 +116,8 @@ namespace APT.SK.WebApi.Controllers.Api
[Description("处理状态")] [Description("处理状态")]
public int STATUS { get; set; } public int STATUS { get; set; }
} }
/// <summary> /// <summary>
/// 安全检查通知 /// 安全检查通知
/// </summary> /// </summary>
@ -1598,16 +1605,8 @@ namespace APT.SK.WebApi.Controllers.Api
return result; return result;
//throw new Exception("生产单元,检查层级,检查类型,检查周期都不能为空"); //throw new Exception("生产单元,检查层级,检查类型,检查周期都不能为空");
} }
var loginUserId = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
var departId = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID; var departId = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID;
var postId = this.GetEntity<T_FM_USER>(t => t.ID == loginUserId && t.Nav_Person != null, "Nav_Person")?.Nav_Person?.POST_ID; var checkSet = this.GetEntity<T_SK_CHECK_SET>(t => t.PRODUCTION_UNIT_ID == entity.PRODUCTION_UNIT_ID && t.CHECK_CYCLE == entity.PLANCHECKFREQUENCY && t.CHECK_TYPE == entity.DEPARTMENT_TYPE && t.DEPARTMENT_ID == Guid.Parse(departId.ToString()));
if (postId == null)
{
result.ErrorMessage = "发起人岗位未配置,请到用户列表确认岗位";
return result;
//throw new Exception("发起人岗位未配置,请到用户列表确认岗位");
}
var checkSet = this.GetEntity<T_SK_CHECK_SET>(t => t.PRODUCTION_UNIT_ID == entity.PRODUCTION_UNIT_ID && t.CHECK_CYCLE == entity.PLANCHECKFREQUENCY && t.CHECK_TYPE == entity.DEPARTMENT_TYPE && t.DEPARTMENT_ID == Guid.Parse(departId.ToString()) && t.POST_ID == postId);
if (checkSet == null) if (checkSet == null)
{ {
result.ErrorMessage = "未找到对应的检查清单,请手动添加检查内容"; result.ErrorMessage = "未找到对应的检查清单,请手动添加检查内容";
@ -1662,25 +1661,57 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
Guid? safeNoticeId = null; Guid? safeNoticeId = null;
Guid? handId = null;
Guid? confirmId = null;
List<Guid> safeRecordIds = new List<Guid>(); List<Guid> safeRecordIds = new List<Guid>();
Guid? safeRecordSumId = null; Guid? safeRecordSumId = null;
Guid? dangerReportId = null; Guid? dangerReportId = null;
Guid? rectifyNoticeId = null; List<Guid> rectifyNoticeIds = new List<Guid>();
List<Guid> rectifyRecordIds = new List<Guid>(); List<Guid> rectifyRecordIds = new List<Guid>();
var sourceIds = new List<Guid>();
T_SK_HIDDEN_DANGER_REPORT dangerReport = null;
T_SK_HIDDEN_DANGER_HAND_REPORT hand = null;
List<T_SK_HIDDEN_DANGER_RECTIFY_RECORD> rectifyRecords = new List<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>();
Guid Keyword = new Guid(filter.Keyword); Guid Keyword = new Guid(filter.Keyword);
//检查通知
var check = GetEntity<T_SK_SECURITY_INSPECTION_NOTICE>(Keyword); var check = GetEntity<T_SK_SECURITY_INSPECTION_NOTICE>(Keyword);
if (check == null) if (check == null)
{ {
//手动隐患上报
hand = GetEntity<T_SK_HIDDEN_DANGER_HAND_REPORT>(Keyword);
if (hand == null)
return result; return result;
else
{
handId = hand.ID;
sourceIds.Add(hand.ID);
var confirm = GetEntity<T_SK_HIDDEN_DANGER_CONFIRM>(e => e.HIDDEN_DANGER_HAND_REPORT_ID != null && e.HIDDEN_DANGER_HAND_REPORT_ID == hand.ID);
if (confirm != null)
{
confirmId = confirm.ID;
sourceIds.Add(confirm.ID);
rectifyNoticeIds = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_NOTICE>(e => e.HIDDEN_DANGER_CONFIRM_ID != null && e.HIDDEN_DANGER_CONFIRM_ID == confirm.ID, filter).Select(t => t.ID).ToList();
if (rectifyNoticeIds != null && rectifyNoticeIds.Any())
{
sourceIds.AddRange(rectifyNoticeIds);
rectifyRecords = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.HIDDEN_DANGER_RECTIFY_NOTICE_ID != null && rectifyNoticeIds.Contains((Guid)e.HIDDEN_DANGER_RECTIFY_NOTICE_ID), filter).ToList();
rectifyRecordIds = rectifyRecords.Select(m => m.ID).ToList();
sourceIds.AddRange(rectifyRecordIds);
}
else
{
rectifyRecords = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.HIDDEN_DANGER_CONFIRM_ID != null && e.HIDDEN_DANGER_CONFIRM_ID == confirm.ID, filter).ToList();
rectifyRecordIds = rectifyRecords.Select(m => m.ID).ToList();
sourceIds.AddRange(rectifyRecordIds);
}
}
GetAutoNext(sourceIds, check, safeNoticeId, hand, handId, confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result);
}
} }
else else
{ {
//ID
var sourceIds = new List<Guid>();
safeNoticeId = check.ID; safeNoticeId = check.ID;
sourceIds.Add(check.ID); sourceIds.Add(check.ID);
T_SK_HIDDEN_DANGER_REPORT dangerReport = null;
List<T_SK_HIDDEN_DANGER_RECTIFY_RECORD> rectifyRecords = new List<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>();
safeRecordIds = GetEntities<T_SK_SECURITY_INSPECTION_RECORD>(e => e.SECURITY_INSPECTION_NOTICE_ID != null && e.SECURITY_INSPECTION_NOTICE_ID == check.ID, filter).Select(m=>m.ID).ToList(); safeRecordIds = GetEntities<T_SK_SECURITY_INSPECTION_RECORD>(e => e.SECURITY_INSPECTION_NOTICE_ID != null && e.SECURITY_INSPECTION_NOTICE_ID == check.ID, filter).Select(m=>m.ID).ToList();
sourceIds.AddRange(safeRecordIds); sourceIds.AddRange(safeRecordIds);
var recordSum= GetEntity<T_SK_SECURITY_INSPECTION_RECORD_SUMMARY>(e => e.SECURITY_INSPECTION_NOTICE_ID != null && e.SECURITY_INSPECTION_NOTICE_ID == check.ID); var recordSum= GetEntity<T_SK_SECURITY_INSPECTION_RECORD_SUMMARY>(e => e.SECURITY_INSPECTION_NOTICE_ID != null && e.SECURITY_INSPECTION_NOTICE_ID == check.ID);
@ -1693,12 +1724,11 @@ namespace APT.SK.WebApi.Controllers.Api
{ {
dangerReportId = dangerReport.ID; dangerReportId = dangerReport.ID;
sourceIds.Add(dangerReport.ID); sourceIds.Add(dangerReport.ID);
var rectifyNotice = GetEntity<T_SK_HIDDEN_DANGER_RECTIFY_NOTICE>(e => e.HIDDEN_DANGER_REPORT_ID != null && e.HIDDEN_DANGER_REPORT_ID == dangerReport.ID); rectifyNoticeIds = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_NOTICE>(e => e.HIDDEN_DANGER_REPORT_ID != null && e.HIDDEN_DANGER_REPORT_ID == dangerReport.ID,filter).Select(t=>t.ID).ToList();
if (rectifyNotice != null) if (rectifyNoticeIds != null && rectifyNoticeIds.Any())
{ {
rectifyNoticeId = rectifyNotice.ID; sourceIds.AddRange(rectifyNoticeIds);
sourceIds.Add(rectifyNotice.ID); rectifyRecords = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.HIDDEN_DANGER_RECTIFY_NOTICE_ID != null && rectifyNoticeIds.Contains((Guid)e.HIDDEN_DANGER_RECTIFY_NOTICE_ID), filter).ToList();
rectifyRecords = GetEntities<T_SK_HIDDEN_DANGER_RECTIFY_RECORD>(e => e.HIDDEN_DANGER_RECTIFY_NOTICE_ID != null && e.HIDDEN_DANGER_RECTIFY_NOTICE_ID == rectifyNotice.ID, filter).ToList();
rectifyRecordIds = rectifyRecords.Select(m => m.ID).ToList(); rectifyRecordIds = rectifyRecords.Select(m => m.ID).ToList();
sourceIds.AddRange(rectifyRecordIds); sourceIds.AddRange(rectifyRecordIds);
} }
@ -1710,6 +1740,14 @@ namespace APT.SK.WebApi.Controllers.Api
} }
} }
} }
GetAutoNext(sourceIds,check, safeNoticeId,hand, handId, confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result);
}
return result;
}
});
}
private void GetAutoNext(List<Guid> sourceIds, T_SK_SECURITY_INSPECTION_NOTICE check, Guid? safeNoticeId, T_SK_HIDDEN_DANGER_HAND_REPORT hand,Guid? handId, Guid? confirmId, List<Guid> safeRecordIds, Guid? safeRecordSumId, Guid? dangerReportId, T_SK_HIDDEN_DANGER_REPORT dangerReport, List<Guid> rectifyNoticeIds, List<Guid> rectifyRecordIds, List<T_SK_HIDDEN_DANGER_RECTIFY_RECORD> rectifyRecords, ref List<OperateLog> result)
{
var approveIds = new List<Guid>(); var approveIds = new List<Guid>();
var approves = new List<T_PF_APPROVE>(); var approves = new List<T_PF_APPROVE>();
if (sourceIds != null && sourceIds.Any()) if (sourceIds != null && sourceIds.Any())
@ -1717,12 +1755,14 @@ namespace APT.SK.WebApi.Controllers.Api
approves = GetEntities<T_PF_APPROVE>(e => sourceIds.Contains(e.DATA_ID), null, null).ToList(); approves = GetEntities<T_PF_APPROVE>(e => sourceIds.Contains(e.DATA_ID), null, null).ToList();
approveIds = approves.Select(m => m.ID).ToList(); approveIds = approves.Select(m => m.ID).ToList();
} }
var tasks = GetEntities<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID != null && (sourceIds.Contains(e.SOURCE_DATA_ID.Value) || approveIds.Contains(e.SOURCE_DATA_ID.Value)), null, null).OrderBy(t => t.CREATE_TIME).ThenBy(m=>m.MODIFY_TIME).ToList(); var tasks = GetEntities<T_FM_NOTIFICATION_TASK>(e => e.SOURCE_DATA_ID != null && (sourceIds.Contains(e.SOURCE_DATA_ID.Value) || approveIds.Contains(e.SOURCE_DATA_ID.Value)), null, null).OrderBy(t => t.CREATE_TIME).ThenBy(m => m.MODIFY_TIME).ToList();
var users = GetEntities<T_FM_USER>(e => e.ENABLE_STATUS == 0, new BaseFilter(check.ORG_ID), null).ToList(); var users = GetEntities<T_FM_USER>(e => e.ENABLE_STATUS == 0, new BaseFilter(check.ORG_ID), null).ToList();
var checkUser = users.FirstOrDefault(t => t.ID == check.APPLY_USER_ID);
var departs = GetEntities<T_FM_DEPARTMENT>(e => e.ENABLE_STATUS == 0, new BaseFilter(check.ORG_ID), null).ToList(); var departs = GetEntities<T_FM_DEPARTMENT>(e => e.ENABLE_STATUS == 0, new BaseFilter(check.ORG_ID), null).ToList();
List<string>formCodes=new List<string> { "SK006","SK014","SK022"}; List<string> formCodes = new List<string> { "SK006", "SK014", "SK022", "SK018" };
var approveTemps = GetEntities<T_PF_APPROVE_TEMP>(e => formCodes.Contains(e.FORM_CODE), new BaseFilter(check.ORG_ID), "Nav_ApproveTempDetails.Nav_ApproveRole").ToList(); var approveTemps = GetEntities<T_PF_APPROVE_TEMP>(e => formCodes.Contains(e.FORM_CODE), new BaseFilter(check.ORG_ID), "Nav_ApproveTempDetails.Nav_ApproveRole").ToList();
if (check != null)
{
var checkUser = users.FirstOrDefault(t => t.ID == check.APPLY_USER_ID);
#region #region
OperateLog noticeLog = new OperateLog(); OperateLog noticeLog = new OperateLog();
noticeLog.FORM_NAME = "安全检查通知"; noticeLog.FORM_NAME = "安全检查通知";
@ -1734,22 +1774,26 @@ namespace APT.SK.WebApi.Controllers.Api
if (temp1 != null) if (temp1 != null)
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = safeNoticeId;
start.CODE = "SK006_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME =temp1.NOTICE_STATUS==4? "安全检查通知(系统归档)" : "安全检查通知"; start.NAME = temp1.NOTICE_STATUS == 4 ? "安全检查通知(系统归档)" : "安全检查通知";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
noticeLog.logList.Add(start); noticeLog.logList.Add(start);
} }
else else
{ {
//手动发起的检查通知 //手动发起的检查通知
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = check.ID;
start.CODE = "SK006_SHOWPRINT";
start.USER_NAME = checkUser.NAME; start.USER_NAME = checkUser.NAME;
start.NAME = check.STATUS == PFStandardStatus.Close? "安全检查通知(系统归档)" : "安全检查通知"; start.NAME = check.STATUS == PFStandardStatus.Close ? "安全检查通知(系统归档)" : "安全检查通知";
start.DEAL_DATE = check.STATUS == PFStandardStatus.Draft ? null:check.MODIFY_TIME; start.DEAL_DATE = check.STATUS == PFStandardStatus.Draft ? null : check.MODIFY_TIME;
start.CREATE_TIME = check.CREATE_TIME; start.CREATE_TIME = check.CREATE_TIME;
start.STATUS = check.STATUS == PFStandardStatus.Close? 15 :check.STATUS == PFStandardStatus.Draft? 0 : 5; start.STATUS = check.STATUS == PFStandardStatus.Close ? 15 : check.STATUS == PFStandardStatus.Draft ? 0 : 5;
noticeLog.logList.Add(start); noticeLog.logList.Add(start);
} }
//审批 //审批
@ -1766,9 +1810,11 @@ namespace APT.SK.WebApi.Controllers.Api
var approveTempFirst = approveTemps.FirstOrDefault(t => t.PARAM == param && t.FORM_CODE == "SK006"); var approveTempFirst = approveTemps.FirstOrDefault(t => t.PARAM == param && t.FORM_CODE == "SK006");
if (approveTempFirst != null && approveTempFirst.Nav_ApproveTempDetails != null && approveTempFirst.Nav_ApproveTempDetails.Any()) if (approveTempFirst != null && approveTempFirst.Nav_ApproveTempDetails != null && approveTempFirst.Nav_ApproveTempDetails.Any())
{ {
foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t=>t.NUM)) foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM))
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = item.Nav_ApproveRole.NAME; start1.USER_NAME = item.Nav_ApproveRole.NAME;
start1.NAME = "安全检查通知审批"; start1.NAME = "安全检查通知审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1780,6 +1826,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = "审批人"; start1.USER_NAME = "审批人";
start1.NAME = "安全检查通知审批"; start1.NAME = "安全检查通知审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1790,38 +1838,64 @@ namespace APT.SK.WebApi.Controllers.Api
} }
else else
{ {
var tempApprove = tasks.Where(t => t.SOURCE_DATA_ID == approveTemp.ID).OrderBy(t => t.MODIFY_TIME).ThenBy(m=>m.CREATE_TIME).ToList(); var tempApprove = tasks.Where(t => t.SOURCE_DATA_ID == approveTemp.ID).OrderBy(t => t.MODIFY_TIME).ThenBy(m => m.CREATE_TIME).ToList();
if (tempApprove != null && tempApprove.Any()) if (tempApprove != null && tempApprove.Any())
{ {
foreach (var item in tempApprove) foreach (var item in tempApprove)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = approveTemp.DATA_ID;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "安全检查通知已被驳回" : "安全检查通知审批"; start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "安全检查通知已被驳回" : "安全检查通知审批";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
noticeLog.logList.Add(start1); noticeLog.logList.Add(start1);
} }
} }
} }
var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == safeNoticeId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m=>m.MODIFY_TIME).ThenBy(n=>n.CREATE_TIME).ToList(); var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == safeNoticeId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList();
if (temp2 != null && temp2.Any()) if (temp2 != null && temp2.Any())
{ {
foreach (var item in temp2) var temp3 = temp2.Where(t => t.NOTICE_STATUS == 1).OrderBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var item in temp3)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = safeNoticeId;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = "安全检查通知确认"; start1.NAME = "安全检查通知确认";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
noticeLog.logList.Add(start1); noticeLog.logList.Add(start1);
} }
} }
var temp4 = temp2.Where(t => t.NOTICE_STATUS != 1).OrderByDescending(n => n.NOTICE_STATUS).ThenBy(m => m.MODIFY_TIME).ToList();
if (temp4 != null && temp4.Any())
{
foreach (var item in temp4)
{
OperateLogList start1 = new OperateLogList();
start1.ID = safeNoticeId;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = item.USER_NAME;
start1.NAME = "安全检查通知确认";
start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
noticeLog.logList.Add(start1);
}
}
}
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK006_SHOWPRINT";
start1.USER_NAME = "检查人"; start1.USER_NAME = "检查人";
start1.NAME = "安全检查通知确认"; start1.NAME = "安全检查通知确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1839,23 +1913,47 @@ namespace APT.SK.WebApi.Controllers.Api
if (safeRecordIds != null && safeRecordIds.Any()) if (safeRecordIds != null && safeRecordIds.Any())
{ {
//发起 //发起
var itemps = tasks.Where(t => t.SOURCE_DATA_ID!=null && safeRecordIds.Contains((Guid)t.SOURCE_DATA_ID)).OrderBy(m=>m.MODIFY_TIME).ThenBy(n=>n.CREATE_TIME).ToList(); var itemps = tasks.Where(t => t.SOURCE_DATA_ID != null && safeRecordIds.Contains((Guid)t.SOURCE_DATA_ID)).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList();
if (itemps != null && itemps.Any()) if (itemps != null && itemps.Any())
{ {
foreach (var temp1 in itemps) var temp2 = itemps.Where(t => t.NOTICE_STATUS == 1).OrderBy(m => m.MODIFY_TIME).ToList();
if (temp2 != null && temp2.Any())
{
foreach (var temp1 in temp2)
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = temp1.SOURCE_DATA_ID;
start.CODE = "SK010_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME = temp1.NOTICE_STATUS== 4? "安全检查记录(系统归档)" : "安全检查记录"; start.NAME = temp1.NOTICE_STATUS == 4 ? "安全检查记录(系统归档)" : "安全检查记录";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
recordLog.logList.Add(start); recordLog.logList.Add(start);
} }
} }
var temp3 = itemps.Where(t => t.NOTICE_STATUS != 1).OrderByDescending(n => n.NOTICE_STATUS).ThenBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var temp1 in temp3)
{
OperateLogList start = new OperateLogList();
start.ID = temp1.SOURCE_DATA_ID;
start.CODE = "SK010_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME;
start.NAME = temp1.NOTICE_STATUS == 4 ? "安全检查记录(系统归档)" : "安全检查记录";
start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
recordLog.logList.Add(start);
}
}
}
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK010_SHOWPRINT";
start1.USER_NAME = "检查人"; start1.USER_NAME = "检查人";
start1.NAME = "安全检查记录"; start1.NAME = "安全检查记录";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1867,6 +1965,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK010_SHOWPRINT";
start1.USER_NAME = "检查人"; start1.USER_NAME = "检查人";
start1.NAME = "安全检查记录"; start1.NAME = "安全检查记录";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1885,30 +1985,56 @@ namespace APT.SK.WebApi.Controllers.Api
//发起 //发起
var temp1 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == safeRecordSumId && !t.NOTICE_TITLE.Contains("确认")); var temp1 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == safeRecordSumId && !t.NOTICE_TITLE.Contains("确认"));
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = safeRecordSumId;
start.CODE = "SK012_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME = "安全检查记录汇总"; start.NAME = "安全检查记录汇总";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
recordSumLog.logList.Add(start); recordSumLog.logList.Add(start);
//确认 //确认
var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == safeRecordSumId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList(); var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == safeRecordSumId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList();
if (temp2 != null && temp2.Any()) if (temp2 != null && temp2.Any())
{ {
foreach (var item in temp2) var temp3 = temp2.Where(t => t.NOTICE_STATUS == 1).OrderBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var item in temp3)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = safeRecordSumId;
start1.CODE = "SK012_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = "安全检查记录汇总确认"; start1.NAME = "安全检查记录汇总确认";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
recordSumLog.logList.Add(start1); recordSumLog.logList.Add(start1);
} }
} }
var temp4 = temp2.Where(t => t.NOTICE_STATUS != 1).OrderByDescending(n => n.NOTICE_STATUS).ThenBy(m => m.MODIFY_TIME).ToList();
if (temp4 != null && temp4.Any())
{
foreach (var item in temp4)
{
OperateLogList start1 = new OperateLogList();
start1.ID = safeRecordSumId;
start1.CODE = "SK012_SHOWPRINT";
start1.USER_NAME = item.USER_NAME;
start1.NAME = "安全检查记录汇总确认";
start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
recordSumLog.logList.Add(start1);
}
}
}
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK012_SHOWPRINT";
start1.USER_NAME = "检查人"; start1.USER_NAME = "检查人";
start1.NAME = "安全检查记录汇总确认"; start1.NAME = "安全检查记录汇总确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1920,6 +2046,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK012_SHOWPRINT";
start.USER_NAME = checkUser != null ? checkUser.NAME : "班长/安全员"; start.USER_NAME = checkUser != null ? checkUser.NAME : "班长/安全员";
start.NAME = "安全检查记录汇总"; start.NAME = "安全检查记录汇总";
start.DEAL_DATE = null; start.DEAL_DATE = null;
@ -1927,6 +2055,8 @@ namespace APT.SK.WebApi.Controllers.Api
start.STATUS = 0; start.STATUS = 0;
recordSumLog.logList.Add(start); recordSumLog.logList.Add(start);
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK012_SHOWPRINT";
start1.USER_NAME = "检查人"; start1.USER_NAME = "检查人";
start1.NAME = "安全检查记录汇总确认"; start1.NAME = "安全检查记录汇总确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1948,16 +2078,20 @@ namespace APT.SK.WebApi.Controllers.Api
if (temp1 != null) if (temp1 != null)
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = dangerReportId;
start.CODE = "SK014_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME = "隐患上报"; start.NAME = "隐患上报";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
hiddenReportLog.logList.Add(start); hiddenReportLog.logList.Add(start);
} }
else else
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK014_SHOWPRINT";
start.USER_NAME = "上报人"; start.USER_NAME = "上报人";
start.NAME = "隐患上报"; start.NAME = "隐患上报";
start.DEAL_DATE = null; start.DEAL_DATE = null;
@ -1982,6 +2116,8 @@ namespace APT.SK.WebApi.Controllers.Api
foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM)) foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM))
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = item.Nav_ApproveRole.NAME; start1.USER_NAME = item.Nav_ApproveRole.NAME;
start1.NAME = "隐患上报审批"; start1.NAME = "隐患上报审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -1993,6 +2129,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = "审批人"; start1.USER_NAME = "审批人";
start1.NAME = "隐患上报审批"; start1.NAME = "隐患上报审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2009,32 +2147,59 @@ namespace APT.SK.WebApi.Controllers.Api
foreach (var item in tempApprove) foreach (var item in tempApprove)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = approveTemp.DATA_ID;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "隐患上报已被驳回" : "隐患上报审批"; start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "隐患上报已被驳回" : "隐患上报审批";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
hiddenReportLog.logList.Add(start1); hiddenReportLog.logList.Add(start1);
} }
} }
} }
var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == dangerReportId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m=>m.MODIFY_TIME).ThenBy(n=>n.CREATE_TIME).ToList(); var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == dangerReportId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList();
if (temp2 != null && temp2.Any()) if (temp2 != null && temp2.Any())
{ {
foreach (var item in temp2) var temp3 = temp2.Where(t => t.NOTICE_STATUS == 1).OrderBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var item in temp3)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = dangerReportId;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = "隐患上报确认"; start1.NAME = "隐患上报确认";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
hiddenReportLog.logList.Add(start1); hiddenReportLog.logList.Add(start1);
} }
} }
var temp4 = temp2.Where(t => t.NOTICE_STATUS != 1).OrderByDescending(n => n.NOTICE_STATUS).ThenBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var item in temp4)
{
OperateLogList start1 = new OperateLogList();
start1.ID = dangerReportId;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = item.USER_NAME;
start1.NAME = "隐患上报确认";
start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
hiddenReportLog.logList.Add(start1);
}
}
}
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = "整改责任人"; start1.USER_NAME = "整改责任人";
start1.NAME = "隐患上报确认"; start1.NAME = "隐患上报确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2046,6 +2211,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK014_SHOWPRINT";
start.USER_NAME = "上报人"; start.USER_NAME = "上报人";
start.NAME = "隐患上报"; start.NAME = "隐患上报";
start.DEAL_DATE = null; start.DEAL_DATE = null;
@ -2053,6 +2220,8 @@ namespace APT.SK.WebApi.Controllers.Api
start.STATUS = 0; start.STATUS = 0;
hiddenReportLog.logList.Add(start); hiddenReportLog.logList.Add(start);
OperateLogList start2 = new OperateLogList(); OperateLogList start2 = new OperateLogList();
start2.ID = null;
start2.CODE = "SK014_SHOWPRINT";
start2.USER_NAME = "审批人"; start2.USER_NAME = "审批人";
start2.NAME = "隐患上报审批"; start2.NAME = "隐患上报审批";
start2.DEAL_DATE = null; start2.DEAL_DATE = null;
@ -2060,6 +2229,8 @@ namespace APT.SK.WebApi.Controllers.Api
start2.STATUS = 0; start2.STATUS = 0;
hiddenReportLog.logList.Add(start2); hiddenReportLog.logList.Add(start2);
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK014_SHOWPRINT";
start1.USER_NAME = "整改责任人"; start1.USER_NAME = "整改责任人";
start1.NAME = "隐患上报确认"; start1.NAME = "隐患上报确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2069,56 +2240,94 @@ namespace APT.SK.WebApi.Controllers.Api
} }
result.Add(hiddenReportLog); result.Add(hiddenReportLog);
#endregion #endregion
}
if (hand != null)
{
var handUser = users.FirstOrDefault(t => t.ID == hand.APPLY_USER_ID);
#region
OperateLog handLog = new OperateLog();
handLog.FORM_NAME = "安全检查记录";
handLog.logList = new List<OperateLogList>();
if (handId != null)
{
OperateLogList start = new OperateLogList();
start.ID = handId;
start.CODE = "SK016_SHOWPRINT";
start.USER_NAME = handUser.NAME;
start.NAME = "手动隐患上报";
start.DEAL_DATE = hand.STATUS == PFStandardStatus.Draft ? null : hand.MODIFY_TIME;
start.CREATE_TIME = check.CREATE_TIME;
start.STATUS = hand.STATUS == PFStandardStatus.Draft ? 16 : 5;
handLog.logList.Add(start);
}
#endregion
#region
#endregion
}
#region #region
if (rectifyNoticeIds != null && rectifyNoticeIds.Any())
{
//发起
var items = tasks.Where(t => t.SOURCE_DATA_ID != null && rectifyNoticeIds.Contains((Guid)t.SOURCE_DATA_ID) && !t.NOTICE_TITLE.Contains("确认")).OrderByDescending(m => m.NOTICE_STATUS = 1).ThenBy(n => n.MODIFY_TIME).ToList();
if (items != null && items.Any())
{
foreach (var temp1 in items)
{
//发起
OperateLog rectifyNoticeLog = new OperateLog(); OperateLog rectifyNoticeLog = new OperateLog();
rectifyNoticeLog.FORM_NAME = "隐患整改通知"; rectifyNoticeLog.FORM_NAME = "隐患整改通知";
rectifyNoticeLog.logList = new List<OperateLogList>(); rectifyNoticeLog.logList = new List<OperateLogList>();
if (rectifyNoticeId != null)
{
//发起
var temp1 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == rectifyNoticeId && !t.NOTICE_TITLE.Contains("确认"));
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = temp1.SOURCE_DATA_ID;
start.CODE = "SK020_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME = "隐患整改通知"; start.NAME = "隐患整改通知";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
rectifyNoticeLog.logList.Add(start); rectifyNoticeLog.logList.Add(start);
var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == rectifyNoticeId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList(); var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == temp1.SOURCE_DATA_ID && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList();
if (temp2 != null && temp2.Any()) if (temp2 != null && temp2.Any())
{ {
foreach (var item in temp2) var temp3 = temp2.Where(t => t.NOTICE_STATUS == 1).OrderBy(m => m.MODIFY_TIME).ToList();
if (temp3 != null && temp3.Any())
{
foreach (var item in temp3)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = temp1.SOURCE_DATA_ID;
start1.CODE = "SK020_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = "隐患整改通知确认"; start1.NAME = "隐患整改通知确认";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
rectifyNoticeLog.logList.Add(start1); rectifyNoticeLog.logList.Add(start1);
} }
} }
var temp4 = temp2.Where(t => t.NOTICE_STATUS != 1).OrderByDescending(m => m.NOTICE_STATUS).ThenBy(n => n.MODIFY_TIME).ToList();
if (temp4 != null && temp4.Any())
{
foreach (var item in temp4)
{
OperateLogList start1 = new OperateLogList();
start1.ID = temp1.SOURCE_DATA_ID;
start1.CODE = "SK020_SHOWPRINT";
start1.USER_NAME = item.USER_NAME;
start1.NAME = "隐患整改通知确认";
start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
rectifyNoticeLog.logList.Add(start1);
}
}
}
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.USER_NAME = "整改责任人"; start1.ID = null;
start1.NAME = "隐患整改通知确认"; start1.CODE = "SK020_SHOWPRINT";
start1.DEAL_DATE = null;
start1.CREATE_TIME = null;
start1.STATUS = 0;
rectifyNoticeLog.logList.Add(start1);
}
}
else {
OperateLogList start = new OperateLogList();
start.USER_NAME = "安全员/上报人";
start.NAME = "隐患整改通知";
start.DEAL_DATE = null;
start.CREATE_TIME = null;
start.STATUS = 0;
rectifyNoticeLog.logList.Add(start);
OperateLogList start1 = new OperateLogList();
start1.USER_NAME = "整改责任人"; start1.USER_NAME = "整改责任人";
start1.NAME = "隐患整改通知确认"; start1.NAME = "隐患整改通知确认";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2127,13 +2336,66 @@ namespace APT.SK.WebApi.Controllers.Api
rectifyNoticeLog.logList.Add(start1); rectifyNoticeLog.logList.Add(start1);
} }
result.Add(rectifyNoticeLog); result.Add(rectifyNoticeLog);
}
}
else
{
OperateLog rectifyNoticeLog = new OperateLog();
rectifyNoticeLog.FORM_NAME = "隐患整改通知";
rectifyNoticeLog.logList = new List<OperateLogList>();
OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK020_SHOWPRINT";
start.USER_NAME = "安全员/上报人";
start.NAME = "隐患整改通知";
start.DEAL_DATE = null;
start.CREATE_TIME = null;
start.STATUS = 0;
rectifyNoticeLog.logList.Add(start);
OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK020_SHOWPRINT";
start1.USER_NAME = "整改责任人";
start1.NAME = "隐患整改通知确认";
start1.DEAL_DATE = null;
start1.CREATE_TIME = null;
start1.STATUS = 0;
rectifyNoticeLog.logList.Add(start1);
result.Add(rectifyNoticeLog);
}
}
else
{
OperateLog rectifyNoticeLog = new OperateLog();
rectifyNoticeLog.FORM_NAME = "隐患整改通知";
rectifyNoticeLog.logList = new List<OperateLogList>();
OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK020_SHOWPRINT";
start.USER_NAME = "安全员/上报人";
start.NAME = "隐患整改通知";
start.DEAL_DATE = null;
start.CREATE_TIME = null;
start.STATUS = 0;
rectifyNoticeLog.logList.Add(start);
OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK020_SHOWPRINT";
start1.USER_NAME = "整改责任人";
start1.NAME = "隐患整改通知确认";
start1.DEAL_DATE = null;
start1.CREATE_TIME = null;
start1.STATUS = 0;
rectifyNoticeLog.logList.Add(start1);
result.Add(rectifyNoticeLog);
}
#endregion #endregion
#region #region
if (rectifyRecordIds != null && rectifyRecordIds.Any()) if (rectifyRecordIds != null && rectifyRecordIds.Any())
{ {
//发起 //发起
var items = tasks.Where(t =>t.SOURCE_DATA_ID!=null && rectifyRecordIds.Contains((Guid)t.SOURCE_DATA_ID) && !t.NOTICE_TITLE.Contains("确认") && !t.NOTICE_TITLE.Contains("验收")).OrderBy(m=>m.MODIFY_TIME).ThenBy(n=>n.CREATE_TIME).ToList(); var items = tasks.Where(t => t.SOURCE_DATA_ID != null && rectifyRecordIds.Contains((Guid)t.SOURCE_DATA_ID) && !t.NOTICE_TITLE.Contains("确认") && !t.NOTICE_TITLE.Contains("验收")).OrderByDescending(m => m.NOTICE_STATUS = 1).ThenBy(n => n.MODIFY_TIME).ToList();
if (items != null && items.Any()) if (items != null && items.Any())
{ {
foreach (var temp1 in items) foreach (var temp1 in items)
@ -2142,27 +2404,33 @@ namespace APT.SK.WebApi.Controllers.Api
refRecordLog.FORM_NAME = "隐患整改记录"; refRecordLog.FORM_NAME = "隐患整改记录";
refRecordLog.logList = new List<OperateLogList>(); refRecordLog.logList = new List<OperateLogList>();
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = temp1.SOURCE_DATA_ID;
start.CODE = "SK022_SHOWPRINT";
start.USER_NAME = temp1.USER_NAME; start.USER_NAME = temp1.USER_NAME;
start.NAME = "隐患整改记录"; start.NAME = "隐患整改记录";
start.DEAL_DATE = temp1.TASK_DT; start.DEAL_DATE = temp1.TASK_DT;
start.CREATE_TIME = temp1.CREATE_TIME; start.CREATE_TIME = temp1.CREATE_TIME;
start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : 0; start.STATUS = temp1.NOTICE_STATUS == 1 ? 5 : temp1.NOTICE_STATUS == 2 ? 10 : temp1.NOTICE_STATUS == 4 ? 15 : (temp1.NOTICE_STATUS == 0 && temp1.TASK_ENDDT >= DateTime.Now) ? 16 : (temp1.TASK_ENDDT < DateTime.Now && temp1.NOTICE_STATUS == 0) ? 20 : 0;
refRecordLog.logList.Add(start); refRecordLog.logList.Add(start);
//验收 //验收
var temp2 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID!=null && t.SOURCE_DATA_ID == temp1.SOURCE_DATA_ID && t.NOTICE_TITLE.Contains("验收")); var temp2 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID != null && t.SOURCE_DATA_ID == temp1.SOURCE_DATA_ID && t.NOTICE_TITLE.Contains("验收"));
if (temp2 != null) if (temp2 != null)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = temp1.SOURCE_DATA_ID;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = temp2.USER_NAME; start1.USER_NAME = temp2.USER_NAME;
start1.NAME = "隐患整改记录验收"; start1.NAME = "隐患整改记录验收";
start1.DEAL_DATE = temp2.TASK_DT; start1.DEAL_DATE = temp2.TASK_DT;
start1.CREATE_TIME = temp2.CREATE_TIME; start1.CREATE_TIME = temp2.CREATE_TIME;
start1.STATUS = temp2.NOTICE_STATUS == 1 ? 5 : temp2.NOTICE_STATUS == 2 ? 10 : temp2.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = temp2.NOTICE_STATUS == 1 ? 5 : temp2.NOTICE_STATUS == 2 ? 10 : temp2.NOTICE_STATUS == 4 ? 15 : (temp2.NOTICE_STATUS == 0 && temp2.TASK_ENDDT >= DateTime.Now) ? 16 : (temp2.TASK_ENDDT < DateTime.Now && temp2.NOTICE_STATUS == 0) ? 20 : 0;
refRecordLog.logList.Add(start1); refRecordLog.logList.Add(start1);
} }
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = "验收人"; start1.USER_NAME = "验收人";
start1.NAME = "隐患整改记录验收"; start1.NAME = "隐患整改记录验收";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2183,6 +2451,8 @@ namespace APT.SK.WebApi.Controllers.Api
foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM)) foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM))
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = item.Nav_ApproveRole.NAME; start1.USER_NAME = item.Nav_ApproveRole.NAME;
start1.NAME = "隐患整改记录审批"; start1.NAME = "隐患整改记录审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2194,6 +2464,8 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = "审批人"; start1.USER_NAME = "审批人";
start1.NAME = "隐患整改记录审批"; start1.NAME = "隐患整改记录审批";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2210,11 +2482,13 @@ namespace APT.SK.WebApi.Controllers.Api
foreach (var item in tempApprove) foreach (var item in tempApprove)
{ {
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = approveTemp.DATA_ID;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = item.USER_NAME; start1.USER_NAME = item.USER_NAME;
start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "隐患整改记录已被驳回" : "隐患整改记录审批"; start1.NAME = item.NOTICE_TITLE.Contains("驳回") ? "隐患整改记录已被驳回" : "隐患整改记录审批";
start1.DEAL_DATE = item.TASK_DT; start1.DEAL_DATE = item.TASK_DT;
start1.CREATE_TIME = item.CREATE_TIME; start1.CREATE_TIME = item.CREATE_TIME;
start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : 0; start1.STATUS = item.NOTICE_STATUS == 1 ? 5 : item.NOTICE_STATUS == 2 ? 10 : item.NOTICE_STATUS == 4 ? 15 : (item.NOTICE_STATUS == 0 && item.TASK_ENDDT >= DateTime.Now) ? 16 : (item.TASK_ENDDT < DateTime.Now && item.NOTICE_STATUS == 0) ? 20 : 0;
refRecordLog.logList.Add(start1); refRecordLog.logList.Add(start1);
} }
} }
@ -2225,9 +2499,11 @@ namespace APT.SK.WebApi.Controllers.Api
else else
{ {
OperateLog refRecordLog = new OperateLog(); OperateLog refRecordLog = new OperateLog();
refRecordLog.FORM_NAME = "隐患整改记录"; refRecordLog.FORM_NAME = "隐患整改通知";
refRecordLog.logList = new List<OperateLogList>(); refRecordLog.logList = new List<OperateLogList>();
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK022_SHOWPRINT";
start.USER_NAME = "整改落实人"; start.USER_NAME = "整改落实人";
start.NAME = "隐患整改记录"; start.NAME = "隐患整改记录";
start.DEAL_DATE = null; start.DEAL_DATE = null;
@ -2235,6 +2511,8 @@ namespace APT.SK.WebApi.Controllers.Api
start.STATUS = 0; start.STATUS = 0;
refRecordLog.logList.Add(start); refRecordLog.logList.Add(start);
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = "验收人"; start1.USER_NAME = "验收人";
start1.NAME = "隐患整改记录验收"; start1.NAME = "隐患整改记录验收";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2242,6 +2520,8 @@ namespace APT.SK.WebApi.Controllers.Api
start1.STATUS = 0; start1.STATUS = 0;
refRecordLog.logList.Add(start1); refRecordLog.logList.Add(start1);
OperateLogList start2 = new OperateLogList(); OperateLogList start2 = new OperateLogList();
start2.ID = null;
start2.CODE = "SK022_SHOWPRINT";
start2.USER_NAME = "审批人"; start2.USER_NAME = "审批人";
start2.NAME = "隐患整改记录审批"; start2.NAME = "隐患整改记录审批";
start2.DEAL_DATE = null; start2.DEAL_DATE = null;
@ -2257,6 +2537,8 @@ namespace APT.SK.WebApi.Controllers.Api
refRecordLog.FORM_NAME = "隐患整改记录"; refRecordLog.FORM_NAME = "隐患整改记录";
refRecordLog.logList = new List<OperateLogList>(); refRecordLog.logList = new List<OperateLogList>();
OperateLogList start = new OperateLogList(); OperateLogList start = new OperateLogList();
start.ID = null;
start.CODE = "SK022_SHOWPRINT";
start.USER_NAME = "整改落实人"; start.USER_NAME = "整改落实人";
start.NAME = "隐患整改记录"; start.NAME = "隐患整改记录";
start.DEAL_DATE = null; start.DEAL_DATE = null;
@ -2264,6 +2546,8 @@ namespace APT.SK.WebApi.Controllers.Api
start.STATUS = 0; start.STATUS = 0;
refRecordLog.logList.Add(start); refRecordLog.logList.Add(start);
OperateLogList start1 = new OperateLogList(); OperateLogList start1 = new OperateLogList();
start1.ID = null;
start1.CODE = "SK022_SHOWPRINT";
start1.USER_NAME = "验收人"; start1.USER_NAME = "验收人";
start1.NAME = "隐患整改记录验收"; start1.NAME = "隐患整改记录验收";
start1.DEAL_DATE = null; start1.DEAL_DATE = null;
@ -2271,6 +2555,8 @@ namespace APT.SK.WebApi.Controllers.Api
start1.STATUS = 0; start1.STATUS = 0;
refRecordLog.logList.Add(start1); refRecordLog.logList.Add(start1);
OperateLogList start2 = new OperateLogList(); OperateLogList start2 = new OperateLogList();
start2.ID = null;
start2.CODE = "SK022_SHOWPRINT";
start2.USER_NAME = "审批人"; start2.USER_NAME = "审批人";
start2.NAME = "隐患整改记录审批"; start2.NAME = "隐患整改记录审批";
start2.DEAL_DATE = null; start2.DEAL_DATE = null;
@ -2281,9 +2567,5 @@ namespace APT.SK.WebApi.Controllers.Api
} }
#endregion #endregion
} }
return result;
}
});
}
} }
} }