优化仓储列表
This commit is contained in:
@@ -26,16 +26,22 @@ namespace WMS.Web.Repositories
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly RepositoryDbContext _context;
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly IErpService _erpService;
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
|
||||
|
||||
public BoxInventoryRepositories(RepositoryDbContext context,
|
||||
IMapper mapper,
|
||||
IErpService erpService,
|
||||
ILoginRepositories loginRepositories,
|
||||
IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService)
|
||||
ISingleDataService singleDataService,
|
||||
IErpBasicDataExtendService erpBasicDataExtendService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_erpService = erpService;
|
||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||
_serviceProvider = serviceProvider;
|
||||
_loginRepositories = loginRepositories;
|
||||
_singleDataService = singleDataService;
|
||||
@@ -48,6 +54,16 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<ResultPagedList<BoxInventoryQueryResponse>> GetPagedList(BoxInventoryQueryRequest dto)
|
||||
{
|
||||
//1.获取物料集合和组织集合
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
return ResultPagedList<BoxInventoryQueryResponse>.ReFailure(materials_result);
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
//物料集合;模糊查询后的物料集合
|
||||
if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
materials = materials.Where(w => EF.Functions.Like(w.MaterialNumber, "%" + dto.MaterialNumber + "%")).ToList();
|
||||
|
||||
var query = _context.BoxInventoryDetails
|
||||
.GroupJoin(_context.BoxInventory, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
@@ -58,9 +74,6 @@ namespace WMS.Web.Repositories
|
||||
if (!string.IsNullOrEmpty(dto.BoxBillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.box.BoxBillNo, "%" + dto.BoxBillNo + "%"));
|
||||
|
||||
//if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
// query = query.Where(w => EF.Functions.Like(w.detail.BillNo, "%" + dto.BillNo + "%"));
|
||||
|
||||
if (dto.StockId.HasValue)
|
||||
query = query.Where(w => w.order.StockId == dto.StockId.Value);
|
||||
|
||||
@@ -76,11 +89,11 @@ namespace WMS.Web.Repositories
|
||||
Id = s.order.Id,
|
||||
DetailsId = s.detail.Id,
|
||||
BoxBillNo = s.box.BoxBillNo,
|
||||
MaterialName = "",
|
||||
MaterialNumber = "",
|
||||
Specifications = "",
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.order.StockId),
|
||||
SubStock="",
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.order.SubStockId),
|
||||
Qty = s.detail.Qty,
|
||||
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
@@ -89,9 +90,9 @@ namespace WMS.Web.Repositories
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId),
|
||||
Stock = "",
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode),
|
||||
Qty = s.Qty,
|
||||
SubStock ="",
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId),
|
||||
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.MaterialId),
|
||||
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
@@ -97,7 +98,7 @@ namespace WMS.Web.Repositories
|
||||
Type =s.Type.GetRemark(),
|
||||
OrderType=s.OrderType.GetRemark(),
|
||||
OrderBillNo=s.OrderBillNo,
|
||||
Stock = "",
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode),
|
||||
Qty = s.Qty,
|
||||
SurplusQty=s.SurplusQty,
|
||||
CreateTime = s.CreateTime
|
||||
|
||||
Reference in New Issue
Block a user