Browse Source

fix: 修复大屏

master
李永德 1 year ago
parent
commit
7ec9da956d
  1. 1
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java
  2. 97
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java
  3. 78
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.wql
  4. 6
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_SORTE_AND_PACKAGE.wql

1
lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/BigScreenService.java

@ -1,6 +1,5 @@
package org.nl.wms.cockpit.service; package org.nl.wms.cockpit.service;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**

97
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; 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 com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -170,7 +171,7 @@ public class BigScreenServiceImpl implements BigScreenService {
map.put("LastTenFailureList", null); map.put("LastTenFailureList", null);
return null; return null;
}); });
// 7、码垛位情况显示 // 7、压制码垛位情况显示
CompletableFuture<JSONArray> stackingPositionTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> stackingPositionTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "5", "region_code", "YZ")) JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "5", "region_code", "YZ"))
.process() .process()
@ -178,7 +179,7 @@ public class BigScreenServiceImpl implements BigScreenService {
return res; return res;
}, pool); }, pool);
stackingPositionTask.thenAccept(result -> { stackingPositionTask.thenAccept(result -> {
// TODO: 请求acs系统 // TODO: 颜色、实时数量请求acs系统
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
JSONObject jsonObject = result.getJSONObject(i); JSONObject jsonObject = result.getJSONObject(i);
jsonObject.put("color_status", ColorEnum.RED.getIndex()); jsonObject.put("color_status", ColorEnum.RED.getIndex());
@ -197,6 +198,7 @@ public class BigScreenServiceImpl implements BigScreenService {
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("device_status", DeviceStatusEnum.STANDBY.getCode()); jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode());
jsonObject.put("open_time", DateUtil.now());
} }
return res; return res;
}, pool); }, pool);
@ -215,6 +217,7 @@ public class BigScreenServiceImpl implements BigScreenService {
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("device_status", DeviceStatusEnum.STANDBY.getCode()); jsonObject.put("device_status", DeviceStatusEnum.STANDBY.getCode());
jsonObject.put("open_time", DateUtil.now());
} }
return res; return res;
}, pool); }, pool);
@ -225,34 +228,34 @@ public class BigScreenServiceImpl implements BigScreenService {
map.put("MixMachineList", null); map.put("MixMachineList", null);
return null; return null;
}); });
// 10、困料货架的信息显示 todo: 数据? // 10、困料货架的信息显示
// CompletableFuture<JSONArray> trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> trappedMaterialShelfTask = CompletableFuture.supplyAsync(() -> {
// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8")) JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "8"))
// .process() .process()
// .getResultJSONArray(0); .getResultJSONArray(0);
// return res; return res;
// }, pool); }, pool);
// trappedMaterialShelfTask.thenAccept(result -> { trappedMaterialShelfTask.thenAccept(result -> {
// map.put("TrappedMaterialShelfList", result); map.put("TrappedMaterialShelfList", result);
// }).exceptionally((e) -> { }).exceptionally((e) -> {
// log.error("困料货架的信息显示: {}", e.getMessage(), e); log.error("困料货架 - 40 货位的信息显示: {}", e.getMessage(), e);
// map.put("TrappedMaterialShelfList", null); map.put("TrappedMaterialShelfList", null);
// return null; return null;
// }); });
// 11、半成品货架数据显示 todo: 数据? // 11、半成品货架数据显示
// CompletableFuture<JSONArray> semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> semiFinishedProductShelfTask = CompletableFuture.supplyAsync(() -> {
// JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9")) JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "9"))
// .process() .process()
// .getResultJSONArray(0); .getResultJSONArray(0);
// return res; return res;
// }, pool); }, pool);
// semiFinishedProductShelfTask.thenAccept(result -> { semiFinishedProductShelfTask.thenAccept(result -> {
// map.put("SemiFinishedProductShelfList", result); map.put("SemiFinishedProductShelfList", result);
// }).exceptionally((e) -> { }).exceptionally((e) -> {
// log.error("半成品货架数据显示: {}", e.getMessage(), e); log.error("半成品货架数据显示: {}", e.getMessage(), e);
// map.put("SemiFinishedProductShelfList", null); map.put("SemiFinishedProductShelfList", null);
// return null; return null;
// }); });
// 12、混料机下料位 // 12、混料机下料位
CompletableFuture<JSONArray> mixBlankingTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> mixBlankingTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "3")) 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); map.put("MixBlankingList", null);
return null; return null;
}); });
// 13、困料货架数据显示 // 13、液压机旁边困料货架数据显示
CompletableFuture<JSONArray> trappedShelfTask = CompletableFuture.supplyAsync(() -> { CompletableFuture<JSONArray> trappedShelfTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "12")) JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "12"))
.process().getResultJSONArray(0); .process().getResultJSONArray(0);
@ -275,10 +278,29 @@ public class BigScreenServiceImpl implements BigScreenService {
trappedShelfTask.thenAccept(result -> { trappedShelfTask.thenAccept(result -> {
map.put("TrappedShelfList", result); map.put("TrappedShelfList", result);
}).exceptionally((e) -> { }).exceptionally((e) -> {
log.error("获取困料货架数据显示 - 6货位信息: {}", e.getMessage(), e); log.error("液压机旁边困料货架数据显示 - 6货位信息: {}", e.getMessage(), e);
map.put("TrappedShelfList", null); map.put("TrappedShelfList", null);
return null; return null;
}); });
// 14、分拣拆码垛对接位
CompletableFuture<JSONArray> 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<Void> allQuery = CompletableFuture.allOf( CompletableFuture<Void> allQuery = CompletableFuture.allOf(
mixDayProductionTask, mixDayProductionTask,
pressDayProductionTask, pressDayProductionTask,
@ -287,10 +309,11 @@ public class BigScreenServiceImpl implements BigScreenService {
lastMonthFailureTask, lastMonthFailureTask,
stackingPositionTask, stackingPositionTask,
pressMachineTask, pressMachineTask,
trappedMaterialShelfTask,
mixMachineTask, mixMachineTask,
trappedShelfTask); trappedShelfTask,
// trappedMaterialShelfTask, sortAndPalletizingTask,
// semiFinishedProductShelfTask); semiFinishedProductShelfTask);
CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return null; return null;
@ -1031,6 +1054,7 @@ public class BigScreenServiceImpl implements BigScreenService {
map.put("FinishedProductShelfList", null); map.put("FinishedProductShelfList", null);
return null; return null;
}); });
// todo: 窑内数据
CompletableFuture<Void> allQuery = CompletableFuture.allOf( CompletableFuture<Void> allQuery = CompletableFuture.allOf(
finishedProductShelfTask); finishedProductShelfTask);
CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> {
@ -1100,7 +1124,7 @@ public class BigScreenServiceImpl implements BigScreenService {
return res; return res;
}, pool); }, pool);
manufacturedProductsDayProductionTask.thenAccept((result) -> { manufacturedProductsDayProductionTask.thenAccept((result) -> {
map.put("CPDayList", result); map.put("CPDayList", result);
}).exceptionally((e) -> { }).exceptionally((e) -> {
log.error("当日成品生产: {}", e.getMessage(), e); log.error("当日成品生产: {}", e.getMessage(), e);
map.put("CPDayList", null); map.put("CPDayList", null);
@ -1141,6 +1165,7 @@ 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申请获取
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());

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

@ -186,7 +186,11 @@
p.point_code, p.point_code,
p.point_name, p.point_name,
p.region_code, 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, IF(LENGTH( vd.stand_status )> 0,vd.stand_status,'') AS stand_status,
CASE vd.stand_status CASE vd.stand_status
WHEN '2' THEN '困料中' WHEN '2' THEN '困料中'
@ -207,8 +211,8 @@
LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code LEFT JOIN st_ivt_vehicle_detail vd ON vd.vehicle_code = p.vehicle_code
AND vd.vehicle_type = p.vehicle_type AND vd.vehicle_type = p.vehicle_type
AND vd.is_delete = '0' AND vd.is_delete = '0'
WHERE p.region_code = 'KLHJ' AND p.point_type IN ('1', '2') WHERE p.region_code = 'KLHJ' AND p.point_type = '1'
ORDER BY p.point_type, p.point_code ORDER BY p.sort_seq
ENDSELECT ENDSELECT
ENDPAGEQUERY ENDPAGEQUERY
ENDIF ENDIF
@ -224,7 +228,7 @@
`sch_base_point` p `sch_base_point` p
WHERE WHERE
p.region_code = 'BCPHJ' p.region_code = 'BCPHJ'
ORDER BY p.point_code ORDER BY p.sort_seq
ENDSELECT ENDSELECT
ENDPAGEQUERY ENDPAGEQUERY
ENDIF ENDIF
@ -232,8 +236,17 @@
IF 输入.flag = "10" IF 输入.flag = "10"
PAGEQUERY PAGEQUERY
SELECT 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 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') WHERE d.region_code = 'YZ' AND d.device_model IN ('3','4')
ORDER BY d.device_code ORDER BY d.device_code
ENDSELECT ENDSELECT
@ -243,8 +256,17 @@
IF 输入.flag = "11" IF 输入.flag = "11"
PAGEQUERY PAGEQUERY
SELECT 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 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' WHERE d.region_code = 'HL'
ORDER BY d.device_code ORDER BY d.device_code
ENDSELECT ENDSELECT
@ -252,23 +274,39 @@
ENDIF ENDIF
IF 输入.flag = "12" 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 PAGEQUERY
SELECT SELECT
point.point_code, p.point_code,
point.point_name, p.point_name,
point.point_status, p.region_code
CASE point.point_status
WHEN '0' THEN '无货'
WHEN '1' THEN '有货'
ELSE ''
END AS point_status_name
FROM FROM
sch_base_point point `sch_base_point` p
WHERE WHERE p.point_type IN ('1', '2') AND p.region_code = 'FJ'
point.region_code = 'KLHJ' ORDER BY p.point_code
AND point.point_type IN ('2','3')
ORDER BY
point.point_code ASC
ENDSELECT ENDSELECT
ENDPAGEQUERY ENDPAGEQUERY
ENDIF ENDIF

6
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_name,
p.point_status, p.point_status,
CASE p.point_status CASE p.point_status
WHEN '0' THEN '无货' WHEN '0' THEN '无货'
WHEN '1' THEN '有货' WHEN '1' THEN '有货'
ELSE '' ELSE ''
END AS point_status_name, 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(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, IF(LENGTH(LEFT(m.material_code, 11))>0,LEFT(m.material_code, 11),'-') AS material_code,

Loading…
Cancel
Save