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