Browse Source

rev: 修改大屏与acs对接

master
李永德 1 year ago
parent
commit
263a1b4bed
  1. 339
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java
  2. 19
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql
  3. 2
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql
  4. 1
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java
  5. 6
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java

339
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java

@ -1,11 +1,8 @@
package org.nl.wms.cockpit.service.impl; package org.nl.wms.cockpit.service.impl;
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.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;
@ -17,6 +14,8 @@ import org.nl.wms.cockpit.service.dto.*;
import org.nl.wms.cockpit.service.enums.ColorEnum; import org.nl.wms.cockpit.service.enums.ColorEnum;
import org.nl.wms.cockpit.service.enums.DeviceEnum; import org.nl.wms.cockpit.service.enums.DeviceEnum;
import org.nl.wms.cockpit.service.enums.DeviceStatusEnum; import org.nl.wms.cockpit.service.enums.DeviceStatusEnum;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.sch.task.util.TaskUtils;
import org.nl.wms.util.MapOf; import org.nl.wms.util.MapOf;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -37,6 +36,8 @@ import java.util.concurrent.ThreadPoolExecutor;
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class BigScreenServiceImpl implements BigScreenService { public class BigScreenServiceImpl implements BigScreenService {
private final WmsToAcsService wmsToAcsService;
/** /**
* 車间情况大屏信息 * 車间情况大屏信息
* *
@ -125,11 +126,9 @@ public class BigScreenServiceImpl implements BigScreenService {
.addParam("flag", "4") .addParam("flag", "4")
.process() .process()
.getResultJSONArray(0); .getResultJSONArray(0);
// TODO: 打开ACS系统对接数据 JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result);
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result); JSONArray data = ObjectUtil.isNotEmpty(
// JSONArray data = ObjectUtil.isNotEmpty( devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result;
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result;
JSONArray 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();
@ -214,34 +213,29 @@ 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);
// 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++) {
// 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 && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty")) && jsonObject.getInteger("encoder_qty") > 0) {
// && jsonObject.getInteger("encoder_qty") > 0) { // 绿色
// // 绿色 jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
// jsonObject.put("color_status", ColorEnum.GREEN.getIndex()); } else if (jsonObject.getInteger("move") == 1
// } else if (jsonObject.getInteger("move") == 1 && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty"))
// && ObjectUtil.isNotEmpty(jsonObject.getInteger("encoder_qty")) && jsonObject.getInteger("encoder_qty") == 0) {
// && jsonObject.getInteger("encoder_qty") == 0) { // 黄色
// // 黄色 jsonObject.put("color_status", ColorEnum.YELLOW.getIndex());
// jsonObject.put("color_status", ColorEnum.YELLOW.getIndex()); } else if (jsonObject.getInteger("move") == 0) {
// } 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()); jsonObject.put("color_status", ColorEnum.RED.getIndex());
} else { // 有托盘人工
jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
} }
return res; }
return data;
}, pool); }, pool);
stackingPositionTask.thenAccept(result -> { stackingPositionTask.thenAccept(result -> {
map.put("StackingPositionList", result); map.put("StackingPositionList", result);
@ -256,16 +250,10 @@ public class BigScreenServiceImpl implements BigScreenService {
.addParamMap(MapOf.of("flag", "10")) .addParamMap(MapOf.of("flag", "10"))
.process() .process()
.getResultJSONArray(0); .getResultJSONArray(0);
for (int i = 0; i < res.size(); i++) { JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
JSONObject jsonObject = res.getJSONObject(i); JSONArray data = ObjectUtil.isNotEmpty(
jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode()); devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
jsonObject.put("open_time", DateUtil.now()); return data;
}
// todo: 打开ACS系统对接数据
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONArray data = ObjectUtil.isNotEmpty(
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
return res;
}, pool); }, pool);
pressMachineTask.thenAccept(result -> { pressMachineTask.thenAccept(result -> {
map.put("PressMachineList", result); map.put("PressMachineList", result);
@ -280,23 +268,16 @@ public class BigScreenServiceImpl implements BigScreenService {
.addParamMap(MapOf.of("flag", "11")) .addParamMap(MapOf.of("flag", "11"))
.process() .process()
.getResultJSONArray(0); .getResultJSONArray(0);
for (int i = 0; i < res.size(); i++) { JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
JSONObject jsonObject = res.getJSONObject(i); 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()); jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode());
String now = DateUtil.now(); String openTime = jsonObject.getString("open_time");
jsonObject.put("open_time", now.substring(now.indexOf('-') + 1)); jsonObject.put("open_time", openTime.substring(openTime.indexOf('-') + 1));
} }
// todo: 打开ACS系统对接数据 return data;
// 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); }, pool);
mixMachineTask.thenAccept(result -> { mixMachineTask.thenAccept(result -> {
map.put("MixMachineList", result); map.put("MixMachineList", result);
@ -371,34 +352,29 @@ public class BigScreenServiceImpl implements BigScreenService {
.addParamMap(MapOf.of("flag", "13")) .addParamMap(MapOf.of("flag", "13"))
.process() .process()
.getResultJSONArray(0); .getResultJSONArray(0);
for (int i = 0; i < res.size(); i++) { JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
JSONObject jsonObject = res.getJSONObject(i); 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()); jsonObject.put("color_status", ColorEnum.RED.getIndex());
} else { // 有托盘人工
jsonObject.put("color_status", ColorEnum.GREEN.getIndex());
} }
// TODO: 打开ACS系统对接数据 }
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); return data;
// 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); }, pool);
sortAndPalletizingTask.thenAccept(result -> { sortAndPalletizingTask.thenAccept(result -> {
map.put("SortAndPalletizingList", result); map.put("SortAndPalletizingList", result);
@ -413,15 +389,10 @@ public class BigScreenServiceImpl implements BigScreenService {
.addParamMap(MapOf.of("flag", "14")) .addParamMap(MapOf.of("flag", "14"))
.process() .process()
.getResultJSONArray(0); .getResultJSONArray(0);
for (int i = 0; i < res.size(); i++) { JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
JSONObject jsonObject = res.getJSONObject(i); JSONArray data = ObjectUtil.isNotEmpty(
jsonObject.put("color_status", ColorEnum.RED.getIndex()); devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
} return data;
// TODO: 打开ACS系统对接数据
// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONArray data = ObjectUtil.isNotEmpty(
// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res;
return res;
}, pool); }, pool);
manipulatorInfoTask.thenAccept(result -> { manipulatorInfoTask.thenAccept(result -> {
map.put("ManipulatorInfoList", result); map.put("ManipulatorInfoList", result);
@ -852,39 +823,20 @@ 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);
// 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++) {
// 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")) ? device.getInteger("devices_status")
// ? device.getInteger("devices_status") : 0;
// : 0; DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1); device.put("device_status_name", deviceStatusEnumByCode.getDescription());
// device.put("device_status_name", deviceStatusEnumByCode.getDescription()); }
// } return data;
return res;
}, pool); }, pool);
mixDevicePopoverInformationTask.thenAccept(result -> { mixDevicePopoverInformationTask.thenAccept(result -> {
//todo: 以下代码去掉
for (int i = 0; i < result.size(); i++) {
JSONObject device = result.getJSONObject(i);
if (!device.getString("material_code").equals("-")) {
device.put("device_status", DeviceStatusEnum.RUNNING.getCode());
device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription());
device.put("open_time", "2023-06-02 11:12:02");
device.put("stand_time", "2");
device.put("work_time", "7");
} else {
device.put("open_time", "-");
device.put("device_status", DeviceStatusEnum.STANDBY.getCode());
device.put("device_status_name", DeviceStatusEnum.STANDBY.getDescription());
device.put("stand_time", "5");
device.put("work_time", "0.5");
}
device.put("error_time", "0");
}
map.put("MixDeviceInfoList", result); map.put("MixDeviceInfoList", result);
}).exceptionally((e) -> { }).exceptionally((e) -> {
log.error("获取混料机的弹窗信息: {}", e.getMessage(), e); log.error("获取混料机的弹窗信息: {}", e.getMessage(), e);
@ -997,38 +949,20 @@ 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);
// 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++) {
// 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")) ? device.getInteger("devices_status")
// ? device.getInteger("devices_status") : 0;
// : 0; DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1); device.put("device_status_name", deviceStatusEnumByCode.getDescription());
// device.put("device_status_name", deviceStatusEnumByCode.getDescription()); }
return res; return data;
}, pool); }, pool);
pressPopoverTask.thenAccept(result -> { pressPopoverTask.thenAccept(result -> {
//todo: 以下代码去掉
for (int i = 0; i < result.size(); i++) {
JSONObject device = result.getJSONObject(i);
if (!device.getString("material_code").equals("-")) {
device.put("device_status", DeviceStatusEnum.RUNNING.getCode());
device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription());
device.put("open_time", "2023-06-02 11:12:02");
device.put("stand_time", "2");
device.put("work_time", "7");
} else {
device.put("open_time", "-");
device.put("device_status", DeviceStatusEnum.STANDBY.getCode());
device.put("device_status_name", DeviceStatusEnum.STANDBY.getDescription());
device.put("stand_time", "5");
device.put("work_time", "0.5");
}
device.put("error_time", "0");
}
map.put("PressPopoverList", result); map.put("PressPopoverList", result);
}).exceptionally((e) -> { }).exceptionally((e) -> {
log.error("获取压机弹窗数据: {}", e.getMessage(), e); log.error("获取压机弹窗数据: {}", e.getMessage(), e);
@ -1039,11 +973,10 @@ public class BigScreenServiceImpl implements BigScreenService {
CompletableFuture<JSONArray> trayStationPopoverTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> trayStationPopoverTask = CompletableFuture.supplyAsync(() -> {
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 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; return data;
return res;
}, pool); }, pool);
trayStationPopoverTask.thenAccept(result -> { trayStationPopoverTask.thenAccept(result -> {
map.put("TrayStationPopoverList", result); map.put("TrayStationPopoverList", result);
@ -1056,28 +989,18 @@ public class BigScreenServiceImpl implements BigScreenService {
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); 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++) { 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"))
// ? device.getInteger("devices_status") ? device.getInteger("devices_status")
// : 0; : 0;
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1); DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
// device.put("device_status_name", deviceStatusEnumByCode.getDescription()); device.put("device_status_name", deviceStatusEnumByCode.getDescription());
// }
// todo 去掉以下代码
for (int i = 0; i < res.size(); i++) {
JSONObject device = res.getJSONObject(i);
device.put("device_status", DeviceStatusEnum.RUNNING.getCode());
device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription());
device.put("open_time", "2023-06-02 11:12:02");
device.put("stand_time", "2");
device.put("work_time", "7");
device.put("error_time", "0");
} }
return res; return data;
}, pool); }, pool);
manipulatorConditionTask.thenAccept(result -> { manipulatorConditionTask.thenAccept(result -> {
map.put("ManipulatorList", result); map.put("ManipulatorList", result);
@ -1368,28 +1291,16 @@ public class BigScreenServiceImpl implements BigScreenService {
JSONObject resObj = new JSONObject(); JSONObject resObj = new JSONObject();
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申请获取 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++) {
// 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")) ? device.getInteger("devices_status")
// ? device.getInteger("devices_status") : 0;
// : 0; DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1);
// DeviceStatusEnum deviceStatusEnumByCode = DeviceStatusEnum.getDeviceStatusEnumByCode(devicesStatus1); device.put("device_status_name", deviceStatusEnumByCode.getDescription());
// device.put("device_status_name", deviceStatusEnumByCode.getDescription());
// resObj.put(device.getString("device_code"), device);
// }
// todo 去掉以下代码
for (int i = 0; i < res.size(); i++) {
JSONObject device = res.getJSONObject(i);
device.put("device_status", DeviceStatusEnum.RUNNING.getCode());
device.put("device_status_name", DeviceStatusEnum.RUNNING.getDescription());
device.put("open_time", "2023-06-02 11:12:02");
device.put("stand_time", "2");
device.put("work_time", "7");
device.put("error_time", "0");
resObj.put(device.getString("device_code"), device); resObj.put(device.getString("device_code"), device);
} }
return resObj; return resObj;
@ -1414,10 +1325,30 @@ public class BigScreenServiceImpl implements BigScreenService {
map.put("HalfSupportCacheList", null); map.put("HalfSupportCacheList", null);
return null; return null;
}); });
// 4、包装线
CompletableFuture<JSONArray> packagingLineTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = new JSONArray();
JSONObject jsonObject = wmsToAcsService.queryBzx();
res = jsonObject.getJSONArray("data");
for (int i = 0; i < res.size(); i++) {
JSONObject BZX = res.getJSONObject(i);
BZX.put("vehicle_type", BZX.getInteger("vehicle_type") + 2);
BZX.put("vehicle_code", TaskUtils.formatVehicleCode(BZX.getString("vehicle_code")));
}
return res;
}, pool);
packagingLineTask.thenAccept(result -> {
map.put("PackagingLineList", result);
}).exceptionally((e) -> {
log.error("获取包装线数据: {}", e.getMessage(), e);
map.put("PackagingLineList", null);
return null;
});
CompletableFuture<Void> allQuery = CompletableFuture.allOf( CompletableFuture<Void> allQuery = CompletableFuture.allOf(
splitOrPalletizingTask, splitOrPalletizingTask,
devicesInfoTask, devicesInfoTask,
halfSupportCacheTask); halfSupportCacheTask,
packagingLineTask);
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);

19
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql

@ -204,12 +204,23 @@
END AS stand_status_name, END AS stand_status_name,
point.point_code, point.point_code,
point.point_name, point.point_name,
point.point_status,
CASE point.point_status CASE point.point_status
WHEN '0' THEN '无货' WHEN '0' THEN '0'
WHEN '1' THEN '有货' WHEN '1' THEN IF(vd.vd_id IS NULL,'1','2')
ELSE '' ELSE '0'
END AS point_status,
CASE point.point_status
WHEN '0' THEN '空位'
WHEN '1' THEN IF(vd.vd_id IS NULL,'空盅','满盅')
ELSE '空位'
END AS point_status_name, END AS point_status_name,
CASE vd.stand_status
WHEN '2' THEN '1'
WHEN '3' THEN '2'
WHEN '4' THEN '2'
WHEN '5' THEN '3'
ELSE '0'
END AS stand_status_color,
IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code, IF(LENGTH(point.vehicle_code)>0,point.vehicle_code,'-') AS vehicle_code,
IF(LENGTH(material.material_code)>0,SUBSTRING(material.material_code, 6, 6),'-') AS bom, IF(LENGTH(material.material_code)>0,SUBSTRING(material.material_code, 6, 6),'-') AS bom,
IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num

2
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql

@ -204,7 +204,7 @@
WHEN '3' THEN '2' WHEN '3' THEN '2'
WHEN '4' THEN '2' WHEN '4' THEN '2'
WHEN '5' THEN '3' WHEN '5' THEN '3'
ELSE '' ELSE '0'
END AS stand_status_color END AS stand_status_color
FROM FROM
`sch_base_point` p `sch_base_point` p

1
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java

@ -72,4 +72,5 @@ public interface WmsToAcsService {
JSONObject light(JSONArray whereJson); JSONObject light(JSONArray whereJson);
JSONObject writeVehicle(JSONArray whereJson); JSONObject writeVehicle(JSONArray whereJson);
JSONObject queryBzx();
} }

6
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java

@ -78,4 +78,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return AcsUtil.notifyAcs(api, whereJson); return AcsUtil.notifyAcs(api, whereJson);
} }
@Override
public JSONObject queryBzx() {
String api = "api/wms/queryBzx";
return AcsUtil.notifyAcs(api, null);
}
} }

Loading…
Cancel
Save