From 98e6dd8f3597a36512699151a7f74b6cf733268f Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期五, 19 九月 2025 14:06:03 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java | 5 +
src/main/java/com/zy/core/thread/LiftThread.java | 2
src/main/java/com/zy/core/model/protocol/ForkLiftStaProtocol.java | 6 +
src/main/java/com/zy/asrs/controller/OpenController.java | 59 +++++++++++
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 18 +-
src/main/java/com/zy/common/utils/ForkLiftUtils.java | 6
src/main/java/com/zy/common/utils/NavigateUtils.java | 6 +
src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java | 30 +++++
src/main/java/com/zy/core/dispatcher/LiftDispatchUtils.java | 2
src/main/webapp/views/lift.html | 2
src/main/java/com/zy/core/dispatcher/ForkLiftDispatchUtils.java | 2
src/main/java/com/zy/common/utils/LiftUtils.java | 7
src/main/java/com/zy/asrs/service/impl/ForkMainServiceImpl.java | 14 +-
src/main/java/com/zy/core/model/LiftStation.java | 2
src/main/java/com/zy/core/thread/impl/NyLiftThread.java | 71 +++++++------
src/main/resources/application.yml | 60 -----------
src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java | 2
17 files changed, 169 insertions(+), 125 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OpenController.java b/src/main/java/com/zy/asrs/controller/OpenController.java
index 17b89b6..fd3e4f6 100644
--- a/src/main/java/com/zy/asrs/controller/OpenController.java
+++ b/src/main/java/com/zy/asrs/controller/OpenController.java
@@ -22,8 +22,10 @@
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.WrkIoType;
import com.zy.core.model.protocol.ForkLiftProtocol;
+import com.zy.core.model.protocol.LiftProtocol;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.thread.ForkLiftThread;
+import com.zy.core.thread.LiftThread;
import com.zy.core.thread.ShuttleThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -231,7 +233,7 @@
return R.error("浠诲姟鍙栨秷澶辫触");
}
- @PostMapping("/deviceStatus")
+ @RequestMapping("/deviceStatus")
@OpenApiLog(memo = "鑾峰彇璁惧鐘舵��")
public R getDeviceStatus() {
HashMap<String, Object> map = new HashMap<>();
@@ -269,8 +271,26 @@
forkLiftProtocols.add(forkLiftProtocol);
}
+ //鑾峰彇鎻愬崌鏈烘暟鎹�
+ ArrayList<LiftProtocol> liftProtocols = new ArrayList<>();
+ List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+ .eq("device_type", String.valueOf(SlaveType.Lift)));
+ for (DeviceConfig device : liftList) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getDeviceNo());
+ if (liftThread == null) {
+ continue;
+ }
+
+ LiftProtocol liftProtocol = liftThread.getStatus();
+ if (liftProtocol == null) {
+ continue;
+ }
+ liftProtocols.add(liftProtocol);
+ }
+
map.put("shuttle", shuttleProtocols);
map.put("forkLift", forkLiftProtocols);
+ map.put("lift", liftProtocols);
apiLogService.insert(new ApiLog(
null
@@ -292,6 +312,43 @@
return R.ok().add(map);
}
+ @RequestMapping("/liftDeviceOriginData")
+ @OpenApiLog(memo = "鑾峰彇鎻愬崌鏈哄師濮嬫暟鎹�")
+ public R getLiftDeviceOriginData() {
+ HashMap<Integer, String> map = new HashMap<>();
+
+ //鑾峰彇鎻愬崌鏈烘暟鎹�
+ List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
+ .eq("device_type", String.valueOf(SlaveType.Lift)));
+ for (DeviceConfig device : liftList) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getDeviceNo());
+ if (liftThread == null) {
+ continue;
+ }
+
+ map.put(device.getDeviceNo(), liftThread.getRealtimeOriginData());
+ }
+
+ apiLogService.insert(new ApiLog(
+ null
+ , "鑾峰彇鎻愬崌鏈哄師濮嬫暟鎹�"
+ , "/liftDeviceOriginData"
+ , null
+ , null
+ , null
+ , null
+ , JSON.toJSONString(map)
+ , null
+ , null
+ , 1
+ , new Date()
+ , null
+ , null
+ ));
+
+ return R.ok().add(map);
+ }
+
@PostMapping("/getLocInformation")
@OpenApiLog(memo = "鑾峰彇鎸囧畾搴撲綅淇℃伅")
public R getLocInformation(@RequestBody GetLocInformationParam param) {
diff --git a/src/main/java/com/zy/asrs/service/impl/ForkMainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/ForkMainServiceImpl.java
index b8af362..40f5529 100644
--- a/src/main/java/com/zy/asrs/service/impl/ForkMainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/ForkMainServiceImpl.java
@@ -304,12 +304,12 @@
}
if (liftSta.getHasCar()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
if (liftSta.getHasTray()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏈夋墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏈夋墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
@@ -429,7 +429,7 @@
assignCommand.setCommands(commands);
wrkMast.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN.sts);//灏忚溅鎼繍涓� 101.鐢熸垚鍑哄簱浠诲姟 ==> 102.灏忚溅鎼繍涓�
- wrkMast.setSourceStaNo(liftSta.getStaNo());
+ wrkMast.setSourceStaNo(liftSta.getSiteId());
wrkMast.setModiTime(new Date());
wrkMast.setSystemMsg("");//娓呯┖娑堟伅
if (wrkMastService.updateById(wrkMast)) {
@@ -771,12 +771,12 @@
}
if (liftSta.getHasCar()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
if (!liftSta.getHasTray()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏃犳墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏃犳墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
@@ -1571,8 +1571,8 @@
assignCommand.setCommands(commands);
wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓� 301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 302.灏忚溅绉诲姩鑷宠繎鐐逛腑
- wrkMast.setSourceStaNo(recentLiftStation.getStaNo());
- wrkMast.setStaNo(liftStaTarget.getStaNo());
+ wrkMast.setSourceStaNo(recentLiftStation.getSiteId());
+ wrkMast.setStaNo(liftStaTarget.getSiteId());
wrkMast.setModiTime(now);
wrkMast.setSystemMsg("");//娓呯┖娑堟伅
if (wrkMastService.updateById(wrkMast)) {
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 34d5f73..e1d18d0 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -302,12 +302,12 @@
}
if (liftSta.getHasCar()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
if (liftSta.getHasTray()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏈夋墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏈夋墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
@@ -427,7 +427,7 @@
assignCommand.setCommands(commands);
wrkMast.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN.sts);//灏忚溅鎼繍涓� 101.鐢熸垚鍑哄簱浠诲姟 ==> 102.灏忚溅鎼繍涓�
- wrkMast.setSourceStaNo(liftSta.getStaNo());
+ wrkMast.setSourceStaNo(liftSta.getSiteId());
wrkMast.setModiTime(new Date());
wrkMast.setSystemMsg("");//娓呯┖娑堟伅
if (wrkMastService.updateById(wrkMast)) {
@@ -775,12 +775,12 @@
}
if (liftSta.getHasCar()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣瀛樺湪灏忚溅锛岀姝㈡淳鍙�", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
if (!liftSta.getHasTray()) {
- News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏃犳墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getStaNo());
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}绔欑偣鏃犳墭鐩橈紝绂佹娲惧彂", wrkMast.getWrkNo(), liftSta.getSiteId());
return false;
}
@@ -1546,8 +1546,8 @@
//灏忚溅宸插湪杩戠偣浣嶇疆鏃犻渶鍓嶅線
if (shuttleProtocol.getCurrentLocNo().equals(endLocation)) {
wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY_COMPLETE.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓� 301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 303.灏忚溅绉诲姩鑷宠繎鐐瑰畬鎴�
- wrkMast.setSourceStaNo(recentLiftStation.getStaNo());
- wrkMast.setStaNo(targetLiftSta.getStaNo());
+ wrkMast.setSourceStaNo(recentLiftStation.getSiteId());
+ wrkMast.setStaNo(targetLiftSta.getSiteId());
wrkMast.setModiTime(now);
wrkMast.setSystemMsg("");//娓呯┖娑堟伅
wrkMastService.updateById(wrkMast);
@@ -1572,8 +1572,8 @@
assignCommand.setCommands(commands);
wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY.sts);//灏忚溅绉诲姩鍒版彁鍗囨満涓� 301.鐢熸垚灏忚溅绉诲簱浠诲姟 ==> 302.灏忚溅绉诲姩鑷宠繎鐐逛腑
- wrkMast.setSourceStaNo(recentLiftStation.getStaNo());
- wrkMast.setStaNo(targetLiftSta.getStaNo());
+ wrkMast.setSourceStaNo(recentLiftStation.getSiteId());
+ wrkMast.setStaNo(targetLiftSta.getSiteId());
wrkMast.setModiTime(now);
wrkMast.setSystemMsg("");//娓呯┖娑堟伅
if (wrkMastService.updateById(wrkMast)) {
diff --git a/src/main/java/com/zy/common/utils/ForkLiftUtils.java b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
index ad116cf..fed6942 100644
--- a/src/main/java/com/zy/common/utils/ForkLiftUtils.java
+++ b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
@@ -33,7 +33,7 @@
}
for (ForkLiftStaProtocol forkLiftStaProtocol : forkLiftThread.getForkLiftStaProtocols()) {
- list.add(forkLiftStaProtocol.getStaNo());
+ list.add(forkLiftStaProtocol.getSiteId());
}
return list;
@@ -67,7 +67,7 @@
}
//鑾峰彇鎻愬崌鏈虹珯鐐�
- public static ForkLiftStaProtocol getLiftStaByStaNo(Integer staNo) {
+ public static ForkLiftStaProtocol getLiftStaByStaNo(Integer siteId) {
DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
List<DeviceConfig> forkliftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
.eq("device_type", String.valueOf(SlaveType.ForkLift)));
@@ -78,7 +78,7 @@
}
for (ForkLiftStaProtocol forkLiftStaProtocol : forkLiftThread.getForkLiftStaProtocols()) {
- if (forkLiftStaProtocol.getStaNo().equals(staNo)) {
+ if (forkLiftStaProtocol.getSiteId().equals(siteId)) {
return forkLiftStaProtocol;
}
}
diff --git a/src/main/java/com/zy/common/utils/LiftUtils.java b/src/main/java/com/zy/common/utils/LiftUtils.java
index 127d9c6..0dcc3ec 100644
--- a/src/main/java/com/zy/common/utils/LiftUtils.java
+++ b/src/main/java/com/zy/common/utils/LiftUtils.java
@@ -35,7 +35,7 @@
}
for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
- list.add(liftStaProtocol.getStaNo());
+ list.add(liftStaProtocol.getSiteId());
}
return list;
@@ -69,7 +69,7 @@
}
//鑾峰彇鎻愬崌鏈虹珯鐐�
- public static LiftStaProtocol getLiftStaByStaNo(Integer staNo) {
+ public static LiftStaProtocol getLiftStaByStaNo(Integer siteId) {
DeviceConfigService deviceConfigService = SpringUtils.getBean(DeviceConfigService.class);
List<DeviceConfig> liftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
.eq("device_type", String.valueOf(SlaveType.Lift)));
@@ -80,7 +80,7 @@
}
for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
- if (liftStaProtocol.getStaNo().equals(staNo)) {
+ if (liftStaProtocol.getSiteId().equals(siteId)) {
return liftStaProtocol;
}
}
@@ -95,7 +95,6 @@
if (liftThread == null) {
return null;
}
-
for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
if (liftStaProtocol.getLev().equals(lev)) {
return liftStaProtocol;
diff --git a/src/main/java/com/zy/common/utils/NavigateUtils.java b/src/main/java/com/zy/common/utils/NavigateUtils.java
index eb76e13..9197cd8 100644
--- a/src/main/java/com/zy/common/utils/NavigateUtils.java
+++ b/src/main/java/com/zy/common/utils/NavigateUtils.java
@@ -261,7 +261,6 @@
for (NavigateNode node : nodes) {
if (node.getNodeValue() == MapNodeType.MAIN_PATH.id) {
continue;
-
}
targetNode = node;
break;
@@ -272,6 +271,11 @@
}
}
+ if (targetNode == null) {
+ List<NavigateNode> list = partList.get(partList.size() - 1);
+ targetNode = list.get(0);
+ }
+
String locNo = NavigatePositionConvert.nodeToLocNo(targetNode);
return locNo;
}
diff --git a/src/main/java/com/zy/core/dispatcher/ForkLiftDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ForkLiftDispatchUtils.java
index 16ed602..b0bdeb8 100644
--- a/src/main/java/com/zy/core/dispatcher/ForkLiftDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ForkLiftDispatchUtils.java
@@ -105,7 +105,7 @@
ForkLiftStaProtocol recentSta = null;//鏈�杩戠珯鐐�
//鎼滅储璺濈灏忚溅鏈�杩戠殑绔欑偣
for (ForkLiftStaProtocol forkLiftStaProtocol : list) {
- Integer staNo = forkLiftStaProtocol.getStaNo();//绔欑偣鍙�
+ Integer siteId = forkLiftStaProtocol.getSiteId();//绔欑偣鍙�
String locNo = forkLiftStaProtocol.getLocNo();//绔欑偣搴撲綅鍙�
//褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
diff --git a/src/main/java/com/zy/core/dispatcher/LiftDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/LiftDispatchUtils.java
index d058729..81735bb 100644
--- a/src/main/java/com/zy/core/dispatcher/LiftDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/LiftDispatchUtils.java
@@ -88,7 +88,7 @@
LiftStaProtocol recentSta = null;//鏈�杩戠珯鐐�
//鎼滅储璺濈灏忚溅鏈�杩戠殑绔欑偣
for (LiftStaProtocol liftStaProtocol : list) {
- Integer staNo = liftStaProtocol.getStaNo();//绔欑偣鍙�
+ Integer siteId = liftStaProtocol.getSiteId();//绔欑偣鍙�
String locNo = liftStaProtocol.getLocNo();//绔欑偣搴撲綅鍙�
//褰撳墠绌挎杞︾嚎绋嬪埌鐩爣鍦扮偣璺濈
diff --git a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
index a3b29bf..9fbfdbe 100644
--- a/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
+++ b/src/main/java/com/zy/core/dispatcher/ShuttleDispatchUtils.java
@@ -223,6 +223,11 @@
return false;
}
+ if (shuttleProtocol.getCurrentLocNo().equals(locNo)) {
+ News.info("{}鍙峰皬杞︼紝绉诲姩鐩爣浣嶇疆涓庡皬杞﹀綋鍓嶄綅缃竴鑷存棤娉曠Щ鍔�", shuttleNo);
+ return false;
+ }
+
//鍒ゆ柇绌挎杞︽槸鍚﹀瓨鍦ㄦ湭瀹屾垚鐨勫皬杞︾Щ搴撲换鍔�
WrkMast hasMoveWorking = wrkMastService.selectShuttleHasMoveWorking(shuttleNo);
if (hasMoveWorking != null) {//灏忚溅瀛樺湪绉诲簱浠诲姟锛岀瓑寰呮墽琛屽畬鎴愬悗鍐嶇敓鎴愭柊鐨勪换鍔�
diff --git a/src/main/java/com/zy/core/model/LiftStation.java b/src/main/java/com/zy/core/model/LiftStation.java
index e3c5bd4..e2844f3 100644
--- a/src/main/java/com/zy/core/model/LiftStation.java
+++ b/src/main/java/com/zy/core/model/LiftStation.java
@@ -9,7 +9,7 @@
private Integer liftNo;
// 鎻愬崌鏈虹珯鐐瑰彿
- private Integer staNo;
+ private Integer siteId;
// 鎺�
private Integer row;
diff --git a/src/main/java/com/zy/core/model/protocol/ForkLiftStaProtocol.java b/src/main/java/com/zy/core/model/protocol/ForkLiftStaProtocol.java
index 5681560..5587ab2 100644
--- a/src/main/java/com/zy/core/model/protocol/ForkLiftStaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/ForkLiftStaProtocol.java
@@ -13,7 +13,7 @@
/**
* 绔欑偣鍙�
*/
- private Integer staNo;
+ private Integer siteId;
/**
* 鏈夋墭鐩�
@@ -30,6 +30,10 @@
*/
private Short taskNo;
+ /**
+ * 鐩爣绔�
+ */
+ private Integer staNo;
/**
* 灞�
diff --git a/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java b/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
index e52218b..ddf2c88 100644
--- a/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/LiftStaProtocol.java
@@ -13,10 +13,10 @@
/**
* 绔欑偣鍙�
*/
- private Integer staNo;
+ private Integer siteId;
/**
- * 妯″紡
+ * 妯″紡 1:鑷姩 0:鎵嬪姩
*/
private Boolean model;
@@ -43,7 +43,17 @@
/**
* 浠诲姟鍙�
*/
- private Short taskNo;
+ private Integer taskNo;
+
+ /**
+ * 鏉$爜
+ */
+ private String barcode;
+
+ /**
+ * 鐩爣浣嶇疆
+ */
+ private Integer staNo;
/**
* 灞�
@@ -60,4 +70,18 @@
*/
private Integer liftNo;
+ public boolean getHasCar() {
+ if (this.hasCar == null) {
+ return false;
+ }
+ return this.hasCar;
+ }
+
+ public boolean getHasTray() {
+ if (this.hasTray == null) {
+ return false;
+ }
+ return this.hasTray;
+ }
+
}
diff --git a/src/main/java/com/zy/core/thread/LiftThread.java b/src/main/java/com/zy/core/thread/LiftThread.java
index ab15e0c..e2da9fc 100644
--- a/src/main/java/com/zy/core/thread/LiftThread.java
+++ b/src/main/java/com/zy/core/thread/LiftThread.java
@@ -42,6 +42,8 @@
String getCurrentLocNo();
+ String getRealtimeOriginData();//鑾峰彇瀹炴椂鍘熷鏁版嵁
+
//***************鑾峰彇鍛戒护*****************
LiftCommand getPickAndPutCommand(Integer taskNo, Integer pick, Integer put);//鍙栨斁璐ф寚浠�
diff --git a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
index dc1c42a..b495438 100644
--- a/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/NyLiftThread.java
@@ -45,10 +45,11 @@
private DeviceConfig device;
private LiftProtocol liftProtocol;
private RedisUtil redisUtil;
- LiftPointModel liftPointModel;
+ private LiftPointModel liftPointModel;
private List<LiftStaProtocol> liftStaProtocols = new ArrayList<>();
private List<DeviceMsgModel> readResultList = new ArrayList<>();
private List<DeviceMsgModel> resultList = new ArrayList<>();
+ private String realtimeOriginData = "";
public NyLiftThread(DeviceConfig device, LiftPointModel liftPointModel, List<LiftStation> stationList, RedisUtil redisUtil) {
this.device = device;
@@ -57,7 +58,7 @@
//鍒濆鍖栫珯鐐�
for (LiftStation station : stationList) {
LiftStaProtocol liftStaProtocol = new LiftStaProtocol();
- liftStaProtocol.setStaNo(station.getStaNo());//绔欑偣鍙�
+ liftStaProtocol.setSiteId(station.getSiteId());//绔欑偣鍙�
liftStaProtocol.setLev(station.getLev());//绔欑偣妤煎眰
String locNo = Utils.getLocNo(station.getRow(), station.getBay(), station.getLev());
liftStaProtocol.setLocNo(locNo);//绔欑偣搴撲綅鍙�
@@ -200,19 +201,33 @@
liftExtend.setOverHeight(data.getBoolean("overHeight"));
liftExtend.setOverWeight(data.getBoolean("overWeight"));
- JSONArray trayList = data.getJSONArray("trayList");
- for (int i = 0; i < trayList.size(); i++) {
- int hasTray = (int) trayList.get(i);
- LiftStaProtocol liftStaProtocol = liftStaProtocols.get(i);
- liftStaProtocol.setHasTray(hasTray == 1);
+ //璇诲彇绔欑偣
+ JSONArray stationList = data.getJSONArray("stationList");
+ if (stationList != null) {
+ for (int i = 0; i < stationList.size(); i++) {
+ JSONObject staObj = stationList.getJSONObject(i);
+ LiftStaProtocol liftStaProtocol = null;
+ for (LiftStaProtocol staProtocol : liftStaProtocols) {
+ if(staProtocol.getSiteId().equals(staObj.getInteger("siteId"))){
+ liftStaProtocol = staProtocol;
+ break;
+ }
+ }
+
+ if(liftStaProtocol == null){
+ continue;
+ }
+
+ liftStaProtocol.setModel(staObj.getInteger("model") == 1);
+ liftStaProtocol.setBusy(staObj.getInteger("busy") == 1);
+ liftStaProtocol.setHasTray(staObj.getInteger("hasTray") == 1);
+ liftStaProtocol.setDeviceError(staObj.getInteger("deviceError") == 1);
+ liftStaProtocol.setTaskNo(staObj.getInteger("taskNo"));
+ liftStaProtocol.setBarcode(staObj.getString("barcode"));
+ }
}
- JSONArray carList = data.getJSONArray("carList");
- for (int i = 0; i < carList.size(); i++) {
- int hasCar = (int) carList.get(i);
- LiftStaProtocol liftStaProtocol = liftStaProtocols.get(i);
- liftStaProtocol.setHasCar(hasCar == 1);
- }
+ this.realtimeOriginData = JSON.toJSONString(data);
if (System.currentTimeMillis() - liftProtocol.getDeviceDataLog() > 1000 * 5) {
//閲囬泦鏃堕棿瓒呰繃5s锛屼繚瀛樹竴娆℃暟鎹褰�
@@ -230,27 +245,7 @@
liftProtocol.setDeviceDataLog(System.currentTimeMillis());
}
- //灏嗘彁鍗囨満鐘舵�佷繚瀛樿嚦鏁版嵁搴�
- BasLiftService basLiftService = SpringUtils.getBean(BasLiftService.class);
- BasLift basLift = basLiftService.selectOne(new EntityWrapper<BasLift>()
- .eq("lift_no", device.getDeviceNo()));
- if (basLift == null) {
- basLift = new BasLift();
- //鎻愬崌鏈哄彿
- basLift.setLiftNo(liftProtocol.getLiftNo());
- basLift.setStatus(1);
- basLiftService.insert(basLift);
- }
- //浠诲姟鍙�
- basLift.setWrkNo(liftProtocol.getTaskNo());
- //淇敼鏃堕棿
- basLift.setUpdateTime(new Date());
- //璁惧鐘舵��
- basLift.setDeviceStatus(JSON.toJSONString(liftProtocol));
- if (basLiftService.updateById(basLift)) {
- OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), liftProtocol.getLiftNo()));
- }
-
+ OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆慬id:{1}] <<<<< 瀹炴椂鏁版嵁鏇存柊鎴愬姛",DateUtils.convert(new Date()), liftProtocol.getLiftNo()));
} catch (Exception e) {
e.printStackTrace();
OutputQueue.LIFT.offer(MessageFormat.format("銆恵0}銆戣鍙栨彁鍗囨満鐘舵�佷俊鎭け璐� ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), device.getDeviceNo(), device.getIp(), device.getPort()));
@@ -480,6 +475,11 @@
}
@Override
+ public String getRealtimeOriginData() {
+ return this.realtimeOriginData;
+ }
+
+ @Override
public LiftCommand getPickAndPutCommand(Integer taskNo, Integer pick, Integer put) {
LiftCommand command = new LiftCommand();
command.setLiftNo(device.getDeviceNo());
@@ -672,5 +672,8 @@
*/
private Boolean overWeight;
+ //鎻愬崌鏈虹珯鐐�
+ private List<LiftStaProtocol> liftStaProtocols;
+
}
}
diff --git a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
index 939c7cb..2a3b70d 100644
--- a/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
+++ b/src/main/java/com/zy/core/thread/impl/ZyForkLiftThread.java
@@ -51,7 +51,7 @@
//鍒濆鍖栫珯鐐�
for (LiftStation station : stationList) {
ForkLiftStaProtocol forkLiftStaProtocol = new ForkLiftStaProtocol();
- forkLiftStaProtocol.setStaNo(station.getStaNo());//绔欑偣鍙�
+ forkLiftStaProtocol.setSiteId(station.getSiteId());//绔欑偣鍙�
forkLiftStaProtocol.setLev(station.getLev());//绔欑偣妤煎眰
String locNo = Utils.getLocNo(station.getRow(), station.getBay(), station.getLev());
forkLiftStaProtocol.setLocNo(locNo);//绔欑偣搴撲綅鍙�
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index f7c3ff0..d1fc01f 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -19,8 +19,8 @@
redis:
host: 127.0.0.1
port: 6379
- database: 0
-# password: 123456
+ database: 3
+ # password: 123456
task:
scheduling:
pool:
@@ -53,58 +53,4 @@
deviceExecuteConfig:
# 姣忎釜绾跨▼绠℃帶璁惧鎵ц鏁伴噺
threadControlCount: 10
- liftType: lift
-
-## 涓嬩綅鏈洪厤缃�
-#wcs-slave:
-# # 鍥涘悜绌挎杞�1
-# shuttle[0]:
-# id: 1
-# ip: 10.10.20.11
-# port: 8888
-# rack: 0
-# slot: 0
-# threadImpl: NyShuttleThread
-# # 鍥涘悜绌挎杞�2
-# shuttle[1]:
-# id: 2
-# ip: 10.10.20.12
-# port: 8888
-# rack: 0
-# slot: 0
-# threadImpl: NyShuttleThread
-# # 璐у弶鎻愬崌鏈轰富绾跨▼
-# forkLiftMaster[0]:
-# id: 99
-# ip: 10.10.20.20
-# port: 102
-# rack: 0
-# slot: 0
-# threadImpl: LfdZyForkLiftMasterThread
-# # 璐у弶鎻愬崌鏈�1
-# forkLift[0]:
-# id: 1
-# ip: 10.10.20.20
-# port: 102
-# rack: 0
-# slot: 0
-# threadImpl: LfdZyForkLiftSlaveThread
-# masterId: 99
-# staRow: 9
-# staBay: 6
-# sta[0]:
-# staNo: 1001
-# lev: 1
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[1]:
-# staNo: 1002
-# lev: 2
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[2]:
-# staNo: 1003
-# lev: 3
-# liftNo: ${wcs-slave.forkLift[0].id}
-# sta[3]:
-# staNo: 1004
-# lev: 4
-# liftNo: ${wcs-slave.forkLift[0].id}
\ No newline at end of file
+ liftType: lift
\ No newline at end of file
diff --git a/src/main/webapp/views/lift.html b/src/main/webapp/views/lift.html
index 1d9253e..b244b82 100644
--- a/src/main/webapp/views/lift.html
+++ b/src/main/webapp/views/lift.html
@@ -145,7 +145,7 @@
<td class="py-3 px-4">{{ item.lev }}</td>
<td class="py-3 px-4">
<div v-for="(sta,id) in item.liftStaProtocols" :key="id">
- {{ sta.lev }}灞傦紝鎵樼洏锛歿{ sta.hasTray ? 'Y':'N' }}锛屽皬杞︼細{{ sta.hasCar ? 'Y':'N' }}
+ {{ sta.siteId }}绔欙紝鎵樼洏锛歿{ sta.hasTray ? 'Y':'N' }}锛屽皬杞︼細{{ sta.hasCar ? 'Y':'N' }}
</div>
</td>
</tr>
--
Gitblit v1.9.1