This commit is contained in:
18942506660
2023-11-23 16:03:56 +08:00
parent cbc70c1a81
commit 65bf0d273d

View File

@@ -72,14 +72,16 @@ namespace WMS.Web.Domain.Services
return Result.ReFailure(ResultCodes.OutStockTaskRepeal);
//上传的物料在任务单里没有找到不能出库
var ex = dto.Details.Select(s => s.MaterialId).Except(outStockTask.Details.Select(s => s.MaterialId)).ToList();
if (ex.Count() > 0)
if (ex.Count() > 0 && dto.Method == 2)
return Result.ReFailure(ResultCodes.OutStockMaterialError);
//1.需要验证物料对应箱和序列号是否存在库存
//如果是按箱出库从库存拿取数据
if (dto.Method == 1)
{
var boxs = dto.Details.Select(s => s.BoxId).ToList();
dto.Details.Clear();
//获取箱子对应的所有库存
var boxInventoryList = await _boxInventoryRepositories.GetList(dto.Details.Select(s => s.BoxId).ToList());
var boxInventoryList = await _boxInventoryRepositories.GetList(boxs);
//过滤掉不同仓库和不同组织的
boxInventoryList = boxInventoryList.Where(w => w.StockCode == outStockTask.StockCode && w.OrgCode == outStockTask.OrgCode).ToList();
//组装dto
@@ -173,8 +175,8 @@ namespace WMS.Web.Domain.Services
Result res_Rollback = Result.ReSuccess();
bool isSuccess = true;
//修改库存
var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
//var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
//if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
if (res_Rollback.IsSuccess)
{
entity = await _outStockRepositories.Add(entity, false);
@@ -190,11 +192,11 @@ namespace WMS.Web.Domain.Services
var res_change = await _serialNumberService.OutStock(entity, loginInfo, false);
if (!res_change.IsSuccess) res_Rollback = res_change;
}
if (res_Rollback.IsSuccess)
{
res_Inventory = await _inventoryInOutDetailsService.GenerateInOrOutDetails(generateList, false);
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
}
//if (res_Rollback.IsSuccess)
//{
// res_Inventory = await _inventoryInOutDetailsService.GenerateInOrOutDetails(generateList, false);
// if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
//}
//提交事务
isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction);
if (!res_Rollback.IsSuccess) return res_Rollback;