From 85bb0d60ce25ec902aba8c298931bda33a77e7b8 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期三, 23 十月 2024 11:59:35 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/core/thread/ScaleThread.java | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/zy/core/thread/ScaleThread.java b/src/main/java/com/zy/core/thread/ScaleThread.java
index dc7bf98..3c574e5 100644
--- a/src/main/java/com/zy/core/thread/ScaleThread.java
+++ b/src/main/java/com/zy/core/thread/ScaleThread.java
@@ -49,13 +49,19 @@
if (null != read) {
String s = new String(read);
if (!Cools.isEmpty(s) && s.startsWith("=")) {
- scale = Double.parseDouble(s.substring(1));
+ String substring = s.substring(1);
+ String s1 = new StringBuilder(substring).reverse().toString();
+ scale = Double.parseDouble(s1);//50.8 67.6
+ if (slave.getId()>3){
+ scale = scale - 50.8;
+ } else {
+ scale = scale - 67.6;
+ }
//灏嗙О閲嶉噸閲忓啓鍏ヨ澶囧熀纭�鏁版嵁涓殑gross_wt瀛楁
if(scale > 20) {
BasDevpService basDevpService = SpringUtils.getBean(BasDevpService.class);
- Integer staNo = slave.getId() == 1 ? 101 : 201;
- BasDevp basDevp = basDevpService.selectById(staNo);
+ BasDevp basDevp = basDevpService.selectById(slave.getStaNo());
if(!Cools.isEmpty(basDevp)) {
basDevp.setGrossWt(scale);
if (null != basDevpService && !basDevpService.updateById(basDevp)) {
@@ -63,7 +69,7 @@
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("time", DateUtils.convert(new Date(), DateUtils.yyyyMMddHHmmss_F));
- jsonObject.put("id", staNo);
+ jsonObject.put("id", slave.getStaNo());
jsonObject.put("scale", scale);
if (OutputQueue.SCALE.size() >= 32) {
OutputQueue.SCALE.poll();
--
Gitblit v1.9.1