Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -93,25 +93,33 @@ namespace WMS.Web.Domain.Services
|
|||||||
IDbContextTransaction _transaction = null;
|
IDbContextTransaction _transaction = null;
|
||||||
if (isTransaction)
|
if (isTransaction)
|
||||||
_transaction = _transactionRepositories.GetTransaction();
|
_transaction = _transactionRepositories.GetTransaction();
|
||||||
bool isRollback = false;
|
Result res_Rollback = Result.ReSuccess();
|
||||||
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) res_Rollback = res_Inventory;
|
||||||
|
if (res_Rollback.IsSuccess)
|
||||||
|
{
|
||||||
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
||||||
if (!isSuccess) isRollback = true;
|
if (!isSuccess) res_Rollback=Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
}
|
||||||
|
if (res_Rollback.IsSuccess)
|
||||||
|
{
|
||||||
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false);
|
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false);
|
||||||
if (!res_change.IsSuccess) isRollback = true;
|
if (!res_change.IsSuccess) res_Rollback = res_change;
|
||||||
|
}
|
||||||
|
if (res_Rollback.IsSuccess)
|
||||||
|
{
|
||||||
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
|
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
|
||||||
if (!isSuccess) isRollback = true;
|
if (!isSuccess) res_Rollback= Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
}
|
||||||
//提交事务
|
//提交事务
|
||||||
if (isTransaction)
|
if (isTransaction)
|
||||||
{
|
{
|
||||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
isSuccess = _transactionRepositories.CommitTransaction(res_Rollback.IsSuccess ? false : true, _transaction);
|
||||||
|
if (!res_Rollback.IsSuccess) return res_Rollback;
|
||||||
if (!isSuccess)
|
if (!isSuccess)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result.ReSuccess();
|
return Result.ReSuccess();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -120,7 +128,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.下架时 需要验证箱是否在库存里
|
||||||
|
|
||||||
@@ -135,19 +143,28 @@ namespace WMS.Web.Domain.Services
|
|||||||
inventoryList.ForEach(f => f.InventoryInOutType = IsUp == true ? 1 : 2);
|
inventoryList.ForEach(f => f.InventoryInOutType = IsUp == true ? 1 : 2);
|
||||||
|
|
||||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||||
bool isRollback = false;
|
|
||||||
bool isSuccess = true;
|
bool isSuccess = true;
|
||||||
|
Result res_Rollback = Result.ReSuccess();
|
||||||
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) res_Rollback = res_Inventory;
|
||||||
|
|
||||||
|
if (res_Rollback.IsSuccess)
|
||||||
|
{
|
||||||
isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, false);
|
isSuccess = await _moveBoxRecordRepositories.AddRange(entityList, false);
|
||||||
if (!isSuccess) isRollback = true;
|
if (!isSuccess) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
}
|
||||||
|
if (res_Rollback.IsSuccess)
|
||||||
|
{
|
||||||
var res_change = await _serialNumberService.MoveBox(entityList, loginInfo, false);
|
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 (!res_Rollback.IsSuccess) return res_Rollback;
|
||||||
if (!isSuccess)
|
if (!isSuccess)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
|
|
||||||
return Result.ReSuccess();
|
return Result.ReSuccess();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,28 +123,29 @@ namespace WMS.Web.Domain.Services
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||||
bool isRollback = false;
|
Result res_Rollback = Result.ReSuccess();
|
||||||
bool isSuccess = true;
|
bool isSuccess = true;
|
||||||
//修改库存
|
//修改库存
|
||||||
var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
|
var res_Inventory = await _boxInventoryService.HandlBoxInventory(inventoryList, false);
|
||||||
if (!res_Inventory.IsSuccess) isRollback = true;
|
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||||
if (!isRollback)
|
if (res_Rollback.IsSuccess)
|
||||||
{
|
{
|
||||||
entity = await _outStockRepositories.Add(entity, false);
|
entity = await _outStockRepositories.Add(entity, false);
|
||||||
if (entity == null) isRollback = true;
|
if (entity == null) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
}
|
}
|
||||||
if (!isRollback)
|
if (res_Rollback.IsSuccess)
|
||||||
{
|
{
|
||||||
outStockTask = await _outStockTaskRepositories.Edit(outStockTask, false);
|
outStockTask = await _outStockTaskRepositories.Edit(outStockTask, false);
|
||||||
if (outStockTask == null) isRollback = true;
|
if (outStockTask == null) res_Rollback = Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
}
|
}
|
||||||
if (!isRollback)
|
if (res_Rollback.IsSuccess)
|
||||||
{
|
{
|
||||||
var res_change = await _serialNumberService.OutStock(entity, loginInfo, false);
|
var res_change = await _serialNumberService.OutStock(entity, 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 (!res_Rollback.IsSuccess) return res_Rollback;
|
||||||
if (!isSuccess)
|
if (!isSuccess)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user