示例#1
0
        /// <summary>
        /// 获取所有工序模板
        /// </summary>
        /// <returns></returns>
        public async Task <PagedResultDto <ProcedureDto> > GetAllProcedures()
        {
            var query = _procedureManager.GetAll().Where(v => !v.IsRoutine);

            return(new PagedResultDto <ProcedureDto>(
                       await query.CountAsync(),
                       await query.Select(v => v.MapTo <ProcedureDto>()).ToListAsync()
                       ));
        }
        /// <summary>
        /// 获取日常任务分类
        /// </summary>
        /// <returns></returns>
        public async Task <PagedResultDto <ProcedureStepDto> > GetAllRoutineCategory()
        {
            var procedure = _procedureManager.GetAll().FirstOrDefault(v => v.IsRoutine);

            // 如果为空则返回一个空的对象
            if (procedure == null)
            {
                return(new PagedResultDto <ProcedureStepDto>());
            }
            var query = _repositoryProcedureStep.GetAll().Where(p => p.ProcedureId == procedure.Id);

            return(await GetAllAsyncByQueryFilter <ProcedureStepDto, ProcedureStep>(query));
        }