|
|
|
@ -17,20 +17,29 @@
|
|
|
|
|
package com.logpm.warehouse.service.impl; |
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataTrayEntity; |
|
|
|
|
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataTrayClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.basicdata.vo.BasicdataClientVO; |
|
|
|
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockListEntity; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockArticleClient; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockClient; |
|
|
|
|
import com.logpm.distribution.feign.IDistributionStockListClient; |
|
|
|
|
import com.logpm.distribution.vo.DistributionStockListVO; |
|
|
|
|
import com.logpm.oldproject.feign.IWarehouseClient; |
|
|
|
|
import com.logpm.warehouse.bean.Resp; |
|
|
|
|
import com.logpm.warehouse.dto.TaskQuestDTO; |
|
|
|
|
import com.logpm.warehouse.dto.TaskSearchDTO; |
|
|
|
|
import com.logpm.warehouse.entity.TaskQuestChildEntity; |
|
|
|
|
import com.logpm.warehouse.entity.TaskQuestEntity; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity; |
|
|
|
|
import com.logpm.warehouse.entity.*; |
|
|
|
|
import com.logpm.warehouse.mapper.QuestDetailMapper; |
|
|
|
|
import com.logpm.warehouse.mapper.WarehouseTrayGoodsMapper; |
|
|
|
|
import com.logpm.warehouse.mapper.WarehouseUpdownGoodsMapper; |
|
|
|
|
import com.logpm.warehouse.service.IQuestDetailService; |
|
|
|
|
import com.logpm.warehouse.service.ITaskQuestChildService; |
|
|
|
|
import com.logpm.warehouse.vo.*; |
|
|
|
|
import com.logpm.warehouse.excel.TaskQuestExcel; |
|
|
|
@ -38,18 +47,17 @@ import com.logpm.warehouse.mapper.TaskQuestMapper;
|
|
|
|
|
import com.logpm.warehouse.service.ITaskQuestService; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.w3c.dom.css.Rect; |
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Random; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -67,9 +75,13 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
|
|
|
|
|
private final ITaskQuestChildService taskQuestChildService; |
|
|
|
|
|
|
|
|
|
private final IQuestDetailService questDetailService; |
|
|
|
|
|
|
|
|
|
private final WarehouseUpdownGoodsMapper warehouseUpdownGoodsMapper; |
|
|
|
|
|
|
|
|
|
private final WarehouseTrayGoodsMapper warehouseTrayGoodsMapper; |
|
|
|
|
private final IBasicdataTrayClient basicdataTrayClient; |
|
|
|
|
private final IDistributionStockListClient distributionStockListClient; |
|
|
|
|
|
|
|
|
|
private final IDistributionStockArticleClient distributionStockArticleClient; |
|
|
|
|
|
|
|
|
@ -234,20 +246,118 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TaskTrayVO> selecttrayList(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO) { |
|
|
|
|
public R selecttrayList(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO) { |
|
|
|
|
//查询托盘编码
|
|
|
|
|
BasicdataTrayEntity trayByTrayCode = basicdataTrayClient.getTrayByTrayCode(taskSearchDTO.getTrayCode()); |
|
|
|
|
Optional<BasicdataTrayEntity> trayByTrayCode1 = Optional.ofNullable(trayByTrayCode); |
|
|
|
|
if(!trayByTrayCode1.isPresent()){ |
|
|
|
|
Resp.scanFail("托盘码不存在!","托盘码不存在!"); |
|
|
|
|
} |
|
|
|
|
List<Long> collect =this.getmyWarehouseList(); |
|
|
|
|
baseMapper.setSqlMode(); |
|
|
|
|
List<TaskTrayVO> list = baseMapper.selecttrayList(page, taskSearchDTO, collect); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
List<TaskTrayVO> list = baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
|
|
|
|
|
if (!list.isEmpty()){ //有盘点数据
|
|
|
|
|
for (TaskTrayVO taskTrayVO : list) { |
|
|
|
|
//查询托盘
|
|
|
|
|
//查询托盘上面的数量
|
|
|
|
|
Integer i = warehouseTrayGoodsMapper.SumByTrayId(taskTrayVO.getTrayId()); |
|
|
|
|
taskTrayVO.setTotal(i); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//添加扫描的托盘信息
|
|
|
|
|
|
|
|
|
|
//添加托盘上面的数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return page.setRecords(list); |
|
|
|
|
page.setRecords(list); |
|
|
|
|
return R.data(page); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据托盘ID查询托盘货位并添加 |
|
|
|
|
* @param taskId 盘点ID |
|
|
|
|
* @param warehouseId 仓库ID |
|
|
|
|
* @param trayId 托盘ID |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private int getTaskInventory(Long taskId,Long warehouseId,Long trayId){ |
|
|
|
|
|
|
|
|
|
List<WarehouseTrayGoodsEntity> warehouseTrayGoodsEntities = warehouseTrayGoodsMapper.selectList(Wrappers.<WarehouseTrayGoodsEntity>query().lambda() |
|
|
|
|
.eq(WarehouseTrayGoodsEntity::getTrayId, trayId) |
|
|
|
|
.eq(WarehouseTrayGoodsEntity::getWarehouseId, warehouseId) |
|
|
|
|
); |
|
|
|
|
if(!warehouseTrayGoodsEntities.isEmpty()){ |
|
|
|
|
List<QuestDetailEntity> questDetailList = new ArrayList<>(); |
|
|
|
|
warehouseTrayGoodsEntities.forEach( i -> { |
|
|
|
|
QuestDetailEntity questDetail = new QuestDetailEntity(); |
|
|
|
|
questDetail.setQuestId(taskId); |
|
|
|
|
switch (i.getAssociationType()){ |
|
|
|
|
case "1": //1.订单号
|
|
|
|
|
questDetail.setOrderId(i.getAssociationId()); |
|
|
|
|
questDetail.setQuestTarget(2);//零担
|
|
|
|
|
questDetail.setCategoryName(i.getGoodsName()); |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case "2": //2运单号
|
|
|
|
|
break; |
|
|
|
|
case "3": //3包件码
|
|
|
|
|
//查询订单ID
|
|
|
|
|
questDetail.setQuestTarget(1);//
|
|
|
|
|
questDetail.setOrdePackageCode(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()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case "4": //4库存品
|
|
|
|
|
questDetail.setQuestTarget(3);//
|
|
|
|
|
DistributionStockListEntity stockListEntity = new DistributionStockListEntity(); |
|
|
|
|
stockListEntity.setIncomingBatch(i.getIncomingBatch()); |
|
|
|
|
stockListEntity.setWarehouseId(warehouseId); |
|
|
|
|
stockListEntity.setMarketId(i.getMarketId()); |
|
|
|
|
stockListEntity.setMaterialId(i.getAssociationId()); |
|
|
|
|
DistributionStockListVO queryData = distributionStockListClient.getQueryData(stockListEntity); |
|
|
|
|
Optional<DistributionStockListVO> queryData1 = Optional.ofNullable(queryData); |
|
|
|
|
if(queryData1.isPresent()){ |
|
|
|
|
questDetail.setStockId(queryData.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
questDetail.setQuestType(4);//托盘
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// questDetail.setOrdePackageCode(4);//托盘
|
|
|
|
|
// questDetail.setQuestType(4);//托盘
|
|
|
|
|
// questDetail.setQuestType(4);//托盘
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
questDetailList.add(questDetail); |
|
|
|
|
}); |
|
|
|
|
//添加
|
|
|
|
|
if(!questDetailList.isEmpty()){ |
|
|
|
|
questDetailService.saveBatch(questDetailList); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
log.debug("托盘没有货位"); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<TaskStripApiVO> selectallocationDetailByStrip(IPage<TaskStripApiVO> page, TaskSearchDTO taskSearchDTO) { |
|
|
|
|
//查询货位上的所有包条
|
|
|
|
|