| | |
| | | using System.Linq.Dynamic.Core; |
| | | using System.Linq.Expressions; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterialStocks; |
| | | using CMS.Plugin.HIAWms.Domain.WmsTask; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using CmsQueryExtensions.Extension; |
| | | using DatabaseSchemaReader.Filters; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using SqlKata; |
| | |
| | | .WhereIf(!string.IsNullOrEmpty(stock?.AreaName), u => u.AreaName.Contains(stock.AreaName)) |
| | | .WhereIf(stock.IsLock > 0, u => u.IsLock == stock.IsLock) |
| | | .Where(u => !u.IsDeleted) |
| | | .OrderByDescending(x=>x.InStockTime) |
| | | .ToListAsync(); |
| | | return baseQuery; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询库存明细 |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="sorting"></param> |
| | | /// <param name="maxResultCount"></param> |
| | | /// <param name="skipCount"></param> |
| | | /// <param name="includeDetails"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<List<WmsMaterialStock>> GetStockDetailListAsync(FunReturnResultModel<Expression<Func<WmsMaterialStock, bool>>> whereConditions, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(x=>x.PlaceNo) |
| | | .ThenByDescending(x => x.CreationTime) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取总数库存管理 |
| | | /// </summary> |
| | | /// <param name="whereConditions"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<long> GetDetailCountAsync(FunReturnResultModel<Expression<Func<WmsMaterialStock, bool>>> whereConditions, CancellationToken cancellationToken = default) |
| | | { |
| | | return await (await GetQueryableAsync()) |
| | | .WhereIf(whereConditions != null, whereConditions.data) |
| | | .Where(x => !x.IsDeleted) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | |
| | | /// <inheritdoc /> |
| | | public override async Task<IQueryable<WmsMaterialStock>> WithDetailsAsync() |
| | | { |