| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.concurrent.TimeoutException; |
| | | |
| | |
| | | public BaseResult<?> executeAgvActionCmd(AgvAction agvAction) { |
| | | |
| | | // todo 1: 记录日志 2:发送任务 3:同步响应 |
| | | // log.info(JSON.toJSONString(agvAction)); |
| | | // News.info(JSON.toJSONString(agvAction)); |
| | | |
| | | String serialNo = agvAction.getSerialNo(); |
| | | |
| | |
| | | public BaseResult<?> executeAgvCommand(AgvCommand agvCommand) { |
| | | |
| | | // todo 1: 记录日志 2:发送任务 3:同步响应 |
| | | log.info(JSON.toJSONString(agvCommand)); |
| | | News.info(JSON.toJSONString(agvCommand)); |
| | | |
| | | String serialNo = agvCommand.getSerialNo(); |
| | | |
| | |
| | | return BaseResult.error(); |
| | | } |
| | | } catch (TimeoutException e){ |
| | | log.error("AgvCmdService.requestProcess", e); |
| | | News.error("AgvCmdService.requestProcess", e); |
| | | return BaseResult.error(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | |
| | | Long agvId = agvService.getAgvId(protocol.getAgvNo()); |
| | | if (null == agvId) { |
| | | log.warn("Agv [{}] 尚未鉴权 !!!", protocol.getAgvNo()); |
| | | News.warn("Agv [{}] 尚未鉴权 !!!", protocol.getAgvNo()); |
| | | return; |
| | | } |
| | | AgvDetail detail = agvDetailService.selectByAgvId(agvId); |
| | |
| | | detail = new AgvDetail(); |
| | | detail.setAgvId(agvId); |
| | | if (!agvDetailService.save(detail)) { |
| | | log.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); |
| | | News.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); |
| | | return; |
| | | } |
| | | } |
| | |
| | | this.sync(agv_12_up, detail); |
| | | // redis.setObject(RedisConstant.DIGITAL_AGV_FLAG, agv.getUuid(), agv_12_up); |
| | | if (PRINT_LOG) { |
| | | log.info("Agv [{}] 有码实时数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_12_up)); |
| | | News.info("Agv [{}] 有码实时数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_12_up)); |
| | | } |
| | | } |
| | | // 无码实时数据包 |
| | |
| | | this.sync(agv_13_up, detail); |
| | | // redis.setObject(RedisConstant.DIGITAL_AGV_FLAG, agv.getUuid(), agv_13_up); |
| | | if (PRINT_LOG) { |
| | | log.info("Agv [{}] 无码实时数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_13_up)); |
| | | News.info("Agv [{}] 无码实时数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_13_up)); |
| | | } |
| | | } |
| | | // 心跳包 |
| | |
| | | AGV_03_UP agv_03_up = (AGV_03_UP) msgBody; |
| | | this.sync(agv_03_up, detail); |
| | | if (PRINT_LOG) { |
| | | log.info("Agv [{}] 心跳包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_03_up)); |
| | | News.info("Agv [{}] 心跳包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_03_up)); |
| | | } |
| | | } |
| | | // 登陆包 |
| | | if (msgBody instanceof AGV_F0_UP) { |
| | | AGV_F0_UP agv_f0_up = (AGV_F0_UP) msgBody; |
| | | this.sync(agv_f0_up, detail); |
| | | log.info("Agv [{}] 登陆包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_f0_up)); |
| | | News.info("Agv [{}] 登陆包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_f0_up)); |
| | | } |
| | | // 故障数据包 |
| | | if (msgBody instanceof AGV_04_UP) { |
| | | AGV_04_UP agv_04_up = (AGV_04_UP) msgBody; |
| | | AgvErrorType errorType = AgvErrorType.query(agv_04_up.getHexFaultId()); |
| | | log.info("Agv [{}] 故障数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_04_up)); |
| | | News.info("Agv [{}] 故障数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_04_up)); |
| | | |
| | | // save |
| | | faultProcessor.execute(new VehicleFaultDto<>(protocol.getAgvNo(), protocol.getTimestamp(), agv_04_up)); |
| | |
| | | } |
| | | } |
| | | if (!agvDetailService.updateById(detail)) { |
| | | log.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); |
| | | News.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); |
| | | } |
| | | |
| | | } |
| | |
| | | detail.setLastCode(null); |
| | | detail.setPos(1); |
| | | // if (!agvDetailService.updatePosCode(detail.getId(), code.getId())) { |
| | | // log.error("Agv [{}] 更新定位数据失败 !!!", agvService.getById(detail.getAgvId()).getUuid()); |
| | | // News.error("Agv [{}] 更新定位数据失败 !!!", agvService.getById(detail.getAgvId()).getUuid()); |
| | | // } |
| | | } else { |
| | | log.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); |
| | | News.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); |
| | | } |
| | | |
| | | // 地面码偏移 |
| | |
| | | |
| | | |
| | | } else { |
| | | log.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); |
| | | News.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); |
| | | } |
| | | |
| | | detail.setStraightVal((double) mesBody.getStraightDirectionPosition()); |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvIdsByTask(task), false); |
| | | // List<String> availableAgvNos = this.getAvailableAgvNos(null); |
| | | if (Cools.isEmpty(availableAgvNos)) { |
| | | // log.warn("No available agv to assign the task[{}]", task.getSeqNum()); |
| | | // News.warn("No available agv to assign the task[{}]", task.getSeqNum()); |
| | | return null; |
| | | } |
| | | |
| | |
| | | |
| | | // valid |
| | | if (Cools.isEmpty(availableAgvNosByOriLane)) { |
| | | log.warn("No available agv to assign the task origin[{}]", task.getSeqNum()); |
| | | News.warn("No available agv to assign the task origin[{}]", task.getSeqNum()); |
| | | return null; |
| | | } |
| | | if (Cools.isEmpty(availableAgvNosByDestLane)) { |
| | | log.warn("No available agv to assign the task destination[{}]", task.getSeqNum()); |
| | | News.warn("No available agv to assign the task destination[{}]", task.getSeqNum()); |
| | | return null; |
| | | } |
| | | List<String> actualAvailableAgvNos = Cools.getIntersection(availableAgvNosByOriLane, availableAgvNosByDestLane); |
| | | if (Cools.isEmpty(actualAvailableAgvNos)) { |
| | | log.warn("No available agv to assign the task[{}]", task.getSeqNum()); |
| | | News.warn("No available agv to assign the task[{}]", task.getSeqNum()); |
| | | return null; |
| | | } |
| | | |
| | |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.core.io.Resource; |
| | | import org.springframework.stereotype.Component; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | |
| | | |
| | | try { |
| | | if (!(lockAcquired = lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS))) { |
| | | log.warn("AvoidWaveCalculator execute fail, cause can not acquire lock ..."); |
| | | News.warn("AvoidWaveCalculator execute fail, cause can not acquire lock ..."); |
| | | return false; |
| | | } |
| | | |
| | |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | log.error(this.getClass().getSimpleName(), e); |
| | | News.error(this.getClass().getSimpleName(), e); |
| | | return false; |
| | | } finally { |
| | | |
| | |
| | | |
| | | long during = System.currentTimeMillis() - startTime; |
| | | if (during > 50) { |
| | | log.info("滤波函数花费时间为:{}毫秒......", during); |
| | | News.info("滤波函数花费时间为:{}毫秒......", during); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // private boolean calcWaveScopeByPython(Integer lev, AgvModel agvModel) throws Exception { |
| | | // if (null == agvModel.getDiameter() || agvModel.getDiameter() <= 0) { |
| | | // log.warn("There is no diameter or diameter value was wrong..."); |
| | | // News.warn("There is no diameter or diameter value was wrong..."); |
| | | // } |
| | | // |
| | | // // python |
| | |
| | | // |
| | | // int exitCode = process.waitFor(); |
| | | // if (exitCode != 0) { |
| | | // log.error("Python script exited with error code: {}", exitCode); |
| | | // log.error("python error:{}", builder.toString()); |
| | | // News.error("Python script exited with error code: {}", exitCode); |
| | | // News.error("python error:{}", builder.toString()); |
| | | // return false; |
| | | // } |
| | | // reader.close(); |
| | |
| | | // return false; |
| | | // } |
| | | // if (!"1".equals(result)) { |
| | | // log.error("Failed to call python"); |
| | | // News.error("Failed to call python"); |
| | | // return false; |
| | | // } |
| | | // |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.Date; |
| | | |
| | |
| | | vehFaultRec.setProtocol(RadixTools.bytesToHexStr(agv_04_up.writeToBytes())); |
| | | |
| | | if (!vehFaultRecService.save(vehFaultRec)) { |
| | | log.error("{}号车辆故障!记录故障信息失败......", dto.getVehicle()); |
| | | News.error("{}号车辆故障!记录故障信息失败......", dto.getVehicle()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("FaultProcessor", e); |
| | | News.error("FaultProcessor", e); |
| | | } |
| | | } |
| | | |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | |
| | | public void prepare(Guarantee plan, LocalDateTime targetTime) { |
| | | int requiredCount = plan.getRequiredCount() == null ? 0 : plan.getRequiredCount(); |
| | | if (requiredCount <= 0) { |
| | | log.warn("Guarantee[{}] requiredCount is not configured, skip", plan.getName()); |
| | | News.warn("Guarantee[{}] requiredCount is not configured, skip", plan.getName()); |
| | | return; |
| | | } |
| | | int minSoc = plan.getMinSoc(); |
| | |
| | | } |
| | | } |
| | | if (available >= requiredCount) { |
| | | // log.debug("Guarantee[{}] already has {} vehicles >= {}% SOC for {}", plan.getName(), available, minSoc, targetTime); |
| | | return; |
| | | } |
| | | int shortage = requiredCount - available; // 还差多少辆 |
| | |
| | | if (scheduled >= shortage) { |
| | | break; |
| | | } |
| | | log.info("Guarantee[{}] schedule AGV {} charging (soc={}%) for target {}", |
| | | News.info("Guarantee[{}] schedule AGV {} charging (soc={}%) for target {}", |
| | | plan.getName(), candidate.getAgv().getName(), candidate.getSoc(), targetTime); |
| | | mainLockWrapService.buildMinorTask(candidate.getAgv().getId(), TaskTypeType.TO_CHARGE, null, null); |
| | | scheduled++; |
| | | } |
| | | if (scheduled < shortage) { |
| | | log.warn("Guarantee[{}] still short of {} vehicles for {} (only {} idle low-soc AGVs)", |
| | | News.warn("Guarantee[{}] still short of {} vehicles for {} (only {} idle low-soc AGVs)", |
| | | plan.getName(), shortage - scheduled, targetTime, candidates.size()); |
| | | } |
| | | } |
| | |
| | | try { |
| | | wrapper.eq(Agv::getAgvModel, Long.valueOf(plan.getScopeValue())); |
| | | } catch (NumberFormatException ignore) { |
| | | log.warn("Guarantee[{}] invalid scopeValue {}", plan.getName(), plan.getScopeValue()); |
| | | News.warn("Guarantee[{}] invalid scopeValue {}", plan.getName(), plan.getScopeValue()); |
| | | } |
| | | } |
| | | return agvService.list(wrapper); |
| | |
| | | import org.springframework.boot.context.event.ApplicationReadyEvent; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.security.MessageDigest; |
| | | import java.security.NoSuchAlgorithmException; |
| | |
| | | stopWatch.start(); |
| | | this.initLaneData(); |
| | | stopWatch.stop(); |
| | | log.info("the rcs system calculated lane data which has spend {} millisecond......", stopWatch.getTime()); |
| | | News.info("the rcs system calculated lane data which has spend {} millisecond......", stopWatch.getTime()); |
| | | |
| | | if (!Cools.isEmpty(this.laneDtoList)) { |
| | | laneService.batchSaveByLaneDtoList(null, this.laneDtoList); |
| | |
| | | } |
| | | |
| | | private void initLaneData() { |
| | | log.info("the rcs system is starting to initialize lane data..."); |
| | | News.info("the rcs system is starting to initialize lane data..."); |
| | | |
| | | List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>().eq(Code::getStatus, StatusType.ENABLE.val)); |
| | | |
| | |
| | | |
| | | this.generateLaneHash(); |
| | | |
| | | log.info("the lane data initialization has been completed in rcs system."); |
| | | News.info("the lane data initialization has been completed in rcs system."); |
| | | } |
| | | |
| | | private void fillAdjacencyCodeMap(List<Code> codeList) { |
| | |
| | | try { |
| | | md = MessageDigest.getInstance("SHA-256"); |
| | | } catch (NoSuchAlgorithmException e) { |
| | | log.error("generateDigest", e); |
| | | News.error("generateDigest", e); |
| | | throw new RuntimeException(e); |
| | | } |
| | | String combined = list.stream().sorted().collect(Collectors.joining(",")); |
| | |
| | | } |
| | | |
| | | public void generateLaneCodeIdx(Integer lev) { |
| | | log.info("There is initializing Lane CodeIdxMap......"); |
| | | News.info("There is initializing Lane CodeIdxMap......"); |
| | | if (Cools.isEmpty(this.laneDtoList)) { |
| | | return; |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | mainService.buildMajorTask(agvId, taskList); |
| | | } catch (Exception e) { |
| | | |
| | | log.error("MainLockWrapService.buildMajorTask[task]", e); |
| | | News.error("MainLockWrapService.buildMajorTask[task]", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } finally { |
| | | if (lockAcquired) { |
| | |
| | | if (!(lockAcquired = this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS))) { |
| | | throw new CoolException("failed to generate [minor task] actions, cause can not acquire lock ..."); |
| | | } |
| | | // log.info("buildMinorTask AGV[{}] lock time: {}", agv.getUuid(), System.currentTimeMillis()); |
| | | // News.info("buildMinorTask AGV[{}] lock time: {}", agv.getUuid(), System.currentTimeMillis()); |
| | | |
| | | return mainService.buildMinorTask(agvId, taskType, destination, jam); |
| | | } catch (Exception e) { |
| | | log.error("MainLockWrapService.buildMinorTask[task]", e); |
| | | News.error("MainLockWrapService.buildMinorTask[task]", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | return false; |
| | |
| | | if (lockAcquired) { |
| | | this.lock.unlock(); |
| | | } |
| | | // log.info("buildMinorTask AGV[{}] unlock time: {}", agv.getUuid(), System.currentTimeMillis()); |
| | | // News.info("buildMinorTask AGV[{}] unlock time: {}", agv.getUuid(), System.currentTimeMillis()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | bus.setBusSts(BusStsType.PROGRESS.val()); |
| | | bus.setUpdateTime(now); |
| | | if (!busService.updateById(bus)) { |
| | | log.error("Bus [{}] failed to Update !!!", bus.getUuid()); |
| | | News.error("Bus [{}] failed to Update !!!", bus.getUuid()); |
| | | } |
| | | } |
| | | return; |
| | |
| | | currSeg.setState(SegmentStateType.INIT.toString()); |
| | | currSeg.setUpdateTime(now); |
| | | if (!segmentService.updateById(currSeg)) { |
| | | // log.error("Segment [{}] failed to update !!!", currSeg.getGroupId() + " - " + currSeg.getSerial()); |
| | | // News.error("Segment [{}] failed to update !!!", currSeg.getGroupId() + " - " + currSeg.getSerial()); |
| | | throw new CoolException("failed to update segment [" + currSeg.getGroupId() + "-" + currSeg.getSerial() + "] failed"); |
| | | } |
| | | |
| | |
| | | loadSeg.setCreateTime(now); |
| | | loadSeg.setUpdateTime(now); |
| | | if (!segmentService.save(loadSeg)) { |
| | | // log.error("Segment [{}] failed to save !!!", loadSeg.getTravelId() + " - " + loadSeg.getSerial()); |
| | | // News.error("Segment [{}] failed to save !!!", loadSeg.getTravelId() + " - " + loadSeg.getSerial()); |
| | | throw new CoolException("failed to save segment [" + loadSeg.getGroupId() + "-" + loadSeg.getSerial() + "] failed"); |
| | | } |
| | | |
| | |
| | | placeSeg.setCreateTime(now); |
| | | placeSeg.setUpdateTime(now); |
| | | if (!segmentService.save(placeSeg)) { |
| | | // log.error("Segment [{}] failed to save !!!", placeSeg.getTravelId() + " - " + placeSeg.getSerial()); |
| | | // News.error("Segment [{}] failed to save !!!", placeSeg.getTravelId() + " - " + placeSeg.getSerial()); |
| | | throw new CoolException("failed to save segment [" + placeSeg.getGroupId() + "-" + placeSeg.getSerial() + "] failed"); |
| | | } |
| | | |
| | |
| | | staReserveService.allocateCallBack(task, agvId); |
| | | }); |
| | | // if (Cools.isEmpty(agvNo)) { |
| | | //// log.warn("Task[{}] has an issue, because it failed to check out agv which is idle...", task.getSeqNum()); |
| | | //// News.warn("Task[{}] has an issue, because it failed to check out agv which is idle...", task.getSeqNum()); |
| | | // continue; |
| | | // } |
| | | // task.setAgvId(agvService.getAgvId(agvNo)); |
| | |
| | | // } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("mainService.infuseAgvForTask", e); |
| | | News.error("mainService.infuseAgvForTask", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | |
| | | dropGroups.add(group); |
| | | } else { |
| | | // import tip: the list must only contain ORIGIN and DESTINATION |
| | | log.error("the list must only contain ORIGIN and DESTINATION"); |
| | | News.error("the list must only contain ORIGIN and DESTINATION"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | } catch (Exception e) { |
| | | |
| | | log.error("mainService.buildMajorTask[task]", e); |
| | | News.error("mainService.buildMajorTask[task]", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | } |
| | |
| | | endCode = codeService.getCacheById(funcSta.getCode()); |
| | | } |
| | | if (null == endCode) { |
| | | log.warn("AGV[{}] failed to search destination,there hadn't any idle funSta,TaskTypeType:{}", agvNo, taskType.toString()); |
| | | News.warn("AGV[{}] failed to search destination,there hadn't any idle funSta,TaskTypeType:{}", agvNo, taskType.toString()); |
| | | } |
| | | break; |
| | | case MOVE: |
| | |
| | | destFuncSta.setState(FuncStaStateType.OCCUPIED.toString()); |
| | | destFuncSta.setUpdateTime(now); |
| | | if (!funcStaService.updateById(destFuncSta)) { |
| | | log.error("FuncSta [{}] failed to update !!!", destFuncSta.getName()); |
| | | News.error("FuncSta [{}] failed to update !!!", destFuncSta.getName()); |
| | | } |
| | | break; |
| | | case MOVE: |
| | |
| | | |
| | | return true; |
| | | } catch (Exception e) { |
| | | log.error("mainService.buildMinorTask[task]", e); |
| | | News.error("mainService.buildMinorTask[task]", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | return false; |
| | |
| | | News.info("{}号Agv动作组装完成,指令数量:{}", agvNo, newActionList.size()); |
| | | return pathTrace; |
| | | } catch (Exception e) { |
| | | log.error("mainService.generateAction", e); |
| | | News.error("mainService.generateAction", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | if (!Cools.isEmpty(pathList)) { |
| | |
| | | |
| | | BaseResult<?> result = agvCmdService.executeAgvActionCmd(agvAction); |
| | | if (result.success()) { |
| | | log.info("任务组 [{}] 动作指令已下发 ===>> 指令数量:{}", actionGroupId, actionList.size()); |
| | | News.info("任务组 [{}] 动作指令已下发 ===>> 指令数量:{}", actionGroupId, actionList.size()); |
| | | } else { |
| | | log.error("任务组 [{}] 动作指令下发失败 !!!", actionGroupId); |
| | | News.error("任务组 [{}] 动作指令下发失败 !!!", actionGroupId); |
| | | throw new CoolException("任务组 [{" + actionGroupId + "}] 动作指令下发失败 !!!"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("mainService.publishAction", e); |
| | | News.error("mainService.publishAction", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | } |
| | | |
| | |
| | | |
| | | Agv agv = agvService.selectByUuid(protocol.getAgvNo()); |
| | | if (null == agv) { |
| | | log.warn("Agv [{}] 尚未鉴权 !!!", protocol.getAgvNo()); |
| | | News.warn("Agv [{}] 尚未鉴权 !!!", protocol.getAgvNo()); |
| | | return; |
| | | } |
| | | |
| | |
| | | AGV_11_UP agv_11_up = (AGV_11_UP) msgBody; |
| | | String serialNo = agv_11_up.getSerialNo(); |
| | | |
| | | log.info("Agv [{}] 动作完成包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_11_up)); |
| | | News.info("Agv [{}] 动作完成包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_11_up)); |
| | | |
| | | // 入库放货 |
| | | if (agv_11_up.getCompleteType().equals(AgvCompleteType.RELEASE_FROM_SHELVES_COMPLETE)) { |
| | |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, String.valueOf(Integer.parseInt(agv_11_up.getLocCode())))); |
| | | if (null == loc) { |
| | | log.warn("Agv [{}] 上报往货架放货完成时,库位码[{}]无效。", protocol.getAgvNo(), agv_11_up.getLocCode()); |
| | | News.warn("Agv [{}] 上报往货架放货完成时,库位码[{}]无效。", protocol.getAgvNo(), agv_11_up.getLocCode()); |
| | | } else { |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | | for (Long taskId : taskIds) { |
| | |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | News.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, String.valueOf(Integer.parseInt(agv_11_up.getLocCode())))); |
| | | if (null == loc) { |
| | | log.warn("Agv [{}] 上报从货架取货完成,库位码[{}]无效。", protocol.getAgvNo(), agv_11_up.getLocCode()); |
| | | News.warn("Agv [{}] 上报从货架取货完成,库位码[{}]无效。", protocol.getAgvNo(), agv_11_up.getLocCode()); |
| | | } else { |
| | | |
| | | List<Long> taskIds = actionService.selectTaskIdsByGroupId(serialNo); |
| | |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | News.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | } |
| | | } |
| | | } |
| | |
| | | // settlement |
| | | this.settleSegmentList(segmentList, serialNo); |
| | | |
| | | log.info("Agv [{}] {}作业完毕 ==========>> ", protocol.getAgvNo(), serialNo); |
| | | News.info("Agv [{}] {} 路径作业已完成", protocol.getAgvNo(), serialNo); |
| | | |
| | | } |
| | | } |
| | |
| | | // 取放货请求包 |
| | | if (msgBody instanceof AGV_06_UP) { |
| | | AGV_06_UP agv_06_up = (AGV_06_UP) msgBody; |
| | | log.info("Agv [{}] 取放货请求包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_06_up)); |
| | | News.info("Agv [{}] 取放货请求包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_06_up)); |
| | | |
| | | boolean success = false; |
| | | |
| | |
| | | // query current segment |
| | | Segment currSeg = segmentService.getCurrRunningSeg(null, agv.getId(), code.getId()); |
| | | if (null == currSeg) { |
| | | log.error("failed to find curr segment [{}]", agv.getUuid()); |
| | | News.error("failed to find curr segment [{}]", agv.getUuid()); |
| | | } else { |
| | | |
| | | // query current task |
| | | Task currTask = taskService.getById(currSeg.getTaskId()); |
| | | if (currTask == null || !currTask.getTaskSts().equals(TaskStsType.PROGRESS.val())) { |
| | | |
| | | log.error("agv[{}] task invalid, task={}", protocol.getAgvNo(), currSeg.getTaskId()); |
| | | News.error("agv[{}] task invalid, task={}", protocol.getAgvNo(), currSeg.getTaskId()); |
| | | } else { |
| | | |
| | | Sta sta; |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.OUT); |
| | | break; |
| | | } |
| | | log.info("AGV [{}] load permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | News.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()); |
| | | News.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()); |
| | | News.error("AGV [{}] has wrong posType [{}], segment [{}]", protocol.getAgvNo(), posType.toString(), currSeg.getId()); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | log.error("agv[{}] failed to deal with action request, qrCode={}", agv.getUuid(), agv_06_up.getVal(), e); |
| | | News.error("agv[{}] failed to deal with action request, qrCode={}", agv.getUuid(), agv_06_up.getVal(), e); |
| | | } |
| | | |
| | | AGV_06_DOWN agv_06_down = new AGV_06_DOWN(); |
| | |
| | | if (msgBody instanceof AGV_70_UP) { |
| | | AGV_70_UP agv_70_up = (AGV_70_UP) msgBody; |
| | | |
| | | log.info("Agv [{}] 料仓信息包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_70_up)); |
| | | News.info("Agv [{}] 料仓信息包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_70_up)); |
| | | } |
| | | } |
| | | |
| | |
| | | task.setEndTime(now); |
| | | task.setUpdateTime(now); |
| | | if (!taskService.updateById(task)) { |
| | | log.error("Task [{}] 更新失败 !!!", task.getSeqNum()); |
| | | News.error("Task [{}] 更新失败 !!!", task.getSeqNum()); |
| | | } else { |
| | | taskService.maintainLocAndSta(task); |
| | | log.info("Task [{}] 作业完毕 ==========>> ", task.getSeqNum()); |
| | | News.info("Task [{}] 任务运行完成.", task.getSeqNum()); |
| | | } |
| | | |
| | | } |
| | |
| | | action.setEndTime(now); |
| | | action.setUpdateTime(now); |
| | | if (!actionService.updateById(action)) { |
| | | log.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | News.error("Action [{}] 更新失败 !!!", action.getPriority() + " - " + action.getName()); |
| | | } |
| | | } |
| | | } |
| | |
| | | segment.setEndTime(now); |
| | | segment.setUpdateTime(now); |
| | | if (!segmentService.updateById(segment)) { |
| | | log.error("Segment [{}] 更新失败 !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | News.error("Segment [{}] 更新失败 !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentLinkedQueue; |
| | |
| | | // } |
| | | |
| | | } catch (InterruptedException e) { |
| | | log.error("unlockTaskQueue", e); |
| | | News.error("unlockTaskQueue", e); |
| | | } |
| | | } |
| | | |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | |
| | | if (tasks.size() == 1) { |
| | | resetCodeIdxList = this.getResetCodeList(lev, tasks.get(0)); |
| | | } else if (tasks.size() > 1) { |
| | | // log.info("consumer task count:{}", tasks.size()); |
| | | // News.info("consumer task count:{}", tasks.size()); |
| | | resetCodeIdxList = this.getResetCodeList(lev, tasks); |
| | | } |
| | | |
| | |
| | | this.dealResetCodeList(lev, resetCodeIdxList); |
| | | } |
| | | |
| | | // log.info("consumer unlock path spend time:{}", System.currentTimeMillis() - startTime); |
| | | // News.info("consumer unlock path spend time:{}", System.currentTimeMillis() - startTime); |
| | | } |
| | | |
| | | } catch (InterruptedException e) { |
| | | Thread.currentThread().interrupt(); |
| | | log.error("PathQueueConsumer[Thread.currentThread.interrupt]", e); |
| | | News.error("PathQueueConsumer[Thread.currentThread.interrupt]", e); |
| | | break; |
| | | } catch (Exception e) { |
| | | log.error("PathQueueConsumer", e); |
| | | News.error("PathQueueConsumer", e); |
| | | } |
| | | } |
| | | }); |
| | |
| | | if (!this.consumerExecutor.awaitTermination(5, TimeUnit.SECONDS)) { |
| | | this.consumerExecutor.shutdownNow(); |
| | | if (!this.consumerExecutor.awaitTermination(5, TimeUnit.SECONDS)) { |
| | | log.error("this.consumerExecutor failed to shutdown"); |
| | | News.error("this.consumerExecutor failed to shutdown"); |
| | | } |
| | | } |
| | | } catch (InterruptedException ie) { |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.PreDestroy; |
| | |
| | | } |
| | | break; |
| | | default: |
| | | log.warn("AGV {}: 未知阶段: {}", agvNo, jobType); |
| | | News.warn("AGV {}: 未知阶段: {}", agvNo, jobType); |
| | | break; |
| | | } |
| | | if (Cools.isEmpty(destinationCodeData)) { |
| | |
| | | } |
| | | |
| | | if (mainLockWrapService.buildMinorTask(agvId, TaskTypeType.MOVE, destinationCodeData, null)) { |
| | | log.info( "{}开始作业演示...", agvNo); |
| | | News.info( "{}开始作业演示...", agvNo); |
| | | |
| | | CoreCache.AGV_MOCK_STEP_CACHE.put(agvId, CodeStepDto.build(destinationCodeData, jobType)); |
| | | } |
| | |
| | | return; |
| | | } |
| | | if (mainLockWrapService.buildMinorTask(agvId, TaskTypeType.MOVE, destinationCodeData, null)) { |
| | | log.info( "{}开始走行演示...", agvNo); |
| | | News.info( "{}开启自动巡逻...", agvNo); |
| | | } |
| | | } |
| | | |
| | |
| | | executePatrolLogic(agvNo); |
| | | // executeUShapeConveyor(agvNo); |
| | | } catch (Exception e) { |
| | | log.error("执行AGV{}跑库任务时发生异常", agvNo, e); |
| | | News.error("执行AGV{}跑库任务时发生异常", agvNo, e); |
| | | } |
| | | }; |
| | | |
| | | ScheduledFuture<?> scheduledFuture = scheduler.scheduleAtFixedRate(patrolTask, 0, SCHEDULE_TIME_INTERVAL, TimeUnit.MILLISECONDS); |
| | | |
| | | AGV_PATROL_MAP.put(agvNo, scheduledFuture); |
| | | log.info("已启动AGV{}的跑库任务。", agvNo); |
| | | News.info("已启动AGV{}的跑库任务。", agvNo); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | CoreCache.AGV_BACKPACK_USED_CACHE.remove(agvId); |
| | | CoreCache.AGV_MOCK_STEP_CACHE.remove(agvId); |
| | | CoreCache.AGV_MOCK_JOB_CACHE.remove(agvNo); |
| | | log.info("已停止AGV {} 的跑库任务。", agvNo); |
| | | News.info("已停止AGV {} 的跑库任务。", agvNo); |
| | | return R.ok("已停止AGV " + agvNo + " 的跑库任务。"); |
| | | } else { |
| | | log.error("未能成功停止AGV " + agvNo + " 的跑库任务。"); |
| | | News.error("未能成功停止AGV " + agvNo + " 的跑库任务。"); |
| | | return R.error("未能成功停止AGV " + agvNo + " 的跑库任务。"); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.News; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | // } |
| | | // } |
| | | // if (null == endCode) { |
| | | // log.warn("AGV[{}] failed to search destination,there hadn't any idle funSta,TaskTypeType:{}", segment.getAgvId(), FuncStaType.STANDBY); |
| | | // News.warn("AGV[{}] failed to search destination,there hadn't any idle funSta,TaskTypeType:{}", segment.getAgvId(), FuncStaType.STANDBY); |
| | | // return; |
| | | // } |
| | | // |
| | | // segment.setState(SegmentStateType.INIT.toString()); |
| | | // segment.setUpdateTime(now); |
| | | // if (!segmentService.updateById(segment)) { |
| | | // log.error("Segment [{}] failed to update !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | // News.error("Segment [{}] failed to update !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | // return; |
| | | // } |
| | | // |
| | |
| | | // insertSeg.setState(SegmentStateType.WAITING.toString()); |
| | | // insertSeg.setMemo(MapDataConstant.RESOLVE_DEADLOCK); |
| | | // if (!segmentService.save(insertSeg)) { |
| | | // log.error("Segment [{}] failed to save !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | // News.error("Segment [{}] failed to save !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | // return; |
| | | // } |
| | | // return; |
| | |
| | | if (!Cools.isEmpty(waitingSegList)) { |
| | | for (Segment waitingSeg : waitingSegList) { |
| | | if (!waitingSeg.getId().equals(segment.getId())) { |
| | | // log.error("AGV[{}] 任务异常,服务器错误!!!", agv.getUuid()); |
| | | // News.error("AGV[{}] 任务异常,服务器错误!!!", agv.getUuid()); |
| | | return; |
| | | } |
| | | } |
| | |
| | | |
| | | // * sync wave scope |
| | | if (!avoidWaveCalculator.calcWaveScope(agvModelService.getByAgvId(agv.getId()))) { |
| | | log.error("failed to calculate avoid wave matrix ..."); |
| | | News.error("failed to calculate avoid wave matrix ..."); |
| | | return; |
| | | } |
| | | |
| | |
| | | segment.setState(SegmentStateType.INIT.toString()); |
| | | segment.setUpdateTime(now); |
| | | if (!segmentService.updateById(segment)) { |
| | | log.error("Segment [{}] failed to update !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | News.error("Segment [{}] failed to update !!!", segment.getGroupId() + " - " + segment.getSerial()); |
| | | } |
| | | segmentList.clear(); |
| | | |
| | |
| | | insertSeg.setPosType(TaskPosDto.PosType.MOVE.toString()); |
| | | insertSeg.setState(SegmentStateType.WAITING.toString()); |
| | | if (!segmentService.save(insertSeg)) { |
| | | log.error("Segment [{}] failed to save !!!", insertSeg.getTravelId() + " - " + insertSeg.getSerial()); |
| | | News.error("Segment [{}] failed to save !!!", insertSeg.getTravelId() + " - " + insertSeg.getSerial()); |
| | | } |
| | | segmentList.add(insertSeg); |
| | | |
| | |
| | | mapService.lockPath(null, pathDtoList, agv.getUuid()); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("TrafficService.trigger", e); |
| | | News.error("TrafficService.trigger", e); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | |
| | | throw new RuntimeException("trigger method caught an exception", e); |
| | |
| | | |
| | | boolean hasUnavoidableBlocks = blockVehicleList.stream().anyMatch(blockVehicleDto -> !blockVehicleDto.isAvoidable()); |
| | | if (hasUnavoidableBlocks && pathList.size() <= MapDataConstant.MIN_SLICE_PATH_LENGTH) { |
| | | News.info("AGV[{}] waiting in place, because the path list is too short...", agvNo); |
| | | // News.info("AGV[{}] waiting in place, because the path list is too short...", agvNo); |
| | | pathList.clear(); |
| | | } |
| | | |
| | |
| | | blockVehicleDto -> null != jamService.getCycleJam(agv.getId(), segment.getId(), blockVehicleDto.getVehicle()) |
| | | ); |
| | | if (hasCycleJam) { |
| | | log.info("AGV[{}] waiting in place, because has cycle jam...", agvNo); |
| | | News.info("AGV[{}] waiting in place, because has cycle jam...", agvNo); |
| | | pathList.clear(); |
| | | } |
| | | } |
| | |
| | | } else { |
| | | |
| | | if (Cools.isEmpty(blockVehicleList)) { |
| | | log.warn("AGV[{}] can't reach to code: {}, because there is too many vehicle in the lane...", agvNo, endCode.getData()); |
| | | News.warn("AGV[{}] can't reach to code: {}, because there is too many vehicle in the lane...", agvNo, endCode.getData()); |
| | | } else { |
| | | |
| | | assert !Cools.isEmpty(blockVehicleList); |
| | |
| | | , agvNo, startCode.getData(), endCode.getData(), "路径阻塞超时"); |
| | | } |
| | | } else { |
| | | log.warn("{}号车辆正在等待交通堵塞,阻塞车辆:【{}】" |
| | | , agvNo |
| | | , blockVehicleList.stream().map(BlockVehicleDto::getVehicle).collect(Collectors.toList()).toString() |
| | | ); |
| | | // News.warn("{}号车辆正在等待交通堵塞,阻塞车辆:【{}】" |
| | | // , agvNo |
| | | // , blockVehicleList.stream().map(BlockVehicleDto::getVehicle).collect(Collectors.toList()).toString() |
| | | // ); |
| | | } |
| | | } |
| | | |
| | |
| | | previousJam.setState(JamStateType.DEPRECATED.toString()); |
| | | previousJam.setUpdateTime(now); |
| | | if (!jamService.updateById(previousJam)) { |
| | | log.error("Jam[{}] failed to update!!!", previousJam.getUuid()); |
| | | News.error("Jam[{}] failed to update!!!", previousJam.getUuid()); |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | log.error("Jam[{}] failed to update!!!", jam.getUuid()); |
| | | News.error("Jam[{}] failed to update!!!", jam.getUuid()); |
| | | } |
| | | } |
| | | // deal expired jam |
| | |
| | | expiredJam.setUpdateTime(now); |
| | | expiredJam.setState(JamStateType.DEPRECATED.toString()); |
| | | if (!jamService.updateById(expiredJam)) { |
| | | log.error("Jam[{}] failed to update!!!", expiredJam.getUuid()); |
| | | News.error("Jam[{}] failed to update!!!", expiredJam.getUuid()); |
| | | } |
| | | } |
| | | |
| | |
| | | private boolean notifyVehicleAvoid(String agvNo, String agvPosCode, List<String> avoidPathList, String sponsor, Jam jam) { |
| | | Long agvId = agvService.getAgvId(agvNo); |
| | | if (!Cools.isEmpty(segmentService.getByAgvAndState(agvId, SegmentStateType.RUNNING.toString()))) { |
| | | log.warn("{}号车辆避让失败,存在进行中任务!!!", agvNo); |
| | | News.warn("{}号车辆避让失败,存在进行中任务!!!", agvNo); |
| | | return false; |
| | | } |
| | | |
| | |
| | | assert avoidPathList.size() >= 2; |
| | | RetreatNavigateNode finalNode = retreatNavigateService.execute(agvNo, startNode, avoidPathList, sponsor, jam); |
| | | if (null == finalNode) { |
| | | log.warn("{}号车辆避让失败,检索避让点失败!!!", agvNo); |
| | | News.warn("{}号车辆避让失败,检索避让点失败!!!", agvNo); |
| | | return false; |
| | | } |
| | | |
| | |
| | | if (!Cools.isEmpty(waitingSegList)) { |
| | | |
| | | if (waitingSegList.size() > 1) { |
| | | log.error("避让通知失败,{}号车辆存在多个等待中的Segment!!!", agvNo); |
| | | News.error("避让通知失败,{}号车辆存在多个等待中的Segment!!!", agvNo); |
| | | return false; |
| | | } |
| | | // revert |
| | |
| | | seg.setState(SegmentStateType.INIT.toString()); |
| | | seg.setUpdateTime(now); |
| | | if (!segmentService.updateById(seg)) { |
| | | log.error("Segment [{}] 更新失败 !!!", seg.getTravelId() + " - " + seg.getSerial()); |
| | | News.error("Segment [{}] 更新失败 !!!", seg.getTravelId() + " - " + seg.getSerial()); |
| | | } |
| | | } |
| | | Segment segment = waitingSegList.get(0); |
| | |
| | | insertSeg.setPosType(TaskPosDto.PosType.MOVE.toString()); |
| | | insertSeg.setState(SegmentStateType.WAITING.toString()); |
| | | if (!segmentService.save(insertSeg)) { |
| | | log.error("Segment [{}] 保存失败 !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | News.error("Segment [{}] 保存失败 !!!", segment.getTravelId() + " - " + segment.getSerial()); |
| | | return false; |
| | | } else { |
| | | jam.setAvoSeg(insertSeg.getId()); |
| | |
| | | jam.setStartTime(new Date()); |
| | | jam.setState(JamStateType.RUNNING.toString()); |
| | | if (!jamService.save(jam)) { |
| | | log.error("AGV[{}] failed to save jam", agv.getUuid()); |
| | | News.error("AGV[{}] failed to save jam", agv.getUuid()); |
| | | throw new CoolException("failed to save jam"); |
| | | } |
| | | } else { |
| | | jam.setDuration(System.currentTimeMillis() - jam.getStartTime().getTime()); |
| | | if (!jamService.updateById(jam)) { |
| | | log.error("AGV[{}] failed to update jam", agv.getUuid()); |
| | | News.error("AGV[{}] failed to update jam", agv.getUuid()); |
| | | } |
| | | } |
| | | return jam; |
| | |
| | | originJam.setUpdateTime(new Date()); |
| | | originJam.setState(JamStateType.FINISH.toString()); |
| | | if (!jamService.updateById(originJam)) { |
| | | log.error("Jam[{}] failed to update", originJam.getUuid()); |
| | | News.error("Jam[{}] failed to update", originJam.getUuid()); |
| | | return originJam; |
| | | } else { |
| | | return this.createOrUpdateJam( |
| | |
| | | return false; |
| | | } |
| | | if (jamList.size() > 1) { |
| | | log.error("AvoSeg[id = {}] seg data has exception, result in two jams", avoSeg); |
| | | News.error("AvoSeg[id = {}] seg data has exception, result in two jams", avoSeg); |
| | | } |
| | | Jam jam = jamList.get(0); |
| | | if (jam.getState().equals(JamStateType.DEPRECATED.toString())) { |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.*; |
| | |
| | | } |
| | | |
| | | public synchronized DynamicNode[][] initDynamicMatrix(Integer lev) { |
| | | log.info("There is initializing Dynamic Matrix......"); |
| | | News.info("There is initializing Dynamic Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | |
| | | String[][] codeMatrix = getCodeMatrix(lev); |
| | |
| | | } |
| | | |
| | | public synchronized String[][] initCdaMatrix(Integer lev) { |
| | | log.info("There is initializing Cda Matrix......"); |
| | | News.info("There is initializing Cda Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | |
| | | if (Cools.isEmpty(xIdxList, yIdxList)) { |
| | |
| | | } |
| | | |
| | | public synchronized int[][] initTurnMatrix(Integer lev) { |
| | | log.info("There is initializing Turn Matrix......"); |
| | | News.info("There is initializing Turn Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | |
| | | String[][] codeMatrix = getCodeMatrix(lev); |
| | |
| | | |
| | | |
| | | public synchronized int[][] initMapMatrix(Integer lev) { |
| | | log.info("There is initializing Map Matrix......"); |
| | | News.info("There is initializing Map Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | |
| | | String[][] codeMatrix = getCodeMatrix(lev); |
| | |
| | | } |
| | | |
| | | public synchronized void initRouteMap(Integer lev) { |
| | | log.info("There is initializing Route Map......"); |
| | | News.info("There is initializing Route Map......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | Set<String> routeKeys = redis.getMapKeys(RedisConstant.AGV_MAP_ROUTE_HASH_FLAG); |
| | | Set<String> routeCdaKeys = redis.getMapKeys(RedisConstant.AGV_MAP_ROUTE_CDA_HASH_FLAG); |
| | |
| | | } |
| | | |
| | | public synchronized String[][] initCodeMatrix(Integer lev) { |
| | | log.info("There is initializing Code Matrix......"); |
| | | News.info("There is initializing Code Matrix......"); |
| | | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); |
| | | List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>() |
| | | .eq(Code::getStatus, 1) |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import com.zy.acs.common.utils.News; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.ArrayList; |
| | |
| | | this.floydMatrix = JSON.parseObject(floydMatrixStr, Double[][].class); |
| | | } else { |
| | | |
| | | log.info("【FLOYD】正在计算矩阵数据......"); |
| | | News.info("【FLOYD】正在计算矩阵数据......"); |
| | | List<Code> codeList = codeService.list(new LambdaQueryWrapper<Code>().eq(Code::getStatus, 1).eq(Code::getDeleted, false)); |
| | | |
| | | int size = codeList.size(); |