| | |
| | | import com.zy.acs.common.domain.protocol.*; |
| | | import com.zy.acs.common.domain.protocol.action.*; |
| | | import com.zy.acs.common.enums.*; |
| | | import com.zy.acs.common.utils.Base62; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | |
| | | task.setAgvId(agvId); |
| | | task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId)); |
| | | task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | // task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | task.setSeqNum(Base62.encode(snowflakeIdWorker.nextId())); |
| | | task.setOriCode(agvDetail.getCode()); |
| | | task.setDestCode(endCode.getId()); |
| | | // lane |
| | |
| | | reverse = true; |
| | | } |
| | | nextDirection = nextLaneDir; // 防止 第一个动作一定是 turn 出问题 |
| | | } else if (null != lastLaneDir) { // todo turn 环形直角 |
| | | } else if (null != lastLaneDir) { // turn 环形直角不应该存在于lane中 |
| | | final double oppLastLaneDir = (lastLaneDir + 180) % 360; |
| | | |
| | | if (!lastDirection.equals(nextDirection)) { // lastLaneDir |
| | | if (!lastDirection.equals(lastLaneDir)) { |
| | | if (!lastCode.getCornerBool()) { |
| | | throw new CoolException(agvNo + "号小车离开巷道需调整方向为 " + nextDirection + "°,请推至转弯点手动调整"); |
| | | } |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.OUT); |
| | | break; |
| | | } |
| | | log.info("AGV[{}] load permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | success = true; |
| | | break; |
| | | case DEST_STA: |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.IN); |
| | | break; |
| | | } |
| | | log.info("AGV[{}] unload permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | success = true; |
| | | break; |
| | | default: |
| | |
| | | AGV_06_DOWN agv_06_down = new AGV_06_DOWN(); |
| | | agv_06_down.setSerialNo(agv_06_up.getSerialNo()); |
| | | agv_06_down.setActionCode(agv_06_up.getActionCode()); |
| | | //agv_06_down.setResult(success ? 1 : 0); |
| | | agv_06_down.setResult(1); |
| | | agv_06_down.setResult(success ? 1 : 0); |
| | | //agv_06_down.setResult(0); |
| | | redis.push(RedisConstant.AGV_PATH_DOWN_FLAG, AgvProtocol.build(protocol.getAgvNo()).setMessageBody(agv_06_down)); |
| | | } |
| | | |