From 33b4d29eb2ba86f3480b5060f863c45818592ba3 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 16 四月 2024 14:47:31 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java | 12 ++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MotionServiceImpl.java | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java | 2
zy-asrs-wcs/src/main/resources/application.yml | 2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java | 18 +++-
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java | 53 ++++++++++--
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java | 10 +-
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java | 5 +
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java | 24 +++---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java | 6
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java | 37 ++++----
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/ShuttleThread.java | 10 ++
13 files changed, 123 insertions(+), 60 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 0f53a3c..8ce012d 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
@@ -63,7 +63,7 @@
ShuttleRedisCommand redisCommand = new ShuttleRedisCommand();
redisCommand.setShuttleNo(assignCommand.getShuttleNo());//鍥涘悜绌挎杞﹀彿
- redisCommand.setWrkNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
+ redisCommand.setTaskNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
redisCommand.setCommandStep(0);//鍛戒护鎵ц姝ュ簭
redisCommand.setAssignCommand(assignCommand);//鍛戒护
//浠诲姟鏁版嵁淇濆瓨鍒皉edis
@@ -73,12 +73,12 @@
|| assignCommand.getTaskMode() == ShuttleTaskModeType.MOVE_LOC_NO.id
|| assignCommand.getTaskMode() == ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO.id) {
//涓嬪彂琛岄┒璺緞
- boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getTaskNo());
+ boolean result = shuttleThread.movePath(assignCommand.getNodes(), assignCommand.getDeviceTaskNo());
if (!result) {
return false;
}
}
- shuttleProtocol.setTaskNo(assignCommand.getTaskNo());
+ shuttleProtocol.setSyncTaskNo(assignCommand.getTaskNo());
return true;
}
return false;
@@ -182,7 +182,7 @@
}
// 鏇存柊redis鏁版嵁
- redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
if (!command.getComplete()) {
return false;
@@ -197,25 +197,25 @@
if (assignCommand.getAuto()) {
if (!assignCommand.getCharge()) {
//瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
}else {
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
}
News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
// 鎵嬪姩浠诲姟
} else {
//鎵嬪姩妯″紡涓嶆姏鍑虹瓑寰呯姸鎬侊紝鐩存帴澶嶄綅绌洪棽鐘舵��
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
//浠诲姟鍙锋竻闆�
- shuttleProtocol.setTaskNo(0);
+ shuttleThread.setSyncTaskNo(0);
//鏍囪澶嶄綅
- shuttleProtocol.setPakMk(true);
+ shuttleThread.setPakMk(true);
News.info("鍥涘悜绌挎杞︽墜鍔ㄤ换鍔℃墽琛屽畬鎴愶紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
}
//鍒犻櫎redis
- redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo());
+ redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo());
return false;//绂佹鍐嶄笅鍙戝懡浠�
}
}
@@ -229,12 +229,12 @@
return false;
}
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WORKING);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.WORKING);
commandStep++;
//鏇存柊redis鏁版嵁
redisCommand.setCommandStep(commandStep);
//浠诲姟鏁版嵁淇濆瓨鍒皉edis
- redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getTaskNo(), JSON.toJSONString(redisCommand));
return true;
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
index 4268ff1..95c20f8 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/Motion.java
@@ -49,7 +49,7 @@
* 浠诲姟鍙�
*/
@ApiModelProperty(value= "浠诲姟鍙�")
- private Integer wrkNo;
+ private Integer taskNo;
/**
* 搴忓垪鍙�
@@ -228,9 +228,9 @@
public Motion() {}
- public Motion(String uuid,Integer wrkNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceCtg,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
+ public Motion(String uuid,Integer taskNo,String serialNo,String title,Integer priority,Integer sync,Long motionCtg,Long motionSts,Long deviceCtg,String device,String origin,Integer oriDrt,String target,Integer tarDrt,String dockNo,Date ioTime,Date startTime,Date endTime,Date errTime,Long errCode,String errDesc,String temp,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer deleted,Long hostId) {
this.uuid = uuid;
- this.wrkNo = wrkNo;
+ this.taskNo = taskNo;
this.serialNo = serialNo;
this.title = title;
this.priority = priority;
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
index 3f67aa7..5e6a8a1 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -63,7 +63,7 @@
ArrayList<LiftCommand> list = new ArrayList<>();
LiftAssignCommand assignCommand = new LiftAssignCommand();
assignCommand.setLiftNo(liftProtocol.getLiftNo());
- assignCommand.setTaskNo(motion.getWrkNo());
+ assignCommand.setTaskNo(motion.getTaskNo());
assignCommand.setCommands(list);
LiftCommand command = new LiftCommand();
@@ -71,11 +71,11 @@
case LIFT_MOVE:
// 濡傛灉宸茬粡鍦ㄧ洰鏍囧眰锛岄偅杈瑰眰杩囨护
if (liftProtocol.getLev().equals(Integer.valueOf(motion.getTarget()))) {
- liftProtocol.setTaskNo(motion.getWrkNo());
+ liftProtocol.setTaskNo(motion.getTaskNo());
break;
}
- command = liftThread.getEmptyMoveCommand(motion.getWrkNo(), Integer.parseInt(motion.getTarget()));
+ command = liftThread.getEmptyMoveCommand(motion.getTaskNo(), Integer.parseInt(motion.getTarget()));
list.add(command);
return liftAction.assignWork(liftThread.getDevice(), assignCommand);
case LIFT_WITH_GOODS:
@@ -93,7 +93,7 @@
return false;
}
- command = liftThread.getMoveWithShuttleCommand(motion.getWrkNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()));
+ command = liftThread.getMoveWithShuttleCommand(motion.getTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()));
list.add(command);
return liftAction.assignWork(liftThread.getDevice(), assignCommand);
case LIFT_WITH_GOODS_AND_SHUTTLE:
@@ -209,7 +209,7 @@
return false;
}
- if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getWrkNo().shortValue()) {
+ if (liftProtocol.getRun() || liftProtocol.getTaskNo() != motion.getTaskNo().shortValue()) {
return false;
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
index df7c5af..e799b7b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -81,7 +81,8 @@
ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
assignCommand.setShuttleNo(deviceNo);
- assignCommand.setTaskNo(motion.getWrkNo());
+ assignCommand.setTaskNo(motion.getTaskNo());
+ assignCommand.setDeviceTaskNo(shuttleThread.generateDeviceTaskNo(motion.getTaskNo(), MotionCtgType.get(motion.getMotionCtgEl())));
assignCommand.setSourceLocNo(motion.getOrigin());
assignCommand.setLocNo(motion.getTarget());
assignCommand.setDeviceId(Integer.parseInt(motion.getDevice()));
@@ -106,12 +107,12 @@
case SHUTTLE_MOVE_LIFT_PALLET://绌挎杞﹂《鍗囧苟绉诲姩
shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
- shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getWrkNo(), true));
+ shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getTaskNo(), true));
break;
case SHUTTLE_MOVE_DOWN_PALLET://绌挎杞︾Щ鍔ㄥ苟鎵樼洏涓嬮檷
shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread);
shuttleTaskModeType = ShuttleTaskModeType.PAK_IN;
- shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getWrkNo(), false));
+ shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getTaskNo(), false));
break;
case SHUTTLE_MOVE_FROM_LIFT://鍑烘彁鍗囨満
// 鍒ゆ柇鎻愬崌鏈虹姸鎬�
@@ -151,7 +152,7 @@
// }
//鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
- if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+ if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
return false;
}
@@ -188,7 +189,7 @@
// }
//鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
- if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+ if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
return false;
}
@@ -197,21 +198,21 @@
break;
case SHUTTLE_CHARGE_ON://鍏呯數寮�
shuttleTaskModeType = ShuttleTaskModeType.CHARGE;
- shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), true));
+ shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), true));
assignCommand.setCharge(Boolean.TRUE);
break;
case SHUTTLE_CHARGE_OFF://鍏呯數鍏�
shuttleTaskModeType = ShuttleTaskModeType.CHARGE;
- shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), false));
+ shuttleCommands.add(shuttleThread.getChargeCommand(motion.getTaskNo(), false));
assignCommand.setCharge(Boolean.TRUE);
break;
case SHUTTLE_PALLET_LIFT://鎵樼洏椤跺崌
shuttleTaskModeType = ShuttleTaskModeType.PALLET_LIFT;
- shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), true));
+ shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), true));
break;
case SHUTTLE_PALLET_DOWN://鎵樼洏涓嬮檷
shuttleTaskModeType = ShuttleTaskModeType.PALLET_DOWN;
- shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), false));
+ shuttleCommands.add(shuttleThread.getLiftCommand(motion.getTaskNo(), false));
break;
default:
throw new CoolException(motion.getMotionCtgEl() + "娌℃湁鎸囧畾浠诲姟浣滀笟娴佺▼锛侊紒锛�");
@@ -245,16 +246,16 @@
return false;
}
- if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+ if (shuttleProtocol.getTaskNo() != 0 && shuttleProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
return false;
}
//鍏呯數浠诲姟
if (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl())).equals(MotionCtgType.SHUTTLE_CHARGE_ON)) {
// 澶嶄綅绌挎杞�
- shuttleProtocol.setTaskNo(0);
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
- shuttleProtocol.setPakMk(true);
+ shuttleThread.setSyncTaskNo(0);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ shuttleThread.setPakMk(true);
return true;
}
@@ -308,7 +309,7 @@
// }
//鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚�
- if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) {
+ if (liftProtocol.getTaskNo().intValue() != motion.getTaskNo()) {
return false;
}
@@ -323,9 +324,9 @@
}
// 澶嶄綅绌挎杞�
- shuttleProtocol.setTaskNo(0);
- shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
- shuttleProtocol.setPakMk(true);
+ shuttleThread.setSyncTaskNo(0);
+ shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ shuttleThread.setPakMk(true);
return true;
}
@@ -361,7 +362,7 @@
//閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
String distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ(), hostId);
//鑾峰彇绉诲姩鍛戒护
- ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
+ ShuttleCommand command = shuttleThread.getMoveCommand(assignCommand.getDeviceTaskNo(), startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id.intValue(), runSpeed);
command.setNodes(nodes);//灏嗚璧拌妭鐐规坊鍔犲埌姣忎竴姝ュ懡浠や腑
commands.add(command);
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java
index cedc3c2..c5bc8b7 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleAssignCommand.java
@@ -28,6 +28,11 @@
private Integer taskNo = 0;
/**
+ * 璁惧宸ヤ綔鍙�
+ */
+ private Integer deviceTaskNo = 0;
+
+ /**
* 浣滀笟绫诲瀷
* 1: 鍏ュ簱
* 2锛� 鍑哄簱
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java
index 534d3a3..ca85df1 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java
@@ -16,7 +16,7 @@
private Integer shuttleNo;
//宸ヤ綔鍙�
- private Integer wrkNo;
+ private Integer taskNo;
//鍛戒护鎵ц姝ュ簭
private Integer commandStep;
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 70f38b1..56a428b 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
@@ -81,7 +81,7 @@
int i = motionList.size();
for (Motion motion : motionList) {
motion.setPriority(i);
- motion.setWrkNo(taskNo);
+ motion.setTaskNo(taskNo);
motion.setUuid(uuid);
if (!this.save(motion)) {
throw new CoolException(JSON.toJSONString(motion) + "鍔ㄤ綔淇濆瓨澶辫触");
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java
index 40af86a..1a3d9c5 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/LiftProtocol.java
@@ -11,7 +11,7 @@
@Slf4j
@Data
-public class LiftProtocol {
+public class LiftProtocol implements Cloneable {
//**********************蹇呴』瀛樺湪灞炴��**********************
/**
@@ -174,4 +174,14 @@
return this.taskNo == null ? 0 : this.taskNo;
}
+ @Override
+ public LiftProtocol clone() {
+ try {
+ return (LiftProtocol) super.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
index c3d506c..60395ed 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
@@ -7,23 +7,19 @@
import com.zy.asrs.wcs.core.service.LocService;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
-import com.zy.asrs.wcs.rcs.model.enums.ShuttleDeviceStatusType;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.entity.ShuttleDeviceStatus;
-import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.service.ShuttleDeviceStatusService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
-
-import java.util.HashMap;
/**
* 鍥涘悜绌挎杞�
*/
@Slf4j
@Data
-public class ShuttleProtocol {
+public class ShuttleProtocol implements Cloneable{
//**********************蹇呴』瀛樺湪灞炴��**********************
/**
@@ -218,7 +214,7 @@
return this.taskNo == null ? 0 : this.taskNo;
}
- public void setTaskNo(Integer taskNo) {
+ public synchronized void setSyncTaskNo(Integer taskNo) {
RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
if (null != redisUtil) {
redisUtil.set(DeviceRedisConstant.SHUTTLE_FLAG + this.shuttleNo, taskNo);
@@ -248,4 +244,14 @@
return currentLoc.getLocNo();
}
+ @Override
+ public ShuttleProtocol clone() {
+ try {
+ return (ShuttleProtocol) super.clone();
+ } catch (CloneNotSupportedException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
}
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 d576867..f00efde 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
@@ -3,7 +3,9 @@
import com.zy.asrs.wcs.common.ExecuteSupport;
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;
import com.zy.asrs.wcs.rcs.entity.Device;
+import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import java.util.List;
@@ -38,7 +40,13 @@
List<NavigateNode> getMoveAdvancePath();//鑾峰彇绌挎杞︿换鍔¤矾寰�
- int generateDeviceTaskNo(int taskNo);//鐢熸垚纭欢璁惧宸ヤ綔鍙�
+ int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType);//鐢熸垚纭欢璁惧宸ヤ綔鍙�
+
+ boolean setProtocolStatus(ShuttleProtocolStatusType status);//璁剧疆宸ヤ綔鐘舵��
+
+ boolean setSyncTaskNo(Integer taskNo);//璁剧疆宸ヤ綔鍙�
+
+ boolean setPakMk(boolean pakMk);//璁剧疆鏍囪
//***************鑾峰彇鍛戒护*****************
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
index 7f35a9b..8fde087 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayLiftThread.java
@@ -163,7 +163,7 @@
@Override
public LiftProtocol getStatus() {
- return this.liftProtocol;
+ return this.liftProtocol.clone();
}
@Override
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 91a9a72..2734158 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
@@ -15,11 +15,11 @@
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
-import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
-import com.zy.asrs.wcs.core.model.enums.ShuttleRunDirection;
+import com.zy.asrs.wcs.core.model.enums.*;
import com.zy.asrs.wcs.core.service.BasShuttleService;
import com.zy.asrs.wcs.core.service.LocService;
import com.zy.asrs.wcs.core.utils.NavigateUtils;
+import com.zy.asrs.wcs.core.utils.Utils;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.OutputQueue;
import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
@@ -208,7 +208,7 @@
@Override
public ShuttleProtocol getStatus() {
- return this.shuttleProtocol;
+ return this.shuttleProtocol.clone();
}
@Override
@@ -274,7 +274,7 @@
param.put("messageName", "runRoute");
param.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
param.put("deviceNo", device.getDeviceNo());
- param.put("taskId", generateDeviceTaskNo(taskNo));
+ param.put("taskId", taskNo);
param.put("nodeNum", nodes.size());
param.put("modes", modes);
String response = new HttpHandler.Builder()
@@ -515,6 +515,9 @@
return path;
}
List<NavigateNode> nodes = redisCommand.getAssignCommand().getNodes();//绌挎杞﹂璁¤矾寰�
+ if (nodes == null) {
+ return path;
+ }
if (!nodes.isEmpty()) {
path.addAll(nodes);
}
@@ -524,12 +527,42 @@
}
@Override
- public int generateDeviceTaskNo(int taskNo) {
- int no = taskNo % 255;
- if (no <= 1) {
- no = 2;
+ public int generateDeviceTaskNo(int taskNo, MotionCtgType motionCtgType) {
+ int deviceTaskNo = taskNo;
+ try {
+ deviceTaskNo = Utils.getTaskNo("SURAY_SHUTTLE");
+ } catch (Exception e) {
+ return taskNo;
}
- return no;
+
+ switch (Objects.requireNonNull(MotionCtgType.get(String.valueOf(motionCtgType)))){
+ case SHUTTLE_MOVE://绌挎杞︾Щ鍔�
+ case SHUTTLE_MOVE_LIFT_PALLET://绌挎杞﹂《鍗囧苟绉诲姩
+ case SHUTTLE_MOVE_DOWN_PALLET://绌挎杞︾Щ鍔ㄥ苟鎵樼洏涓嬮檷
+ case SHUTTLE_MOVE_FROM_LIFT://鍑烘彁鍗囨満
+ case SHUTTLE_MOVE_TO_LIFT://杩涙彁鍗囨満
+ return deviceTaskNo;
+ default:
+ return taskNo;
+ }
+ }
+
+ @Override
+ public synchronized boolean setProtocolStatus(ShuttleProtocolStatusType status) {
+ this.shuttleProtocol.setProtocolStatus(status);
+ return true;
+ }
+
+ @Override
+ public synchronized boolean setSyncTaskNo(Integer taskNo) {
+ this.shuttleProtocol.setSyncTaskNo(taskNo);
+ return true;
+ }
+
+ @Override
+ public synchronized boolean setPakMk(boolean pakMk) {
+ this.shuttleProtocol.setPakMk(pakMk);
+ return true;
}
@Override
@@ -538,7 +571,7 @@
body.put("messageName", "runOrder");
body.put("msgTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
body.put("deviceNo", Integer.parseInt(this.device.getDeviceNo()));
- body.put("taskId", generateDeviceTaskNo(taskNo));
+ body.put("taskId", taskNo);
LocService locService = SpringUtils.getBean(LocService.class);
Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>()
diff --git a/zy-asrs-wcs/src/main/resources/application.yml b/zy-asrs-wcs/src/main/resources/application.yml
index 5d8b45b..f9f4428 100644
--- a/zy-asrs-wcs/src/main/resources/application.yml
+++ b/zy-asrs-wcs/src/main/resources/application.yml
@@ -18,7 +18,7 @@
# url: jdbc:mysql://47.97.1.152:3306/asrs?useUnicode=trKue&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
# username: root
# password: zy@123
- url: jdbc:mysql://127.0.0.1:3306/asrs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
+ url: jdbc:mysql://192.168.4.15:3306/asrs?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: xltys1995
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
--
Gitblit v1.9.1