非采购上架接口优化
This commit is contained in:
@@ -1790,16 +1790,61 @@
|
|||||||
上架方式
|
上架方式
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.StockCode">
|
||||||
|
<summary>
|
||||||
|
仓库编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.SubStockId">
|
||||||
|
<summary>
|
||||||
|
仓位ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Boxs">
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Boxs">
|
||||||
<summary>
|
<summary>
|
||||||
箱信息
|
箱信息
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Details">
|
<member name="T:WMS.Web.Core.Dto.InStock.NoPurchaseShelfBoxRequest">
|
||||||
|
<summary>
|
||||||
|
箱
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfBoxRequest.BoxId">
|
||||||
|
<summary>
|
||||||
|
箱信息ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfBoxRequest.BoxBillNo">
|
||||||
|
<summary>
|
||||||
|
箱号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfBoxRequest.Details">
|
||||||
<summary>
|
<summary>
|
||||||
入库单明细
|
入库单明细
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest">
|
||||||
|
<summary>
|
||||||
|
明细
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest.MaterialId">
|
||||||
|
<summary>
|
||||||
|
物料Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest.Qty">
|
||||||
|
<summary>
|
||||||
|
入库数量
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfDetailsRequest.SerialNumbers">
|
||||||
|
<summary>
|
||||||
|
序列号集
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Core.Dto.InStock.PurchaseShelfRequest">
|
<member name="T:WMS.Web.Core.Dto.InStock.PurchaseShelfRequest">
|
||||||
<summary>
|
<summary>
|
||||||
采购上架-请求对象
|
采购上架-请求对象
|
||||||
|
|||||||
@@ -23,14 +23,64 @@ namespace WMS.Web.Core.Dto.InStock
|
|||||||
[Required(ErrorMessage = "上架方式不能为空")]
|
[Required(ErrorMessage = "上架方式不能为空")]
|
||||||
public int ShelfMethod { get; set; }
|
public int ShelfMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库编码
|
||||||
|
///</summary>
|
||||||
|
[Required(ErrorMessage = "仓库不能为空")]
|
||||||
|
public string StockCode { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 仓位ID
|
||||||
|
///</summary>
|
||||||
|
[Required(ErrorMessage = " 仓位不能为空")]
|
||||||
|
public int SubStockId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箱信息
|
/// 箱信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<UpdateInStockTaskBoxRequest> Boxs { get; set; } = new List<UpdateInStockTaskBoxRequest>();
|
public List<NoPurchaseShelfBoxRequest> Boxs { get; set; } = new List<NoPurchaseShelfBoxRequest>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱
|
||||||
|
/// </summary>
|
||||||
|
public class NoPurchaseShelfBoxRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 箱信息ID
|
||||||
|
/// </summary>
|
||||||
|
public int BoxId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 箱号
|
||||||
|
/// </summary>
|
||||||
|
public string BoxBillNo { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库单明细
|
/// 入库单明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SaveInStockDetailsRequest> Details { get; set; } = new List<SaveInStockDetailsRequest>();
|
public List<NoPurchaseShelfDetailsRequest> Details { get; set; } = new List<NoPurchaseShelfDetailsRequest>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 明细
|
||||||
|
/// </summary>
|
||||||
|
public class NoPurchaseShelfDetailsRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料Id
|
||||||
|
///</summary>
|
||||||
|
[Required(ErrorMessage = "物料不能为空")]
|
||||||
|
public int MaterialId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库数量
|
||||||
|
///</summary>
|
||||||
|
[Required(ErrorMessage = "入库数量不能为空")]
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序列号集
|
||||||
|
/// </summary>
|
||||||
|
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using WMS.Web.Core.Dto.Erp;
|
using WMS.Web.Core.Dto.Erp;
|
||||||
using WMS.Web.Core.Dto.InStock;
|
using WMS.Web.Core.Dto.InStock;
|
||||||
using WMS.Web.Core.Dto.InStockTask;
|
using WMS.Web.Core.Dto.InStockTask;
|
||||||
|
using WMS.Web.Core.Dto.Inventory;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Mappers
|
namespace WMS.Web.Domain.Mappers
|
||||||
@@ -30,6 +31,9 @@ namespace WMS.Web.Domain.Mappers
|
|||||||
|
|
||||||
|
|
||||||
CreateMap<SaveInStockDetailsRequest, InStockDetails>().ReverseMap();
|
CreateMap<SaveInStockDetailsRequest, InStockDetails>().ReverseMap();
|
||||||
|
CreateMap<NoPurchaseShelfDetailsRequest, InStockDetails>().ReverseMap();
|
||||||
|
CreateMap<NoPurchaseShelfDetailsRequest, BoxInventoryGenerateDetailsDto>();
|
||||||
|
|
||||||
|
|
||||||
CreateMap<InStockTask, InStockTaskInfoDto>()
|
CreateMap<InStockTask, InStockTaskInfoDto>()
|
||||||
.ForMember(x => x.Details, ops => ops.Ignore());
|
.ForMember(x => x.Details, ops => ops.Ignore());
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
private readonly IInStockRepositories _inStockRepositories;
|
private readonly IInStockRepositories _inStockRepositories;
|
||||||
private readonly IInStockTaskRepositories _inStockTaskRepositories;
|
private readonly IInStockTaskRepositories _inStockTaskRepositories;
|
||||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||||
public InStockService(IMapper mapper, IErpService erpService, IBoxInventoryService boxInventoryService,ISerialNumberService serialNumberService, ILoginService loginService, IBoxRepositories boxRepositories,
|
public InStockService(IMapper mapper, IErpService erpService, IBoxInventoryService boxInventoryService, ISerialNumberService serialNumberService, ILoginService loginService, IBoxRepositories boxRepositories,
|
||||||
IBasicsRepositories basicsRepositories, IErpBasicDataExtendService erpBasicDataExtendService, IChangeMoveBoxService changeMoveBoxService,
|
IBasicsRepositories basicsRepositories, IErpBasicDataExtendService erpBasicDataExtendService, IChangeMoveBoxService changeMoveBoxService,
|
||||||
IInStockRepositories inStockRepositories, IInStockTaskRepositories inStockTaskRepositories)
|
IInStockRepositories inStockRepositories, IInStockTaskRepositories inStockTaskRepositories)
|
||||||
{
|
{
|
||||||
@@ -76,7 +76,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
IDbContextTransaction _transaction = _basicsRepositories.GetTransaction();
|
IDbContextTransaction _transaction = _basicsRepositories.GetTransaction();
|
||||||
bool isRollback = false;
|
bool isRollback = false;
|
||||||
bool isTransaction = false;
|
bool isTransaction = false;
|
||||||
var result = await this.Update(dto, loginInfo.UserInfo.StaffId,true, isTransaction);
|
var result = await this.Update(dto, loginInfo.UserInfo.StaffId, true, isTransaction);
|
||||||
if (!result.IsSuccess) isRollback = true;
|
if (!result.IsSuccess) isRollback = true;
|
||||||
|
|
||||||
//提交事务
|
//提交事务
|
||||||
@@ -122,14 +122,14 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <param name="dto"></param>
|
/// <param name="dto"></param>
|
||||||
/// <param name="loginInDto"></param>
|
/// <param name="loginInDto"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<Result> ShelfNoPurchase(NoPurchaseShelfRequest dto,LoginInDto loginInDto)
|
public async Task<Result> ShelfNoPurchase(NoPurchaseShelfRequest dto, LoginInDto loginInDto)
|
||||||
{
|
{
|
||||||
IDbContextTransaction _transaction = _basicsRepositories.GetTransaction();
|
IDbContextTransaction _transaction = _basicsRepositories.GetTransaction();
|
||||||
bool isRollback = false;
|
bool isRollback = false;
|
||||||
bool isTransaction = false;
|
bool isTransaction = false;
|
||||||
//保存非采购上架的数据
|
//保存非采购上架的数据
|
||||||
var shelfSave_result = await this.ShelfNoPurchaseSave(dto, loginInDto, isTransaction);
|
var shelfSave_result = await this.ShelfNoPurchaseSave(dto, loginInDto, isTransaction);
|
||||||
if(!shelfSave_result.IsSuccess) isRollback = true;
|
if (!shelfSave_result.IsSuccess) isRollback = true;
|
||||||
//提交事务
|
//提交事务
|
||||||
var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction);
|
var isSuccess = _basicsRepositories.CommitTransaction(isRollback, _transaction);
|
||||||
if (!isSuccess)
|
if (!isSuccess)
|
||||||
@@ -151,13 +151,13 @@ namespace WMS.Web.Domain.Services
|
|||||||
materials = materials_result.Data.ToList();
|
materials = materials_result.Data.ToList();
|
||||||
|
|
||||||
//1.先判断:箱号已经绑定了入库任务单中;备注:业务说法就是箱是否收货了
|
//1.先判断:箱号已经绑定了入库任务单中;备注:业务说法就是箱是否收货了
|
||||||
var tast= await _inStockTaskRepositories.GetBy(boxBillNo);
|
var tast = await _inStockTaskRepositories.GetBy(boxBillNo);
|
||||||
if (tast==null)
|
if (tast == null)
|
||||||
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
|
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
|
||||||
|
|
||||||
//2.找到箱对应的物料信息
|
//2.找到箱对应的物料信息
|
||||||
var box= await _boxRepositories.GetByNo(boxBillNo);
|
var box = await _boxRepositories.GetByNo(boxBillNo);
|
||||||
if(box==null)
|
if (box == null)
|
||||||
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.BoxNoData);
|
return Result<InStockTaskInfoDto>.ReFailure(ResultCodes.BoxNoData);
|
||||||
|
|
||||||
//3.组装返回数据
|
//3.组装返回数据
|
||||||
@@ -202,18 +202,18 @@ namespace WMS.Web.Domain.Services
|
|||||||
if (entity != null)
|
if (entity != null)
|
||||||
{
|
{
|
||||||
//保存成功后:序列号跟踪流程添加
|
//保存成功后:序列号跟踪流程添加
|
||||||
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()
|
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,
|
||||||
BoxId=x.Key.BoxId,
|
BoxId = x.Key.BoxId,
|
||||||
StockCode=x.Key.StockCode,
|
StockCode = x.Key.StockCode,
|
||||||
SubStockId=x.Key.SubStockId
|
SubStockId = x.Key.SubStockId
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
foreach (var item in dto.Details)
|
foreach (var item in dto.Details)
|
||||||
@@ -246,51 +246,55 @@ 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 task = await _inStockTaskRepositories.Get(dto.TaskId);
|
||||||
updateInStockTaskRequest.Id = dto.TaskId;
|
if (task == null)
|
||||||
updateInStockTaskRequest.Boxs = dto.Boxs;
|
return Result.ReFailure(ResultCodes.SourceBillNoDateError);
|
||||||
updateInStockTaskRequest.Details = new List<UpdateInStockTaskDetailsRequest>();
|
|
||||||
foreach (var item in dto.Details)
|
|
||||||
{
|
|
||||||
var updateInStockTaskDetailsRequest = new UpdateInStockTaskDetailsRequest();
|
|
||||||
updateInStockTaskDetailsRequest.MaterialId = item.MaterialId;
|
|
||||||
updateInStockTaskDetailsRequest.ReceiveQty = item.Qty;
|
|
||||||
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);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//1.2.修改入库任务单
|
//2.生成:入库单
|
||||||
var update_result = await this.Update(updateInStockTaskRequest, loginInfo.UserInfo.StaffId, null, isTransaction, true);
|
|
||||||
if (!update_result.IsSuccess)
|
|
||||||
return update_result;
|
|
||||||
|
|
||||||
//2.入库单生成
|
|
||||||
var entity = new InStock();
|
var entity = new InStock();
|
||||||
entity.Type = update_result.Data.Type;
|
entity.Type = task.Type;
|
||||||
entity.Details = _mapper.Map<List<InStockDetails>>(dto.Details);
|
entity.Details = new List<InStockDetails>();
|
||||||
|
|
||||||
|
var temps=new List<InStockDetails>();
|
||||||
|
//3.遍历:box信息,并拼装入库单明细
|
||||||
|
foreach (var box in dto.Boxs)
|
||||||
|
{
|
||||||
|
//3.1先数据映射
|
||||||
|
var dets = _mapper.Map<List<InStockDetails>>(box.Details);
|
||||||
|
//3.2遍历赋值:boxID和仓库和仓位和来源单和供应商和组织
|
||||||
|
dets.ForEach(item =>
|
||||||
|
{
|
||||||
|
item.TaskId = dto.TaskId;
|
||||||
|
item.SourceBillNo = task.SourceBillNo;
|
||||||
|
item.BoxId = box.BoxId;
|
||||||
|
item.SubStockId = dto.SubStockId;
|
||||||
|
item.StockCode = dto.StockCode;
|
||||||
|
|
||||||
|
var taskDet= task.Details.Where(x => x.MaterialId == item.MaterialId).FirstOrDefault();
|
||||||
|
item.SupplierId = taskDet.SupplierId;
|
||||||
|
item.OrgId = taskDet.OrgId;
|
||||||
|
});
|
||||||
|
//3.3添加到临时集合中
|
||||||
|
temps.AddRange(dets);
|
||||||
|
}
|
||||||
|
//3.4给对象明细赋值
|
||||||
|
entity.Details = temps;
|
||||||
|
//4.创建
|
||||||
entity.Create(loginInfo.UserInfo.StaffId);
|
entity.Create(loginInfo.UserInfo.StaffId);
|
||||||
|
|
||||||
//2.1保存入库单信息
|
//5.1保存入库单信息
|
||||||
entity = await _inStockRepositories.Add(entity, isTransaction);
|
entity = await _inStockRepositories.Add(entity, isTransaction);
|
||||||
if(entity==null)
|
if (entity == null)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
//2.2当按产品上架:就要调用改箱的操作;
|
//6.当按产品上架:就要调用改箱的操作;
|
||||||
if (dto.ShelfMethod == (int)ShelfMethod.Product)
|
if (dto.ShelfMethod == (int)ShelfMethod.Product)
|
||||||
{
|
{
|
||||||
|
var dto_box = dto.Boxs.FirstOrDefault();
|
||||||
var changeBox = new SaveChangeBoxRecordRequest();
|
var changeBox = new SaveChangeBoxRecordRequest();
|
||||||
changeBox.DestBoxId = boxIds.FirstOrDefault();
|
changeBox.DestBoxId = dto_box.BoxId;
|
||||||
foreach (var item in dto.Details)
|
foreach (var item in dto_box.Details)
|
||||||
{
|
{
|
||||||
var changeBoxRD = new SaveChangeBoxRecordDetailsRequest();
|
var changeBoxRD = new SaveChangeBoxRecordDetailsRequest();
|
||||||
changeBoxRD.MaterialId = item.MaterialId;
|
changeBoxRD.MaterialId = item.MaterialId;
|
||||||
@@ -303,35 +307,24 @@ namespace WMS.Web.Domain.Services
|
|||||||
return changeBoxSave_Result;
|
return changeBoxSave_Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//2.3序列号跟踪流程添加;备注:和上面的改箱操作后会记录序列号轨迹不冲突;
|
//6.1序列号跟踪流程添加;备注:和上面的改箱操作后会记录序列号轨迹不冲突;
|
||||||
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;
|
||||||
|
|
||||||
//3.箱库存的变更
|
//7.箱库存的变更
|
||||||
//3.1组装头部
|
//7.1组装头部和明细
|
||||||
var boxInventoryGenerateDto = dto.Details.GroupBy(x => new { x.BoxId, x.StockCode, x.SubStockId }).Select(x => new BoxInventoryGenerateDto()
|
var boxInventoryGenerateDto = dto.Boxs.Select(item => new BoxInventoryGenerateDto()
|
||||||
{
|
{
|
||||||
InventoryInOutMethod = dto.ShelfMethod == (int)ShelfMethod.Product?(int)InventoryInOutMethod.Box: (int)InventoryInOutMethod.Product,
|
InventoryInOutMethod = dto.ShelfMethod == (int)ShelfMethod.Product ? (int)InventoryInOutMethod.Box : (int)InventoryInOutMethod.Product,
|
||||||
InventoryInOutType = (int)InventoryInOutType.In,
|
InventoryInOutType = (int)InventoryInOutType.In,
|
||||||
BoxId = x.Key.BoxId,
|
BoxId = item.BoxId,
|
||||||
StockCode = x.Key.StockCode,
|
StockCode = dto.StockCode,
|
||||||
SubStockId = x.Key.SubStockId
|
SubStockId = dto.SubStockId,
|
||||||
|
Details = _mapper.Map<List<BoxInventoryGenerateDetailsDto>>(item.Details)
|
||||||
}).ToList();
|
}).ToList();
|
||||||
//3.2组装明细
|
|
||||||
foreach (var item in dto.Details)
|
//7.2执行处理箱库存
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//3.3执行处理箱库存
|
|
||||||
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
var boxInventoryResult = await _boxInventoryService.HandlBoxInventory(boxInventoryGenerateDto, isTransaction);
|
||||||
if (!boxInventoryResult.IsSuccess)
|
if (!boxInventoryResult.IsSuccess)
|
||||||
return boxInventoryResult;
|
return boxInventoryResult;
|
||||||
@@ -347,7 +340,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
/// <param name="isReceive"></param>
|
/// <param name="isReceive"></param>
|
||||||
/// <param name="isTransaction"></param>
|
/// <param name="isTransaction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<Result<InStockTask>> Update(UpdateInStockTaskRequest dto, int staffId,bool? isReceive, bool isTransaction = true,bool isNoPurchaseShelf=false)
|
public async Task<Result<InStockTask>> Update(UpdateInStockTaskRequest dto, int staffId, bool? isReceive, bool isTransaction = true, bool isNoPurchaseShelf = false)
|
||||||
{
|
{
|
||||||
var entity = await _inStockTaskRepositories.Get(dto.Id);
|
var entity = await _inStockTaskRepositories.Get(dto.Id);
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
@@ -374,7 +367,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
else
|
else
|
||||||
entity.Shelf(staffId);
|
entity.Shelf(staffId);
|
||||||
}
|
}
|
||||||
var result =await _inStockTaskRepositories.Update(entity, isTransaction);
|
var result = await _inStockTaskRepositories.Update(entity, isTransaction);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
return Result<InStockTask>.ReSuccess(entity);
|
return Result<InStockTask>.ReSuccess(entity);
|
||||||
else
|
else
|
||||||
@@ -392,7 +385,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
public async Task<Result> UpdateRange(List<int> ids, int staffId, bool isReceive, bool isTransaction = true)
|
public async Task<Result> UpdateRange(List<int> ids, int staffId, bool isReceive, bool isTransaction = true)
|
||||||
{
|
{
|
||||||
var entitys = await _inStockTaskRepositories.GetList(ids);
|
var entitys = await _inStockTaskRepositories.GetList(ids);
|
||||||
if (entitys == null || entitys.Count==0)
|
if (entitys == null || entitys.Count == 0)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
foreach (var item in entitys)
|
foreach (var item in entitys)
|
||||||
@@ -427,7 +420,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
|
|
||||||
//2.找到箱对应的物料信息:多个箱
|
//2.找到箱对应的物料信息:多个箱
|
||||||
var boxs = await _boxRepositories.GetEntityListByNos(dto.BoxBillNos);
|
var boxs = await _boxRepositories.GetEntityListByNos(dto.BoxBillNos);
|
||||||
if (boxs == null || boxs.Count==0)
|
if (boxs == null || boxs.Count == 0)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
|
||||||
|
|
||||||
//合并多个箱明细的数据:相同物料数量合并
|
//合并多个箱明细的数据:相同物料数量合并
|
||||||
@@ -435,12 +428,12 @@ namespace WMS.Web.Domain.Services
|
|||||||
|
|
||||||
//3.比对:false为比对失败;
|
//3.比对:false为比对失败;
|
||||||
bool isRight = boxDetails.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count == task.Details.Count;
|
bool isRight = boxDetails.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count == task.Details.Count;
|
||||||
if(!isRight)
|
if (!isRight)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
|
||||||
|
|
||||||
//4.是否任务单存在绑定箱号判断:存在的话,就不能收货或者非采购上架
|
//4.是否任务单存在绑定箱号判断:存在的话,就不能收货或者非采购上架
|
||||||
bool isHave = task.Boxs.Where(x => dto.BoxBillNos.Contains(x.BoxBillNo)).Any();
|
bool isHave = task.Boxs.Where(x => dto.BoxBillNos.Contains(x.BoxBillNo)).Any();
|
||||||
if(isHave)
|
if (isHave)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
|
||||||
|
|
||||||
//4.返回对比结果:true为比对成功,并把箱ID和箱号返回
|
//4.返回对比结果:true为比对成功,并把箱ID和箱号返回
|
||||||
@@ -452,7 +445,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
r_box.BoxBillNo = box.BoxBillNo;
|
r_box.BoxBillNo = box.BoxBillNo;
|
||||||
r_box.BoxId = box.Id;
|
r_box.BoxId = box.Id;
|
||||||
r_box.TotalCount = box.Details.Sum(x => x.Qty);
|
r_box.TotalCount = box.Details.Sum(x => x.Qty);
|
||||||
r_box.Details =_mapper.Map<List<ContrastBoxDetailsResponse>>( box.Details);
|
r_box.Details = _mapper.Map<List<ContrastBoxDetailsResponse>>(box.Details);
|
||||||
}
|
}
|
||||||
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ namespace WMS.Web.Domain.Values
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static ValueTuple<int, string> DateWriteError = (40004, "数据操作失败");
|
public static ValueTuple<int, string> DateWriteError = (40004, "数据操作失败");
|
||||||
public static ValueTuple<int, string> NoDateError = (40005, "数据不存在");
|
public static ValueTuple<int, string> NoDateError = (40005, "数据不存在");
|
||||||
|
public static ValueTuple<int, string> SourceBillNoDateError = (40005, "来源单不存在,请核对后再试");
|
||||||
|
|
||||||
//出库任务单
|
//出库任务单
|
||||||
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
|
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
|
||||||
|
|||||||
Reference in New Issue
Block a user