Commit 444c5097 authored by wanghao's avatar wanghao

1 使用本地数据库运行程序;这边的电脑无线太卡

parent 055d3aac
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/zh-mes-device-db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: Zh@123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# Quartz持久化配置:cite[1]:cite[5]
quartz:
# 持久化到数据库方式
job-store-type: jdbc
# 初始化数据库架构
jdbc:
initialize-schema: always
# Quartz调度程序属性:cite[1]
properties:
org:
quartz:
scheduler:
# 调度任务实例名称
instanceName: ZhMESDeviceScheduler
# 实例ID,AUTO自动生成
instanceId: AUTO
jobStore:
# JobStore实现类
class: org.quartz.impl.jdbcjobstore.JobStoreTX
# 驱动程序代理类
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# 表名前缀
tablePrefix: QRTZ_
# 是否使用属性文件存储JobDataMaps
useProperties: true
# 错过触发阈值(毫秒)
misfireThreshold: 60000
# 是否启用集群功能
isClustered: false
# 集群检查间隔(毫秒)
clusterCheckinInterval: 15000
# 配置线程池:cite[1]
threadPool:
class: org.quartz.simpl.SimpleThreadPool
# 线程数
threadCount: 10
# 线程优先级
threadPriority: 5
# 线程名称前缀
threadNamePrefix: ZhMESQuartzWorker_
# redis 配置
redis:
# 地址
host: localhost
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/zh-mes-device-db?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: Zh@123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# ==================== 连接池核心优化配置 ====================
# 1. 连接池大小优化(针对Quartz高频短任务特点)
initialSize: 15 # 初始化连接数增加到15,应对Quartz启动时并发需求
minIdle: 15 # 最小空闲连接保持15,避免连接频繁创建销毁
maxActive: 50 # 最大连接数增加到50,考虑72个Job并发 + 业务连接
# 2. 连接获取优化(解决Quartz获取连接超时问题)
maxWait: 30000 # 获取连接最大等待时间5秒,避免Quartz线程阻塞
# 3. 连接保活核心配置(解决"discard long time none received connection"警告)
timeBetweenEvictionRunsMillis: 30000 # 检测间隔30秒,更频繁检查连接有效性
minEvictableIdleTimeMillis: 300000 # 连接最小生存时间5分钟
maxEvictableIdleTimeMillis: 600000 # 连接最大生存时间10分钟
# 4. 连接有效性检测强化(关键修复)
validationQuery: SELECT 1 # 连接有效性检测SQL
testWhileIdle: true # 空闲时检测连接有效性(必须开启)
testOnBorrow: true # 借用时检测连接有效性(关键:确保Quartz拿到有效连接)
testOnReturn: false # 归还时不检测(性能考虑)
validationQueryTimeout: 2000 # 验证查询超时2秒
# 5. 连接保活机制(新增)
keepAlive: true # 开启连接保活
keepAliveBetweenTimeMillis: 30000 # 保活执行间隔30秒
phyTimeoutMillis: 1200000 # 物理连接超时20分钟
# 项目相关配置
# 6. 连接泄露检测(保留原有配置)
removeAbandoned: true
removeAbandonedTimeout: 300
logAbandoned: true
# 7. 过滤器配置
webStatFilter:
enabled: true
statViewServlet:
enabled: true
allow:
url-pattern: /druid/*
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
# redis 配置(保持不变)
redis:
host: 127.0.0.1
port: 6379
database: 0
password:
timeout: 10s
lettuce:
pool:
min-idle: 0
max-idle: 8
max-active: 8
max-wait: -1ms
# 其他配置保持不变...
zehong:
# 名称
name: Zehong
# 版本
version: 3.5.0
# 版权年份
copyrightYear: 2021
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/zehong/uploadPath,Linux配置 /home/zehong/uploadPath)
profile: D:/zehong/uploadPath
# 获取ip地址开关
profile: D:/zhmes-agecal/uploadPath
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# Netty配置
netty:
port: 6001 # 服务端口
boss-group-thread-count: 1 # 主线程数
worker-group-thread-count: 8 # 工作线程数
max-frame-length: 65535 # 最大帧长度
heartbeat-timeout: 10 # 心跳超时时间(秒)
port: 6001
boss-group-thread-count: 1
worker-group-thread-count: 8
max-frame-length: 65535
heartbeat-timeout: 10
# 机械臂UDP配置
robot:
arm:
udp:
......
......@@ -26,7 +26,7 @@ spring:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: test
active: dev
# 文件上传
servlet:
multipart:
......
......@@ -134,7 +134,7 @@ public class RobotArmCommandServiceImpl implements IRobotArmCommandService
// 2. 处理待执行的下料指令
List<RobotArmCommand> unloadingCommands =
robotArmCommandMapper.selectPendingUnloadingCommands();
if (!unloadingCommands.isEmpty() && "unloading".equals(priority)) {
if (!unloadingCommands.isEmpty()) {
boolean[] roboticArmExitConveyorData = Modbus4jUtils.getRoboticArmExitConveyorData(outLetBeltIp,outLetBeltPort);
if(roboticArmExitConveyorData[1]) {
log.info("开始处理下料指令: {}", unloadingCommands.get(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment