|
@ -110,15 +110,26 @@ public class PointUpdateUtil { |
|
|
devices.add(device); |
|
|
devices.add(device); |
|
|
// 向ACS查询点位状态
|
|
|
// 向ACS查询点位状态
|
|
|
JSONObject deviceStatus = wmsToAcsService.getPointStatus(devices); |
|
|
JSONObject deviceStatus = wmsToAcsService.getPointStatus(devices); |
|
|
if (ObjectUtil.isEmpty(deviceStatus.get("data"))) return DeviceStatusEnum.SHUTDOWN.getCode(); |
|
|
if (ObjectUtil.isEmpty(deviceStatus.get("data"))) { |
|
|
JSONArray statusJSONArray = deviceStatus.getJSONArray("data"); |
|
|
return DeviceStatusEnum.SHUTDOWN.getCode(); |
|
|
if (ObjectUtil.isEmpty(statusJSONArray)) return DeviceStatusEnum.SHUTDOWN.getCode(); |
|
|
} |
|
|
|
|
|
JSONArray statusJSONArray = null; |
|
|
|
|
|
try { |
|
|
|
|
|
statusJSONArray = deviceStatus.getJSONArray("data"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return DeviceStatusEnum.SHUTDOWN.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
if (ObjectUtil.isEmpty(statusJSONArray)) { |
|
|
|
|
|
return DeviceStatusEnum.SHUTDOWN.getCode(); |
|
|
|
|
|
} |
|
|
JSONObject deviceJson = statusJSONArray.getJSONObject(0); |
|
|
JSONObject deviceJson = statusJSONArray.getJSONObject(0); |
|
|
String point_code = deviceJson.getString("device_code"); |
|
|
String point_code = deviceJson.getString("device_code"); |
|
|
String mode = deviceJson.getString("mode"); // 工作状态:0脱机,其他正常
|
|
|
String mode = deviceJson.getString("mode"); // 工作状态:0脱机,其他正常
|
|
|
String error = deviceJson.getString("error"); // 0是正常
|
|
|
String error = deviceJson.getString("error"); // 0是正常
|
|
|
log.info("device_code: " + point_code + ", mode: " + mode + ", error: " + error); |
|
|
log.info("device_code: " + point_code + ", mode: " + mode + ", error: " + error); |
|
|
if (!error.equals("0")) return DeviceStatusEnum.FAILURE.getCode(); |
|
|
if (!error.equals("0")) { |
|
|
|
|
|
return DeviceStatusEnum.FAILURE.getCode(); |
|
|
|
|
|
} |
|
|
return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode(); |
|
|
return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|