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 c74c1ed..19df591 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 @@ -48,7 +48,8 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> mixDayProductionTask = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找sql - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "HL")) + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "1", "region_code", "HL")) .process() .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { @@ -71,7 +72,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> pressDayProductionTask = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有混捻每周的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "YZ")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "1", "region_code", "YZ")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); setResultCompleteInProcessProduction(res, "YZ"); @@ -88,7 +92,8 @@ public class BigScreenServiceImpl implements BigScreenService { return null; }); // TODO: 3、当日成品 - CompletableFuture> manufacturedProductsDayProductionTask = CompletableFuture.supplyAsync(() -> { + CompletableFuture> manufacturedProductsDayProductionTask + = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); Random random = new Random(); // 使用随机数 @@ -152,11 +157,11 @@ public class BigScreenServiceImpl implements BigScreenService { }); // TODO: 6、最近10次设备故障 CompletableFuture> lastTenFailureTask = CompletableFuture.supplyAsync(() -> { - List res = new ArrayList<>(); + List res = new CopyOnWriteArrayList<>(); for (int i = 0; i < 5; i++) { FailureDeviceInfoDto dto = new FailureDeviceInfoDto(); dto.setDevice_code("hn01"); - dto.setDevice_name("混黏01"); + dto.setDevice_name("混撵01"); dto.setFailure_time("05-30 09:50:12"); dto.setFailure_info("机器故障"); dto.setDevice_status_name("待机"); @@ -173,7 +178,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 7、压制码垛位情况显示 CompletableFuture 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() .getResultJSONArray(0); return res; @@ -192,7 +198,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 8、压机信息显示 todo: 压机的状态,请求acs CompletableFuture pressMachineTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "10")) + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "10")) .process() .getResultJSONArray(0); for (int i = 0; i < res.size(); i++) { @@ -211,7 +218,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 9、混料机信息显示 todo: 设备状态,请求acs CompletableFuture mixMachineTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "11")) + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "11")) .process() .getResultJSONArray(0); for (int i = 0; i < res.size(); i++) { @@ -230,7 +238,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 10、困料货架的信息显示 CompletableFuture 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() .getResultJSONArray(0); return res; @@ -244,7 +253,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 11、半成品货架数据显示 CompletableFuture 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() .getResultJSONArray(0); return res; @@ -258,8 +268,10 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 12、混料机下料位 CompletableFuture mixBlankingTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "3")) - .process().getResultJSONArray(0); + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP") + .addParamMap(MapOf.of("flag", "3")) + .process() + .getResultJSONArray(0); return res; }, pool); mixBlankingTask.thenAccept(result -> { @@ -271,8 +283,10 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 13、液压机旁边困料货架数据显示 CompletableFuture trappedShelfTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "12")) - .process().getResultJSONArray(0); + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "12")) + .process() + .getResultJSONArray(0); return res; }, pool); trappedShelfTask.thenAccept(result -> { @@ -284,7 +298,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 14、分拣拆码垛对接位 CompletableFuture sortAndPalletizingTask = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "13")) + JSONArray res = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "13")) .process() .getResultJSONArray(0); // TODO: 颜色、实时数量请求acs系统 @@ -314,7 +329,8 @@ public class BigScreenServiceImpl implements BigScreenService { trappedShelfTask, sortAndPalletizingTask, semiFinishedProductShelfTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -335,7 +351,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> mixMaterialStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有混料设备的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "HL")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "1", "region_code", "HL")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); // 设备空数据值 @@ -352,8 +371,10 @@ public class BigScreenServiceImpl implements BigScreenService { sumRealDay += numberDto.getReal_qty(); sumPlanDay += numberDto.getPlan_qty(); } - res.put("hl_plan_day", BigDecimal.valueOf(sumPlanDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); - res.put("hl_real_day", BigDecimal.valueOf(sumRealDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("hl_plan_day", + BigDecimal.valueOf(sumPlanDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("hl_real_day", + BigDecimal.valueOf(sumRealDay / 1000).setScale(2, RoundingMode.HALF_UP).toString()); res.put("hl_productivity", (int)((sumRealDay / sumPlanDay)*100)); res.put("HLDayList", result); if (map.containsKey("HL")) { // 如果存在 @@ -385,7 +406,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> mixDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有混捻每周的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "2", "region_code", "HL")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "2", "region_code", "HL")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); setResultCompleteInProcessProduction(res, "HL"); @@ -428,7 +452,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> yzPlanAndRealStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有压制的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "1", "region_code", "YZ")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "1", "region_code", "YZ")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); setResultCompleteInProcessProduction(res, "YZ"); @@ -444,8 +471,10 @@ public class BigScreenServiceImpl implements BigScreenService { sumRealDay += numberDto.getReal_qty(); sumPlanDay += numberDto.getPlan_qty(); } - res.put("yz_plan_day", BigDecimal.valueOf(sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); - res.put("yz_real_day", BigDecimal.valueOf(sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("yz_plan_day", + BigDecimal.valueOf(sumPlanDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); + res.put("yz_real_day", + BigDecimal.valueOf(sumRealDay / 10000).setScale(2, RoundingMode.HALF_UP).toString()); res.put("yz_productivity", (int)((sumRealDay / sumPlanDay)*100)); res.put("YZDayList", result); if (map.containsKey("YZ")) { // 如果存在 @@ -477,7 +506,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> yzDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有压制每周的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "2", "region_code", "YZ")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "2", "region_code", "YZ")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); setResultCompleteInProcessProduction(res, "YZ"); @@ -520,7 +552,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> bzPlanAndRealStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有包装每天的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "3")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "3")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); } @@ -567,7 +602,10 @@ public class BigScreenServiceImpl implements BigScreenService { CompletableFuture> bzDeviceWeekDayStorage = CompletableFuture.supplyAsync(() -> { List res = new CopyOnWriteArrayList<>(); // 查找所有包装每周的数据 - JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION").addParamMap(MapOf.of("flag", "4")).process().getResultJSONArray(0); + JSONArray result = WQL.getWO("COCKPIT_PROCESS_PRODUCTION") + .addParamMap(MapOf.of("flag", "4")) + .process() + .getResultJSONArray(0); if (ObjectUtil.isNotEmpty(result)) { res = result.toJavaList(NumberDto.class); } @@ -662,7 +700,8 @@ public class BigScreenServiceImpl implements BigScreenService { bzPlanAndRealStorage, bzDeviceWeekDayStorage, cpDeviceDataStorage); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -741,7 +780,8 @@ public class BigScreenServiceImpl implements BigScreenService { mixedDayListTask, mixDevicePopoverInformationTask, cupRackDisplayTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -781,7 +821,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 3、困料货架数据显示 - 40货位 CompletableFuture trappedShelf40Task = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "6", "point_type", "1")) + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP") + .addParamMap(MapOf.of("flag", "6", "point_type", "1")) .process().getResultJSONArray(0); return res; }, pool); @@ -794,7 +835,8 @@ public class BigScreenServiceImpl implements BigScreenService { }); // 4、困料货架数据显示 - 6货位 CompletableFuture trappedShelf6Task = CompletableFuture.supplyAsync(() -> { - JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP").addParamMap(MapOf.of("flag", "6", "point_type", "2")) + JSONArray res = WQL.getWO("COCKPIT_MIX_AND_TRAP") + .addParamMap(MapOf.of("flag", "6", "point_type", "2")) .process().getResultJSONArray(0); return res; }, pool); @@ -810,7 +852,8 @@ public class BigScreenServiceImpl implements BigScreenService { trappedIOStockTask, trappedShelf40Task, trappedShelf6Task); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -893,7 +936,8 @@ public class BigScreenServiceImpl implements BigScreenService { pressPopoverTask, trayStationPopoverTask, manipulatorConditionTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -948,7 +992,8 @@ public class BigScreenServiceImpl implements BigScreenService { moldingDayTask, semiFinishedProductShelfTask, moldingIOStoringTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -1029,7 +1074,8 @@ public class BigScreenServiceImpl implements BigScreenService { semiFinishedIOTask, fireInTheKilnTask, coolingInTheKilnTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -1057,7 +1103,8 @@ public class BigScreenServiceImpl implements BigScreenService { // todo: 窑内数据 CompletableFuture allQuery = CompletableFuture.allOf( finishedProductShelfTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -1109,7 +1156,8 @@ public class BigScreenServiceImpl implements BigScreenService { return null; }); // todo: 4、当日成品 - CompletableFuture> manufacturedProductsDayProductionTask = CompletableFuture.supplyAsync(() -> { + CompletableFuture> manufacturedProductsDayProductionTask + = CompletableFuture.supplyAsync(() -> { List res = new ArrayList<>(); Random random = new Random(); // 使用随机数 @@ -1135,7 +1183,8 @@ public class BigScreenServiceImpl implements BigScreenService { packingAreaTask, sortingTask, manufacturedProductsDayProductionTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -1202,7 +1251,8 @@ public class BigScreenServiceImpl implements BigScreenService { splitOrPalletizingTask, devicesInfoTask, halfSupportCacheTask); - CompletableFuture> future = allQuery.thenApply((result) -> map).exceptionally((e) -> { + CompletableFuture> future + = allQuery.thenApply((result) -> map).exceptionally((e) -> { log.error(e.getMessage(), e); return null; }); @@ -1227,7 +1277,9 @@ public class BigScreenServiceImpl implements BigScreenService { } // 获取所有设备编码 WQLObject deviceTab = WQLObject.getWQLObject("pdm_bi_device"); - JSONArray resultJSONArray = deviceTab.query("region_code = '" + region_code + "' AND is_workorder = '1'").getResultJSONArray(0); + JSONArray resultJSONArray = deviceTab + .query("region_code = '" + region_code + "' AND is_workorder = '1'") + .getResultJSONArray(0); for (int i = 0; i < resultJSONArray.size(); i++) { JSONObject jsonObject = resultJSONArray.getJSONObject(i); if (!existingLabels.contains(jsonObject.getString("device_code"))) {