| | |
| | | StartupDto startupDto = new StartupDto(); |
| | | // 生成工作号 |
| | | int workNo = getWorkNo(0); |
| | | |
| | | switch (sourceStaNo) { |
| | | case 202: |
| | | whsType = 2; |
| | | break; |
| | | case 205: |
| | | whsType = 1; |
| | | break; |
| | | case 126: |
| | | whsType = 3; |
| | | break; |
| | | case 110: |
| | | whsType = 4; |
| | | break; |
| | | case 301: |
| | | whsType = 5; |
| | | break; |
| | | default: |
| | | throw new CoolException("库位排号分配错误, 源站号:" + sourceStaNo); |
| | | } |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | // 1-4排 |
| | | if (whsType == 1) { |
| | | for (int i = 0; i < shelves.group; i ++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | | } |
| | | Integer crnNo1 = shelves.get(curRow); |
| | | if (basCrnpService.checkSiteError(crnNo1, true)) { |
| | | crnNo = crnNo1; |
| | | break; |
| | | } |
| | | } |
| | | // 5-8排 |
| | | } else if (whsType == 2) { |
| | | curRow = curRow - 4; |
| | | for (int i = 0; i < shelves.group; i ++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | | } |
| | | Integer crnNo1 = shelves.get(curRow); |
| | | if (basCrnpService.checkSiteError(crnNo1 + 1, true)) { |
| | | // 偏移量补偿 |
| | | curRow = curRow + 4; |
| | | crnNo = crnNo1 + 1; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | // 126空板入 1-8排 |
| | | } else { |
| | | for (int i = 0; i < shelves.group; i ++) { |
| | | curRow = shelves.start(curRow); |
| | | if (curRow < 0) { |
| | |
| | | if (times < rowCount) { |
| | | times = times + 1; |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | } else { |
| | | times = 0; |
| | | } |
| | | |
| | | // 轻货物找轻库位为空时,可以去找重库位仓 |
| | | if (locTypeDto.getLocType1() == 1) { |
| | | locTypeDto.setLocType1((short) 2); |
| | | return getLocNo(null, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |