| | |
| | | |
| | | // 获取分机信息 |
| | | DeviceSer deviceSer = coreSerService.getCacheSer(param.getCompanyId(), |
| | | depotConf.getGrainSer()); |
| | | depotConf.getGasSer()); |
| | | |
| | | CheckGasRequest request = new CheckGasRequest(); |
| | | request.setDepotId(param.getDepotId()); |
| | |
| | | if (DepotType.TYPE_02.getCode().equals(depotType) || DepotType.TYPE_04.getCode().equals(depotType)) { |
| | | view.setViewName("admin/n2/n2-hand2"); |
| | | } else { |
| | | if ("5013".equals(user.getCompanyId()) || "5016".equals(user.getCompanyId())) { |
| | | if ("5013".equals(user.getCompanyId()) || "5016".equals(user.getCompanyId()) || "5325".equals(user.getCompanyId())) { |
| | | view.setViewName("admin/n2/n2-hand-5013"); |
| | | } else { |
| | | view.setViewName("admin/n2/n2-hand1"); |
| | |
| | | view.addObject("n2ImgMap", n2ImgMap); |
| | | |
| | | view.setViewName("admin/n2/n2-hand1"); |
| | | if ("5013".equals(user.getCompanyId()) || "5016".equals(user.getCompanyId())) { |
| | | if ("5013".equals(user.getCompanyId()) || "5016".equals(user.getCompanyId()) || "5325".equals(user.getCompanyId())) { |
| | | view.setViewName("admin/n2/n2-hand-5013"); |
| | | } |
| | | return view; |
| | |
| | | <PropertyDef name="co2Fun"> |
| | | <Property></Property> |
| | | <Property name="label">功能号</Property> |
| | | <Property name="mapping"> |
| | | <Property name="mapValues">${dorado.getDataProvider("deviceModbusPR#triggerFun").getResult()}</Property> |
| | | <Property name="keyProperty">code</Property> |
| | | <Property name="valueProperty">name</Property> |
| | | </Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="o2"> |
| | | <Property></Property> |
| | |
| | | <PropertyDef name="o2Fun"> |
| | | <Property></Property> |
| | | <Property name="label">功能号</Property> |
| | | <Property name="mapping"> |
| | | <Property name="mapValues">${dorado.getDataProvider("deviceModbusPR#triggerFun").getResult()}</Property> |
| | | <Property name="keyProperty">code</Property> |
| | | <Property name="valueProperty">name</Property> |
| | | </Property> |
| | | </PropertyDef> |
| | | <PropertyDef name="ph3"> |
| | | <Property></Property> |
| | |
| | | <PropertyDef name="ph3Fun"> |
| | | <Property></Property> |
| | | <Property name="label">功能号</Property> |
| | | <Property name="mapping"> |
| | | <Property name="mapValues">${dorado.getDataProvider("deviceModbusPR#triggerFun").getResult()}</Property> |
| | | <Property name="keyProperty">code</Property> |
| | | <Property name="valueProperty">name</Property> |
| | | </Property> |
| | | </PropertyDef> |
| | | </DataType> |
| | | </Model> |
| | |
| | | private String stopFun = "99"; |
| | | |
| | | @Column(name = "OPEN_END_", length = 10) |
| | | @PropertyDef(label = "停地址") |
| | | @PropertyDef(label = "开到位地址") |
| | | private String openEnd = Constant.YN_N; |
| | | |
| | | @Column(name = "OPEN_END_FUN", length = 4) |
| | |
| | | */ |
| | | public static ModbusMaster getMaster(String ip, int port) throws ModbusInitException, InterruptedException { |
| | | String key = ip; |
| | | ModbusMaster modbusMaster = masterMap.get(key); |
| | | if (modbusMaster == null || !modbusMaster.isConnected()) { |
| | | // ModbusMaster modbusMaster = masterMap.get(key); |
| | | // if (modbusMaster == null || !modbusMaster.isConnected()) { |
| | | IpParameters ipParameters = new IpParameters(); |
| | | ipParameters.setHost(ip); |
| | | ipParameters.setPort(port); |
| | | modbusMaster = modbusFactory.createTcpMaster(ipParameters, true); |
| | | ModbusMaster modbusMaster = modbusFactory.createTcpMaster(ipParameters, false); |
| | | modbusMaster.init(); |
| | | |
| | | //初始化之后等待,避免出现连接未创建 |
| | | Thread.sleep(2500); |
| | | |
| | | masterMap.put(key, modbusMaster); |
| | | // masterMap.put(key, modbusMaster); |
| | | |
| | | return modbusMaster; |
| | | } |
| | | return modbusMaster; |
| | | // } |
| | | // return modbusMaster; |
| | | } |
| | | |
| | | |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.DecimalFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | int sumNum = results.size(); |
| | | double co2, o2, ph3, n2; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | double sumO2 = 0.0, sumCo2 = 0.0, sumPh3 = 0.0, sumN2 = 0.0; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (ModbusGasResult gasResult : results) { |
| | | //二氧化碳,单位:PPM,直接使用 |
| | | co2 = gasResult.getCo2().doubleValue(); |
| | | o2 = gasResult.getO2().doubleValue(); |
| | | //氧气,除以10,单位:百分比 |
| | | o2 = Double.valueOf(df.format(gasResult.getO2().doubleValue()*0.1)); |
| | | //磷化氢,单位:PPM,直接使用 |
| | | ph3 = gasResult.getPh3().doubleValue(); |
| | | n2 = -100; |
| | | |
| | | //TODO >>>>> 根据返回值进行判断和转换 |
| | | |
| | | n2 = Double.valueOf(df.format(99.9 - o2));; |
| | | |
| | | if (gas.getPerCo2Max() < co2) { |
| | | gas.setPerCo2Max(co2); |
| | |
| | | temp = modbusTcp.getDeviceModbus().getOpen(); |
| | | } |
| | | |
| | | //环流风机-关 |
| | | if (DeviceStatus.F_CLOSE.getCode().equals(exeDevice.getTargetStatus())) { |
| | | temp = modbusTcp.getDeviceModbus().getStop(); |
| | | } |
| | | |
| | | //环流风机-开 |
| | | if (DeviceStatus.F_OPEN.getCode().equals(exeDevice.getTargetStatus())) { |
| | | temp = modbusTcp.getDeviceModbus().getOpen(); |
| | | } |
| | | |
| | | if (StringUtils.isBlank(exeDevice.getLink()) || "null".equals(exeDevice.getLink())) { |
| | | //根据设备目标状态,调用MODBUS执行 |
| | | modbusTcp.setAddrExe(ServerUtil.getAddrExe(temp)); |
| | |
| | | |
| | | if (Constant.YN_N.equals(modbusTcp.getDeviceModbus().getOpen())) return; |
| | | |
| | | if (Constant.YN_N.equals(modbusTcp.getDeviceModbus().getOpenEnd())) return; |
| | | int addrExe = ServerUtil.getAddrExe(modbusTcp.getDeviceModbus().getOpenEnd()); |
| | | |
| | | boolean result = ModbusUtil2.readInputStatus(modbusTcp.getIp(), modbusTcp.getPort(), addrExe); |
| | |
| | | ServerUtil.add2StatusMap(modbusTcp.getCompanyId(), modbusTcp.getSerId(), modbusTcp.getBizCode(), DeviceStatus.OPEN.getCode()); |
| | | } |
| | | |
| | | |
| | | if (Constant.YN_N.equals(modbusTcp.getDeviceModbus().getCloseEnd())) return; |
| | | addrExe = ServerUtil.getAddrExe(modbusTcp.getDeviceModbus().getCloseEnd()); |
| | | result = ModbusUtil2.readInputStatus(modbusTcp.getIp(), modbusTcp.getPort(), addrExe); |
| | | log.debug("---------读关到位状态------{}-{}-{}", modbusTcp.getBizCode(), addrExe, result); |
| | |
| | | return; |
| | | } |
| | | |
| | | //根据通道数量线程等待,每个通道等待50秒 |
| | | Thread.sleep(list.size() * 50 * 1000); |
| | | //根据通道数量线程等待,每个通道等待60秒 |
| | | Thread.sleep(list.size() * 60 * 1000); |
| | | log.debug("--------------等待时间完成,开始获取检测结果-------------{}", modbusTcp.getBizCode()); |
| | | |
| | | boolean isRun = isRun(request); |
| | |
| | | modbusTcpTemp.setAddrExe(ServerUtil.getAddrExe(gasModbus.getPh3())); |
| | | check = ModbusUtil2.readHoldingRegister(modbusTcpTemp.getIp(), modbusTcpTemp.getPort(), modbusTcpTemp.getAddrExe()); |
| | | gasResult.setPh3(check); |
| | | |
| | | log.debug("----通道{},Co2={},O2={},Ph3={}", gasModbus.getPasscode(), gasResult.getCo2(), gasResult.getO2(), gasResult.getPh3()); |
| | | results.add(gasResult); |
| | | } |
| | | |
| | |
| | | //通知解析 |
| | | analysisService.analysisGas(request, results); |
| | | } catch (Exception e) { |
| | | log.error("------------更新气体检测结果进度失败,执行异常-----{}--{}", modbusTcp.getBizCode(), e.getMessage()); |
| | | log.error("------------更新气体检测结果进度失败,执行异常-----{}--{}", modbusTcp.getBizCode(), e); |
| | | } |
| | | |
| | | } |
| | |
| | | gas.mapImg.5013_001.img=5013_001.png |
| | | |
| | | ## 5318-\u6F6E\u9633 |
| | | gas.mapImg.5318_001.img=5318_001.png |
| | | gas.mapImg.5318_001.img=5318_001. |
| | | |
| | | ## 5325 江西赣州-大公 |
| | | gas.mapImg.5325_1.img=5325_001.png |
| | | gas.mapImg.5325_2.img=5325_001.png |
| | | gas.mapImg.5325_3.img=5325_001.png |
| | | gas.mapImg.5325_4.img=5325_001.png |
| | | gas.mapImg.5325_5.img=5325_001.png |
| | | gas.mapImg.5325_6.img=5325_001.png |
| | | gas.mapImg.5325_7.img=5325_001.png |
| | | gas.mapImg.5325_8.img=5325_001.png |
| | | gas.mapImg.5325_9.img=5325_001.png |
| | | gas.mapImg.5325_10.img=5325_001.png |
| | | gas.mapImg.5325_11.img=5325_001.png |
| | | gas.mapImg.5325_12.img=5325_001.png |
| | | gas.mapImg.5325_13.img=5325_001.png |
| | | gas.mapImg.5325_14.img=5325_001.png |
| | | gas.mapImg.5325_15.img=5325_001.png |
| | | gas.mapImg.5325_16.img=5325_001.png |
| | | |
| | | ## 5328 广西来宾 |
| | | gas.mapImg.5328_0P18.img=5328_001_7.png |
| | |
| | | n2.mapImg.5000_0138.a=default_qyc_a.png |
| | | n2.mapImg.5000_0138.b=default_qyc_b.png |
| | | |
| | | ## 5325_001 |
| | | n2.mapImg.5325_001.a=pfc2_a.png |
| | | n2.mapImg.5325_001.b=pfc2_b.png |
| | | |
| | | ## 5329_001 |
| | | n2.mapImg.5329_001.a=default_qyc_a.png |
| | | n2.mapImg.5329_001.b=default_qyc_b.png |
| | |
| | | layer.open({ |
| | | type: 1, |
| | | title: '设备操作-' + domSelectDevice.attr("name"), |
| | | area: ['450px', '200px'], |
| | | area: ['450px', '150px'], |
| | | shade: 0, |
| | | content: $('#control-HL2'), |
| | | btn: 0, |
| | |
| | | <div class="layui-btn-container m10"> |
| | | <button class="rkbk-quick-btn btn-fj layui-btn btn-blue" |
| | | onClick="toExecute('F_OPEN')"> |
| | | <i><img th:src="@{../../static/images/icon-sm-fj.png}" /></i>强风 |
| | | <i><img th:src="@{../../static/images/icon-sm-fj.png}" /></i>开风机 |
| | | </button> |
| | | <button class="rkbk-quick-btn btn-fj layui-btn btn-red" |
| | | onClick="toExecute('F_CLOSE')"> |
| | | <i><img th:src="@{../../static/images/icon-sm-fj.png}" /></i>关风机 |
| | | </button> |
| | | <button class="rkbk-quick-btn btn-fj layui-btn btn-blue" |
| | | onClick="toExecute('F_OPEN_F')"> |
| | | <i><img th:src="@{../../static/images/icon-sm-fj.png}" /></i>弱风 |
| | | </button> |
| | | <!-- <button class="rkbk-quick-btn btn-fj layui-btn btn-blue"--> |
| | | <!-- onClick="toExecute('F_OPEN_F')">--> |
| | | <!-- <i><img th:src="@{../../static/images/icon-sm-fj.png}" /></i>弱风--> |
| | | <!-- </button>--> |
| | | </div> |
| | | </div> |
| | | |