From 3b604eb218a3b167144cc6e5d9c86cd95e16157c Mon Sep 17 00:00:00 2001 From: yxFwq <1> Date: 星期六, 10 五月 2025 08:08:24 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/ScaleThread.java | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 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..70c4978 100644 --- a/src/main/java/com/zy/core/thread/ScaleThread.java +++ b/src/main/java/com/zy/core/thread/ScaleThread.java @@ -49,13 +49,37 @@ 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 (scale>60){ + switch (slave.getId()){ + case 1: + scale = scale - 60; + break; + case 2: + scale = scale - 52; + break; + case 3: + scale = scale - 74.0; + break; + case 4: + scale = scale - 50.8; + break; + default: + scale = scale - 74.0; + } + } +// if (slave.getId()>3){ +// scale = scale - 50.8; +// } else { +// scale = scale - 74.0; +// } //灏嗙О閲嶉噸閲忓啓鍏ヨ澶囧熀纭�鏁版嵁涓殑gross_wt瀛楁 - if(scale > 20) { + if(scale > 5) { 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 +87,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