| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | private NavigateUtils navigateUtils; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Autowired |
| | | private BasOutStationAreaService basOutStationAreaService; |
| | | |
| | | /** |
| | | * 生成工作号 |
| | |
| | | } |
| | | Integer crnNo = findCrnResult.getCrnNo(); |
| | | |
| | | Integer sourceStationId = this.findOutStationId(findCrnResult, param.getStaNo()); |
| | | Integer staNo = param.getStaNo(); |
| | | String outArea = param.getOutArea(); |
| | | if(Cools.isEmpty(staNo) && Cools.isEmpty(outArea)) { |
| | | throw new CoolException("请传入出库站点或出库区域"); |
| | | } |
| | | |
| | | if(Cools.isEmpty(staNo)) { |
| | | List<BasOutStationArea> areaList = basOutStationAreaService.selectList(new EntityWrapper<BasOutStationArea>().eq("area_code", outArea)); |
| | | if (areaList.isEmpty()) { |
| | | throw new CoolException("出库区域不存在"); |
| | | } |
| | | int nextInt = new Random().nextInt(areaList.size()); |
| | | BasOutStationArea basOutStationArea = areaList.get(nextInt); |
| | | staNo = basOutStationArea.getStationId(); |
| | | } |
| | | |
| | | Integer sourceStationId = this.findOutStationId(findCrnResult, staNo); |
| | | if (sourceStationId == null) { |
| | | throw new CoolException("未找到输送目标站点可走行路径"); |
| | | } |
| | |
| | | wrkMast.setIoPri(ioPri); |
| | | wrkMast.setSourceLocNo(locMast.getLocNo()); // 源库位 |
| | | wrkMast.setSourceStaNo(sourceStationId);//源站 |
| | | wrkMast.setStaNo(param.getStaNo());//目标站 |
| | | wrkMast.setStaNo(staNo);//目标站 |
| | | wrkMast.setWmsWrkNo(param.getTaskNo()); |
| | | wrkMast.setBarcode(locMast.getBarcode()); |
| | | wrkMast.setAppeTime(now); |
| | |
| | | break; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | return targetStationId; |
| | |
| | | break; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | } |
| | | } |
| | | return finalSourceStationId; |