调整接口
This commit is contained in:
@@ -75,31 +75,29 @@ namespace WMS.Web.Domain.Services
|
||||
if (destBox != null)
|
||||
boxList.Add(destBox);
|
||||
|
||||
//2.修改库存时需要区别 有原箱和没有原箱的情况
|
||||
var subStock= await _basbicsRepositories.GetSubUcStockAsync(dto.SubStockId, loginInfo.UserInfo.CompanyId);
|
||||
//var entity = _mapper.Map<ChangeBoxRecord>(dto);\
|
||||
|
||||
List<ChangeBoxRecord> list = new List<ChangeBoxRecord>();
|
||||
foreach (var d in dto.Details)
|
||||
{
|
||||
ChangeBoxRecord entity = new ChangeBoxRecord();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, d.Qty, d.MaterialId, d.SerialNumbers, dto.SrcBoxId, dto.DestBoxId);
|
||||
entity.DestSubStockId = dto.SubStockId;
|
||||
entity.DestBoxOrgCode = subStock.ErpOrgCode;
|
||||
entity.DestStockCode = subStock.StockCode;
|
||||
list.Add(entity);
|
||||
entity.SrcSubStockId = 0;//原乡仓位需要去拉一下库存获取
|
||||
if (subStock != null)
|
||||
{
|
||||
entity.DestSubStockId = dto.SubStockId;
|
||||
entity.DestBoxOrgCode = subStock.ErpOrgCode;
|
||||
entity.DestStockCode = subStock.StockCode;
|
||||
}
|
||||
list.Add(entity);
|
||||
}
|
||||
var inventoryList = new List<BoxInventoryChangeGenerateDto>();
|
||||
inventoryList.Add(_mapper.Map<BoxInventoryChangeGenerateDto>(dto));
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _basbicsRepositories.GetTransaction();
|
||||
Result res_Rollback = Result.ReSuccess();
|
||||
bool isSuccess = true;
|
||||
var res_Inventory = await _boxInventoryService.GenerateChangeBox(inventoryList, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
|
||||
if (res_Rollback.IsSuccess)
|
||||
{
|
||||
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
||||
@@ -115,6 +113,11 @@ namespace WMS.Web.Domain.Services
|
||||
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
|
||||
if (!isSuccess) res_Rollback= Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
if(res_Rollback.IsSuccess)
|
||||
{
|
||||
var res_Inventory = await _boxInventoryService.GenerateChangeBox(list, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
}
|
||||
//提交事务
|
||||
if (isTransaction)
|
||||
{
|
||||
@@ -134,12 +137,12 @@ namespace WMS.Web.Domain.Services
|
||||
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
|
||||
{
|
||||
//1.下架时 需要验证箱是否在库存里
|
||||
|
||||
List<MoveBoxRecord> entityList = new List<MoveBoxRecord>();
|
||||
foreach (var d in dto)
|
||||
{
|
||||
var subStock = await _basbicsRepositories.GetSubUcStockAsync(d.SubStockId, loginInfo.UserInfo.CompanyId);
|
||||
var entity = new MoveBoxRecord();
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, d.StockCode, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, subStock ?.ErpOrgCode, subStock?.StockCode, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entityList.Add(entity);
|
||||
}
|
||||
var inventoryList = _mapper.Map<List<BoxInventoryMoveGenerateDto>>(dto);
|
||||
|
||||
Reference in New Issue
Block a user