| | |
| | | using System; |
| | | using System.Linq.Dynamic.Core; |
| | | using CMS.Plugin.HIAWms.Domain.WmsAreas; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using DatabaseSchemaReader.Filters; |
| | | using MathNet.Numerics; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
| | | using Volo.Abp.EntityFrameworkCore; |
| | |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails() |
| | | .OrderBy(t => t.Sort) |
| | | .Where(x=> !x.IsDeleted) |
| | | .Where(x => !x.IsDeleted) |
| | | .FirstOrDefaultAsync(t => t.AreaName == name, GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 查看库区是否存在 |
| | | /// </summary> |
| | |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<List<WmsArea>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | public async Task<List<WmsArea>> GetListAsync(WmsArea? area, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsArea> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsAreaSpecification(); |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.AreaNo.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaNo), u => u.AreaNo.Contains(area.AreaNo)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaName), u => u.AreaNo.Contains(area.AreaName)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.StoreCode), u => u.AreaNo == area.StoreCode) |
| | | .WhereIf(area.AreaStatus > 0, u => u.AreaStatus == area.AreaStatus) |
| | | .WhereIf(area.AreaType > 0, u => u.AreaType == area.AreaType) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsArea.Sort) : sorting) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取库区列表 |
| | | /// </summary> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsArea>> GetListForSelectAsync(CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<long> GetCountAsync(string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default) |
| | | public async Task<long> GetCountAsync(WmsArea? area, string filter = null, Specification<WmsArea> specification = null, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsAreaSpecification(); |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.AreaNo.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaNo), u => u.AreaNo.Contains(area.AreaNo)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.AreaName), u => u.AreaNo.Contains(area.AreaName)) |
| | | .WhereIf(!string.IsNullOrEmpty(area.StoreCode), u => u.AreaNo == area.StoreCode) |
| | | .WhereIf(area.AreaStatus > 0, u => u.AreaStatus == area.AreaStatus) |
| | | .WhereIf(area.AreaType > 0, u => u.AreaType == area.AreaType) |
| | | .Where(x => !x.IsDeleted) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |