From 9af152509959409830bf542f147aca01d7616221 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期六, 02 八月 2025 13:48:41 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 135 ++++++++++++--------------------------------
1 files changed, 37 insertions(+), 98 deletions(-)
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 68e701d..63ca0b6 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -87,7 +87,7 @@
Object data = redisUtil.get(RedisKeyType.MAP.key + lev);
if (data == null) {//redis鍦板浘鏁版嵁涓虹┖
//杞藉叆鍦板浘
- List<List<MapNode>> lists = navigateMapData.getJsonData(lev, NavigationMapType.getMapTypes(NavigationMapType.NONE), null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
+ List<List<MapNode>> lists = navigateMapData.getJsonOriginData(lev, NavigationMapType.getMapTypes(NavigationMapType.NONE), null, null);//鑾峰彇瀹屾暣鍦板浘(鍖呮嫭鍏ュ簱鍑哄簱)
//瀛樺叆鏁版嵁搴�
basMap.setData(JSON.toJSONString(lists));
@@ -386,6 +386,13 @@
return false;
}
+ //妫�娴嬫槸鍚﹀瓨鍦ㄧЩ鍔ㄤ换鍔�
+ WrkMast moveWorking = wrkMastService.selectShuttleHasMoveWorking(wrkMast.getShuttleNo());
+ if (moveWorking != null) {
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽皬杞﹀瓨鍦ㄧЩ鍔ㄤ换鍔�", wrkMast.getWrkNo());
+ return false;
+ }
+
ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo()); // 鍥涘悜绌挎杞︾紪鍙�
assignCommand.setTaskMode(ShuttleTaskModeType.TRANSPORT.id);//灏忚溅绉诲簱浠诲姟
@@ -429,99 +436,6 @@
return false;
}
return true;
- }
-
- /**
- * 鍥涘悜绌挎杞︿换鍔″畬鎴�
- */
- public synchronized void shuttleFinished() {
- try {
- List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
- .eq("device_type", String.valueOf(SlaveType.Shuttle)));
- for (DeviceConfig device : shuttleList) {
- //鑾峰彇鍥涘悜绌挎杞︿俊鎭�
- ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo());
- ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
- if (shuttleProtocol == null) {
- continue;
- }
-
- //鍥涘悜绌挎杞︾姸鎬佷负绛夊緟纭銆佸皬杞﹀浜庣┖闂茬姸鎬�
- if (shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.WAITING.id //浠诲姟瀹屾垚绛夊緟纭
- && shuttleProtocol.getTaskNo() != 0
- ) {
- //灏嗕换鍔℃。鏍囪涓哄畬鎴�
- WrkMast wrkMast = wrkMastService.selectByWorkNo(shuttleProtocol.getTaskNo());
- if (wrkMast != null) {
- if (wrkMast.getWrkSts() == WrkStsType.INBOUND_SHUTTLE_RUN.sts) {
- //5.灏忚溅鎼繍涓� ==> 9.鍏ュ簱瀹屾垚
- wrkMast.setWrkSts(WrkStsType.COMPLETE_INBOUND.sts);
- shuttleThread.setSyncTaskNo(0);
- } else if (wrkMast.getWrkSts() == WrkStsType.OUTBOUND_SHUTTLE_RUN.sts) {
- //102.灏忚溅鎼繍涓� ==> 103.灏忚溅鎼繍瀹屾垚
- wrkMast.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts);
- shuttleThread.setSyncTaskNo(0);
- } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_NEARBY.sts) {
- //302.灏忚溅绉诲姩鑷宠繎鐐逛腑 ==> 303.灏忚溅绉诲姩鑷宠繎鐐瑰畬鎴�
- wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY_COMPLETE.sts);
- shuttleThread.setSyncTaskNo(0);
- } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_IN_LIFT.sts) {
- //304.灏忚溅杩佸叆鎻愬崌鏈轰腑 ==> 305.灏忚溅杩佸叆鎻愬崌鏈哄畬鎴�
- wrkMast.setWrkSts(WrkStsType.MOVE_IN_LIFT_COMPLETE.sts);
- shuttleThread.setSyncTaskNo(0);
- } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_OUT_LIFT.sts) {
- //308.灏忚溅杩佸嚭鎻愬崌鏈轰腑 ==> 309.灏忚溅杩佸嚭鎻愬崌鏈哄畬鎴�
- if (Utils.getLev(shuttleProtocol.getCurrentLocNo()) != Utils.getLev(wrkMast.getLocNo())) {
- continue;//灏忚溅鏈埌杈剧洰鏍囧眰
- }
- wrkMast.setWrkSts(WrkStsType.MOVE_OUT_LIFT_COMPLETE.sts);
- shuttleThread.setSyncTaskNo(0);
- } else if (wrkMast.getWrkSts() == WrkStsType.MOVE_SHUTTLE.sts) {
- //310.灏忚溅绉诲姩涓� ==> 311.灏忚溅绉诲姩瀹屾垚
- wrkMast.setWrkSts(WrkStsType.COMPLETE_MOVE.sts);
- shuttleThread.setSyncTaskNo(0);
- notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_MOVE_COMPLETE);//瑙﹀彂閫氱煡
- } else if (wrkMast.getWrkSts() == WrkStsType.CHARGE_SHUTTLE_WORKING.sts) {
- //204.灏忚溅鍏呯數涓� ==> 205.灏忚溅鍏呯數瀹屾垚
- wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_COMPLETE.sts);
- shuttleThread.setSyncTaskNo(0);
- notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_POWER_COMPLETE);//瑙﹀彂閫氱煡
- } else if (wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_SHUTTLE_RUN.sts) {
- //502.灏忚溅鎼繍涓� ==> 509.绉诲簱瀹屾垚
- wrkMast.setWrkSts(WrkStsType.COMPLETE_LOC_MOVE.sts);
- shuttleThread.setSyncTaskNo(0);
- notifyUtils.notify(String.valueOf(SlaveType.Shuttle), shuttleProtocol.getShuttleNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.SHUTTLE_DELIVERY);//瑙﹀彂閫氱煡
- } else {
- continue;
- }
-
- if (wrkMastService.updateById(wrkMast)) {
- //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
- shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
- News.info("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傚洓鍚戠┛姊溅鍙�={}", shuttleProtocol.getShuttleNo());
- } else {
- News.error("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅澶辫触锛屼絾鏈壘鍒板伐浣滄。銆傚洓鍚戠┛姊溅鍙�={}锛屽伐浣滃彿={}", shuttleProtocol.getShuttleNo(), shuttleProtocol.getTaskNo());
- }
- } else {
- Object object = redisUtil.get(RedisKeyType.SHUTTLE_WORK_FLAG.key + shuttleProtocol.getTaskNo());
- if(object != null){
- ShuttleAssignCommand assignCommand = JSON.parseObject(object.toString(), ShuttleAssignCommand.class);
- if (!assignCommand.getAuto()) {
- //鎵嬪姩妯″紡
- //宸ヤ綔鍙锋竻闆�
- shuttleThread.setTaskNo(0);
- //璁剧疆鍥涘悜绌挎杞︿负绌洪棽鐘舵��
- shuttleThread.setProtocolStatus(ShuttleProtocolStatusType.IDLE);
- News.info("鍥涘悜绌挎杞﹀凡纭涓斾换鍔″畬鎴愮姸鎬�,澶嶄綅銆傚洓鍚戠┛姊溅鍙�={}", shuttleProtocol.getShuttleNo());
- }
- }
- }
- }
-
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
}
/**
@@ -580,8 +494,22 @@
return false;
}
+ if (shuttleProtocol.getCurrentLocNo() == null) {
+ return false;
+ }
+
+ //鍒ゆ柇灏忚溅鏄惁鍒拌揪璐х墿搴撲綅
if (!shuttleProtocol.getCurrentLocNo().equals(wrkMast.getSourceLocNo())) {
+ //灏忚溅鏈埌杈惧彇璐т綅缃�
+ shuttleDispatchUtils.dispatchShuttle(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getShuttleNo());//璋冨害灏忚溅鍒拌揣鐗╂墍鍦ㄥ簱浣嶈繘琛屽彇璐�
News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽皬杞︽湭鍒拌揪鍙栬揣浣嶇疆", wrkMast.getWrkNo(), wrkMast.getSourceLocNo());
+ return false;
+ }
+
+ //妫�娴嬫槸鍚﹀瓨鍦ㄧЩ鍔ㄤ换鍔�
+ WrkMast moveWorking = wrkMastService.selectShuttleHasMoveWorking(wrkMast.getShuttleNo());
+ if (moveWorking != null) {
+ News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽皬杞﹀瓨鍦ㄧЩ鍔ㄤ换鍔�", wrkMast.getWrkNo());
return false;
}
@@ -599,9 +527,10 @@
assignCommand.setTaskMode(ShuttleTaskModeType.TRANSPORT.id);//灏忚溅绉诲簱浠诲姟
assignCommand.setTaskNo(wrkMast.getWrkNo());//浠诲姟鍙�
assignCommand.setAuto(true);//鑷姩妯″紡
+ assignCommand.setLocNo(wrkMast.getLocNo());
//鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
- List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.getDfxWithDevice(), assignCommand, shuttleThread);
+ List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(wrkMast.getSourceLocNo(), wrkMast.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.DFX), assignCommand, shuttleThread);
if (commands == null) {
News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
return false;
@@ -1166,6 +1095,16 @@
continue;
}
+ WrkMast wrkMast1 = wrkMastService.selectShuttleWorking(shuttleProtocol.getShuttleNo());
+ if (wrkMast1 != null) {
+ continue;
+ }
+
+ WrkMast wrkMast2 = wrkMastService.selectShuttleHasMoveWorking(shuttleProtocol.getShuttleNo());
+ if (wrkMast2 != null) {
+ continue;
+ }
+
WrkMast wrkMast = wrkMastService.selectChargeWorking(shuttleProtocol.getShuttleNo());
if (wrkMast != null) {//宸叉湁鍏呯數浠诲姟
continue;
@@ -1301,7 +1240,7 @@
return false;
}
- if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) {
+ if (wrkMast.getLocNo().equals(shuttleProtocol.getCurrentLocNo())) {
//灏忚溅鍦ㄥ厖鐢垫々浣嶇疆
wrkMast.setWrkSts(WrkStsType.CHARGE_SHUTTLE_RUN_COMPLETE.sts);
wrkMast.setModiTime(new Date());
@@ -1585,7 +1524,7 @@
assignCommand.setAuto(true);//鑷姩妯″紡
//璁$畻杩戠偣浣嶇疆
- String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), null, null, 1);
+ String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL, NavigationMapType.PATH_LOCK), null, null, 1);
if (endLocation == null) {
News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛屽皬杞﹁繎鐐逛綅缃绠楀け璐�", wrkMast.getWrkNo());
return false;
@@ -1900,7 +1839,7 @@
assignCommand.setLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
//鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠�
- List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.getNormalWithDevice(), assignCommand, shuttleThread);
+ List<ShuttleCommand> commands = shuttleOperaUtils.getStartToTargetCommands(shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), assignCommand, shuttleThread);
if (commands == null) {
News.taskInfo(wrkMast.getWrkNo(), "{}浠诲姟锛寋}灏忚溅锛岃矾寰勮绠楀け璐�", wrkMast.getWrkNo(), shuttleProtocol.getShuttleNo());
return false;//璺緞璁$畻澶辫触
--
Gitblit v1.9.1