列表物料填充
This commit is contained in:
@@ -27,9 +27,11 @@ namespace WMS.Web.Repositories
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
|
||||
public OutStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories,
|
||||
IErpService erpService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -37,6 +39,7 @@ namespace WMS.Web.Repositories
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
_erpService = erpService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -86,6 +89,16 @@ namespace WMS.Web.Repositories
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
//1.获取物料集合
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
return (new List<OutStockQueryInfoResponse>(), 0);
|
||||
var materials = materials_result.Data.ToList();
|
||||
List<int> mIds = new List<int>();
|
||||
//物料集合;模糊查询后的物料集合
|
||||
if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
mIds = materials.Where(w => EF.Functions.Like(w.MaterialNumber, "%" + dto.MaterialNumber + "%")).Select(s => s.MaterialId).ToList();
|
||||
|
||||
var query = _context.OutStockDetails
|
||||
.GroupJoin(_context.OutStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
@@ -93,7 +106,8 @@ namespace WMS.Web.Repositories
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
|
||||
//if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
if (mIds.Count() != 0)
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.order.CreatorId));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
@@ -126,10 +140,10 @@ namespace WMS.Web.Repositories
|
||||
SourceBillNo = s.order.SourceBillNo,
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
ReceiptCustomer = _singleDataService.GetSingleData(SingleAction.Customers, _loginRepositories.CompanyId, s.order.ReceiptCustomerId),
|
||||
MaterialName = "",
|
||||
MaterialNumber = "",
|
||||
Specifications = "",
|
||||
ReceiptCustomer = "",
|
||||
MaterialName = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialName ?? "",
|
||||
MaterialNumber = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialNumber ?? "",
|
||||
Specifications = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).Specifications ?? "",
|
||||
Qty = s.detail.Qty
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user