#
vincentlu
2025-12-31 58d62142408b64ddd597aab2ed06138300b4a571
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java
@@ -91,25 +91,31 @@
        return result;
    }
    public synchronized Agv execute(Task task) {
    public synchronized String execute(Task task, AllocateSupport support) {
        // inbound roller station
        Sta rollerOriSta = getInboundRollerSta(task);
        Agv inboundAgv = tryAllocateForRoller(task, rollerOriSta, true);
        if (inboundAgv != null) {
        String inboundAgv = tryAllocateForRoller(task, rollerOriSta, true);
        if (!Cools.isEmpty(inboundAgv)) {
            return inboundAgv;
        }
        // outbound roller station
        Sta rollerDestSta = getOutboundRollerSta(task);
        Agv outboundAgv = tryAllocateForRoller(task, rollerDestSta, false);
        if (outboundAgv != null) {
        String outboundAgv = tryAllocateForRoller(task, rollerDestSta, false);
        if (!Cools.isEmpty(outboundAgv)) {
            return outboundAgv;
        }
        return this.normalExecute(task);
        String normalAgv = this.normalExecute(task);
        if (!Cools.isEmpty(normalAgv)) {
            support.success(task, normalAgv);
            return normalAgv;
    }
    private Agv tryAllocateForRoller(Task task, Sta rollerSta, boolean inbound) {
        return null;
    }
    private String tryAllocateForRoller(Task task, Sta rollerSta, boolean inbound) {
        if (rollerSta == null) {
            return null;
        }
@@ -135,7 +141,7 @@
            task.setDestLaneHash(filterLaneDto.getDestinationLane().getHashCode());
        }
        return agvService.selectByUuid(agvNo);
        return agvNo;
    }
    /**
@@ -147,7 +153,7 @@
     *
     *      it can break the limit of the number of agv backpack
     */
    public synchronized Agv normalExecute(Task task) {
    public synchronized String normalExecute(Task task) {
        List<String> availableAgvNos = this.getAvailableAgvNos(agvAreaDispatcher.getAgvNosByTask(task), false);
//        List<String> availableAgvNos = this.getAvailableAgvNos(null);
        if (Cools.isEmpty(availableAgvNos)) {
@@ -177,7 +183,7 @@
            task.setDestLaneHash(destinationLane.getHashCode());
        }
        return agvService.selectByUuid(actualAvailableAgvNos.get(0));
        return actualAvailableAgvNos.get(0);
    }
    private String checkoutAgvForInboundRoller(Task task, Sta sta, List<String> availableAgvNos) {
@@ -209,14 +215,14 @@
                    )
            );
            if (taskCnt == 0) {
                break;
                continue;
            }
            // has enough backpack space to load
            Integer backpack = agvService.getBackpack(agvId);
            int countRemainingBackpack = segmentService.countRemainingBackpack(null, agvId);
            if (countRemainingBackpack >= backpack) {
                break;
                continue;
            }
            return agvNo;