From 14a6067ac871ed3c0d73ee1d1939db7a7aefe13a Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期五, 10 五月 2024 08:43:28 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java | 1
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java | 59 +++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionService.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java | 4
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java | 10 +
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java | 10 +
zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml | 14 ++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java | 21 +++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java | 33 ++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateSolution.java | 94 +++++++++++----
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java | 4
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java | 9 -
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java | 60 +++++-----
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java | 7
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java | 7 +
16 files changed, 261 insertions(+), 76 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
index 6c02d01..9ca36f9 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -250,7 +250,7 @@
if (shuttleThread == null) {
return;
}
- ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(false);
if (shuttleProtocol == null) {
return;
}
@@ -280,35 +280,6 @@
}
if (shuttleProtocol.getMoveType() == 0) {//璺戣建閬�
- ArrayList<String> locs = new ArrayList<>();
- for (int i = shuttleProtocol.getXCurrent(); i <= shuttleProtocol.getXTarget(); i++) {
- String locNo = Utils.getLocNo(i, shuttleProtocol.getYCurrent(), lev);
- locs.add(locNo);
- }
-
- List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>()
- .in(Loc::getLocNo, locs));
- if (locList.isEmpty()) {
- //绌哄簱浣�
- shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);
- return;
- }
-
- Loc start = locList.get(0);
- Loc target = locList.get(locList.size() - 1);
- //鍒ゆ柇灏忚溅鏄惁鍦ㄨ捣鐐逛綅缃�
- if (!shuttleProtocol.getCurrentLocNo().equals(start.getLocNo())) {//涓嶅湪璧风偣浣嶇疆锛岃皟搴﹀幓璧风偣浣嶇疆
- shuttleDispatcher.generateMoveTask(device, start.getLocNo());
- }else {
- //鍦ㄨ捣鐐逛綅缃紝璋冨害鍘荤洰鏍囦綅缃�
- if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) {
- shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝璺宠繃
- }else {
- shuttleDispatcher.generateMoveTask(device, start.getLocNo());
- shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);
- }
- }
- } else if (shuttleProtocol.getMoveType() == 1) {//璺戝簱浣�
Integer xCurrent = shuttleProtocol.getXCurrent();
if (xCurrent > shuttleProtocol.getXTarget()) {//褰揦鍊煎ぇ浜嶺鐩爣鍊硷紝杩涜褰掗浂涓擸鏂瑰悜+1
shuttleProtocol.setXCurrent(shuttleProtocol.getXStart());
@@ -338,6 +309,35 @@
shuttleDispatcher.generateMoveTask(device, target.getLocNo());
shuttleProtocol.setXCurrent(shuttleProtocol.getXCurrent() + 1);
}
+ } else if (shuttleProtocol.getMoveType() == 1) {//璺戝簱浣�
+ ArrayList<String> locs = new ArrayList<>();
+ for (int i = shuttleProtocol.getXCurrent(); i <= shuttleProtocol.getXTarget(); i++) {
+ String locNo = Utils.getLocNo(i, shuttleProtocol.getYCurrent(), lev);
+ locs.add(locNo);
+ }
+
+ List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>()
+ .in(Loc::getLocNo, locs));
+ if (locList.isEmpty()) {
+ //绌哄簱浣�
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);
+ return;
+ }
+
+ Loc start = locList.get(0);
+ Loc target = locList.get(locList.size() - 1);
+ //鍒ゆ柇灏忚溅鏄惁鍦ㄨ捣鐐逛綅缃�
+ if (!shuttleProtocol.getCurrentLocNo().equals(start.getLocNo())) {//涓嶅湪璧风偣浣嶇疆锛岃皟搴﹀幓璧风偣浣嶇疆
+ shuttleDispatcher.generateMoveTask(device, start.getLocNo());
+ }else {
+ //鍦ㄨ捣鐐逛綅缃紝璋冨害鍘荤洰鏍囦綅缃�
+ if (shuttleProtocol.getCurrentLocNo().equals(target.getLocNo())) {
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);//灏忚溅鍜岀洰鏍囦綅缃竴鑷达紝璺宠繃
+ }else {
+ shuttleDispatcher.generateMoveTask(device, start.getLocNo());
+ shuttleProtocol.setYCurrent(shuttleProtocol.getYCurrent() + 1);
+ }
+ }
} else if (shuttleProtocol.getMoveType() == 2) {//姣嶈建閬撳惊鐜窇
Integer xCurrent = shuttleProtocol.getXCurrent();
Integer yCurrent = shuttleProtocol.getYCurrent();
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
index e9a34f5..5c202ea 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/controller/BasShuttleController.java
@@ -243,14 +243,7 @@
return R.error("灏忚溅蹇欑涓�");
}
- shuttleProtocol.setMoveLoc(true);//寮�鍚窇搴�
- shuttleProtocol.setMoveType(param.getMoveType());
- shuttleProtocol.setXStart(param.getStartX());
- shuttleProtocol.setXTarget(param.getTargetX());
- shuttleProtocol.setXCurrent(param.getStartX());
- shuttleProtocol.setYStart(param.getStartY());
- shuttleProtocol.setYTarget(param.getTargetY());
- shuttleProtocol.setYCurrent(param.getStartY());
+ shuttleThread.enableMoveLoc(param);
return R.ok();
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java
index 0b08625..66c59da 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java
@@ -190,6 +190,7 @@
Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
.eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
.eq(Device::getDeviceNo, shuttleNo)
+ .eq(Device::getStatus, 1)
);
if (null == device) {
return vo;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
index ddcac62..e560ada 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/mapper/TaskMapper.java
@@ -26,6 +26,10 @@
List<Task> selectManualByExecuteSts();
+ List<Task> selectMoveByAnalyzeSts();
+
+ List<Task> selectMoveByExecuteSts();
+
List<Task> selectWaitAnalyzeInBoundTask();
List<Task> selectPakOut();
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionService.java
index a84797f..854c134 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/MotionService.java
@@ -23,4 +23,6 @@
// 鎸佷箙鍖� motion 骞剁敓浜riority
int batchInsert(List<Motion> motionList, String uuid, Integer taskNo);
+ int batchInsert(List<Motion> motionList, String uuid, Integer taskNo, Long hostId);
+
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
index 166eb58..47ecd7a 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/TaskService.java
@@ -24,6 +24,10 @@
List<Task> selectManualByExecuteSts();
+ List<Task> selectMoveByAnalyzeSts();
+
+ List<Task> selectMoveByExecuteSts();
+
List<Task> selectWaitAnalyzeInBoundTask();
List<Task> selectPakOut();
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
index 8176068..56a8231 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -83,7 +83,7 @@
public synchronized void initRealtimeBasMap() {
try {
List<Dict> dicts = dictService.list(new LambdaQueryWrapper<Dict>()
- .like(Dict::getFlag, "map")
+ .like(Dict::getFlag, "map-")
.eq(Dict::getStatus, 1));
TreeMap<Integer, ArrayList<ArrayList<MapNode>>> levData = new TreeMap<>();
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
index 56a428b..6bc68e0 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java
@@ -77,12 +77,15 @@
}
@Override
- public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) {
+ public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo, Long hostId) {
int i = motionList.size();
for (Motion motion : motionList) {
motion.setPriority(i);
motion.setTaskNo(taskNo);
motion.setUuid(uuid);
+ if (hostId != null) {
+ motion.setHostId(hostId);
+ }
if (!this.save(motion)) {
throw new CoolException(JSON.toJSONString(motion) + "鍔ㄤ綔淇濆瓨澶辫触");
}
@@ -90,4 +93,9 @@
}
return motionList.size();
}
+
+ @Override
+ public int batchInsert(List<Motion> motionList, String uuid, Integer taskNo) {
+ return batchInsert(motionList, uuid, taskNo, null);
+ }
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
index 394edcf..8004414 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/TaskServiceImpl.java
@@ -87,6 +87,16 @@
}
@Override
+ public List<Task> selectMoveByAnalyzeSts() {
+ return this.baseMapper.selectMoveByAnalyzeSts();
+ }
+
+ @Override
+ public List<Task> selectMoveByExecuteSts() {
+ return this.baseMapper.selectMoveByExecuteSts();
+ }
+
+ @Override
public List<Task> selectWaitAnalyzeInBoundTask() {
return this.baseMapper.selectWaitAnalyzeInBoundTask();
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
index 10f3f7d..1cb6c4e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/MotionTimer.java
@@ -41,7 +41,7 @@
@Autowired
private ShuttleCommandService shuttleCommandService;
-// @Scheduled(cron = "0/1 * * * * ? ")
+ @Scheduled(cron = "0/1 * * * * ? ")
public synchronized void executeTask() {
Date now = new Date();
// ANALYZE_INBOUND
@@ -226,6 +226,63 @@
}
@Scheduled(cron = "0/1 * * * * ? ")
+ public synchronized void executeMoveTask() {
+ Date now = new Date();
+ // ANALYZE_MOVE
+ for (Task task : taskService.selectMoveByAnalyzeSts()) {
+ Motion executingMotion = motionService.selectOfTop1(task.getUuid(), MotionStsType.EXECUTING.val(), task.getHostId());
+ if (executingMotion != null) {//瀛樺湪姝e湪鎵ц鐨刴otion
+ continue;
+ }
+
+ Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.INIT.val(), task.getHostId());
+ if (null != motion) {
+ boolean result = this.executeMotion(motion);
+ if (!result) {
+ continue;
+ }
+ // 鏇存柊Task
+ switch (TaskStsType.query(task.getTaskSts())) {
+ case ANALYZE_MOVE:
+ task.setTaskSts(TaskStsType.EXECUTE_MOVE.sts);
+ break;
+ }
+ task.setUpdateTime(now);
+ if (!taskService.updateById(task)) {
+ log.error("{}鍏朵粬宸ヤ綔妗f洿鏂扮姸鎬佸け璐ワ紒", task.getTaskNo());
+ }
+ }
+ }
+ // EXECUTE_MOVE
+ for (Task task : taskService.selectMoveByExecuteSts()) {
+ if (!motionService.hasRunningMotion(task.getUuid(), task.getHostId())) {
+ Motion motion = motionService.selectOfTop1(task.getUuid(), MotionStsType.WAITING.val(), task.getHostId());
+ if (null != motion) {
+ boolean result = this.executeMotion(motion);
+ if (!result) {
+ continue;
+ }
+ } else {
+ if (motionService.selectOfTop1(task.getUuid(), MotionStsType.EXECUTING.val(), task.getHostId()) != null) {
+ continue;
+ }
+
+ // 鏇存柊Task
+ switch (TaskStsType.query(task.getTaskSts())) {
+ case EXECUTE_MOVE:
+ task.setTaskSts(TaskStsType.COMPLETE_MOVE.sts);
+ break;
+ }
+ task.setUpdateTime(now);
+ if (!taskService.updateById(task)) {
+ log.error("{}浠栧伐浣滄。鏇存柊鐘舵�佸け璐ワ紒", task.getTaskNo());
+ }
+ }
+ }
+ }
+ }
+
+ @Scheduled(cron = "0/1 * * * * ? ")
public void scanMotionByExecuting() {
List<Motion> motionList = motionService.selectBySts(MotionStsType.EXECUTING.val());
for (Motion motion : motionList) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateSolution.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateSolution.java
index 677c6f0..9fc734c 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateSolution.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/NavigateSolution.java
@@ -1,7 +1,10 @@
package com.zy.asrs.wcs.core.utils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.wcs.core.model.NavigateNode;
+import com.zy.asrs.wcs.system.entity.Dict;
+import com.zy.asrs.wcs.system.service.DictService;
import java.util.ArrayList;
import java.util.List;
@@ -13,7 +16,7 @@
*/
public class NavigateSolution {
- // -1 -> 澧欏锛� 1 -> 璧风偣 2 -> 缁堢偣 3-> 姣嶈建 4->绔欑偣
+ // -1 -> 澧欏锛� 0 -> 璐т綅锛� 1 -> 璧风偣 2 -> 缁堢偣 3-> 姣嶈建 4->绔欑偣
int[][] map = {{}};
@@ -97,6 +100,18 @@
public ArrayList<NavigateNode> extend_current_node(NavigateNode current_node) {
+ //榛樿鍦板浘姣嶈建鏂瑰悜x
+ String mapDirection = "x";
+ DictService dictService = SpringUtils.getBean(DictService.class);
+ if (dictService != null) {
+ Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>()
+ .eq(Dict::getFlag, "direction_map")
+ .eq(Dict::getStatus, 1));
+ if (dict != null) {
+ mapDirection = dict.getValue();
+ }
+ }
+
//鑾峰彇褰撳墠缁撶偣鐨剎, y
int x = current_node.getX();
int y = current_node.getY();
@@ -129,31 +144,62 @@
// neighbour_node.add(node);
// }
// }
- if (map[x][y] == 3) {
- //姣嶈建鎵嶈兘杩涜宸﹀彸绉诲姩
- if (is_valid(x, y + 1))
- {
- NavigateNode node = new NavigateNode(x, y + 1);
- neighbour_node.add(node);
- }
- if (is_valid(x, y - 1))
- {
- NavigateNode node = new NavigateNode(x, y - 1);
- neighbour_node.add(node);
- }
- }
- if (map[x][y] == 0 || map[x][y] == 3 || map[x][y] == 4 || map[x][y] == 5) {
- //瀛愯建鍜屾瘝杞ㄣ�佽緭閫佺嚎銆佸厖鐢垫々鎵嶈兘杩涜涓婁笅绉诲姩
- if (is_valid(x + 1, y))
- {
- NavigateNode node = new NavigateNode(x + 1, y);
- neighbour_node.add(node);
+ if (mapDirection.equals("x")) {//姣嶈建x鏂瑰悜
+ if (map[x][y] == 3) {
+ //姣嶈建鎵嶈兘杩涜涓婁笅绉诲姩
+ if (is_valid(x + 1, y))
+ {
+ NavigateNode node = new NavigateNode(x + 1, y);
+ neighbour_node.add(node);
+ }
+ if (is_valid(x - 1, y))
+ {
+ NavigateNode node = new NavigateNode(x -1, y);
+ neighbour_node.add(node);
+ }
}
- if (is_valid(x - 1, y))
- {
- NavigateNode node = new NavigateNode(x -1, y);
- neighbour_node.add(node);
+
+ if (map[x][y] == 0 || map[x][y] == 3 || map[x][y] == 4 || map[x][y] == 5) {
+ //瀛愯建鍜屾瘝杞ㄣ�佽緭閫佺嚎銆佸厖鐢垫々鎵嶈兘杩涜宸﹀彸绉诲姩
+ if (is_valid(x, y + 1))
+ {
+ NavigateNode node = new NavigateNode(x, y + 1);
+ neighbour_node.add(node);
+ }
+ if (is_valid(x, y - 1))
+ {
+ NavigateNode node = new NavigateNode(x, y - 1);
+ neighbour_node.add(node);
+ }
+ }
+ }else if (mapDirection.equals("y")) {//姣嶈建y鏂瑰悜
+ if (map[x][y] == 3) {
+ //姣嶈建鎵嶈兘杩涜宸﹀彸绉诲姩
+ if (is_valid(x, y + 1))
+ {
+ NavigateNode node = new NavigateNode(x, y + 1);
+ neighbour_node.add(node);
+ }
+ if (is_valid(x, y - 1))
+ {
+ NavigateNode node = new NavigateNode(x, y - 1);
+ neighbour_node.add(node);
+ }
+ }
+
+ if (map[x][y] == 0 || map[x][y] == 3 || map[x][y] == 4 || map[x][y] == 5) {
+ //瀛愯建鍜屾瘝杞ㄣ�佽緭閫佺嚎銆佸厖鐢垫々鎵嶈兘杩涜涓婁笅绉诲姩
+ if (is_valid(x + 1, y))
+ {
+ NavigateNode node = new NavigateNode(x + 1, y);
+ neighbour_node.add(node);
+ }
+ if (is_valid(x - 1, y))
+ {
+ NavigateNode node = new NavigateNode(x -1, y);
+ neighbour_node.add(node);
+ }
}
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
index b56b3ff..19b2732 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -164,9 +164,6 @@
return null;
}
- //鑾峰彇閬胯浣嶇疆
- String standByLocNo = this.searchStandByLocNo(Integer.valueOf(device.getDeviceNo()), device.getHostId(), shuttleThread.getStatus().getCurrentLocNo());
-
Task task = new Task();
task.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
task.setTaskNo(String.valueOf(Utils.getTaskNo("MOVE")));
@@ -176,7 +173,7 @@
task.setOriginSite(null);
task.setOriginLoc(null);
task.setDestSite(null);
- task.setDestLoc(standByLocNo); // 閬胯浣嶇疆
+ task.setDestLoc(locNo); // 杩佺Щ浣嶇疆
task.setIoTime(new Date());
task.setStartTime(new Date());
task.setHostId(device.getHostId());
@@ -189,7 +186,7 @@
News.error("淇濆瓨{}鍙峰洓鍚戠┛姊溅杩佺Щ浠诲姟澶辫触!!!", device.getDeviceNo());
return null;
}
- motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()));
+ motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), device.getHostId());
task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts);
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
index 31cf9a5..e3fe09f 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java
@@ -1,6 +1,7 @@
package com.zy.asrs.wcs.rcs.thread;
import com.zy.asrs.wcs.common.ExecuteSupport;
+import com.zy.asrs.wcs.core.domain.param.ShuttleMoveLocParam;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
@@ -12,7 +13,9 @@
public interface ShuttleThread extends ThreadHandler{
- ShuttleProtocol getStatus();//鑾峰彇鍥涘悜绌挎杞︾姸鎬�
+ ShuttleProtocol getStatus(boolean clone);//鑾峰彇鍥涘悜绌挎杞︾姸鎬�
+
+ ShuttleProtocol getStatus();//鑾峰彇鍥涘悜绌挎杞︾姸鎬�-榛樿clone
Device getDevice();//鑾峰彇璁惧淇℃伅
@@ -50,6 +53,8 @@
boolean setPakMk(boolean pakMk);//璁剧疆鏍囪
+ boolean enableMoveLoc(ShuttleMoveLocParam param);
+
//***************鑾峰彇鍛戒护*****************
ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes);//鑾峰彇绉诲姩鍛戒护
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
index b0ff86f..4e4122d 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -9,6 +9,7 @@
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.common.ExecuteSupport;
+import com.zy.asrs.wcs.core.domain.param.ShuttleMoveLocParam;
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.MapNode;
@@ -343,10 +344,15 @@
@Override
public ShuttleProtocol getStatus() {
+ return getStatus(true);
+ }
+
+ @Override
+ public ShuttleProtocol getStatus(boolean clone) {
if (this.shuttleProtocol == null) {
return null;
}
- return this.shuttleProtocol.clone();
+ return clone ? this.shuttleProtocol.clone() : this.shuttleProtocol;
}
@Override
@@ -652,6 +658,19 @@
}
@Override
+ public boolean enableMoveLoc(ShuttleMoveLocParam param) {
+ shuttleProtocol.setMoveLoc(true);//寮�鍚窇搴�
+ shuttleProtocol.setMoveType(param.getMoveType());
+ shuttleProtocol.setXStart(param.getStartX());
+ shuttleProtocol.setXTarget(param.getTargetX());
+ shuttleProtocol.setXCurrent(param.getStartX());
+ shuttleProtocol.setYStart(param.getStartY());
+ shuttleProtocol.setYTarget(param.getTargetY());
+ shuttleProtocol.setYCurrent(param.getStartY());
+ return true;
+ }
+
+ @Override
public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
NyShuttleHttpCommand httpStandard = getHttpStandard(Integer.parseInt(device.getDeviceNo()), taskNo);
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
index 32d18d7..55d704e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -10,6 +10,7 @@
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.common.ExecuteSupport;
+import com.zy.asrs.wcs.core.domain.param.ShuttleMoveLocParam;
import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -184,6 +185,7 @@
basShuttle.setStatus(1);
basShuttle.setDeleted(0);
basShuttle.setHostId(device.getHostId());
+ basShuttle.setDeviceId(device.getId().intValue());
shuttleService.save(basShuttle);
}
//浠诲姟鍙�
@@ -217,10 +219,15 @@
@Override
public ShuttleProtocol getStatus() {
+ return getStatus(true);
+ }
+
+ @Override
+ public ShuttleProtocol getStatus(boolean clone) {
if (this.shuttleProtocol == null) {
return null;
}
- return this.shuttleProtocol.clone();
+ return clone ? this.shuttleProtocol.clone() : this.shuttleProtocol;
}
@Override
@@ -257,11 +264,11 @@
NavigateNode targetPath = sectionNodes.get(sectionNodes.size() - 1);
if (ShuttleRunDirection.get(startPath.getDirection()) == ShuttleRunDirection.LEFT
|| ShuttleRunDirection.get(startPath.getDirection()) == ShuttleRunDirection.RIGHT) {
- //姣嶈建鏂瑰悜
- oper = 5;
- } else {
//瀛愯建鏂瑰悜
oper = 6;
+ } else {
+ //姣嶈建鏂瑰悜
+ oper = 5;
}
for (int i = 0; i < sectionNodes.size(); i++) {
@@ -299,7 +306,11 @@
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
Integer code = jsonObject.getInteger("code");
+ System.out.println("璺緞涓嬪彂" + taskNo);
+ System.out.println(JSON.toJSONString(jsonObject));
+ System.out.println(JSON.toJSONString(param));
if (code.equals(200)) {
+ System.out.println("璺緞涓嬪彂" + taskNo);
return true;
}
} catch (Exception e) {
@@ -329,6 +340,7 @@
.doPost();
JSONObject jsonObject = JSON.parseObject(response);
Integer code = jsonObject.getInteger("code");
+ System.out.println(JSON.toJSONString(command.getBody()));
if (code.equals(200)) {
this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
return true;
@@ -608,6 +620,19 @@
}
@Override
+ public boolean enableMoveLoc(ShuttleMoveLocParam param) {
+ shuttleProtocol.setMoveLoc(true);//寮�鍚窇搴�
+ shuttleProtocol.setMoveType(param.getMoveType());
+ shuttleProtocol.setXStart(param.getStartX());
+ shuttleProtocol.setXTarget(param.getTargetX());
+ shuttleProtocol.setXCurrent(param.getStartX());
+ shuttleProtocol.setYStart(param.getStartY());
+ shuttleProtocol.setYTarget(param.getTargetY());
+ shuttleProtocol.setYCurrent(param.getStartY());
+ return true;
+ }
+
+ @Override
public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
HashMap<String, Object> body = new HashMap<>();
body.put("messageName", "runOrder");
diff --git a/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml b/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
index 81aefdb..4558156 100644
--- a/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
+++ b/zy-asrs-wcs/src/main/resources/mapper/core/TaskMapper.xml
@@ -52,6 +52,20 @@
order by priority desc,start_time,task_no asc
</select>
+ <select id="selectMoveByAnalyzeSts" resultType="com.zy.asrs.wcs.core.entity.Task">
+ select * from wcs_task
+ where 1=1
+ and task_sts in (302)
+ order by priority desc,start_time,task_no asc
+ </select>
+
+ <select id="selectMoveByExecuteSts" resultType="com.zy.asrs.wcs.core.entity.Task">
+ select * from wcs_task
+ where 1=1
+ and task_sts in (303)
+ order by priority desc,start_time,task_no asc
+ </select>
+
<select id="selectWaitAnalyzeInBoundTask" resultType="com.zy.asrs.wcs.core.entity.Task">
select * from wcs_task where task_ctg = 1 and task_sts = 1
</select>
--
Gitblit v1.9.1