version/logical-line.xmindBinary files differ
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/KernelScheduler.java
@@ -58,7 +58,7 @@ if (!this.lock.tryLock(LOCK_TIMEOUT, TimeUnit.SECONDS)) { return; } List<Bus> busList = busService.selectBySts(BusStsType.RECEIVE); for (Bus bus : busList) { mainService.infuseAgvForTask(bus); mainService.allocateTask(bus); } this.lock.unlock(); } zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -194,7 +194,7 @@ * 任务分配给车辆 ( 车辆此时是空闲且静止的 ) */ @Transactional public synchronized void infuseAgvForTask(Bus bus) { public synchronized void allocateTask(Bus bus) { try { Date now = new Date(); List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>() @@ -212,6 +212,7 @@ return; } List<Long> taskIds = taskList.stream().map(Task::getId).distinct().collect(Collectors.toList()); for (Task task : taskList) { Agv agv = missionAssignService.execute(task); if (null == agv) { @@ -230,31 +231,31 @@ // ------------------------------------------ List<Long> taskIds = taskList.stream().map(Task::getId).distinct().collect(Collectors.toList()); Map<String, List<Long>> taskAllot = new HashMap<>(); for (Task task : taskList) { Agv agv = missionAssignService.execute(task, taskAllot, taskIds); if (null == agv) { log.warn("Task[{}] has an issue, because it failed to checkout agv which is idle...", task.getSeqNum()); continue; } task.setAgvId(agv.getId()); task.setTaskSts(TaskStsType.WAITING.val()); task.setIoTime(now); task.setUpdateTime(now); if (!taskService.updateById(task)) { throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update"); } if (taskAllot.containsKey(agv.getUuid())) { taskAllot.get(agv.getUuid()).add(task.getId()); } else { taskAllot.put(agv.getUuid(), Utils.singletonList(task.getId())); } } // // Map<String, List<Long>> taskAllot = new HashMap<>(); // for (Task task : taskList) { // Agv agv = missionAssignService.execute(task, taskAllot, taskIds); // if (null == agv) { // log.warn("Task[{}] has an issue, because it failed to checkout agv which is idle...", task.getSeqNum()); // continue; // } // // // task.setAgvId(agv.getId()); // task.setTaskSts(TaskStsType.WAITING.val()); // task.setIoTime(now); // task.setUpdateTime(now); // if (!taskService.updateById(task)) { // throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update"); // } // // if (taskAllot.containsKey(agv.getUuid())) { // taskAllot.get(agv.getUuid()).add(task.getId()); // } else { // taskAllot.put(agv.getUuid(), Utils.singletonList(task.getId())); // } // } } catch (Exception e) { log.error("mainService.infuseAgvForTask", e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); @@ -275,7 +276,7 @@ // valid ----------------------------------------------- Agv agv = agvService.getById(agvId); if (!agvService.judgeEnable(agv.getId(), agvDetail -> agvDetail.getVol() > agv.getChargeLine())) { if (!agvService.judgeEnable(agv.getId(), true)) { throw new CoolException("AGV[" + agv.getUuid() + "]当前不可用..."); } if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MissionAssignService.java
@@ -59,8 +59,7 @@ } // 2. in idle status final Agv finalAgv = agv; if (!agvService.judgeEnable(finalAgv.getId(), agvDetail -> agvDetail.getVol() > finalAgv.getChargeLine())) { if (!agvService.judgeEnable(agv.getId(), true)) { continue; } @@ -75,6 +74,7 @@ if (Cools.isEmpty(availableAgvList)) { return null; } return null; } @@ -110,9 +110,8 @@ log.info(agv.getUuid() + "号AGV不可用,已经存在进行中的任务..."); continue; } final Agv finalAgv = agv; if (!agvService.judgeEnable(finalAgv.getId(), agvDetail -> agvDetail.getVol() > finalAgv.getChargeLine())) { log.info(finalAgv.getUuid() + "号AGV不可用," + task.getSeqNum() + "任务无法计算..."); if (!agvService.judgeEnable(agv.getId(), true)) { log.info(agv.getUuid() + "号AGV不可用," + task.getSeqNum() + "任务无法计算..."); continue; } @@ -157,9 +156,8 @@ log.info(agv.getUuid() + "号AGV不可用,已经存在进行中的任务..."); return null; } final Agv finalAgv = agv; if (!agvService.judgeEnable(finalAgv.getId(), agvDetail -> agvDetail.getVol() > finalAgv.getChargeLine())) { log.info(finalAgv.getUuid() + "号AGV不可用," + task.getSeqNum() + "任务无法计算..."); if (!agvService.judgeEnable(agv.getId(), true)) { log.info(agv.getUuid() + "号AGV不可用," + task.getSeqNum() + "任务无法计算..."); return null; } zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/AgvService.java
@@ -1,14 +1,12 @@ package com.zy.acs.manager.manager.service; import com.baomidou.mybatisplus.extension.service.IService; import com.zy.acs.common.utils.JudgeSupport; import com.zy.acs.manager.common.domain.BaseParam; import com.zy.acs.manager.common.domain.PageParam; import com.zy.acs.manager.common.domain.PageResult; import com.zy.acs.manager.core.domain.VehicleDto; import com.zy.acs.manager.manager.controller.result.AgvResult; import com.zy.acs.manager.manager.entity.Agv; import com.zy.acs.manager.manager.entity.AgvDetail; import com.zy.acs.manager.manager.entity.Task; import java.util.List; @@ -29,7 +27,7 @@ Boolean judgeEnable(Long agvId); Boolean judgeEnable(Long agvId, JudgeSupport<AgvDetail> support); Boolean judgeEnable(Long agvId, Boolean withBattery); Boolean judgeOnline(Long agvId); zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/AgvServiceImpl.java
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zy.acs.common.constant.RedisConstant; import com.zy.acs.common.enums.AgvStatusType; import com.zy.acs.common.utils.JudgeSupport; import com.zy.acs.common.utils.RedisSupport; import com.zy.acs.framework.common.Cools; import com.zy.acs.manager.common.domain.BaseParam; @@ -67,11 +66,11 @@ @Override public Boolean judgeEnable(Long agvId) { return this.judgeEnable(agvId, null); return this.judgeEnable(agvId, false); } @Override public Boolean judgeEnable(Long agvId, JudgeSupport<AgvDetail> support) { public Boolean judgeEnable(Long agvId, Boolean withBattery) { Agv agv = this.getById(agvId); AgvModel agvModel = agvModelService.getById(agv.getAgvModel()); if (segmentService.count(new LambdaQueryWrapper<Segment>() @@ -105,17 +104,24 @@ return false; } } if (support != null) { if (!support.execute(agvDetail)) { return false; } } if (!agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { if (agvDetail.getPos() != 1) { log.warn("[{}]号Agv当前不在定位......", agv.getUuid()); return false; } } // with battery if (withBattery) { if (agvDetail.getVol() < agv.getChargeLine()) { log.warn("[{}]号Agv电量不足......", agv.getUuid()); return false; } if (agvDetail.getVol() < agvModel.getLowBattery()) { log.warn("[{}]号Agv电量不足......", agv.getUuid()); return false; } } return true; }