|
|
@ -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); |
|
|
|