优化列表查询
This commit is contained in:
@@ -124,10 +124,8 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => w.order.MaterialId == 0);
|
||||
}
|
||||
|
||||
if (cr_ids.Count != 0)
|
||||
if(!string.IsNullOrEmpty(dto.Creator))
|
||||
query = query.Where(w => cr_ids.Contains(w.order.CreatorId));
|
||||
else if (!string.IsNullOrEmpty(dto.Creator))
|
||||
query = query.Where(w => w.order.CreatorId==0);
|
||||
if (dto.BeginDate != null)
|
||||
query = query.Where(w => w.order.CreateTime.Date >= dto.BeginDate.Value);
|
||||
if (dto.EndDate != null)
|
||||
|
||||
@@ -321,10 +321,8 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => w.detail.MaterialId == 0);
|
||||
}
|
||||
|
||||
if (cr_ids.Count!=0)
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
query = query.Where(w => cr_ids.Contains(w.order.CreatorId));
|
||||
else if (!string.IsNullOrEmpty(dto.Creator))
|
||||
query = query.Where(w => w.order.CreatorId == 0);
|
||||
|
||||
if (dto.SupplierId.HasValue)
|
||||
query = query.Where(w => w.detail.SupplierId == dto.SupplierId.Value);
|
||||
|
||||
@@ -456,12 +456,14 @@ namespace WMS.Web.Repositories
|
||||
if (!string.IsNullOrEmpty(dto.Receiver))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(companyId);
|
||||
if (staffList != null && staffList.Count!=0)
|
||||
ids_Receiver = staffList.Where(w => w.Name.Contains(dto.Receiver)).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dto.Operator))
|
||||
{
|
||||
var staffList = await _basicsRepositories.GetStaffListAsync(companyId);
|
||||
if (staffList != null && staffList.Count != 0)
|
||||
ids_Operator = staffList.Where(w => w.Name.Contains(dto.Operator)).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
@@ -495,15 +497,11 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => w.detail.MaterialId == 0);
|
||||
}
|
||||
|
||||
if (ids_Receiver.Count() > 0)
|
||||
if (!string.IsNullOrEmpty(dto.Receiver))
|
||||
query = query.Where(w => ids_Receiver.Contains(w.order.ReceiverId ?? 0));
|
||||
else if (!string.IsNullOrEmpty(dto.Receiver))
|
||||
query = query.Where(w => w.order.ReceiverId == 0);
|
||||
|
||||
if (ids_Operator.Count() > 0)
|
||||
if (!string.IsNullOrEmpty(dto.Operator))
|
||||
query = query.Where(w => ids_Operator.Contains(w.order.ShelferId ?? 0));
|
||||
else if (!string.IsNullOrEmpty(dto.Operator))
|
||||
query = query.Where(w => w.order.ShelferId == 0);
|
||||
|
||||
if (dto.SupplierId.HasValue)
|
||||
query = query.Where(w => w.detail.SupplierId == dto.SupplierId.Value);
|
||||
|
||||
Reference in New Issue
Block a user