Browse Source

修改托盘列表查询

training
caoyizhong 1 year ago
parent
commit
5890898505
  1. 22
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java
  2. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java
  3. 128
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

22
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseTaskApiController.java

@ -80,9 +80,6 @@ public class WarehouseTaskApiController {
if(ObjectUtils.isNull(taskSearchDTO.getTaskId())){
return R.fail("盘点任务id不能为空");
}
if(ObjectUtils.isNull(taskSearchDTO.getTrayCode())){
return R.fail("托盘编码不能为空");
}
R r= taskQuestService.selecttrayList(Condition.getPage(query), taskSearchDTO);
return r;
}else{
@ -90,6 +87,25 @@ public class WarehouseTaskApiController {
}
}
/**
* 托盘列表
*/
@GetMapping("/trayListInfo")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "托盘列表", notes = "code,type")
public R trayListInfo(TaskSearchDTO taskSearchDTO, Query query) {
Optional<TaskSearchDTO> taskSearchDTO1 = Optional.ofNullable(taskSearchDTO);
if(taskSearchDTO1.isPresent()){
if(ObjectUtils.isNull(taskSearchDTO.getTaskId())){
return R.fail("盘点任务id不能为空");
}
R r= taskQuestService.trayListInfo(Condition.getPage(query), taskSearchDTO);
return r;
}else{
return R.fail("参数未传递!");
}
}
/**
* 库位明细(定制品)
*/

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/ITaskQuestService.java

@ -88,4 +88,11 @@ public interface ITaskQuestService extends BaseService<TaskQuestEntity> {
void deleteQuestDetail(TaskSearchDTO taskSearchDTO);
/**
* 盘点托盘明细查询
* @param page
* @param taskSearchDTO
* @return
*/
R trayListInfo(IPage<Object> page, TaskSearchDTO taskSearchDTO);
}

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

