箱库存
This commit is contained in:
@@ -20,7 +20,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 出入库回退上下架:服务接口
|
/// 出入库回退上下架:服务接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BackRecordService: IBackRecordService
|
public class BackRecordService : IBackRecordService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly IMapper _mapper;
|
||||||
private readonly ILoginService _loginService;
|
private readonly ILoginService _loginService;
|
||||||
@@ -60,13 +60,10 @@ namespace WMS.Web.Domain.Services
|
|||||||
entity.Create(loginInfo.UserInfo.StaffId);
|
entity.Create(loginInfo.UserInfo.StaffId);
|
||||||
entity = await _backRecordRepositories.Add(entity, isTransaction);
|
entity = await _backRecordRepositories.Add(entity, isTransaction);
|
||||||
|
|
||||||
//提交事务
|
|
||||||
var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction);
|
|
||||||
if (!isSuccess)
|
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
|
||||||
|
|
||||||
if (entity != null)
|
|
||||||
{
|
if (entity == null)
|
||||||
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
//保存成功后:序列号跟踪流程添加
|
//保存成功后:序列号跟踪流程添加
|
||||||
var serialNumber_result = await _serialNumberService.BackRecord(entity, loginInfo, isTransaction);
|
var serialNumber_result = await _serialNumberService.BackRecord(entity, loginInfo, isTransaction);
|
||||||
if (!serialNumber_result.IsSuccess)
|
if (!serialNumber_result.IsSuccess)
|
||||||
@@ -75,14 +72,16 @@ namespace WMS.Web.Domain.Services
|
|||||||
//保存成功后:变更库存
|
//保存成功后:变更库存
|
||||||
var entitys = new List<BackRecord>();
|
var entitys = new List<BackRecord>();
|
||||||
entitys.Add(entity);
|
entitys.Add(entity);
|
||||||
var boxInventoryResult= await _boxInventoryService.GenerateBackBox(entitys, isTransaction);
|
var boxInventoryResult = await _boxInventoryService.GenerateBackBox(entitys, isTransaction);
|
||||||
if (!boxInventoryResult.IsSuccess)
|
if (!boxInventoryResult.IsSuccess)
|
||||||
return boxInventoryResult;
|
return boxInventoryResult;
|
||||||
|
|
||||||
return Result.ReSuccess();
|
//提交事务
|
||||||
}
|
var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction);
|
||||||
else
|
if (!isSuccess)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
return Result.ReSuccess();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,29 +229,10 @@ namespace WMS.Web.Domain.Services
|
|||||||
if (!serialNumber_result.IsSuccess)
|
if (!serialNumber_result.IsSuccess)
|
||||||
return serialNumber_result;
|
return serialNumber_result;
|
||||||
|
|
||||||
//保存成功后:变更箱库存
|
//箱库存变动
|
||||||
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
var dtoDatas = new List<InStock>();
|
||||||
{
|
dtoDatas.Add(entity);
|
||||||
InventoryInOutMethod = (int)InventoryInOutMethod.Box,
|
var boxInventoryResult = await _boxInventoryService.GenerateInStockBox(dtoDatas, isTransaction);
|
||||||
InventoryInOutType = (int)InventoryInOutType.In,
|
|
||||||
BoxId = x.Key.BoxId,
|
|
||||||
StockCode = x.Key.StockCode,
|
|
||||||
SubStockId = x.Key.SubStockId
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
foreach (var item in dto.Details)
|
|
||||||
{
|
|
||||||
var current = boxInventoryGenerateDto.Where(x => x.BoxId == item.BoxId).FirstOrDefault();
|
|
||||||
if (current != null)
|
|
||||||
{
|
|
||||||
var detail = new BoxInventoryGenerateDetailsDto();
|
|
||||||
detail.MaterialId = item.MaterialId;
|
|
||||||
detail.Qty = item.Qty;
|
|
||||||
detail.SerialNumbers = item.SerialNumbers;
|
|
||||||
current.Details.Add(detail);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
|
||||||
if (!boxInventoryResult.IsSuccess)
|
if (!boxInventoryResult.IsSuccess)
|
||||||
return boxInventoryResult;
|
return boxInventoryResult;
|
||||||
|
|
||||||
@@ -335,20 +316,10 @@ namespace WMS.Web.Domain.Services
|
|||||||
if (!serialNumber_result.IsSuccess)
|
if (!serialNumber_result.IsSuccess)
|
||||||
return serialNumber_result;
|
return serialNumber_result;
|
||||||
|
|
||||||
//7.箱库存的变更
|
//箱库存变动
|
||||||
//7.1组装头部和明细
|
var dtoDatas = new List<InStock>();
|
||||||
var boxInventoryGenerateDto = dto.Boxs.Select(item => new BoxInventoryGenerateDto()
|
dtoDatas.Add(entity);
|
||||||
{
|
var boxInventoryResult = await _boxInventoryService.GenerateInStockBox(dtoDatas, isTransaction);
|
||||||
InventoryInOutMethod = dto.ShelfMethod == (int)ShelfMethod.Product ? (int)InventoryInOutMethod.Box : (int)InventoryInOutMethod.Product,
|
|
||||||
InventoryInOutType = (int)InventoryInOutType.In,
|
|
||||||
BoxId = item.BoxId,
|
|
||||||
StockCode = dto.StockCode,
|
|
||||||
SubStockId = dto.SubStockId,
|
|
||||||
Details = _mapper.Map<List<BoxInventoryGenerateDetailsDto>>(item.Details)
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
//7.2执行处理箱库存
|
|
||||||
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
|
||||||
if (!boxInventoryResult.IsSuccess)
|
if (!boxInventoryResult.IsSuccess)
|
||||||
return boxInventoryResult;
|
return boxInventoryResult;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user