| | |
| | | if (backpackCount !== prevBackpackCount || battery !== prevBattery) { |
| | | const agvStatusMode = getAgvStatusMode(backpackCount, battery); |
| | | const agvTexture = generateAgvSpriteTexture(agvStatusMode); |
| | | agvSprite.texture = PIXI.Texture.from(agvTexture, { resourceOptions: { scale: 1 } }); |
| | | agvSprite.texture = PIXI.Texture.from(agvTexture, { resourceOptions: { scale: 1 } }); // todo Uncaught TypeError: Cannot read properties of undefined (reading '_pixiId') |
| | | // update backpackCount and battery |
| | | agvSprite.data.backpackCount = backpackCount; |
| | | agvSprite.data.battery = battery; |
| | |
| | | List<String> result = new ArrayList<>(); |
| | | for (Agv agv : agvList) { |
| | | if (!hasRunning) { |
| | | // 1. without running tasks |
| | | if (0 < taskService.count(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getAgvId, agv.getId()) |
| | | .and(i -> i |
| | |
| | | )) { |
| | | continue; |
| | | } |
| | | } |
| | | // 2. in idle status |
| | | if (!agvService.judgeEnable(agv.getId(), true)) { |
| | | continue; |
| | | if (!agvService.judgeEnable(agv.getId(), true, true)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | if (!agvService.judgeEnable(agv.getId(), true, false)) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | result.add(agv.getUuid()); |
| | |
| | | try { |
| | | // valid ----------------------------------------------- |
| | | Agv agv = agvService.getById(agvId); |
| | | if (!agvService.judgeEnable(agv.getId(), false)) { |
| | | if (!agvService.judgeEnable(agv.getId())) { |
| | | return; |
| | | } |
| | | if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.OUT); |
| | | break; |
| | | } |
| | | log.info("AGV[{}] load permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | 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()); |
| | | log.info("AGV [{}] unload permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | success = true; |
| | | break; |
| | | default: |
| | | log.error("agv[{}] has wrong posType [{}], segment [{}]", protocol.getAgvNo(), posType.toString(), currSeg.getId()); |
| | | log.error("AGV [{}] has wrong posType [{}], segment [{}]", protocol.getAgvNo(), posType.toString(), currSeg.getId()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | |
| | | Boolean judgeEnable(Long agvId); |
| | | |
| | | Boolean judgeEnable(Long agvId, Boolean withBattery); |
| | | Boolean judgeEnable(Long agvId, Boolean withBattery, Boolean idleStatus); |
| | | |
| | | Boolean judgeOnline(Long agvId); |
| | | |
| | |
| | | |
| | | @Override |
| | | public Boolean judgeEnable(Long agvId) { |
| | | return this.judgeEnable(agvId, false); |
| | | return this.judgeEnable(agvId, false, true); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean judgeEnable(Long agvId, Boolean isLowBattery) { |
| | | public Boolean judgeEnable(Long agvId, Boolean isLowBattery, Boolean idleStatus) { |
| | | String agvNo = this.getAgvNo(agvId); |
| | | AgvModel agvModel = agvModelService.getByAgvId(agvId); |
| | | if (0 < segmentService.count(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()) |
| | | )) { |
| | | if (idleStatus) { |
| | | if (0 < segmentService.count(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()) |
| | | )) { |
| | | // log.warn("[{}]号Agv正在忙碌 - segment......", agvNo); |
| | | return false; |
| | | return false; |
| | | } |
| | | } |
| | | if (!this.judgeOnline(agvId)) { |
| | | // log.warn("[{}]号Agv不是在线状态......", agvNo); |
| | |
| | | if (null == agvDetail.getSoc() || agvDetail.getSoc() == 0) { |
| | | return false; |
| | | } |
| | | if (!agvDetail.getAgvStatus().equals(AgvStatusType.IDLE) && !agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | log.warn("[{}]号Agv不是空闲状态......", agvNo); |
| | | return false; |
| | | if (idleStatus) { |
| | | if (!agvDetail.getAgvStatus().equals(AgvStatusType.IDLE) && !agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | log.warn("[{}]号Agv不是空闲状态......", agvNo); |
| | | return false; |
| | | } |
| | | } |
| | | if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | if (agvDetail.getSoc() < agvModel.getQuaBattery()) { |