|
|
|
@ -19,6 +19,7 @@ package com.logpm.warehouse.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -333,10 +334,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public Long getTaskID() { |
|
|
|
|
Random random = new Random(); |
|
|
|
|
long min = 100000000000000000L; // 最小值为10的18次方
|
|
|
|
|
long max = 9223372036854775807L; // Long类型的最大值
|
|
|
|
|
return min + (long) (random.nextDouble() * (max - min)); |
|
|
|
|
return IdWorker.getId(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -623,22 +621,22 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
boolean save = this.save(taskQuest); |
|
|
|
|
// 存入子表 todo 暂时不要商场
|
|
|
|
|
// if (!taskQuest.getList().isEmpty()) {
|
|
|
|
|
//// List<TaskQuestChildEntity> list = taskQuest.getList();
|
|
|
|
|
//// for (TaskQuestChildEntity taskQuestChildEntity : list) {
|
|
|
|
|
//// taskQuestChildEntity.setWarehouseId(id);
|
|
|
|
|
//// taskQuestChildEntity.setQuestId(taskQuest.getId());
|
|
|
|
|
////
|
|
|
|
|
//// }
|
|
|
|
|
//// taskQuestChildService.saveBatch(list);
|
|
|
|
|
//// //添加包件信息
|
|
|
|
|
//// List<Long> collect = list.stream().map(TaskQuestChildEntity::getRefId).collect(Collectors.toList());
|
|
|
|
|
//// addQuestDetail(myCurrentWarehouse.getId(), collect, questNum, taskQuest.getId());
|
|
|
|
|
// } else {
|
|
|
|
|
// addQuestDetail(myCurrentWarehouse.getId(), null, questNum, taskQuest.getId());
|
|
|
|
|
// }
|
|
|
|
|
if (!taskQuest.getList().isEmpty()) { |
|
|
|
|
List<TaskQuestChildEntity> list = taskQuest.getList(); |
|
|
|
|
for (TaskQuestChildEntity taskQuestChildEntity : list) { |
|
|
|
|
taskQuestChildEntity.setWarehouseId(id); |
|
|
|
|
taskQuestChildEntity.setQuestId(taskQuest.getId()); |
|
|
|
|
|
|
|
|
|
addQuestDetail(myCurrentWarehouse.getId(), null, questNum, taskQuest.getId()); |
|
|
|
|
} |
|
|
|
|
taskQuestChildService.saveBatch(list); |
|
|
|
|
//添加包件信息
|
|
|
|
|
List<Long> collect = list.stream().map(TaskQuestChildEntity::getRefId).collect(Collectors.toList()); |
|
|
|
|
addQuestDetail(myCurrentWarehouse.getId(), collect, questNum, taskQuest.getId()); |
|
|
|
|
} else { |
|
|
|
|
addQuestDetail(myCurrentWarehouse.getId(), null, questNum, taskQuest.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// addQuestDetail(myCurrentWarehouse.getId(), null, questNum, taskQuest.getId());
|
|
|
|
|
|
|
|
|
|
return save ? R.success("添加成功") : R.fail("添加失败"); |
|
|
|
|
} |
|
|
|
@ -1274,13 +1272,16 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
String[] split1 = i.getTrayId().split(","); |
|
|
|
|
for (String s : split1) { |
|
|
|
|
List<BasicdataTrayEntity> collect = trayEntityList.stream().filter(w -> w.getId().equals(Long.valueOf(s))).collect(Collectors.toList()); |
|
|
|
|
//托盘
|
|
|
|
|
if (ObjectUtils.isNull(collect)) { |
|
|
|
|
i.setTrayName(collect.get(0).getPalletName()); |
|
|
|
|
} else if (ObjectUtils.isNotNull(i.getTrayName()) && !i.getTrayName().contains(i.getTrayName())) { |
|
|
|
|
i.setTrayName(i.getTrayCode() + "," + collect.get(0).getPalletName()); |
|
|
|
|
if(StringUtil.isNoneBlank(s)){ |
|
|
|
|
List<BasicdataTrayEntity> collect = trayEntityList.stream().filter(w -> w.getId().equals(Long.valueOf(s))).collect(Collectors.toList()); |
|
|
|
|
//托盘
|
|
|
|
|
if (ObjectUtils.isNull(collect)) { |
|
|
|
|
i.setTrayName(collect.get(0).getPalletName()); |
|
|
|
|
} else if (ObjectUtils.isNotNull(i.getTrayName()) && !i.getTrayName().contains(i.getTrayName())) { |
|
|
|
|
i.setTrayName(i.getTrayCode() + "," + collect.get(0).getPalletName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1628,12 +1629,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TaskContractVO> selectcontractList(IPage<Object> page, TaskSearchDTO taskSearchDTO) { |
|
|
|
|
List<Long> collect = this.getmyWarehouseList(); |
|
|
|
|
baseMapper.setSqlMode(); |
|
|
|
|
String goodsType = taskSearchDTO.getGoodsType(); |
|
|
|
|
// LambdaQueryWrapper<QuestDetailEntity> queryWrapper = Wrappers.<QuestDetailEntity>query().lambda()
|
|
|
|
|
// .eq(QuestDetailEntity::getQuestType, 3)
|
|
|
|
|
// .eq(QuestDetailEntity::getQuestId, taskSearchDTO.getTaskId());
|
|
|
|
|
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
List<TaskContractVO> list = new ArrayList<>(); |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setQuestId(taskSearchDTO.getQuestId()); |
|
|
|
@ -1646,7 +1644,36 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
IPage<TaskContractVO> taskPageList = new Page<>(); |
|
|
|
|
List<QuestDetailEntity> questDetailEntityList = baseMapper.selectTaskInfo(taskSearchDTO.getQuestNum(), questDetail); |
|
|
|
|
if (Func.isEmpty(questDetailEntityList)) { |
|
|
|
|
return null; |
|
|
|
|
// 从业务系统获取数据
|
|
|
|
|
DistributionParcelListEntity byPacketBarCodeAndWarehouseId = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(questDetail.getCode(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
if (ObjectUtils.isNotNull(byPacketBarCodeAndWarehouseId)){ |
|
|
|
|
// 得到下面的订单信息
|
|
|
|
|
|
|
|
|
|
List<DistributionParcelListEntity> byPacketBarCode = distributionParcelListClient.findEntityListByOrderCode(byPacketBarCodeAndWarehouseId.getOrderCode(), taskSearchDTO.getWarehouseId()); |
|
|
|
|
|
|
|
|
|
if(ObjectUtils.isEmpty(byPacketBarCode)){ |
|
|
|
|
throw new ServiceException("包件信息不存在"); |
|
|
|
|
}else{ |
|
|
|
|
List<QuestDetailEntity> list1 = new ArrayList<>(); |
|
|
|
|
for (DistributionParcelListEntity distributionParcelListEntity : byPacketBarCode) { |
|
|
|
|
if(distributionParcelListEntity.getWarehouseId().equals(taskSearchDTO.getWarehouseId())){ |
|
|
|
|
QuestDetailEntity questDetailEntity1 = buildQuestDetailEntity(taskSearchDTO.getQuestId(), distributionParcelListEntity, user, null); |
|
|
|
|
// 这里新增2
|
|
|
|
|
questDetailEntity1.setIsNew(1); |
|
|
|
|
list1.add(questDetailEntity1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
baseMapper.insertQuestDetail(taskSearchDTO.getQuestNum(),list1); |
|
|
|
|
// return taskPageList.setRecords(list);
|
|
|
|
|
questDetailEntityList = list1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
Map<Integer, List<QuestDetailEntity>> questDetailMap = questDetailEntityList.stream().collect(Collectors.groupingBy(QuestDetailEntity::getQuestTarget)); |
|
|
|
|
//订制品
|
|
|
|
@ -1827,8 +1854,10 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
private TaskTrayVO getTaskTrayInfo(List<QuestDetailEntity> list1) { |
|
|
|
|
// return baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
|
|
|
|
|
|
|
|
|
|
List<TaskTrayVO> list = new ArrayList<>(); |
|
|
|
|
TaskTrayVO taskTrayVO = new TaskTrayVO(); |
|
|
|
|
if(list1.isEmpty()){ |
|
|
|
|
return taskTrayVO; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QuestDetailEntity questDetailEntity = list1.get(0); |
|
|
|
|
String trayId = questDetailEntity.getTrayId(); |
|
|
|
@ -2010,6 +2039,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
*/ |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public int getTaskInventory(TaskSearchDTO taskSearchDTO, Long warehouseId, BasicdataTrayEntity trayByTrayCode) { |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
//查询是否在当前任务内
|
|
|
|
|
List<TaskQuestChildEntity> list = taskQuestChildService.list(Wrappers.<TaskQuestChildEntity>query().lambda() |
|
|
|
|
.eq(TaskQuestChildEntity::getQuestId, taskSearchDTO.getQuestId()) |
|
|
|
@ -2054,33 +2084,41 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
case "3": //3包件码
|
|
|
|
|
//查询订单ID
|
|
|
|
|
//查询订单信息
|
|
|
|
|
questDetail.setQuestTarget(1);//
|
|
|
|
|
questDetail.setOrderPackageCode(i.getAssociationValue());//包条码
|
|
|
|
|
questDetail.setOrderPackageId(i.getAssociationId());//包件ID
|
|
|
|
|
DistributionParcelListEntity parcelList = new DistributionParcelListEntity(); |
|
|
|
|
parcelList.setId(i.getAssociationId()); |
|
|
|
|
parcelList.setOrderPackageCode(i.getAssociationValue()); |
|
|
|
|
List<DistributionParcelListEntity> parcelList1 = distributionParcelListClient.getParcelList(parcelList); |
|
|
|
|
if (!parcelList1.isEmpty()) { |
|
|
|
|
questDetail.setOrderId(parcelList1.get(0).getStockArticleId()); |
|
|
|
|
} else { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
DistributionStockArticleEntity distributionStockArticleEntity = getStockArticleInfo(parcelList1.get(0).getStockArticleId()); |
|
|
|
|
if (!list.stream().anyMatch(d -> d.getRefName().equals(distributionStockArticleEntity.getMallName()))) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
questDetail.setOrderCode(distributionStockArticleEntity.getOrderCode());//
|
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = getUpdownGoodsPack(i.getAssociationId(), "3", i.getAssociationValue(), warehouseId); |
|
|
|
|
|
|
|
|
|
if (Optional.ofNullable(warehouseUpdownGoodsEntity).isPresent()) { |
|
|
|
|
questDetail.setPositionCode(warehouseUpdownGoodsEntity.getPositionCode());//完整货位
|
|
|
|
|
questDetail.setAllocationId(String.valueOf(warehouseUpdownGoodsEntity.getAllocationId())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// questDetail.setQuestTarget(1);//
|
|
|
|
|
// questDetail.setOrderPackageCode(i.getAssociationValue());//包条码
|
|
|
|
|
// questDetail.setOrderPackageId(i.getAssociationId());//包件ID
|
|
|
|
|
// DistributionParcelListEntity parcelList = new DistributionParcelListEntity();
|
|
|
|
|
// parcelList.setId(i.getAssociationId());
|
|
|
|
|
// parcelList.setOrderPackageCode(i.getAssociationValue());
|
|
|
|
|
// List<DistributionParcelListEntity> parcelList1 = distributionParcelListClient.getParcelList(parcelList);
|
|
|
|
|
// if (!parcelList1.isEmpty()) {
|
|
|
|
|
// questDetail.setOrderId(parcelList1.get(0).getStockArticleId());
|
|
|
|
|
// } else {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// DistributionStockArticleEntity distributionStockArticleEntity = getStockArticleInfo(parcelList1.get(0).getStockArticleId());
|
|
|
|
|
//// if (!list.stream().anyMatch(d -> d.getRefName().equals(distributionStockArticleEntity.getMallName()))) {
|
|
|
|
|
//// continue;
|
|
|
|
|
//// }
|
|
|
|
|
// questDetail.setOrderCode(distributionStockArticleEntity.getOrderCode());//
|
|
|
|
|
// WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = getUpdownGoodsPack(i.getAssociationId(), "3", i.getAssociationValue(), warehouseId);
|
|
|
|
|
//
|
|
|
|
|
// if (Optional.ofNullable(warehouseUpdownGoodsEntity).isPresent()) {
|
|
|
|
|
// questDetail.setPositionCode(warehouseUpdownGoodsEntity.getPositionCode());//完整货位
|
|
|
|
|
// questDetail.setAllocationId(String.valueOf(warehouseUpdownGoodsEntity.getAllocationId()));
|
|
|
|
|
// }
|
|
|
|
|
// questDetail.setIsNew(0);//是否新增
|
|
|
|
|
DistributionParcelListEntity byPacketBarCodeAndWarehouseId = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(i.getAssociationValue(), warehouseId); |
|
|
|
|
questDetail =buildQuestDetailEntity(taskSearchDTO.getQuestId(),byPacketBarCodeAndWarehouseId,user,null); |
|
|
|
|
break; |
|
|
|
|
case "4": //4库存品
|
|
|
|
|
|
|
|
|
|
questDetail.setCreateUser(user.getUserId()); |
|
|
|
|
questDetail.setCreateDept(Long.parseLong(user.getDeptId().split(",")[0])); |
|
|
|
|
questDetail.setStatus(1); |
|
|
|
|
questDetail.setIsDeleted(0); |
|
|
|
|
Date date = new Date(); |
|
|
|
|
questDetail.setCreateTime(date); |
|
|
|
|
questDetail.setUpdateTime(date); |
|
|
|
|
questDetail.setQuestTarget(3);//
|
|
|
|
|
DistributionStockListEntity stockListEntity = new DistributionStockListEntity(); |
|
|
|
|
stockListEntity.setIncomingBatch(i.getIncomingBatch()); |
|
|
|
@ -2089,9 +2127,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
stockListEntity.setMaterialId(i.getAssociationId()); |
|
|
|
|
//查询订单信息
|
|
|
|
|
DistributionStockListEntity stockListInfo = getStockListInfo(stockListEntity); |
|
|
|
|
if (!list.stream().anyMatch(d -> d.getRefName().equals(stockListInfo.getMarketName()))) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// if (!list.stream().anyMatch(d -> d.getRefName().equals(stockListInfo.getMarketName()))) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
stockListEntity.setOrderCode(stockListInfo.getOrderCode()); |
|
|
|
|
DistributionStockListVO queryData = distributionStockListClient.getQueryData(stockListEntity); |
|
|
|
|
WarehouseUpdownGoodsEntity warehouseUpdownGoods = getUpdownGoodsStockList(i.getMarketId(), "4", i.getIncomingBatch(), warehouseId, i.getAssociationId(), i.getAssociationValue()); |
|
|
|
@ -2107,6 +2145,9 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
questDetail.setQuestType(4);//托盘
|
|
|
|
|
questDetail.setQuestStatus(0); //包件盘点状态
|
|
|
|
|
questDetail.setStockNum(i.getNum()); //数量
|
|
|
|
@ -2115,6 +2156,10 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
questDetail.setTrayId(String.valueOf(trayByTrayCode.getId())); |
|
|
|
|
questDetail.setAllocationId(String.valueOf(trayByTrayCode.getId())); |
|
|
|
|
questDetail.setIsNew(0);//是否新增
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 增加商场信息
|
|
|
|
|
|
|
|
|
|
questDetailList.add(questDetail); |
|
|
|
|
} |
|
|
|
|
//添加
|
|
|
|
|