|
|
@ -1,5 +1,8 @@ |
|
|
package com.gaotao.modules.automatedWarehouse.service.impl; |
|
|
package com.gaotao.modules.automatedWarehouse.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
|
import com.gaotao.common.utils.PageUtils; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcs; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcs; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcsPalletList; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcsPalletList; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcsPalletSubDetail; |
|
|
import com.gaotao.modules.api.entity.NotifyDataToWcsPalletSubDetail; |
|
|
@ -73,25 +76,26 @@ public class PalletMergeQueryServiceImpl implements PalletMergeQueryService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 查询需要合托的托盘列表 - rqrq |
|
|
|
|
|
|
|
|
* @Description 查询需要合托的托盘列表(分页)- rqrq |
|
|
* |
|
|
* |
|
|
* <p><b>查询逻辑:</b></p> |
|
|
* <p><b>查询逻辑:</b></p> |
|
|
* <ol> |
|
|
* <ol> |
|
|
* <li>先计算该pallet_type在立库中装得最多的栈板的position+layer count</li> |
|
|
|
|
|
|
|
|
* <li>如果前端传入maxPositionCount则使用,否则计算该类型最大已用位置数</li> |
|
|
* <li>查询立库中该类型的栈板,count>0 且 count<最大count</li> |
|
|
* <li>查询立库中该类型的栈板,count>0 且 count<最大count</li> |
|
|
* <li>只查询calling_flag='N'的栈板</li> |
|
|
* <li>只查询calling_flag='N'的栈板</li> |
|
|
* <li>按count从小到大排序</li> |
|
|
* <li>按count从小到大排序</li> |
|
|
|
|
|
* <li>返回分页结果</li> |
|
|
* </ol> |
|
|
* </ol> |
|
|
* |
|
|
* |
|
|
* @Title searchPalletMergeList |
|
|
* @Title searchPalletMergeList |
|
|
* @param data 查询条件(包含site和palletType) |
|
|
|
|
|
* @return List<PalletMergeQueryData> |
|
|
|
|
|
|
|
|
* @param data 查询条件(包含site、palletType、maxPositionCount可选、page、limit) |
|
|
|
|
|
* @return PageUtils 分页结果 |
|
|
* @author rqrq |
|
|
* @author rqrq |
|
|
* @date 2026/01/06 |
|
|
|
|
|
|
|
|
* @date 2026/01/15 |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public List<PalletMergeQueryData> searchPalletMergeList(PalletMergeQueryData data) { |
|
|
|
|
|
System.out.println("开始查询需要合托的托盘列表 - rqrq,site=" + data.getSite() + ", palletType=" + data.getPalletType()); |
|
|
|
|
|
|
|
|
public PageUtils searchPalletMergeList(PalletMergeQueryData data) { |
|
|
|
|
|
System.out.println("开始查询需要合托的托盘列表(分页)- rqrq,site=" + data.getSite() + ", palletType=" + data.getPalletType() + ", 前端传入maxPositionCount=" + data.getMaxPositionCount()); |
|
|
|
|
|
|
|
|
// 参数校验 - rqrq |
|
|
// 参数校验 - rqrq |
|
|
if (!StringUtils.hasText(data.getSite())) { |
|
|
if (!StringUtils.hasText(data.getSite())) { |
|
|
@ -101,22 +105,39 @@ public class PalletMergeQueryServiceImpl implements PalletMergeQueryService { |
|
|
throw new RuntimeException("托盘类型不能为空"); |
|
|
throw new RuntimeException("托盘类型不能为空"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Step 1: 计算该类型在立库中装得最多的栈板的position+layer count - rqrq |
|
|
|
|
|
Integer maxPositionCount = palletMergeQueryMapper.getMaxPositionCount(data.getSite(), data.getPalletType()); |
|
|
|
|
|
System.out.println("该类型最大已用位置数: " + maxPositionCount + " - rqrq"); |
|
|
|
|
|
|
|
|
// 设置默认分页参数 - rqrq |
|
|
|
|
|
if (data.getPage() == null || data.getPage() <= 0) { |
|
|
|
|
|
data.setPage(1); |
|
|
|
|
|
} |
|
|
|
|
|
if (data.getLimit() == null || data.getLimit() <= 0) { |
|
|
|
|
|
data.setLimit(20); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 如果前端传入maxPositionCount则使用,否则计算该类型最大已用位置数 - rqrq |
|
|
|
|
|
Integer maxPositionCount = data.getMaxPositionCount(); |
|
|
|
|
|
if (maxPositionCount == null || maxPositionCount <= 0) { |
|
|
|
|
|
maxPositionCount = palletMergeQueryMapper.getMaxPositionCount(data.getSite(), data.getPalletType())-1; |
|
|
|
|
|
System.out.println("后端计算最大已用位置数: " + maxPositionCount + " - rqrq"); |
|
|
|
|
|
} else { |
|
|
|
|
|
System.out.println("使用前端传入的最大已用位置数: " + maxPositionCount + " - rqrq"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 如果没有任何栈板或最大count为0,返回空列表 - rqrq |
|
|
|
|
|
|
|
|
// 如果没有任何栈板或最大count为0,返回空分页结果 - rqrq |
|
|
if (maxPositionCount == null || maxPositionCount <= 0) { |
|
|
if (maxPositionCount == null || maxPositionCount <= 0) { |
|
|
System.out.println("没有找到该类型的栈板,返回空列表 - rqrq"); |
|
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
|
|
|
|
System.out.println("没有找到该类型的栈板,返回空分页结果 - rqrq"); |
|
|
|
|
|
return new PageUtils(new ArrayList<>(), 0, data.getLimit(), data.getPage()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Step 2: 查询count>0 且 count<最大count的栈板,按count从小到大排序 - rqrq |
|
|
|
|
|
List<PalletMergeQueryData> list = palletMergeQueryMapper.searchPalletMergeList( |
|
|
|
|
|
data.getSite(), data.getPalletType(), maxPositionCount); |
|
|
|
|
|
|
|
|
// 设置maxPositionCount到data用于查询 - rqrq |
|
|
|
|
|
data.setMaxPositionCount(maxPositionCount); |
|
|
|
|
|
|
|
|
System.out.println("查询需要合托的托盘列表完成,共" + list.size() + "条记录 - rqrq"); |
|
|
|
|
|
return list; |
|
|
|
|
|
|
|
|
// 使用MyBatis-Plus分页方式查询 - rqrq |
|
|
|
|
|
IPage<PalletMergeQueryData> resultList = palletMergeQueryMapper.searchPalletMergeListPage( |
|
|
|
|
|
new Page<>(data.getPage(), data.getLimit()), data); |
|
|
|
|
|
PageUtils pageResult = new PageUtils(resultList); |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("查询需要合托的托盘列表完成,共" + resultList.getTotal() + "条记录 - rqrq"); |
|
|
|
|
|
return pageResult; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|