列表物料填充
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
|
||||
|
||||
|
||||
@@ -26,16 +26,18 @@ namespace WMS.Web.Repositories
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
|
||||
|
||||
public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_erpService = erpService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -212,6 +214,16 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||
{
|
||||
//1.获取物料集合
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
return (new List<OutStockTaskQueryInfoResponse>(), 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.OutStockTaskDetails
|
||||
.GroupJoin(_context.OutStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
@@ -219,7 +231,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 (dto.Ids.Count() > 0)
|
||||
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
@@ -254,10 +267,10 @@ namespace WMS.Web.Repositories
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
ReceiptCustomer = "",
|
||||
MaterialName = "",
|
||||
MaterialNumber = "",
|
||||
Specifications = "",
|
||||
Unit="",
|
||||
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 ?? "",
|
||||
Unit= materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).BaseUnitName ?? "",
|
||||
#endregion
|
||||
|
||||
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
@@ -25,16 +25,18 @@ namespace WMS.Web.Repositories
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
|
||||
|
||||
public TakeStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_erpService = erpService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -157,9 +159,15 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<TakeStockQueryInfoResponse> list, int total)> GetListAsync(TakeStockQueryRequest dto)
|
||||
{
|
||||
//1.获取物料集合
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
return (new List<TakeStockQueryInfoResponse>(), 0);
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
var query = _context.TakeStock
|
||||
//.GroupJoin(_context.TakeStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
//.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
//.GroupJoin(_context.TakeStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
//.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
@@ -180,7 +188,7 @@ namespace WMS.Web.Repositories
|
||||
#region dto组装
|
||||
Id = s.Id,
|
||||
BillNo = s.BillNo,
|
||||
Unit = "",//物料带出来
|
||||
Unit = materials.FirstOrDefault(f => f.MaterialId == s.MaterialId).BaseUnitName ?? "",
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockId),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId),
|
||||
BeforeQty = s.BeforeQty,
|
||||
|
||||
Reference in New Issue
Block a user