From b22c773435474fcdaea05c6239d9cc94bbfd499c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期三, 04 二月 2026 13:56:31 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java | 75 ++++++++++++++++++++++---------------
1 files changed, 44 insertions(+), 31 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
index ce8ef78..2e52cda 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java
@@ -9,6 +9,7 @@
import com.zy.acs.framework.common.R;
import com.zy.acs.framework.common.SnowflakeIdWorker;
import com.zy.acs.manager.common.annotation.OperationLog;
+import com.zy.acs.manager.common.config.UplinkProperties;
import com.zy.acs.manager.common.domain.param.HandlerPublishParam;
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.core.service.*;
@@ -18,6 +19,7 @@
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.service.*;
import com.zy.acs.manager.system.controller.BaseController;
+import com.zy.acs.manager.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@@ -64,7 +66,7 @@
@Autowired
private StaService staService;
@Autowired
- private TrafficService trafficService;
+ private UplinkProperties uplinkProperties;
@Autowired
private ThreadPoolRegulator threadPoolRegulator;
@Autowired
@@ -77,6 +79,8 @@
private StaReserveService staReserveService;
@Autowired
private AgvAreaDispatcher agvAreaDispatcher;
+ @Autowired
+ private ConfigService configService;
@PreAuthorize("hasAuthority('manager:agv:update')")
@OperationLog("Locate All Agv")
@@ -140,6 +144,7 @@
return R.error();
}
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
Date now = new Date();
Agv agv = agvService.selectByUuid(param.getAgvNo());
AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId());
@@ -164,13 +169,13 @@
Task task = new Task();
task.setAgvId(agv.getId());
task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
- List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId));
+// List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId));
// task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum()));
task.setSeqNum(Base62.encode(snowflakeIdWorker.nextId()));
task.setTaskType(param.getTaskMode().val());
task.setTaskSts(TaskStsType.WAITING.val());
-
+ task.setUplinkSts(uplinkProperties.getEnabled() ? TaskUplinkStateType.PENDING.toString() : TaskUplinkStateType.SKIPPED.toString());
task.setPriority(999);
task.setIoTime(now);
task.setStartTime(now);
@@ -232,13 +237,15 @@
// throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$());
throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬪簱浣嶃��" + oriLoc.getLocNo() + "銆�");
}
- if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
- throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
- }
- oriLoc.setLocSts(LocStsType.PAKOUT.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ if (maintainLocSts) {
+ if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+ throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
+ }
+ oriLoc.setLocSts(LocStsType.PAKOUT.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ }
}
// destLoc
@@ -255,13 +262,15 @@
// throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$());
throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囧簱浣嶃��" + destLoc.getLocNo() + "銆�");
}
- if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
- throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
- }
- destLoc.setLocSts(LocStsType.PAKIN.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ if (maintainLocSts) {
+ if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+ throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
+ }
+ destLoc.setLocSts(LocStsType.PAKIN.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ }
}
// task
@@ -285,13 +294,15 @@
// throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + oriLoc.getCode$());
throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈捐捣濮嬪簱浣嶃��" + oriLoc.getLocNo() + "銆�");
}
- if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
- throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
- }
- oriLoc.setLocSts(LocStsType.PAKOUT.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ if (maintainLocSts) {
+ if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+ throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 涓嶆槸鍦ㄥ簱鐘舵��");
+ }
+ oriLoc.setLocSts(LocStsType.PAKOUT.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ }
}
// destSta
@@ -352,13 +363,15 @@
// throw new BusinessException("AGV " + agv.getUuid() + " failed to reach target code " + destLoc.getCode$());
throw new BusinessException("AGV銆�" + agv.getUuid() + "銆戞棤娉曞埌杈剧洰鏍囧簱浣嶃��" + destLoc.getLocNo() + "銆�");
}
- if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
- throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
- }
- destLoc.setLocSts(LocStsType.PAKIN.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ if (maintainLocSts) {
+ if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+ throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 涓嶆槸绌洪棽鐘舵��");
+ }
+ destLoc.setLocSts(LocStsType.PAKIN.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("destLoc锛�" + destLoc.getLocNo() + " 淇敼搴撲綅鐘舵�佸け璐�");
+ }
}
// task
--
Gitblit v1.9.1