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 | 40 ++++++++++++++++++++++++++++------------ 1 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java index dcf22ca..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,10 +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", 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; } @@ -82,7 +86,7 @@ JSONObject shuttleData = JSON.parseObject(JSON.toJSONString(shuttleProtocol)); if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) { if (shuttleData != null) { - list.add(shuttleData); + baseObj.putAll(shuttleData); } continue; } @@ -97,7 +101,13 @@ } } - list.add(shuttleData); + 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); } @@ -106,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; } @@ -147,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); } @@ -300,7 +312,11 @@ assignCommand.setNodes(result.getNodes()); } else if (shuttleTaskModeType == ShuttleTaskModeType.MOVE_LOC_NO) { //绉诲姩鍒扮洰鏍囧簱浣� - NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleSlave.getId(), assignCommand.getTaskNo().intValue(), shuttleProtocol.getCurrentLocNo(), param.getDistLocNo(), NavigationMapType.NORMAL.id); + Integer mapType = NavigationMapType.NORMAL.id; + if (shuttleProtocol.getLiftPosition() == 2) { + mapType = NavigationMapType.DFX.id; + } + NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleSlave.getId(), assignCommand.getTaskNo().intValue(), shuttleProtocol.getCurrentLocNo(), param.getDistLocNo(), mapType); if (result == null) { throw new CoolException("璺緞璁$畻澶辫触"); } -- Gitblit v1.9.1