接口调整
This commit is contained in:
@@ -1175,9 +1175,9 @@
|
||||
单据ID(等同-入库任务单ID)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsRequest.BoxBillNo">
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsRequest.BoxBillNos">
|
||||
<summary>
|
||||
箱号
|
||||
箱号集合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsResponse">
|
||||
@@ -1185,26 +1185,51 @@
|
||||
采购订单物料明细和箱物料明细-对比影响对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsResponse.TotalCount">
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastMaterialsResponse.Boxs">
|
||||
<summary>
|
||||
箱号明细数量的总和
|
||||
多个箱的信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.BoxBaseDto">
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.ContrastBoxResponse">
|
||||
<summary>
|
||||
收货和上架需要用的箱的基本信息-对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.BoxBaseDto.BoxId">
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxResponse.BoxId">
|
||||
<summary>
|
||||
箱号ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.BoxBaseDto.BoxBillNo">
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxResponse.BoxBillNo">
|
||||
<summary>
|
||||
箱号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxResponse.TotalCount">
|
||||
<summary>
|
||||
箱号明细数量的总和
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxResponse.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.ContrastBoxDetailsResponse">
|
||||
<summary>
|
||||
箱明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxDetailsResponse.MaterialId">
|
||||
<summary>
|
||||
物料
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.ContrastBoxDetailsResponse.Qty">
|
||||
<summary>
|
||||
数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.InStockTask.InStockTaskBillNoQueryRequest">
|
||||
<summary>
|
||||
模糊查询来源单据-请求对象
|
||||
@@ -1765,6 +1790,11 @@
|
||||
上架方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Boxs">
|
||||
<summary>
|
||||
箱信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStock.NoPurchaseShelfRequest.Details">
|
||||
<summary>
|
||||
入库单明细
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
创建时间(对应老OPS的创建时间)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Entitys.Box.Details">
|
||||
<member name="P:WMS.Web.Domain.Entitys.Box.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
|
||||
@@ -23,6 +23,11 @@ namespace WMS.Web.Core.Dto.InStock
|
||||
[Required(ErrorMessage = "上架方式不能为空")]
|
||||
public int ShelfMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱信息
|
||||
/// </summary>
|
||||
public List<UpdateInStockTaskBoxRequest> Boxs { get; set; } = new List<UpdateInStockTaskBoxRequest>();
|
||||
|
||||
/// <summary>
|
||||
/// 入库单明细
|
||||
/// </summary>
|
||||
|
||||
@@ -18,9 +18,8 @@ namespace WMS.Web.Core.Dto.InStockTask
|
||||
public int TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// 箱号集合
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "箱号不能为空")]
|
||||
public string BoxBillNo { get; set; }
|
||||
public List<string> BoxBillNos { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,18 +7,18 @@ namespace WMS.Web.Core.Dto.InStockTask
|
||||
/// <summary>
|
||||
/// 采购订单物料明细和箱物料明细-对比影响对象
|
||||
/// </summary>
|
||||
public class ContrastMaterialsResponse:BoxBaseDto
|
||||
public class ContrastMaterialsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱号明细数量的总和
|
||||
/// 多个箱的信息
|
||||
/// </summary>
|
||||
public decimal TotalCount { get; set; }
|
||||
public List<ContrastBoxResponse> Boxs { get; set; } = new List<ContrastBoxResponse>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 收货和上架需要用的箱的基本信息-对象
|
||||
/// </summary>
|
||||
public class BoxBaseDto
|
||||
public class ContrastBoxResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱号ID
|
||||
@@ -29,5 +29,31 @@ namespace WMS.Web.Core.Dto.InStockTask
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string BoxBillNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号明细数量的总和
|
||||
/// </summary>
|
||||
public decimal TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<ContrastBoxDetailsResponse> Details { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 箱明细
|
||||
/// </summary>
|
||||
public class ContrastBoxDetailsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal Qty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<BoxDetails> Details = new List<BoxDetails>();
|
||||
public List<BoxDetails> Details { get; set; } = new List<BoxDetails>();
|
||||
|
||||
//移出
|
||||
public Result Out(List<(int MaterialId, decimal Qty, List<string> SerialNumbers)> list)
|
||||
|
||||
@@ -29,5 +29,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
Task<bool> AddRange(List<Box> entitys, bool isTransaction = true);
|
||||
/// 查询实体集合
|
||||
Task<List<Box>> GetEntityList(List<int> ids);
|
||||
|
||||
Task<List<Box>> GetEntityListByNos(List<string> billNos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,10 @@ namespace WMS.Web.Domain.Mappers
|
||||
CreateMap<InStockTaskDetails, InStockTaskDetailsInfoDto>();
|
||||
|
||||
|
||||
CreateMap<BoxDetails, ContrastBoxDetailsResponse>();
|
||||
|
||||
|
||||
|
||||
#region ERP-dto映射到wsm的任务表中
|
||||
//ERP-同步结果对象统一映射
|
||||
CreateMap<ErpInStockResultDto, InStockTask>()
|
||||
|
||||
@@ -249,6 +249,7 @@ namespace WMS.Web.Domain.Services
|
||||
//1.修改-入库任务单的信息
|
||||
var updateInStockTaskRequest = new UpdateInStockTaskRequest();
|
||||
updateInStockTaskRequest.Id = dto.TaskId;
|
||||
updateInStockTaskRequest.Boxs = dto.Boxs;
|
||||
updateInStockTaskRequest.Details = new List<UpdateInStockTaskDetailsRequest>();
|
||||
foreach (var item in dto.Details)
|
||||
{
|
||||
@@ -259,14 +260,14 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
//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);
|
||||
}
|
||||
//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.修改入库任务单
|
||||
var update_result = await this.Update(updateInStockTaskRequest, loginInfo.UserInfo.StaffId, null, isTransaction, true);
|
||||
@@ -419,26 +420,40 @@ namespace WMS.Web.Domain.Services
|
||||
var task = await _inStockTaskRepositories.Get(dto.TaskId);
|
||||
if (task == null)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.OrderNoData);
|
||||
//2.找到箱对应的物料信息
|
||||
var box = await _boxRepositories.GetByNo(dto.BoxBillNo);
|
||||
if (box == null)
|
||||
////2.找到箱对应的物料信息--弃用(这个是单个箱)
|
||||
//var box = await _boxRepositories.GetByNo(dto.BoxBillNo);
|
||||
//if (box == null)
|
||||
// return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
|
||||
|
||||
//2.找到箱对应的物料信息:多个箱
|
||||
var boxs = await _boxRepositories.GetEntityListByNos(dto.BoxBillNos);
|
||||
if (boxs == null || boxs.Count==0)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxNoData);
|
||||
|
||||
//合并多个箱明细的数据:相同物料数量合并
|
||||
var boxDetails = boxs.SelectMany(x => x.Details).GroupBy(x => x.MaterialId).Select(x => new { MaterialId = x.Key, Qty = x.Sum(t => t.Qty) }).ToList();
|
||||
|
||||
//3.比对:false为比对失败;
|
||||
bool isRight = box.Details.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && box.Details.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)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
|
||||
|
||||
//4.是否任务单存在绑定箱号判断:存在的话,就不能收货或者非采购上架
|
||||
bool isHave = task.Boxs.Where(x => x.BoxBillNo == box.BoxBillNo).Any();
|
||||
bool isHave = task.Boxs.Where(x => dto.BoxBillNos.Contains(x.BoxBillNo)).Any();
|
||||
if(isHave)
|
||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
|
||||
|
||||
//4.返回对比结果:true为比对成功,并把箱ID和箱号返回
|
||||
var response = new ContrastMaterialsResponse();
|
||||
response.BoxBillNo = box.BoxBillNo;
|
||||
response.BoxId = box.Id;
|
||||
response.TotalCount = box.Details.Sum(x => x.Qty);
|
||||
|
||||
foreach (var box in boxs)
|
||||
{
|
||||
var r_box = new ContrastBoxResponse();
|
||||
r_box.BoxBillNo = box.BoxBillNo;
|
||||
r_box.BoxId = box.Id;
|
||||
r_box.TotalCount = box.Details.Sum(x => x.Qty);
|
||||
r_box.Details =_mapper.Map<List<ContrastBoxDetailsResponse>>( box.Details);
|
||||
}
|
||||
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,13 @@ namespace WMS.Web.Repositories
|
||||
|
||||
return entity.Clone();
|
||||
}
|
||||
public async Task<List<Box>> GetEntityListByNos(List<string> billNos)
|
||||
{
|
||||
var entity = await _context.Box.Include(x => x.Details)
|
||||
.Where(f => billNos.Contains(f.BoxBillNo)).ToListAsync();
|
||||
|
||||
return entity.Clone();
|
||||
}
|
||||
//根据箱号搜索 用来比对确定是否箱号信息是否存在
|
||||
public async Task<List<string>> GetByNos(List<string> billNos)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user