add: 大屏窑、行架等数据

This commit is contained in:
2023-07-04 14:40:25 +08:00
parent 50922a29bf
commit cb333295ab
3 changed files with 90 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ package org.nl.wms.cockpit.service.enums;
* @Date: 2023/6/26
*/
public enum ErrorInfoEnum {
no_error("0", ""),
scram("1", "急停中"),
LIGHT_CURTAIN_ALARM("2", "光幕报警"),
BODY_ALARM("3", "本体报警"),

View File

@@ -15,6 +15,7 @@ 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.cockpit.service.enums.ErrorInfoEnum;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.sch.task.util.TaskUtils;
import org.nl.wms.util.MapOf;
@@ -246,6 +247,13 @@ public class BigScreenServiceImpl implements BigScreenService {
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONObject devicesStatus = null;
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res;
for (int i = 0; i < data.size(); i++) {
JSONObject object = data.getJSONObject(i);
String realQty = object.getString("real_qty");
if (ObjectUtil.isNotEmpty(realQty)) {
object.put("now_capacity", realQty);
}
}
return data;
}, pool);
pressMachineTask.thenAccept(result -> {
@@ -397,6 +405,71 @@ public class BigScreenServiceImpl implements BigScreenService {
map.put("ManipulatorInfoList", null);
return null;
});
// 16、窑口4个位置
CompletableFuture<JSONArray> kilneye4InfoTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = new JSONArray();
for (int i = 1; i <= 4; i++) {
String device = "JYHJ0" + i;
JSONObject d = new JSONObject();
d.put("device_code", device);
res.add(d);
}
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONObject devicesStatus = null;
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res;
return data;
}, pool);
kilneye4InfoTask.thenAccept(result -> {
map.put("kilneye4InfoList", result);
}).exceptionally((e) -> {
log.error("窑4个位置: {}", e.getMessage(), e);
map.put("kilneye4InfoList", null);
return null;
});
// 17、窑道2个位置
CompletableFuture<JSONObject> KilnPassage2InfoTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = new JSONArray();
JSONObject d1 = new JSONObject();
JSONObject result = new JSONObject();
d1.put("device_code", "LQD01");
res.add(d1);
d1.put("device_code", "HCD01");
res.add(d1);
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONObject devicesStatus = null;
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res;
for (int i = 0; i < data.size(); i++) {
JSONObject jsonObject = data.getJSONObject(i);
jsonObject.put("error_name", ErrorInfoEnum.getErrorInfoEnumByCode(jsonObject.getString("error")).getName());
result.put(jsonObject.getString("device_code"), jsonObject);
}
return result;
}, pool);
KilnPassage2InfoTask.thenAccept(result -> {
map.put("KilnPassage2InfoList", result);
}).exceptionally((e) -> {
log.error("窑道2个位置: {}", e.getMessage(), e);
map.put("KilnPassage2InfoList", null);
return null;
});
// 18、进窑桁架和出窑桁架
CompletableFuture<JSONArray> ioKilnTrussTask = CompletableFuture.supplyAsync(() -> {
JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION")
.addParamMap(MapOf.of("flag", "15"))
.process()
.getResultJSONArray(0);
JSONObject devicesStatus = PointUpdateUtil.getDevicesStatus(res);
// JSONObject devicesStatus = null;
JSONArray data = ObjectUtil.isNotEmpty(devicesStatus) ? devicesStatus.getJSONArray("data") : res;
return data;
}, pool);
ioKilnTrussTask.thenAccept(result -> {
map.put("IoKilnTrussTask", result);
}).exceptionally((e) -> {
log.error("进窑桁架和出窑桁架: {}", e.getMessage(), e);
map.put("IoKilnTrussTask", null);
return null;
});
CompletableFuture<Void> allQuery = CompletableFuture.allOf(
mixDayProductionTask,
pressDayProductionTask,
@@ -410,7 +483,10 @@ public class BigScreenServiceImpl implements BigScreenService {
trappedShelfTask,
sortAndPalletizingTask,
semiFinishedProductShelfTask,
manipulatorInfoTask);
manipulatorInfoTask,
kilneye4InfoTask,
KilnPassage2InfoTask,
ioKilnTrussTask);
CompletableFuture<ConcurrentHashMap<String, Object>> future
= allQuery.thenApply((result) -> map).exceptionally((e) -> {
log.error(e.getMessage(), e);

View File

@@ -345,3 +345,15 @@
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "15"
PAGEQUERY
SELECT
d.device_code
FROM
`pdm_bi_device` d
WHERE d.region_code = 'SZ' AND d.device_model IN ('6', '8')
ORDER BY d.device_model
ENDSELECT
ENDPAGEQUERY
ENDIF