| | |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | | } |
| | | if (Cools.isEmpty(batch)) { //箱号 |
| | | if (Cools.isEmpty(batch)) { //批次 |
| | | batch = ""; |
| | | } |
| | | if (Cools.isEmpty(grade)) { //备用 |
| | |
| | | if (basCrnpService.checkSiteError(crnNo, true)) { |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type",100)); |
| | | if (locMasts.size()-crnCountO<=2){ |
| | | times++; |
| | | continue; |
| | | if (crnNo>5 || crnNo<3){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type",100).ne("source_sta_no",100).and().ne("source_sta_no",148)); |
| | | if (locMasts.size()-crnCountO<=2){ |
| | | log.error(crnNo+"号堆垛机没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | nearRow = 0; |
| | | times++; |
| | | continue; |
| | | } |
| | | } |
| | | break; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | if (nearRow == 0) { |
| | | throw new CoolException("无可用堆垛机"); |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("无可用堆垛机,无可用空库位"); |
| | | } |
| | | |
| | | boolean signRule1 = false; |
| | |
| | | |
| | | |
| | | if (Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | if (!Cools.isEmpty(matnr) && (staDescId == 1)){ |
| | | signRule1 = true; |
| | | } |
| | | // // 靠近摆放规则 --- 同天同规格物料 //分离版 |
| | | // if (!Cools.isEmpty(matnr) && staDescId == 1){ |
| | | // signRule1 = true; |
| | | // } |
| | | // 靠近摆放规则 --- 同天同规格物料 //互通版 |
| | | if (!Cools.isEmpty(matnr) && staDescId == 1) { |
| | | signRule2 = true; |
| | |
| | | } |
| | | |
| | | if (signRule1){ |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O")); |
| | | for (LocMast locMast1:locMasts){ |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectById(shallowLoc); |
| | | if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("F")){ |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMast2.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr())) { |
| | | locMast = locMast1; |
| | | break; |
| | | if (nearRow!=curRow){ |
| | | 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,groupOutsideLocCrn); |
| | | if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("F")){ |
| | | LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo())); |
| | | if (!Cools.isEmpty(locDetl) && matnr.equals(locDetl.getMatnr()) && batch.equals(Cools.isEmpty(locDetl.getBatch()) ? "" : locDetl.getBatch()) && grade.equals(Cools.isEmpty(locDetl.getBrand()) ? "" : locDetl.getBrand())) { |
| | | //获取目标库位所在巷道最浅非空库位 |
| | | locMast = locMastService.selectLocByLocStsPakInO(curRow,nearRow,groupOutsideLocCrn); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // 靠近摆放规则 --- 空托 //互通版 |
| | | if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) { |
| | | System.out.println("123whsType:"+whsType+"locMast:"+locMast); |
| | | |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow)); |
| | | if (locMasts.size() > 0) { |
| | | System.out.println("234whsType:"+whsType+"locMast:"+locMast); |
| | | |
| | | |
| | | for (LocMast loc : locMasts) { |
| | | if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) { |
| | | if (!Utils.isDeepLoc(slaveProperties, loc.getLocNo())) { |
| | | continue; |
| | | } |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo()); |
| | |
| | | if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) { |
| | | if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) { |
| | | if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) { |
| | | System.out.println("345whsType:"+whsType+"locMast:"+locMast); |
| | | |
| | | locMast = shallowLoc; |
| | | crnNo = locMast.getCrnNo(); |
| | | break; |
| | |
| | | }else { |
| | | staNo = basDevpService.selectById(staDesc.getCrnStn()); |
| | | if (!staNo.getAutoing().equals("Y")) { |
| | | log.error("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | // throw new CoolException("目标站"+staDesc.getCrnStn()+"不可用"); |
| | | crnNo = 0; |
| | | } |
| | |
| | | |
| | | // 1.按规则查找库位 |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O").orderBy("lev1",true).orderBy("bay1",true)); |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O") |
| | | .orderBy("inv_wh",false).orderBy("lev1",true).orderBy("bay1",true)); |
| | | |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", shallowLoc).eq("loc_sts", "O")); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } |
| | | }else { |
| | | } else { |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | | } |
| | | if (Utils.BooleanWhsTypeStaIoType(whsType)){ |
| | | String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo()); |
| | | LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "O")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast2; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "F")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } else { |
| | | locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>() |
| | | .eq("loc_no", shallowLoc).eq("loc_sts", "D")); |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | if (!Cools.isEmpty(locMast1)) { |
| | | locMast = locMast1; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!Cools.isEmpty(locMast) && !basCrnpService.checkSiteError(crnNo, true)) { |