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. 95
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/BigScreenServiceImpl.java
  3. 60
      lms/nladmin-system/src/main/java/org/nl/wms/cockpit/wql/COCKPIT_PROCESS_PRODUCTION.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;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**

95
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<JSONArray> 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<JSONArray> 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<JSONArray> 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<JSONArray> 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<JSONArray> 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<JSONArray> 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<JSONArray> 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<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(
mixDayProductionTask,
pressDayProductionTask,
@ -287,10 +309,11 @@ public class BigScreenServiceImpl implements BigScreenService {
lastMonthFailureTask,
stackingPositionTask,
pressMachineTask,
trappedMaterialShelfTask,
mixMachineTask,
trappedShelfTask);
// trappedMaterialShelfTask,
// semiFinishedProductShelfTask);
trappedShelfTask,
sortAndPalletizingTask,
semiFinishedProductShelfTask);
CompletableFuture<ConcurrentHashMap<String, Object>> 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<Void> allQuery = CompletableFuture.allOf(
finishedProductShelfTask);
CompletableFuture<ConcurrentHashMap<String, Object>> future = allQuery.thenApply((result) -> map).exceptionally((e) -> {
@ -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());

60
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
@ -256,14 +278,16 @@
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
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')
@ -272,3 +296,17 @@
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "13"
PAGEQUERY
SELECT
p.point_code,
p.point_name,
p.region_code
FROM
`sch_base_point` p
WHERE p.point_type IN ('1', '2') AND p.region_code = 'FJ'
ORDER BY p.point_code
ENDSELECT
ENDPAGEQUERY
ENDIF

Loading…
Cancel
Save