From 1bdaf9be340892e1654caea9ed4082b6c61beb3b Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期一, 09 三月 2026 15:54:02 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 57 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
index 230d0e6..d4acffc 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java
@@ -20,10 +20,11 @@
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.core.domain.AgvBackpackDto;
import com.zy.acs.manager.core.domain.LaneDto;
+import com.zy.acs.manager.core.domain.PathDto;
import com.zy.acs.manager.core.domain.TaskPosDto;
import com.zy.acs.manager.core.integrate.conveyor.ConveyorStationService;
-import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
import com.zy.acs.manager.core.integrate.dto.OpenBusSubmitParam;
+import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
import com.zy.acs.manager.manager.entity.*;
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.service.*;
@@ -383,7 +384,7 @@
int idx = -1;
for (int i = 0; i < destPosList.size(); i++) {
if (Objects.equals(destPosList.get(i).getTaskId(), newDto.getTaskId())
- && Objects.equals(destPosList.get(i).getCodeId(), newDto.getCodeId())) {
+ && Objects.equals(destPosList.get(i).getCodeId(), newDto.getCodeId())) {
idx = i;
break;
}
@@ -893,9 +894,10 @@
* 鏍规嵁鍒嗙墖鐢熸垚鍔ㄤ綔 ( 杞﹁締鍙兘宸茬粡鍋氳繃涓�浜涗换鍔′簡,姝e湪绛夊緟涓嬩竴娈典换鍔� )
*/
@Transactional
- public synchronized void generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) {
+ public synchronized List<PathDto> generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) {
+ List<PathDto> pathTrace = new ArrayList<>();
try {
- if (Cools.isEmpty(agvId, segmentList)) { return; }
+ if (Cools.isEmpty(agvId, segmentList)) { return pathTrace; }
Date now = new Date();
long actionPrepareSts = ActionStsType.PREPARE.val();
// JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class);
@@ -924,6 +926,7 @@
if (!lastCode.getData().equals(pathList.get(0))) {
throw new CoolException("AGV[" + agvNo + "]瀹氫綅鍋忕Щ...");
}
+ pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false));
boolean first = true;
for (Segment segment : segmentList) {
@@ -989,6 +992,7 @@
now // 宸ヤ綔鏃堕棿
));
lastDirection = nextLaneDir;
+ PathDto.markTurn(pathTrace, lastDirection);
}
if (nextDirection.equals(oppNextLaneDir)) {
@@ -1057,6 +1061,7 @@
));
lastDirection = nextDirection;
+ PathDto.markTurn(pathTrace, lastDirection);
}
}
}
@@ -1082,6 +1087,7 @@
));
lastDirection = nextDirection;
+ PathDto.markTurn(pathTrace, lastDirection);
}
// run
@@ -1104,6 +1110,7 @@
));
lastCode = nextCode;
+ pathTrace.add(new PathDto(lastCode.getData(), lastDirection, false));
}
@@ -1149,13 +1156,14 @@
));
lastDirection = firstTurnDir;
+ PathDto.markTurn(pathTrace, lastDirection);
}
first = false;
}
// 浣滀笟鐐瑰姩浣�
- AgvDirectionType agvDirectionType;
+ ActuatorDirectionType actuatorDirectionType;
Double staWorkDirection;
AgvBackpackType backpackType = AgvBackpackType.query(segment.getBackpack());
switch (Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))) {
@@ -1168,7 +1176,8 @@
// 璐ф灦鍙栬揣
Loc oriLoc = locService.getById(task.getOriLoc());
// 璁$畻宸﹀彸鏂瑰悜
- agvDirectionType = mapService.calculateAgvWorkDirectionByShelf(oriLoc, lastCode);
+ actuatorDirectionType = ActuatorDirectionType.fromVal(oriLoc.getCompDirect());
+// actuatorDirectionType = mapService.calculateAgvWorkDirectionByShelf(oriLoc, lastCode);
actionList.add(new Action(
null, // 缂栧彿
task.getBusId(), // 鎬荤嚎
@@ -1176,7 +1185,7 @@
null, // 鍔ㄤ綔鍙�
null, // 浼樺厛绾�
ActionTypeType.ReadyTakeFromShelvesLoc.desc, // 鍚嶇О
- (double) agvDirectionType.val, // 灞炴�у��
+ (double) actuatorDirectionType.val, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
JSON.toJSONString(new HeightDepthDto(oriLoc.getOffset())), // 鍔ㄤ綔鍙傛暟
ActionTypeType.ReadyTakeFromShelvesLoc.val(), // 鍔ㄤ綔绫诲瀷
@@ -1231,15 +1240,16 @@
// 璐ф灦鏀捐揣
Loc destLoc = locService.getById(task.getDestLoc());
// 璁$畻宸﹀彸鏂瑰悜
- agvDirectionType = mapService.calculateAgvWorkDirectionByShelf(destLoc, lastCode);
+ actuatorDirectionType = ActuatorDirectionType.fromVal(destLoc.getCompDirect());
+// actuatorDirectionType = mapService.calculateAgvWorkDirectionByShelf(destLoc, lastCode);
actionList.add(new Action(
null, // 缂栧彿
task.getBusId(), // 鎬荤嚎
task.getId(), // 浠诲姟
null, // 鍔ㄤ綔鍙�
- null, // 浼樺厛绾�
+ null, // 浼樺厛绾�
ActionTypeType.ReadyReleaseToShelvesLoc.desc, // 鍚嶇О
- (double) agvDirectionType.val, // 灞炴�у��
+ (double) actuatorDirectionType.val, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
JSON.toJSONString(new HeightDepthDto(destLoc.getOffset())), // 鍔ㄤ綔鍙傛暟
ActionTypeType.ReadyReleaseToShelvesLoc.val(), // 鍔ㄤ綔绫诲瀷
@@ -1251,7 +1261,7 @@
case ORI_STA:
// 绔欑偣鍙栬揣
Sta oriSta = staService.getById(task.getOriSta());
- Double oriStaWorkDirection = mapService.getStaAngle(oriSta, workDirection);
+ Double oriStaWorkDirection = mapService.getStaAngle(oriSta);
// 妫�楠屾柟鍚�
if (!lastDirection.equals(oriStaWorkDirection)) {
if (!lastCode.getCornerBool()) {
@@ -1274,9 +1284,11 @@
now // 宸ヤ綔鏃堕棿
));
lastDirection = oriStaWorkDirection;
+ PathDto.markTurn(pathTrace, lastDirection);
}
// 璁$畻璐у弶宸ヤ綔鏂瑰悜
- staWorkDirection = mapService.calculateAgvWorkDirectionByStation(oriStaWorkDirection, lastDirection);
+ actuatorDirectionType = ActuatorDirectionType.fromVal(oriSta.getActDir());
+// staWorkDirection = mapService.calculateAgvWorkDirectionByStation(oriStaWorkDirection, lastDirection);
actionList.add(new Action(
null, // 缂栧彿
task.getBusId(), // 鎬荤嚎
@@ -1284,7 +1296,7 @@
null, // 鍔ㄤ綔鍙�
null, // 浼樺厛绾�
ActionTypeType.ReadyTakeFromConveyorSta.desc, // 鍚嶇О
- staWorkDirection, // 灞炴�у��
+ (double) actuatorDirectionType.val, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
JSON.toJSONString(new HeightDepthDto(oriSta.getHeight(), Optional.ofNullable(oriSta.getDepth()).orElse((double) 0))), // 鍔ㄤ綔鍙傛暟
ActionTypeType.ReadyTakeFromConveyorSta.val(), // 鍔ㄤ綔绫诲瀷
@@ -1315,7 +1327,7 @@
case DEST_STA:
// 绔欑偣鏀捐揣
Sta destSta = staService.getById(task.getDestSta());
- Double destStaWorkDirection = mapService.getStaAngle(destSta, workDirection);
+ Double destStaWorkDirection = mapService.getStaAngle(destSta);
// 妫�楠屾柟鍚�
if (!lastDirection.equals(destStaWorkDirection)) {
if (!lastCode.getCornerBool()) {
@@ -1338,6 +1350,7 @@
now // 宸ヤ綔鏃堕棿
));
lastDirection = destStaWorkDirection;
+ PathDto.markTurn(pathTrace, lastDirection);
}
// 鑳岀瘬鍙栬揣
if (backupAction) {
@@ -1359,7 +1372,8 @@
));
}
// 璁$畻璐у弶宸ヤ綔鏂瑰悜
- staWorkDirection = mapService.calculateAgvWorkDirectionByStation(destStaWorkDirection, lastDirection);
+// staWorkDirection = mapService.calculateAgvWorkDirectionByStation(destStaWorkDirection, lastDirection);
+ actuatorDirectionType = ActuatorDirectionType.fromVal(destSta.getActDir());
actionList.add(new Action(
null, // 缂栧彿
task.getBusId(), // 鎬荤嚎
@@ -1367,7 +1381,7 @@
null, // 鍔ㄤ綔鍙�
null, // 浼樺厛绾�
ActionTypeType.ReadyReleaseToConveyorSta.desc, // 鍚嶇О
- staWorkDirection, // 灞炴�у��
+ (double) actuatorDirectionType.val, // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
JSON.toJSONString(new HeightDepthDto(destSta.getHeight(), Optional.ofNullable(destSta.getDepth()).orElse((double) 0))), // 鍔ㄤ綔鍙傛暟
ActionTypeType.ReadyReleaseToConveyorSta.val(), // 鍔ㄤ綔绫诲瀷
@@ -1397,6 +1411,7 @@
now // 宸ヤ綔鏃堕棿
));
lastDirection = chargeDirection;
+ PathDto.markTurn(pathTrace, lastDirection);
}
// charge
@@ -1551,6 +1566,7 @@
}
log.info("{}鍙稟gv鍔ㄤ綔缁勮瀹屾垚锛屾寚浠ゆ暟閲忥細{}", agvNo, newActionList.size());
+ return pathTrace;
} catch (Exception e) {
log.error("mainService.generateAction", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -1606,8 +1622,9 @@
task.setUpdateTime(now);
if (!taskService.updateById(task)) {
throw new BusinessException(task.getSeqNum() + "浠诲姟鏇存柊澶辫触");
- }
- }
+ }
+
+}
}
AgvAction agvAction = new AgvAction(agvNo, actionGroupId);
@@ -1829,9 +1846,9 @@
// segment list
List<Segment> segmentList = segmentService.list(new LambdaQueryWrapper<Segment>()
- .eq(Segment::getGroupId, serialNo)
+ .eq(Segment::getGroupId, serialNo)
// .eq(Segment::getState, SegmentStateType.RUNNING.toString())
- .orderByAsc(Segment::getSerial)
+ .orderByAsc(Segment::getSerial)
);
// settlement
--
Gitblit v1.9.1