| | |
| | | FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto, |
| | | RowLastnoType rowLastnoType) { |
| | | int attempt = times; |
| | | while (attempt < crnNumber * 2) { |
| | | while (attempt < crnNumber * 4) { |
| | | int[] params = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = params[1]; |
| | | int crnNo = params[2]; |
| | | if (!basCrnpService.checkSiteError(crnNo, true)) { |
| | | attempt++; |
| | | continue; |
| | | } |
| | | // if (!basCrnpService.checkSiteError(crnNo, true)) { |
| | | // attempt++; |
| | | // continue; |
| | | // } |
| | | int rowCount = params[0]; |
| | | int nearRow = params[3]; |
| | | |
| | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | crnNo = 6; |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | |
| | |
| | | StaDesc staDesc = null; |
| | | BasDevp staNo = null; |
| | | |
| | | if (Utils.BooleanWhsTypeSta(rowLastno, staDescId)) { |
| | | // if (Utils.BooleanWhsTypeSta(rowLastno, staDescId)) { |
| | | // 获取目标站 |
| | | wrapper = new EntityWrapper<StaDesc>() |
| | | .eq("type_no", staDescId) |
| | | .eq("stn_no", sourceStaNo) |
| | | .eq("crn_no", crnNo); |
| | | staDesc = staDescService.selectOne(wrapper); |
| | | if (Cools.isEmpty(staDesc)) { |
| | | log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | // throw new CoolException("入库路径不存在"); |
| | | crnNo = 0; |
| | | } else { |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | log.error("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | crnNo = 0; |
| | | } |
| | | startupDto.setStaNo(staNo.getDevNo()); |
| | | } |
| | | } |
| | | // wrapper = new EntityWrapper<StaDesc>() |
| | | // .eq("type_no", staDescId) |
| | | // .eq("stn_no", sourceStaNo) |
| | | // .eq("crn_no", crnNo); |
| | | // staDesc = staDescService.selectOne(wrapper); |
| | | // if (Cools.isEmpty(staDesc)) { |
| | | // log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | //// throw new CoolException("入库路径不存在"); |
| | | // crnNo = 0; |
| | | // } |
| | | // else { |
| | | // staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | // if (!staNo.getAutoing().equals("Y")) { |
| | | // log.error("目标站" + staDesc.getCrnStn() + "不可用"); |
| | | //// throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | // crnNo = 0; |
| | | // } |
| | | // startupDto.setStaNo(staNo.getDevNo()); |
| | | // } |
| | | // } |
| | | |
| | | // 更新库位排号 |
| | | if (Utils.BooleanWhsTypeSta(rowLastno, staDescId) && Cools.isEmpty(locMast)) { |
| | |
| | | |
| | | // 开始查找库位 ==============================>> |
| | | |
| | | // 1.按规则查找库位 |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | if (Cools.isEmpty(locMast) && sourceStaNo != 4006) {//si'lou'p四楼盘点选择区域 |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .orderBy("lev1", true).orderBy("bay1", true));//最浅库位 |
| | | .orderBy("lev1", true).orderBy("bay1", true)); // 最浅库位 |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | //获取目标库位所在巷道最深空库位 |
| | | // 获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getBay1() == curRow) { |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getRow1() == curRow) { |
| | | locMast = locMast2; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | // 根据 findLocNoAttributeVo.getOutArea() 设置列范围 |
| | | int startBay = 1; |
| | | int endBay = 19; |
| | | |
| | | switch (findLocNoAttributeVo.getOutArea()) { |
| | | case 1: |
| | | startBay = 15; |
| | | endBay = 19; |
| | | break; |
| | | case 2: |
| | | startBay = 8; |
| | | endBay = 14; |
| | | break; |
| | | case 3: |
| | | startBay = 1; |
| | | endBay = 8; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | // 优先从指定列范围查找 |
| | | boolean found = false; |
| | | |
| | | // 按照排号从38到32递减查找,优先查找指定列范围(如1-8、8-14、15-19) |
| | | for (int row = 38; row >= 32; row--) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", row) |
| | | .ge("bay1", startBay) |
| | | .le("bay1", endBay) |
| | | .eq("loc_sts", "O") |
| | | .eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .orderBy("lev1", true) |
| | | .orderBy("bay1", true)); // 最浅库位 |
| | | |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // 获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getRow1() == curRow) { |
| | | locMast = locMast2; |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (found) { |
| | | break; // 找到目标库位后跳出循环 |
| | | } |
| | | } |
| | | |
| | | // 如果没有在优先范围内找到合适库位,继续进行全局查找(1-19列) |
| | | if (!found) { |
| | | // 从排号38到32查找所有列(1-19) |
| | | for (int row = 38; row >= 32; row--) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", row) |
| | | .ge("bay1", 1) // 查找1到19列 |
| | | .le("bay1", 19) |
| | | .eq("loc_sts", "O") |
| | | .eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .orderBy("lev1", true) |
| | | .orderBy("bay1", true)); // 最浅库位 |
| | | |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // 获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getRow1() == curRow) { |
| | | locMast = locMast2; |
| | | found = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (found) { |
| | | break; // 找到目标库位后跳出循环 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 递归查询 |
| | | if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |