|
|
|
@ -17,6 +17,7 @@
|
|
|
|
|
package com.logpm.warehouse.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
@ -29,6 +30,7 @@ import com.logpm.distribution.entity.DistributionStockListEntity;
|
|
|
|
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockArticleClient; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockListClient; |
|
|
|
|
import com.logpm.distribution.vo.DistributionPackadeliVO; |
|
|
|
|
import com.logpm.distribution.vo.DistributionStockListVO; |
|
|
|
|
import com.logpm.warehouse.bean.Resp; |
|
|
|
|
import com.logpm.warehouse.dto.QuestDetailDTO; |
|
|
|
@ -96,8 +98,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
private final IWarehouseTaryAllocationService taryAllocationService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TaskQuestVO> selectTaskQuestPage(IPage<TaskQuestVO> page, TaskQuestVO taskQuest) { |
|
|
|
|
//获取当前登录人仓库
|
|
|
|
@ -226,45 +226,67 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
List<Long> collect = this.getmyWarehouseList(); |
|
|
|
|
baseMapper.setSqlMode(); |
|
|
|
|
String goodsType = taskSearchDTO.getGoodsType(); |
|
|
|
|
switch (goodsType){ |
|
|
|
|
case "1": |
|
|
|
|
LambdaQueryWrapper<QuestDetailEntity> queryWrapper = Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3) |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskSearchDTO.getTaskId()); |
|
|
|
|
List<TaskContractVO> list = new ArrayList<>(); |
|
|
|
|
List<QuestDetailEntity> questDetailEntityList = questDetailService.list(queryWrapper); |
|
|
|
|
if (Func.isEmpty(questDetailEntityList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
Map<Integer, List<QuestDetailEntity>> questDetailMap = questDetailEntityList.stream().collect(Collectors.groupingBy(QuestDetailEntity::getQuestTarget)); |
|
|
|
|
//订制品
|
|
|
|
|
List<TaskContractVO> list = baseMapper.selectcontractList(page, taskSearchDTO, collect); |
|
|
|
|
break; |
|
|
|
|
case "2": |
|
|
|
|
//零担
|
|
|
|
|
break; |
|
|
|
|
case "3": |
|
|
|
|
//库存品
|
|
|
|
|
break; |
|
|
|
|
List<QuestDetailEntity> questDetailEntities = questDetailMap.get(1); |
|
|
|
|
List<QuestDetailEntity> zeroQuestDetailEntities = questDetailMap.get(2); |
|
|
|
|
List<QuestDetailEntity> inventoryQuestDetailEntities = questDetailMap.get(3); |
|
|
|
|
if (Func.isNotEmpty(questDetailEntities)){ |
|
|
|
|
Map<Long, List<QuestDetailEntity>> orderMap = questDetailEntities.stream().collect(Collectors.groupingBy(QuestDetailEntity::getOrderId)); |
|
|
|
|
orderMap.forEach((k,v)->{ |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findEntityByStockArticleId(k); |
|
|
|
|
List<QuestDetailEntity> detailEntities = orderMap.get(k); |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setIsInventory(0); |
|
|
|
|
taskContractVO.setIsZero(0); |
|
|
|
|
taskContractVO.setOrderCode(detailEntities.get(0).getOrderCode()); |
|
|
|
|
taskContractVO.setOrderId(k); |
|
|
|
|
taskContractVO.setTotal(detailEntities.stream().mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
taskContractVO.setZktotal(detailEntities.stream().mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
taskContractVO.setUnTotal(detailEntities.stream().filter(q->Func.equals(q.getQuestStatus(),1)).mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
list.add(taskContractVO); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
List<TaskContractVO> list = baseMapper.selectcontractList(page, taskSearchDTO, collect); |
|
|
|
|
|
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
for (TaskContractVO taskContractVO : list) { |
|
|
|
|
Long orderId = taskContractVO.getOrderId(); |
|
|
|
|
String orderCode = taskContractVO.getOrderCode(); |
|
|
|
|
//查询该订单,如果是零担直接用在库数量
|
|
|
|
|
DistributionStockArticleEntity entityByStockArticle = distributionStockArticleClient.findEntityByStockArticleId(orderId); |
|
|
|
|
if (entityByStockArticle.getIsZero().equals("1")) { |
|
|
|
|
if (entityByStockArticle.getGenre() == 1) { |
|
|
|
|
taskContractVO.setTotal(entityByStockArticle.getTotalNumber()); |
|
|
|
|
taskContractVO.setZktotal(entityByStockArticle.getTotalNumber()); |
|
|
|
|
if (Func.isNotEmpty(zeroQuestDetailEntities)){ |
|
|
|
|
for (QuestDetailEntity questDetailEntity : zeroQuestDetailEntities) { |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findEntityByStockArticleId(questDetailEntity.getOrderId()); |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setIsInventory(0); |
|
|
|
|
taskContractVO.setIsZero(1); |
|
|
|
|
taskContractVO.setOrderCode(questDetailEntity.getOrderCode()); |
|
|
|
|
taskContractVO.setOrderId(questDetailEntity.getOrderId()); |
|
|
|
|
taskContractVO.setTotal(stockArticleEntity.getTotalNumber()); |
|
|
|
|
taskContractVO.setZktotal(questDetailEntity.getStockNum()); |
|
|
|
|
taskContractVO.setUnTotal(questDetailEntity.getStockNum()); |
|
|
|
|
list.add(taskContractVO); |
|
|
|
|
} |
|
|
|
|
} else if (entityByStockArticle.getIsZero().equals("0")) { |
|
|
|
|
//包条
|
|
|
|
|
if (entityByStockArticle.getGenre() == 1) { |
|
|
|
|
//查询该订单下包条的所有数量
|
|
|
|
|
Integer integer = distributionParcelListClient.SumEntityByOrderId(orderId, null); |
|
|
|
|
Integer integer1 = distributionParcelListClient.SumEntityByOrderId(orderId, collect.get(0)); |
|
|
|
|
taskContractVO.setTotal(integer); |
|
|
|
|
taskContractVO.setZktotal(integer1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(inventoryQuestDetailEntities)){ |
|
|
|
|
for (QuestDetailEntity questDetailEntity : inventoryQuestDetailEntities) { |
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListClient.getStockListById(questDetailEntity.getStockId()); |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setOrderCode(questDetailEntity.getOrderCode()); |
|
|
|
|
taskContractVO.setOrderId(questDetailEntity.getStockId()); |
|
|
|
|
taskContractVO.setTotal(stockListEntity.getQuantityStock()); |
|
|
|
|
taskContractVO.setIsZero(0); |
|
|
|
|
taskContractVO.setIsInventory(1); |
|
|
|
|
taskContractVO.setZktotal(questDetailEntity.getStockNum()); |
|
|
|
|
taskContractVO.setUnTotal(0); |
|
|
|
|
if (questDetailEntity.getQuestStatus().equals(1)){ |
|
|
|
|
taskContractVO.setUnTotal(questDetailEntity.getStockNum()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
list.add(taskContractVO); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return page.setRecords(list); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -330,6 +352,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 出来托盘信息 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<TaskTrayVO> getTaskTrayInfo(List<QuestDetailEntity> list1){ |
|
|
|
@ -364,16 +387,17 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
taskTrayVO.setUnTotal(unTotal.get()); |
|
|
|
|
list.add(taskTrayVO); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 托盘ID信息货物处理 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private TaskTrayVO getTaskTrayInfoOwn(List<QuestDetailEntity> list1,String type){ |
|
|
|
|
|
|
|
|
|
TaskTrayVO taskTrayVO = new TaskTrayVO(); |
|
|
|
|
list1.stream().collect(Collectors.groupingBy(QuestDetailEntity::getTrayId)) |
|
|
|
|
.forEach((k,v) ->{ |
|
|
|
@ -420,6 +444,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 查询托盘里面的信息 |
|
|
|
|
* |
|
|
|
|
* @param taskSearchDTO |
|
|
|
|
* @param warehouseId |
|
|
|
|
* @param trayId |
|
|
|
@ -436,6 +461,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 盘点根据托盘id查询明细 |
|
|
|
|
* |
|
|
|
|
* @param page |
|
|
|
|
* @param taskSearchDTO |
|
|
|
|
* @return |
|
|
|
@ -451,10 +477,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据托盘ID查询托盘货位并添加 |
|
|
|
|
* |
|
|
|
|
* @param taskId 盘点ID |
|
|
|
|
* @param warehouseId 仓库ID |
|
|
|
|
* @param trayByTrayCode 托盘 |
|
|
|
@ -590,6 +615,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 包件,订单查询货位信息 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private WarehouseUpdownGoodsEntity getUpdownGoodsPack(Long associationId, String type, String associationValue, Long warehouseId) { |
|
|
|
@ -603,6 +629,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 库存品查询货位信息 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private WarehouseUpdownGoodsEntity getUpdownGoodsStockList(Long marketId, String type, String incomingBatch, Long warehouseId, Long associationId, String associationValue) { |
|
|
|
@ -615,8 +642,10 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
.eq(WarehouseUpdownGoodsEntity::getWarehouseId, warehouseId) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单ID查询订单信息 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private DistributionStockArticleEntity getStockArticleInfo(Long stockArticleID) { |
|
|
|
@ -625,6 +654,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单ID查询订单信息 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private DistributionStockListEntity getStockListInfo(DistributionStockListEntity distributionStockListEntity) { |
|
|
|
@ -632,8 +662,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<QuestDetailEntity> allocationDetailByPackage(TaskSearchDTO taskSearchDTO) { |
|
|
|
|
|
|
|
|
@ -1014,7 +1042,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QuestDetailDTO questDetail = taskSearchDTO.getQuestDetail(); |
|
|
|
|
QuestDetailEntity questDetailEntity = new QuestDetailEntity(); |
|
|
|
|
BeanUtil.copy(questDetail, questDetailEntity); |
|
|
|
@ -1030,7 +1057,6 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetailEntity.setGroundingAllocationId(allocationId); |
|
|
|
|
questDetailEntity.setGroundingPositionCode(positionCode); |
|
|
|
|
questDetailEntity.setIsNew(1); |
|
|
|
|
|
|
|
|
|
questDetailService.save(questDetailEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1039,6 +1065,101 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
return baseMapper.findMaterialList(taskSearchDTO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R contractQuestDetail(TaskSearchDTO taskSearchDTO) { |
|
|
|
|
if (Func.isEmpty(taskSearchDTO.getTaskId())){ |
|
|
|
|
log.error("#####################TaskId参数缺失:{}",taskSearchDTO.getTaskId()); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(taskSearchDTO.getOrderId())){ |
|
|
|
|
log.error("#####################OrderId参数缺失:{}",taskSearchDTO.getOrderId()); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if (Func.isEmpty(taskSearchDTO.getWarehouseId())){ |
|
|
|
|
log.error("#####################WarehouseId参数缺失:{}",taskSearchDTO.getWarehouseId()); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
Integer isInventory = taskSearchDTO.getIsInventory(); |
|
|
|
|
LambdaQueryWrapper<QuestDetailEntity> queryWrapper = Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskSearchDTO.getTaskId()) |
|
|
|
|
.eq(QuestDetailEntity::getWarehouseId, taskSearchDTO.getWarehouseId()) |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3); |
|
|
|
|
if (Func.equals(isInventory,1)){ |
|
|
|
|
queryWrapper.eq(QuestDetailEntity::getStockId, taskSearchDTO.getOrderId()); |
|
|
|
|
}else { |
|
|
|
|
queryWrapper.eq(QuestDetailEntity::getOrderId, taskSearchDTO.getOrderId()); |
|
|
|
|
} |
|
|
|
|
List<QuestDetailEntity> questDetailEntities = questDetailService.list(queryWrapper); |
|
|
|
|
List<Integer> type = questDetailEntities.stream().filter(f -> Func.isNotEmpty(f.getQuestTarget())).map(QuestDetailEntity::getQuestTarget).distinct().collect(Collectors.toList()); |
|
|
|
|
if (Func.isEmpty(type)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if (type.size() != 1){ |
|
|
|
|
log.error("###################orderId查询类型异常:{}",taskSearchDTO.getOrderId()); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
TaskContractVO contractVO = new TaskContractVO(); |
|
|
|
|
AtomicInteger total = new AtomicInteger(); |
|
|
|
|
AtomicInteger operationNum = new AtomicInteger(); |
|
|
|
|
ArrayList<TaskPackagelistVO> taskPackagelistVOS = new ArrayList<>(); |
|
|
|
|
List<String> orderCode = questDetailEntities.stream().map(QuestDetailEntity::getOrderCode).distinct().collect(Collectors.toList()); |
|
|
|
|
if (orderCode.size() != 1){ |
|
|
|
|
log.error("###################orderId查询类型异常:{}",taskSearchDTO.getOrderId()); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
for (QuestDetailEntity questDetailEntity : questDetailEntities) { |
|
|
|
|
TaskPackagelistVO packagelistVO = new TaskPackagelistVO(); |
|
|
|
|
total.getAndAdd(questDetailEntity.getStockNum()); |
|
|
|
|
if (questDetailEntity.getQuestStatus().equals(1)){ |
|
|
|
|
operationNum.getAndAdd(questDetailEntity.getStockNum()); |
|
|
|
|
} |
|
|
|
|
packagelistVO.setOrderId(questDetailEntity.getOrderId()); |
|
|
|
|
if (type.get(0)==1){ |
|
|
|
|
packagelistVO.setOrderPackageCode(questDetailEntity.getOrdePackageCode()); |
|
|
|
|
packagelistVO.setQuantity(questDetailEntity.getStockNum()); |
|
|
|
|
} |
|
|
|
|
if (type.get(0)==2){ |
|
|
|
|
packagelistVO.setWaybillNub(questDetailEntity.getWaybillNumber()); |
|
|
|
|
packagelistVO.setQuantity(questDetailEntity.getStockNum()); |
|
|
|
|
} |
|
|
|
|
if(type.get(0)==3){ |
|
|
|
|
packagelistVO.setOrderId(questDetailEntity.getStockId()); |
|
|
|
|
packagelistVO.setQuantity(questDetailEntity.getStockNum()); |
|
|
|
|
packagelistVO.setMaterialCode(questDetailEntity.getMaterialCode()); |
|
|
|
|
packagelistVO.setMaterialName(questDetailEntity.getMaterialName()); |
|
|
|
|
} |
|
|
|
|
packagelistVO.setAllocation(questDetailEntity.getPositionCode()); |
|
|
|
|
packagelistVO.setOrderCode(orderCode.get(0)); |
|
|
|
|
packagelistVO.setCurrentStatus("1"); // 默认在库
|
|
|
|
|
taskPackagelistVOS.add(packagelistVO); |
|
|
|
|
} |
|
|
|
|
List<Long> orderId = questDetailEntities.stream().map(QuestDetailEntity::getOrderId).distinct().collect(Collectors.toList()); |
|
|
|
|
if (type.get(0).equals(1)){ |
|
|
|
|
contractVO.setOrderId(orderId.get(0)); |
|
|
|
|
contractVO.setOrderCode(orderCode.get(0)); |
|
|
|
|
contractVO.setIsZero(0); |
|
|
|
|
contractVO.setIsInventory(0); |
|
|
|
|
}else if (type.get(0).equals(2)){ |
|
|
|
|
List<String> zeroOrderCode = questDetailEntities.stream().map(QuestDetailEntity::getOrderCode).distinct().collect(Collectors.toList()); |
|
|
|
|
contractVO.setOrderId(orderId.get(0)); |
|
|
|
|
contractVO.setOrderCode(zeroOrderCode.get(0)); |
|
|
|
|
contractVO.setIsZero(1); |
|
|
|
|
contractVO.setIsInventory(0); |
|
|
|
|
}else if (type.get(0).equals(3)){ |
|
|
|
|
List<Long> inventoryOrderId = questDetailEntities.stream().map(QuestDetailEntity::getStockId).distinct().collect(Collectors.toList()); |
|
|
|
|
contractVO.setOrderId(inventoryOrderId.get(0)); |
|
|
|
|
contractVO.setIsZero(0); |
|
|
|
|
contractVO.setIsInventory(1); |
|
|
|
|
}else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
contractVO.setZktotal(total.get()); |
|
|
|
|
contractVO.setPackagelistVOList(taskPackagelistVOS); |
|
|
|
|
contractVO.setTotal(total.get()); |
|
|
|
|
contractVO.setUnTotal(operationNum.get()); |
|
|
|
|
return R.data(contractVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<QuestDetailVO> SelectStrip(IPage<TaskQuestVO> page,Long id) { |
|
|
|
|
IPage<QuestDetailVO> questDetailVOList = baseMapper.selectStripListByQuestId(page,id); |
|
|
|
@ -1091,8 +1212,12 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public R queryContract(TaskSearchDTO taskSearchDTO) { |
|
|
|
|
String goodsType = taskSearchDTO.getGoodsType(); |
|
|
|
|
// String goodsType = taskSearchDTO.getGoodsType();
|
|
|
|
|
Integer type = taskSearchDTO.getType(); |
|
|
|
|
if (Func.isEmpty(type)){ |
|
|
|
|
log.error("####################前端参数type传递有误:{}",type); |
|
|
|
|
Resp.scanFail("操作失败", "服务器正忙..."); |
|
|
|
|
} |
|
|
|
|
if (type == 1) { |
|
|
|
|
String code = taskSearchDTO.getCode(); |
|
|
|
|
if (Func.isEmpty(code)) { |
|
|
|
@ -1100,10 +1225,14 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
return Resp.scanFail("操作失败", "请填写正确合同号"); |
|
|
|
|
} |
|
|
|
|
//查询包件 赋予到订单上
|
|
|
|
|
List<DistributionParcelListEntity> entityListByOrderCode = distributionParcelListClient.findEntityListByOrderCode(taskSearchDTO.getCode(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
DistributionParcelListEntity entityListByOrderCode = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(taskSearchDTO.getCode(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
if (Func.isNotEmpty(entityListByOrderCode) ) { |
|
|
|
|
DistributionParcelListEntity parcelListEntity = entityListByOrderCode.get(0); |
|
|
|
|
taskSearchDTO.setCode(parcelListEntity.getOrderCode()); |
|
|
|
|
boolean flag = entityListByOrderCode.getConditions().equals(3); |
|
|
|
|
if (flag){ |
|
|
|
|
log.error("####################扫描库存品包件:{}",flag); |
|
|
|
|
return Resp.scanFail("操作失败", "请停止扫描库存品包件"); |
|
|
|
|
} |
|
|
|
|
taskSearchDTO.setIncomingBatch(entityListByOrderCode.getOrderCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String incomingBatch = taskSearchDTO.getIncomingBatch(); |
|
|
|
@ -1116,34 +1245,74 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
List<TaskQuestChildEntity> taskQuestChildEntityList = taskQuestChildService.list(Wrappers.<TaskQuestChildEntity>query().lambda() |
|
|
|
|
.eq(TaskQuestChildEntity::getQuestId, taskQuestId) |
|
|
|
|
.eq(TaskQuestChildEntity::getRefType, 1)); |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = null; |
|
|
|
|
AtomicInteger libNum = new AtomicInteger(); |
|
|
|
|
List<DistributionStockArticleEntity> stockArticleEntity = null; |
|
|
|
|
List<String> marketNames = null; |
|
|
|
|
if (Func.isEmpty(taskQuestId)) { |
|
|
|
|
//全仓盘点
|
|
|
|
|
stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(incomingBatch,taskSearchDTO.getWarehouseId()); |
|
|
|
|
stockArticleEntity = distributionStockArticleClient.findStockArticleByCodeAndMarketAndWarehouseId(incomingBatch,"", taskSearchDTO.getWarehouseId()); |
|
|
|
|
} else { |
|
|
|
|
if (Func.isNotEmpty(taskQuestChildEntityList)) { |
|
|
|
|
marketNames = taskQuestChildEntityList.stream().map(TaskQuestChildEntity::getRefName).collect(Collectors.toList()); |
|
|
|
|
stockArticleEntity = distributionStockArticleClient.findStockArticleByCodeAndMarketAndWarehouseId(taskSearchDTO.getCode(), marketNames,taskSearchDTO.getWarehouseId()); |
|
|
|
|
stockArticleEntity = distributionStockArticleClient.findStockArticleByCodeAndMarketAndWarehouseId(taskSearchDTO.getIncomingBatch(), String.join(",",marketNames), taskSearchDTO.getWarehouseId()); |
|
|
|
|
} else { |
|
|
|
|
log.error("###################盘点任务查询失败"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<TaskContractVO> taskContractVOS = new ArrayList<>(); |
|
|
|
|
String goodsType = taskSearchDTO.getGoodsType(); |
|
|
|
|
if (Func.isEmpty(goodsType)){ |
|
|
|
|
log.error("####################参数异常:{}",goodsType); |
|
|
|
|
} |
|
|
|
|
switch (goodsType) { |
|
|
|
|
case "1" : |
|
|
|
|
|
|
|
|
|
//查询任务表 是否需要进行盘点任务数据的插入
|
|
|
|
|
List<QuestDetailEntity> questDetailEntityList = questDetailService.list(Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskQuestId) |
|
|
|
|
.like(QuestDetailEntity::getOrderCode, incomingBatch) |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3) |
|
|
|
|
.eq(QuestDetailEntity::getQuestTarget, 1) |
|
|
|
|
.eq(QuestDetailEntity::getWarehouseId, taskSearchDTO.getWarehouseId())); |
|
|
|
|
if (Func.isNotEmpty(questDetailEntityList) && questDetailEntityList.size()>0){ |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
Map<Long, List<QuestDetailEntity>> orderMap = questDetailEntityList.stream().collect(Collectors.groupingBy(QuestDetailEntity::getOrderId)); |
|
|
|
|
orderMap.forEach((k,v)->{ |
|
|
|
|
List<QuestDetailEntity> questDetailEntities = orderMap.get(k); |
|
|
|
|
taskContractVO.setTotal(v.stream().mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
taskContractVO.setZktotal(v.stream().mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
taskContractVO.setOrderId(questDetailEntities.get(0).getOrderId()); |
|
|
|
|
taskContractVO.setOrderCode(questDetailEntities.get(0).getOrderCode()); |
|
|
|
|
taskContractVO.setIsZero(0); |
|
|
|
|
taskContractVO.setIsInventory(0); |
|
|
|
|
if (questDetailEntities.get(0).getQuestTarget().equals(2)){ |
|
|
|
|
taskContractVO.setIsZero(1); |
|
|
|
|
} |
|
|
|
|
taskContractVO.setUnTotal(v.stream().filter(f->Func.equals(f.getQuestStatus(),1)).mapToInt(QuestDetailEntity::getStockNum).sum()); |
|
|
|
|
taskContractVOS.add(taskContractVO); |
|
|
|
|
}); |
|
|
|
|
}else { |
|
|
|
|
if (Func.isEmpty(stockArticleEntity)) { |
|
|
|
|
log.error("###################此订单不属于该次盘点任务"); |
|
|
|
|
return Resp.scanFail("操作失败", "不属于该任务"); |
|
|
|
|
} |
|
|
|
|
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); |
|
|
|
|
parcelListEntity.setStockArticleId(stockArticleEntity.getId()); |
|
|
|
|
List<DistributionParcelListEntity> parcelList = distributionParcelListClient.getParcelList(parcelListEntity); |
|
|
|
|
for (DistributionStockArticleEntity distributionStockArticleEntity : stockArticleEntity) { |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setOrderId(distributionStockArticleEntity.getId()); |
|
|
|
|
taskContractVO.setOrderCode(distributionStockArticleEntity.getOrderCode()); |
|
|
|
|
taskContractVO.setTotal(distributionStockArticleEntity.getTotalNumber()); |
|
|
|
|
//查询已经【盘点的包件数量
|
|
|
|
|
Long count = questDetailService.count(Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getOrderId, distributionStockArticleEntity.getId()) |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskQuestId) |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3) |
|
|
|
|
.eq(QuestDetailEntity::getQuestStatus, 1)); |
|
|
|
|
taskContractVO.setUnTotal(count.intValue()); |
|
|
|
|
taskContractVOS.add(taskContractVO); |
|
|
|
|
List<DistributionParcelListEntity> parcelList = distributionParcelListClient.getParcelListByStockArticleId(distributionStockArticleEntity.getId()); |
|
|
|
|
if (Func.isEmpty(parcelList)) { |
|
|
|
|
log.error("###################查询订单包件错误,订单ID:{}",stockArticleEntity.getId()); |
|
|
|
|
log.error("###################查询订单包件错误,订单ID:{}", distributionStockArticleEntity.getId()); |
|
|
|
|
} |
|
|
|
|
if (stockArticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())){ |
|
|
|
|
if (distributionStockArticleEntity.getIsZero().equals(IsOrNoConstant.no.getValue())) { |
|
|
|
|
AtomicInteger libNum = new AtomicInteger(); |
|
|
|
|
parcelList.forEach(p -> { |
|
|
|
|
QuestDetailEntity questDetailEntity = new QuestDetailEntity(); |
|
|
|
|
if (!p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yichuku.getValue()) && !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { |
|
|
|
@ -1161,6 +1330,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetailEntity.setOrderId(p.getStockArticleId()); |
|
|
|
|
libNum.getAndAdd(p.getQuantity()); |
|
|
|
|
questDetailEntity.setIsNew(0); |
|
|
|
|
questDetailEntity.setWaybillNumber(p.getWaybillNumber()); |
|
|
|
|
questDetailEntity.setOrderPackageId(p.getId()); |
|
|
|
|
questDetailEntity.setWarehouseId(taskSearchDTO.getWarehouseId()); |
|
|
|
|
questDetailEntity.setQuestId(taskQuestId); |
|
|
|
|
questDetailEntity.setQuestStatus(0); |
|
|
|
|
questDetailEntity.setQuestTarget(1); |
|
|
|
@ -1168,9 +1340,37 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetailService.save(questDetailEntity); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
taskContractVO.setZktotal(libNum.get()); |
|
|
|
|
} else { |
|
|
|
|
//查询任务表 是否需要进行盘点任务数据的插入
|
|
|
|
|
List<QuestDetailEntity> zeroQuestDetailEntityList = questDetailService.list(Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskQuestId) |
|
|
|
|
.like(QuestDetailEntity::getOrderCode, incomingBatch) |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3) |
|
|
|
|
.eq(QuestDetailEntity::getQuestTarget, 2) |
|
|
|
|
.eq(QuestDetailEntity::getWarehouseId, taskSearchDTO.getWarehouseId())); |
|
|
|
|
if (Func.isNotEmpty(zeroQuestDetailEntityList)){ |
|
|
|
|
for (QuestDetailEntity questDetailEntity : zeroQuestDetailEntityList) { |
|
|
|
|
TaskContractVO contractVO = new TaskContractVO(); |
|
|
|
|
contractVO.setTotal(questDetailEntity.getStockNum()); |
|
|
|
|
contractVO.setZktotal(questDetailEntity.getStockNum()); |
|
|
|
|
contractVO.setOrderId(questDetailEntity.getOrderId()); |
|
|
|
|
contractVO.setOrderCode(questDetailEntity.getOrderCode()); |
|
|
|
|
contractVO.setIsZero(0); |
|
|
|
|
contractVO.setIsInventory(0); |
|
|
|
|
contractVO.setUnTotal(0); |
|
|
|
|
if (questDetailEntity.getQuestTarget().equals(2)){ |
|
|
|
|
taskContractVO.setIsZero(1); |
|
|
|
|
} |
|
|
|
|
if (questDetailEntity.getQuestStatus().equals(1)){ |
|
|
|
|
taskContractVO.setUnTotal(questDetailEntity.getStockNum()); |
|
|
|
|
} |
|
|
|
|
taskContractVOS.add(contractVO); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
AtomicInteger libNum = new AtomicInteger(); |
|
|
|
|
QuestDetailEntity questDetailEntity = new QuestDetailEntity(); |
|
|
|
|
DistributionStockArticleEntity stockArticleInfo = getStockArticleInfo(stockArticleEntity.getId()); |
|
|
|
|
DistributionStockArticleEntity stockArticleInfo = getStockArticleInfo(distributionStockArticleEntity.getId()); |
|
|
|
|
WarehouseUpdownGoodsEntity updownGoodsPack = getUpdownGoodsPack(stockArticleInfo.getId(), "1", stockArticleInfo.getOrderCode(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
List<WarehouseTrayEntity> warehouseTrayEntities = baseMapper.selectZeroOrderTratInfo(stockArticleInfo.getId(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
if (Func.isNotEmpty(warehouseTrayEntities)) { |
|
|
|
@ -1181,42 +1381,83 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetailEntity.setAllocationId(updownGoodsPack.getId()); |
|
|
|
|
} |
|
|
|
|
questDetailEntity.setOrderCode(stockArticleInfo.getOrderCode()); |
|
|
|
|
questDetailEntity.setOrderId(stockArticleInfo.getId()); |
|
|
|
|
libNum.getAndAdd(stockArticleInfo.getHandQuantity()); |
|
|
|
|
questDetailEntity.setIsNew(0); |
|
|
|
|
questDetailEntity.setQuestId(taskQuestId); |
|
|
|
|
questDetailEntity.setWaybillNumber(stockArticleInfo.getWaybillNumber()); |
|
|
|
|
questDetailEntity.setWarehouseId(stockArticleInfo.getWarehouseId()); |
|
|
|
|
questDetailEntity.setQuestStatus(0); |
|
|
|
|
questDetailEntity.setQuestTarget(1); |
|
|
|
|
questDetailEntity.setStockNum(stockArticleInfo.getHandQuantity()); |
|
|
|
|
questDetailEntity.setQuestType(3); |
|
|
|
|
questDetailService.save(questDetailEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "2": |
|
|
|
|
//库存品
|
|
|
|
|
//查询任务表 是否需要进行盘点任务数据的插入
|
|
|
|
|
List<QuestDetailEntity> inventoryQuestDetailEntityList = questDetailService.list(Wrappers.<QuestDetailEntity>query().lambda() |
|
|
|
|
.eq(QuestDetailEntity::getQuestId, taskQuestId) |
|
|
|
|
.like(QuestDetailEntity::getOrderCode, incomingBatch) |
|
|
|
|
.or() |
|
|
|
|
.eq(QuestDetailEntity::getIncomingBatch,incomingBatch) |
|
|
|
|
.eq(QuestDetailEntity::getQuestType, 3) |
|
|
|
|
.eq(QuestDetailEntity::getQuestTarget, 3) |
|
|
|
|
.eq(QuestDetailEntity::getWarehouseId, taskSearchDTO.getWarehouseId())); |
|
|
|
|
if (Func.isNotEmpty(inventoryQuestDetailEntityList) && inventoryQuestDetailEntityList.size()>0){ |
|
|
|
|
int sum = inventoryQuestDetailEntityList.stream().filter(iqd -> Func.equals(iqd.getQuestStatus(), 1)).mapToInt(QuestDetailEntity::getStockNum).sum(); |
|
|
|
|
inventoryQuestDetailEntityList.forEach(iqd->{ |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setTotal(iqd.getStockNum()); |
|
|
|
|
taskContractVO.setZktotal(iqd.getStockNum()); |
|
|
|
|
taskContractVO.setOrderId(iqd.getStockId()); |
|
|
|
|
taskContractVO.setOrderCode(iqd.getOrderCode()); |
|
|
|
|
taskContractVO.setUnTotal(sum); |
|
|
|
|
taskContractVO.setIsZero(0); |
|
|
|
|
taskContractVO.setIsInventory(1); |
|
|
|
|
taskContractVOS.add(taskContractVO); |
|
|
|
|
}); |
|
|
|
|
}else { |
|
|
|
|
List<DistributionStockListEntity> stockListByWarehouseIdAndMarketAndStockListInfo = distributionStockListClient.getStockListByWarehouseIdAndMarketAndStockListInfo(incomingBatch, marketNames, taskSearchDTO.getWarehouseId()); |
|
|
|
|
if (Func.isEmpty(stockListByWarehouseIdAndMarketAndStockListInfo)){ |
|
|
|
|
return Resp.scanFail("操作失败","该库存品不存在此任务中"); |
|
|
|
|
} |
|
|
|
|
stockListByWarehouseIdAndMarketAndStockListInfo.forEach(s -> { |
|
|
|
|
QuestDetailEntity questDetailEntity = new QuestDetailEntity(); |
|
|
|
|
questDetailEntity.setOrderCode(s.getOrderCode()); |
|
|
|
|
questDetailEntity.setIsNew(0); |
|
|
|
|
questDetailEntity.setQuestId(taskQuestId); |
|
|
|
|
questDetailEntity.setQuestStatus(0); |
|
|
|
|
questDetailEntity.setQuestTarget(1); |
|
|
|
|
questDetailEntity.setQuestTarget(3); |
|
|
|
|
questDetailEntity.setQuestType(3); |
|
|
|
|
libNum.getAndAdd(s.getQuantityStock() - s.getOutboundQuantity()); |
|
|
|
|
questDetailEntity.setMaterialName(s.getDescriptionGoods()); |
|
|
|
|
questDetailEntity.setMaterialCode(s.getCargoNumber()); |
|
|
|
|
questDetailEntity.setStockNum(s.getQuantityStock()); |
|
|
|
|
questDetailEntity.setWarehouseId(taskSearchDTO.getWarehouseId()); |
|
|
|
|
questDetailEntity.setIncomingBatch(s.getIncomingBatch()); |
|
|
|
|
questDetailEntity.setMarketName(s.getMarketName()); |
|
|
|
|
questDetailEntity.setStockId(s.getId()); |
|
|
|
|
questDetailEntity.setOrderCode(s.getOrderCode()); |
|
|
|
|
questDetailService.save(questDetailEntity); |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setOrderId(questDetailEntity.getStockId()); |
|
|
|
|
taskContractVO.setOrderCode(questDetailEntity.getOrderCode()); |
|
|
|
|
taskContractVO.setTotal(questDetailEntity.getStockNum()); |
|
|
|
|
taskContractVO.setZktotal(questDetailEntity.getStockNum()); |
|
|
|
|
taskContractVO.setUnTotal(0); |
|
|
|
|
taskContractVOS.add(taskContractVO); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
log.error("####################缺少货物类型字段"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
TaskContractVO taskContractVO = new TaskContractVO(); |
|
|
|
|
taskContractVO.setTotal(stockArticleEntity.getTotalNumber()); |
|
|
|
|
taskContractVO.setOrderId(stockArticleEntity.getId()); |
|
|
|
|
taskContractVO.setUnTotal(0); |
|
|
|
|
taskContractVO.setZktotal(libNum.get()); |
|
|
|
|
|
|
|
|
|
return R.data(taskContractVO); |
|
|
|
|
return R.data(taskContractVOS); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|