From 819bef1aeacf77eaaac809f87971db1056d18ee5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 14 十一月 2024 13:57:55 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 51 +++++++++++++--------------------------------------
1 files changed, 13 insertions(+), 38 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
index ca8080e..4fcedee 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -15,7 +15,6 @@
import com.zy.acs.common.enums.AgvCompleteType;
import com.zy.acs.common.enums.AgvDirectionType;
import com.zy.acs.common.enums.AgvSpeedType;
-import com.zy.acs.common.utils.RedisSupport;
import com.zy.acs.common.utils.Utils;
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.SnowflakeIdWorker;
@@ -25,6 +24,7 @@
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.common.utils.CommonUtil;
import com.zy.acs.manager.core.domain.AgvBackpackDto;
+import com.zy.acs.manager.core.domain.Lane;
import com.zy.acs.manager.core.domain.TaskPosDto;
import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam;
@@ -41,7 +41,6 @@
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
-import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
/**
@@ -50,10 +49,6 @@
@Slf4j
@Component("mainService")
public class MainService {
-
- private final RedisSupport redis = RedisSupport.defaultRedisSupport;
- private static final int LOCK_TIMEOUT = 5;
- private final ReentrantLock lock = new ReentrantLock(Boolean.TRUE);
@Autowired
private BusService busService;
@@ -97,6 +92,8 @@
private TrafficService trafficService;
@Autowired
private AgvModelService agvModelService;
+ @Autowired
+ private LaneService laneService;
@SuppressWarnings("all")
@@ -235,35 +232,6 @@
throw new BusinessException("seqNum: " + task.getSeqNum() + " failed to update");
}
}
-
-
- // ------------------------------------------
-
-
-//
-// 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();
@@ -560,6 +528,9 @@
if (null == endCode) {
return false;
}
+ if (!allocateService.validCapacityOfLane(agv, endCode)) {
+ throw new BusinessException("the lane with code:" + endCode.getData() + " is full of AGV[" + agv.getUuid() + "]!!!");
+ }
Task task = new Task();
task.setAgvId(agv.getId());
@@ -568,6 +539,11 @@
task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum()));
task.setOriCode(agvDetail.getCode());
task.setDestCode(endCode.getId());
+ // lane
+ Lane destLane = laneService.search(endCode.getData());
+ if (null != destLane) {
+ task.setDestLaneHash(destLane.getHashCode());
+ }
task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE)?2:1);
task.setTaskSts(TaskStsType.ASSIGN.val());
task.setTaskType(taskType.val());
@@ -684,13 +660,12 @@
List<Action> actionList = new ArrayList<>();
// start node
Code lastCode = codeService.getById(agvDetail.getRecentCode());
+ Double lastDirection = agvDetail.getAgvAngle();
if (!lastCode.getData().equals(pathList.get(0))) {
throw new CoolException("AGV[" + agv.getUuid() + "]瀹氫綅鍋忕Щ...");
}
- Double lastDirection = agvDetail.getAgvAngle();
boolean first = true;
-
for (Segment segment : segmentList) {
// 鍒嗘鎵�灞炵殑Task
@@ -922,7 +897,7 @@
break;
case TO_CHARGE:
// 妫�楠屾柟鍚�
- FuncSta chargeFuncSta = funcStaService.query(agvId, lastCode.getId(), FuncStaType.CHARGE.toString());
+ FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString());
Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle());
if (!lastDirection.equals(chargeDirection)) {
actionList.add(new Action(
--
Gitblit v1.9.1