From 7ec9da956ddff0f0125966c5bf08f32d12e1d145 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Tue, 13 Jun 2023 15:16:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/cockpit/service/BigScreenService.java | 1 - .../service/impl/BigScreenServiceImpl.java | 97 ++++++++++++------- .../wql/COCKPIT_PROCESS_PRODUCTION.wql | 78 +++++++++++---- .../cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql | 6 +- 4 files changed, 122 insertions(+), 60 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java index d7f083a..0fd4568 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java @@ -1,6 +1,5 @@ package org.nl.wms.cockpit.service; -import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** 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 33ce6cc..c74c1ed 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,5 +1,6 @@ package org.nl.wms.cockpit.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -170,7 +171,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("LastTenFailureList", null); return null; }); - // 7、码垛位情况显示 + // 7、压制码垛位情况显示 CompletableFuture stackingPositionTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "5", "region_code", "YZ")) .process() @@ -178,7 +179,7 @@ public class BigScreenServiceImpl implements BigScreenService { return res; }, pool); stackingPositionTask.thenAccept(result -> { - // TODO: 请求acs系统 + // TODO: 颜色、实时数量请求acs系统 for (int i = 0; i < result.size(); i++) { JSONObject jsonObject = result.getJSONObject(i); jsonObject.put("color_status", ColorEnum.RED.getIndex()); @@ -197,6 +198,7 @@ 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()); } return res; }, pool); @@ -215,6 +217,7 @@ 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()); } return res; }, pool); @@ -225,34 +228,34 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("MixMachineList", null); return null; }); - // 10、困料货架的信息显示 todo: 数据? -// CompletableFuture trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> { -// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8")) -// .process() -// .getResultJSONArray(0); -// return res; -// }, pool); -// trappedMaterialShelfTask.thenAccept(result -> { -// map.put("TrappedMaterialShelfList", result); -// }).exceptionally((e) -> { -// log.error("困料货架的信息显示: {}", e.getMessage(), e); -// map.put("TrappedMaterialShelfList", null); -// return null; -// }); - // 11、半成品货架数据显示 todo: 数据? -// CompletableFuture semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { -// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9")) -// .process() -// .getResultJSONArray(0); -// return res; -// }, pool); -// semiFinishedProductShelfTask.thenAccept(result -> { -// map.put("SemiFinishedProductShelfList", result); -// }).exceptionally((e) -> { -// log.error("半成品货架数据显示: {}", e.getMessage(), e); -// map.put("SemiFinishedProductShelfList", null); -// return null; -// }); + // 10、困料货架的信息显示 + CompletableFuture trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8")) + .process() + .getResultJSONArray(0); + return res; + }, pool); + trappedMaterialShelfTask.thenAccept(result -> { + map.put("TrappedMaterialShelfList", result); + }).exceptionally((e) -> { + log.error("困料货架 - 40 货位的信息显示: {}", e.getMessage(), e); + map.put("TrappedMaterialShelfList", null); + return null; + }); + // 11、半成品货架数据显示 + CompletableFuture semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9")) + .process() + .getResultJSONArray(0); + return res; + }, pool); + semiFinishedProductShelfTask.thenAccept(result -> { + map.put("SemiFinishedProductShelfList", result); + }).exceptionally((e) -> { + log.error("半成品货架数据显示: {}", e.getMessage(), e); + map.put("SemiFinishedProductShelfList", null); + return null; + }); // 12、混料机下料位 CompletableFuture mixBlankingTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "3")) @@ -266,7 +269,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("MixBlankingList", null); return null; }); - // 13、困料货架数据显示 + // 13、液压机旁边困料货架数据显示 CompletableFuture trappedShelfTask = CompletableFuture.supplyAsync(() -> { JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "12")) .process().getResultJSONArray(0); @@ -275,10 +278,29 @@ public class BigScreenServiceImpl implements BigScreenService { trappedShelfTask.thenAccept(result -> { map.put("TrappedShelfList", result); }).exceptionally((e) -> { - log.error("获取困料货架数据显示 - 6货位信息: {}", e.getMessage(), e); + log.error("液压机旁边困料货架数据显示 - 6货位信息: {}", e.getMessage(), e); map.put("TrappedShelfList", null); return null; }); + // 14、分拣拆码垛对接位 + CompletableFuture sortAndPalletizingTask = CompletableFuture.supplyAsync(() -> { + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "13")) + .process() + .getResultJSONArray(0); + // TODO: 颜色、实时数量请求acs系统 + for (int i = 0; i < res.size(); i++) { + JSONObject jsonObject = res.getJSONObject(i); + jsonObject.put("color_status", ColorEnum.RED.getIndex()); + } + return res; + }, pool); + sortAndPalletizingTask.thenAccept(result -> { + map.put("SortAndPalletizingList", result); + }).exceptionally((e) -> { + log.error("分拣拆码垛: {}", e.getMessage(), e); + map.put("SortAndPalletizingList", null); + return null; + }); CompletableFuture allQuery = CompletableFuture.allOf( mixDayProductionTask, pressDayProductionTask, @@ -287,10 +309,11 @@ public class BigScreenServiceImpl implements BigScreenService { lastMonthFailureTask, stackingPositionTask, pressMachineTask, + trappedMaterialShelfTask, mixMachineTask, - trappedShelfTask); -// trappedMaterialShelfTask, -// semiFinishedProductShelfTask); + trappedShelfTask, + sortAndPalletizingTask, + semiFinishedProductShelfTask); CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; @@ -1031,6 +1054,7 @@ public class BigScreenServiceImpl implements BigScreenService { map.put("FinishedProductShelfList", null); return null; }); + // todo: 窑内数据 CompletableFuture allQuery = CompletableFuture.allOf( finishedProductShelfTask); CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { @@ -1100,7 +1124,7 @@ public class BigScreenServiceImpl implements BigScreenService { return res; }, pool); manufacturedProductsDayProductionTask.thenAccept((result) -> { - map.put("CPDayList", result); + map.put("CPDayList", result); }).exceptionally((e) -> { log.error("当日成品生产: {}", e.getMessage(), e); map.put("CPDayList", null); @@ -1141,6 +1165,7 @@ 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申请获取 for (int i = 0; i < res.size(); i++) { JSONObject device = res.getJSONObject(i); device.put("device_status", DeviceStatusEnum.RUNNING.getCode()); 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 cd69379..80595a9 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 @@ -186,7 +186,11 @@ p.point_code, p.point_name, p.region_code, - p.point_status, + CASE p.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 '困料中' @@ -207,8 +211,8 @@ LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code AND vd.vehicle_type = p.vehicle_type AND vd.is_delete = '0' - WHERE p.region_code = 'KLHJ' AND p.point_type IN ('1', '2') - ORDER BY p.point_type, p.point_code + WHERE p.region_code = 'KLHJ' AND p.point_type = '1' + ORDER BY p.sort_seq ENDSELECT ENDPAGEQUERY ENDIF @@ -224,7 +228,7 @@ `sch_base_point` p WHERE p.region_code = 'BCPHJ' - ORDER BY p.point_code + ORDER BY p.sort_seq ENDSELECT ENDPAGEQUERY ENDIF @@ -232,8 +236,17 @@ IF 输入.flag = "10" PAGEQUERY SELECT - d.device_code + d.device_code, + LEFT(m.material_code, 11) AS material_code, + ( + SELECT IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS now_capacity FROM pdm_bi_device d + LEFT JOIN pdm_bd_workorder w ON w.device_code = d.device_code AND w.order_status = '3' + LEFT JOIN md_me_materialbase m ON m.material_id = w.material_id WHERE d.region_code = 'YZ' AND d.device_model IN ('3','4') ORDER BY d.device_code ENDSELECT @@ -243,8 +256,17 @@ IF 输入.flag = "11" PAGEQUERY SELECT - d.device_code + d.device_code, + IF(LENGTH(SUBSTRING(m.material_code, 6, 6))>0,SUBSTRING(m.material_code, 6, 6),'-') AS bom, + ( + SELECT IF(LENGTH(SUM(w.real_qty)) > 0,SUM(w.real_qty),0) + FROM pdm_bd_workorder w + WHERE w.device_code = d.device_code + AND DATE(w.plan_date) = CURDATE() + ) AS now_capacity FROM pdm_bi_device d + LEFT JOIN pdm_bd_workorder w ON w.device_code = d.device_code AND w.order_status = '3' + LEFT JOIN md_me_materialbase m ON m.material_id = w.material_id WHERE d.region_code = 'HL' ORDER BY d.device_code ENDSELECT @@ -252,23 +274,39 @@ ENDIF 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 + 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' + WHERE + point.region_code = 'KLHJ' + AND point.point_type IN ('2','3') + ORDER BY + point.point_code ASC + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "13" PAGEQUERY SELECT - point.point_code, - point.point_name, - point.point_status, - CASE point.point_status - WHEN '0' THEN '无货' - WHEN '1' THEN '有货' - ELSE '' - END AS point_status_name + p.point_code, + p.point_name, + p.region_code FROM - sch_base_point point - WHERE - point.region_code = 'KLHJ' - AND point.point_type IN ('2','3') - ORDER BY - point.point_code ASC + `sch_base_point` p + WHERE p.point_type IN ('1', '2') AND p.region_code = 'FJ' + ORDER BY p.point_code ENDSELECT ENDPAGEQUERY ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql index 49ed8f9..d0711c7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql @@ -183,9 +183,9 @@ p.point_name, p.point_status, CASE p.point_status - WHEN '0' THEN '无货' - WHEN '1' THEN '有货' - ELSE '' + WHEN '0' THEN '无货' + WHEN '1' THEN '有货' + ELSE '' END AS point_status_name, IF(LENGTH(mix_num)>0,CONCAT(DATE_FORMAT(CURRENT_DATE(), '%Y%m%d'),LPAD(mix_num, 3, '0')),'-') AS mix_num, IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code,