From 97e21d611a0192c355fd06b76e2215f525abdd15 Mon Sep 17 00:00:00 2001
From: tqs <56479841@qq.com>
Date: 星期六, 22 十月 2022 12:47:24 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/thread/ScaleThread.java | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/ScaleThread.java b/src/main/java/com/zy/core/thread/ScaleThread.java
index c5a2d4b..30d695a 100644
--- a/src/main/java/com/zy/core/thread/ScaleThread.java
+++ b/src/main/java/com/zy/core/thread/ScaleThread.java
@@ -1,6 +1,9 @@
package com.zy.core.thread;
import com.core.common.Cools;
+import com.core.common.SpringUtils;
+import com.zy.asrs.entity.BasDevp;
+import com.zy.asrs.service.BasDevpService;
import com.zy.core.Slave;
import com.zy.core.ThreadHandler;
import lombok.Data;
@@ -43,6 +46,19 @@
String s = new String(read);
if (!Cools.isEmpty(s) && s.startsWith("=")) {
scale = Double.parseDouble(s.substring(1));
+
+ //灏嗙О閲嶉噸閲忓啓鍏ヨ澶囧熀纭�鏁版嵁涓殑gross_wt瀛楁
+ if(scale > 20) {
+ BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
+ Integer staNo = slave.getId() == 1 ? 101 : 201;
+ BasDevp basDevp = basDevpService.selectById(staNo);
+ if(!Cools.isEmpty(basDevp)) {
+ basDevp.setGrossWt(scale);
+ if (null != basDevpService && !basDevpService.updateById(basDevp)) {
+ throw new Exception("鏇存柊鏁版嵁搴撴暟鎹け璐�");
+ }
+ }
+ }
}
}
Thread.sleep(100);
@@ -66,7 +82,7 @@
// log.info("鏉$爜鎵弿浠繛鎺ユ垚鍔� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
} catch (Exception e) {
socket = null;
- log.error("鏉$爜鎵弿浠繛鎺ュけ璐ワ紒锛侊紒 ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
+ log.error("纾呯Г杩炴帴澶辫触锛侊紒锛� ===>> [id:{}] [ip:{}] [port:{}]", slave.getId(), slave.getIp(), slave.getPort());
return false;
}
return true;
--
Gitblit v1.9.1