修复bug

This commit is contained in:
18942506660
2023-11-17 15:38:22 +08:00
parent 1a28d353f9
commit f972020069

View File

@@ -97,13 +97,21 @@ namespace WMS.Web.Domain.Services
bool isSuccess = true; bool isSuccess = true;
var res_Inventory = await _boxInventoryService.GenerateChangeBox(inventoryList, false); var res_Inventory = await _boxInventoryService.GenerateChangeBox(inventoryList, false);
if (!res_Inventory.IsSuccess) isRollback = true; if (!res_Inventory.IsSuccess) isRollback = true;
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false); if (!isRollback)
if (!isSuccess) isRollback = true; {
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false); isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
if (!res_change.IsSuccess) isRollback = true; if (!isSuccess) isRollback = true;
isSuccess = await _boxRepositories.EditEntityList(boxList, false); }
if (!isSuccess) isRollback = true; if (!isRollback)
{
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false);
if (!res_change.IsSuccess) isRollback = true;
}
if (!isRollback)
{
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
if (!isSuccess) isRollback = true;
}
//提交事务 //提交事务
if (isTransaction) if (isTransaction)
{ {
@@ -111,6 +119,7 @@ namespace WMS.Web.Domain.Services
if (!isSuccess) if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError); return Result.ReFailure(ResultCodes.DateWriteError);
} }
if (isRollback) return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess(); return Result.ReSuccess();
} }
@@ -120,7 +129,7 @@ namespace WMS.Web.Domain.Services
/// <param name="dto"></param> /// <param name="dto"></param>
/// <param name="loginInfo"></param> /// <param name="loginInfo"></param>
/// <returns></returns> /// <returns></returns>
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto,bool IsUp, LoginInDto loginInfo) public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
{ {
//1.下架时 需要验证箱是否在库存里 //1.下架时 需要验证箱是否在库存里
@@ -137,16 +146,25 @@ namespace WMS.Web.Domain.Services
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction(); IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
bool isRollback = false; bool isRollback = false;
bool isSuccess = true; bool isSuccess = true;
string messageError = "";
var res_Inventory = await _boxInventoryService.GenerateMoveBox(inventoryList, false); var res_Inventory = await _boxInventoryService.GenerateMoveBox(inventoryList, false);
if (!res_Inventory.IsSuccess) isRollback = true; if (!res_Inventory.IsSuccess) isRollback = true;
isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, false);
if (!isSuccess) isRollback = true; if (!isRollback)
var res_change = await _serialNumberService.MoveBox(entityList, loginInfo, false); {
if (!res_change.IsSuccess) isRollback = true; isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, false);
if (!isSuccess) isRollback = true;
}
if (!isRollback)
{
var res_change = await _serialNumberService.MoveBox(entityList, loginInfo, false);
if (!res_change.IsSuccess) isRollback = true;
}
//提交事务 //提交事务
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction); isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
if (!isSuccess) if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError); return Result.ReFailure(ResultCodes.DateWriteError);
if (isRollback) return Result.ReFailure(ResultCodes.DateWriteError);
return Result.ReSuccess(); return Result.ReSuccess();
} }