From 71a2c3d3df0c9d430431baaae9d3042882255d44 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 28 三月 2024 09:23:04 +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/core/model/enums/ShuttleCommandModeType.java | 51 ++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java | 37 ++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java | 16 ++
zy-asrs-flow/src/pages/device/shuttle/index.jsx | 7 +
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleCommand.java | 11 +
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java | 28 ++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java | 181 ++++++++++++++++++++++++++++++
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java | 11 +
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java | 15 ++
9 files changed, 346 insertions(+), 11 deletions(-)
diff --git a/zy-asrs-flow/src/pages/device/shuttle/index.jsx b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
index eff130e..d44561e 100644
--- a/zy-asrs-flow/src/pages/device/shuttle/index.jsx
+++ b/zy-asrs-flow/src/pages/device/shuttle/index.jsx
@@ -170,7 +170,7 @@
{
key: '8',
label: '鍏呯數鐘舵��',
- children: 'N',
+ children: item.hasCharge ? 'Y' : 'N',
},
{
key: '9',
@@ -187,6 +187,11 @@
label: '杩愯鏂瑰悜',
children: item.runDirection,
},
+ {
+ key: '12',
+ label: '鏄惁鏈夋墭鐩�',
+ children: item.hasPallet ? 'Y' : 'N',
+ },
];
return <div key={item.id} style={{ width: '45%' }}>
<Descriptions size="small" title={tmpTitle} bordered items={tmpData} />
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
new file mode 100644
index 0000000..873cb42
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -0,0 +1,181 @@
+package com.zy.asrs.wcs.core.action;
+
+import com.alibaba.fastjson.JSON;
+import com.zy.asrs.wcs.core.model.NavigateNode;
+import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
+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.utils.NavigateMapUtils;
+import com.zy.asrs.wcs.core.utils.RedisUtil;
+import com.zy.asrs.wcs.core.utils.Utils;
+import com.zy.asrs.wcs.rcs.News;
+import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
+import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
+import com.zy.asrs.wcs.rcs.entity.Device;
+import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
+import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
+import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
+import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class ShuttleAction {
+
+ @Autowired
+ private RedisUtil redisUtil;
+ @Autowired
+ private NavigateMapUtils navigateMapUtils;
+
+ public synchronized boolean assignWork(Device device, ShuttleAssignCommand assignCommand) {
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
+ if (shuttleThread == null) {
+ return false;
+ }
+
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ ShuttleRedisCommand redisCommand = new ShuttleRedisCommand();
+
+ redisCommand.setShuttleNo(assignCommand.getShuttleNo());//鍥涘悜绌挎杞﹀彿
+ redisCommand.setWrkNo(assignCommand.getTaskNo());//宸ヤ綔鍙�
+ redisCommand.setCommandStep(0);//鍛戒护鎵ц姝ュ簭
+ redisCommand.setAssignCommand(assignCommand);//鍛戒护
+ //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+ if (redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + assignCommand.getTaskNo(), JSON.toJSONString(redisCommand))) {
+ shuttleProtocol.setTaskNo(assignCommand.getTaskNo().intValue());
+ return true;
+ }
+ return false;
+ }
+
+ public synchronized boolean executeWork(Device device, Integer taskNo) {
+ Object obj = redisUtil.get(DeviceRedisConstant.SHUTTLE_WORK_FLAG + taskNo);
+ if (obj == null) {
+ return false;
+ }
+ ShuttleRedisCommand redisCommand = JSON.parseObject(obj.toString(), ShuttleRedisCommand.class);
+ if (redisCommand == null) {
+ return false;
+ }
+
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
+ if (shuttleThread == null) {
+ return false;
+ }
+
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ if (shuttleProtocol == null) {
+ return false;
+ }
+
+ //鍥涘悜绌挎杞︾┖闂层�佹湁浠诲姟銆佹爣璁颁负true銆佸瓨鍦ㄤ换鍔℃寚浠わ紝闇�瑕佹墽琛屼换鍔$殑涓嬩竴鏉℃寚浠�
+ if (!shuttleProtocol.getIdle()
+ || shuttleProtocol.getTaskNo() == 0
+ || !shuttleProtocol.getPakMk()) {
+ return false;
+ }
+
+ List<ShuttleCommand> commands = redisCommand.getAssignCommand().getCommands();
+ if (commands.isEmpty()) {
+ return false;
+ }
+
+ ShuttleAssignCommand assignCommand = redisCommand.getAssignCommand();
+ int commandStep = redisCommand.getCommandStep();
+
+ // 瀹岀粨涓婁竴鏉″懡浠�
+ if (commandStep != 0) {
+ ShuttleCommand command = commands.get(commandStep - 1);
+ if (command.getMode() == ShuttleCommandModeType.MOVE.id) {
+ // 姝e父绉诲姩
+ if (command.getTargetLocNo().equals(shuttleProtocol.getCurrentLocNo())) {
+ command.setComplete(true);
+ //瑙i攣閿佸畾璺緞锛屼笂涓�鏉¤矾寰�
+ List<NavigateNode> nodes = JSON.parseArray(JSON.toJSONString(command.getNodes()), NavigateNode.class);//杩涜娣卞害copy
+ if (nodes != null) {
+ NavigateNode targetNode = assignCommand.getNodes().get(assignCommand.getNodes().size() - 1);//鏈�缁堣妭鐐�
+ NavigateNode node = nodes.get(nodes.size() - 1);
+ if (!(targetNode.getX() == node.getX() && targetNode.getY() == node.getY())) {
+ nodes.remove(nodes.size() - 1);//鍓旈櫎灏捐妭鐐�
+ }
+ boolean result = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(shuttleProtocol.getCurrentLocNo()), shuttleProtocol.getShuttleNo(), nodes, false);//瑙i攣璺緞
+ if (!result) {
+ return false;//瑙i攣澶辫触
+ }
+ }
+ }
+ } else if (command.getMode() == ShuttleCommandModeType.PALLET_LIFT.id) {
+ // 鎵樼洏椤跺崌
+ //鍒ゆ柇鏄惁椤跺崌鍒颁綅
+ if (shuttleProtocol.getHasLift()) {
+ //鍒ゆ柇鏄惁鏈夌墿
+ if (shuttleProtocol.getHasPallet()) {
+ command.setComplete(true);
+ }
+ }
+ } else if (command.getMode() == ShuttleCommandModeType.PALLET_DOWN.id) {
+ // 鎵樼洏涓嬮檷鍛戒护
+ // 鍒ゆ柇鏄惁涓嬮檷鍒颁綅
+ if (!shuttleProtocol.getHasLift()) {
+ command.setComplete(true);
+ }
+ } else if (command.getMode() == ShuttleCommandModeType.CHARGE.id) {
+ // 鍏呯數寮�鍏�
+ //鍒ゆ柇灏忚溅鍏呯數鐘舵��
+ if (shuttleProtocol.getHasCharge()) {
+ command.setComplete(true);
+ }
+ }else {
+ command.setComplete(true);//鍏朵粬鍛戒护榛樿璁や负瀹屾垚
+ }
+
+ // 鏇存柊redis鏁版嵁
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
+
+ if (!command.getComplete()) {
+ return false;
+ }
+
+ //鍒ゆ柇鏄惁涓烘渶鍚庝竴鏉″懡浠や笖鍛戒护鎵ц瀹屾垚锛屾姏鍑虹瓑寰呯‘璁ょ姸鎬�
+ ShuttleCommand endCommand = commands.get(commands.size() - 1);
+ if (endCommand.getComplete()) {
+ News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(commands));
+
+ // 绯荤粺浠诲姟
+ if (assignCommand.getAuto()) {
+ if (!assignCommand.getCharge()) {
+ //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+ shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+ }else {
+ shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
+ }
+ News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+
+ // 鎵嬪姩浠诲姟
+ } else {
+ //鎵嬪姩妯″紡涓嶆姏鍑虹瓑寰呯姸鎬侊紝鐩存帴澶嶄綅绌洪棽鐘舵��
+ shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
+ //浠诲姟鍙锋竻闆�
+ shuttleProtocol.setTaskNo(0);
+ //鏍囪澶嶄綅
+ shuttleProtocol.setPakMk(true);
+ News.info("鍥涘悜绌挎杞︽墜鍔ㄤ换鍔℃墽琛屽畬鎴愶紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
+ }
+
+ //鍒犻櫎redis
+ redisUtil.del(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo());
+ return false;//绂佹鍐嶄笅鍙戝懡浠�
+ }
+ }
+
+ return true;
+ }
+
+}
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 beb76a3..4851e47 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
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wcs.core.action.ShuttleAction;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
@@ -50,6 +51,8 @@
private LocService locService;
@Autowired
private NavigateMapUtils navigateMapUtils;
+ @Autowired
+ private ShuttleAction shuttleAction;
// 璁$畻
public Boolean accept(Motion motion) {
@@ -365,16 +368,14 @@
if (motion.getOrigin() != null && motion.getTarget() != null) {
//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
- boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), Integer.parseInt(shuttleProtocol.getShuttleNo()), assignCommand.getNodes(), true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
+ boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodes(), true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
if (!lockResult) {
return false;//閿佸畾澶辫触
}
-// shuttleThread.assignWork(assignCommand);
- }else {
-// shuttleThread.assignWork(assignCommand);
}
- return Boolean.TRUE;
+ boolean result = shuttleAction.assignWork(shuttleThread.getDevice(), assignCommand);
+ return result;
}
public Boolean finish(Motion motion) {
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleCommand.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleCommand.java
index fcd1325..c7a373d 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleCommand.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleCommand.java
@@ -1,6 +1,7 @@
package com.zy.asrs.wcs.core.model.command;
import com.zy.asrs.wcs.core.model.NavigateNode;
+import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import lombok.Data;
import java.util.List;
@@ -22,6 +23,16 @@
private Integer taskNo = 0;
/**
+ * 鍛戒护绫诲瀷
+ */
+ private Integer mode = ShuttleCommandModeType.NONE.id;
+
+ /**
+ * 鐩爣搴撲綅
+ */
+ private String targetLocNo;
+
+ /**
* 鎶ユ枃鍐呭
*/
private String body;
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
new file mode 100644
index 0000000..9e6455c
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/command/ShuttleRedisCommand.java
@@ -0,0 +1,28 @@
+package com.zy.asrs.wcs.core.model.command;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 鍥涘悜绌挎杞﹀懡浠�-瀛樺偍鍦╮edis
+ */
+@Data
+public class ShuttleRedisCommand implements Serializable {
+
+ //鍥涘悜绌挎杞﹀彿
+ private Short shuttleNo;
+
+ //宸ヤ綔鍙�
+ private Short wrkNo;
+
+ //鍛戒护鎵ц姝ュ簭
+ private Integer commandStep;
+
+ //鍛戒护
+ private ShuttleAssignCommand assignCommand;
+
+ //鎻愬崌鏈哄畨鍏ㄩ攣瀹氭爣璁�
+ private Boolean liftSecurityMk = false;
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/ShuttleCommandModeType.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/ShuttleCommandModeType.java
new file mode 100644
index 0000000..eb2defd
--- /dev/null
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/ShuttleCommandModeType.java
@@ -0,0 +1,51 @@
+package com.zy.asrs.wcs.core.model.enums;
+
+/**
+ * 鍥涘悜绌挎杞﹀懡浠ょ被鍨�
+ */
+public enum ShuttleCommandModeType {
+
+ NONE(-1, "鏈煡绫诲瀷"),
+ MOVE(1, "绉诲姩"),
+ IN_LIFT(2, "杩涙彁鍗囨満"),
+ OUT_LIFT(3, "鍑烘彁鍗囨満"),
+ CHARGE(4, "鍏呯數"),
+ PALLET_LIFT(5, "鎵樼洏椤跺崌"),
+ PALLET_DOWN(6, "鎵樼洏涓嬮檷"),
+ RESET(8, "澶嶄綅"),
+ ;
+
+ public Integer id;
+ public String desc;
+
+ ShuttleCommandModeType(Integer id, String desc) {
+ this.id = id;
+ this.desc = desc;
+ }
+
+ public static ShuttleCommandModeType get(Integer id) {
+ if (null == id) {
+ return null;
+ }
+ for (ShuttleCommandModeType type : ShuttleCommandModeType.values()) {
+ if (type.id.equals(id)) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+ public static ShuttleCommandModeType get(ShuttleCommandModeType type) {
+ if (null == type) {
+ return null;
+ }
+ for (ShuttleCommandModeType type1 : ShuttleCommandModeType.values()) {
+ if (type1 == type) {
+ return type1;
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
index 0518fca..04df88d 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/DeviceTimer.java
@@ -1,10 +1,20 @@
package com.zy.asrs.wcs.core.timer;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zy.asrs.wcs.core.action.ShuttleAction;
import com.zy.asrs.wcs.core.utils.RedisUtil;
+import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
+import com.zy.asrs.wcs.rcs.entity.Device;
+import com.zy.asrs.wcs.rcs.entity.DeviceType;
+import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
+import com.zy.asrs.wcs.rcs.service.DeviceService;
+import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
+
+import java.util.List;
@Slf4j
@Component
@@ -12,10 +22,37 @@
@Autowired
private RedisUtil redisUtil;
+ @Autowired
+ private DeviceService deviceService;
+ @Autowired
+ private DeviceTypeService deviceTypeService;
+ @Autowired
+ private ShuttleAction shuttleAction;
@Scheduled(cron = "0/1 * * * * ? ")
public synchronized void executeShuttle() {
+ DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
+ .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))
+ .eq(DeviceType::getStatus, 1));
+ if (deviceType == null) {
+ return;
+ }
+ List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
+ .eq(Device::getStatus, 1)
+ .eq(Device::getDeviceType, deviceType.getId()));
+ for (Device device : list) {
+ Object object = redisUtil.get(DeviceRedisConstant.SHUTTLE_FLAG + device.getDeviceNo());
+ if (object == null) {
+ continue;
+ }
+
+ Integer taskNo = Integer.valueOf(String.valueOf(object));
+ if (taskNo != 0) {
+ //瀛樺湪浠诲姟闇�瑕佹墽琛�
+ shuttleAction.executeWork(device, taskNo);
+ }
+ }
}
@Scheduled(cron = "0/1 * * * * ? ")
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 ad5496b..0eb07b2 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
@@ -29,7 +29,7 @@
/**
* 鍥涘悜绌挎杞﹀彿
*/
- private String shuttleNo;
+ private Integer shuttleNo;
/**
* 浠诲姟鍙�
@@ -89,6 +89,11 @@
* 鏄惁椤跺崌
*/
private Boolean hasLift;
+
+ /**
+ * 鏄惁鏈夋墭鐩�
+ */
+ private Boolean hasPallet;
/**
* 琛岄┒鏂瑰悜
@@ -230,6 +235,14 @@
return this.taskNo == null ? 0 : this.taskNo;
}
+ public void setTaskNo(Integer taskNo) {
+ RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+ if (null != redisUtil) {
+ redisUtil.set(DeviceRedisConstant.SHUTTLE_FLAG + this.shuttleNo, taskNo);
+ this.taskNo = taskNo;
+ }
+ }
+
//閫氳繃褰撳墠浜岀淮鐮佽幏鍙栧綋鍓嶅簱浣嶅彿
public String getCurrentLocNo() {
LocService locService = SpringUtils.getBean(LocService.class);
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 1091fc4..0fb820e 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
@@ -9,6 +9,7 @@
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
+import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import com.zy.asrs.wcs.core.service.LocService;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.OutputQueue;
@@ -81,24 +82,29 @@
if (data != null) {
if (null == shuttleProtocol) {
shuttleProtocol = new ShuttleProtocol();
- shuttleProtocol.setShuttleNo(device.getDeviceNo());
+ shuttleProtocol.setShuttleNo(Integer.valueOf(device.getDeviceNo()));
shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
shuttleProtocol.setDevice(device);
}
//----------璇诲彇鍥涘悜绌挎杞︾姸鎬�-----------
- //灏忚溅蹇欑姸鎬佷綅
- shuttleProtocol.setDeviceStatus(data.getInteger("deviceStatus"));
+ //灏忚溅璁惧鐘舵��
+ Integer deviceStatus = data.getInteger("deviceStatus");
+ shuttleProtocol.setDeviceStatus(deviceStatus);
//褰撳墠浜岀淮鐮�
- shuttleProtocol.setCurrentCode(data.getString("deviceLocation") == null ? "0" : data.getString("deviceLocation"));
+ shuttleProtocol.setCurrentCode(data.getString("groundCode") == null ? "0" : data.getString("groundCode"));
//鐢垫睜鐢甸噺
shuttleProtocol.setBatteryPower(data.getString("battery") == null ? "0%" : data.getString("battery"));
//鏄惁椤跺崌
shuttleProtocol.setHasLift(data.getInteger("palletStatus") == 1 ? true : false);
+ //鏄惁鏈夋墭鐩�
+ shuttleProtocol.setHasPallet(data.getInteger("hasPallet") != 2 ? true : false);
//琛岄┒鏂瑰悜
shuttleProtocol.setRunDirection(data.getString("direction") == null ? "none" : data.getString("direction"));
+ //鏄惁涓哄厖鐢电姸鎬�
+ shuttleProtocol.setHasCharge((deviceStatus == 5 || deviceStatus == 13) ? true : false);
///璇诲彇鍥涘悜绌挎杞︾姸鎬�-end
@@ -194,6 +200,8 @@
ShuttleCommand command = new ShuttleCommand();
command.setShuttleNo(Integer.parseInt(this.device.getDeviceNo()));
command.setBody(JSON.toJSONString(body));
+ command.setMode(ShuttleCommandModeType.MOVE.id);
+ command.setTargetLocNo(loc.getLocNo());
return command;
}
--
Gitblit v1.9.1