/// <summary> /// 添加Job /// </summary> /// <param name="input"></param> public bool AddJob(JobInfoInputDto input) { var job = _jobInfoRepository.Get(x => x.JobName.Equals(input.jobname) && x.JobGroup.Equals(input.jobgroup), true); if (job == null) { return(false); } var result = _jobManager.AddJob(input.jobname, input.jobgroup, input.jobcron, job.JobValue, job.JobClass) .Result; var trigger_state = _jobManager.GeTriggerState(input.jobname, input.jobgroup); if (trigger_state != TriggerState.Normal || trigger_state != TriggerState.Paused) { return(false); } job.JobCron = input.jobcron; job.IsDelete = 0; job.JobStatus = (int)TriggerState.Normal; job.CreateTime = DateTime.Now; job.UpdateTime = DateTime.Now; _jobInfoRepository.Update(job); return(_jobInfoRepository.SaveChanges() > 0); }