|
@@ -187,6 +187,25 @@ public class OpcDaUtil {
|
|
return jsonList;
|
|
return jsonList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static List<JSONObject> generPAS300Tree(Server server) throws JIException, UnknownHostException {
|
|
|
|
+ List<JSONObject> jsonList = new ArrayList<>();
|
|
|
|
+ //获取服务器下所有ITEM列表,树形展示
|
|
|
|
+ TreeBrowser treeBrowser = server.getTreeBrowser();
|
|
|
|
+ Branch browse = treeBrowser.browse();
|
|
|
|
+ if (Blank.isEmpty(browse)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ Collection<Leaf> leaves = browse.getLeaves();
|
|
|
|
+ List<String> leafNameList = new ArrayList<>();
|
|
|
|
+ if (Blank.isNotEmpty(leaves)) {
|
|
|
|
+ for (Leaf leaf : leaves) {
|
|
|
|
+ leafNameList.add(leaf.getName());
|
|
|
|
+ }
|
|
|
|
+ Collections.reverse(leafNameList);
|
|
|
|
+ }
|
|
|
|
+ return jsonList;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static List<JSONObject> recursionServerChildren(Collection<Branch> branchCollection) {
|
|
public static List<JSONObject> recursionServerChildren(Collection<Branch> branchCollection) {
|
|
List<JSONObject> jsonList = new ArrayList<>();
|
|
List<JSONObject> jsonList = new ArrayList<>();
|
|
for (Branch branch : branchCollection) {
|
|
for (Branch branch : branchCollection) {
|
|
@@ -266,11 +285,16 @@ public class OpcDaUtil {
|
|
|
|
|
|
public static List<Item> genReadNameDa(DataSource dataSource, List<Item> itemList) {
|
|
public static List<Item> genReadNameDa(DataSource dataSource, List<Item> itemList) {
|
|
if (dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.KEPSERVER.getValue()) ||
|
|
if (dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.KEPSERVER.getValue()) ||
|
|
- dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.SCADA.getValue())
|
|
|
|
|
|
+ dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.SCADA.getValue()) ||
|
|
|
|
+ dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.PAS300.getValue())
|
|
) {
|
|
) {
|
|
for (int i = 0; i < itemList.size(); i++) {
|
|
for (int i = 0; i < itemList.size(); i++) {
|
|
itemList.get(i).setItemReadName(itemList.get(i).getItemName());
|
|
itemList.get(i).setItemReadName(itemList.get(i).getItemName());
|
|
}
|
|
}
|
|
|
|
+ } else if (dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.YOKOGAWA.getValue())) {
|
|
|
|
+ for (int i = 0; i < itemList.size(); i++) {
|
|
|
|
+ itemList.get(i).setItemReadName(itemList.get(i).getItemName().replace(".", "!"));
|
|
|
|
+ }
|
|
} else if (dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.OPCIFIX.getValue())) {
|
|
} else if (dataSource.getClsId().toUpperCase().equals(OpcDaDriverEnum.OPCIFIX.getValue())) {
|
|
for (int i = 0; i < itemList.size(); i++) {
|
|
for (int i = 0; i < itemList.size(); i++) {
|
|
String itemName = itemList.get(i).getItemName();
|
|
String itemName = itemList.get(i).getItemName();
|
|
@@ -437,14 +461,15 @@ public class OpcDaUtil {
|
|
}
|
|
}
|
|
|
|
|
|
public static String genException(String message) {
|
|
public static String genException(String message) {
|
|
- if (Blank.isEmpty(message)){
|
|
|
|
|
|
+ if (Blank.isEmpty(message)) {
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
if (message.contains("0x00000005")) {
|
|
if (message.contains("0x00000005")) {
|
|
return "账号或密码错误";
|
|
return "账号或密码错误";
|
|
} else if (message.contains("0x8001FFFF")) {
|
|
} else if (message.contains("0x8001FFFF")) {
|
|
return "ip连接不可用";
|
|
return "ip连接不可用";
|
|
- } else if (message.contains("Index 16 out of bounds for length 16")) {
|
|
|
|
|
|
+ } else if (message.contains("Index 16 out of bounds for length 16") ||
|
|
|
|
+ message.contains("java.lang.ArrayIndexOutOfBoundsException: 16")) {
|
|
return "服务未启动";
|
|
return "服务未启动";
|
|
} else if (message.contains("0x80070005")) {
|
|
} else if (message.contains("0x80070005")) {
|
|
return "访问被拒绝,可能是权限未配置,配置可在组件服务中进行配置";
|
|
return "访问被拒绝,可能是权限未配置,配置可在组件服务中进行配置";
|