修复bug
This commit is contained in:
@@ -41,12 +41,13 @@ namespace WMS.Web.Domain.Services
|
|||||||
private readonly IInventoryInOutDetailsService _inventoryInOutDetailsService;
|
private readonly IInventoryInOutDetailsService _inventoryInOutDetailsService;
|
||||||
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
|
private readonly IBoxInventoryRepositories _boxInventoryRepositories;
|
||||||
private readonly ILogger<OutStockService> _logger;
|
private readonly ILogger<OutStockService> _logger;
|
||||||
|
private readonly IBoxRepositories _boxRepositories;
|
||||||
public OutStockService(IMapper mapper, ILoginService loginService,
|
public OutStockService(IMapper mapper, ILoginService loginService,
|
||||||
IBasicsRepositories transactionRepositories,
|
IBasicsRepositories transactionRepositories,
|
||||||
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories,
|
IOutStockRepositories outStockRepositories, IOutStockTaskRepositories outStockTaskRepositories,
|
||||||
IOutStockTaskService outStockTaskService, IErpService erpService, ISerialNumberService serialNumberService,
|
IOutStockTaskService outStockTaskService, IErpService erpService, ISerialNumberService serialNumberService,
|
||||||
IBoxInventoryService boxInventoryService, IInventoryInOutDetailsService inventoryInOutDetailsService,
|
IBoxInventoryService boxInventoryService, IInventoryInOutDetailsService inventoryInOutDetailsService,
|
||||||
IBoxInventoryRepositories boxInventoryRepositories, ILogger<OutStockService> logger)
|
IBoxInventoryRepositories boxInventoryRepositories, ILogger<OutStockService> logger, IBoxRepositories boxRepositories)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_loginService = loginService;
|
_loginService = loginService;
|
||||||
@@ -60,6 +61,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
_inventoryInOutDetailsService = inventoryInOutDetailsService;
|
_inventoryInOutDetailsService = inventoryInOutDetailsService;
|
||||||
_boxInventoryRepositories = boxInventoryRepositories;
|
_boxInventoryRepositories = boxInventoryRepositories;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
_boxRepositories = boxRepositories;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出库单
|
/// 出库单
|
||||||
@@ -79,14 +81,24 @@ namespace WMS.Web.Domain.Services
|
|||||||
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
|
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
|
||||||
if (ex.Count() > 0 && dto.Method == 2)
|
if (ex.Count() > 0 && dto.Method == 2)
|
||||||
return Result.ReFailure(ResultCodes.OutStockMaterialError);
|
return Result.ReFailure(ResultCodes.OutStockMaterialError);
|
||||||
|
var boxIds = dto.Details.Select(s => s.BoxId).ToList();
|
||||||
|
var boxInventoryList = await _boxInventoryRepositories.GetList(boxIds);
|
||||||
|
foreach (var boxid in boxIds)
|
||||||
|
{
|
||||||
|
var inventory = boxInventoryList.FirstOrDefault(f => f.BoxId == boxid);
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
var box = await _boxRepositories.Get(boxid);
|
||||||
|
return Result.ReFailure($"箱号:{box?.BoxBillNo} 不存在库存", 70008);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//1.需要验证物料对应箱和序列号是否存在库存
|
//1.需要验证物料对应箱和序列号是否存在库存
|
||||||
//如果是按箱出库从库存拿取数据
|
//如果是按箱出库从库存拿取数据
|
||||||
if (dto.Method == 1)
|
if (dto.Method == 1)
|
||||||
{
|
{
|
||||||
var boxs = dto.Details.Select(s => s.BoxId).ToList();
|
|
||||||
dto.Details.Clear();
|
dto.Details.Clear();
|
||||||
//获取箱子对应的所有库存
|
//获取箱子对应的所有库存
|
||||||
var boxInventoryList = await _boxInventoryRepositories.GetList(boxs);
|
|
||||||
//过滤掉不同仓库和不同组织的
|
//过滤掉不同仓库和不同组织的
|
||||||
boxInventoryList = boxInventoryList.Where(w => w.StockCode == outStockTask.StockCode && w.OrgCode == outStockTask.OrgCode).ToList();
|
boxInventoryList = boxInventoryList.Where(w => w.StockCode == outStockTask.StockCode && w.OrgCode == outStockTask.OrgCode).ToList();
|
||||||
//组装dto
|
//组装dto
|
||||||
|
|||||||
Reference in New Issue
Block a user