From 263a1b4bedd6310a0c3f7928cf57a8c90f467769 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Sun, 25 Jun 2023 19:56:29 +0800 Subject: [PATCH] =?UTF-8?q?rev:=20=E4=BF=AE=E6=94=B9=E5=A4=A7=E5=B1=8F?= =?UTF-8?q?=E4=B8=8Eacs=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BigScreenServiceImpl.java | 343 +++++++----------- .../wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql | 19 +- .../wql/COCKPIT_PROCESS_PRODUCTION.wql | 2 +- .../wms/ext/acs/service/WmsToAcsService.java | 1 + .../acs/service/impl/WmsToAcsServiceImpl.java | 6 + 5 files changed, 160 insertions(+), 211 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java index 114f9dc..da76e72 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java +++ b/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; -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; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; 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.DeviceEnum; 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.springframework.stereotype.Service; @@ -37,6 +36,8 @@ import java.util.concurrent.ThreadPoolExecutor; @RequiredArgsConstructor @Slf4j public class BigScreenServiceImpl implements BigScreenService { + + private final WmsToAcsService wmsToAcsService; /** * 車间情况大屏信息 * @@ -125,11 +126,9 @@ public class BigScreenServiceImpl implements BigScreenService { .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; + JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(result); + JSONArray data = ObjectUtil.isNotEmpty( + devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : result; // 初始化数据 数组下标:0关机 1待机 2生产中 3故障 JSONObject total = new JSONObject(); DeviceEnum[] values = DeviceEnum.values(); @@ -214,34 +213,29 @@ public class BigScreenServiceImpl implements BigScreenService { .addParamMap(MapOf.of("flag", "5", "region_code", "YZ")) .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 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()); + 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; + return data; }, pool); stackingPositionTask.thenAccept(result -> { map.put("StackingPositionList", result); @@ -256,16 +250,10 @@ public class BigScreenServiceImpl implements BigScreenService { .addParamMap(MapOf.of("flag", "10")) .process() .getResultJSONArray(0); - 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()); - } - // todo: 打开ACS系统对接数据 -// JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); -// JSONArray data = ObjectUtil.isNotEmpty( -// devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; - return res; + JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); + JSONArray data = ObjectUtil.isNotEmpty( + devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; + return data; }, pool); pressMachineTask.thenAccept(result -> { map.put("PressMachineList", result); @@ -280,23 +268,16 @@ public class BigScreenServiceImpl implements BigScreenService { .addParamMap(MapOf.of("flag", "11")) .process() .getResultJSONArray(0); - for (int i = 0; i < res.size(); i++) { - JSONObject jsonObject = res.getJSONObject(i); + 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 now = DateUtil.now(); - jsonObject.put("open_time", now.substring(now.indexOf('-') + 1)); + String openTime = jsonObject.getString("open_time"); + jsonObject.put("open_time", openTime.substring(openTime.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; + return data; }, pool); mixMachineTask.thenAccept(result -> { map.put("MixMachineList", result); @@ -371,34 +352,29 @@ public class BigScreenServiceImpl implements BigScreenService { .addParamMap(MapOf.of("flag", "13")) .process() .getResultJSONArray(0); - for (int i = 0; i < res.size(); i++) { - JSONObject jsonObject = res.getJSONObject(i); - jsonObject.put("color_status", ColorEnum.RED.getIndex()); + 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()); + } } - // 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); -// 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 data; }, pool); sortAndPalletizingTask.thenAccept(result -> { map.put("SortAndPalletizingList", result); @@ -413,15 +389,10 @@ public class BigScreenServiceImpl implements BigScreenService { .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; + JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); + JSONArray data = ObjectUtil.isNotEmpty( + devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; + return data; }, pool); manipulatorInfoTask.thenAccept(result -> { map.put("ManipulatorInfoList", result); @@ -852,39 +823,20 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture mixDevicePopoverInformationTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "2")) .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; + 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 data; }, pool); 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); }).exceptionally((e) -> { log.error("获取混料机的弹窗信息: {}", e.getMessage(), e); @@ -997,38 +949,20 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture pressPopoverTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "4")) .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; + 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 data; }, pool); 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); }).exceptionally((e) -> { log.error("获取压机弹窗数据: {}", e.getMessage(), e); @@ -1039,11 +973,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture trayStationPopoverTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "5")) .process().getResultJSONArray(0); - // 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; + JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res); + JSONArray data = ObjectUtil.isNotEmpty( + devicesStatus.getJSONArray("data")) ? devicesStatus.getJSONArray("data") : res; + return data; }, pool); trayStationPopoverTask.thenAccept(result -> { map.put("TrayStationPopoverList", result); @@ -1056,28 +989,18 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture manipulatorConditionTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_MOLDING_INFO").addParamMap(MapOf.of("flag", "6")) .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++) { - 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"); + 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 data; }, pool); manipulatorConditionTask.thenAccept(result -> { map.put("ManipulatorList", result); @@ -1368,28 +1291,16 @@ public class BigScreenServiceImpl implements BigScreenService { JSONObject resObj = new JSONObject(); JSONArray res = WQL.getWO("COCKPIT_SORTE_AND_PACKAGE").addParamMap(MapOf.of("flag", "5")) .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()); -// 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"); + 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); } return resObj; @@ -1414,10 +1325,30 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("HalfSupportCacheList", null); return null; }); + // 4、包装线 + CompletableFuture 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 allQuery = CompletableFuture.allOf( splitOrPalletizingTask, devicesInfoTask, - halfSupportCacheTask); + halfSupportCacheTask, + packagingLineTask); CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql index 47c6f1d..a57abd0 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_MIX_AND_TRAP.wql +++ b/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, point.point_code, point.point_name, - point.point_status, CASE point.point_status - WHEN '0' THEN '无货' - WHEN '1' THEN '有货' - ELSE '' + WHEN '0' THEN '0' + WHEN '1' THEN IF(vd.vd_id IS NULL,'1','2') + 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, + 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(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 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql index a7485c2..75bd4c6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql @@ -204,7 +204,7 @@ WHEN '3' THEN '2' WHEN '4' THEN '2' WHEN '5' THEN '3' - ELSE '' + ELSE '0' END AS stand_status_color FROM `sch_base_point` p diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 08ba0d1..d380616 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/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 writeVehicle(JSONArray whereJson); + JSONObject queryBzx(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index fec63dd..a648695 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/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); } + @Override + public JSONObject queryBzx() { + String api = "api/wms/queryBzx"; + return AcsUtil.notifyAcs(api, null); + } + }