| | |
| | | * <p> |
| | | * 粮情每天11点穿上区 |
| | | */ |
| | | @Scheduled(cron = "0 0 11 * * ?") |
| | | // @Scheduled(cron = "0 0 11 * * ?") |
| | | public void scheduledGrain() { |
| | | //获取设备配置,只针对粮情设备进行执行 |
| | | log.info("定时kafka粮情推送"); |
| | |
| | | * 粮情每天8点采集粮情 |
| | | * |
| | | */ |
| | | @Scheduled(cron = "0 30 5 ? * *") |
| | | // @Scheduled(cron = "0 30 5 ? * *") |
| | | // @Scheduled(cron = "0 32 11 ? * 1,4") |
| | | @Scheduled(cron = "0 32 11 ? * *") |
| | | public void scheduledGrain2() { |
| | | //获取设备配置,只针对粮情设备进行执行 |
| | | log.info("定时粮情采集kafka推送"); |
| | |
| | | //邦海智能纯网口设备协议 |
| | | BhznGrainV2ServerEngine.start(null); |
| | | //邦海智能无线主机设备协议 |
| | | //BhznGrainV0ServerEngine.start(null); |
| | | BhznGrainV0ServerEngine.start(null); |
| | | //邦海智能无线主机设备协议 |
| | | BhznGrainV01ServerEngine.start(null); |
| | | //BhznGrainV01ServerEngine.start(null); |
| | | } |
| | | |
| | | } |
| | |
| | | sb.append(BytesUtil.tran_LH(BytesUtil.intToHexStr(i))); |
| | | |
| | | //发送方地址 |
| | | sb.append("0001"); |
| | | sb.append("0000"); |
| | | |
| | | //命令ID |
| | | sb.append(BhznGrainV0ServerUtils.FUNCTION_ID_83); |
| | |
| | | return BytesUtil.intToHexStr(256 - check).substring(2); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(getCheck("AA630A0001830108")); |
| | | } |
| | | |
| | | |
| | | public static void addSession(IoSession session) { |
| | | contextIoSession.put(DEFAULT_MAC_ID, session); |
| | | } |
| | |
| | | // 发送命令 |
| | | InvokeResult message = BhznGrainV0ServerEngine.pushByMin(hexStr); |
| | | |
| | | log.error("平台------>>>>控制柜:发送粮情检测命令-{}", message); |
| | | log.error("平台------>>>>控制柜:发送粮情检测命令-{} -------------- {}", message,hexStr); |
| | | |
| | | // 封装返回信息 |
| | | if (!InvokeResult.SUCCESS.getCode().equals(message.getCode())) { |
| | |
| | | } |
| | | |
| | | //数据优化 |
| | | if (curTemp > 35) { |
| | | if (curTemp > 40) { |
| | | curTemp = response.getTAvg(); |
| | | } |
| | | |
| | |
| | | |
| | | temperature.add(new GrainTemp(cableNum + "", z + "", curTemp + "", position + "")); |
| | | |
| | | sumT += curTemp; |
| | | if (curTemp > max) { |
| | | if (curTemp > max && curTemp < 38) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min && new Double(curTemp).intValue()!= -100) { |
| | | if (curTemp < min && curTemp > 5) { |
| | | min = curTemp; |
| | | } |
| | | if(new Double(curTemp).intValue()!= -100){ |
| | | if(curTemp > 5 && curTemp < 38){ |
| | | sumT += curTemp; |
| | | sumNum++; |
| | | } |
| | | } |
| | |
| | | |
| | | temperature.add(new GrainTemp(cableNum + "", z + "", curTemp + "", position + "")); |
| | | |
| | | sumT += curTemp; |
| | | if (curTemp > max) { |
| | | if (curTemp > max && curTemp < 38) { |
| | | max = curTemp; |
| | | } |
| | | if (curTemp < min) { |
| | | if (curTemp < min && curTemp > 5) { |
| | | min = curTemp; |
| | | } |
| | | if(curTemp > 5 && curTemp < 38){ |
| | | sumT += curTemp; |
| | | sumNum++; |
| | | } |
| | | } |
| | | |
| | | if (sumNum == 0) { |