| | |
| | | import com.fzzy.protocol.bhzn.cmd.CommandBuild; |
| | | import com.fzzy.protocol.bhzn.cmd.ReMessageBuilder; |
| | | import com.fzzy.protocol.bhzn.data.IoMessage; |
| | | import com.fzzy.protocol.data.GrainCableData; |
| | | import com.fzzy.gateway.data.GrainCableData; |
| | | import com.fzzy.protocol.data.THDto; |
| | | import com.fzzy.protocol.bhzn.server.BhznGrainV2ServerEngine; |
| | | import com.fzzy.protocol.bhzn.server.BhznGrainV2ServerUtils; |
| | |
| | | } |
| | | |
| | | // 判断数据有没有收取完整 |
| | | GrainCableData cableData = this.getCableData(gatewayDevice); |
| | | GrainCableData cableData = GatewayUtils.getCableData(gatewayDevice); |
| | | int sumPoint = cableData.getSumNum(); |
| | | |
| | | //获取当前粮情温度报文 |
| | |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | private GrainCableData getCableData(GatewayDevice gatewayDevice) { |
| | | String cableRule = gatewayDevice.getCableRule(); |
| | | String cableCir = gatewayDevice.getCableCir(); |
| | | |
| | | GrainCableData result = new GrainCableData(); |
| | | |
| | | int cableY, cableX; |
| | | String[] attCable = cableRule.split("-"); |
| | | int cableZ = Integer.valueOf(attCable[0]); |
| | | if (StringUtils.isEmpty(cableCir)) { |
| | | cableY = Integer.valueOf(attCable[1]); |
| | | cableX = Integer.valueOf(attCable[2]); |
| | | } else { |
| | | String[] attCir = cableCir.split("-"); |
| | | cableZ = Integer.valueOf(attCir[0]); |
| | | cableY = 1; |
| | | cableX = 0; |
| | | //针对多圈计算 |
| | | for (int i = 0; i < cableCir.length(); i++) { |
| | | cableX += Integer.valueOf(attCir[i]); |
| | | } |
| | | |
| | | result.setCir(true); |
| | | } |
| | | |
| | | result.setCableY(cableY); |
| | | result.setCableZ(cableZ); |
| | | result.setCableX(cableX); |
| | | result.setSumNum(cableZ * cableY * cableX); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |