From a6392a64ecbaa93ad3ad24f80cabc2fff615b34b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Thu, 17 Aug 2023 18:52:29 +0800 Subject: [PATCH] Update DashboardService.java --- .../dashboard/service/DashboardService.java | 163 ++++++++++++++++-- 1 file changed, 153 insertions(+), 10 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/dashboard/service/DashboardService.java b/lms/nladmin-system/src/main/java/org/nl/wms/dashboard/service/DashboardService.java index b70cca0..045613b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/dashboard/service/DashboardService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/dashboard/service/DashboardService.java @@ -23,7 +23,7 @@ public class DashboardService { // 当前设备情况--------------------------------------------------------------------------------------------------- JSONObject currentEquipmentCondition = new JSONObject(); result.put("currentEquipmentCondition", currentEquipmentCondition); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 currentEquipmentCondition.put("running", 10); currentEquipmentCondition.put("pausing", 4); currentEquipmentCondition.put("shutdown", 1); @@ -36,7 +36,7 @@ public class DashboardService { // 故障次数 JSONObject currentMonth = new JSONObject(); monthlyFailureStatistics.put("currentMonth", currentMonth); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 currentMonth.put("mix", 12); currentMonth.put("press", 8); currentMonth.put("dry", 4); @@ -45,7 +45,7 @@ public class DashboardService { // 平均次数 JSONObject average = new JSONObject(); monthlyFailureStatistics.put("average", average); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 average.put("mix", 16); average.put("press", 10); average.put("dry", 6); @@ -58,42 +58,42 @@ public class DashboardService { // 混料 JSONObject mix = new JSONObject(); dailyProductionStatistics.put("mix", mix); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 mix.put("planned", 64.25); mix.put("completed", 32.25); // 困料 JSONObject standing = new JSONObject(); dailyProductionStatistics.put("standing", standing); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 standing.put("onStanding", 32.25); standing.put("completed", 16.25); // 压制 JSONObject press = new JSONObject(); dailyProductionStatistics.put("press", press); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 press.put("planned", 64.25); press.put("completed", 32.25); // 干燥 JSONObject dry = new JSONObject(); dailyProductionStatistics.put("dry", dry); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 dry.put("planned", 64.25); dry.put("completed", 32.25); // 分拣 JSONObject sort = new JSONObject(); dailyProductionStatistics.put("sort", sort); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 sort.put("planned", 32.25); sort.put("completed", 16.25); // 设备生产统计--------------------------------------------------------------------------------------------------- JSONArray equipmentProductionStatistics = new JSONArray(); result.put("equipmentProductionStatistics", equipmentProductionStatistics); - // todo 现在是假数据,后期更新 + // todo 现在是假数据,后期更新。 for (int i = 1; i <= 3; i++) { JSONObject row = new JSONObject(); equipmentProductionStatistics.add(row); @@ -112,6 +112,149 @@ public class DashboardService { * @return 大屏首页设备 */ public JSONObject homepageEquipment() { - return null; + JSONObject result = new JSONObject(); + + // 混料区-------------------------------------------------------------------------------------------------------- + JSONObject mix = new JSONObject(); + result.put("mix", mix); + + // 混料机 + JSONArray mixingMachine = new JSONArray(); + mix.put("mixingMachine", mixingMachine); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 16; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "混料机" + i); + row.put("status", this.random(1, 4)); + mixingMachine.add(row); + } + + // 混料对接位 + JSONArray unloadLocation = new JSONArray(); + mix.put("unloadLocation", unloadLocation); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 16; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "混料机" + i + "下料位1"); + row.put("status", this.random(1, 4)); + mixingMachine.add(row); + } + + // 困料货架------------------------------------------------------------------------------------------------------ + JSONObject stand = new JSONObject(); + result.put("stand", stand); + + // 困料货位 + JSONArray storageLocation = new JSONArray(); + stand.put("storageLocation", storageLocation); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 8; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "困料货位" + i); + row.put("status", this.random(1, 4)); + String isHasGoods = this.random(0, 1); + row.put("isHasGoods", isHasGoods); + if ("1".equals(isHasGoods)) { + row.put("standStatus", this.random(1, 5)); + } + storageLocation.add(row); + } + + // 压制区-------------------------------------------------------------------------------------------------------- + JSONObject press = new JSONObject(); + result.put("press", press); + + // 压机上料位 + JSONArray loadLocation = new JSONArray(); + press.put("loadLocation", loadLocation); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 10; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "压机" + i + "上料位1"); + row.put("status", this.random(1, 4)); + loadLocation.add(row); + } + + // 压机 + JSONArray pressMachine = new JSONArray(); + press.put("pressMachine", pressMachine); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 10; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "压机" + i); + row.put("status", this.random(1, 4)); + pressMachine.add(row); + } + + // 码垛机械手 + JSONArray palletizingRobot = new JSONArray(); + press.put("palletizingRobot", palletizingRobot); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 5; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "码垛机械手" + i); + row.put("status", this.random(1, 4)); + palletizingRobot.add(row); + } + + // 压机下料位 + unloadLocation = new JSONArray(); + press.put("unloadLocation", unloadLocation); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 10; i++) { + for (int j = 1; j <= 2; j++) { + JSONObject row = new JSONObject(); + row.put("equipment", "压机" + i + "下料位" + j); + row.put("status", this.random(1, 4)); + unloadLocation.add(row); + } + } + + // 窑前货架------------------------------------------------------------------------------------------------------ + JSONObject frontWarehouse = new JSONObject(); + result.put("frontWarehouse", frontWarehouse); + + // 窑前货位 + storageLocation = new JSONArray(); + frontWarehouse.put("storageLocation", storageLocation); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 28; i += 2) { + JSONObject row = new JSONObject(); + row.put("equipment", "窑前货位" + i); + row.put("status", this.random(1, 4)); + row.put("isHasGoods", this.random(0, 1)); + storageLocation.add(row); + } + for (int i = 2; i <= 28; i += 2) { + JSONObject row = new JSONObject(); + row.put("equipment", "窑前货位" + i); + row.put("status", this.random(1, 4)); + row.put("isHasGoods", this.random(0, 1)); + storageLocation.add(row); + } + + // 干燥区-------------------------------------------------------------------------------------------------------- + JSONObject dry = new JSONObject(); + result.put("dry", dry); + + // 输送线 + JSONArray conveyorLine = new JSONArray(); + dry.put("conveyorLine", conveyorLine); + // todo 现在是假数据,后期更新。 + for (int i = 1; i <= 4; i++) { + JSONObject row = new JSONObject(); + row.put("equipment", "窑前输送线" + i); + row.put("status", this.random(1, 4)); + conveyorLine.add(row); + } + + // 桁架 + JSONArray gantryRobot = new JSONArray(); + + return result; + } + + private String random(int from, int to) { + return String.valueOf(from + (int) (Math.random() * (to - from + 1))); } }