| | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i < crnNumber*2; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | rowCount = locNecessaryParameters[0]; |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue())); |
| | | if (locMasts.size()<=5){ |
| | | times++; |
| | | continue; |
| | | } |
| | | break; |
| | | } else { |
| | | nearRow = locNecessaryParameters[3]; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("crn_no", crnNo).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue())); |
| | | if (locMasts.size()<=5){ |
| | | times++; |
| | | continue; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | if (crnNo == 0) { |
| | | throw new CoolException("无可用库位"); |
| | |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (WrkMast wrkMast:wrkMasts){ |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(wrkMast.getLocNo())){ |
| | | continue; |
| | | } |
| | |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo()); |
| | | |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMastGro,rowLastnoType.getType().longValue()); |
| | | for (int i = 0; i < crnNumber*2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){ |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRow && locMast2.getLocSts().equals("S")){ |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){ |
| | | int row2=0; |
| | | if (Utils.getRow(locMast2.getLocNo())>nearRow){ |
| | | if (Utils.getRow(locMast2.getLocNo())>nearRowW){ |
| | | row2=Utils.getRow(locMast2.getLocNo())-1; |
| | | }else { |
| | | row2=Utils.getRow(locMast2.getLocNo())+1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo)); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O")); |
| | | if (Cools.isEmpty(locMast)){ |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | }else if (signRule2){ |
| | | List<String> locNos = locDetlService.getSameDetlToday(matnr, sRow, eRow); |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (String locNo : locNos) { |
| | | if (Utils.isShallowLoc(slaveProperties, locNo)) { |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(locNo)){ |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo); |
| | | // 检测目标库位是否为空库位 |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | | } |
| | | if (Utils.getRow(locNo)==nearRow){ |
| | | continue; |
| | | } |
| | | if (Utils.getBay(locNo)==nearbay && Utils.getLev(locNo)==nearlev){ |
| | | continue; |
| | | }else { |
| | | nearbay=Utils.getBay(locNo); |
| | | nearlev=Utils.getLev(locNo); |
| | | } |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(locNo); |
| | | |
| | | for (int i = 0; i < crnNumber*2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){ |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 靠近摆放规则 --- 空托 //分离版 |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | for (LocMast locMast1:locMasts){ |
| | | //获取巷道 |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){ |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){ |
| | | int row2=0; |
| | | if (Utils.getRow(locMast2.getLocNo())>nearRowW){ |
| | | row2=Utils.getRow(locMast2.getLocNo())-1; |
| | | }else { |
| | | row2=Utils.getRow(locMast2.getLocNo())+1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O")); |
| | | if (Cools.isEmpty(locMast)){ |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // // 靠近摆放规则 --- 空托 //互通版 |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | // if (locMasts.size() > 0) { |
| | | // for (LocMast loc : locMasts) { |
| | | // if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | // continue; |
| | | // } |
| | | // String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | | // // 检测目标库位是否为空库位 |
| | | // LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | // if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | // if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { |
| | | // if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | // locMast = shallowLoc; |
| | | // crnNo = locMast.getCrnNo(); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // // 靠近摆放规则 --- 空托 //分离版 |
| | | // if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | // List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | // for (LocMast locMast1:locMasts){ |
| | | // //获取巷道 |
| | | //// List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow); |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("D")){ |
| | | // //获取目标库位所在巷道最浅非空库位 |
| | | // locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | int nearbay = 0; |
| | | int nearlev = 0; |
| | | for (LocMast locMastSign:locMasts){ |
| | | int curRowW = curRow; //相似工作档案 最深库位排 |
| | | int nearRowW = nearRow; //相似工作档案 最浅库位排 |
| | | if (Cools.isEmpty(locMastSign.getLocNo())){ |
| | | continue; |
| | | } |
| | | if (Utils.getRow(locMastSign.getLocNo())==nearRow){ |
| | | continue; |
| | | } |
| | | if (Utils.getBay(locMastSign.getLocNo())==nearbay && Utils.getLev(locMastSign.getLocNo())==nearlev){ |
| | | continue; |
| | | }else { |
| | | nearbay=Utils.getBay(locMastSign.getLocNo()); |
| | | nearlev=Utils.getLev(locMastSign.getLocNo()); |
| | | } |
| | | // List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,wrkMast.getLocNo(), curRow>nearRow); |
| | | LocMast locMastGro = locMastService.selectById(locMastSign.getLocNo()); |
| | | |
| | | for (int i = 0; i < crnNumber*2; i++) { |
| | | if (!(Utils.getRow(locMastGro.getLocNo())>nearRowW && Utils.getRow(locMastGro.getLocNo())<=curRowW) && !(Utils.getRow(locMastGro.getLocNo())<nearRowW && Utils.getRow(locMastGro.getLocNo())>=curRowW) ){ |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber); |
| | | curRowW = locNecessaryParameters[1]; |
| | | nearRowW = locNecessaryParameters[3]; |
| | | }else { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInF(curRowW,nearRowW,locMastGro,rowLastnoType.getType().longValue()); |
| | | |
| | | if (!Cools.isEmpty(locMast2) && Utils.getRow(locMast2.getLocNo())!=nearRowW && locMast2.getLocSts().equals("S")){ |
| | | int row2=0; |
| | | if (Utils.getRow(locMast2.getLocNo())>nearRowW){ |
| | | row2=Utils.getRow(locMast2.getLocNo())-1; |
| | | }else { |
| | | row2=Utils.getRow(locMast2.getLocNo())+1; |
| | | } |
| | | String targetLocNo = zerofill(String.valueOf(row2), 2) + locMast2.getLocNo().substring(2); |
| | | locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",targetLocNo).eq("loc_sts","O")); |
| | | if (Cools.isEmpty(locMast)){ |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | Wrapper<StaDesc> wrapper = null; |
| | | StaDesc staDesc = null; |
| | |
| | | .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("入库路径不存在"); |
| | | log.error("入库路径不存在:type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo); |
| | | 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()); |
| | |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(rowLastno)){ |
| | | // String shallowLoc = Utils.getDeepLocYTl(slaveProperties, locMast1.getLocNo()); |
| | | // LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | // .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("whs_type",rowLastnoType.getType().longValue())); |
| | | //获取目标库位所在巷道最深空库位 |
| | | LocMast locMast2 = locMastService.selectLocByLocStsPakInO(curRow,nearRow,locMast1,rowLastnoType.getType().longValue()); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getBay1()==curRow) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | // //未找到 找第一排 |
| | | // if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)){ |
| | | // locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | // .eq("row1", 1) |
| | | // .eq("loc_sts", "O") |
| | | // .orderBy("lev1",true).orderBy("bay1",true)); |
| | | // for (LocMast locMast1 : locMasts) { |
| | | // if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | // continue; |
| | | // } |
| | | // locMast = locMast1; |
| | | // break; |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | // 递归查询 |
| | |
| | | times = times + 1; |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, matnr, batch, grade,moveCrnNo, locTypeDto, times); |
| | | } |
| | | // // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | // if (locTypeDto.getLocType1() < 2) { |
| | | // int i = locTypeDto.getLocType1() + 1; |
| | | // locTypeDto.setLocType1((short)i); |
| | | // return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0); |
| | | // } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | |
| | | } |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i < crnNumber*2; i++) { |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | break; |
| | | } else { |
| | | times++; |
| | | } |
| | | } |
| | | if (crnNo == 0) { |
| | | throw new CoolException("无可用库位"); |
| | | } |
| | | int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber); |
| | | curRow = locNecessaryParameters[1]; |
| | | crnNo = locNecessaryParameters[2]; |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | |
| | | Wrapper<StaDesc> wrapper = null; |
| | | StaDesc staDesc = null; |