|
@ -2,6 +2,7 @@ package org.nl.wms.cockpit.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import lombok.Data; |
|
|
import lombok.Data; |
|
@ -191,8 +192,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
List<FailureDeviceInfoDto> res = new CopyOnWriteArrayList<>(); |
|
|
List<FailureDeviceInfoDto> res = new CopyOnWriteArrayList<>(); |
|
|
for (int i = 0; i < 5; i++) { |
|
|
for (int i = 0; i < 5; i++) { |
|
|
FailureDeviceInfoDto dto = new FailureDeviceInfoDto(); |
|
|
FailureDeviceInfoDto dto = new FailureDeviceInfoDto(); |
|
|
dto.setDevice_code("hn01"); |
|
|
dto.setDevice_code("hl01"); |
|
|
dto.setDevice_name("混撵01"); |
|
|
dto.setDevice_name("混料01"); |
|
|
dto.setFailure_time("05-30 09:50:12"); |
|
|
dto.setFailure_time("05-30 09:50:12"); |
|
|
dto.setFailure_info("机器故障"); |
|
|
dto.setFailure_info("机器故障"); |
|
|
dto.setDevice_status_name("待机"); |
|
|
dto.setDevice_status_name("待机"); |
|
@ -217,6 +218,25 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// 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++) {
|
|
|
|
|
|
// JSONObject jsonObject = data.getJSONObject(i);
|
|
|
|
|
|
// if (jsonObject.getInteger("move") == 1
|
|
|
|
|
|
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
|
|
|
|
|
|
// && jsonObject.getInteger("encoder_qty") > 0) {
|
|
|
|
|
|
// // 绿色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
|
|
|
|
|
|
// } else if (jsonObject.getInteger("move") == 1
|
|
|
|
|
|
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
|
|
|
|
|
|
// && jsonObject.getInteger("encoder_qty") == 0) {
|
|
|
|
|
|
// // 黄色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.YELLOW.getIndex());
|
|
|
|
|
|
// } else if (jsonObject.getInteger("move") == 0) {
|
|
|
|
|
|
// // 红色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.RED.getIndex());
|
|
|
|
|
|
// } else { // 有托盘人工
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
jsonObject.put("color_status", ColorEnum.RED.getIndex()); |
|
|
jsonObject.put("color_status", ColorEnum.RED.getIndex()); |
|
@ -263,12 +283,19 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("open_time", DateUtil.now()); |
|
|
String now = DateUtil.now(); |
|
|
|
|
|
jsonObject.put("open_time", now.substring(now.indexOf('-') + 1)); |
|
|
} |
|
|
} |
|
|
// todo: 打开ACS系统对接数据
|
|
|
// todo: 打开ACS系统对接数据
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// 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++) {
|
|
|
|
|
|
// JSONObject jsonObject = data.getJSONObject(i);
|
|
|
|
|
|
// jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode());
|
|
|
|
|
|
// String openTime = jsonObject.getString("open_time");
|
|
|
|
|
|
// jsonObject.put("open_time", openTime.substring(openTime.indexOf('-') + 1));
|
|
|
|
|
|
// }
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
mixMachineTask.thenAccept(result -> { |
|
|
mixMachineTask.thenAccept(result -> { |
|
@ -352,6 +379,25 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
// 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++) {
|
|
|
|
|
|
// JSONObject jsonObject = data.getJSONObject(i);
|
|
|
|
|
|
// if (jsonObject.getInteger("move") == 1
|
|
|
|
|
|
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
|
|
|
|
|
|
// && jsonObject.getInteger("encoder_qty") > 0) {
|
|
|
|
|
|
// // 绿色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
|
|
|
|
|
|
// } else if (jsonObject.getInteger("move") == 1
|
|
|
|
|
|
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
|
|
|
|
|
|
// && jsonObject.getInteger("encoder_qty") == 0) {
|
|
|
|
|
|
// // 黄色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.YELLOW.getIndex());
|
|
|
|
|
|
// } else if (jsonObject.getInteger("move") == 0) {
|
|
|
|
|
|
// // 红色
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.RED.getIndex());
|
|
|
|
|
|
// } else { // 有托盘人工
|
|
|
|
|
|
// jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
sortAndPalletizingTask.thenAccept(result -> { |
|
|
sortAndPalletizingTask.thenAccept(result -> { |
|
@ -361,6 +407,29 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("SortAndPalletizingList", null); |
|
|
map.put("SortAndPalletizingList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
|
|
|
// 15、机械手状态
|
|
|
|
|
|
CompletableFuture<JSONArray> manipulatorInfoTask = CompletableFuture.supplyAsync(() -> { |
|
|
|
|
|
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") |
|
|
|
|
|
.addParamMap(MapOf.of("flag", "14")) |
|
|
|
|
|
.process() |
|
|
|
|
|
.getResultJSONArray(0); |
|
|
|
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
|
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
|
|
|
jsonObject.put("color_status", ColorEnum.RED.getIndex()); |
|
|
|
|
|
} |
|
|
|
|
|
// TODO: 打开ACS系统对接数据
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
|
|
|
return res; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
manipulatorInfoTask.thenAccept(result -> { |
|
|
|
|
|
map.put("ManipulatorInfoList", result); |
|
|
|
|
|
}).exceptionally((e) -> { |
|
|
|
|
|
log.error("机械手: {}", e.getMessage(), e); |
|
|
|
|
|
map.put("ManipulatorInfoList", null); |
|
|
|
|
|
return null; |
|
|
|
|
|
}); |
|
|
CompletableFuture<Void> allQuery = CompletableFuture.allOf( |
|
|
CompletableFuture<Void> allQuery = CompletableFuture.allOf( |
|
|
mixDayProductionTask, |
|
|
mixDayProductionTask, |
|
|
pressDayProductionTask, |
|
|
pressDayProductionTask, |
|
@ -373,7 +442,8 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
mixMachineTask, |
|
|
mixMachineTask, |
|
|
trappedShelfTask, |
|
|
trappedShelfTask, |
|
|
sortAndPalletizingTask, |
|
|
sortAndPalletizingTask, |
|
|
semiFinishedProductShelfTask); |
|
|
semiFinishedProductShelfTask, |
|
|
|
|
|
manipulatorInfoTask); |
|
|
CompletableFuture<ConcurrentHashMap<String, Object>> future |
|
|
CompletableFuture<ConcurrentHashMap<String, Object>> future |
|
|
= allQuery.thenApply((result) -> map).exceptionally((e) -> { |
|
|
= allQuery.thenApply((result) -> map).exceptionally((e) -> { |
|
|
log.error(e.getMessage(), e); |
|
|
log.error(e.getMessage(), e); |
|
|