Browse Source

添加托盘包件信息

training
caoyizhong 1 year ago
parent
commit
d76676d104
  1. 11
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TaskTrayVO.java
  2. 3
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml
  3. 272
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

11
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/TaskTrayVO.java

@ -30,6 +30,17 @@ public class TaskTrayVO {
*/
@ApiModelProperty(value = "货物类型")
private String goodsType;
/**
* 盘点状态;0 待盘点 1. 已盘 2未盘点 3已排除
*/
@ApiModelProperty(value = "盘点状态;0 待盘点 1. 已盘 2未盘点 3已排除")
private Integer questStatus;
/**
* 在库数量
*/
@ApiModelProperty(value = "在库数量")
private Integer stockNum;
/**
* 盘点件数

3
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/TaskQuestMapper.xml

@ -111,7 +111,8 @@
lqd.tray_id trayId,
lqd.tray_code trayCode,
lqd.quest_target goodsType,
sum( lqd.stock_num ) unTotal
lqd.quest_status questStatus
lqd.stock_num stockNum
FROM
logpm_quest_detail lqd
<where>

272
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

@ -18,6 +18,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.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.*;
@ -251,6 +252,13 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
@Override
public R selecttrayList(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO) {
//todo 验证盘点信息
//先判定盘点任务是否已结束
//当前登录人选择的仓库
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
verifyTask(taskSearchDTO.getTaskId(),myCurrentWarehouse.getId());
//查询托盘编码
BasicdataTrayEntity trayByTrayCode = basicdataTrayClient.getTrayByTrayCode(taskSearchDTO.getTrayCode());
Optional<BasicdataTrayEntity> trayByTrayCode1 = Optional.ofNullable(trayByTrayCode);
@ -259,18 +267,35 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
}
List<Long> collect =this.getmyWarehouseList();
baseMapper.setSqlMode();
List<TaskTrayVO> list = baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
List<TaskTrayVO> list = getTaskTrayInfo(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
if (!list.isEmpty()){ //有盘点数据
for (TaskTrayVO taskTrayVO : list) {
//查询托盘上面的数量
Integer i = warehouseTrayGoodsMapper.SumByTrayId(taskTrayVO.getTrayId());
taskTrayVO.setTotal(i);
}
// for (TaskTrayVO taskTrayVO : list) {
// //查询托盘上面的数量
// Integer i = warehouseTrayGoodsMapper.SumByTrayId(taskTrayVO.getTrayId());
// taskTrayVO.setTotal(i);
// }
list.stream().mapToInt(TaskTrayVO::getStockNum).sum();
}else{
//添加扫描的托盘信息
//添加托盘上面的数据
int taskInventory = getTaskInventory(taskSearchDTO.getTaskId(), collect.get(0), trayByTrayCode);
switch (taskInventory){
case 0:
return Resp.scanFail("没有盘点信息!","没有盘点信息!");
case 1:
break;
case 2:
return Resp.scanFail("托盘信息未找到!","托盘信息未找到!");
case 3:
return Resp.scanFail("无包件信息!","无包件信息!");
}
}
@ -278,85 +303,190 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
return R.data(page);
}
/**
* 查询托盘信息
* @return
*/
private List<TaskTrayVO> getTaskTrayInfo(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO,List<Long> collect){
return baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
}
/**
* 根据托盘ID查询托盘货位并添加
* @param taskId 盘点ID
* @param warehouseId 仓库ID
* @param trayId 托盘ID
* @param trayByTrayCode 托盘
* @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)
private int getTaskInventory(Long taskId,Long warehouseId,BasicdataTrayEntity trayByTrayCode){
//查询是否在当前任务内
List<TaskQuestChildEntity> list = taskQuestChildService.list(Wrappers.<TaskQuestChildEntity>query().lambda()
.eq(TaskQuestChildEntity::getQuestId, taskId)
);
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());
if(!list.isEmpty()){
boolean b = list.stream().anyMatch(t -> ObjectUtils.isNotNull(t.getRefId()));
List<WarehouseTrayGoodsEntity> warehouseTrayGoodsEntities = warehouseTrayGoodsMapper.selectList(Wrappers.<WarehouseTrayGoodsEntity>query().lambda()
.eq(WarehouseTrayGoodsEntity::getTrayId, trayByTrayCode.getId())
.eq(WarehouseTrayGoodsEntity::getWarehouseId, warehouseId)
);
if(!warehouseTrayGoodsEntities.isEmpty()){
List<QuestDetailEntity> questDetailList = new ArrayList<>();
for (int ii = 0; ii < warehouseTrayGoodsEntities.size(); ii++) {
WarehouseTrayGoodsEntity i = warehouseTrayGoodsEntities.get(ii);
QuestDetailEntity questDetail = new QuestDetailEntity();
questDetail.setQuestId(taskId);
switch (i.getAssociationType()){
case "1": //1.订单号
if(b){
//部分盘点
//查询订单信息
DistributionStockArticleEntity distributionStockArticleEntity = getStockArticleInfo(i.getAssociationId());
if(!list.stream().anyMatch(d -> d.getRefId().equals(distributionStockArticleEntity.getMallId()))){
continue;
}
}
questDetail.setOrderId(i.getAssociationId());
questDetail.setQuestTarget(2);//零担
questDetail.setCategoryName(i.getGoodsName());
WarehouseUpdownGoodsEntity updownGoodsEntity = getUpdownGoodsPack(i.getAssociationId(),"1",i.getAssociationValue(),warehouseId);
if(Optional.ofNullable(updownGoodsEntity).isPresent()){
questDetail.setPositionCode(updownGoodsEntity.getPositionCode());//完整货位
questDetail.setAllocationId(updownGoodsEntity.getAllocationId());
}
break;
case "2": //2运单号
break;
case "3": //3包件码
//查询订单ID
//查询订单信息
DistributionStockArticleEntity distributionStockArticleEntity = getStockArticleInfo(i.getAssociationId());
if(!list.stream().anyMatch(d -> d.getRefId().equals(distributionStockArticleEntity.getMallId()))){
continue;
}
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);
WarehouseUpdownGoodsEntity warehouseUpdownGoodsEntity = getUpdownGoodsPack(i.getAssociationId(),"3",i.getAssociationValue(),warehouseId);
if(Optional.ofNullable(warehouseUpdownGoodsEntity).isPresent()){
questDetail.setPositionCode(warehouseUpdownGoodsEntity.getPositionCode());//完整货位
questDetail.setAllocationId(warehouseUpdownGoodsEntity.getAllocationId());
}
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());
//查询订单信息
DistributionStockListEntity stockListInfo = getStockListInfo(stockListEntity);
if(!list.stream().anyMatch(d -> d.getRefId().equals(stockListInfo.getMarketId()))){
continue;
}
DistributionStockListVO queryData = distributionStockListClient.getQueryData(stockListEntity);
WarehouseUpdownGoodsEntity warehouseUpdownGoods = warehouseUpdownGoodsMapper.selectOne(Wrappers.<WarehouseUpdownGoodsEntity>query().lambda()
.eq(WarehouseUpdownGoodsEntity::getAssociationValue, i.getAssociationValue())
.eq(WarehouseUpdownGoodsEntity::getMarketId, i.getMarketId())
.eq(WarehouseUpdownGoodsEntity::getIncomingBatch, i.getIncomingBatch())
.eq(WarehouseUpdownGoodsEntity::getAssociationId, i.getAssociationId())
.eq(WarehouseUpdownGoodsEntity::getAssociationType, "4")
.eq(WarehouseUpdownGoodsEntity::getWarehouseId, warehouseId)
);
if(Optional.ofNullable(warehouseUpdownGoods).isPresent()){
questDetail.setPositionCode(warehouseUpdownGoods.getPositionCode());//完整货位
questDetail.setAllocationId(warehouseUpdownGoods.getAllocationId());
}
Optional<DistributionStockListVO> queryData1 = Optional.ofNullable(queryData);
if(queryData1.isPresent()){
questDetail.setStockId(queryData.getId());
}
break;
}
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.setQuestStatus(0); //包件盘点状态
questDetail.setStockNum(i.getNum()); //数量
questDetail.setWarehouseId(warehouseId);//仓库id
questDetail.setTrayCode(trayByTrayCode.getPalletCode());
questDetail.setTrayId(trayByTrayCode.getId());
questDetail.setAllocationId(trayByTrayCode.getId());
questDetail.setIsNew(0);//是否新增
questDetailList.add(questDetail);
}
questDetail.setQuestType(4);//托盘
// questDetail.setOrdePackageCode(4);//托盘
// questDetail.setQuestType(4);//托盘
// questDetail.setQuestType(4);//托盘
questDetailList.add(questDetail);
});
//添加
if(!questDetailList.isEmpty()){
questDetailService.saveBatch(questDetailList);
//添加
if(!questDetailList.isEmpty()){
questDetailService.saveBatch(questDetailList);
return 1;
}else{
log.debug("托盘盘点:没有物料信息");
return 3;
}
}else{
log.debug("托盘盘点:托盘没有货物信息");
return 2;
}
}else{
log.debug("托盘没有货位");
log.debug("托盘盘点:没有当前盘点任务!");
return 0;
}
}
/**
* 包件订单查询货位信息
* @return
*/
private WarehouseUpdownGoodsEntity getUpdownGoodsPack(Long associationId,String type,String associationValue,Long warehouseId){
return warehouseUpdownGoodsMapper.selectOne(Wrappers.<WarehouseUpdownGoodsEntity>query().lambda()
.eq(WarehouseUpdownGoodsEntity::getAssociationValue, associationValue)
.eq(WarehouseUpdownGoodsEntity::getAssociationId, associationId)
.eq(WarehouseUpdownGoodsEntity::getAssociationType, type)
.eq(WarehouseUpdownGoodsEntity::getWarehouseId, warehouseId)
);
}
/**
* 库存品查询货位信息
* @return
*/
private WarehouseUpdownGoodsEntity getUpdownGoodsStpck(Long marketId,String type,String incomingBatch,Long warehouseId,Long associationId ,Long associationValue){
return warehouseUpdownGoodsMapper.selectOne(Wrappers.<WarehouseUpdownGoodsEntity>query().lambda()
.eq(WarehouseUpdownGoodsEntity::getAssociationValue, associationValue)
.eq(WarehouseUpdownGoodsEntity::getMarketId, marketId)
.eq(WarehouseUpdownGoodsEntity::getIncomingBatch, incomingBatch)
.eq(WarehouseUpdownGoodsEntity::getAssociationId, associationId)
.eq(WarehouseUpdownGoodsEntity::getAssociationType, type)
.eq(WarehouseUpdownGoodsEntity::getWarehouseId, warehouseId)
);
}
/**
* 订单ID查询订单信息
* @return
*/
private DistributionStockArticleEntity getStockArticleInfo(Long stockArticleID){
return distributionStockArticleClient.findEntityByStockArticleId(stockArticleID);
}
return 1;
/**
* 订单ID查询订单信息
* @return
*/
private DistributionStockListEntity getStockListInfo(DistributionStockListEntity distributionStockListEntity){
return distributionStockListClient.getQueryData(distributionStockListEntity);
}

Loading…
Cancel
Save