部门培训计划完成后就触发年度计划
This commit is contained in:
		
							parent
							
								
									4e3dadddc5
								
							
						
					
					
						commit
						bf633ebe67
					
				@ -52,6 +52,7 @@ namespace APT.BaseData.Services.DomainServices
 | 
			
		||||
            var yearTrainPlanContent = new List<T_SE_YEAR_TRAIN_PLAN_CONTENT>();
 | 
			
		||||
            var depPlan = GetEntity<T_SE_DEP_TRAIN_PLAN>(id, new string[] { "Nav_DepTrainPlanDetail.Nav_DepTrainPlanContent" });
 | 
			
		||||
            var yearTrainPlan = GetEntity<T_SE_YEAR_TRAIN_PLAN>(t => t.PLAN_YEAR == depPlan.PLAN_YEAR);
 | 
			
		||||
            var sendNotice = new T_FM_NOTIFICATION_TASK();
 | 
			
		||||
            var addyearTrainPlan = false;
 | 
			
		||||
            if (yearTrainPlan == null)
 | 
			
		||||
            {
 | 
			
		||||
@ -92,6 +93,30 @@ namespace APT.BaseData.Services.DomainServices
 | 
			
		||||
                    yearTrainPlanContent.Add(c);
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
            var orgId = yearTrainPlan.ORG_ID;
 | 
			
		||||
            var isFinishDep = GetEntities<T_SE_DEP_TRAIN_PLAN>(t => t.PLAN_YEAR == yearTrainPlan.PLAN_YEAR&&t.ID!=model.ID, new BaseFilter(orgId));
 | 
			
		||||
            var isFinished = isFinishDep.Count(t => t.STATUS != PFStandardStatus.Archived);
 | 
			
		||||
            if (isFinished == 0)
 | 
			
		||||
            {
 | 
			
		||||
                var user = GetEntity<T_FM_USER>(e => e.Nav_ApproveRole.NAME == "安环部负责人" && e.ENABLE_STATUS == 0);
 | 
			
		||||
                if (user == null)
 | 
			
		||||
                {
 | 
			
		||||
                    user = GetEntity<T_FM_USER>(e => e.Nav_ApproveRole.NAME == "安环部安全员" && e.ENABLE_STATUS == 0);
 | 
			
		||||
                }
 | 
			
		||||
                yearTrainPlan.LAUNCH_DEPARTMENT_ID = user.DEPARTMENT_ID;
 | 
			
		||||
                yearTrainPlan.LAUNCH_TIME = DateTime.Now;
 | 
			
		||||
                yearTrainPlan.LAUNCH_USER_ID = user.ID;
 | 
			
		||||
                yearTrainPlan.STATUS = PFStandardStatus.Sign;
 | 
			
		||||
                yearTrainPlan.END_TIME = Convert.ToDateTime(DateTime.Now.ToString("D").ToString());
 | 
			
		||||
                if (user != null)
 | 
			
		||||
                {
 | 
			
		||||
                    sendNotice = NotificationTaskService.InsertUserNoticeTaskModel(yearTrainPlan.PLAN_YEAR + "年度培训计划", yearTrainPlan.ID, orgId, user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(15), 0, "SE012");
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    throw new Exception("未找到安环部负责人!");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            UnifiedCommit(() =>
 | 
			
		||||
            {
 | 
			
		||||
                UpdateEntityNoCommit(model);
 | 
			
		||||
@ -101,6 +126,8 @@ namespace APT.BaseData.Services.DomainServices
 | 
			
		||||
                    BantchSaveEntityNoCommit(yearTrainPlanDetail);
 | 
			
		||||
                if (yearTrainPlanDetail != null && yearTrainPlanDetail.Any())
 | 
			
		||||
                    BantchSaveEntityNoCommit(yearTrainPlanContent);
 | 
			
		||||
                if (sendNotice != null)
 | 
			
		||||
                    AddEntityNoCommit(sendNotice);
 | 
			
		||||
            });
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user