From 1391ccb4b72474afeb7a2d77dc707468843a3a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=BE=8E=E8=8D=A3?= <10755671+mei-rong-he@user.noreply.gitee.com> Date: Thu, 20 Nov 2025 22:20:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E9=9A=90=E6=82=A3=E4=B8=8A?= =?UTF-8?q?=E6=8A=A5=E5=8F=AF=E8=A7=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Api/SKController.cs | 10 +- .../Api/SecurityInspectionNoticeController.cs | 207 +++++++++++++++--- 2 files changed, 182 insertions(+), 35 deletions(-) diff --git a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs index 8df74e4..2232bec 100644 --- a/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs +++ b/APT.MicroApi/APT.PP.WebApi/Controllers/Api/SKController.cs @@ -594,7 +594,7 @@ namespace APT.PP.WebApi.Controllers.Api baseFilter.SelectField = new string[] { "ID", "PRODUCTION_UNIT_ID", "CHECK_TYPE_ID","APPLY_DEPARTMENT_ID","APPLY_USER_ID","PLANCHECKFREQUENCY","DEPARTMENT_TYPE","CHECK_TIME","CHECK_PERSON", "Nav_CheckNoticeDetails.RISK_AREA_ID","Nav_CheckNoticeDetails.CHECK_CONTENTS_ID","Nav_CheckNoticeDetails.CHECKCONTENT","Nav_CheckNoticeDetails.CHECKPROOF","Nav_CheckNoticeDetails.CHECKSTANDARD", "Nav_CheckNoticeFiles.IMG_FILE_ID", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailUsers.USER_ID", "Nav_CheckNoticeDetails.Nav_CheckNoticeDetailBasics.LAW_ID" }; //指定字段,包括导航属性 - Expression> expression = i => i.IS_DELETED == false && i.CHECK_TIME != null && i.CHECK_TIME.Value.Date == DateTime.Now.Date && i.CHECK_TIME.Value.Hour == dtNow.Hour && i.STATUS != 0; + Expression> expression = i => i.IS_DELETED == false && i.CHECK_TIME != null && i.CHECK_TIME.Value.Date == DateTime.Now.Date && i.CHECK_TIME.Value.Hour == dtNow.Hour && i.STATUS == PFStandardStatus.Archived; List notices = this.GetOrderEntities(expression, baseFilter).ToList(); var noticeExsisIds = notices.Select(t => t.ID).ToList(); baseFilter.SelectField = new string[] { "ID", "SECURITY_INSPECTION_NOTICE_ID" }; //指定字段,包括导航属性 @@ -720,13 +720,13 @@ namespace APT.PP.WebApi.Controllers.Api m.Nav_CheckNoticeDetails = null; m.Nav_CheckNoticeFiles = null; }); - notices.Where(t => sourceIds.Contains(t.ID)).ForEach(m => m.STATUS = PFStandardStatus.Close); - notices.Where(t => !sourceIds.Contains(t.ID)).ForEach(m => m.STATUS = PFStandardStatus.Archived); + //notices.Where(t => sourceIds.Contains(t.ID)).ForEach(m => m.STATUS = PFStandardStatus.Close); + //notices.Where(t => !sourceIds.Contains(t.ID)).ForEach(m => m.STATUS = PFStandardStatus.Archived); } UnifiedCommit(() => { - if (notices != null && notices.Any()) - BantchSaveEntityNoCommit(notices); + //if (notices != null && notices.Any()) + // BantchSaveEntityNoCommit(notices); if (tasks != null && tasks.Any()) BantchSaveEntityNoCommit(tasks); if (noticeTasks != null && noticeTasks.Any()) diff --git a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs index cc26c09..d09d40f 100644 --- a/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs +++ b/APT.MicroApi/APT.SK.WebApi/Controllers/Api/SecurityInspectionNoticeController.cs @@ -1671,6 +1671,7 @@ namespace APT.SK.WebApi.Controllers.Api var sourceIds = new List(); T_SK_HIDDEN_DANGER_REPORT dangerReport = null; T_SK_HIDDEN_DANGER_HAND_REPORT hand = null; + T_SK_HIDDEN_DANGER_CONFIRM confirm= null; List rectifyRecords = new List(); Guid Keyword = new Guid(filter.Keyword); //检查通知 @@ -1685,7 +1686,7 @@ namespace APT.SK.WebApi.Controllers.Api { handId = hand.ID; sourceIds.Add(hand.ID); - var confirm = GetEntity(e => e.HIDDEN_DANGER_HAND_REPORT_ID != null && e.HIDDEN_DANGER_HAND_REPORT_ID == hand.ID); + confirm = GetEntity(e => e.HIDDEN_DANGER_HAND_REPORT_ID != null && e.HIDDEN_DANGER_HAND_REPORT_ID == hand.ID); if (confirm != null) { confirmId = confirm.ID; @@ -1705,7 +1706,7 @@ namespace APT.SK.WebApi.Controllers.Api sourceIds.AddRange(rectifyRecordIds); } } - GetAutoNext(sourceIds, check, safeNoticeId, hand, handId, confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result); + GetAutoNext(sourceIds, check, safeNoticeId, hand, handId,confirm, confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result); } } else @@ -1740,13 +1741,13 @@ namespace APT.SK.WebApi.Controllers.Api } } } - GetAutoNext(sourceIds,check, safeNoticeId,hand, handId, confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result); + GetAutoNext(sourceIds,check, safeNoticeId,hand, handId, confirm,confirmId, safeRecordIds, safeRecordSumId, dangerReportId, dangerReport, rectifyNoticeIds, rectifyRecordIds, rectifyRecords, ref result); } return result; } }); } - private void GetAutoNext(List sourceIds, T_SK_SECURITY_INSPECTION_NOTICE check, Guid? safeNoticeId, T_SK_HIDDEN_DANGER_HAND_REPORT hand,Guid? handId, Guid? confirmId, List safeRecordIds, Guid? safeRecordSumId, Guid? dangerReportId, T_SK_HIDDEN_DANGER_REPORT dangerReport, List rectifyNoticeIds, List rectifyRecordIds, List rectifyRecords, ref List result) + private void GetAutoNext(List sourceIds, T_SK_SECURITY_INSPECTION_NOTICE check, Guid? safeNoticeId, T_SK_HIDDEN_DANGER_HAND_REPORT hand,Guid? handId, T_SK_HIDDEN_DANGER_CONFIRM confirm,Guid? confirmId, List safeRecordIds, Guid? safeRecordSumId, Guid? dangerReportId, T_SK_HIDDEN_DANGER_REPORT dangerReport, List rectifyNoticeIds, List rectifyRecordIds, List rectifyRecords, ref List result) { var approveIds = new List(); var approves = new List(); @@ -1777,7 +1778,7 @@ namespace APT.SK.WebApi.Controllers.Api start.ID = safeNoticeId; start.CODE = "SK006_SHOWPRINT"; start.USER_NAME = temp1.USER_NAME; - start.NAME = temp1.NOTICE_STATUS == 4 ? "安全检查通知(系统归档)" : "安全检查通知"; + start.NAME = "安全检查通知"; 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; @@ -1790,7 +1791,7 @@ namespace APT.SK.WebApi.Controllers.Api start.ID = check.ID; start.CODE = "SK006_SHOWPRINT"; start.USER_NAME = checkUser.NAME; - start.NAME = check.STATUS == PFStandardStatus.Close ? "安全检查通知(系统归档)" : "安全检查通知"; + start.NAME = "安全检查通知"; start.DEAL_DATE = check.STATUS == PFStandardStatus.Draft ? null : check.MODIFY_TIME; start.CREATE_TIME = check.CREATE_TIME; start.STATUS = check.STATUS == PFStandardStatus.Close ? 15 : check.STATUS == PFStandardStatus.Draft ? 0 : 5; @@ -1868,7 +1869,7 @@ namespace APT.SK.WebApi.Controllers.Api start1.CODE = "SK006_SHOWPRINT"; start1.USER_NAME = item.USER_NAME; start1.NAME = "安全检查通知确认"; - start1.DEAL_DATE = item.TASK_DT; + start1.DEAL_DATE = item.NOTICE_STATUS == 4 ? item.MODIFY_TIME : 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); @@ -1884,7 +1885,7 @@ namespace APT.SK.WebApi.Controllers.Api start1.CODE = "SK006_SHOWPRINT"; start1.USER_NAME = item.USER_NAME; start1.NAME = "安全检查通知确认"; - start1.DEAL_DATE = item.TASK_DT; + start1.DEAL_DATE = item.NOTICE_STATUS == 4 ? item.MODIFY_TIME : 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); @@ -1925,8 +1926,8 @@ namespace APT.SK.WebApi.Controllers.Api 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.NAME = "安全检查记录"; + start.DEAL_DATE = temp1.NOTICE_STATUS == 4 ? temp1.MODIFY_TIME : 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); @@ -1941,8 +1942,8 @@ namespace APT.SK.WebApi.Controllers.Api 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.NAME = "安全检查记录"; + start.DEAL_DATE = temp1.NOTICE_STATUS == 4 ? temp1.MODIFY_TIME : 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); @@ -2103,12 +2104,12 @@ namespace APT.SK.WebApi.Controllers.Api var approveTemp = approves.FirstOrDefault(t => t.DATA_ID == dangerReportId); if (approveTemp == null) { - //判断发起人层级,取审批模板 - var departFirst = departs.FirstOrDefault(t => t.ID == dangerReport.APPLY_DEPARTMENT_ID); - var param = Enum.GetName(typeof(SKDepartmentTypeEnum), departFirst.DEPARTMENT_TYPE); - if (departFirst.DEPARTMENT_STATUS != 1) + //判断重大还是一般,取审批模板 + var detailFirst =this.GetEntity(t=>t.HIDDEN_DANGER_REPORT_ID == dangerReportId && t.HIDDEN_LEVEL == SKHiddenLevel.Major); + var param = "一般"; + if (detailFirst != null) { - param = "公司级"; + param = "重大"; } var approveTempFirst = approveTemps.FirstOrDefault(t => t.PARAM == param && t.FORM_CODE == "SK014"); if (approveTempFirst != null && approveTempFirst.Nav_ApproveTempDetails != null && approveTempFirst.Nav_ApproveTempDetails.Any()) @@ -2246,22 +2247,168 @@ namespace APT.SK.WebApi.Controllers.Api var handUser = users.FirstOrDefault(t => t.ID == hand.APPLY_USER_ID); #region 手动隐患上报 OperateLog handLog = new OperateLog(); - handLog.FORM_NAME = "安全检查记录"; + handLog.FORM_NAME = "手动隐患上报"; handLog.logList = new List(); - 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); - } + 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 隐患确认单 + OperateLog confirmLog = new OperateLog(); + confirmLog.FORM_NAME = "隐患确认单"; + confirmLog.logList = new List(); + if (confirmId != null) + { + var temp1 = tasks.FirstOrDefault(t => t.SOURCE_DATA_ID == confirmId && !t.NOTICE_TITLE.Contains("确认")); + OperateLogList start1 = new OperateLogList(); + start1.ID = confirmId; + start1.CODE = "SK018_SHOWPRINT"; + start1.USER_NAME = temp1.USER_NAME; + start1.NAME = "隐患确认单"; + start1.DEAL_DATE = temp1.TASK_DT; + start1.CREATE_TIME = temp1.CREATE_TIME; + start1.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; + confirmLog.logList.Add(start1); + //审批 + var approveTemp = approves.FirstOrDefault(t => t.DATA_ID == confirmId); + if (approveTemp == null) + { + //判断发起人层级,取审批模板 + var param = confirm.HIDDEN_LEVEL.GetDescription(); + var approveTempFirst = approveTemps.FirstOrDefault(t => t.PARAM == param && t.FORM_CODE == "SK014"); + if (approveTempFirst != null && approveTempFirst.Nav_ApproveTempDetails != null && approveTempFirst.Nav_ApproveTempDetails.Any()) + { + foreach (var item in approveTempFirst.Nav_ApproveTempDetails.OrderBy(t => t.NUM)) + { + OperateLogList start2 = new OperateLogList(); + start2.ID = null; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = item.Nav_ApproveRole.NAME; + start2.NAME = "隐患确认单审批"; + start2.DEAL_DATE = null; + start2.CREATE_TIME = null; + start2.STATUS = 0; + confirmLog.logList.Add(start2); + } + } + else + { + OperateLogList start2 = new OperateLogList(); + start2.ID = null; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = "审批人"; + start2.NAME = "隐患确认单审批"; + start2.DEAL_DATE = null; + start2.CREATE_TIME = null; + start2.STATUS = 0; + confirmLog.logList.Add(start2); + } + } + else + { + 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()) + { + foreach (var item in tempApprove) + { + OperateLogList start2 = new OperateLogList(); + start2.ID = approveTemp.DATA_ID; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = item.USER_NAME; + start2.NAME = item.NOTICE_TITLE.Contains("驳回") ? "隐患确认单已被驳回" : "隐患确认单审批"; + start2.DEAL_DATE = item.TASK_DT; + start2.CREATE_TIME = item.CREATE_TIME; + start2.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; + confirmLog.logList.Add(start2); + } + } + } + var temp2 = tasks.Where(t => t.SOURCE_DATA_ID == confirmId && t.NOTICE_TITLE.Contains("确认")).OrderBy(m => m.MODIFY_TIME).ThenBy(n => n.CREATE_TIME).ToList(); + if (temp2 != null && temp2.Any()) + { + 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 start2 = new OperateLogList(); + start2.ID = confirmId; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = item.USER_NAME; + start2.NAME = "隐患确认单确认"; + start2.DEAL_DATE = item.TASK_DT; + start2.CREATE_TIME = item.CREATE_TIME; + start2.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; + confirmLog.logList.Add(start2); + } + } + + 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 start2 = new OperateLogList(); + start2.ID = confirmId; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = item.USER_NAME; + start2.NAME = "隐患确认单确认"; + start2.DEAL_DATE = item.TASK_DT; + start2.CREATE_TIME = item.CREATE_TIME; + start2.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; + confirmLog.logList.Add(start2); + } + } + } + else + { + OperateLogList start2 = new OperateLogList(); + start2.ID = null; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = "整改责任人"; + start2.NAME = "隐患确认单确认"; + start2.DEAL_DATE = null; + start2.CREATE_TIME = null; + start2.STATUS = 0; + confirmLog.logList.Add(start2); + } + } + else + { + OperateLogList start1 = new OperateLogList(); + start1.ID = null; + start1.CODE = "SK018_SHOWPRINT"; + start1.USER_NAME = "班长/上报人"; + start1.NAME = "隐患确认单"; + start1.DEAL_DATE = null; + start1.CREATE_TIME = null; + start1.STATUS = 0; + confirmLog.logList.Add(start1); + OperateLogList start2 = new OperateLogList(); + start2.ID = null; + start2.CODE = "SK018_SHOWPRINT"; + start2.USER_NAME = "审批人"; + start2.NAME = "隐患确认单审批"; + start2.DEAL_DATE = null; + start2.CREATE_TIME = null; + start2.STATUS = 0; + confirmLog.logList.Add(start2); + OperateLogList start3 = new OperateLogList(); + start3.ID = null; + start3.CODE = "SK018_SHOWPRINT"; + start3.USER_NAME = "整改责任人"; + start3.NAME = "隐患确认单确认"; + start3.DEAL_DATE = null; + start3.CREATE_TIME = null; + start3.STATUS = 0; + confirmLog.logList.Add(start3); + } #endregion } #region 隐患整改通知