#
luxiaotao1123
2024-10-30 d2bdac9da5131cfe34612d491377b0ac544d56bd
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/FuncStaServiceImpl.java
@@ -72,24 +72,27 @@
                return false;
            }
            Agv existAgv = agvService.findByPosition(code);
            Agv agv = agvService.findByPosition(code);
            if (funcSta.getType().equals(FuncStaType.CHARGE.toString())) {
                // if the type of this funSta is charge and the existing agv is in charge status, then that means this funSta is occupied
                if (null != existAgv) {
                    AgvDetail agvDetail = agvDetailService.selectByAgvId(existAgv.getId());
                if (null != agv) {
                    AgvModel agvModel = agvModelService.getById(agv.getAgvModel());
                    AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
                    if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) {
                        AgvModel agvModel = agvModelService.getById(existAgv.getAgvModel());
                        if (agvDetail.getVol() < agvModel.getQuaBattery()) {
                            return false;
                        }
                    } else {
                        Task latestTask = taskService.findLatestTask(existAgv.getId(), null);
                        Task latestTask = taskService.findLatestTask(agv.getId(), null);
                        if (null != latestTask
                                && latestTask.getTaskType().equals(TaskTypeType.TO_CHARGE.val())
                                && latestTask.getDestCode().equals(funcSta.getCode())
                        ) {
                            // avoid the agv already be full battery but there was no task assign to it, so that not in charge status and battery had down
                            if (agvDetailService.isPowerLoss(agv, agvDetail, agvModel)) {
                            return false;
                            }
                        }
                    }
                }
@@ -107,7 +110,7 @@
            if (funcSta.getType().equals(FuncStaType.STANDBY.toString())) {
                if (null == existAgv) {
                if (null == agv) {
                    // if there is a running task whose destination is this funSta, then that means this funSta is occupied
                    if (0 < taskService.count(new LambdaQueryWrapper<Task>()
                            .eq(Task::getTaskType, TaskTypeType.TO_STANDBY.val())