| | |
| | | import com.zy.asrs.wcs.core.model.command.LiftCommand; |
| | | import com.zy.asrs.wcs.core.model.enums.*; |
| | | import com.zy.asrs.wcs.core.service.*; |
| | | import com.zy.asrs.wcs.core.utils.OpenUtils; |
| | | import com.zy.asrs.wcs.core.utils.RedisUtil; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.core.utils.*; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant; |
| | |
| | | private OpenUtils openUtils; |
| | | @Autowired |
| | | private LiftAction liftAction; |
| | | @Autowired |
| | | private NavigateUtils navigateUtils; |
| | | |
| | | /** |
| | | * 组托 |
| | |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() |
| | | && staProtocol.isInEnable() |
| | | && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) |
| | | && staProtocol.getIsIn() == (short)1 |
| | | && staProtocol.isPakMk() |
| | | ) { |
| | | |
| | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateMotion(task); |
| | | if (motionList.isEmpty()) { |
| | | task.setShuttleNo(null);//保存穿梭车号 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.info("{}任务更新穿梭车号失败", task.getTaskNo()); |
| | | } |
| | | continue; |
| | | } |
| | | motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId()); |
| | |
| | | // continue; |
| | | // } |
| | | |
| | | // //同库位组校验 |
| | | // List<String> outerLoc = Utils.getGroupOuterLoc(wrkMast.getSourceLocNo()); |
| | | // List<LocMast> outerLocMasts = locMastService.selectNotEmptyLocNos(outerLoc); |
| | | // if (!outerLocMasts.isEmpty()) { |
| | | // News.info("{}任务,浅库位存在货物,系统等待中", wrkMast.getWrkNo()); |
| | | // continue;//浅库位存在未执行任务 |
| | | // } |
| | | //检测货物是否可出 |
| | | boolean checkLocPathIsAvailable = navigateUtils.checkLocPathIsAvailable(task.getOriginLoc(), task.getHostId()); |
| | | if(!checkLocPathIsAvailable) { |
| | | continue; |
| | | } |
| | | |
| | | if (Cools.isEmpty(task.getShuttleNo())) { |
| | | if (Cools.isEmpty(task.getShuttleNo()) || task.getShuttleNo() ==0) { |
| | | //分配小车 |
| | | //搜索空闲车 |
| | | ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task); |
| | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateMotion(task); |
| | | if (Cools.isEmpty(motionList)) { |
| | | task.setShuttleNo(0);//保存穿梭车号 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.info("{}任务更新穿梭车号失败", task.getTaskNo()); |
| | | } |
| | | log.error("出库 ===>> 暂时没有空闲小车, 任务号={}", task.getTaskNo()); |
| | | continue; |
| | | } |
| | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateShuttleMoveMotion(task); |
| | | if (motionList.isEmpty()) { |
| | | task.setShuttleNo(null);//保存穿梭车号 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.info("{}任务更新穿梭车号失败", task.getTaskNo()); |
| | | } |
| | | continue; |
| | | } |
| | | motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId()); |
| | |
| | | } |
| | | } |
| | | |
| | | // 解析小车载货移动工作档 |
| | | public synchronized void analyzeLadenMoveTask() { |
| | | for (Task task : taskService.selectWaitAnalyzeLadenMoveTask()) { |
| | | //检测货物是否可出 |
| | | boolean checkLocPathIsAvailable = navigateUtils.checkLocPathIsAvailable(task.getOriginLoc(), task.getHostId()); |
| | | if(!checkLocPathIsAvailable) { |
| | | continue; |
| | | } |
| | | |
| | | if (Cools.isEmpty(task.getShuttleNo())) { |
| | | //分配小车 |
| | | //搜索空闲车 |
| | | ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task); |
| | | if (shuttleThread == null) { |
| | | News.info("{}任务未找到空闲穿梭车", task.getTaskNo()); |
| | | continue; |
| | | } |
| | | |
| | | task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//保存穿梭车号 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.info("{}任务更新穿梭车号失败", task.getTaskNo()); |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | // generate motion list |
| | | List<Motion> motionList = analyzeService.generateShuttleLadenMoveMotion(task); |
| | | if (motionList.isEmpty()) { |
| | | continue; |
| | | } |
| | | motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId()); |
| | | |
| | | // 更新工作主档 |
| | | task.setTaskSts(TaskStsType.ANALYZE_LADEN_MOVE.sts); // 工作状态 |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo()); |
| | | } |
| | | } |
| | | } |
| | | } |