using YBEE.EQM.Core; namespace YBEE.EQM.Application; /// /// 监测计划管理服务 /// [ApiDescriptionSettings(Name = "exam-plan")] [Route("exam/plan")] public class ExamPlanAppService(IExamPlanService examPlanService, ExamSampleWorker examSampleWorker) : IDynamicApiController { /// /// 添加监测计划 /// /// /// public async Task Add(AddExamPlanInput input) { await examPlanService.Add(input); } /// /// 更新监测计划 /// /// /// public async Task Update(UpdateExamPlanInput input) { await examPlanService.Update(input); } /// /// 删除监测计划 /// /// /// public async Task Del(BaseId input) { await examPlanService.Del(input); } /// /// 开始监测 /// /// /// public async Task Start(BaseId input) { await examPlanService.Start(input); } /// /// 结束监测 /// /// /// public async Task Stop(BaseId input) { await examPlanService.Stop(input); } /// /// 取消监测 /// /// /// public async Task Cancel(BaseId input) { await examPlanService.Cancel(input); } /// /// 根据ID获取监测计划 /// /// /// public async Task GetById([FromQuery][Required] int id) { return await examPlanService.GetById(id); } /// /// 获取监测计划抽样状态 /// /// /// [DisableOpLog] public async Task GetSampleStatusById(int id) { return await examPlanService.GetSampleStatusById(id); } /// /// 分页查询监测计划列表 /// /// /// public async Task> QueryPageList(ExamPlanPageInput input) { return await examPlanService.QueryPageList(input); } /// /// 获取我的单据状态数量 /// /// public async Task> QueryStatusCount(ExamPlanPageInput input) { return await examPlanService.QueryStatusCount(input); } /// /// 获取最近5个抽测参照成绩监测计划 /// /// /// public async Task> GetSampleRefPlanList(int id) { return await examPlanService.GetSampleRefPlanList(id); } /// /// 按监测计划执行抽样 /// /// public void ExecuteSample(BaseId input) { var ret = examSampleWorker.StartTask(input.Id); if (ret == -1) { throw Oops.Oh(ErrorCode.E3007); } } }