调整物料

This commit is contained in:
18942506660
2023-11-08 13:36:08 +08:00
parent 296010697e
commit 52dd6c3592
3 changed files with 22 additions and 19 deletions

View File

@@ -28,10 +28,10 @@ namespace WMS.Web.Repositories
private readonly ILoginRepositories _loginRepositories; private readonly ILoginRepositories _loginRepositories;
private readonly IBasicsRepositories _basicsRepositories; private readonly IBasicsRepositories _basicsRepositories;
private readonly IErpService _erpService; private readonly IErpService _erpService;
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
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) IErpService erpService, IErpBasicDataExtendService erpBasicDataExtendService)
{ {
_context = context; _context = context;
_mapper = mapper; _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(); 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(); var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess) if (!materials_result.IsSuccess)
return (new List<OutStockQueryInfoResponse>(), 0); return (new List<OutStockQueryInfoResponse>(), 0);
var materials = materials_result.Data.ToList(); var materials = materials_result.Data.ToList();
List<int> mIds = new List<int>();
//物料集合;模糊查询后的物料集合 //物料集合;模糊查询后的物料集合
if (!string.IsNullOrEmpty(dto.MaterialNumber)) 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.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 })
@@ -141,9 +142,9 @@ namespace WMS.Web.Repositories
SaleBillNo = s.detail.SaleBillNo, SaleBillNo = s.detail.SaleBillNo,
DeliveryOrg = "", DeliveryOrg = "",
ReceiptCustomer = "", ReceiptCustomer = "",
MaterialName = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialName ?? "", MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialNumber ?? "", MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).Specifications ?? "", Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Qty = s.detail.Qty Qty = s.detail.Qty
#endregion #endregion

View File

@@ -27,10 +27,10 @@ namespace WMS.Web.Repositories
private readonly ISingleDataService _singleDataService; private readonly ISingleDataService _singleDataService;
private readonly ILoginRepositories _loginRepositories; private readonly ILoginRepositories _loginRepositories;
private readonly IErpService _erpService; private readonly IErpService _erpService;
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider, public OutStockTaskRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService) ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService, IErpBasicDataExtendService erpBasicDataExtendService)
{ {
_context = context; _context = context;
_mapper = mapper; _mapper = mapper;
@@ -214,16 +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.获取物料集合 List<int> mIds = new List<int>();
var materials_result = await _erpService.BillQueryForMaterial(); var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess) if (!materials_result.IsSuccess)
return (new List<OutStockTaskQueryInfoResponse>(), 0); return (new List<OutStockTaskQueryInfoResponse>(), 0);
var materials = materials_result.Data.ToList(); var materials = materials_result.Data.ToList();
List<int> mIds = new List<int>();
//物料集合;模糊查询后的物料集合 //物料集合;模糊查询后的物料集合
if (!string.IsNullOrEmpty(dto.MaterialNumber)) 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 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 })
@@ -267,10 +267,10 @@ namespace WMS.Web.Repositories
SaleBillNo = s.detail.SaleBillNo, SaleBillNo = s.detail.SaleBillNo,
DeliveryOrg = "", DeliveryOrg = "",
ReceiptCustomer = "", ReceiptCustomer = "",
MaterialName = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialName ?? "", MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).MaterialNumber ?? "", MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).Specifications ?? "", Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Unit= materials.FirstOrDefault(f => f.MaterialId == s.detail.MaterialId).BaseUnitName ?? "", Unit = "",
#endregion #endregion
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); }).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();

View File

@@ -26,10 +26,12 @@ namespace WMS.Web.Repositories
private readonly ISingleDataService _singleDataService; private readonly ISingleDataService _singleDataService;
private readonly ILoginRepositories _loginRepositories; private readonly ILoginRepositories _loginRepositories;
private readonly IErpService _erpService; private readonly IErpService _erpService;
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
public TakeStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider, public TakeStockRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService) ISingleDataService singleDataService, ILoginRepositories loginRepositories, IErpService erpService
, IErpBasicDataExtendService erpBasicDataExtendService)
{ {
_context = context; _context = context;
_mapper = mapper; _mapper = mapper;
@@ -188,7 +190,7 @@ namespace WMS.Web.Repositories
#region dto组装 #region dto组装
Id = s.Id, Id = s.Id,
BillNo = s.BillNo, BillNo = s.BillNo,
Unit = materials.FirstOrDefault(f => f.MaterialId == s.MaterialId).BaseUnitName ?? "", Unit = "",
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,