| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.LocTypeDto; |
| | | import com.zy.common.model.StartupDto; |
| | |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto, int times) { |
| | | |
| | | if (sourceStaNo.equals(202)) { |
| | | whsType = 1; |
| | | locTypeDto.setLocType1((short) 1); |
| | | } else if (sourceStaNo.equals(206)) { |
| | | whsType = 2; |
| | | locTypeDto.setLocType1((short) 2); |
| | | } |
| | | |
| | | whsType = 1; |
| | | locTypeDto.setLocType1((short) 1); |
| | | StartupDto startupDto = new StartupDto(); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | if (Cools.isEmpty(rowLastno)) { |
| | |
| | | int crnNo = crn_qty; |
| | | // 目标库位 |
| | | LocMast locMast = null; |
| | | |
| | | crnNo=2; |
| | | if (curRow == 3) { |
| | | curRow = 4; |
| | | } else if (curRow == 4) { |
| | | curRow = 3; |
| | | } else { |
| | | rowCount = 0; |
| | | crnNo=1; |
| | | } |
| | | |
| | | if (crnNo == 0) { |
| | | throw new CoolException("没有可用的堆垛机"); |
| | |
| | | // 更新库位排号 |
| | | rowLastno.setCurrentRow(curRow); |
| | | rowLastnoService.updateById(rowLastno); |
| | | |
| | | if (crnNo==1){ |
| | | LocMast locMast1 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_sts", "F").eq("loc_type2", (short) 3)); |
| | | if (!Cools.isEmpty(locMast1)){ |
| | | locMast = locMastService.queryFreeLocMast(2,(short)3); |
| | | if (Cools.isEmpty(locMast)){ |
| | | locMast = locMastService.queryFreeLocMast(1,(short)3); |
| | | } |
| | | if(staDescId==1){ |
| | | List<LocMast> locMast1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", (short) 3)//待测库位 |
| | | .orderBy("row1",true) |
| | | .orderBy("bay1",true)); |
| | | List<LocMast> locMast2 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", (short) 1)//测试库位 |
| | | .orderBy("row1",true) |
| | | .orderBy("bay1",true)); |
| | | if (Cools.isEmpty(locMast1) || Cools.isEmpty(locMast2)) { |
| | | throw new CoolException("没有待测和测试库位无法入库!!!"); |
| | | } |
| | | if(!Cools.isEmpty(locMast2)){ |
| | | locMast=locMast2.get(0); |
| | | }else if(!Cools.isEmpty(locMast1)){ |
| | | locMast=locMast1.get(0); |
| | | } |
| | | }else if(staDescId==10){ |
| | | List<LocMast> locMast1 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", (short) 3)//待测库位 |
| | | .orderBy("row1",true) |
| | | .orderBy("bay1",true)); |
| | | List<LocMast> locMast2 = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("loc_type1", (short) 1)//测试库位 |
| | | .orderBy("row1",true) |
| | | .orderBy("bay1",true)); |
| | | if (Cools.isEmpty(locMast1) || Cools.isEmpty(locMast2)) { |
| | | throw new CoolException("没有待测和测试库位无法入空托!!!"); |
| | | } |
| | | if(!Cools.isEmpty(locMast1)){ |
| | | locMast=locMast1.get(0); |
| | | }else if(!Cools.isEmpty(locMast2)){ |
| | | locMast=locMast2.get(0); |
| | | } |
| | | } |
| | | |
| | | if (Cools.isEmpty(locMast)){ |
| | | // 开始查找库位 ==============================> |
| | | int ruleId = Integer.parseInt(Parameter.get().getFindLocRule()); |
| | | if (whsType != 1) { |
| | | locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); |
| | | } else if (ruleId == 1) { //按测试设备排序,优先排满单台设备 |
| | | locMast = locMastService.queryFreeLocMast1(curRow, locTypeDto.getLocType1(), channelMax + 1); |
| | | } else if (ruleId == 2) { //按通道排序,均匀分配每台设备 |
| | | Short locType2 = getLocType2Small(curRow, locTypeDto.getLocType1()); |
| | | locMast = locMastService.queryFreeLocMast2(curRow, locTypeDto.getLocType1(), locType2); |
| | | } else { //默认规则 |
| | | locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1()); |
| | | } |
| | | } |
| | | |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (Cools.isEmpty(locMast)) { |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount) { |
| | | times = times + 1; |
| | | return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto, times); |
| | | } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{}", JSON.toJSONString(locTypeDto), times); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | String locNo = locMast.getLocNo(); |