更新设备驱动多选下拉框

This commit is contained in:
USER-20220102CG\noblelift
2022-08-16 15:50:32 +08:00
parent 354134b83e
commit 005ec3b919
3 changed files with 22 additions and 11 deletions

View File

@@ -222,7 +222,7 @@ public interface DeviceService {
*
* @param device_id
*/
JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
net.sf.json.JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code);
/**
* DB测试读

View File

@@ -1150,15 +1150,15 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
@Override
public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
final JSONObject extraObj = new JSONObject();
public net.sf.json.JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) {
final net.sf.json.JSONObject extraObj = new net.sf.json.JSONObject();
DeviceDto dto = this.findById(device_id);
if (ObjectUtil.isNull(dto)) {
return new JSONObject();
return new net.sf.json.JSONObject();
}
log.info("判断设备是否配置过驱动!");
//处理设备扩展属性
JSONObject result = new JSONObject();
net.sf.json.JSONObject result = new net.sf.json.JSONObject();
//根据设备驱动定义获取OPC读写数据
DeviceDriverDefination deviceDriverDefination = deviceDriverDefinationAppService.getDeviceDriverDefination(driver_code);
@@ -1173,13 +1173,24 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
JSONArray arr = WQLObject.getWQLObject("acs_device_extra").query("filed_type ='01' and device_id = '" + device_id + "'").getResultJSONArray(0);
// for (int i = 0; i < arr.size(); i++) {
// final JSONObject json = arr.getJSONObject(i);
// if ("true".equalsIgnoreCase(json.getString("extra_value")) ||
// "false".equalsIgnoreCase(json.getString("extra_value"))) {
// extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value"));
// } else {
// extraObj.put(json.getString("extra_code"), json.get("extra_value"));
// }
// }
for (int i = 0; i < arr.size(); i++) {
final JSONObject json = arr.getJSONObject(i);
if ("true".equalsIgnoreCase(json.getString("extra_value")) ||
"false".equalsIgnoreCase(json.getString("extra_value"))) {
extraObj.put(json.getString("extra_code"), json.getBoolean("extra_value"));
final net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(arr.get(i));
if ("true".equalsIgnoreCase(json.optString("extra_value")) ||
"false".equalsIgnoreCase(json.optString("extra_value"))) {
extraObj.put(json.optString("extra_code"), json.optBoolean("extra_value"));
} else {
extraObj.put(json.getString("extra_code"), json.get("extra_value"));
extraObj.put(json.optString("extra_code"), json.opt("extra_value"));
}
}

View File

@@ -132,7 +132,7 @@ public class ItemProtocol {
} else {
return value;
}
return "0";
return "";
}
public static List<ItemDto> getReadableItemDtos() {