修复bug

This commit is contained in:
18942506660
2023-11-17 15:46:47 +08:00
parent f972020069
commit 3bf3e5b938

View File

@@ -93,33 +93,33 @@ namespace WMS.Web.Domain.Services
IDbContextTransaction _transaction = null;
if (isTransaction)
_transaction = _transactionRepositories.GetTransaction();
bool isRollback = false;
Result res_Rollback = Result.ReSuccess();
bool isSuccess = true;
var res_Inventory = await _boxInventoryService.GenerateChangeBox(inventoryList, false);
if (!res_Inventory.IsSuccess) isRollback = true;
if (!isRollback)
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
if (res_Rollback.IsSuccess)
{
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
if (!isSuccess) isRollback = true;
if (!isSuccess) res_Rollback=Result.ReFailure(ResultCodes.DateWriteError);
}
if (!isRollback)
if (res_Rollback.IsSuccess)
{
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false);
if (!res_change.IsSuccess) isRollback = true;
if (!res_change.IsSuccess) res_Rollback = res_change;
}
if (!isRollback)
if (res_Rollback.IsSuccess)
{
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
if (!isSuccess) isRollback = true;
if (!isSuccess) res_Rollback= Result.ReFailure(ResultCodes.DateWriteError);
}
//提交事务
if (isTransaction)
{
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction);
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
}
if (isRollback) return Result.ReFailure(ResultCodes.DateWriteError);
if (!res_Rollback.IsSuccess) return res_Rollback;
return Result.ReSuccess();
}
@@ -144,27 +144,26 @@ namespace WMS.Web.Domain.Services
inventoryList.ForEach(f => f.InventoryInOutType = IsUp == true ? 1 : 2);
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
bool isRollback = false;
bool isSuccess = true;
string messageError = "";
Result res_Rollback = Result.ReSuccess();
var res_Inventory = await _boxInventoryService.GenerateMoveBox(inventoryList, false);
if (!res_Inventory.IsSuccess) isRollback = true;
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
if (!isRollback)
if (res_Rollback.IsSuccess)
{
isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, false);
if (!isSuccess) isRollback = true;
if (!isSuccess) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError);
}
if (!isRollback)
if (res_Rollback.IsSuccess)
{
var res_change = await _serialNumberService.MoveBox(entityList, loginInfo, false);
if (!res_change.IsSuccess) isRollback = true;
if (!res_change.IsSuccess) res_Rollback = res_change;
}
//提交事务
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction);
if (!isSuccess)
return Result.ReFailure(ResultCodes.DateWriteError);
if (isRollback) return Result.ReFailure(ResultCodes.DateWriteError);
if (!res_Rollback.IsSuccess) return res_Rollback;
return Result.ReSuccess();
}