| | |
| | | } |
| | | |
| | | /** |
| | | * 供 6.15 重分配接口复用:按外部指定的堆垛机顺序,在指定库区内找新的入库位。 |
| | | * |
| | | * 这里不推进 row_lastno 游标,只负责一次性的路径校验 + 设备校验 + 空库位搜索。 |
| | | */ |
| | | public StartupDto findRun2InboundLocByCandidateCrnNos(Integer sourceStaNo, Integer staDescId, Integer preferredArea, |
| | | List<Integer> candidateCrnNos, LocTypeDto locTypeDto) { |
| | | if (sourceStaNo == null) { |
| | | throw new CoolException("源站不能为空"); |
| | | } |
| | | if (Cools.isEmpty(candidateCrnNos)) { |
| | | return null; |
| | | } |
| | | Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | RowLastno defaultRowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(defaultRowLastno)) { |
| | | throw new CoolException("站点=" + sourceStaNo + " 未查询到对应的库位规则"); |
| | | } |
| | | RowLastno searchRowLastno = defaultRowLastno; |
| | | if (preferredArea != null && preferredArea > 0) { |
| | | RowLastno areaRowLastno = rowLastnoService.selectById(preferredArea); |
| | | if (Cools.isEmpty(areaRowLastno)) { |
| | | throw new CoolException("未找到库区轮询规则"); |
| | | } |
| | | searchRowLastno = areaRowLastno; |
| | | } |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(searchRowLastno.getTypeId()); |
| | | if (Cools.isEmpty(rowLastnoType)) { |
| | | throw new CoolException("数据异常,请联系管理员===》库位规则类型未知"); |
| | | } |
| | | if (rowLastnoType.getType() != 1 && rowLastnoType.getType() != 2) { |
| | | throw new CoolException("当前仓库不支持重新分配入库位"); |
| | | } |
| | | StartupDto startupDto = new StartupDto(); |
| | | LocMast locMast = findRun2EmptyLocByCrnNos(searchRowLastno, rowLastnoType, candidateCrnNos, locTypeDto, |
| | | staDescId, sourceStaNo, startupDto, preferredArea, "reassign-inbound"); |
| | | if (Cools.isEmpty(locMast) || !"O".equals(locMast.getLocSts())) { |
| | | return null; |
| | | } |
| | | startupDto.setSourceStaNo(sourceStaNo); |
| | | startupDto.setCrnNo(locMast.getCrnNo()); |
| | | startupDto.setLocNo(locMast.getLocNo()); |
| | | return startupDto; |
| | | } |
| | | |
| | | /** |
| | | * 空托盘识别规则: |
| | | * 1. 以组托档物料编码 matnr=emptyPallet 为主,不再依赖 ioType=10。 |
| | | * 2. 保留 staDescId=10 的兼容判断,避免旧链路还未切换时行为突变。 |