Merge branch 'main' of http://47.122.43.22:3000/wjn/mh_sms
This commit is contained in:
		
						commit
						1d25c12911
					
				@ -5679,6 +5679,16 @@ namespace APT.BaseData.Services.DomainServices
 | 
			
		||||
                                listLog = GetUpdateDeal(OPERATEPOINT_Enums.RiskSendAudit, RISK_SUBMIT_ID.Value, APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value, listContentID, taskFinish.TASK_ENDDT);
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "BS/BSRiskSubmit/DealEndNew"://整改记录
 | 
			
		||||
 | 
			
		||||
                            var contentDeal = GetEntity<T_BS_RISK_SUBMIT_CONTENT_DEAL>(modelApp.DATA_ID);
 | 
			
		||||
                            if (contentDeal != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                var modelLog = GetUpdateDeal(OPERATEPOINT_Enums.RiskDealAudit, contentDeal.RISK_SUBMIT_ID.Value, APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value, contentDeal.RISK_SUBMIT_CONTENT_ID, taskFinish.TASK_ENDDT);
 | 
			
		||||
                                if (modelLog != null)
 | 
			
		||||
                                    listLog = new List<T_BS_OPERATE_LOG>() { modelLog };
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        default:
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
@ -5694,6 +5704,8 @@ namespace APT.BaseData.Services.DomainServices
 | 
			
		||||
                            UpdateEntityNoCommit(taskFinish);
 | 
			
		||||
                        if (listTaskNext != null && listTaskNext.Count > 0)//下一个节点
 | 
			
		||||
                            BantchSaveEntityNoCommit(listTaskNext);
 | 
			
		||||
                        if (listLog != null && listLog.Any())//本节点操作记录
 | 
			
		||||
                            BantchSaveEntityNoCommit(listLog);
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
 | 
			
		||||
@ -8596,6 +8596,83 @@ namespace APT.BS.WebApi.Controllers.Api
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 检查任务取消
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="filter"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        [HttpPost, Route("Cancel")]
 | 
			
		||||
        public JsonActionResult<bool> Cancel([FromBody] KeywordFilter filter)
 | 
			
		||||
        {
 | 
			
		||||
            return SafeExecute<bool>(() =>
 | 
			
		||||
            {
 | 
			
		||||
                //后台配置自定义按钮事件 keyWord就是对应的id
 | 
			
		||||
                //只能取消自己的单子
 | 
			
		||||
                Guid CheckID = Guid.Empty;
 | 
			
		||||
                Guid TaskID = Guid.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(filter.Keyword))
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        CheckID = new Guid(filter.Keyword);
 | 
			
		||||
                        if (!string.IsNullOrEmpty(filter.Parameter1))
 | 
			
		||||
                        {
 | 
			
		||||
                            TaskID = new Guid(filter.Parameter1);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    catch { }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (CheckID == Guid.Empty)
 | 
			
		||||
                    throw new Exception("获取信息失败,请重试!");
 | 
			
		||||
 | 
			
		||||
                var Check = GetEntity<T_BS_SAFE_CHECK>(CheckID);
 | 
			
		||||
                if (Check == null)
 | 
			
		||||
                    throw new Exception("未获取到检查单,操作失败!");
 | 
			
		||||
 | 
			
		||||
                Check.ENABLE_STATUS = 1;
 | 
			
		||||
                Check.MODIFIER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
			
		||||
                Check.MODIFY_TIME = DateTime.Now;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                T_FM_NOTIFICATION_TASK task = null;
 | 
			
		||||
                MS.Domain.Entities.SC.BI.T_BI_NOTIFICATION_TASK_NEW taskBI = null;
 | 
			
		||||
                if (TaskID != Guid.Empty)
 | 
			
		||||
                {
 | 
			
		||||
                    task = NotificationTaskService.GetEntityTask(TaskID, "BS032_SHOWPRINT");
 | 
			
		||||
                    if (task != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        task.ISCANCEL = true;
 | 
			
		||||
                        task.MODIFIER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
 | 
			
		||||
                        task.MODIFY_TIME = DateTime.Now;
 | 
			
		||||
                    }
 | 
			
		||||
                    taskBI = GetEntity<MS.Domain.Entities.SC.BI.T_BI_NOTIFICATION_TASK_NEW>(e => e.SOURCE_DATA_ID == CheckID && e.NOTICE_STATUS == 0 && e.SOURCE_FORMCODE == "BS032");
 | 
			
		||||
                    if (taskBI != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        taskBI.MODIFIER_ID = task.MODIFIER_ID;
 | 
			
		||||
                        taskBI.MODIFY_TIME = task.MODIFY_TIME;
 | 
			
		||||
                        taskBI.TASK_DT = task.TASK_DT;
 | 
			
		||||
                        taskBI.NOTICE_STATUS = task.NOTICE_STATUS;
 | 
			
		||||
                        taskBI.IS_DELETED = true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                UnifiedCommit(() =>
 | 
			
		||||
                {
 | 
			
		||||
                    if (Check != null)
 | 
			
		||||
                        UpdateEntityNoCommit(Check);
 | 
			
		||||
                    if (task != null)
 | 
			
		||||
                        UpdateEntityNoCommit(task);
 | 
			
		||||
                    if (taskBI != null)
 | 
			
		||||
                        UpdateEntityNoCommit(taskBI);
 | 
			
		||||
                });
 | 
			
		||||
                return true;
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,7 @@
 | 
			
		||||
    using APT.BaseData.Services.DomainServices;
 | 
			
		||||
    using APT.BaseData.Services.Services.FM;
 | 
			
		||||
    using APT.BaseData.Services.Sys;
 | 
			
		||||
    using APT.MS.Domain.Entities.FO;
 | 
			
		||||
 | 
			
		||||
    [Route("api/PF/PFApprove")]
 | 
			
		||||
    public partial class ApproveController : AuthorizeApiController<T_PF_APPROVE>
 | 
			
		||||
@ -219,6 +220,16 @@
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        if (ret == "FO/FOCrucialLicenseJob/BackUpdate")
 | 
			
		||||
                        {
 | 
			
		||||
                            BackUpdate_FOJobCrucialLicense(dbApprove.DATA_ID.ToString(), () => JobChangeApproveStatus(dbApprove, task));
 | 
			
		||||
                            return "";
 | 
			
		||||
                        }
 | 
			
		||||
                        if (ret == "FO/FOJobEventRecord/BackUpdate")
 | 
			
		||||
                        {
 | 
			
		||||
                            BackUpdate_FOJobEventRecord(dbApprove.DATA_ID.ToString(), () => JobChangeApproveStatus(dbApprove, task));
 | 
			
		||||
                            return "";
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
@ -418,7 +429,19 @@
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private void JobChangeApproveStatus(T_PF_APPROVE dbApprove, T_FM_NOTIFICATION_TASK task)//, Type dbTypeEnd = null, MethodInfo methodInfoEnd = null
 | 
			
		||||
        {
 | 
			
		||||
            var details = dbApprove.Nav_ApproveDetails;
 | 
			
		||||
            dbApprove.Nav_ApproveDetails = null;
 | 
			
		||||
            details.ForEach(i => i.Nav_Approve = null);
 | 
			
		||||
            if (task != null)
 | 
			
		||||
                this.UpdateEntityNoCommit(task);
 | 
			
		||||
            this.UpdateEntityNoCommit(dbApprove);
 | 
			
		||||
            this.BantchUpdateEntityNoCommit(details);
 | 
			
		||||
            //if (methodInfoEnd != null)
 | 
			
		||||
            //    methodInfoEnd.MakeGenericMethod(new Type[] { dbTypeEnd }).Invoke(this, new object[] { dbApprove.DATA_ID.ToString() });
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        private void ChangeApproveStatus(T_PF_APPROVE dbApprove, T_FM_NOTIFICATION_TASK task)//, Type dbTypeEnd = null, MethodInfo methodInfoEnd = null
 | 
			
		||||
        {
 | 
			
		||||
            var details = dbApprove.Nav_ApproveDetails;
 | 
			
		||||
@ -927,5 +950,119 @@
 | 
			
		||||
            });
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 工作票回调函数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="id"></param>
 | 
			
		||||
        /// <returns></returns> 
 | 
			
		||||
        private bool BackUpdate_FOJobCrucialLicense(string id, Action action)
 | 
			
		||||
        {
 | 
			
		||||
            //var entity = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(id, false, "Nav_OperationStep", "Nav_ApplyUser", "Nav_CrucialLicensePerson");
 | 
			
		||||
            var entity = this.GetEntity<T_FO_CRUCIAL_LICENSE_JOB>(id, new string[] { "Nav_OperationStep", "Nav_ApplyUser", "Nav_CrucialLicensePerson" });// wyw 
 | 
			
		||||
            entity.IS_PUBLISH = (int)FOPreMeetingStatusEnum.签到中;
 | 
			
		||||
            //触发技术交底表
 | 
			
		||||
            var tech = new T_FO_TECH_DISCLOSURE_FROM();
 | 
			
		||||
            var techUsers = new List<T_FO_TECH_DISCLOSURE_PERSON>();
 | 
			
		||||
            var notices = new List<T_FM_NOTIFICATION_TASK>();
 | 
			
		||||
            var techForm = this.GetEntity<T_FO_TECH_DISCLOSURE_FROM>(t => t.JOB_NAME_ID == entity.ID);
 | 
			
		||||
            if (techForm == null)
 | 
			
		||||
            {
 | 
			
		||||
                //取审批流水码
 | 
			
		||||
                var sysFilter = new SystemCodeFilter();
 | 
			
		||||
                sysFilter.CodeType = (int)PFCodeRuleType.技术交底表编号;
 | 
			
		||||
                sysFilter.Count = 1;
 | 
			
		||||
                sysFilter.OrgId = entity.ORG_ID;
 | 
			
		||||
                var codes = CodeRuleService.NewGenSerial(sysFilter);
 | 
			
		||||
                var codeList = codes.Split(new char[] { ',' });
 | 
			
		||||
                //主表
 | 
			
		||||
                tech.CODE = codeList[0];
 | 
			
		||||
                tech.ORG_ID = entity.ORG_ID;
 | 
			
		||||
                tech.OPERATION_STEP_ID = entity.OPERATION_STEP_ID;
 | 
			
		||||
                tech.JOB_NAME_ID = entity.ID;
 | 
			
		||||
                tech.JOB_LOCATION = entity.JOB_LOCATION;
 | 
			
		||||
                tech.DISCLOSURE_PERSON_ID = entity.APPLY_USER_ID;
 | 
			
		||||
                tech.IS_AUTO = (int)ISImportantEnum.是;
 | 
			
		||||
                tech.IS_OUTSOURCE = false;
 | 
			
		||||
                tech.RELATED_ID = null;
 | 
			
		||||
                if (entity.MONITOR_USER_ID != null)
 | 
			
		||||
                {
 | 
			
		||||
                    T_FO_TECH_DISCLOSURE_PERSON person = new T_FO_TECH_DISCLOSURE_PERSON();
 | 
			
		||||
                    person.ORG_ID = entity.ORG_ID;
 | 
			
		||||
                    person.USER_ID = entity.MONITOR_USER_ID;
 | 
			
		||||
                    person.TECH_DISCLOSURE_FROM_ID = tech.ID;
 | 
			
		||||
                    person.CREATER_ID = entity.CREATER_ID;
 | 
			
		||||
                    techUsers.Add(person);
 | 
			
		||||
                }
 | 
			
		||||
                if (entity.Nav_CrucialLicensePerson != null && entity.Nav_CrucialLicensePerson.Any())
 | 
			
		||||
                {
 | 
			
		||||
                    entity.Nav_CrucialLicensePerson.ForEach(t =>
 | 
			
		||||
                    {
 | 
			
		||||
                        T_FO_TECH_DISCLOSURE_PERSON person = new T_FO_TECH_DISCLOSURE_PERSON();
 | 
			
		||||
                        person.ORG_ID = t.ORG_ID;
 | 
			
		||||
                        person.USER_ID = t.USER_ID;
 | 
			
		||||
                        person.TECH_DISCLOSURE_FROM_ID = tech.ID;
 | 
			
		||||
                        person.CREATER_ID = t.CREATER_ID;
 | 
			
		||||
                        techUsers.Add(person);
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
                techUsers = techUsers.Distinct(t => t.USER_ID).ToList();
 | 
			
		||||
                var userIds = entity.Nav_CrucialLicensePerson.Select(t => (Guid)t.USER_ID).Distinct().ToList();
 | 
			
		||||
                if (!userIds.Contains((Guid)entity.MONITOR_USER_ID))
 | 
			
		||||
                {
 | 
			
		||||
                    techUsers.Where(t => t.USER_ID == entity.MONITOR_USER_ID).ForEach(m => m.DEAL_STATUS = FOUserShiftStatusEnum.已处理);
 | 
			
		||||
                }
 | 
			
		||||
                var UserNames = new List<string>();
 | 
			
		||||
                var user = this.GetEntities<T_FM_USER>(t => t.ENABLE_STATUS == (int)FMEnableStatusEnum.启用 && (userIds.Contains(t.ID) || t.ID == entity.APPLY_USER_ID), new BaseFilter(entity.ORG_ID));
 | 
			
		||||
                var userFirst = user.FirstOrDefault(t => t.ID == entity.APPLY_USER_ID);
 | 
			
		||||
                foreach (var u in userIds)
 | 
			
		||||
                {
 | 
			
		||||
                    var current = user.FirstOrDefault(t => t.ID == u);
 | 
			
		||||
                    UserNames.Add(current?.NAME);
 | 
			
		||||
                }
 | 
			
		||||
                //DateTime dtEnd = NotificationTaskService.GetTaskEndTime(FMTASKTYPE.JobSite, entity.ORG_ID.Value, DateTime.Now, null, null);
 | 
			
		||||
                if (userFirst != null)
 | 
			
		||||
                {
 | 
			
		||||
                    notices.Add(NotificationTaskService.InsertUserNoticeTaskModel("安全技术交底表(" + entity.JOB_DATE.Value.ToShortDateString().Replace("/", "") + ")", tech.ID, entity.ORG_ID, entity.APPLY_USER_ID.Value, userFirst?.NAME, DateTime.Now,
 | 
			
		||||
                    entity.JOB_DATE.Value, (int)FMNoticeTypeEnum.消息, "FO019"));
 | 
			
		||||
                }
 | 
			
		||||
                if (userIds != null && userIds.Any())
 | 
			
		||||
                {
 | 
			
		||||
                    notices.AddRange(NotificationTaskService.InsertUserNoticeTaskModels("关键作业/许可作业工作票确认(" + entity.JOB_DATE.Value.ToShortDateString().Replace("/", "") + ")", entity.ID, entity.ORG_ID, userIds, UserNames, DateTime.Now,
 | 
			
		||||
                    entity.JOB_DATE.Value, (int)FMNoticeTypeEnum.消息, "FO017_SHOWPRINT"));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                entity.IS_PUBLISH = (int)FOPreMeetingStatusEnum.归档;
 | 
			
		||||
                tech = null; techUsers = null; notices = null;
 | 
			
		||||
            }
 | 
			
		||||
            UnifiedCommit(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (entity != null)
 | 
			
		||||
                    this.UpdateEntityNoCommit(entity);
 | 
			
		||||
                if (notices != null && notices.Any())
 | 
			
		||||
                    this.BantchSaveEntityNoCommit(notices);
 | 
			
		||||
                if (tech != null)
 | 
			
		||||
                    this.UpdateEntityNoCommit(tech);
 | 
			
		||||
                if (techUsers != null && techUsers.Any())
 | 
			
		||||
                    this.BantchSaveEntityNoCommit(techUsers);
 | 
			
		||||
                if (action != null)
 | 
			
		||||
                    action();
 | 
			
		||||
            });
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        private bool BackUpdate_FOJobEventRecord(string id, Action action)
 | 
			
		||||
        {
 | 
			
		||||
            var entity = this.GetEntity<T_FO_JOB_EVENT_RECORD>(id, "Nav_Details");
 | 
			
		||||
            entity.FORM_STATUS = (int)FOTeamActivityState.已归档;
 | 
			
		||||
            UnifiedCommit(() =>
 | 
			
		||||
            {
 | 
			
		||||
                if (entity != null)
 | 
			
		||||
                    this.UpdateEntityNoCommit(entity);
 | 
			
		||||
                if (action != null)
 | 
			
		||||
                    action();
 | 
			
		||||
            });
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user