| | |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private MatService matService; |
| | | @Autowired |
| | | private LocRuleService locRuleService; |
| | | |
| | | /** |
| | | * 生成工作号 |
| | |
| | | whsType = 1; |
| | | start = 1; |
| | | end = 14; |
| | | if (null != wrkMastService.selectPakoutOfStaNo(104)) { |
| | | start = 8; |
| | | theCrnNo = 2; |
| | | } |
| | | // if (null != wrkMastService.selectPakoutOfStaNo(104)) { |
| | | // start = 8; |
| | | // theCrnNo = 2; |
| | | // } |
| | | break; |
| | | case 203: |
| | | whsType = 2; |
| | | start = 8; |
| | | end = 21; |
| | | if (null != wrkMastService.selectPakoutOfStaNo(204)) { |
| | | end = 14; |
| | | theCrnNo = 2; |
| | | } |
| | | // if (null != wrkMastService.selectPakoutOfStaNo(204)) { |
| | | // end = 14; |
| | | // theCrnNo = 2; |
| | | // } |
| | | break; |
| | | default: |
| | | throw new CoolException("检索库位失败,请联系管理员"); |
| | |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 库区锁定 |
| | | if (Cools.isEmpty(locMast)) { |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0), null, start, end); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1() |
| | | , locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast one : locMasts) { |
| | | List<String> groupLoc = Utils.getGroupLoc(one.getLocNo()); |
| | | LocMast locMast0 = locMastService.findOutMost(groupLoc); |
| | | if (null != locMast0) { |
| | | // 浅库位符合尺寸检测 |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 浅库位对应堆垛机必须可用且无异常 |
| | | if (basCrnpService.checkSiteError(locMast0.getCrnNo(), true)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | crnNo = locMast0.getCrnNo(); |
| | | locMast = locMast0; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | // 如果没有相近物料,则按规则轮询货架 |
| | | |
| | | int currentRow = 1; |
| | | if (null == locMast) { |
| | | Shelves shelves = new Shelves(rowCount, crn_qty); |
| | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.当检索库排为浅库位排时,优先寻找当前库排的深库位排 |
| | | // 高低频管控、库位组全部为O |
| | | if (locMast == null) { |
| | | List<Integer> rows = Utils.getGroupLoc(curRow); |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast0(rows, rows.size(), locTypeDto.getLocType1(), inoutEveryday); |
| | |
| | | } |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 todo:luxiaotao |
| | | // if (!locMastService.checkEmptyCount(locMast)) { |
| | | // locMast = null; |
| | | // } |
| | | |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(locMast, 10)) { locMast = null; } |
| | | } |
| | | |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | // 2.1 高低频管控、库位组无需全部为O,找到库位对应深库位不能为P R |
| | | if (Cools.isEmpty(locMast)) { |
| | | int sign = curRow; |
| | | while (sign != 0 && Cools.isEmpty(locMast)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMastEnd1(sign, locTypeDto.getLocType1(), inoutEveryday); |
| | | for (LocMast loc : locMasts) { |
| | | // 同库位组对应其钱库位是否为 O.空库位 |
| | | boolean success = true; |
| | | // 浅库位 |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | LocMast outerLoc = locMastService.selectById(outerLocNo); |
| | | if (Cools.isEmpty(outerLoc)) { |
| | | continue; |
| | | } |
| | | if (!outerLoc.getLocSts().equals("O")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 深库位判断 |
| | | List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo()); |
| | | for (String insideLocNo : insideLocList) { |
| | | LocMast insideLoc = locMastService.selectById(insideLocNo); |
| | | if (Cools.isEmpty(insideLoc)) { |
| | | continue; |
| | | } |
| | | if (insideLoc.getLocSts().equals("R") |
| | | || insideLoc.getLocSts().equals("P") |
| | | || insideLoc.getLocSts().equals("Q") |
| | | || insideLoc.getLocSts().equals("S")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(loc, 10)) { |
| | | success = false; |
| | | } |
| | | if (success) { |
| | | locMast = loc; |
| | | break; |
| | | } |
| | | } |
| | | sign = getCurRow(sign); |
| | | } |
| | | } |
| | | |
| | | // 2.无库位时,无视区域锁定,重新查找库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | int sign = curRow; |
| | | while (sign != 0 && Cools.isEmpty(locMast)) { |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMastEnd(sign, locTypeDto.getLocType1()); |
| | | for (LocMast loc : locMasts) { |
| | | // 同库位组对应其钱库位是否为 O.空库位 |
| | | boolean success = true; |
| | | // 浅库位 |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(loc.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | LocMast outerLoc = locMastService.selectById(outerLocNo); |
| | | if (Cools.isEmpty(outerLoc)) { |
| | | continue; |
| | | } |
| | | if (!outerLoc.getLocSts().equals("O")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 深库位 |
| | | List<String> insideLocList = Utils.getGroupInsideLoc(loc.getLocNo()); |
| | | for (String insideLocNo : insideLocList) { |
| | | LocMast insideLoc = locMastService.selectById(insideLocNo); |
| | | if (Cools.isEmpty(insideLoc)) { |
| | | continue; |
| | | } |
| | | if (insideLoc.getLocSts().equals("R") |
| | | || insideLoc.getLocSts().equals("P") |
| | | || insideLoc.getLocSts().equals("Q") |
| | | || insideLoc.getLocSts().equals("S")) { |
| | | success = false; break; |
| | | } |
| | | } |
| | | // 因库位移转、需预留空库位 |
| | | if (!locMastService.checkEmptyCount(loc, 10)) { |
| | | success = false; |
| | | } |
| | | if (success) { |
| | | locMast = loc; |
| | | break; |
| | | } |
| | | } |
| | | sign = getCurRow(sign); |
| | | } |
| | | } |
| | | |
| | | //2023-4-13 ADD, 找到的库位、以及其浅库位,如果在工作档有移库任务,则跳过 |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("io_type", 11)); |
| | | for (WrkMast wrkMast : wrkMasts){ |
| | | if (wrkMast.getSourceLocNo().equals(locMast.getLocNo())){ |
| | | locMast = null; |
| | | break; |
| | | } |
| | | List<String> outerLocList = Utils.getGroupOuterLoc(locMast.getLocNo()); |
| | | for (String outerLocNo : outerLocList) { |
| | | if (locMast.getLocNo().equals(outerLocNo)){ |
| | | locMast = null; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 3.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount) { |
| | |
| | | } |
| | | } |
| | | |
| | | public int getCurRow(int curRow){ |
| | | switch (curRow){ |
| | | case 1: |
| | | case 2: |
| | | case 8: |
| | | case 9: |
| | | case 10: |
| | | case 15: |
| | | case 16: |
| | | case 17: |
| | | return curRow+1; |
| | | case 5: |
| | | case 6: |
| | | case 7: |
| | | case 13: |
| | | case 14: |
| | | case 20: |
| | | case 21: |
| | | return curRow-1; |
| | | default: |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | } |