| | |
| | | // } else if (sourceStaNo > 399){ |
| | | // whsType = 4; |
| | | // } |
| | | |
| | | if (sourceStaNo ==101||sourceStaNo==103){ |
| | | whsType = 1; |
| | | } else if (sourceStaNo ==105||sourceStaNo==107){ |
| | | // 目标堆垛机号 |
| | | int crnNo = 0; |
| | | if (sourceStaNo ==102) { |
| | | whsType = 3; |
| | | crnNo = 3; |
| | | }else if (sourceStaNo ==104) { |
| | | whsType = 2; |
| | | } else{ |
| | | crnNo = 2; |
| | | }else if(sourceStaNo ==106) { |
| | | whsType = 1; |
| | | crnNo = 1; |
| | | }else |
| | | throw new CoolException("站点数据异常,请联系管理员"); |
| | | } |
| | | |
| | | |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | |
| | | int eRow = rowLastno.geteRow(); |
| | | int crn_qty = rowLastno.getCrnQty(); |
| | | int rowCount = eRow - sRow + 1; |
| | | // 目标堆垛机号 |
| | | int crnNo = 0; |
| | | |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | int divides = (int) Arith.divides(1, curRow - 1, 4); |
| | | curRow = (int) Arith.remainder(curRow, 4); |
| | | if (curRow == 0) { |
| | | 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); |
| | | crnNo1 = crnNo1 + divides*1; |
| | | if (basCrnpService.checkSiteError(crnNo1, true)) { |
| | | crnNo = crnNo1; |
| | | curRow = curRow + divides*4; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | | } |
| | | // // 如果没有相近物料,则按规则轮询货架 |
| | | // if (null == locMast) { |
| | | // if(crnNo>1) { |
| | | // curRow = curRow -2; |
| | | // } |
| | | // Shelves shelves = new Shelves(rowCount, crn_qty); |
| | | // int divides = (int) Arith.divides(1, curRow - 1, 4); |
| | | // curRow = (int) Arith.remainder(curRow, 4); |
| | | // if (curRow == 0) { |
| | | // curRow = 4; |
| | | // } |
| | | // for (int i = 0; i < shelves.group; i ++) { |
| | | // curRow = shelves.start(curRow); |
| | | // if (curRow < 0) { |
| | | // throw new CoolException("检索库位失败,请联系管理员"); |
| | | // } |
| | | // if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | // curRow = curRow + divides*4; |
| | | // break; |
| | | // } |
| | | // } |
| | | // if(crnNo>1) { |
| | | // curRow = curRow +2; |
| | | // } |
| | | // } |
| | | // |
| | | // if (crnNo == 0) { |
| | | // throw new CoolException("没有可用的堆垛机"); |
| | | // } |
| | | // 获取目标站 |
| | | Wrapper<StaDesc> wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | } |
| | | |
| | | if(curRow==1){ |
| | | curRow=2; |
| | | }else if(curRow==2){ |
| | | curRow=1; |
| | | }else if(curRow==3){ |
| | | curRow=6; |
| | | }else if(curRow==6){ |
| | | curRow=3; |
| | | }else if(curRow==7){ |
| | | curRow=10; |
| | | }else if(curRow==10){ |
| | | curRow=7; |
| | | } |
| | | // 更新库位排号 |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | |
| | | if (!locMastService.checkEmptyCount(locMast)) { |
| | | locMast = null; |
| | | } |
| | | // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X |
| | | if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | locMast = null; |
| | | if(curRow >2){ |
| | | // 目标库位 ===>> 浅库位, 则校验其深库位是否为 F D X |
| | | if (null != locMast && Utils.isShallowLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast deepLoc = locMastService.selectById(Utils.getDeepLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!deepLoc.getLocSts().equals("F") && !deepLoc.getLocSts().equals("D") && !deepLoc.getLocSts().equals("X")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O |
| | | if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!shallowLoc.getLocSts().equals("O")) { |
| | | locMast = null; |
| | | // 目标库位 ===>> 深库位, 则校验其浅库位是否为 O |
| | | if (null != locMast && Utils.isDeepLoc(slaveProperties, locMast.getLocNo())) { |
| | | LocMast shallowLoc = locMastService.selectById(Utils.getShallowLoc(slaveProperties, locMast.getLocNo())); |
| | | if (!shallowLoc.getLocSts().equals("O")) { |
| | | locMast = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (times < rowCount) { |
| | | times = times + 1; |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | }else if (times == rowCount) { |
| | | |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("crn_no", crnNo) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("lev1")); |
| | | if(Cools.isEmpty(locMast1)){ |
| | | throw new CoolException("堆垛机="+crnNo+"没有空库位"); |
| | | } |
| | | if(!locMastService.checkEmptyCount(locMast1)){ |
| | | throw new CoolException("堆垛机="+crnNo+"没有空库位"); |
| | | } |
| | | } |
| | | |
| | | // 轻货物找轻库位为空时,可以去找重库位仓 |