fix: 修复大屏数据
This commit is contained in:
@@ -2,6 +2,7 @@ package org.nl.wms.cockpit.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
@@ -191,8 +192,8 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
List<FailureDeviceInfoDto> res = new CopyOnWriteArrayList<>();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
FailureDeviceInfoDto dto = new FailureDeviceInfoDto();
|
||||
dto.setDevice_code("hn01");
|
||||
dto.setDevice_name("混撵01");
|
||||
dto.setDevice_code("hl01");
|
||||
dto.setDevice_name("混料01");
|
||||
dto.setFailure_time("05-30 09:50:12");
|
||||
dto.setFailure_info("机器故障");
|
||||
dto.setDevice_status_name("待机");
|
||||
@@ -217,6 +218,25 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
||||
// JSONArray data = ObjectUtil.isNotEmpty(
|
||||
// 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++) {
|
||||
JSONObject jsonObject = res.getJSONObject(i);
|
||||
jsonObject.put("color_status", ColorEnum.RED.getIndex());
|
||||
@@ -263,12 +283,19 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
for (int i = 0; i < res.size(); i++) {
|
||||
JSONObject jsonObject = res.getJSONObject(i);
|
||||
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系统对接数据
|
||||
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
||||
// JSONArray data = ObjectUtil.isNotEmpty(
|
||||
// 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;
|
||||
}, pool);
|
||||
mixMachineTask.thenAccept(result -> {
|
||||
@@ -352,6 +379,25 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
||||
// JSONArray data = ObjectUtil.isNotEmpty(
|
||||
// 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;
|
||||
}, pool);
|
||||
sortAndPalletizingTask.thenAccept(result -> {
|
||||
@@ -361,6 +407,29 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
map.put("SortAndPalletizingList", 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(
|
||||
mixDayProductionTask,
|
||||
pressDayProductionTask,
|
||||
@@ -373,7 +442,8 @@ public class BigScreenServiceImpl implements BigScreenService {
|
||||
mixMachineTask,
|
||||
trappedShelfTask,
|
||||
sortAndPalletizingTask,
|
||||
semiFinishedProductShelfTask);
|
||||
semiFinishedProductShelfTask,
|
||||
manipulatorInfoTask);
|
||||
CompletableFuture<ConcurrentHashMap<String, Object>> future
|
||||
= allQuery.thenApply((result) -> map).exceptionally((e) -> {
|
||||
log.error(e.getMessage(), e);
|
||||
|
||||
@@ -237,6 +237,7 @@
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
d.device_code,
|
||||
d.device_name,
|
||||
LEFT(m.material_code, 11) AS material_code,
|
||||
(
|
||||
SELECT IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0)
|
||||
@@ -276,23 +277,38 @@
|
||||
IF 输入.flag = "12"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
point.point_code,
|
||||
point.point_name,
|
||||
CASE point.point_status
|
||||
WHEN '0' THEN '0'
|
||||
WHEN '1' THEN IF(vd.vd_id IS NULL,'1','2')
|
||||
ELSE '0'
|
||||
END AS point_status
|
||||
point.point_code,
|
||||
point.point_name,
|
||||
CASE point.point_status
|
||||
WHEN '0' THEN '0'
|
||||
WHEN '1' THEN IF(vd.vd_id IS NULL,'1','2')
|
||||
ELSE '0'
|
||||
END AS point_status,
|
||||
IF(LENGTH( vd.stand_status )> 0,vd.stand_status,'') AS stand_status,
|
||||
CASE vd.stand_status
|
||||
WHEN '2' THEN '困料中'
|
||||
WHEN '3' THEN '困料完成'
|
||||
WHEN '4' THEN '困料完成'
|
||||
WHEN '5' THEN '困料超时'
|
||||
ELSE ''
|
||||
END AS stand_status_name,
|
||||
CASE vd.stand_status
|
||||
WHEN '2' THEN '1'
|
||||
WHEN '3' THEN '2'
|
||||
WHEN '4' THEN '2'
|
||||
WHEN '5' THEN '3'
|
||||
ELSE ''
|
||||
END AS stand_status_color
|
||||
FROM
|
||||
sch_base_point point
|
||||
LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code
|
||||
AND vd.vehicle_type = point.vehicle_type
|
||||
AND vd.is_delete = '0'
|
||||
sch_base_point point
|
||||
LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = point.vehicle_code
|
||||
AND vd.vehicle_type = point.vehicle_type
|
||||
AND vd.is_delete = '0'
|
||||
WHERE
|
||||
point.region_code = 'KLHJ'
|
||||
AND point.point_type IN ('2','3')
|
||||
point.region_code = 'KLHJ'
|
||||
AND point.point_type IN ('2','3')
|
||||
ORDER BY
|
||||
point.point_code ASC
|
||||
point.point_code ASC
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -310,3 +326,19 @@
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "14"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
d.device_code,
|
||||
d.device_name,
|
||||
d.region_code
|
||||
FROM
|
||||
`pdm_bi_device` d
|
||||
WHERE ((d.region_code = 'YZ' AND d.device_model = '5')
|
||||
OR (d.region_code = 'FJ' AND d.device_model = '9'))
|
||||
AND d.device_code <> 'FJRGCD01'
|
||||
ORDER BY d.device_model, d.region_code, d.device_code
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user