From cc507c307b6d3833d00da967f728e082c22486fa Mon Sep 17 00:00:00 2001
From: tuqiang <437016993@qq.com>
Date: Sat, 17 Aug 2024 19:27:19 +0800
Subject: [PATCH] =?UTF-8?q?fix:=E7=BA=BF=E7=A8=8B=E9=98=BB=E5=A1=9E?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
acs2/nladmin-system/nlsso-server/pom.xml | 1 +
.../java/org/nl/acs/agv/QueryAGVStatus.java | 2 -
.../agv/server/impl/NDCAgvServiceImpl.java | 1 -
.../conveyor/belt_conveyor/ItemProtocol.java | 2 +-
.../ItemProtocol.java | 2 +-
.../box_subvolumes_conveyor/ItemProtocol.java | 2 +-
.../ItemProtocol.java | 2 +-
.../fold_disc_site/ItemProtocol.java | 2 +-
.../scanner_weight_conveyor/ItemProtocol.java | 4 +-
.../un_box_lable_conveyor/ItemProtocol.java | 2 +-
.../box_package_manipulator/ItemProtocol.java | 2 +-
.../box_storage_manipulator/ItemProtocol.java | 2 +-
.../return_good_manipulator/ItemProtocol.java | 2 +-
.../one_manipulator/rgv/ItemProtocol.java | 2 +-
.../trapped_manipulator/ItemProtocol.java | 2 +-
.../volume_two_manipulator/ItemProtocol.java | 2 +-
.../OvenGantryManipulatorDeviceDriver.java | 220 +++++++++---------
.../service/InstructionService.java | 2 +-
.../service/impl/InstructionServiceImpl.java | 6 +-
.../org/nl/acs/opc/DeviceExecuteAutoRun.java | 96 +++++++-
.../src/main/java/org/nl/acs/opc/OpcUtl.java | 1 -
.../java/org/nl/acs/task/domain/Task.java | 4 +
.../config/thread/ThreadPoolExecutorUtil.java | 2 +-
.../service/quartz/task/AutoCreateInst.java | 6 +-
.../service/quartz/task/CreateDDJInst.java | 1 -
.../quartz/task/NdcAutoReconnection.java | 2 -
.../src/main/resources/config/application.yml | 26 +--
27 files changed, 226 insertions(+), 172 deletions(-)
diff --git a/acs2/nladmin-system/nlsso-server/pom.xml b/acs2/nladmin-system/nlsso-server/pom.xml
index d351f489a..ecfd7228d 100644
--- a/acs2/nladmin-system/nlsso-server/pom.xml
+++ b/acs2/nladmin-system/nlsso-server/pom.xml
@@ -44,6 +44,7 @@
pom
+
org.dromara.dynamictp
dynamic-tp-spring-boot-starter-adapter-webserver
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java
index ed4278064..269e7a94b 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/QueryAGVStatus.java
@@ -1,7 +1,6 @@
package org.nl.acs.agv;
import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
@@ -42,7 +41,6 @@ public class QueryAGVStatus {
private DeviceAppService deviceAppService;
public void run() {
- log.info("定时查询AGV状态"+ DateUtil.now());
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
index a28a12359..d3f0fbf2d 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java
@@ -301,7 +301,6 @@ public class NDCAgvServiceImpl implements NDCAgvService {
(byte) nextHighHigh, (byte) nextHighLow
};
-
log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF));
System.out.println("反馈agv动作数据:" + Bytes2HexString(b));
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java
index 6ade53379..4fed8c6d8 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/conveyor/belt_conveyor/ItemProtocol.java
@@ -139,7 +139,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java
index 3b2280fa4..00b127add 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_storage_out_conveyor/ItemProtocol.java
@@ -139,7 +139,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java
index e4a73a0df..7755f3bf1 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java
@@ -142,7 +142,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/ItemProtocol.java
index 431b69ae0..9c7b234ea 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/finished_product_out_with_bind_lable_conveyor/ItemProtocol.java
@@ -194,7 +194,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/ItemProtocol.java
index 9eb52f605..79e29d781 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/fold_disc_site/ItemProtocol.java
@@ -112,7 +112,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
public String getOpcStringValue(String protocol) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java
index 29fe2a967..63b171efa 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ItemProtocol.java
@@ -178,7 +178,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
@@ -191,7 +191,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java
index afd79aab3..32abccf20 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/un_box_lable_conveyor/ItemProtocol.java
@@ -178,7 +178,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java
index 72631610d..0ed37036a 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/ItemProtocol.java
@@ -211,7 +211,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java
index 690c347a2..78d04d793 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/ItemProtocol.java
@@ -199,7 +199,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
public String getOpcStringValue(String protocol) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java
index 056428b0e..fb5ca6ccd 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/return_good_manipulator/ItemProtocol.java
@@ -184,7 +184,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
public static List getReadableItemDtos() {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/rgv/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/rgv/ItemProtocol.java
index e0ad618d8..7454c597c 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/rgv/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/rgv/ItemProtocol.java
@@ -91,7 +91,7 @@ ItemProtocol {
} else {
return value;
}
- return "0";
+ return "";
}
public static List getReadableItemDtos() {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java
index 5c067254a..95d2147f3 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/trapped_manipulator/ItemProtocol.java
@@ -182,7 +182,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
public float getOpcFloatValue(String protocol) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java
index ee19a35a1..ba1bafc0b 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/volume_two_manipulator/ItemProtocol.java
@@ -177,7 +177,7 @@ public class ItemProtocol {
setIsonline(true);
return value;
}
- return value;
+ return 0;
}
public float getOpcFloatValue(String protocol) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
index e45725f18..a32ef3324 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/oven_manipulator/OvenGantryManipulatorDeviceDriver.java
@@ -36,6 +36,7 @@ import org.nl.acs.monitor.DeviceStageMonitor;
import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl;
import org.nl.acs.route.service.RouteLineService;
+import org.nl.acs.task.enums.TaskTypeEnum;
import org.nl.acs.task.service.TaskService;
import org.nl.acs.task.service.dto.TaskDto;
import org.nl.common.exception.BadRequestException;
@@ -49,6 +50,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
import java.util.concurrent.Executor;
+import java.util.stream.Collectors;
/**
* 烘箱-行架机械手
@@ -331,28 +333,21 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
TaskDto task = null;
for (int i = 0; i < getDeviceCodeList.size(); i++) {
String startDeviceCode = getDeviceCodeList.get(i);
+ //先查指令
List taskDtos = taskserver.queryTaskByDeviceCodeAndStatus(startDeviceCode);
- if (ObjectUtil.isNotEmpty(taskDtos)) {
- //按照优先级排序 优先级相等按照创建时间排序
- taskDtos = this.sortTask(taskDtos);
+ List taskDtoStream = taskDtos.stream().sorted(Comparator.comparing(TaskDto::getCreate_time)).collect(Collectors.toList());
+ if (ObjectUtil.isNotEmpty(taskDtoStream)) {
TaskDto taskDto = taskDtos.get(0);
-
- //存在行架->暂存的AGV任务 需要过滤
- // 6 行架任务 8烘箱任务
- if (!StrUtil.equals(taskDto.getTask_type(), "6") && !StrUtil.equals(taskDto.getTask_type(), "8")) {
- taskDto = null;
- continue;
- }
-
- Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
- String start_device_code = instruction.getStart_device_code();
- String next_device_code = instruction.getNext_device_code();
- Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
- Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
- HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
- StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
- ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
- OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
+ if (TaskTypeEnum.Truss_Task.getIndex().equals(taskDto.getTask_type())) {
+ Instruction instruction = instructionService.findByTaskcodeAndStatus(taskDto.getTask_code());
+ String start_device_code = instruction.getStart_device_code();
+ String next_device_code = instruction.getNext_device_code();
+ Device nextdevice = deviceAppService.findDeviceByCode(next_device_code);
+ Device startdevice = deviceAppService.findDeviceByCode(start_device_code);
+ HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
+ StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
+ ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
+ OvenInspectSiteDeviceDriver ovenInspectSiteDeviceDriver;
/*if (startdevice.getDeviceDriver() instanceof OvenInspectSiteDeviceDriver && nextdevice.getDeviceDriver() instanceof RangingStationsDeviceDriver) {
ovenInspectSiteDeviceDriver = (OvenInspectSiteDeviceDriver) startdevice.getDeviceDriver();
standardInspectSiteDeviceDriver = (RangingStationsDeviceDriver) nextdevice.getDeviceDriver();
@@ -383,104 +378,111 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
return false;
}
}*/
- if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
- standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
- if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
- if (standardInspectSiteDeviceDriver.getMove() != 1) {
- notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
+ if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
+ standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver();
+ if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
+ if (standardInspectSiteDeviceDriver.getMove() != 1) {
+ notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "无货,无法下发指令!指令号:" + instruction.getInstruction_code();
+ return false;
+ }
+ }
+ }
+ if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
+ hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
+ if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
+ notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
- }
- if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
- hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
- if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) {
- notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:" + instruction.getInstruction_code();
- return false;
- }
- }
- if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
- standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
- if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
- if (standardInspectSiteDeviceDriver.getMove() != 0) {
- notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
+ if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
+ standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver();
+ if (ObjectUtil.equal("true", standardInspectSiteDeviceDriver.getExtraValue().get("input_move"))) {
+ if (standardInspectSiteDeviceDriver.getMove() != 0) {
+ notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevicecode() + "有货,无法下发指令!指令号:" + instruction.getInstruction_code();
+ return false;
+ }
+ }
+ }
+ if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
+ hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
+ if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) {
+ notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:" + instruction.getInstruction_code();
return false;
}
}
- }
- if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
- hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver();
- if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) {
- notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:" + instruction.getInstruction_code();
+ //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true
+ boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code);
+ //未关门结束
+ if (isCloseDoor) {
+ notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
- }
- //判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true
- boolean isCloseDoor = this.judgeCloseDoor(start_device_code, next_device_code);
- //未关门结束
- if (isCloseDoor) {
- notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
- return false;
- }
/*instruction.setInstruction_status("1");
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);*/
- Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
- Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
- if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
- throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
+ Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
+ Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
+ if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
+ throw new BadRequestException("设备:" + startDevice.getDevice_code() + "未设置电气调度号!");
+ }
+ if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
+ throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
+ }
+ String start_addr = startDevice.getExtraValue().get("address").toString();
+ String next_addr = nextDevice.getExtraValue().get("address").toString();
+ String msg = "当前设备:" + device_code + ",下发指令:"
+ + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ + ",指令终点:" + instruction.getNext_device_code();
+ LuceneLogDto logDto = LuceneLogDto.builder()
+ .device_code(device_code)
+ .content(msg)
+ .build();
+ logDto.setLog_level(3);
+ luceneExecuteLogService.deviceExecuteLog(logDto);
+ List list = new ArrayList<>();
+ Map map = new HashMap();
+ map.put("code", "to_onset");
+ map.put("value", StrUtil.isNotBlank(start_addr) ? start_addr : "0");
+ Map map1 = new HashMap();
+ map1.put("code", "to_target");
+ map1.put("value", StrUtil.isNotBlank(next_addr) ? next_addr : "0");
+ Map map2 = new HashMap();
+ map2.put("code", "to_task");
+ map2.put("value", instruction.getInstruction_code());
+ Map map3 = new HashMap();
+ map3.put("code", "to_command");
+ map3.put("value", "1");
+ list.add(map);
+ list.add(map1);
+ list.add(map2);
+ list.add(map3);
+ this.writing(list);
+ this.setRequireSucess(true);
+ return true;
}
- if (ObjectUtil.isEmpty(nextDevice.getExtraValue().get("address"))) {
- throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
- }
- String start_addr = startDevice.getExtraValue().get("address").toString();
- String next_addr = nextDevice.getExtraValue().get("address").toString();
- String msg = "当前设备:" + device_code + ",下发指令:"
- + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
- + ",指令终点:" + instruction.getNext_device_code();
- LuceneLogDto logDto = LuceneLogDto.builder()
- .device_code(device_code)
- .content(msg)
- .build();
- logDto.setLog_level(3);
- luceneExecuteLogService.deviceExecuteLog(logDto);
- List list = new ArrayList<>();
- Map map = new HashMap();
- map.put("code", "to_onset");
- map.put("value", StrUtil.isNotBlank(start_addr) ? start_addr : "0");
- Map map1 = new HashMap();
- map1.put("code", "to_target");
- map1.put("value", StrUtil.isNotBlank(next_addr) ? next_addr : "0");
- Map map2 = new HashMap();
- map2.put("code", "to_task");
- map2.put("value", instruction.getInstruction_code());
- Map map3 = new HashMap();
- map3.put("code", "to_command");
- map3.put("value", "1");
- list.add(map);
- list.add(map1);
- list.add(map2);
- list.add(map3);
- this.writing(list);
- this.setRequireSucess(true);
- return true;
} else {
- List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode);
+ List taskDtoList = taskserver.findByTrappedManipulatorReady();
if (ObjectUtil.isNotEmpty(taskDtoList)) {
- for (int j = 0; j < taskDtoList.size(); j++) {
- //按照优先级排序 优先级相等按照创建时间排序
- taskDtoList = this.sortTask(taskDtoList);
- task = taskDtoList.get(j);
- // 6 行架任务 8烘箱任务
- if (!StrUtil.equals(task.getTask_type(), "6") && !StrUtil.equals(task.getTask_type(), "8")) {
- task = null;
- continue;
- }
- if (ObjectUtil.isNotEmpty(task)) {
- break;
+ List taskDtosReady = new ArrayList<>();
+ for (TaskDto taskDto1 : taskDtoList) {
+ if (getDeviceCodeList.contains(taskDto1.getStart_device_code())) {
+ taskDtosReady.add(taskDto1);
}
}
+// task = taskDtosReady.get(0);
+ List readyTaskDtos = new ArrayList<>();
+ for (int j = 0; j < taskDtosReady.size(); j++) {
+ task = taskDtosReady.get(j);
+
+ readyTaskDtos.add(task);
+ }
+ //按照优先级排序 优先级相等按照创建时间排序
+ readyTaskDtos = this.sortTask(readyTaskDtos);
+ task = readyTaskDtos.get(0);
+ }
+ if (ObjectUtil.isNotEmpty(task)) {
+ break;
}
}
}
@@ -662,11 +664,11 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
list.add(map3);
this.writing(list);
this.setRequireSucess(true);
- notCreateInstMessage = "";
- notCreateTaskMessage = "";
+ return true;
} else {
notCreateInstMessage = "未找到关联设备的任务,指令无法创建";
}
+
return true;
}
}
@@ -857,7 +859,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
// EXECUTOR.execute(() -> {
- toOpenDoor(device);
+ toOpenDoor(device);
// });
int mode = hongXiangConveyorDeviceDriver.getMode();
int door = hongXiangConveyorDeviceDriver.getDoor();
@@ -923,7 +925,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (device.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) device.getDeviceDriver();
// EXECUTOR.execute(() -> {
- toCloseDoor(device);
+ toCloseDoor(device);
// });
int mode = hongXiangConveyorDeviceDriver.getMode();
int door = hongXiangConveyorDeviceDriver.getDoor();
@@ -989,7 +991,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
// EXECUTOR.submit(() -> {
- toOpenDoor(nextDevice);
+ toOpenDoor(nextDevice);
// });
int mode = hongXiangConveyorDeviceDriver.getMode();
int door = hongXiangConveyorDeviceDriver.getDoor();
@@ -1059,7 +1061,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (nextDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextDevice.getDeviceDriver();
// EXECUTOR.execute(() -> {
- toCloseDoor(nextDevice);
+ toCloseDoor(nextDevice);
// });
if (StrUtil.isNotEmpty(taskDto.getOven_time())) {
//下发烘箱时间
@@ -1141,8 +1143,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
// }
// }
//
- }
}
+ }
} else {
feedMessage = "行架机械手:";
if (mode != 3) {
@@ -1158,8 +1160,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
feedMessage = feedMessage + "当前上报任务号(task)不应该为0。";
}
}
- }
}
+ }
public synchronized boolean finish_instruction(Instruction inst) throws Exception {
instructionService.finish(inst);
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java
index 10e081809..e7d89ad47 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java
@@ -183,7 +183,7 @@ public interface InstructionService extends CommonService {
* @param dto
* @throws Exception
*/
- boolean create(Instruction dto) throws Exception;
+ void create(Instruction dto) throws Exception;
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
index 2a08eb4b1..e026cde8f 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
@@ -380,7 +380,7 @@ public class InstructionServiceImpl extends CommonServiceImpl inst.getStart_device_code()
.equals(start_device_code))) {
- return false;
+ return;
}
}
String currentUsername = SecurityUtils.getCurrentNickName();
@@ -538,7 +538,6 @@ public class InstructionServiceImpl extends CommonServiceImpl runs;
@@ -114,8 +121,33 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
BlockedRunable runnable = new BlockedRunable() {
@Override
public void subRun() throws Exception {
-// Thread.sleep(6000);
deviceDriver.executeAuto();
+ /* ThreadPoolExecutor executor= DtpRegistry.getDtpExecutor("dtpExecutor1");
+
+ Future> submit = executor.submit(() -> {
+ try {
+ deviceDriver.executeAuto();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ });
+ try {
+ // 设置超时时间为 15 秒,如果任务超时,抛出 TimeoutException
+ submit.get(10, TimeUnit.SECONDS);
+ System.out.println();
+ } catch (TimeoutException e) {
+ System.out.println("任务超时,取消任务!");
+ // 使用反射获取 FutureTask 中的线程,并使用 Thread.stop() 强制终止
+ Field runnerField = submit.getClass().getDeclaredField("runner");
+ runnerField.setAccessible(true);
+ Thread runnerThread = (Thread) runnerField.get(submit);
+ if (runnerThread != null) {
+ runnerThread.stop(); // 强制终止线程(不推荐)
+ }
+
+ } catch (InterruptedException | ExecutionException e) {
+ e.printStackTrace();
+ }*/
}
@Override
@@ -127,16 +159,55 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
this.runs.put(deviceDriver.getDeviceCode(), runnable);
}
runnable.setIndex(this.runs);
-
- ExecutorService executorService = (ExecutorService) ThreadPoolExecutorUtil.getPoll();
- Future> future = executorService.submit(runnable);
+// this.executorService.execute(runnable);
+ Future> future = this.executorService.submit(runnable);
+ /* try {
+ // 设置超时时间为 30 秒,如果任务超时,抛出 TimeoutException
+ future.get(5, TimeUnit.SECONDS);
+ } catch (TimeoutException e) {
+ System.out.println("任务超时,取消任务!");
+ // 超时后取消任务,并设置为 true 以中断执行中的线程
+ future.cancel(true);
+ } catch (InterruptedException | ExecutionException e) {
+ e.printStackTrace();
+ }*/
- ScheduledExecutorService scheduler= (ScheduledExecutorService) DtpRegistry.getExecutor("scheduled_pool");
+ //plc断连后强制终止线程
+ /* try {
+ // 设置超时时间为 15 秒,如果任务超时,抛出 TimeoutException
+ future.get(15, TimeUnit.SECONDS);
+ } catch (TimeoutException e) {
+ System.out.println("任务超时,取消任务!");
+ // 使用反射获取 FutureTask 中的线程,并使用 Thread.stop() 强制终止
+ Field runnerField = future.getClass().getDeclaredField("runner");
+ runnerField.setAccessible(true);
+ Thread runnerThread = (Thread) runnerField.get(future);
+ if (runnerThread != null) {
+ runnerThread.stop(); // 强制终止线程(不推荐)
+ }
- // 使用调度器在超时后取消任务
+ } catch (InterruptedException | ExecutionException e) {
+ e.printStackTrace();
+ }*/
+
+ // 使用调度器在超时后取消任务
scheduler.schedule(() -> {
if (!future.isDone()) {
+
+// future.cancel(true); // 尝试中断任务
+// Field runnerField = null;
+// try {
+// runnerField = future.getClass().getDeclaredField("runner");
+// runnerField.setAccessible(true);
+// Thread runnerThread = (Thread) runnerField.get(future);
+// if (runnerThread != null) {
+// runnerThread.stop(); // 强制终止线程(不推荐)
+// }
+// } catch (Exception e) {
+// throw new RuntimeException(e);
+// }
+
try {
// 设置超时时间为 30 秒,如果任务超时,抛出 TimeoutException
future.get(5, TimeUnit.SECONDS);
@@ -147,8 +218,15 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
+
+
}
- }, 1, TimeUnit.MILLISECONDS); // 设置超时时间为10秒
+ }, 5, TimeUnit.SECONDS); // 设置超时时间为10秒
+
+
+
+
+
}
}
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java
index edcb1a84c..d5a8dec41 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/OpcUtl.java
@@ -52,7 +52,6 @@ public class OpcUtl {
e1.printStackTrace();
}
-
boolean is_success = true;
StringBuilder message = new StringBuilder();
Iterator arg4 = e.keySet().iterator();
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java
index 6e77c6c3d..c1e76c964 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/domain/Task.java
@@ -48,6 +48,10 @@ public class Task extends CommonModel implements Serializable {
private String vehicle_code;
+ private String vehicle_code2;
+
+
+
private String vehicle_type;
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java
index 5e3c0e648..ab73632f1 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/config/thread/ThreadPoolExecutorUtil.java
@@ -35,7 +35,7 @@ public class ThreadPoolExecutorUtil {
public static Executor getPoll(){
- return DtpRegistry.getExecutor("cool_pool");
+ return DtpRegistry.getExecutor("dtpExecutor1");
/* AsyncTaskProperties properties = SpringContextHolder.getBean(AsyncTaskProperties.class);
return new ThreadPoolExecutor(
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java
index 7a4555c38..76e6f4a10 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/AutoCreateInst.java
@@ -46,7 +46,6 @@ public class AutoCreateInst {
* 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货
*/
public void run() throws Exception {
- log.info("自动生成指令"+DateUtil.now());
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
@@ -194,9 +193,8 @@ public class AutoCreateInst {
} else {
instdto.setAgv_inst_type("4");
}
- boolean flag;
try {
- flag = instructionService.create(instdto);
+ instructionService.create(instdto);
} catch (Exception e) {
acsTask.setRemark(e.getMessage());
taskserver.updateByCodeFromCache(acsTask);
@@ -209,11 +207,9 @@ public class AutoCreateInst {
continue;
}
//创建指令后修改任务状态
- if (flag) {
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
acsTask.setUpdate_time(DateUtil.now());
taskserver.update(acsTask);
- }
}
}
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java
index 3590b3615..c3d4868fc 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/CreateDDJInst.java
@@ -43,7 +43,6 @@ public class CreateDDJInst {
* 定时查询堆垛机任务
*/
public void run() {
- log.info("定时查询堆垛机任务"+DateUtil.now());
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/NdcAutoReconnection.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/NdcAutoReconnection.java
index f5bd3a1c6..c1b1d54ce 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/NdcAutoReconnection.java
+++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/quartz/task/NdcAutoReconnection.java
@@ -1,6 +1,5 @@
package org.nl.system.service.quartz.task;
-import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.run.AutoRunService;
import org.nl.system.service.param.ISysParamService;
@@ -21,7 +20,6 @@ public class NdcAutoReconnection {
AutoRunService autoRunService;
public void run(String threadCode) throws Exception {
- log.info("定时NDC自动重连"+ DateUtil.now());
String[] threadCodes = threadCode.split(",");
for (String code : threadCodes) {
if (!autoRunService.getThreadByCode(code).isAlive()) {
diff --git a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml
index 42d9bf76e..e14cb962f 100644
--- a/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml
+++ b/acs2/nladmin-system/nlsso-server/src/main/resources/config/application.yml
@@ -51,40 +51,22 @@ spring:
monitorInterval: 8
tomcatTp: # tomcat webserver 线程池配置
threadPoolAliasName: tomcat 线程池 # 线程池别名,可选
- corePoolSize: 30
+ corePoolSize: 10
maximumPoolSize: 50
keepAliveTime: 60
runTimeout: 10000
queueTimeout: 100
executors: # 动态线程池配置,都有默认值,采用默认值的可以不配置该项,减少配置量
- - threadPoolName: cool_pool # 线程池名称,必填dtpExecutor1
+ - threadPoolName: dtpExecutor1 # 线程池名称,必填
threadPoolAliasName: core_thread # 线程池别名,可选
executorType: common # 线程池类型 common、eager、ordered、scheduled、priority,默认 common
- corePoolSize: 30 # 核心线程数,默认1
- maximumPoolSize: 50 # 最大线程数,默认cpu核数
+ corePoolSize: 10 # 核心线程数,默认1
+ maximumPoolSize: 30 # 最大线程数,默认cpu核数
queueCapacity: 1024 # 队列容量,默认1024
queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类,默认VariableLinkedBlockingQueue
rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类,默认AbortPolicy
keepAliveTime: 30 # 空闲线程等待超时时间,默认60
threadNamePrefix: core_thread # 线程名前缀,默认dtp
- tryInterrupt: true
- allowCoreThreadTimeOut: true # 是否允许核心线程池超时,默认false
- waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认true
- awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认3,单位(s)
- preStartAllCoreThreads: false # 是否预热所有核心线程,默认false
- runTimeout: 2000 # 任务执行超时阈值,单位(ms),默认0(不统计)
- queueTimeout: 1000 # 任务在队列等待超时阈值,单位(ms),默认0(不统计)
- - threadPoolName: scheduled_pool # 线程池名称,必填
- threadPoolAliasName: scheduled_thread # 线程池别名,可选
- executorType: scheduled # 线程池类型 common、eager、ordered、scheduled、priority,默认 common
- corePoolSize: 30 # 核心线程数,默认1
- maximumPoolSize: 50 # 最大线程数,默认cpu核数
- queueCapacity: 1024 # 队列容量,默认1024
- queueType: VariableLinkedBlockingQueue # 任务队列,查看源码QueueTypeEnum枚举类,默认VariableLinkedBlockingQueue
- rejectedHandlerType: CallerRunsPolicy # 拒绝策略,查看RejectedTypeEnum枚举类,默认AbortPolicy
- keepAliveTime: 30 # 空闲线程等待超时时间,默认60
- threadNamePrefix: scheduled_thread # 线程名前缀,默认dtp
- tryInterrupt: true
allowCoreThreadTimeOut: true # 是否允许核心线程池超时,默认false
waitForTasksToCompleteOnShutdown: true # 参考spring线程池设计,优雅关闭线程池,默认true
awaitTerminationSeconds: 5 # 优雅关闭线程池时,阻塞等待线程池中任务执行时间,默认3,单位(s)