|
@ -127,8 +127,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : result; |
|
|
// 初始化数据 数组下标:0关机 1待机 2生产中 3故障
|
|
|
// 初始化数据 数组下标:0关机 1待机 2生产中 3故障
|
|
|
JSONObject total = new JSONObject(); |
|
|
JSONObject total = new JSONObject(); |
|
|
DeviceEnum[] values = DeviceEnum.values(); |
|
|
DeviceEnum[] values = DeviceEnum.values(); |
|
@ -138,8 +138,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
// 遍历判断
|
|
|
// 遍历判断
|
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("status")) |
|
|
? device.getInteger("devices_status") |
|
|
? device.getInteger("status") |
|
|
: 0; |
|
|
: 0; |
|
|
String regionCode = device.getString("region_code"); |
|
|
String regionCode = device.getString("region_code"); |
|
|
DeviceEnum deviceEnumByCode = DeviceEnum.getDeviceEnumByCode(regionCode); // 获取属于哪种设备
|
|
|
DeviceEnum deviceEnumByCode = DeviceEnum.getDeviceEnumByCode(regionCode); // 获取属于哪种设备
|
|
@ -168,16 +168,13 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// TODO: 5、近一个月故障次数前5台设备
|
|
|
// TODO: 5、近一个月故障次数前5台设备
|
|
|
CompletableFuture<List<OperationConditionDto>> lastMonthFailureTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> lastMonthFailureTask = CompletableFuture.supplyAsync(() -> { |
|
|
List<OperationConditionDto> res = new ArrayList<>(); |
|
|
// 获取所有设备
|
|
|
Random random = new Random(); |
|
|
JSONArray result = WQL.getWO("COCKPIT_DEVICE") |
|
|
for (int i = 0; i < 5; i++) { |
|
|
.addParam("flag", "6") |
|
|
OperationConditionDto dto = new OperationConditionDto(); |
|
|
.process() |
|
|
dto.setDevice_name("机器" + (i + 1)); |
|
|
.getResultJSONArray(0); |
|
|
dto.setFailure(random.nextInt(30 - 10 + 1) + 10); |
|
|
return result; |
|
|
res.add(dto); |
|
|
|
|
|
} |
|
|
|
|
|
return res; |
|
|
|
|
|
}, pool); |
|
|
}, pool); |
|
|
lastMonthFailureTask.thenAccept(result -> { |
|
|
lastMonthFailureTask.thenAccept(result -> { |
|
|
map.put("LastMonthFailureList", result); |
|
|
map.put("LastMonthFailureList", result); |
|
@ -187,18 +184,12 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// TODO: 6、最近10次设备故障
|
|
|
// TODO: 6、最近10次设备故障
|
|
|
CompletableFuture<List<FailureDeviceInfoDto>> lastTenFailureTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> lastTenFailureTask = CompletableFuture.supplyAsync(() -> { |
|
|
List<FailureDeviceInfoDto> res = new CopyOnWriteArrayList<>(); |
|
|
JSONArray result = WQL.getWO("COCKPIT_DEVICE") |
|
|
for (int i = 0; i < 5; i++) { |
|
|
.addParam("flag", "5") |
|
|
FailureDeviceInfoDto dto = new FailureDeviceInfoDto(); |
|
|
.process() |
|
|
dto.setDevice_code("hl01"); |
|
|
.getResultJSONArray(0); |
|
|
dto.setDevice_name("混料01"); |
|
|
return result; |
|
|
dto.setFailure_time("05-30 09:50:12"); |
|
|
|
|
|
dto.setFailure_info("机器故障"); |
|
|
|
|
|
dto.setDevice_status_name("待机"); |
|
|
|
|
|
res.add(dto); |
|
|
|
|
|
} |
|
|
|
|
|
return res; |
|
|
|
|
|
}, pool); |
|
|
}, pool); |
|
|
lastTenFailureTask.thenAccept(result -> { |
|
|
lastTenFailureTask.thenAccept(result -> { |
|
|
map.put("LastTenFailureList", result); |
|
|
map.put("LastTenFailureList", result); |
|
@ -214,6 +205,7 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
|
|
|
// JSONObject devicesStatus = null;
|
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
@ -251,8 +243,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
return data; |
|
|
return data; |
|
|
}, pool); |
|
|
}, pool); |
|
|
pressMachineTask.thenAccept(result -> { |
|
|
pressMachineTask.thenAccept(result -> { |
|
@ -269,8 +261,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject jsonObject = data.getJSONObject(i); |
|
|
JSONObject jsonObject = data.getJSONObject(i); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
@ -353,8 +345,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject jsonObject = data.getJSONObject(i); |
|
|
JSONObject jsonObject = data.getJSONObject(i); |
|
|
if (jsonObject.getInteger("move") == 1 |
|
|
if (jsonObject.getInteger("move") == 1 |
|
@ -390,8 +382,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
return data; |
|
|
return data; |
|
|
}, pool); |
|
|
}, pool); |
|
|
manipulatorInfoTask.thenAccept(result -> { |
|
|
manipulatorInfoTask.thenAccept(result -> { |
|
@ -824,8 +816,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "2")) |
|
|
JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "2")) |
|
|
.process().getResultJSONArray(0); |
|
|
.process().getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
@ -950,8 +942,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "4")) |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "4")) |
|
|
.process().getResultJSONArray(0); |
|
|
.process().getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
@ -974,8 +966,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "5")) |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "5")) |
|
|
.process().getResultJSONArray(0); |
|
|
.process().getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
return data; |
|
|
return data; |
|
|
}, pool); |
|
|
}, pool); |
|
|
trayStationPopoverTask.thenAccept(result -> { |
|
|
trayStationPopoverTask.thenAccept(result -> { |
|
@ -990,8 +982,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "6")) |
|
|
JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "6")) |
|
|
.process().getResultJSONArray(0); |
|
|
.process().getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
@ -1061,7 +1053,7 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
moldingIOStoringTask.thenAccept(result -> { |
|
|
moldingIOStoringTask.thenAccept(result -> { |
|
|
map.put("MoldingIOStoringList", result); |
|
|
map.put("MoldingIOStoringList", result); |
|
|
}).exceptionally((e) -> { |
|
|
}).exceptionally((e) -> { |
|
|
log.error("获取半成品货架信息: {}", e.getMessage(), e); |
|
|
log.error("获取成型出入库信息: {}", e.getMessage(), e); |
|
|
map.put("MoldingIOStoringList", null); |
|
|
map.put("MoldingIOStoringList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
@ -1108,16 +1100,10 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("SemiFinishedIOList", null); |
|
|
map.put("SemiFinishedIOList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// todo: 3、烧制窑内物料
|
|
|
// 3、烧制窑内物料
|
|
|
CompletableFuture<JSONArray> fireInTheKilnTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> fireInTheKilnTask = CompletableFuture.supplyAsync(() -> { |
|
|
JSONArray res = new JSONArray(); |
|
|
JSONArray res = WQL.getWO("COCKPIT_FIR_AND_DRY").addParamMap(MapOf.of("flag", "4")) |
|
|
Random random = new Random(); |
|
|
.process().getResultJSONArray(0); |
|
|
for (int i = 1; i <= 5; i++) { |
|
|
|
|
|
JSONObject r = new JSONObject(); |
|
|
|
|
|
r.put("qty", random.nextInt(2000 - 100 + 1) + 100); |
|
|
|
|
|
r.put("material_code", "物料" + i); |
|
|
|
|
|
res.add(r); |
|
|
|
|
|
} |
|
|
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
fireInTheKilnTask.thenAccept(result -> { |
|
|
fireInTheKilnTask.thenAccept(result -> { |
|
@ -1127,16 +1113,10 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("FireInTheKilnList", null); |
|
|
map.put("FireInTheKilnList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// todo: 4、冷却窑内物料
|
|
|
// 4、冷却窑内物料
|
|
|
CompletableFuture<JSONArray> coolingInTheKilnTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> coolingInTheKilnTask = CompletableFuture.supplyAsync(() -> { |
|
|
JSONArray res = new JSONArray(); |
|
|
JSONArray res = WQL.getWO("COCKPIT_FIR_AND_DRY").addParamMap(MapOf.of("flag", "5")) |
|
|
Random random = new Random(); |
|
|
.process().getResultJSONArray(0); |
|
|
for (int i = 1; i <= 5; i++) { |
|
|
|
|
|
JSONObject r = new JSONObject(); |
|
|
|
|
|
r.put("qty", random.nextInt(2000 - 100 + 1) + 100); |
|
|
|
|
|
r.put("material_code", "物料" + i); |
|
|
|
|
|
res.add(r); |
|
|
|
|
|
} |
|
|
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
coolingInTheKilnTask.thenAccept(result -> { |
|
|
coolingInTheKilnTask.thenAccept(result -> { |
|
@ -1292,8 +1272,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "5")) |
|
|
JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "5")) |
|
|
.process().getResultJSONArray(0); |
|
|
.process().getResultJSONArray(0); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); |
|
|
JSONArray data = ObjectUtil.isNotEmpty( |
|
|
// JSONObject devicesStatus = null;
|
|
|
devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; |
|
|
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res; |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
JSONObject device = data.getJSONObject(i); |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|