| | |
| | | using System.Threading.Tasks; |
| | | using Utility.Entity; |
| | | using Utility; |
| | | using Model.ModelVm; |
| | | |
| | | namespace Wms.Controllers |
| | | { |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<string> StopJob([FromBody] JobKey job) |
| | | public async Task<string> StopJob(JobVm job) |
| | | { |
| | | return await scheduler.StopOrDelScheduleJobAsync(job.Group, job.Name); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<string> RemoveJob([FromBody] JobKey job) |
| | | public async Task<string> RemoveJob(JobVm job) |
| | | { |
| | | return await scheduler.StopOrDelScheduleJobAsync(job.Group, job.Name, true); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<string> ResumeJob([FromBody] JobKey job) |
| | | public async Task<string> ResumeJob(JobVm job) |
| | | { |
| | | return await scheduler.ResumeJobAsync(job.Group, job.Name); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<ScheduleEntity> QueryJob([FromBody] JobKey job) |
| | | public async Task<ScheduleEntity> QueryJob(JobVm job) |
| | | { |
| | | return await scheduler.QueryJobAsync(job.Group, job.Name); |
| | | } |
| | |
| | | /// <param name="job"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<bool> TriggerJob([FromBody] JobKey job) |
| | | public async Task<bool> TriggerJob(JobVm job) |
| | | { |
| | | await scheduler.TriggerJobAsync(job); |
| | | JobKey modKey = new JobKey(job.Name, job.Group); |
| | | await scheduler.TriggerJobAsync(modKey); |
| | | return true; |
| | | } |
| | | |
| | |
| | | /// <param name="jobKey"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<List<string>> GetJobLogs([FromBody] JobKey jobKey) |
| | | public async Task<List<string>> GetJobLogs(JobVm job) |
| | | { |
| | | var logs = await scheduler.GetJobLogsAsync(jobKey); |
| | | JobKey modKey = new JobKey(job.Name, job.Group); |
| | | var logs = await scheduler.GetJobLogsAsync(modKey); |
| | | logs?.Reverse(); |
| | | return logs; |
| | | } |