| | |
| | | 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)) { |
| | |
| | | } |
| | | 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(); |