| | |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public virtual async Task<WmsContainer> FindByNameAsync(string name, CancellationToken cancellationToken = default) |
| | | public virtual async Task<WmsContainer> FindByNameAsync(string containerNo, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .OrderBy(t => t.Sort) |
| | | .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); |
| | | .FirstOrDefaultAsync(t => t.ContainerNo == containerNo, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<bool> NameExistAsync(string name, Guid? id = null) |
| | | public async Task<bool> NameExistAsync(string containerNo, Guid? id = null) |
| | | { |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).AnyAsync(x => x.Name == name); |
| | | return await (await GetDbSetAsync()).WhereIf(id.HasValue, p => p.Id != id).AnyAsync(x => x.ContainerNo == containerNo); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.Name.Contains(filter)) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.ContainerNo.Contains(filter)) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsContainer.Sort) : sorting) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | |
| | | specification ??= new WmsContainerSpecification(); |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.Name.Contains(filter)) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.ContainerNo.Contains(filter)) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | | |