From bd4b7199d724280cd6536dc71d4afee263031464 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期三, 04 二月 2026 10:14:01 +0800
Subject: [PATCH] #
---
/dev/null | 153 -------------------
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 73 +++++----
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java | 2
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java | 22 ++
zy-acs-manager/src/main/resources/application.yml | 6
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java | 1
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java | 5
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java | 109 +++++++-----
zy-acs-manager/src/main/java/com/zy/acs/manager/core/HandlerController.java | 68 +++++---
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java | 2
zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java | 6
11 files changed, 183 insertions(+), 264 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 56079cf..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
@@ -19,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;
@@ -78,6 +79,8 @@
private StaReserveService staReserveService;
@Autowired
private AgvAreaDispatcher agvAreaDispatcher;
+ @Autowired
+ private ConfigService configService;
@PreAuthorize("hasAuthority('manager:agv:update')")
@OperationLog("Locate All Agv")
@@ -141,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());
@@ -233,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
@@ -256,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
@@ -286,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
@@ -353,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
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java
index de1dc52..2832d5b 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/MaintainScheduler.java
@@ -158,6 +158,7 @@
List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>()
.in(Task::getUplinkSts, TaskUplinkStateType.PENDING.toString(), TaskUplinkStateType.FAILED.toString())
.eq(Task::getTaskSts, TaskStsType.COMPLETE.val())
+ .isNotNull(Task::getBusId)
);
if (Cools.isEmpty(taskList)) { return; }
for (Task task : taskList) {
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java
index bff4260..9b79571 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunRebootScheduler.java
@@ -61,6 +61,12 @@
// @Scheduled(cron = "0/1 * * * * ? ")
private void execute() {
if (!configService.getVal("TaskAssignRebootMode", Boolean.class)) { return; }
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
+ if (!maintainLocSts) {
+ log.error("failed to run auto agv task, the maintainLocSts is false");
+ return;
+ }
+
AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString()));
if (null == agvModel) { return; }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java
index b19a9e6..f0ca5e6 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoRunScheduler.java
@@ -54,6 +54,11 @@
// @Scheduled(cron = "0/1 * * * * ? ")
private void execute() {
if (!configService.getVal("TaskAssignMode", Boolean.class)) { return; }
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
+ if (!maintainLocSts) {
+ log.error("failed to run auto agv task, the maintainLocSts is false");
+ return;
+ }
AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString()));
if (null == agvModel) { return; }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoTestDeviationScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoTestDeviationScheduler.java
deleted file mode 100644
index 7662c22..0000000
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/AutoTestDeviationScheduler.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.zy.acs.manager.core.scheduler.test;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zy.acs.common.constant.RedisConstant;
-import com.zy.acs.common.utils.RedisSupport;
-import com.zy.acs.framework.common.Cools;
-import com.zy.acs.framework.common.SnowflakeIdWorker;
-import com.zy.acs.manager.common.domain.TaskDto;
-import com.zy.acs.manager.core.integrate.dto.OpenBusSubmitParam;
-import com.zy.acs.manager.core.service.AreaGovernService;
-import com.zy.acs.manager.core.service.MainService;
-import com.zy.acs.manager.manager.entity.Agv;
-import com.zy.acs.manager.manager.entity.AgvModel;
-import com.zy.acs.manager.manager.entity.Bus;
-import com.zy.acs.manager.manager.entity.Loc;
-import com.zy.acs.manager.manager.enums.AgvModelType;
-import com.zy.acs.manager.manager.enums.BusStsType;
-import com.zy.acs.manager.manager.enums.LocStsType;
-import com.zy.acs.manager.manager.enums.StatusType;
-import com.zy.acs.manager.manager.service.*;
-import com.zy.acs.manager.manager.service.impl.CodeServiceImpl;
-import com.zy.acs.manager.system.service.ConfigService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-@Slf4j
-@Component
-public class AutoTestDeviationScheduler {
-
- private static final AgvModelType DEFAULT_AGV_MODEL = AgvModelType.HEAVY_LOAD_STACKING_ROBOT;
-
- private final RedisSupport redis = RedisSupport.defaultRedisSupport;
-
- @Autowired
- private AgvService agvService;
- @Autowired
- private BusService busService;
- @Autowired
- private MainService mainService;
- @Autowired
- private ConfigService configService;
- @Autowired
- private LocService locService;
- @Autowired
- private StaService staService;
- @Autowired
- private AgvModelService agvModelService;
- @Autowired
- private SnowflakeIdWorker snowflakeIdWorker;
- @Autowired
- private AreaGovernService areaGovernService;
- @Autowired
- private CodeServiceImpl codeService;
-
- /**
- * 寰幆璺戝簱锛屾祴璇曞亸宸�
- */
- // @Scheduled(fixedRate = 500) // 鍥哄畾棰戠巼鎵ц锛屼笉鍚屾
- //@Scheduled(fixedDelay = 1000) // 鍥哄畾棰戠巼鎵ц锛屽悓姝�
-// @Scheduled(cron = "0/1 * * * * ? ")
- private void execute() {
- if (!configService.getVal("TestDeviationMode", Boolean.class)) { return; }
- AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString()));
- if (null == agvModel) { return; }
-
- this.autoRun(agvModel);
- }
-
- private void autoRun(AgvModel agvModel) {
- int availableAgvCount = this.getAvailableAgvCount();
- if (0 == availableAgvCount) { return; }
-
-// List<String> staPreNos = getStaPrefixes(staGroupList);
- List<String> staPreNos = new ArrayList<>();
- String memo = "DEMO_STA_" + String.join("-", staPreNos);
-
- // 绉诲簱
- this.runLocToLoc(agvModel, memo);
- }
-
-
- // 绉诲簱
- private void runLocToLoc(AgvModel agvModel, String staTaskMemo) {
- String memo = "DEMO_LOC";
-
- int availableAgvCount = this.getAvailableAgvCount();
-
- // 鏈�澶� ? 缁刡us杩愯
- if (availableAgvCount <= busService.count(new LambdaQueryWrapper<Bus>()
- .in(Bus::getBusSts, BusStsType.RECEIVE.val(), BusStsType.PROGRESS.val())
- .in(Bus::getMemo, memo, staTaskMemo)
- )) { return; }
-
- int maxCapacity = agvModel.getBackpack();
-
- // STOCK
- List<Loc> stockLocList = locService.selectRandByLocSts(LocStsType.STOCK.val(), maxCapacity);
- if (Cools.isEmpty(stockLocList)) {
- return;
- }
- Collections.shuffle(stockLocList);
-
- // IDLE
- List<Loc> idleLocList = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getStatus,1).eq(Loc::getLocSts,LocStsType.IDLE.val()).ne(Loc::getMemo,"1").orderByAsc(Loc::getRow).orderByAsc(Loc::getBay).orderByAsc(Loc::getLev));
- if (Cools.isEmpty(idleLocList)) {
- return;
- }
-
- OpenBusSubmitParam param = new OpenBusSubmitParam();
- param.setBatchNo(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19));
- for (int i = 0; i < Math.min(maxCapacity, Math.min(stockLocList.size(), idleLocList.size())); i++) {
- Loc stockLoc = stockLocList.get(i);
- Loc idleLoc = idleLocList.get(i);
- idleLoc.setMemo("1");
- locService.updateById(idleLoc);
- TaskDto taskDto = new TaskDto();
- taskDto.setOriLoc(stockLoc.getLocNo());
- taskDto.setDestLoc(idleLoc.getLocNo());
- taskDto.setTaskNo(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19));
-
- param.getTasks().add(taskDto);
- }
- if (Cools.isEmpty(param.getTasks())) { return; }
-
- mainService.generateBusAndTask(param, memo);
- }
-
-
- private int getAvailableAgvCount() {
- int res = 0;
- List<Agv> agvList = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val));
- if (Cools.isEmpty(agvList)) {
- return res;
- }
- for (Agv agv : agvList) {
- if (null == redis.getObject(RedisConstant.AGV_ONLINE_FLAG, agv.getUuid())) {
- continue;
- }
- if (!agv.getStatusBool()) {
- continue;
- }
- res++;
- }
-
- return res;
- }
-
-}
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java
index acf95e2..c3b795d 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/scheduler/test/ConveyorAutoRunScheduler.java
@@ -25,7 +25,7 @@
import java.util.*;
@Slf4j
-@Component
+//@Component
public class ConveyorAutoRunScheduler {
private static final AgvModelType DEFAULT_AGV_MODEL = AgvModelType.CTU_BOX_TRANSPORT_AGV;
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 48267c9..230d0e6 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
@@ -104,6 +104,7 @@
@Transactional
public Bus generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) {
String errorMsg = busService.checkoutValid(busSubmitParam);
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
if (!Cools.isEmpty(errorMsg)) {
throw new BusinessException(errorMsg);
}
@@ -147,35 +148,39 @@
Sta destSta = null;
switch (TaskTypeType.get(task.getTaskTypeEl())) {
case LOC_TO_LOC:
- oriLoc = locService.getById(task.getOriLoc());
- if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
- throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
- }
- oriLoc.setLocSts(LocStsType.PAKOUT.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
- }
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+ throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
+ }
+ oriLoc.setLocSts(LocStsType.PAKOUT.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+ }
- destLoc = locService.getById(task.getDestLoc());
- if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
- throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
- }
- destLoc.setLocSts(LocStsType.PAKIN.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+ destLoc = locService.getById(task.getDestLoc());
+ if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+ throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
+ }
+ destLoc.setLocSts(LocStsType.PAKIN.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+ }
}
break;
case LOC_TO_STA:
- oriLoc = locService.getById(task.getOriLoc());
- if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
- throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
- }
- oriLoc.setLocSts(LocStsType.PAKOUT.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+ throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
+ }
+ oriLoc.setLocSts(LocStsType.PAKOUT.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+ }
}
destSta = staService.getById(task.getDestSta());
@@ -189,14 +194,16 @@
throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to reserve");
}
- destLoc = locService.getById(task.getDestLoc());
- if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
- throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
- }
- destLoc.setLocSts(LocStsType.PAKIN.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+ if (maintainLocSts) {
+ destLoc = locService.getById(task.getDestLoc());
+ if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+ throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
+ }
+ destLoc.setLocSts(LocStsType.PAKIN.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+ }
}
break;
case STA_TO_STA:
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java
index 8f768cd..e14cb23 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/IntegrationRecordService.java
@@ -5,4 +5,6 @@
public interface IntegrationRecordService extends IService<IntegrationRecord> {
+ Boolean syncRecord(IntegrationRecord record);
+
}
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java
index ca07aad..fc6cdc3 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/IntegrationRecordServiceImpl.java
@@ -1,12 +1,34 @@
package com.zy.acs.manager.manager.service.impl;
+import com.zy.acs.framework.common.R;
+import com.zy.acs.manager.core.service.ThreadPoolRegulator;
import com.zy.acs.manager.manager.mapper.IntegrationRecordMapper;
import com.zy.acs.manager.manager.entity.IntegrationRecord;
import com.zy.acs.manager.manager.service.IntegrationRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+
+import java.util.concurrent.CompletableFuture;
@Service("integrationRecordService")
public class IntegrationRecordServiceImpl extends ServiceImpl<IntegrationRecordMapper, IntegrationRecord> implements IntegrationRecordService {
+ @Autowired
+ private ThreadPoolRegulator threadPoolRegulator;
+
+ @Override
+ public Boolean syncRecord(IntegrationRecord record) {
+ CompletableFuture<?> completableFuture = CompletableFuture.supplyAsync(() -> {
+
+
+
+// mapDataDispatcher.modifyDynamicMatrix(null, null, param.getAgvNo(), true);
+// avoidWaveCalculator.calcDynamicNodeByVehicle(agv, null);
+ return R.ok();
+ }, threadPoolRegulator.getInstance());
+
+ return false;
+ }
+
}
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
index 5c78488..2613bdb 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
@@ -17,6 +17,7 @@
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.mapper.TaskMapper;
import com.zy.acs.manager.manager.service.*;
+import com.zy.acs.manager.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -50,6 +51,8 @@
private ActionService actionService;
@Autowired
private TravelService travelService;
+ @Autowired
+ private ConfigService configService;
@Override
public PageResult<Task> pageRel(PageParam<Task, BaseParam> pageParam) {
@@ -288,6 +291,7 @@
if (!task.getTaskSts().equals(TaskStsType.COMPLETE.val())) {
return;
}
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
Date now = new Date();
// loc status
Loc oriLoc = null;
@@ -296,31 +300,35 @@
Sta destSta = null;
switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) {
case LOC_TO_LOC:
- oriLoc = locService.getById(task.getOriLoc());
- if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
- oriLoc.setLocSts(LocStsType.IDLE.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
+ oriLoc.setLocSts(LocStsType.IDLE.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ }
}
- }
- destLoc = locService.getById(task.getDestLoc());
- if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
- destLoc.setLocSts(LocStsType.STOCK.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ destLoc = locService.getById(task.getDestLoc());
+ if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
+ destLoc.setLocSts(LocStsType.STOCK.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ }
}
}
break;
case LOC_TO_STA:
- oriLoc = locService.getById(task.getOriLoc());
- if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
- oriLoc.setLocSts(LocStsType.IDLE.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
+ oriLoc.setLocSts(LocStsType.IDLE.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ }
}
}
@@ -331,12 +339,14 @@
oriSta = staService.getById(task.getOriSta());
staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT);
- destLoc = locService.getById(task.getDestLoc());
- if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
- destLoc.setLocSts(LocStsType.STOCK.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ if (maintainLocSts) {
+ destLoc = locService.getById(task.getDestLoc());
+ if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
+ destLoc.setLocSts(LocStsType.STOCK.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ }
}
}
break;
@@ -361,31 +371,36 @@
public void maintainLocAndStaHandler(Task task, Boolean complete) {
Loc oriLoc = null; Loc destLoc = null;
Sta oriSta = null; Sta destSta = null;
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
Date now = new Date();
TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl());
switch (Objects.requireNonNull(typeType)) {
case LOC_TO_LOC:
- oriLoc = locService.getById(task.getOriLoc());
- destLoc = locService.getById(task.getDestLoc());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ destLoc = locService.getById(task.getDestLoc());
- oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
- }
+ oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
- destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
break;
case LOC_TO_STA:
- oriLoc = locService.getById(task.getOriLoc());
- oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
destSta = staService.getById(task.getDestSta());
@@ -403,11 +418,13 @@
staReserveService.cancelStaReserve(oriSta, task, 1, StaReserveType.OUT);
}
- destLoc = locService.getById(task.getDestLoc());
- destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ if (maintainLocSts) {
+ destLoc = locService.getById(task.getDestLoc());
+ destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
break;
case STA_TO_STA:
diff --git a/zy-acs-manager/src/main/resources/application.yml b/zy-acs-manager/src/main/resources/application.yml
index 3918043..51d4215 100644
--- a/zy-acs-manager/src/main/resources/application.yml
+++ b/zy-acs-manager/src/main/resources/application.yml
@@ -53,14 +53,14 @@
convey-plc:
host: 10.10.10.222
port: 9090
- url: /api/open/task/report
timeout: 15000
uplink:
enabled: true
- host: 10.10.10.222
- port: 9090
+ host: 10.10.10.251
+ port: 8082
timeout: 30000
+ url: /rsf-open-api/rcs/api/open/task/report
floyd:
enable: false
--
Gitblit v1.9.1