自动化立体仓库 - WCS系统
*
lsh
2025-04-08 a5e366c9143ff99bc5f707048a73f93a8d444bb8
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();