From fb7fb0abb4386c13c7712cc9a7bee80b3c2cb72c Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期四, 26 十月 2023 20:26:43 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/controller/ShuttleController.java | 79 +++++++++++++++++++++++++++++++++------
1 files changed, 67 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 3c7508f..7ed35f3 100644
--- a/src/main/java/com/zy/asrs/controller/ShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -17,6 +17,7 @@
import com.zy.asrs.service.WrkMastService;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.NyShuttleOperaResult;
+import com.zy.common.model.enums.NavigationMapType;
import com.zy.common.service.CommonService;
import com.zy.common.utils.NyHttpUtils;
import com.zy.common.utils.NyShuttleOperaUtils;
@@ -70,10 +71,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;
}
@@ -81,7 +85,7 @@
JSONObject shuttleData = JSON.parseObject(JSON.toJSONString(shuttleProtocol));
if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) {
if (shuttleData != null) {
- list.add(shuttleData);
+ baseObj.putAll(shuttleData);
}
continue;
}
@@ -96,7 +100,7 @@
}
}
- list.add(shuttleData);
+ baseObj.putAll(shuttleData);
}
return R.ok().add(list);
}
@@ -105,14 +109,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;
}
@@ -146,8 +149,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);
}
@@ -299,7 +305,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());
+ 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("璺緞璁$畻澶辫触");
}
@@ -338,6 +348,15 @@
shuttleProtocol.setToken(0);//浠ょ墝娓呯┖
shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);//浠诲姟鐘舵��-绌洪棽
shuttleProtocol.setPakMk(false);//浣滀笟鏍囪澶嶄綅
+
+ shuttleProtocol.setMoveLoc(false);
+ shuttleProtocol.setMoveType(0);
+ shuttleProtocol.setXStart(0);
+ shuttleProtocol.setXTarget(0);
+ shuttleProtocol.setXCurrent(0);
+ shuttleProtocol.setYStart(0);
+ shuttleProtocol.setYTarget(0);
+ shuttleProtocol.setYCurrent(0);
return R.ok();
} else if (shuttleTaskModeType == ShuttleTaskModeType.SHUTTLE_CONTROL) {
//灏忚溅绠″埗
@@ -410,4 +429,40 @@
return R.ok();
}
+ /**
+ * 璺戝簱绋嬪簭
+ */
+ @PostMapping("/moveLoc")
+ @ManagerAuth
+ public R moveLoc(@RequestParam Integer shuttleNo,
+ @RequestParam Integer moveType,
+ @RequestParam Integer xStart,
+ @RequestParam Integer xTarget,
+ @RequestParam Integer yStart,
+ @RequestParam Integer yTarget) {
+ NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
+ if (shuttleThread == null) {
+ return R.error();
+ }
+
+ NyShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
+ if (shuttleProtocol == null) {
+ return R.error();
+ }
+
+ if (!shuttleProtocol.isIdle()) {
+ return R.error("灏忚溅蹇欑涓�");
+ }
+
+ shuttleProtocol.setMoveLoc(true);//寮�鍚窇搴�
+ shuttleProtocol.setMoveType(moveType);
+ shuttleProtocol.setXStart(xStart);
+ shuttleProtocol.setXTarget(xTarget);
+ shuttleProtocol.setXCurrent(xStart);
+ shuttleProtocol.setYStart(yStart);
+ shuttleProtocol.setYTarget(yTarget);
+ shuttleProtocol.setYCurrent(yStart);
+ return R.ok();
+ }
+
}
--
Gitblit v1.9.1