|
@ -4,9 +4,11 @@ import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
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.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.nl.config.thread.ThreadPoolExecutorUtil; |
|
|
import org.nl.config.thread.ThreadPoolExecutorUtil; |
|
|
|
|
|
import org.nl.modules.common.utils.PointUpdateUtil; |
|
|
import org.nl.modules.wql.WQL; |
|
|
import org.nl.modules.wql.WQL; |
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
import org.nl.wms.cockpit.service.BigScreenService; |
|
|
import org.nl.wms.cockpit.service.BigScreenService; |
|
@ -114,17 +116,46 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("CPDayList", null); |
|
|
map.put("CPDayList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// TODO: 4、设备运行情况
|
|
|
// 4、设备运行情况
|
|
|
CompletableFuture<List<OperationConditionDto>> deviceConditionTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<List<OperationConditionDto>> deviceConditionTask = CompletableFuture.supplyAsync(() -> { |
|
|
List<OperationConditionDto> res = new ArrayList<>(); |
|
|
List<OperationConditionDto> res = new ArrayList<>(); |
|
|
for (int i = 0; i < 4; i++) { |
|
|
// 获取所有设备
|
|
|
DeviceEnum deviceEnumByIndex = DeviceEnum.getDeviceEnumByIndex(i); |
|
|
JSONArray result = WQL.getWO("COCKPIT_DEVICE") |
|
|
|
|
|
.addParam("flag", "4") |
|
|
|
|
|
.process() |
|
|
|
|
|
.getResultJSONArray(0); |
|
|
|
|
|
// TODO: 打开ACS系统对接数据
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result;
|
|
|
|
|
|
JSONArray data = result; |
|
|
|
|
|
// 初始化数据 数组下标:0关机 1待机 2生产中 3故障
|
|
|
|
|
|
JSONObject total = new JSONObject(); |
|
|
|
|
|
DeviceEnum[] values = DeviceEnum.values(); |
|
|
|
|
|
for (int i = 0; i < values.length; i++) { |
|
|
|
|
|
total.put(values[i].getCode(), new int[4]); |
|
|
|
|
|
} |
|
|
|
|
|
// 遍历判断
|
|
|
|
|
|
for (int i = 0; i < data.size(); i++) { |
|
|
|
|
|
JSONObject device = data.getJSONObject(i); |
|
|
|
|
|
Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status")) |
|
|
|
|
|
? device.getInteger("devices_status") |
|
|
|
|
|
: 0; |
|
|
|
|
|
String regionCode = device.getString("region_code"); |
|
|
|
|
|
DeviceEnum deviceEnumByCode = DeviceEnum.getDeviceEnumByCode(regionCode); // 获取属于哪种设备
|
|
|
|
|
|
int[] ints = (int[]) total.get(deviceEnumByCode.getCode()); |
|
|
|
|
|
ints[devicesStatus1] = ints[devicesStatus1] + 1; |
|
|
|
|
|
total.put(deviceEnumByCode.getCode(), ints); |
|
|
|
|
|
} |
|
|
|
|
|
// 返回输出值
|
|
|
|
|
|
for (int i = 0; i < values.length; i++) { // 4个
|
|
|
|
|
|
int[] ints = (int[]) total.get(values[i].getCode()); |
|
|
OperationConditionDto dto = new OperationConditionDto(); |
|
|
OperationConditionDto dto = new OperationConditionDto(); |
|
|
dto.setDevice_name(deviceEnumByIndex.getDevice_name()); |
|
|
dto.setDevice_name(values[i].getDevice_name()); // 列名
|
|
|
dto.setRunning(3); |
|
|
dto.setRunning(ints[2]); |
|
|
dto.setFailure(5); |
|
|
dto.setFailure(ints[3]); |
|
|
dto.setShutdown(2); |
|
|
dto.setShutdown(ints[0]); |
|
|
dto.setStandby(6); |
|
|
dto.setStandby(ints[1]); |
|
|
res.add(dto); |
|
|
res.add(dto); |
|
|
} |
|
|
} |
|
|
return res; |
|
|
return res; |
|
@ -182,21 +213,24 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.addParamMap(MapOf.of("flag", "5", "region_code", "YZ")) |
|
|
.addParamMap(MapOf.of("flag", "5", "region_code", "YZ")) |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
return res; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
stackingPositionTask.thenAccept(result -> { |
|
|
|
|
|
// TODO: 颜色、实时数量请求acs系统
|
|
|
// TODO: 颜色、实时数量请求acs系统
|
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
JSONObject jsonObject = result.getJSONObject(i); |
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
|
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
|
|
|
JSONObject jsonObject = res.getJSONObject(i); |
|
|
jsonObject.put("color_status", ColorEnum.RED.getIndex()); |
|
|
jsonObject.put("color_status", ColorEnum.RED.getIndex()); |
|
|
} |
|
|
} |
|
|
|
|
|
return res; |
|
|
|
|
|
}, pool); |
|
|
|
|
|
stackingPositionTask.thenAccept(result -> { |
|
|
map.put("StackingPositionList", result); |
|
|
map.put("StackingPositionList", result); |
|
|
}).exceptionally((e) -> { |
|
|
}).exceptionally((e) -> { |
|
|
log.error("码垛位情况显示: {}", e.getMessage(), e); |
|
|
log.error("码垛位情况显示: {}", e.getMessage(), e); |
|
|
map.put("StackingPositionList", null); |
|
|
map.put("StackingPositionList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// 8、压机信息显示 todo: 压机的状态,请求acs
|
|
|
// 8、压机信息显示
|
|
|
CompletableFuture<JSONArray> pressMachineTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> pressMachineTask = CompletableFuture.supplyAsync(() -> { |
|
|
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") |
|
|
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") |
|
|
.addParamMap(MapOf.of("flag", "10")) |
|
|
.addParamMap(MapOf.of("flag", "10")) |
|
@ -207,6 +241,10 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("open_time", DateUtil.now()); |
|
|
jsonObject.put("open_time", DateUtil.now()); |
|
|
} |
|
|
} |
|
|
|
|
|
// todo: 打开ACS系统对接数据
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
pressMachineTask.thenAccept(result -> { |
|
|
pressMachineTask.thenAccept(result -> { |
|
@ -216,7 +254,7 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("PressMachineList", null); |
|
|
map.put("PressMachineList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// 9、混料机信息显示 todo: 设备状态,请求acs
|
|
|
// 9、混料机信息显示
|
|
|
CompletableFuture<JSONArray> mixMachineTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> mixMachineTask = CompletableFuture.supplyAsync(() -> { |
|
|
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") |
|
|
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") |
|
|
.addParamMap(MapOf.of("flag", "11")) |
|
|
.addParamMap(MapOf.of("flag", "11")) |
|
@ -227,6 +265,10 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); |
|
|
jsonObject.put("open_time", DateUtil.now()); |
|
|
jsonObject.put("open_time", DateUtil.now()); |
|
|
} |
|
|
} |
|
|
|
|
|
// todo: 打开ACS系统对接数据
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
mixMachineTask.thenAccept(result -> { |
|
|
mixMachineTask.thenAccept(result -> { |
|
@ -302,11 +344,14 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
.addParamMap(MapOf.of("flag", "13")) |
|
|
.addParamMap(MapOf.of("flag", "13")) |
|
|
.process() |
|
|
.process() |
|
|
.getResultJSONArray(0); |
|
|
.getResultJSONArray(0); |
|
|
// TODO: 颜色、实时数量请求acs系统
|
|
|
|
|
|
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()); |
|
|
} |
|
|
} |
|
|
|
|
|
// TODO: 打开ACS系统对接数据
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
sortAndPalletizingTask.thenAccept(result -> { |
|
|
sortAndPalletizingTask.thenAccept(result -> { |
|
@ -340,6 +385,7 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 工序生产 |
|
|
* 工序生产 |
|
|
|
|
|
* |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
@ -736,10 +782,22 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
CompletableFuture<JSONArray> mixDevicePopoverInformationTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> mixDevicePopoverInformationTask = CompletableFuture.supplyAsync(() -> { |
|
|
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); |
|
|
|
|
|
// 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 device = data.getJSONObject(i);
|
|
|
|
|
|
// Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status"))
|
|
|
|
|
|
// ? device.getInteger("devices_status")
|
|
|
|
|
|
// : 0;
|
|
|
|
|
|
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
|
|
|
|
|
|
// device.put("device_status_name", deviceStatusEnumByCode.getDescription());
|
|
|
|
|
|
// }
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
mixDevicePopoverInformationTask.thenAccept(result -> { |
|
|
mixDevicePopoverInformationTask.thenAccept(result -> { |
|
|
//todo: 请求acs设置开机状态等等信息
|
|
|
//todo: 以下代码去掉
|
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
JSONObject device = result.getJSONObject(i); |
|
|
JSONObject device = result.getJSONObject(i); |
|
|
if (!device.getString("material_code").equals("-")) { |
|
|
if (!device.getString("material_code").equals("-")) { |
|
@ -869,10 +927,21 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
CompletableFuture<JSONArray> pressPopoverTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> pressPopoverTask = CompletableFuture.supplyAsync(() -> { |
|
|
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); |
|
|
|
|
|
// 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 device = data.getJSONObject(i);
|
|
|
|
|
|
// Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status"))
|
|
|
|
|
|
// ? device.getInteger("devices_status")
|
|
|
|
|
|
// : 0;
|
|
|
|
|
|
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
|
|
|
|
|
|
// device.put("device_status_name", deviceStatusEnumByCode.getDescription());
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
pressPopoverTask.thenAccept(result -> { |
|
|
pressPopoverTask.thenAccept(result -> { |
|
|
//todo: 请求acs获取开机状态等等信息
|
|
|
//todo: 以下代码去掉
|
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
for (int i = 0; i < result.size(); i++) { |
|
|
JSONObject device = result.getJSONObject(i); |
|
|
JSONObject device = result.getJSONObject(i); |
|
|
if (!device.getString("material_code").equals("-")) { |
|
|
if (!device.getString("material_code").equals("-")) { |
|
@ -901,6 +970,9 @@ 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); |
|
|
// todo: request acs to find device status and other information
|
|
|
// todo: request acs to find device status and other information
|
|
|
|
|
|
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
return res; |
|
|
return res; |
|
|
}, pool); |
|
|
}, pool); |
|
|
trayStationPopoverTask.thenAccept(result -> { |
|
|
trayStationPopoverTask.thenAccept(result -> { |
|
@ -910,10 +982,22 @@ public class BigScreenServiceImpl implements BigScreenService { |
|
|
map.put("TrayStationPopoverList", null); |
|
|
map.put("TrayStationPopoverList", null); |
|
|
return null; |
|
|
return null; |
|
|
}); |
|
|
}); |
|
|
// 3、机械手状态 todo
|
|
|
// 3、机械手状态
|
|
|
CompletableFuture<JSONArray> manipulatorConditionTask = CompletableFuture.supplyAsync(() -> { |
|
|
CompletableFuture<JSONArray> manipulatorConditionTask = CompletableFuture.supplyAsync(() -> { |
|
|
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);
|
|
|
|
|
|
// JSONArray data = ObjectUtil.isNotEmpty(
|
|
|
|
|
|
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
|
|
|
|
|
|
// for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
// JSONObject device = data.getJSONObject(i);
|
|
|
|
|
|
// Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status"))
|
|
|
|
|
|
// ? device.getInteger("devices_status")
|
|
|
|
|
|
// : 0;
|
|
|
|
|
|
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
|
|
|
|
|
|
// device.put("device_status_name", deviceStatusEnumByCode.getDescription());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// todo 去掉以下代码
|
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
JSONObject device = res.getJSONObject(i); |
|
|
JSONObject device = res.getJSONObject(i); |
|
|
device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); |
|
|
device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); |
|
@ -1215,6 +1299,19 @@ 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); |
|
|
// todo: 向acs申请获取
|
|
|
// 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 device = data.getJSONObject(i);
|
|
|
|
|
|
// Integer devicesStatus1 = ObjectUtil.isNotEmpty(device.getInteger("devices_status"))
|
|
|
|
|
|
// ? device.getInteger("devices_status")
|
|
|
|
|
|
// : 0;
|
|
|
|
|
|
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
|
|
|
|
|
|
// device.put("device_status_name", deviceStatusEnumByCode.getDescription());
|
|
|
|
|
|
// resObj.put(device.getString("device_code"), device);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// todo 去掉以下代码
|
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
for (int i = 0; i < res.size(); i++) { |
|
|
JSONObject device = res.getJSONObject(i); |
|
|
JSONObject device = res.getJSONObject(i); |
|
|
device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); |
|
|
device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); |
|
|