diff --git a/src/com/szpg/db/data/PgFjStat.java b/src/com/szpg/db/data/PgFjStat.java
index 3787e12..a32cd81 100644
--- a/src/com/szpg/db/data/PgFjStat.java
+++ b/src/com/szpg/db/data/PgFjStat.java
@@ -143,9 +143,11 @@
try {
json.put("time", this.getTmStr());
json.put("run", null != this.getRun() && this.getRun() == true ? URLEncoder.encode("风机启动", "UTF-8") : URLEncoder.encode("风机关闭", "UTF-8"));
- json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
json.put("flt", null != this.getFlt() && this.getFlt() == true ? URLEncoder.encode("风机故障", "UTF-8") : URLEncoder.encode("正常", "UTF-8"));
json.put("am", null != this.getAm() && this.getAm() == true ? URLEncoder.encode("远控", "UTF-8") : URLEncoder.encode("就地", "UTF-8"));
+ json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
+ json.put("amStat", null != this.getAm() && this.getAm() == true ? "1" : "0");
+ json.put("fltStat", null != this.getFlt() && this.getFlt() == true ? "1" : "0");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/db/data/PgFjStat.java b/src/com/szpg/db/data/PgFjStat.java
index 3787e12..a32cd81 100644
--- a/src/com/szpg/db/data/PgFjStat.java
+++ b/src/com/szpg/db/data/PgFjStat.java
@@ -143,9 +143,11 @@
try {
json.put("time", this.getTmStr());
json.put("run", null != this.getRun() && this.getRun() == true ? URLEncoder.encode("风机启动", "UTF-8") : URLEncoder.encode("风机关闭", "UTF-8"));
- json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
json.put("flt", null != this.getFlt() && this.getFlt() == true ? URLEncoder.encode("风机故障", "UTF-8") : URLEncoder.encode("正常", "UTF-8"));
json.put("am", null != this.getAm() && this.getAm() == true ? URLEncoder.encode("远控", "UTF-8") : URLEncoder.encode("就地", "UTF-8"));
+ json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
+ json.put("amStat", null != this.getAm() && this.getAm() == true ? "1" : "0");
+ json.put("fltStat", null != this.getFlt() && this.getFlt() == true ? "1" : "0");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/db/data/PgJgStat.java b/src/com/szpg/db/data/PgJgStat.java
index b362a76..aaef788 100644
--- a/src/com/szpg/db/data/PgJgStat.java
+++ b/src/com/szpg/db/data/PgJgStat.java
@@ -108,7 +108,7 @@
json.put("time", this.getTmStr());
json.put("open", null != this.getJgopen() ? URLEncoder.encode(getJgopen(), "UTF-8") : "");
json.put("lock", null != this.getJglock() && this.getJglock() == true ? URLEncoder.encode("井盖锁定", "UTF-8") : URLEncoder.encode("井盖解锁", "UTF-8"));
- json.put("runStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
+ json.put("lockStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/db/data/PgFjStat.java b/src/com/szpg/db/data/PgFjStat.java
index 3787e12..a32cd81 100644
--- a/src/com/szpg/db/data/PgFjStat.java
+++ b/src/com/szpg/db/data/PgFjStat.java
@@ -143,9 +143,11 @@
try {
json.put("time", this.getTmStr());
json.put("run", null != this.getRun() && this.getRun() == true ? URLEncoder.encode("风机启动", "UTF-8") : URLEncoder.encode("风机关闭", "UTF-8"));
- json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
json.put("flt", null != this.getFlt() && this.getFlt() == true ? URLEncoder.encode("风机故障", "UTF-8") : URLEncoder.encode("正常", "UTF-8"));
json.put("am", null != this.getAm() && this.getAm() == true ? URLEncoder.encode("远控", "UTF-8") : URLEncoder.encode("就地", "UTF-8"));
+ json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
+ json.put("amStat", null != this.getAm() && this.getAm() == true ? "1" : "0");
+ json.put("fltStat", null != this.getFlt() && this.getFlt() == true ? "1" : "0");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/db/data/PgJgStat.java b/src/com/szpg/db/data/PgJgStat.java
index b362a76..aaef788 100644
--- a/src/com/szpg/db/data/PgJgStat.java
+++ b/src/com/szpg/db/data/PgJgStat.java
@@ -108,7 +108,7 @@
json.put("time", this.getTmStr());
json.put("open", null != this.getJgopen() ? URLEncoder.encode(getJgopen(), "UTF-8") : "");
json.put("lock", null != this.getJglock() && this.getJglock() == true ? URLEncoder.encode("井盖锁定", "UTF-8") : URLEncoder.encode("井盖解锁", "UTF-8"));
- json.put("runStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
+ json.put("lockStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/rmi/RemoteWSCommandAction.java b/src/com/szpg/rmi/RemoteWSCommandAction.java
index 86eef30..3ddaa2c 100644
--- a/src/com/szpg/rmi/RemoteWSCommandAction.java
+++ b/src/com/szpg/rmi/RemoteWSCommandAction.java
@@ -39,7 +39,8 @@
private String wdThreshold;
private String sdThreshold;
-
+ private String threshold;
+
private String format;
private String jsoncallback;
@@ -69,6 +70,14 @@
this.sdThreshold = sdThreshold;
}
+ public String getThreshold() {
+ return threshold;
+ }
+
+ public void setThreshold(String threshold) {
+ this.threshold = threshold;
+ }
+
public String getFormat() {
return format;
}
@@ -422,6 +431,170 @@
}
}
+ public String setWSThreshold() throws Exception {
+ // 返回结果
+ JSONObject jResult = new JSONObject();
+
+ PgAcuDao acuDao = new PgAcuDaoImpl();
+ PgHjsbblDao blDao = new PgHjsbblDaoImpl();
+
+ if (null == zcbh || zcbh.equals("") == true) {
+ jResult.put("success", false);
+ jResult.put("code", "1");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("资产编号为空"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ String acucode = zcbh.substring(0, zcbh.indexOf(".", 6));
+ PgAcu acu = acuDao.findACUByCode(acucode);
+ if (null == acu) {
+ jResult.put("success", false);
+ jResult.put("code", "2");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到资产对应的PLC主机"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ ACUClient client = ACUClientUtil.getInstance().getClients().get(acu.getAcu_host() + ":" + acu.getAcu_port());
+ if (null != client) {
+ // 源地址
+ String sour = Configure.getProperty("sys", "LOCALHOST.NET") +
+ Configure.getProperty("sys", "LOCALHOST.NODE") +
+ Configure.getProperty("sys", "LOCALHOST.UNIT");
+
+ // 目标地址
+ String dest = client.getNet() + client.getNode() + client.getUnit();
+
+ // 温湿度阈值的数组
+ String[] thresholdArray = threshold.split(";");
+ try {
+ float wdt = Float.parseFloat(thresholdArray[0]);
+ float sdt = Float.parseFloat(thresholdArray[1]);
+ } catch (Exception ex) {
+ jResult.put("success", false);
+ jResult.put("code", "5");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("温湿度阈值解析异常"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 设置温度阈值
+ WriteMemoryCommand setWdCommand = WriteMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_SETWDTHRESHOLD);
+ PgHjsbbl temBlObj = blDao.findBlByBh(zcbh + ".TemSet");
+ if (null != temBlObj) {
+ // SID在new对象的时候已经生成
+
+ setWdCommand.setMessageProducerId(sour);
+ setWdCommand.setMessageProducerHost(client.getHost());
+ setWdCommand.setDestinationId(dest);
+ setWdCommand.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); //按字操作
+
+ int start = temBlObj.getKszdz();
+ int end = temBlObj.getJszdz();
+
+ // 开始字地址
+ setWdCommand.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(start, 2)) + "00");
+
+ // 字数
+ int n = end - start + 1;
+ setWdCommand.setCount(n);
+
+ // 字内容
+ Bytes dataByte = SetSensorThresholdService.parseValueToBytes((float) NumberFormat.parseDouble(thresholdArray[0], "0.00"), n, client.getFlag());
+ setWdCommand.setValue( dataByte.toBytes() );
+ ((SetWdThresholdWordCommand) setWdCommand).setThreshold(Float.parseFloat(thresholdArray[0]));
+
+ // 调用服务过程执行命令发送服务
+ SetSensorThresholdService service = new SetSensorThresholdService();
+ service.executeService(client, setWdCommand);
+ Logger.getLogger(this.getClass().getName()).info(setWdCommand);
+
+ jResult.put("success", true);
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("发送成功,请等待响应"));
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "4");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到对应变量"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 设置湿度阈值
+ WriteMemoryCommand setSdCommand = WriteMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_SETSDTHRESHOLD);
+ PgHjsbbl humBlObj = blDao.findBlByBh(zcbh + ".WetSet");
+ if (null != humBlObj) {
+ // SID在new对象的时候已经生成
+
+ setSdCommand.setMessageProducerId(sour);
+ setSdCommand.setMessageProducerHost(client.getHost());
+ setSdCommand.setDestinationId(dest);
+ setSdCommand.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); // 按字操作
+
+ int start = humBlObj.getKszdz();
+ int end = humBlObj.getJszdz();
+
+ // 开始字地址
+ setSdCommand.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(start, 2)) + "00");
+
+ // 字数
+ int n = end - start + 1;
+ setSdCommand.setCount(n);
+
+ // 字内容
+ Bytes dataByte = SetSensorThresholdService.parseValueToBytes((float) NumberFormat.parseDouble(thresholdArray[1], "0.00"), n, client.getFlag());
+ setSdCommand.setValue( dataByte.toBytes() );
+ ((SetSdThresholdWordCommand) setSdCommand).setThreshold(Float.parseFloat(thresholdArray[1]));
+
+ // 调用服务过程执行命令发送服务
+ SetSensorThresholdService service = new SetSensorThresholdService();
+ service.executeService(client, setSdCommand);
+ Logger.getLogger(this.getClass().getName()).info(setSdCommand);
+
+ jResult.put("success", true);
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("发送成功,请等待响应"));
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "4");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到对应变量"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 修改数据库中的报警阈值
+ PgAlarmRuleDao ruleDao = new PgAlarmRuleDaoImpl();
+ PgDeviceDao devDao = new PgDeviceDaoImpl();
+
+ int deviceId = devDao.findDeviceIdByCode(zcbh);
+ if (deviceId > 0) {
+ PgAlarmRule rule = ruleDao.findRuleByDevice(deviceId);
+ if (null != rule) {
+ try {
+ // 更新阈值
+ ruleDao.updateWSHighThresholdByDevice(deviceId, NumberFormat.parseDouble(thresholdArray[0], "0.00"), NumberFormat.parseDouble(thresholdArray[1], "0.00"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ returnToFront(jResult);
+ return null;
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "3");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("PLC主机不在线"));
+
+ returnToFront(jResult);
+ return null;
+ }
+ }
+
public String readWSValueFromDB() throws Exception {
// 返回结果
diff --git a/src/com/szpg/db/data/PgFjStat.java b/src/com/szpg/db/data/PgFjStat.java
index 3787e12..a32cd81 100644
--- a/src/com/szpg/db/data/PgFjStat.java
+++ b/src/com/szpg/db/data/PgFjStat.java
@@ -143,9 +143,11 @@
try {
json.put("time", this.getTmStr());
json.put("run", null != this.getRun() && this.getRun() == true ? URLEncoder.encode("风机启动", "UTF-8") : URLEncoder.encode("风机关闭", "UTF-8"));
- json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
json.put("flt", null != this.getFlt() && this.getFlt() == true ? URLEncoder.encode("风机故障", "UTF-8") : URLEncoder.encode("正常", "UTF-8"));
json.put("am", null != this.getAm() && this.getAm() == true ? URLEncoder.encode("远控", "UTF-8") : URLEncoder.encode("就地", "UTF-8"));
+ json.put("runStat", null != this.getRun() && this.getRun() == true ? "1" : "0");
+ json.put("amStat", null != this.getAm() && this.getAm() == true ? "1" : "0");
+ json.put("fltStat", null != this.getFlt() && this.getFlt() == true ? "1" : "0");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/db/data/PgJgStat.java b/src/com/szpg/db/data/PgJgStat.java
index b362a76..aaef788 100644
--- a/src/com/szpg/db/data/PgJgStat.java
+++ b/src/com/szpg/db/data/PgJgStat.java
@@ -108,7 +108,7 @@
json.put("time", this.getTmStr());
json.put("open", null != this.getJgopen() ? URLEncoder.encode(getJgopen(), "UTF-8") : "");
json.put("lock", null != this.getJglock() && this.getJglock() == true ? URLEncoder.encode("井盖锁定", "UTF-8") : URLEncoder.encode("井盖解锁", "UTF-8"));
- json.put("runStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
+ json.put("lockStat", null != this.getJglock() && this.getJglock() == true ? "0" : "1");
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
diff --git a/src/com/szpg/rmi/RemoteWSCommandAction.java b/src/com/szpg/rmi/RemoteWSCommandAction.java
index 86eef30..3ddaa2c 100644
--- a/src/com/szpg/rmi/RemoteWSCommandAction.java
+++ b/src/com/szpg/rmi/RemoteWSCommandAction.java
@@ -39,7 +39,8 @@
private String wdThreshold;
private String sdThreshold;
-
+ private String threshold;
+
private String format;
private String jsoncallback;
@@ -69,6 +70,14 @@
this.sdThreshold = sdThreshold;
}
+ public String getThreshold() {
+ return threshold;
+ }
+
+ public void setThreshold(String threshold) {
+ this.threshold = threshold;
+ }
+
public String getFormat() {
return format;
}
@@ -422,6 +431,170 @@
}
}
+ public String setWSThreshold() throws Exception {
+ // 返回结果
+ JSONObject jResult = new JSONObject();
+
+ PgAcuDao acuDao = new PgAcuDaoImpl();
+ PgHjsbblDao blDao = new PgHjsbblDaoImpl();
+
+ if (null == zcbh || zcbh.equals("") == true) {
+ jResult.put("success", false);
+ jResult.put("code", "1");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("资产编号为空"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ String acucode = zcbh.substring(0, zcbh.indexOf(".", 6));
+ PgAcu acu = acuDao.findACUByCode(acucode);
+ if (null == acu) {
+ jResult.put("success", false);
+ jResult.put("code", "2");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到资产对应的PLC主机"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ ACUClient client = ACUClientUtil.getInstance().getClients().get(acu.getAcu_host() + ":" + acu.getAcu_port());
+ if (null != client) {
+ // 源地址
+ String sour = Configure.getProperty("sys", "LOCALHOST.NET") +
+ Configure.getProperty("sys", "LOCALHOST.NODE") +
+ Configure.getProperty("sys", "LOCALHOST.UNIT");
+
+ // 目标地址
+ String dest = client.getNet() + client.getNode() + client.getUnit();
+
+ // 温湿度阈值的数组
+ String[] thresholdArray = threshold.split(";");
+ try {
+ float wdt = Float.parseFloat(thresholdArray[0]);
+ float sdt = Float.parseFloat(thresholdArray[1]);
+ } catch (Exception ex) {
+ jResult.put("success", false);
+ jResult.put("code", "5");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("温湿度阈值解析异常"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 设置温度阈值
+ WriteMemoryCommand setWdCommand = WriteMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_SETWDTHRESHOLD);
+ PgHjsbbl temBlObj = blDao.findBlByBh(zcbh + ".TemSet");
+ if (null != temBlObj) {
+ // SID在new对象的时候已经生成
+
+ setWdCommand.setMessageProducerId(sour);
+ setWdCommand.setMessageProducerHost(client.getHost());
+ setWdCommand.setDestinationId(dest);
+ setWdCommand.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); //按字操作
+
+ int start = temBlObj.getKszdz();
+ int end = temBlObj.getJszdz();
+
+ // 开始字地址
+ setWdCommand.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(start, 2)) + "00");
+
+ // 字数
+ int n = end - start + 1;
+ setWdCommand.setCount(n);
+
+ // 字内容
+ Bytes dataByte = SetSensorThresholdService.parseValueToBytes((float) NumberFormat.parseDouble(thresholdArray[0], "0.00"), n, client.getFlag());
+ setWdCommand.setValue( dataByte.toBytes() );
+ ((SetWdThresholdWordCommand) setWdCommand).setThreshold(Float.parseFloat(thresholdArray[0]));
+
+ // 调用服务过程执行命令发送服务
+ SetSensorThresholdService service = new SetSensorThresholdService();
+ service.executeService(client, setWdCommand);
+ Logger.getLogger(this.getClass().getName()).info(setWdCommand);
+
+ jResult.put("success", true);
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("发送成功,请等待响应"));
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "4");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到对应变量"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 设置湿度阈值
+ WriteMemoryCommand setSdCommand = WriteMemoryCommand.getInstance(AppMessageConstants.CMD_TYPE_SETSDTHRESHOLD);
+ PgHjsbbl humBlObj = blDao.findBlByBh(zcbh + ".WetSet");
+ if (null != humBlObj) {
+ // SID在new对象的时候已经生成
+
+ setSdCommand.setMessageProducerId(sour);
+ setSdCommand.setMessageProducerHost(client.getHost());
+ setSdCommand.setDestinationId(dest);
+ setSdCommand.setMemoryArea(FINSConstants.MEMORY_WORK_AREA_WORD); // 按字操作
+
+ int start = humBlObj.getKszdz();
+ int end = humBlObj.getJszdz();
+
+ // 开始字地址
+ setSdCommand.setStartAddress(ByteUtil.binToHexString(ByteUtil.intToBins(start, 2)) + "00");
+
+ // 字数
+ int n = end - start + 1;
+ setSdCommand.setCount(n);
+
+ // 字内容
+ Bytes dataByte = SetSensorThresholdService.parseValueToBytes((float) NumberFormat.parseDouble(thresholdArray[1], "0.00"), n, client.getFlag());
+ setSdCommand.setValue( dataByte.toBytes() );
+ ((SetSdThresholdWordCommand) setSdCommand).setThreshold(Float.parseFloat(thresholdArray[1]));
+
+ // 调用服务过程执行命令发送服务
+ SetSensorThresholdService service = new SetSensorThresholdService();
+ service.executeService(client, setSdCommand);
+ Logger.getLogger(this.getClass().getName()).info(setSdCommand);
+
+ jResult.put("success", true);
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("发送成功,请等待响应"));
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "4");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("未找到对应变量"));
+
+ returnToFront(jResult);
+ return null;
+ }
+
+ // 修改数据库中的报警阈值
+ PgAlarmRuleDao ruleDao = new PgAlarmRuleDaoImpl();
+ PgDeviceDao devDao = new PgDeviceDaoImpl();
+
+ int deviceId = devDao.findDeviceIdByCode(zcbh);
+ if (deviceId > 0) {
+ PgAlarmRule rule = ruleDao.findRuleByDevice(deviceId);
+ if (null != rule) {
+ try {
+ // 更新阈值
+ ruleDao.updateWSHighThresholdByDevice(deviceId, NumberFormat.parseDouble(thresholdArray[0], "0.00"), NumberFormat.parseDouble(thresholdArray[1], "0.00"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ returnToFront(jResult);
+ return null;
+ } else {
+ jResult.put("success", false);
+ jResult.put("code", "3");
+ jResult.put("resaon", UnicodeConvertor.string2Unicode("PLC主机不在线"));
+
+ returnToFront(jResult);
+ return null;
+ }
+ }
+
public String readWSValueFromDB() throws Exception {
// 返回结果
diff --git a/src/struts.xml b/src/struts.xml
index 87c3769..c80eab8 100644
--- a/src/struts.xml
+++ b/src/struts.xml
@@ -7,6 +7,7 @@
+