优化接口
This commit is contained in:
@@ -1304,12 +1304,22 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OperatorId">
|
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OperatorId">
|
||||||
<summary>
|
<summary>
|
||||||
操作人(出库人)
|
操作人
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OperateTime">
|
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OperateTime">
|
||||||
<summary>
|
<summary>
|
||||||
操作时间(出库时间)
|
操作时间
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OutStockId">
|
||||||
|
<summary>
|
||||||
|
出库人
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.OutStockTime">
|
||||||
|
<summary>
|
||||||
|
出库时间
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.CreateTime">
|
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.CreateTime">
|
||||||
@@ -1322,7 +1332,7 @@
|
|||||||
明细
|
明细
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:WMS.Web.Domain.Entitys.OutStockTask.OutStock(System.Int32,System.Decimal)">
|
<member name="M:WMS.Web.Domain.Entitys.OutStockTask.OutStock(System.Int32,System.Decimal,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
出库 反写 任务单(返回 这个物料下面的来源单号出了多少数量)
|
出库 反写 任务单(返回 这个物料下面的来源单号出了多少数量)
|
||||||
</summary>
|
</summary>
|
||||||
|
|||||||
@@ -151,13 +151,13 @@ namespace WMS.Web.Domain.Services
|
|||||||
materials = materials_result.Data.ToList();
|
materials = materials_result.Data.ToList();
|
||||||
|
|
||||||
//1.先判断:箱号已经绑定了入库任务单中;备注:业务说法就是箱是否收货了
|
//1.先判断:箱号已经绑定了入库任务单中;备注:业务说法就是箱是否收货了
|
||||||
var tast_box= await _inStockTaskBoxRepositories.GetBy(dto.BoxBillNo);
|
var tast_box = await _inStockTaskBoxRepositories.GetBy(dto.BoxBillNo);
|
||||||
if (tast_box == null)
|
if (tast_box == null)
|
||||||
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
|
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.Box_NoBind_Task_Data);
|
||||||
|
|
||||||
//1.2找到任务单
|
//1.2找到任务单
|
||||||
var tast = await _inStockTaskRepositories.Get(tast_box.TaskId);
|
var tast = await _inStockTaskRepositories.Get(tast_box.TaskId);
|
||||||
if(tast == null)
|
if (tast == null)
|
||||||
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.InStockTaskNoData);
|
return Result<BoxInStockTaskDto>.ReFailure(ResultCodes.InStockTaskNoData);
|
||||||
|
|
||||||
//1.2.1判断箱子绑定的物料明细数据的仓库,是不是用户所选的仓库;不是则提示:箱号仓库不对
|
//1.2.1判断箱子绑定的物料明细数据的仓库,是不是用户所选的仓库;不是则提示:箱号仓库不对
|
||||||
@@ -251,7 +251,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
{
|
{
|
||||||
task.Details.ForEach(x =>
|
task.Details.ForEach(x =>
|
||||||
{
|
{
|
||||||
var current_entityDets= dto.Details.Where(t => t.ErpDetailId == x.ErpDetailId).ToList();
|
var current_entityDets = dto.Details.Where(t => t.ErpDetailId == x.ErpDetailId).ToList();
|
||||||
if (current_entityDets != null && current_entityDets.Count != 0 && x.ErpDetailId == current_entityDets.FirstOrDefault().ErpDetailId)
|
if (current_entityDets != null && current_entityDets.Count != 0 && x.ErpDetailId == current_entityDets.FirstOrDefault().ErpDetailId)
|
||||||
{
|
{
|
||||||
var current_entityDet_matQty = current_entityDets.Sum(x => x.Qty);
|
var current_entityDet_matQty = current_entityDets.Sum(x => x.Qty);
|
||||||
@@ -455,26 +455,26 @@ namespace WMS.Web.Domain.Services
|
|||||||
});
|
});
|
||||||
|
|
||||||
//2.修改箱和任务单的绑定关系,先判断箱没有被收货过
|
//2.修改箱和任务单的绑定关系,先判断箱没有被收货过
|
||||||
var taskBoxList= await _inStockTaskBoxRepositories.GetListBy(entity.Id);
|
var taskBoxList = await _inStockTaskBoxRepositories.GetListBy(entity.Id);
|
||||||
var dto_boxIds= dto.Boxs.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
var dto_boxIds = dto.Boxs.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||||
var isHaveBox= taskBoxList.Where(x => dto_boxIds.Contains(x.BoxId)).Any();
|
var isHaveBox = taskBoxList.Where(x => dto_boxIds.Contains(x.BoxId)).Any();
|
||||||
if (isHaveBox)
|
if (isHaveBox)
|
||||||
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
|
return Result<InStockTask>.ReFailure(ResultCodes.InStockTaskBoxIsHaveData);
|
||||||
|
|
||||||
//3.组装绑定关系表,要添加的集合
|
//3.组装绑定关系表,要添加的集合
|
||||||
var boxEntitys= await _boxRepositories.GetEntityList(dto_boxIds);
|
var boxEntitys = await _boxRepositories.GetEntityList(dto_boxIds);
|
||||||
var taskBoxAdd = new List<InStockTaskBox>();
|
var taskBoxAdd = new List<InStockTaskBox>();
|
||||||
foreach (var item in dto.Boxs)
|
foreach (var item in dto.Boxs)
|
||||||
{
|
{
|
||||||
var taskBox = _mapper.Map<InStockTaskBox>(item);
|
var taskBox = _mapper.Map<InStockTaskBox>(item);
|
||||||
taskBox.TaskId = entity.Id;
|
taskBox.TaskId = entity.Id;
|
||||||
var current_dto_box_dets= boxEntitys.Where(x => x.Id == item.BoxId).SelectMany(x=>x.Details).ToList();
|
var current_dto_box_dets = boxEntitys.Where(x => x.Id == item.BoxId).SelectMany(x => x.Details).ToList();
|
||||||
taskBox.Details = _mapper.Map<List<InStockTaskBoxDetails>>(current_dto_box_dets);
|
taskBox.Details = _mapper.Map<List<InStockTaskBoxDetails>>(current_dto_box_dets);
|
||||||
taskBox.Details.ForEach(x => { x.ErpDetailId = item.ErpDetailId; });
|
taskBox.Details.ForEach(x => { x.ErpDetailId = item.ErpDetailId; });
|
||||||
taskBoxAdd.Add(taskBox);
|
taskBoxAdd.Add(taskBox);
|
||||||
}
|
}
|
||||||
var isSuccess= await _inStockTaskBoxRepositories.AddRange(taskBoxAdd,isTransaction);
|
var isSuccess = await _inStockTaskBoxRepositories.AddRange(taskBoxAdd, isTransaction);
|
||||||
if(!isSuccess)
|
if (!isSuccess)
|
||||||
return Result<InStockTask>.ReFailure(ResultCodes.DateWriteError);
|
return Result<InStockTask>.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
|
||||||
|
|
||||||
@@ -536,40 +536,41 @@ namespace WMS.Web.Domain.Services
|
|||||||
|
|
||||||
//判断箱是否存在库存:有的话就提示“箱号已上架入库”
|
//判断箱是否存在库存:有的话就提示“箱号已上架入库”
|
||||||
var boxInventory = await _boxInventoryRepositories.GetList(boxs.Select(x => x.Id).ToList());
|
var boxInventory = await _boxInventoryRepositories.GetList(boxs.Select(x => x.Id).ToList());
|
||||||
if(boxInventory!=null && boxInventory.Count!=0)
|
if (boxInventory != null && boxInventory.Count != 0)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxInventoryHaveInventoryError);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxInventoryHaveInventoryError);
|
||||||
|
|
||||||
//合并多个箱明细的数据:相同物料数量合并
|
//合并多个箱明细的数据:相同物料数量合并
|
||||||
var boxDetails = boxs.SelectMany(x => x.Details).GroupBy(x => x.MaterialId).Select(x => new { MaterialId = x.Key, Qty = x.Sum(t => t.Qty) }).ToList();
|
var boxDetails = boxs.SelectMany(x => x.Details).GroupBy(x => x.MaterialId).Select(x => new { MaterialId = x.Key, Qty = x.Sum(t => t.Qty) }).ToList();
|
||||||
|
|
||||||
|
//采购单:要对比数量
|
||||||
|
if (task.Type == InstockType.Purchase)
|
||||||
|
{
|
||||||
//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)
|
||||||
{
|
{
|
||||||
var qtyIsError = boxDetails.All(x => task_details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty < x.Qty));
|
var qtyIsError = boxDetails.All(x => task_details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty < x.Qty));
|
||||||
|
|
||||||
if (boxDetails.Count > task_details.Count && qtyIsError)
|
if (boxDetails.Count > task_details.Count && qtyIsError)
|
||||||
{
|
|
||||||
if (task.Type == InstockType.Purchase)
|
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Purchase_Error);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Purchase_Error);
|
||||||
else
|
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.ContrastError);
|
|
||||||
}
|
|
||||||
else if (qtyIsError)
|
else if (qtyIsError)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Qty_Error);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Qty_Error);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (task.Type == InstockType.Purchase)
|
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Purchase_Count_Error);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Purchase_Count_Error);
|
||||||
else
|
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Count_Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//非采购单:不要对比数量,只对比物料
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//3.比对:false为比对失败;
|
||||||
|
bool isRight = boxDetails.All(x => task_details.Any(t => t.MaterialId == x.MaterialId)) && boxDetails.Count <= task_details.Count;
|
||||||
|
if (!isRight)
|
||||||
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.Contrast_Count_Error);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//4.是否任务单存在绑定箱号判断:存在的话,就不能收货或者非采购上架
|
//4.是否任务单存在绑定箱号判断:存在的话,就不能收货或者非采购上架
|
||||||
var taskBoxList= await _inStockTaskBoxRepositories.GetListBy(task.Id);
|
var taskBoxList = await _inStockTaskBoxRepositories.GetListBy(task.Id);
|
||||||
bool isHave = taskBoxList.Where(x => dto.BoxBillNos.Contains(x.BoxBillNo)).Any();
|
bool isHave = taskBoxList.Where(x => dto.BoxBillNos.Contains(x.BoxBillNo)).Any();
|
||||||
if (isHave)
|
if (isHave)
|
||||||
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
|
return Result<ContrastMaterialsResponse>.ReFailure(ResultCodes.BoxHaveError);
|
||||||
@@ -588,5 +589,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
}
|
}
|
||||||
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
return Result<ContrastMaterialsResponse>.ReSuccess(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace WMS.Web.Domain.Values
|
|||||||
public static ValueTuple<int, string> Box_NoBind_Task_Data = (80001, "该箱号不在收货信息中,请核对再试!");
|
public static ValueTuple<int, string> Box_NoBind_Task_Data = (80001, "该箱号不在收货信息中,请核对再试!");
|
||||||
public static ValueTuple<int, string> OrderNoData = (80002, "单据信息不存在,请核对后再试!");
|
public static ValueTuple<int, string> OrderNoData = (80002, "单据信息不存在,请核对后再试!");
|
||||||
public static ValueTuple<int, string> ContrastError = (80003, "箱内产品和数量与来源单不一致");
|
public static ValueTuple<int, string> ContrastError = (80003, "箱内产品和数量与来源单不一致");
|
||||||
public static ValueTuple<int, string> Contrast_Purchase_Error = (80003, "箱内产品和数量与来源单不一致");
|
public static ValueTuple<int, string> Contrast_Purchase_Error = (80003, "箱内产品和数量与采购单不一致");
|
||||||
public static ValueTuple<int, string> Contrast_Purchase_Count_Error = (80003, "箱内产品和采购单不一致");
|
public static ValueTuple<int, string> Contrast_Purchase_Count_Error = (80003, "箱内产品和采购单不一致");
|
||||||
public static ValueTuple<int, string> Contrast_Count_Error = (80003, "箱内产品和来源单不一致");
|
public static ValueTuple<int, string> Contrast_Count_Error = (80003, "箱内产品和来源单不一致");
|
||||||
public static ValueTuple<int, string> Contrast_Qty_Error = (80003, "箱内产品数量超过可入库数量");
|
public static ValueTuple<int, string> Contrast_Qty_Error = (80003, "箱内产品数量超过可入库数量");
|
||||||
|
|||||||
Reference in New Issue
Block a user