| | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机后小车待机位 |
| | | List<String> standbyLocs = shuttleStandbyFrom.getStandbyLoc$();//获取全部待机位 |
| | | //获取可用待机位 |
| | | String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs); |
| | | //穿梭车出提升机后全部待机位 |
| | | String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//获取全部待机位 |
| | | |
| | | |
| | | //获取出库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleFromLiftStandbyLoc); |
| | | dto.setLocNo(standbyLocs); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleFromLiftStandbyLoc); |
| | | dto.setLocNo(standbyLocs); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | |
| | | motion.setTemp(String.valueOf(origin.getLiftNo()));//保存提升机号 |
| | | motion.setDockNo(String.valueOf(target.getStaNo())); |
| | | break; |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | motion.setTarget(null);//等待自动搜索 |
| | | motion.setTemp(target.getLocNo());//全部待机位 |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | package com.zy.asrs.wcs.core.kernel.command; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | |
| | | import com.zy.asrs.wcs.rcs.News; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | 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.LiftProtocol; |
| | |
| | | private LiftAction liftAction; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | @Autowired |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | |
| | | // 计算 |
| | | public Boolean accept(Motion motion) { |
| | |
| | | if (null == shuttleProtocol) { |
| | | return false; |
| | | } |
| | | |
| | | Device shuttleDevice = shuttleThread.getDevice(); |
| | | if (!shuttleThread.isIdle(new ExecuteSupport() { |
| | | @Override |
| | | public Boolean judgement() { |
| | |
| | | case SHUTTLE_UPDATE_LOCATION://小车坐标更新 |
| | | shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_UPDATE_LOCATION; |
| | | shuttleCommands.add(shuttleThread.getUpdateLocationCommand(motion.getTaskNo(), motion.getTarget())); |
| | | break; |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; |
| | | |
| | | //获取全部待机位 |
| | | List<String> standbyLocs = JSON.parseArray(motion.getTemp(), String.class); |
| | | //获取可用待机位 |
| | | String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs); |
| | | shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), shuttleFromLiftStandbyLoc, NavigationMapType.NORMAL.id, assignCommand, shuttleThread); |
| | | |
| | | //更新动作可用待机位 |
| | | motion.setTarget(shuttleFromLiftStandbyLoc); |
| | | motion.setUpdateTime(new Date()); |
| | | motionService.updateById(motion); |
| | | |
| | | break; |
| | | default: |
| | | throw new CoolException(motion.getMotionCtgEl() + "没有指定任务作业流程!!!"); |
| | |
| | | return false; |
| | | } |
| | | break; |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | if (!shuttleProtocol.getCurrentLocNo().equals(motion.getTarget())) { |
| | | return false; |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.model.enums; |
| | | |
| | | public enum MapNodeType { |
| | | |
| | | DISABLE(-1, "禁用"), |
| | | NORMAL_PATH(0, "货位"), |
| | | START_POINT(1, "起点"), |
| | | TARGET_POINT(2, "终点"), |
| | | MAIN_PATH(3, "母轨"), |
| | | CONVEYOR(4, "输送站点"), |
| | | CHARGE(5, "充电桩"), |
| | | CONVEYOR_CAR_GO(6, "小车可走输送站点"), |
| | | CAR(66, "小车"), |
| | | LIFT(67, "提升机"), |
| | | LOCK(-999, "锁定节点"), |
| | | ; |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | |
| | | MapNodeType(Integer id, String desc) { |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public static MapNodeType get(Short id) { |
| | | if (null == id) { |
| | | return null; |
| | | } |
| | | for (MapNodeType type : MapNodeType.values()) { |
| | | if (type.id.equals(id.intValue())) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static MapNodeType get(MapNodeType type) { |
| | | if (null == type) { |
| | | return null; |
| | | } |
| | | for (MapNodeType type1 : MapNodeType.values()) { |
| | | if (type1 == type) { |
| | | return type1; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | SHUTTLE_MOVE_TO_LIFT(SHUTTLE), |
| | | SHUTTLE_MOVE_FROM_CONVEYOR(SHUTTLE), |
| | | SHUTTLE_MOVE_TO_CONVEYOR(SHUTTLE), |
| | | SHUTTLE_MOVE_STANDBY(SHUTTLE), |
| | | |
| | | SHUTTLE_MOVE_FROM_LIFT_TO_CONVEYOR(SHUTTLE), |
| | | |
| | |
| | | import com.zy.asrs.framework.common.SpringUtils; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wcs.core.model.NavigateNode; |
| | | import com.zy.asrs.wcs.core.model.enums.MapNodeType; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | | import com.zy.asrs.wcs.system.service.DictService; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | return false; |
| | | } |
| | | // 如果结点的位置小于0,则不合法 |
| | | if (map[x][y] < 0) return false; |
| | | if (map[x][y] < 0) { |
| | | return false; |
| | | } |
| | | |
| | | if (map[x][y] == MapNodeType.CAR.id) {//节点是小车 |
| | | return false; |
| | | } |
| | | NavigateNode navigateNode = new NavigateNode(x, y); |
| | | if (is_exist(navigateNode)) { |
| | | return false; |
| | |
| | | |
| | | return levCount < Integer.parseInt(dict.getValue()); |
| | | } |
| | | //分析出库路径待机库位 |
| | | public String analyzeOutPathWaitLoc(String startLoc, String targetLoc, Device shuttleDevice) { |
| | | //计算路径并分解成两段动作 |
| | | List<NavigateNode> nodeList = NavigateUtils.calc(startLoc, targetLoc, NavigationMapType.DFX.id, Utils.getShuttlePoints(Integer.parseInt(shuttleDevice.getDeviceNo()), Utils.getLev(startLoc))); |
| | | if (nodeList == null) { |
| | | News.error("{} dash {} can't find navigate path!", startLoc, targetLoc); |
| | | return null; |
| | | } |
| | | //获取分段路径 |
| | | ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(nodeList); |
| | | if (data.size() <= 1) { |
| | | return null;//两点之间只有一段路径 |
| | | } |
| | | |
| | | //取出倒数第二段路径 |
| | | ArrayList<NavigateNode> navigateNodes = data.get(data.size() - 2); |
| | | NavigateNode startNode = navigateNodes.get(0); |
| | | String lastPathStartLoc = Utils.getLocNo(startNode.getX(), startNode.getY(), startNode.getZ()); |
| | | return lastPathStartLoc; |
| | | } |
| | | |
| | | } |
| | |
| | | case SHUTTLE_PALLET_DOWN://托盘下降 |
| | | case SHUTTLE_CHARGE_ON://充电开 |
| | | case SHUTTLE_CHARGE_OFF://充电关 |
| | | case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位 |
| | | return deviceTaskNo; |
| | | default: |
| | | return taskNo; |