Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -28,10 +28,10 @@ namespace WMS.Web.Repositories
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
public OutStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories,
|
||||
IErpService erpService)
|
||||
IErpService erpService, IErpBasicDataExtendService erpBasicDataExtendService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -89,15 +89,16 @@ namespace WMS.Web.Repositories
|
||||
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
|
||||
}
|
||||
|
||||
//1.获取物料集合
|
||||
List<int> mIds = new List<int>();
|
||||
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 })
|
||||
@@ -141,9 +142,9 @@ namespace WMS.Web.Repositories
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
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 ?? "",
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
Qty = s.detail.Qty
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -27,10 +27,10 @@ namespace WMS.Web.Repositories
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
|
||||
public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService, IErpBasicDataExtendService erpBasicDataExtendService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -214,16 +214,16 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||
{
|
||||
//1.获取物料集合
|
||||
List<int> mIds = new List<int>();
|
||||
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();
|
||||
|
||||
{
|
||||
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 })
|
||||
@@ -267,10 +267,10 @@ namespace WMS.Web.Repositories
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
DeliveryOrg = "",
|
||||
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 ?? "",
|
||||
Unit= materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).BaseUnitName ?? "",
|
||||
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.detail.MaterialId),
|
||||
#endregion
|
||||
|
||||
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
@@ -26,10 +26,12 @@ namespace WMS.Web.Repositories
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
|
||||
|
||||
public TakeStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService
|
||||
, IErpBasicDataExtendService erpBasicDataExtendService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -188,7 +190,7 @@ namespace WMS.Web.Repositories
|
||||
#region dto组装
|
||||
Id = s.Id,
|
||||
BillNo = s.BillNo,
|
||||
Unit = materials.FirstOrDefault(f => f.MaterialId == s.MaterialId).BaseUnitName ?? "",
|
||||
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.MaterialId),
|
||||
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