| | |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | | import com.zy.asrs.wcs.core.kernel.AnalyzeService; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.NavigationMapType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.*; |
| | | import com.zy.asrs.wcs.core.service.*; |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | |
| | | } |
| | | |
| | | int lev = Utils.getLev(locNo);//当前楼层 |
| | | JSONArray standbyLoc = JSON.parseArray(idleLoc); |
| | | if (lev > standbyLoc.size()) { |
| | | List<String> standbyLoc = JSON.parseArray(idleLoc, String.class); |
| | | if (standbyLoc.isEmpty()) { |
| | | throw new CoolException("避让数据异常"); |
| | | } |
| | | |
| | | Object object = standbyLoc.get(lev - 1); |
| | | List<String> locs = JSON.parseArray(object.toString(), String.class); |
| | | if (locs.isEmpty()) { |
| | | throw new CoolException("避让数据为空"); |
| | | //获取当前层避让位置 |
| | | List<String> currentLevStandByLoc = new ArrayList<>(); |
| | | for (String loc : standbyLoc) { |
| | | if (Utils.getLev(loc) == lev) { |
| | | currentLevStandByLoc.add(loc); |
| | | } |
| | | } |
| | | if (currentLevStandByLoc.isEmpty()) { |
| | | throw new CoolException("当前层无避让位置"); |
| | | } |
| | | |
| | | Integer finalDistance = ShuttleDispatcher.INF; |
| | | String recentLoc = null; |
| | | for (String loc : locs) { |
| | | for (String loc : currentLevStandByLoc) { |
| | | //当前穿梭车到避让位计算 |
| | | List<NavigateNode> currentShuttlePath = NavigateUtils.calc( |
| | | locNo |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.OFFLINE)) { |
| | | continue; |
| | | } |
| | | |
| | | if(!shuttleThread.isDeviceIdle()) { |
| | | continue; |
| | | } |
| | | |
| | | if(shuttleProtocol.getCurrentLocNo() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) == lev) { |
| | | if (shuttleProtocol.getHasCharge()) { |
| | | continue;//充电中 |
| | |
| | | |
| | | } |
| | | |
| | | //搜索是否存在前往目标楼层的小车工作档 |
| | | for (Task task : taskService.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskSts, TaskStsType.NEW_INBOUND.sts, TaskStsType.ANALYZE_INBOUND.sts, TaskStsType.EXECUTE_INBOUND.sts, TaskStsType.COMPLETE_INBOUND.sts |
| | | , TaskStsType.NEW_OUTBOUND.sts, TaskStsType.ANALYZE_OUTBOUND.sts, TaskStsType.EXECUTE_OUTBOUND.sts, TaskStsType.COMPLETE_OUTBOUND.sts))) { |
| | | |
| | | List<Motion> motions = motionService.list(new LambdaQueryWrapper<Motion>() |
| | | .eq(Motion::getTaskNo, task.getTaskNo()) |
| | | .in(Motion::getMotionCtg, MotionCtgType.SHUTTLE_MOVE |
| | | , MotionCtgType.SHUTTLE_MOVE_LIFT_PALLET |
| | | , MotionCtgType.SHUTTLE_MOVE_DOWN_PALLET |
| | | , MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | , MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | , MotionCtgType.SHUTTLE_MOVE_FROM_CONVEYOR |
| | | , MotionCtgType.SHUTTLE_MOVE_TO_CONVEYOR |
| | | , MotionCtgType.SHUTTLE_MOVE_FROM_LIFT_TO_CONVEYOR |
| | | )); |
| | | |
| | | boolean isUpdateLev = false; |
| | | for (Motion motion : motions) { |
| | | if (motion.getOrigin() == null || motion.getTarget() == null) { |
| | | continue; |
| | | } |
| | | |
| | | int sourceLev = Utils.getLev(motion.getOrigin());//动作源楼层 |
| | | int targetLev = Utils.getLev(motion.getTarget());//动作目标楼层 |
| | | if (sourceLev != targetLev) { |
| | | isUpdateLev = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if(isUpdateLev) { |
| | | levCount++;//工作档属于跨层任务,小车归属于目标楼层 |
| | | continue; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return levCount < Integer.parseInt(dict.getValue()); |
| | | } |
| | | |