From 4cfaac76490c1391237483329719bc6abd4392af Mon Sep 17 00:00:00 2001 From: CZT <czt18638530771@163.com> Date: 星期二, 29 八月 2023 20:32:00 +0800 Subject: [PATCH] 调整代码 --- igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteControlServiceImpl.java | 13 ++++++ igds-web/src/main/resources/gas-conf.properties | 20 +++++++++ igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteGasServiceImpl.java | 8 ++-- igds-web/src/main/resources/static/admin/n2/n2-hand-5013.js | 2 igds-n2/src/main/java/com/ld/igds/n2/controller/N2Controller.java | 4 +- igds-basic/src/main/java/com/ld/igds/gas/manager/GasManager.java | 2 igds-web/src/main/resources/static/img/n2/5325/pfc2_a.png | 0 igds-protocol-modbus/src/main/java/com/ld/igds/models/DeviceModbus.java | 2 igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java | 12 +++-- igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ModbusUtil2.java | 12 +++--- igds-web/src/main/resources/templates/admin/n2/n2-hand-5013.html | 10 ++-- igds-web/src/main/resources/static/img/gas/5325/5325_001.png | 0 igds-protocol-modbus/src/main/java/com/ld/igds/modbus/GasModbus.view.xml | 15 +++++++ igds-web/src/main/resources/n2-conf.properties | 4 ++ igds-web/src/main/resources/static/img/n2/5325/pfc2_b.png | 0 15 files changed, 77 insertions(+), 27 deletions(-) diff --git a/igds-basic/src/main/java/com/ld/igds/gas/manager/GasManager.java b/igds-basic/src/main/java/com/ld/igds/gas/manager/GasManager.java index 02446e1..6b758ff 100644 --- a/igds-basic/src/main/java/com/ld/igds/gas/manager/GasManager.java +++ b/igds-basic/src/main/java/com/ld/igds/gas/manager/GasManager.java @@ -261,7 +261,7 @@ // 鑾峰彇鍒嗘満淇℃伅 DeviceSer deviceSer = coreSerService.getCacheSer(param.getCompanyId(), - depotConf.getGrainSer()); + depotConf.getGasSer()); CheckGasRequest request = new CheckGasRequest(); request.setDepotId(param.getDepotId()); diff --git a/igds-n2/src/main/java/com/ld/igds/n2/controller/N2Controller.java b/igds-n2/src/main/java/com/ld/igds/n2/controller/N2Controller.java index 506e3f4..bc10d82 100644 --- a/igds-n2/src/main/java/com/ld/igds/n2/controller/N2Controller.java +++ b/igds-n2/src/main/java/com/ld/igds/n2/controller/N2Controller.java @@ -80,7 +80,7 @@ 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"); @@ -128,7 +128,7 @@ 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; diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/modbus/GasModbus.view.xml b/igds-protocol-modbus/src/main/java/com/ld/igds/modbus/GasModbus.view.xml index 12ec7d6..2576894 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/modbus/GasModbus.view.xml +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/modbus/GasModbus.view.xml @@ -136,6 +136,11 @@ <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> @@ -144,6 +149,11 @@ <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> @@ -152,6 +162,11 @@ <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> diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/models/DeviceModbus.java b/igds-protocol-modbus/src/main/java/com/ld/igds/models/DeviceModbus.java index 5d172eb..ae17d8d 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/models/DeviceModbus.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/models/DeviceModbus.java @@ -58,7 +58,7 @@ 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) diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ModbusUtil2.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ModbusUtil2.java index e7d4dbe..d4385be 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ModbusUtil2.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/ModbusUtil2.java @@ -47,22 +47,22 @@ */ 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; } diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java index 0cff6e1..30c815f 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/AnalysisService.java @@ -18,6 +18,7 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.text.DecimalFormat; import java.util.Date; import java.util.List; @@ -80,16 +81,17 @@ 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)); + //纾峰寲姘紝鍗曚綅锛歅PM锛岀洿鎺ヤ娇鐢� ph3 = gasResult.getPh3().doubleValue(); - n2 = -100; - - //TODO >>>>> 鏍规嵁杩斿洖鍊艰繘琛屽垽鏂拰杞崲 - + n2 = Double.valueOf(df.format(99.9 - o2));; if (gas.getPerCo2Max() < co2) { gas.setPerCo2Max(co2); diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteControlServiceImpl.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteControlServiceImpl.java index 2fe10f4..6616ee3 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteControlServiceImpl.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteControlServiceImpl.java @@ -87,6 +87,16 @@ 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)); @@ -255,6 +265,7 @@ 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); @@ -264,7 +275,7 @@ 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); diff --git a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteGasServiceImpl.java b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteGasServiceImpl.java index cece11d..2516fe1 100644 --- a/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteGasServiceImpl.java +++ b/igds-protocol-modbus/src/main/java/com/ld/igds/protocol/modbus/command/RemoteGasServiceImpl.java @@ -129,8 +129,8 @@ return; } - //鏍规嵁閫氶亾鏁伴噺绾跨▼绛夊緟锛屾瘡涓�氶亾绛夊緟50绉� - Thread.sleep(list.size() * 50 * 1000); + //鏍规嵁閫氶亾鏁伴噺绾跨▼绛夊緟锛屾瘡涓�氶亾绛夊緟60绉� + Thread.sleep(list.size() * 60 * 1000); log.debug("--------------绛夊緟鏃堕棿瀹屾垚锛屽紑濮嬭幏鍙栨娴嬬粨鏋�-------------{}", modbusTcp.getBizCode()); boolean isRun = isRun(request); @@ -161,7 +161,7 @@ modbusTcpTemp.setAddrExe(ServerUtil.getAddrExe(gasModbus.getPh3())); check = ModbusUtil2.readHoldingRegister(modbusTcpTemp.getIp(), modbusTcpTemp.getPort(), modbusTcpTemp.getAddrExe()); gasResult.setPh3(check); - + log.debug("----閫氶亾{}锛孋o2={}锛孫2={}锛孭h3={}", gasModbus.getPasscode(), gasResult.getCo2(), gasResult.getO2(), gasResult.getPh3()); results.add(gasResult); } @@ -172,7 +172,7 @@ //閫氱煡瑙f瀽 analysisService.analysisGas(request, results); } catch (Exception e) { - log.error("------------鏇存柊姘斾綋妫�娴嬬粨鏋滆繘搴﹀け璐ワ紝鎵ц寮傚父-----{}--{}", modbusTcp.getBizCode(), e.getMessage()); + log.error("------------鏇存柊姘斾綋妫�娴嬬粨鏋滆繘搴﹀け璐ワ紝鎵ц寮傚父-----{}--{}", modbusTcp.getBizCode(), e); } } diff --git a/igds-web/src/main/resources/gas-conf.properties b/igds-web/src/main/resources/gas-conf.properties index 03e65be..675bf62 100644 --- a/igds-web/src/main/resources/gas-conf.properties +++ b/igds-web/src/main/resources/gas-conf.properties @@ -29,7 +29,25 @@ 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 diff --git a/igds-web/src/main/resources/n2-conf.properties b/igds-web/src/main/resources/n2-conf.properties index 639d665..9e6b4d0 100644 --- a/igds-web/src/main/resources/n2-conf.properties +++ b/igds-web/src/main/resources/n2-conf.properties @@ -110,6 +110,10 @@ 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 \ No newline at end of file diff --git a/igds-web/src/main/resources/static/admin/n2/n2-hand-5013.js b/igds-web/src/main/resources/static/admin/n2/n2-hand-5013.js index e90375d..5f6dc99 100644 --- a/igds-web/src/main/resources/static/admin/n2/n2-hand-5013.js +++ b/igds-web/src/main/resources/static/admin/n2/n2-hand-5013.js @@ -298,7 +298,7 @@ layer.open({ type: 1, title: '璁惧鎿嶄綔-' + domSelectDevice.attr("name"), - area: ['450px', '200px'], + area: ['450px', '150px'], shade: 0, content: $('#control-HL2'), btn: 0, diff --git a/igds-web/src/main/resources/static/img/gas/5325/5325_001.png b/igds-web/src/main/resources/static/img/gas/5325/5325_001.png new file mode 100644 index 0000000..25c971d --- /dev/null +++ b/igds-web/src/main/resources/static/img/gas/5325/5325_001.png Binary files differ diff --git a/igds-web/src/main/resources/static/img/n2/5325/pfc2_a.png b/igds-web/src/main/resources/static/img/n2/5325/pfc2_a.png new file mode 100644 index 0000000..8fa743b --- /dev/null +++ b/igds-web/src/main/resources/static/img/n2/5325/pfc2_a.png Binary files differ diff --git a/igds-web/src/main/resources/static/img/n2/5325/pfc2_b.png b/igds-web/src/main/resources/static/img/n2/5325/pfc2_b.png new file mode 100644 index 0000000..8fa743b --- /dev/null +++ b/igds-web/src/main/resources/static/img/n2/5325/pfc2_b.png Binary files differ diff --git a/igds-web/src/main/resources/templates/admin/n2/n2-hand-5013.html b/igds-web/src/main/resources/templates/admin/n2/n2-hand-5013.html index cf58456..2d56e19 100644 --- a/igds-web/src/main/resources/templates/admin/n2/n2-hand-5013.html +++ b/igds-web/src/main/resources/templates/admin/n2/n2-hand-5013.html @@ -323,16 +323,16 @@ <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> -- Gitblit v1.9.3