From 470962be1cfdbf75b734ab8f78e28a7b23a06964 Mon Sep 17 00:00:00 2001 From: tqs <56479841@qq.com> Date: 星期三, 07 九月 2022 17:55:25 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/model/DevpSlave.java | 1 + src/main/java/com/zy/core/thread/ScaleThread.java | 16 ++++++++++++++++ src/main/resources/application.yml | 7 +++++++ 3 files changed, 24 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/core/model/DevpSlave.java b/src/main/java/com/zy/core/model/DevpSlave.java index ad33be5..bb45c71 100644 --- a/src/main/java/com/zy/core/model/DevpSlave.java +++ b/src/main/java/com/zy/core/model/DevpSlave.java @@ -34,6 +34,7 @@ private Integer barcode; + private Integer scale; } } diff --git a/src/main/java/com/zy/core/thread/ScaleThread.java b/src/main/java/com/zy/core/thread/ScaleThread.java index c5a2d4b..180396a 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); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index efa500f..b807ddb 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -131,10 +131,12 @@ inSta[0]: staNo: 101 barcode: ${wcs-slave.barcode[0].id} + scale: ${wcs-slave.scale[0].id} # 鍏ュ簱鍙�2 inSta[1]: staNo: 201 barcode: ${wcs-slave.barcode[1].id} + scale: ${wcs-slave.scale[1].id} # 绌烘澘鍏ュ簱鍙�1 emptyInSta[0]: staNo: 101 @@ -160,4 +162,9 @@ scale[0]: id: 1 ip: 10.10.10.201 + port: 5005 + # 纾呯Г + scale[1]: + id: 2 + ip: 10.10.10.201 port: 5005 \ No newline at end of file -- Gitblit v1.9.1