| | |
| | | */ |
| | | @Transactional |
| | | public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, LocTypeDto locTypeDto) { |
| | | try { |
| | | Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | /** |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | */ |
| | | switch (rowLastnoType.getType()) { |
| | | case 1: |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | case 2: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | case 3: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | case 4: |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 4, locTypeDto, 0); |
| | | case 5: |
| | | return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | default: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | } |
| | | // try { |
| | | Integer whsType = Utils.GetWhsType(sourceStaNo); |
| | | RowLastno rowLastno = rowLastnoService.selectById(whsType); |
| | | RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId()); |
| | | /** |
| | | * 库型 1: 标准堆垛机库 2: 平库 3: 穿梭板 4: 四向车 5: AGV 0: 未知 |
| | | */ |
| | | switch (rowLastnoType.getType()) { |
| | | case 1: |
| | | Config crnSearchDetectTaskCountConfig = configService.selectConfigByCode("crnSearchDetectTaskCount"); |
| | | int crnSearchDetectTaskCount = Integer.parseInt(crnSearchDetectTaskCountConfig.getValue()); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("站点={} 未查询到对应的规则,{}", sourceStaNo,e.getMessage()); |
| | | Config applyInTaskTotalCountConfig = configService.selectConfigByCode("applyInTaskTotalCount"); |
| | | int applyInTaskTotalCount = Integer.parseInt(applyInTaskTotalCountConfig.getValue()); |
| | | int crnNo = 6; |
| | | boolean flag = true; |
| | | List<String> data = new ArrayList<>(); |
| | | while (crnNo > 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("loc_sts", "O") |
| | | .eq("crn", crnNo) |
| | | .eq("whs_type", rowLastnoType.getType().longValue()) |
| | | .eq("loc_type1", locTypeDto.getLocType1()) |
| | | .eq("loc_type2", locTypeDto.getLocType2()) |
| | | ); |
| | | if (locMasts.size() <= 15) { |
| | | log.error(crnNo + "号堆垛机没有空库位!!! 尺寸规格: {}", JSON.toJSONString(locTypeDto)); |
| | | data.add(crnNo + "号没有空库位;"); |
| | | } else { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("crn_no", crnNo) |
| | | .in("io_type", 1, 10, 53, 57) |
| | | ); |
| | | if (wrkMasts.size() > crnSearchDetectTaskCount) { |
| | | log.error(crnNo + "号堆垛机已达到入库控制上限!!! 任务数量: {}, 控制数量:{}", wrkMasts.size(), crnSearchDetectTaskCount); |
| | | data.add(crnNo + "号入库控制上限;"); |
| | | continue; |
| | | } |
| | | List<WrkMast> wrkMastsList = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("crn_no", crnNo) |
| | | .in("io_type", 1, 10, 53, 57, 101, 103, 107, 110) |
| | | ); |
| | | if (wrkMastsList.size() > applyInTaskTotalCount) { |
| | | log.error(crnNo + "号堆垛机已达到申请入库时总任务数量上限(入库、出库)!!! 任务数量: {}, 控制数量:{}", wrkMastsList.size(), applyInTaskTotalCount); |
| | | data.add(crnNo + "号申请入库时总任务数量上限;"); |
| | | continue; |
| | | } |
| | | flag = false; |
| | | break; |
| | | } |
| | | crnNo--; |
| | | } |
| | | if (!flag) { |
| | | return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | } else { |
| | | log.info("数据:{}", data); |
| | | throw new CoolException(data.toString()); |
| | | } |
| | | case 2: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | case 3: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | case 4: |
| | | return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 4, locTypeDto, 0); |
| | | case 5: |
| | | return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0); |
| | | default: |
| | | log.error("站点={} 未查询到对应的规则", sourceStaNo); |
| | | break; |
| | | } |
| | | |
| | | // } catch (Exception e) { |
| | | // log.error("站点={} 未查询到对应的规则,{}", sourceStaNo, e.getMessage()); |
| | | // } |
| | | return null; |
| | | } |
| | | |
| | |
| | | .eq("crn_no", crnNo) |
| | | .in("io_type", 1, 10, 53, 57) |
| | | ); |
| | | if(wrkMasts.size() > crnSearchDetectTaskCount){ |
| | | if (wrkMasts.size() > crnSearchDetectTaskCount) { |
| | | log.error(crnNo + "号堆垛机已达到入库控制上限!!! 任务数量: {}, 控制数量:{}", wrkMasts.size(), crnSearchDetectTaskCount); |
| | | continue; |
| | | } |
| | |
| | | ); |
| | | if (wrkMastsList.size() > applyInTaskTotalCount) { |
| | | log.error(crnNo + "号堆垛机已达到申请入库时总任务数量上限(入库、出库)!!! 任务数量: {}, 控制数量:{}", wrkMastsList.size(), applyInTaskTotalCount); |
| | | continue; |
| | | } |
| | | |
| | | rowCount = locNecessaryParameters[0]; |
| | |
| | | .eq("crn_no", crnNo) |
| | | .in("io_type", 1, 10, 53, 57) |
| | | ); |
| | | if(wrkMasts.size() > crnSearchDetectTaskCount){ |
| | | if (wrkMasts.size() > crnSearchDetectTaskCount) { |
| | | log.error(crnNo + "号堆垛机已达到入库控制上限!!! 任务数量: {}, 控制数量:{}", wrkMasts.size(), crnSearchDetectTaskCount); |
| | | flag = false; |
| | | } |
| | |
| | | .eq("crn_no", crnNo) |
| | | .in("io_type", 1, 10, 53, 57) |
| | | ); |
| | | if(wrkMasts.size() > crnSearchDetectTaskCount){ |
| | | if (wrkMasts.size() > crnSearchDetectTaskCount) { |
| | | log.error(crnNo + "号堆垛机已达到入库控制上限!!! 任务数量: {}, 控制数量:{}", wrkMasts.size(), crnSearchDetectTaskCount); |
| | | flag = false; |
| | | } |
| | |
| | | if (Cools.isEmpty(locMast) && crnNo != 0) { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>() |
| | | .eq("row1", nearRow) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()).ne("inv_wh",1) |
| | | .eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()).ne("inv_wh", 1) |
| | | .orderBy("lev1", true).orderBy("bay1", true)); |
| | | for (LocMast locMast1 : locMasts) { |
| | | if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | |
| | | // locTypeDto.setLocType1((short)i); |
| | | // return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0); |
| | | // } |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{},{}", JSON.toJSONString(locTypeDto), times,moveCrnNo); |
| | | log.error("系统没有空库位!!! 尺寸规格: {}, 轮询次数:{},{}", JSON.toJSONString(locTypeDto), times, moveCrnNo); |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | | |
| | |
| | | //针对1号堆垛机打的补丁,防止找到库位时,找到最浅库位 |
| | | String deepLoc2 = Utils.getDeepLoc2(slaveProperties, locMast.getLocNo()); |
| | | if (!Cools.isEmpty(deepLoc2)) { |
| | | LocMast locMastNew = locMastService.selectOne(new EntityWrapper<LocMast>().eq("crn_no",locMast.getCrnNo()) |
| | | LocMast locMastNew = locMastService.selectOne(new EntityWrapper<LocMast>().eq("crn_no", locMast.getCrnNo()) |
| | | .eq("loc_no", deepLoc2).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue())); |
| | | if (!Cools.isEmpty(locMastNew)) { |
| | | locMast = locMastNew; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 获取目标站 |