| | |
| | | agvSprite.position.set(codeSprite.position.x, codeSprite.position.y); |
| | | agvSprite.rotation = targetRotation + agvRotationOffset; |
| | | mapContainer.addChild(agvSprite); |
| | | console.log(agvSprite, setCurSprite); |
| | | beInsight(agvSprite, setCurSprite); |
| | | |
| | | // agvNo sprite |
| | |
| | | if (null == endCode) { |
| | | return R.error(); |
| | | } |
| | | if (!mainLockWrapService.buildMinorTask(agv, agvDetail, param.getTaskMode(), endCode.getData())) { |
| | | if (!mainLockWrapService.buildMinorTask(agv, param.getTaskMode(), endCode.getData(), null)) { |
| | | return R.error(); |
| | | } |
| | | break; |
| | | case TO_CHARGE: |
| | | case TO_STANDBY: |
| | | if (!mainLockWrapService.buildMinorTask(agv, agvDetail, param.getTaskMode(), null)) { |
| | | if (!mainLockWrapService.buildMinorTask(agv, param.getTaskMode(), null, null)) { |
| | | return R.error(); |
| | | } |
| | | break; |
| | |
| | | continue; |
| | | } |
| | | |
| | | mainLockWrapService.buildMinorTask(agv, agvDetail, TaskTypeType.TO_CHARGE, null); |
| | | mainLockWrapService.buildMinorTask(agv, TaskTypeType.TO_CHARGE, null, null); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | // } |
| | | |
| | | mainLockWrapService.buildMinorTask(agv, agvDetail, TaskTypeType.TO_STANDBY, null); |
| | | mainLockWrapService.buildMinorTask(agv, TaskTypeType.TO_STANDBY, null, null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.manager.entity.Agv; |
| | | import com.zy.acs.manager.manager.entity.AgvDetail; |
| | | import com.zy.acs.manager.manager.entity.Jam; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.TaskTypeType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | } |
| | | |
| | | public boolean buildMinorTask(Agv agv, AgvDetail agvDetail, TaskTypeType taskType, String destination) { |
| | | public boolean buildMinorTask(Agv agv, TaskTypeType taskType, String destination, Jam jam) { |
| | | boolean lockAcquired = false; |
| | | try { |
| | | if (!(lockAcquired = this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS))) { |
| | |
| | | } |
| | | // log.info("buildMinorTask AGV[{}] lock time: {}", agv.getUuid(), System.currentTimeMillis()); |
| | | |
| | | return mainService.buildMinorTask(agv, agvDetail, taskType, destination); |
| | | return mainService.buildMinorTask(agv, taskType, destination, jam); |
| | | } catch (Exception e) { |
| | | log.error("MainLockWrapService.buildMinorTask[task]", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | |
| | | * 充电 回待机位任务 |
| | | */ |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional |
| | | public boolean buildMinorTask(Agv agv, AgvDetail agvDetail, TaskTypeType taskType, String destination) { |
| | | public boolean buildMinorTask(Agv agv, TaskTypeType taskType, String destination, Jam jam) { |
| | | if (Cools.isEmpty(agv, taskType)) { return false; } |
| | | try { |
| | | if (null == agvDetail) { |
| | | agvDetail = agvDetailService.selectByAgvId(agv.getId()); |
| | | } |
| | | AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); |
| | | if (!agvService.judgeEnable(agv.getId())) { |
| | | return false; |
| | | } |
| | |
| | | } |
| | | if (!segmentService.save(next)) { |
| | | throw new BusinessException("segment failed to save"); |
| | | } else { |
| | | if (null != jam && i == 0) { |
| | | jam.setAvoSeg(next.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (null == destinationCode) { |
| | | return; |
| | | } |
| | | if (mainLockWrapService.buildMinorTask(agv, agvDetail, TaskTypeType.MOVE, destinationCode.getData())) { |
| | | if (mainLockWrapService.buildMinorTask(agv, TaskTypeType.MOVE, destinationCode.getData(), null)) { |
| | | log.info(agv.getUuid() + "开始走行演示..."); |
| | | } |
| | | } |
| | |
| | | if (!segmentService.save(insertSeg)) { |
| | | log.error("Segment [{}] 保存失败 !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | return false; |
| | | } else { |
| | | jam.setAvoSeg(insertSeg.getId()); |
| | | } |
| | | |
| | | } else { |
| | | |
| | | return mainLockWrapService.buildMinorTask(agv, null, TaskTypeType.MOVE, endCodeData); |
| | | return mainLockWrapService.buildMinorTask(agv, TaskTypeType.MOVE, endCodeData, jam); |
| | | } |
| | | |
| | | return true; |