From 590a64af2cdd33427ed8eda2eb983b07dd60ab8b Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期五, 16 一月 2026 12:05:12 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java | 55 +++++++++++++++++++++++++++++--------------------------
1 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java
index b3f75fe..2918e16 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AllocateService.java
@@ -5,7 +5,7 @@
import com.zy.acs.manager.common.utils.CommonUtil;
import com.zy.acs.manager.core.domain.AgvCntDto;
import com.zy.acs.manager.core.domain.FilterLaneDto;
-import com.zy.acs.manager.core.domain.Lane;
+import com.zy.acs.manager.core.domain.LaneDto;
import com.zy.acs.manager.core.domain.TaskPosDto;
import com.zy.acs.manager.manager.entity.*;
import com.zy.acs.manager.manager.enums.*;
@@ -45,7 +45,7 @@
@Autowired
private LocService locService;
@Autowired
- private LaneService laneService;
+ private LaneBuilder laneBuilder;
@Autowired
private AgvAreaDispatcher agvAreaDispatcher;
@Autowired
@@ -135,11 +135,11 @@
}
// record lane hash for later dispatch/traffic-control logic
- if (filterLaneDto.getOriginLane() != null) {
- task.setOriLaneHash(filterLaneDto.getOriginLane().getHashCode());
+ if (filterLaneDto.getOriginLaneDto() != null) {
+ task.setOriLaneHash(filterLaneDto.getOriginLaneDto().getHashCode());
}
- if (filterLaneDto.getDestinationLane() != null) {
- task.setDestLaneHash(filterLaneDto.getDestinationLane().getHashCode());
+ if (filterLaneDto.getDestinationLaneDto() != null) {
+ task.setDestLaneHash(filterLaneDto.getDestinationLaneDto().getHashCode());
}
return agvNo;
@@ -167,21 +167,24 @@
if (null == filterLaneDto) {
return null;
}
- Lane originLane = filterLaneDto.getOriginLane();
- Lane destinationLane = filterLaneDto.getDestinationLane();
+ LaneDto originLaneDto = filterLaneDto.getOriginLaneDto();
+ LaneDto destinationLaneDto = filterLaneDto.getDestinationLaneDto();
List<String> actualAvailableAgvNos = filterLaneDto.getActualAvailableAgvNos();
if (Cools.isEmpty(actualAvailableAgvNos)) {
return null;
}
// choose min number of running task
- actualAvailableAgvNos.sort(Comparator.comparingInt(agvNo -> calcAllocateWeight(agvNo, task)));
+ actualAvailableAgvNos.sort((o1, o2) -> Integer.compare(
+ calcAllocateWeight(o2, task),
+ calcAllocateWeight(o1, task)
+ ));
- if (null != originLane) {
- task.setOriLaneHash(originLane.getHashCode());
+ if (null != originLaneDto) {
+ task.setOriLaneHash(originLaneDto.getHashCode());
}
- if (null != destinationLane) {
- task.setDestLaneHash(destinationLane.getHashCode());
+ if (null != destinationLaneDto) {
+ task.setDestLaneHash(destinationLaneDto.getHashCode());
}
return actualAvailableAgvNos.get(0);
@@ -288,13 +291,13 @@
Integer maxAgvCountInLane = configService.getVal("maxAgvCountInLane", Integer.class);
// checkout lane
- Lane originLane = taskService.checkoutOriginLane(task);
- Lane destinationLane = taskService.checkoutDestinationLane(task);
+ LaneDto originLaneDto = taskService.checkoutOriginLane(task);
+ LaneDto destinationLaneDto = taskService.checkoutDestinationLane(task);
// allocate about origin
List<String> availableAgvNosByOriLane = new ArrayList<>(availableAgvNos);
- if (null != originLane) {
- List<String> agvNosByOriLane = findAgvNosByLane(originLane); // the agv list that had tasks in this lane
+ if (null != originLaneDto) {
+ List<String> agvNosByOriLane = findAgvNosByLane(originLaneDto); // the agv list that had tasks in this lane
// if full lane
if (agvNosByOriLane.size() >= maxAgvCountInLane) {
@@ -307,8 +310,8 @@
// allocate about destination
List<String> availableAgvNosByDestLane = new ArrayList<>(availableAgvNos);
- if (null != destinationLane) {
- List<String> agvNosByDestLane = findAgvNosByLane(destinationLane);
+ if (null != destinationLaneDto) {
+ List<String> agvNosByDestLane = findAgvNosByLane(destinationLaneDto);
if (agvNosByDestLane.size() >= maxAgvCountInLane) {
availableAgvNosByDestLane = Cools.getIntersection(agvNosByDestLane, availableAgvNos);
@@ -331,14 +334,14 @@
return null;
}
- return new FilterLaneDto(originLane, destinationLane, actualAvailableAgvNos);
+ return new FilterLaneDto(originLaneDto, destinationLaneDto, actualAvailableAgvNos);
}
- public List<String> findAgvNosByLane(Lane lane) {
- if (null == lane) {
+ public List<String> findAgvNosByLane(LaneDto laneDto) {
+ if (null == laneDto) {
return new ArrayList<>();
}
- List<Task> taskList = taskService.findRunningTasksByLaneHash(lane.getHashCode());
+ List<Task> taskList = taskService.findRunningTasksByLaneHash(laneDto.getHashCode());
if (Cools.isEmpty(taskList)) {
return new ArrayList<>();
}
@@ -409,11 +412,11 @@
}
public Boolean validCapacityOfLane(String agvNo, Code code) {
- Lane lane = laneService.search(code.getData());
- if (null != lane) {
+ LaneDto laneDto = laneBuilder.search(code.getData());
+ if (null != laneDto) {
Integer maxAgvCountInLane = configService.getVal("maxAgvCountInLane", Integer.class);
- List<String> agvNosByLane = this.findAgvNosByLane(lane);
+ List<String> agvNosByLane = this.findAgvNosByLane(laneDto);
agvNosByLane.remove(agvNo);
if (agvNosByLane.size() >= maxAgvCountInLane) {
return false;
--
Gitblit v1.9.1