列表优化
This commit is contained in:
@@ -26,6 +26,7 @@ namespace WMS.Web.Repositories
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly IErpService _erpService;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
@@ -35,6 +36,7 @@ namespace WMS.Web.Repositories
|
||||
public BackRecordRepositories(RepositoryDbContext context,
|
||||
IMapper mapper,
|
||||
IErpService erpService,
|
||||
IBasicsRepositories basicsRepositories,
|
||||
ILoginRepositories loginRepositories,
|
||||
IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService,
|
||||
@@ -43,6 +45,7 @@ namespace WMS.Web.Repositories
|
||||
_erpService = erpService;
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
_serviceProvider = serviceProvider;
|
||||
_loginRepositories = loginRepositories;
|
||||
_singleDataService = singleDataService;
|
||||
@@ -68,6 +71,13 @@ namespace WMS.Web.Repositories
|
||||
return (new List<BackRecordQueryResponse>(), 0);
|
||||
var orgs = orgs_result.Data.ToList();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
|
||||
ids = staffList.Where(w =>w.Name.Contains(dto.Creator)).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
var query = _context.BackRecordDetails
|
||||
.GroupJoin(_context.BackRecord, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
@@ -77,7 +87,13 @@ namespace WMS.Web.Repositories
|
||||
|
||||
if (dto.SubStockId.HasValue)
|
||||
query = query.Where(w => w.detail.SubStockId == dto.SubStockId.Value);
|
||||
|
||||
|
||||
if(dto.Type.HasValue)
|
||||
query = query.Where(w => (int)w.order.Type == dto.Type.Value);
|
||||
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.order.CreatorId));
|
||||
|
||||
if (dto.CreateBeginDate != null)
|
||||
query = query.Where(w => w.order.CreateTime >= dto.CreateBeginDate.Value);
|
||||
if (dto.CreateEndDate != null)
|
||||
|
||||
Reference in New Issue
Block a user