From 48c1de18235020edff108339ed1d12bade8a2b90 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期一, 08 十二月 2025 16:37:02 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
index f411914..4cc6ef1 100644
--- a/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZySiemensCrnThread.java
@@ -43,6 +43,7 @@
private RedisUtil redisUtil;
private ZyCrnConnectDriver zyCrnConnectDriver;
private CrnProtocol crnProtocol;
+ private int deviceLogCollectTime = 200;
private boolean resetFlag = false;
public ZySiemensCrnThread(DeviceConfig deviceConfig, RedisUtil redisUtil) {
@@ -57,6 +58,7 @@
this.initCrn();
while (true) {
try {
+ deviceLogCollectTime = Utils.getDeviceLogCollectTime();
int step = 1;
Task task = MessageQueue.poll(SlaveType.Crn, deviceConfig.getDeviceNo());
if (task != null) {
@@ -122,7 +124,7 @@
ZyCrnStatusEntity crnStatus = zyCrnConnectDriver.getStatus();
if (crnStatus == null) {
OutputQueue.CRN.offer(MessageFormat.format("銆恵0}銆戣鍙栧爢鍨涙満plc鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()));
- News.error("SiemensCrn"+" - 5"+" - 璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
+ News.error("SiemensCrn璇诲彇鍫嗗灈鏈簆lc鐘舵�佷俊鎭け璐� ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort());
return;
}
@@ -172,7 +174,7 @@
crnProtocol.setLastCommandTime(System.currentTimeMillis());
}
- if (System.currentTimeMillis() - crnProtocol.getDeviceDataLog() > 200) {
+ if (System.currentTimeMillis() - crnProtocol.getDeviceDataLog() > deviceLogCollectTime) {
//淇濆瓨鏁版嵁璁板綍
DeviceDataLog deviceDataLog = new DeviceDataLog();
deviceDataLog.setOriginData(JSON.toJSONString(crnStatus));
@@ -186,7 +188,12 @@
crnProtocol.setDeviceDataLog(System.currentTimeMillis());
}
- BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ BasCrnpService basCrnpService = null;
+ try {
+ basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ }catch (Exception e){
+
+ }
if (basCrnpService != null) {
BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", deviceConfig.getDeviceNo()));
if(basCrnp == null) {
@@ -195,6 +202,8 @@
basCrnp.setStatus(1);
basCrnp.setInEnable("N");
basCrnp.setOutEnable("N");
+ basCrnp.setMaxInTask(5);
+ basCrnp.setMaxOutTask(5);
basCrnp.setCreateTime(new Date());
basCrnpService.insert(basCrnp);
}
--
Gitblit v1.9.1