@ -56,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
@ -267,50 +268,102 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
}
List<Long> collect =this.getmyWarehouseList();
baseMapper.setSqlMode();
List<TaskTrayVO> list = getTaskTrayInfo(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
if (!list.isEmpty()){ //有盘点数据
// for (TaskTrayVO taskTrayVO : list) {
// //查询托盘上面的数量
// Integer i = warehouseTrayGoodsMapper.SumByTrayId(taskTrayVO.getTrayId());
// taskTrayVO.setTotal(i);
// }
list.stream().mapToInt(TaskTrayVO::getStockNum).sum();
if(ObjectUtils.isNotNull(taskSearchDTO.getTrayCode())){
//查询传入的托盘数据
List<QuestDetailEntity> list = getQuestDetailList(taskSearchDTO,myCurrentWarehouse.getId(),trayByTrayCode.getId());
// List<TaskTrayVO> list = getTaskTrayInfo(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
if (!list.isEmpty()){ //有盘点数据
return R.data(getTaskTrayInfo(list));
}else{
//添加扫描的托盘信息
//添加托盘上面的数据
int taskInventory = getTaskInventory(taskSearchDTO.getTaskId(), collect.get(0), trayByTrayCode);
switch (taskInventory){
case 0:
return Resp.scanFail("没有盘点信息!","没有盘点信息!");
case 1:
List<QuestDetailEntity> questDetailList = getQuestDetailList(taskSearchDTO,myCurrentWarehouse.getId(),trayByTrayCode.getId());
return R.data(getTaskTrayInfo(questDetailList));
case 2:
return Resp.scanFail("托盘信息未找到!","托盘信息未找到!");
case 3:
return Resp.scanFail("无包件信息!","无包件信息!");
default:
return Resp.scanFail("注意,注意:未知查询!","注意,注意:未知查询!");
}
}
}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("无包件信息!","无包件信息!");
//查询有没有托盘的数据
List<QuestDetailEntity> list1 = getQuestDetailList(taskSearchDTO,myCurrentWarehouse.getId(),trayByTrayCode.getId());
if(!list1.isEmpty()){
// int sum = list1.stream().mapToInt(QuestDetailEntity::getStockNum).sum(); //总数
return R.data(getTaskTrayInfo(list1));
}
return null;
}
page.setRecords(list);
return R.data(page);
}
/**
* 查询托盘信息
* @return
*/
private List<TaskTrayVO> getTaskTrayInfo(IPage<TaskTrayVO> page, TaskSearchDTO taskSearchDTO,List<Long> collect){
return baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
private List<TaskTrayVO> getTaskTrayInfo(List<QuestDetailEntity> list1){
// return baseMapper.selecttrayList(page,taskSearchDTO,collect);// 查询有没有当次盘点任务的托盘数据
List<TaskTrayVO> list = new ArrayList<>();
list1.stream().collect(Collectors.groupingBy(QuestDetailEntity::getTrayId))
.forEach((k,v) ->{
TaskTrayVO taskTrayVO = new TaskTrayVO();
taskTrayVO.setTrayId(k);
AtomicReference<Integer> num = new AtomicReference<>(0); //总数
AtomicReference<Integer> unTotal = new AtomicReference<>(0); //盘点数
v.forEach( p ->{
taskTrayVO.setTrayCode(p.getTrayCode());
num.set(num.get() + p.getStockNum());
if(p.getQuestStatus().equals(1)){
unTotal.set(unTotal.get() + p.getQuestStatus());
}
switch (p.getQuestTarget()){
case 1:
taskTrayVO.setGoodsType("定制品");
break;
case 2:
taskTrayVO.setGoodsType("零担");
break;
case 3:
taskTrayVO.setGoodsType("库存品");
break;
}
});
taskTrayVO.setTotal(num.get());
taskTrayVO.setUnTotal(unTotal.get());
list.add(taskTrayVO);
});
return list;
}
/**
* 查询托盘里面的信息
* @param taskSearchDTO
* @param warehouseId
* @param trayId
* @return
*/
private List<QuestDetailEntity> getQuestDetailList(TaskSearchDTO taskSearchDTO,Long warehouseId,Long trayId){
return questDetailService.list(Wrappers.<QuestDetailEntity>query().lambda()
.eq(QuestDetailEntity::getWarehouseId, warehouseId)
.eq(QuestDetailEntity::getQuestId, taskSearchDTO.getTaskId())
.eq(ObjectUtils.isNotNull(trayId),QuestDetailEntity::getTrayId, trayId)
.eq(QuestDetailEntity::getQuestType, 4)
);
}
@Override
public R trayListInfo(IPage<Object> page, TaskSearchDTO taskSearchDTO) {
return null;
}
@ -399,14 +452,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
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)
);
WarehouseUpdownGoodsEntity warehouseUpdownGoods = getUpdownGoodsStockList(i.getMarketId(),"4",i.getIncomingBatch(),warehouseId, i.getAssociationId(), i.getAssociationValue());
if(Optional.ofNullable(warehouseUpdownGoods).isPresent()){
questDetail.setPositionCode(warehouseUpdownGoods.getPositionCode());//完整货位
questDetail.setAllocationId(warehouseUpdownGoods.getAllocationId());
@ -463,7 +509,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
* 库存品查询货位信息
* @return
*/
private WarehouseUpdownGoodsEntity getUpdownGoodsStpck(Long marketId,String type,String incomingBatch,Long warehouseId,Long associationId ,Long associationValue){
private WarehouseUpdownGoodsEntity getUpdownGoodsStockList(Long marketId,String type,String incomingBatch,Long warehouseId,Long associationId ,String associationValue){
return warehouseUpdownGoodsMapper.selectOne(Wrappers.<WarehouseUpdownGoodsEntity>query().lambda()
.eq(WarehouseUpdownGoodsEntity::getAssociationValue, associationValue)
.eq(WarehouseUpdownGoodsEntity::getMarketId, marketId)

Loading…
Cancel
Save