| | |
| | | /// <summary> |
| | | /// 按照名称查找Wms任务管理 |
| | | /// </summary> |
| | | /// <param name="name"></param> |
| | | /// <param name="taskNo"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public virtual async Task<WmsTask> FindByNameAsync(string name, CancellationToken cancellationToken = default) |
| | | public virtual async Task<WmsTask> FindByNameAsync(string taskNo, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(t => t.Sort) |
| | | .FirstOrDefaultAsync(t => t.TaskNo == name, GetCancellationToken(cancellationToken)); |
| | | .FirstOrDefaultAsync(t => t.TaskNo == taskNo, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证名称是否存在Wms任务管理 |
| | | /// </summary> |
| | | /// <param name="name">校验值</param> |
| | | /// <param name="taskNo">校验值</param> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public async Task<bool> NameExistAsync(string name, Guid? id = null) |
| | | public async Task<bool> NameExistAsync(string taskNo, Guid? id = null) |
| | | { |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.TaskNo == name); |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).Where(x => !x.IsDeleted).AnyAsync(x => x.TaskNo == taskNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | .IncludeDetails(includeDetails) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsTask.Sort) : sorting) |
| | | .OrderByDescending(x=>x.CreationTime) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | |
| | | return (await GetQueryableAsync()) |
| | | .Where(x => !x.IsDeleted).IncludeDetails(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据原料标识查询任务 |
| | | /// </summary> |
| | | /// <param name="dataIdentifier"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<WmsTask> QueryWmsTaskByDataIdentifierAasync(string dataIdentifier, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderByDescending(x=>x.CreationTime) |
| | | .FirstOrDefaultAsync(t => t.MutableParam2 == dataIdentifier, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取任务列表 |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="sorting"></param> |
| | | /// <param name="includeDetails"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsTask>> GetTaskListAsync(FunReturnResultModel<Expression<Func<WmsTask, bool>>> whereConditions, string sorting = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(x => x.TaskType) |
| | | .ThenBy(x=>x.TaskLevel) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | } |