| | |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.common.model.StartupDto; |
| | |
| | | */ |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos) { |
| | | StartupDto startupDto = new StartupDto(); |
| | | int workNo = getWorkNo(WorkNoType.getWorkNoType(staDescId)); |
| | | startupDto.setWorkNo(workNo); |
| | | if (sourceStaNo < 100) { |
| | | whsType = 1; |
| | | } else { |
| | | whsType = 2; |
| | | } |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |
| | |
| | | int curRow = rowLastno.getCurrentRow(); |
| | | int sRow = rowLastno.getsRow(); |
| | | int eRow = rowLastno.geteRow(); |
| | | int crn_qty = rowLastno.getCrnQty(); |
| | | int rowCount = eRow - sRow + 1; |
| | | |
| | | // 获取目标站所在货架排号 |
| | | curRow = curRow == sRow ? eRow : sRow; |
| | | // 目标堆垛机号 |
| | | int crnNo = 0; |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | | // 同一天同规格货物靠近摆法规则 |
| | | // if (!Cools.isEmpty(matNos)) { |
| | | // List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0)); |
| | | // for (String locNo : locNos) { |
| | | // // 获取排 |
| | | // int row = Integer.parseInt(locNo.substring(0, 2)); |
| | | // // 判断是否为深库位 |
| | | // double remainder = Arith.remainder(row, rowCount / crn_qty); |
| | | // int targetRow; |
| | | // if (remainder == 1) { |
| | | // // 得到当前库位的外围库位 |
| | | // targetRow = row + 1; |
| | | // } else if (remainder == 0) { |
| | | // // 得到当前库位的内围库位 |
| | | // targetRow = row - 1; |
| | | // } else { |
| | | // continue; |
| | | // } |
| | | // String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2); |
| | | // // 检测目标库位是否为空库位 |
| | | // LocMast targetLocMast = locMastService.selectById(targetLocNo); |
| | | // if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) { |
| | | // locMast = targetLocMast; |
| | | // crnNo = locMast.getCrnNo(); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | // 获取目标站所在货架排号 todo:luxiaotao |
| | | if (curRow == sRow) { |
| | | curRow = eRow; |
| | | } else { |
| | | curRow = sRow; |
| | | } |
| | | crnNo = whsType; |
| | | // Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | // curRow = shelves.start(curRow); |
| | | // if (curRow < 0) { |
| | | // throw new CoolException("检索库位失败,请联系管理员"); |
| | | // } |
| | | // for (List<Integer> node : shelves.nodes){ |
| | | // if (node.contains(curRow)) { |
| | | // crnNo = shelves.nodes.indexOf(node) + 1; |
| | | // break; |
| | | // } |
| | | // } |
| | | int crnNo; |
| | | switch (whsType) { |
| | | case 1: |
| | | crnNo = 1; |
| | | break; |
| | | case 2: |
| | | crnNo = 2; |
| | | break; |
| | | default: |
| | | throw new CoolException("检索库位 -- 检索堆垛机号失败"); |
| | | } |
| | | |
| | | basCrnpService.checkSiteStatus(crnNo); |
| | |
| | | int inQty = staNo.getInQty()==null?0:staNo.getInQty(); |
| | | if (staNo.getAutoing().equals("Y") && inQty<2) { |
| | | // 查找库位 |
| | | if (locMast == null) { |
| | | locMast = locMastService.queryFreeLocMast(curRow); |
| | | } |
| | | LocMast locMast = locMastService.queryFreeLocMast(curRow); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("没有空库位"); |
| | | } |