非采购上架-箱库存变更
This commit is contained in:
@@ -1765,11 +1765,6 @@
|
|||||||
上架方式
|
上架方式
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Boxs">
|
|
||||||
<summary>
|
|
||||||
箱集合
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Details">
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Details">
|
||||||
<summary>
|
<summary>
|
||||||
入库单明细
|
入库单明细
|
||||||
|
|||||||
@@ -23,11 +23,6 @@ namespace WMS.Web.Core.Dto.InStock
|
|||||||
[Required(ErrorMessage = "上架方式不能为空")]
|
[Required(ErrorMessage = "上架方式不能为空")]
|
||||||
public int ShelfMethod { get; set; }
|
public int ShelfMethod { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 箱集合
|
|
||||||
/// </summary>
|
|
||||||
public List<UpdateInStockTaskBoxRequest> Boxs { get; set; } = new List<UpdateInStockTaskBoxRequest>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库单明细
|
/// 入库单明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
return serialNumber_result;
|
return serialNumber_result;
|
||||||
|
|
||||||
//保存成功后:变更箱库存
|
//保存成功后:变更箱库存
|
||||||
var boxInventoryGenerateDto = entity.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
||||||
{
|
{
|
||||||
InventoryInOutMethod= (int)InventoryInOutMethod.Box,
|
InventoryInOutMethod= (int)InventoryInOutMethod.Box,
|
||||||
InventoryInOutType=(int)InventoryInOutType.In,
|
InventoryInOutType=(int)InventoryInOutType.In,
|
||||||
@@ -246,12 +246,10 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<Result> ShelfNoPurchaseSave(NoPurchaseShelfRequest dto, LoginInDto loginInfo, bool isTransaction = true)
|
private async Task<Result> ShelfNoPurchaseSave(NoPurchaseShelfRequest dto, LoginInDto loginInfo, bool isTransaction = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
//1.修改-入库任务单的信息
|
//1.修改-入库任务单的信息
|
||||||
var updateInStockTaskRequest = new UpdateInStockTaskRequest();
|
var updateInStockTaskRequest = new UpdateInStockTaskRequest();
|
||||||
updateInStockTaskRequest.Id = dto.TaskId;
|
updateInStockTaskRequest.Id = dto.TaskId;
|
||||||
updateInStockTaskRequest.Boxs = dto.Boxs;
|
updateInStockTaskRequest.Details = new List<UpdateInStockTaskDetailsRequest>();
|
||||||
updateInStockTaskRequest.Details =new List<UpdateInStockTaskDetailsRequest>();
|
|
||||||
foreach (var item in dto.Details)
|
foreach (var item in dto.Details)
|
||||||
{
|
{
|
||||||
var updateInStockTaskDetailsRequest = new UpdateInStockTaskDetailsRequest();
|
var updateInStockTaskDetailsRequest = new UpdateInStockTaskDetailsRequest();
|
||||||
@@ -259,6 +257,16 @@ namespace WMS.Web.Domain.Services
|
|||||||
updateInStockTaskDetailsRequest.ReceiveQty = item.Qty;
|
updateInStockTaskDetailsRequest.ReceiveQty = item.Qty;
|
||||||
updateInStockTaskRequest.Details.Add(updateInStockTaskDetailsRequest);
|
updateInStockTaskRequest.Details.Add(updateInStockTaskDetailsRequest);
|
||||||
}
|
}
|
||||||
|
//1.1.先找到箱IDs:获取箱基本信息
|
||||||
|
var boxIds = dto.Details.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||||
|
var boxInfos= await _boxRepositories.GetEntityList(boxIds);
|
||||||
|
foreach (var item in boxInfos)
|
||||||
|
{
|
||||||
|
var task_box = new UpdateInStockTaskBoxRequest();
|
||||||
|
task_box.BoxId = item.Id;
|
||||||
|
task_box.BoxBillNo = item.BoxBillNo;
|
||||||
|
updateInStockTaskRequest.Boxs.Add(task_box);
|
||||||
|
}
|
||||||
|
|
||||||
//2.修改后返回当前实体
|
//2.修改后返回当前实体
|
||||||
var update_result = await this.Update(updateInStockTaskRequest, loginInfo.UserInfo.StaffId, null, isTransaction, true);
|
var update_result = await this.Update(updateInStockTaskRequest, loginInfo.UserInfo.StaffId, null, isTransaction, true);
|
||||||
@@ -271,10 +279,6 @@ namespace WMS.Web.Domain.Services
|
|||||||
entity.Details = _mapper.Map<List<InStockDetails>>(dto.Details);
|
entity.Details = _mapper.Map<List<InStockDetails>>(dto.Details);
|
||||||
entity.Create(loginInfo.UserInfo.StaffId);
|
entity.Create(loginInfo.UserInfo.StaffId);
|
||||||
|
|
||||||
//需要填写序列号
|
|
||||||
//需要修改库存
|
|
||||||
//需要同步金蝶
|
|
||||||
|
|
||||||
//添加入库单信息
|
//添加入库单信息
|
||||||
entity = await _inStockRepositories.Add(entity, isTransaction);
|
entity = await _inStockRepositories.Add(entity, isTransaction);
|
||||||
if(entity==null)
|
if(entity==null)
|
||||||
@@ -284,7 +288,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
if (dto.ShelfMethod == (int)ShelfMethod.Product)
|
if (dto.ShelfMethod == (int)ShelfMethod.Product)
|
||||||
{
|
{
|
||||||
var changeBox = new SaveChangeBoxRecordRequest();
|
var changeBox = new SaveChangeBoxRecordRequest();
|
||||||
changeBox.DestBoxId = dto.Boxs.FirstOrDefault().BoxId;
|
changeBox.DestBoxId = boxIds.FirstOrDefault();
|
||||||
foreach (var item in dto.Details)
|
foreach (var item in dto.Details)
|
||||||
{
|
{
|
||||||
var changeBoxRD = new SaveChangeBoxRecordDetailsRequest();
|
var changeBoxRD = new SaveChangeBoxRecordDetailsRequest();
|
||||||
@@ -302,6 +306,33 @@ namespace WMS.Web.Domain.Services
|
|||||||
var serialNumber_result = await _serialNumberService.InStock(entity, loginInfo, isTransaction);
|
var serialNumber_result = await _serialNumberService.InStock(entity, loginInfo, isTransaction);
|
||||||
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()
|
||||||
|
{
|
||||||
|
InventoryInOutMethod = dto.ShelfMethod == (int)ShelfMethod.Product?(int)InventoryInOutMethod.Box: (int)InventoryInOutMethod.Product,
|
||||||
|
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)
|
||||||
|
return boxInventoryResult;
|
||||||
|
|
||||||
return Result.ReSuccess();
|
return Result.ReSuccess();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -370,10 +401,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
}
|
}
|
||||||
var isSuccess = await _inStockTaskRepositories.UpdateRange(entitys, isTransaction);
|
var isSuccess = await _inStockTaskRepositories.UpdateRange(entitys, isTransaction);
|
||||||
if (isSuccess)
|
if (isSuccess)
|
||||||
{
|
|
||||||
|
|
||||||
return Result.ReSuccess();
|
return Result.ReSuccess();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user