From bc0413809efd5440be383dc9f4ceeb828bdd9d35 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期六, 04 十一月 2023 15:45:53 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/ShuttleController.java | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java index 509ed36..d2f0e51 100644 --- a/src/main/java/com/zy/asrs/controller/ShuttleController.java +++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java @@ -7,6 +7,7 @@ import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.R; +import com.core.common.SpringUtils; import com.core.exception.CoolException; import com.zy.asrs.domain.param.ShuttleOperatorParam; import com.zy.asrs.domain.vo.*; @@ -71,14 +72,13 @@ @ManagerAuth(memo = "鍥涘悜绌挎杞︿俊鎭〃") public R shuttleStateTable(){ ArrayList<JSONObject> list = new ArrayList<>(); - List<BasShuttle> shuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().orderBy("shuttle_no")); - for (BasShuttle basShuttle : shuttles) { + for (ShuttleSlave slave : slaveProperties.getShuttle()) { // 琛ㄦ牸琛� JSONObject baseObj = new JSONObject(); - baseObj.put("shuttleNo", basShuttle.getShuttleNo()); + baseObj.put("shuttleNo", slave.getId()); list.add(baseObj); // 鑾峰彇鍥涘悜绌挎杞︿俊鎭� - NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, basShuttle.getShuttleNo()); + NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); if (shuttleThread == null) { continue; } @@ -101,6 +101,12 @@ } } + Integer chargeLine = basShuttleService.selectById(slave.getId()).getChargeLine(); + String lowerPower = "N"; + if (chargeLine != null && shuttleProtocol.getPowerPercent() != null) { + lowerPower = shuttleProtocol.getPowerPercent() <= chargeLine ? "Y" : "N"; + } + shuttleData.put("lowerPower", lowerPower);//鏄惁浣庣數閲� baseObj.putAll(shuttleData); } return R.ok().add(list); @@ -110,14 +116,13 @@ @ManagerAuth(memo = "鍥涘悜绌挎杞︽暟鎹〃") public R steMsgTable(){ List<ShuttleMsgTableVo> list = new ArrayList<>(); - List<BasShuttle> shuttles = basShuttleService.selectList(new EntityWrapper<BasShuttle>().orderBy("shuttle_no")); - for (BasShuttle basShuttle : shuttles) { + for (ShuttleSlave slave : slaveProperties.getShuttle()) { // 琛ㄦ牸琛� ShuttleMsgTableVo vo = new ShuttleMsgTableVo(); - vo.setShuttleNo(basShuttle.getShuttleNo()); // 鍥涘悜绌挎杞﹀彿 + vo.setShuttleNo(slave.getId()); // 鍥涘悜绌挎杞﹀彿 list.add(vo); // 鑾峰彇绌挎杞︿俊鎭� - ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, basShuttle.getShuttleNo()); + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); if (shuttleThread == null) { continue; } @@ -151,8 +156,11 @@ vo.setPakMk(shuttleProtocol.getPakMk()?"Y" : "N"); // 浣滀笟鏍囪 vo.setLocNo(shuttleProtocol.getLocNo());//鍥涘悜绌挎杞﹀綋鍓嶅簱浣嶅彿 vo.setLev(shuttleProtocol.getLocNo() == null ? 0 : Utils.getLev(shuttleProtocol.getLocNo()));//鍥涘悜绌挎杞﹀綋鍓嶅眰楂� -// vo.setRunSpeed(basShuttle.getRunSpeed());//鍥涘悜绌挎杞﹁繍琛岄�熷害(璁剧疆) - vo.setChargeLine(basShuttle.getChargeLine());//鍏呯數闃堝�� + + BasShuttle basShuttle = basShuttleService.selectById(slave.getId()); + if (basShuttle != null) { + vo.setChargeLine(basShuttle.getChargeLine());//鍏呯數闃堝�� + } } return R.ok().add(list); } -- Gitblit v1.9.1