This commit is contained in:
2022-06-30 10:50:07 +08:00
parent 22fac97060
commit ca134703bf
2 changed files with 21 additions and 15 deletions

View File

@@ -77,29 +77,28 @@ public class Test3 extends BaseTest {
String now = DateUtil.now();
WQLObject tab= WQLObject.getWQLObject("acs_opc");
WQLObject tab_plc= WQLObject.getWQLObject("acs_opc_plc");
JSONArray resultJSONArray = tab.query("opc_code like '%TW'","opc_code").getResultJSONArray(0);
/* for (int i = 3; i < resultJSONArray.size(); i++) {
final JSONObject jsonObject = resultJSONArray.getJSONObject(i);
JSONArray resultJSONArray = tab.query("opc_code like 'XY%'","opc_code").getResultJSONArray(0);
for (int i = 0; i < resultJSONArray.size(); i++) {
JSONObject jsonObject = resultJSONArray.getJSONObject(i);
JSONObject map = new JSONObject();
map.put("plc_id",IdUtil.simpleUUID());
map.put("plc_code",jsonObject.getString("opc_code"));
map.put("plc_name",jsonObject.getString("opc_name"));
map.put("opc_server_id",jsonObject.getString("opc_id"));
if (i <= 28){
map.put("plc_host","192.168.47." + (162 + i));
}
if (i > 28 && i <= 42){
map.put("plc_host","192.168.47." + (51 + i));
/* if (i >= 12 && i < 21){
map.put("plc_host","192.168.47." + (102 + i));
}
if (i > 42 && i <= 57){
map.put("plc_host","192.168.47." + (51 + i));
}
}*/
map.put("create_by",currentUsername);
map.put("create_time",now);
map.put("update_by",currentUsername);
map.put("update_name",now);
tab_plc.insert(map);
}*/
}
/* for (int i = 5; i < 29; i++) {
JSONObject map = new JSONObject();
map.put("opc_id",IdUtil.simpleUUID());
@@ -122,15 +121,15 @@ public class Test3 extends BaseTest {
map.put("update_name",now);
tab.insert(map);
}*/
for (int i = 1; i <= 13; i++) {
/* for (int i = 1; i <= 21; i++) {
JSONObject map = new JSONObject();
map.put("opc_id",IdUtil.simpleUUID());
if (i < 10){
map.put("opc_code","KZ0"+i);
map.put("opc_code","XY0"+i);
map.put("opc_name","KZ0"+i);
} else {
map.put("opc_code","KZ"+i);
map.put("opc_name","KZ"+i);
map.put("opc_code","XY"+i);
map.put("opc_name","XY"+i);
}
map.put("opc_host","192.168.46.225");
map.put("user","administrator");
@@ -143,7 +142,7 @@ public class Test3 extends BaseTest {
map.put("update_by",currentUsername);
map.put("update_name",now);
tab.insert(map);
}
}*/
}
@Test