#
vincentlu
2025-12-26 ccbf73034e8a7c5867d3b58e115013527283ee76
zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
@@ -13,6 +13,7 @@
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.core.service.*;
import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
import com.zy.acs.manager.core.service.astart.domain.DynamicNode;
import com.zy.acs.manager.manager.entity.*;
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.service.*;
@@ -72,6 +73,8 @@
    private AvoidWaveCalculator avoidWaveCalculator;
    @Autowired
    private PatrolService patrolService;
    @Autowired
    private StaReserveService staReserveService;
    @PreAuthorize("hasAuthority('manager:agv:update')")
    @OperationLog("Locate All Agv")
@@ -87,10 +90,27 @@
    @PostMapping("/patrol/batch/startup")
    public synchronized R patrolBatchStartup() {
        List<Agv> list = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val));
        DynamicNode[][] dynamicMatrix = mapDataDispatcher.getDynamicMatrix(MapDataDispatcher.MAP_DEFAULT_LEV);
        int result = 0;
        for (Agv agv : list) {
            patrolService.startupPatrol(agv.getUuid());
            result++;
            String agvNo = agv.getUuid();
            boolean inMap = false;
            label: for (int i = 0; i < dynamicMatrix.length; i++) {
                for (int j = 0; j < dynamicMatrix[i].length; j++) {
                    DynamicNode dynamicNode = dynamicMatrix[i][j];
                    String vehicle = dynamicNode.getVehicle();
                    if (agvNo.equals(vehicle)) {
                        inMap = true;
                        break label;
                    }
                }
            }
            if (inMap) {
                patrolService.startupPatrol(agvNo);
                result++;
            }
        }
        return R.ok().add(result);
    }
@@ -173,7 +193,7 @@
                    oriLoc = locService.getById(param.getStartLocNo());
                }
                if (!Cools.isEmpty(param.getStartLocNoStr())) {
                    oriLoc = locService.selecatByLocNo(param.getStartLocNoStr());
                    oriLoc = locService.selectByLocNo(param.getStartLocNoStr());
                }
                if (null == oriLoc) {
                    return R.error();
@@ -192,7 +212,7 @@
                    destLoc = locService.getById(param.getEndLocNo());
                }
                if (!Cools.isEmpty(param.getEndLocNoStr())) {
                    destLoc = locService.selecatByLocNo(param.getEndLocNoStr());
                    destLoc = locService.selectByLocNo(param.getEndLocNoStr());
                }
                if (null == destLoc) {
                    return R.error();
@@ -220,7 +240,7 @@
                    oriLoc = locService.getById(param.getStartLocNo());
                }
                if (!Cools.isEmpty(param.getStartLocNoStr())) {
                    oriLoc = locService.selecatByLocNo(param.getStartLocNoStr());
                    oriLoc = locService.selectByLocNo(param.getStartLocNoStr());
                }
                if (null == oriLoc) {
                    return R.error();
@@ -244,13 +264,8 @@
                if (null == destSta) {
                    return R.error();
                }
                if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 不是无货状态");
                }
                destSta.setStaSts(StaStsType.READY_RELEASE.val());
                destSta.setUpdateTime(now);
                if (!staService.updateById(destSta)) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 修改站点状态失败");
                if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败");
                }
                // task
@@ -272,13 +287,8 @@
                if (null == oriSta) {
                    return R.error();
                }
                if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 不是有货状态");
                }
                oriSta.setStaSts(StaStsType.READY_TAKE.val());
                oriSta.setUpdateTime(now);
                if (!staService.updateById(oriSta)) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 修改站点状态失败");
                if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败");
                }
                // destLoc
@@ -286,7 +296,7 @@
                    destLoc = locService.getById(param.getEndLocNo());
                }
                if (!Cools.isEmpty(param.getEndLocNoStr())) {
                    destLoc = locService.selecatByLocNo(param.getEndLocNoStr());
                    destLoc = locService.selectByLocNo(param.getEndLocNoStr());
                }
                if (null == destLoc) {
                    return R.error();
@@ -319,13 +329,8 @@
                if (null == oriSta) {
                    return R.error();
                }
                if (!oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 不是有货状态");
                }
                oriSta.setStaSts(StaStsType.READY_TAKE.val());
                oriSta.setUpdateTime(now);
                if (!staService.updateById(oriSta)) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 修改站点状态失败");
                if (null == staReserveService.reserveStaOut(oriSta, task, 1)) {
                    throw new BusinessException("oriSta:" + oriSta.getStaNo() + " 预约失败");
                }
                // destSta
@@ -338,13 +343,8 @@
                if (null == destSta) {
                    return R.error();
                }
                if (!destSta.getStaSts().equals(StaStsType.IDLE.val())) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 不是无货状态");
                }
                destSta.setStaSts(StaStsType.READY_RELEASE.val());
                destSta.setUpdateTime(now);
                if (!staService.updateById(destSta)) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 修改站点状态失败");
                if (null == staReserveService.reserveStaIn(destSta, task, 1)) {
                    throw new BusinessException("destSta:" + destSta.getStaNo() + " 预约失败");
                }
                // task