From aa2c08620a28a862da0353233f7163de08cae060 Mon Sep 17 00:00:00 2001
From: zc <zyzc>
Date: 星期三, 22 十月 2025 08:53:41 +0800
Subject: [PATCH] 希日出库修改确认
---
zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 227 ++++++++++++++++++++++++++++++++++----------------------
1 files changed, 138 insertions(+), 89 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 1ea8950..08b4fad 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
@@ -205,11 +205,11 @@
break;
case STA_TO_LOC:
oriSta = staService.getById(task.getOriSta());
- if (oriSta.getStaTypeIsCheck() != 1) {
- if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
- throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
- }
- }
+// if (oriSta.getStaTypeIsCheck() != 1) {
+// if (locStaStatusCheck && !oriSta.getStaSts().equals(StaStsType.STOCK.val())) {
+// throw new BusinessException("oriSta锛�" + task.getOriSta$() + " is not in STOCK status");
+// }
+// }
oriSta.setStaSts(StaStsType.READY_TAKE.val());
oriSta.setUpdateTime(now);
if (!staService.updateById(oriSta)) {
@@ -789,7 +789,11 @@
boolean reverse = false;
if (nextDirection.equals((workDirection + 180) % 360)) {
nextDirection = workDirection;
- reverse = true;
+ if (Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType())).equals(TaskPosDto.PosType.ORI_STA)) {
+ reverse = false;
+ } else {
+ reverse = true;
+ }
}
// 绗簩姝ワ細鍒ゆ柇褰撳墠鑺傜偣鏄惁鍙互鏃嬭浆
@@ -810,22 +814,45 @@
nextDirection = lastDirection;
reverse = true;
} else {
- // turn
- actionList.add(new Action(
- null, // 缂栧彿s
- task.getBusId(), // 鎬荤嚎
- task.getId(), // 浠诲姟
- null, // 鍔ㄤ綔鍙�
- null, // 浼樺厛绾�
- ActionTypeType.TurnCorner.desc, // 鍚嶇О
- mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�у��
- lastCode.getData(), // 鍦伴潰鐮�
- String.valueOf(nextDirection), // 鍔ㄤ綔鍙傛暟
- ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
- actionPrepareSts, // 鍔ㄤ綔杩涘害
- agvId, // AGV
- now // 宸ヤ綔鏃堕棿
- ));
+ if ((Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
+ .equals(TaskPosDto.PosType.ORI_STA) || Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()))
+ .equals(TaskPosDto.PosType.DEST_STA)) && lastCode.getData().equals("00000050")) {
+ // turn
+ reverse = false;
+
+ actionList.add(new Action(
+ null, // 缂栧彿s
+ task.getBusId(), // 鎬荤嚎
+ task.getId(), // 浠诲姟
+ null, // 鍔ㄤ綔鍙�
+ null, // 浼樺厛绾�
+ ActionTypeType.TurnCorner.desc, // 鍚嶇О
+ mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�у��
+ lastCode.getData(), // 鍦伴潰鐮�
+ String.valueOf(180), // 鍔ㄤ綔鍙傛暟
+ ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
+ actionPrepareSts, // 鍔ㄤ綔杩涘害
+ agvId, // AGV
+ now // 宸ヤ綔鏃堕棿
+ ));
+ } else {
+ // turn
+ actionList.add(new Action(
+ null, // 缂栧彿s
+ task.getBusId(), // 鎬荤嚎
+ task.getId(), // 浠诲姟
+ null, // 鍔ㄤ綔鍙�
+ null, // 浼樺厛绾�
+ ActionTypeType.TurnCorner.desc, // 鍚嶇О
+ mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�у��
+ lastCode.getData(), // 鍦伴潰鐮�
+ String.valueOf(nextDirection), // 鍔ㄤ綔鍙傛暟
+ ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
+ actionPrepareSts, // 鍔ㄤ綔杩涘害
+ agvId, // AGV
+ now // 宸ヤ綔鏃堕棿
+ ));
+ }
lastDirection = nextDirection;
}
@@ -1003,28 +1030,28 @@
Sta oriSta = staService.getById(task.getOriSta());
Double oriStaWorkDirection = mapService.getStaAngle(oriSta, workDirection);
// 妫�楠屾柟鍚�
- if (!lastDirection.equals(oriStaWorkDirection)) {
- if (!lastCode.getCornerBool()) {
- throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
- }
- // turn
- actionList.add(new Action(
- null, // 缂栧彿
- task.getBusId(), // 鎬荤嚎
- task.getId(), // 浠诲姟
- null, // 鍔ㄤ綔鍙�
- null, // 浼樺厛绾�
- ActionTypeType.TurnCorner.desc, // 鍚嶇О
- mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�ш皰
- lastCode.getData(), // 鍦伴潰鐮�
- String.valueOf(oriStaWorkDirection), // 鍔ㄤ綔鍙傛暟
- ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
- actionPrepareSts, // 鍔ㄤ綔杩涘害
- agvId, // AGV
- now // 宸ヤ綔鏃堕棿
- ));
- lastDirection = oriStaWorkDirection;
- }
+// if (!lastDirection.equals(oriStaWorkDirection)) {
+// if (!lastCode.getCornerBool()) {
+// throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+// }
+// // turn
+// actionList.add(new Action(
+// null, // 缂栧彿
+// task.getBusId(), // 鎬荤嚎
+// task.getId(), // 浠诲姟
+// null, // 鍔ㄤ綔鍙�
+// null, // 浼樺厛绾�
+// ActionTypeType.TurnCorner.desc, // 鍚嶇О
+// mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�ш皰
+// lastCode.getData(), // 鍦伴潰鐮�
+// String.valueOf(oriStaWorkDirection), // 鍔ㄤ綔鍙傛暟
+// ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
+// actionPrepareSts, // 鍔ㄤ綔杩涘害
+// agvId, // AGV
+// now // 宸ヤ綔鏃堕棿
+// ));
+// lastDirection = oriStaWorkDirection;
+// }
// 璁$畻璐у弶宸ヤ綔鏂瑰悜
staWorkDirection = mapService.calculateAgvWorkDirectionByStation(oriStaWorkDirection, lastDirection);
actionList.add(new Action(
@@ -1033,11 +1060,11 @@
task.getId(), // 浠诲姟
null, // 鍔ㄤ綔鍙�
null, // 浼樺厛绾�
- ActionTypeType.ReadyTakeFromConveyorSta.desc, // 鍚嶇О
- staWorkDirection, // 灞炴�у��
+ ActionTypeType.ReadyTakeFromShelvesLoc.desc, // 鍚嶇О
+ Double.parseDouble("0"), // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
String.valueOf(oriSta.getOffset()), // 鍔ㄤ綔鍙傛暟
- ActionTypeType.ReadyTakeFromConveyorSta.val(), // 鍔ㄤ綔绫诲瀷
+ ActionTypeType.ReadyTakeFromShelvesLoc.val(), // 鍔ㄤ綔绫诲瀷
actionPrepareSts, // 鍔ㄤ綔杩涘害
agvId, // AGV
now, // 宸ヤ綔鏃堕棿
@@ -1066,29 +1093,47 @@
// 绔欑偣鏀捐揣
Sta destSta = staService.getById(task.getDestSta());
Double destStaWorkDirection = mapService.getStaAngle(destSta, workDirection);
+// CodeGap gap = codeGapService.findByCodeOfBoth(lastCode.getId(), nextCode.getId());
+
// 妫�楠屾柟鍚�
- if (!lastDirection.equals(destStaWorkDirection)) {
- if (!lastCode.getCornerBool()) {
- throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
- }
- // turn
- actionList.add(new Action(
- null, // 缂栧彿
- task.getBusId(), // 鎬荤嚎
- task.getId(), // 浠诲姟
- null, // 鍔ㄤ綔鍙�
- null, // 浼樺厛绾�
- ActionTypeType.TurnCorner.desc, // 鍚嶇О
- mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�ш皰
- lastCode.getData(), // 鍦伴潰鐮�
- String.valueOf(destStaWorkDirection), // 鍔ㄤ綔鍙傛暟
- ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
- actionPrepareSts, // 鍔ㄤ綔杩涘害
- agvId, // AGV
- now // 宸ヤ綔鏃堕棿
- ));
- lastDirection = destStaWorkDirection;
- }
+// if (!lastDirection.equals(destStaWorkDirection)) {
+// if (!lastCode.getCornerBool()) {
+// throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+// }
+//
+// actionList.add(new Action(
+// null, // 缂栧彿
+// task.getBusId(), // 鎬荤嚎
+// task.getId(), // 浠诲姟
+// null, // 鍔ㄤ綔鍙�
+// null, // 浼樺厛绾�
+// actionType.desc, // 鍚嶇О
+// (double) agvSpeedType.val, // 灞炴�у��
+// lastCode.getData(), // 鍦伴潰鐮�
+// String.valueOf(gap.getDistance()), // 鍔ㄤ綔鍙傛暟
+// actionType.val(), // 鍔ㄤ綔绫诲瀷
+// actionPrepareSts, // 鍔ㄤ綔杩涘害
+// agvId, // AGV
+// now // 宸ヤ綔鏃堕棿
+// ));
+// // turn
+// actionList.add(new Action(
+// null, // 缂栧彿
+// task.getBusId(), // 鎬荤嚎
+// task.getId(), // 浠诲姟
+// null, // 鍔ㄤ綔鍙�
+// null, // 浼樺厛绾�
+// ActionTypeType.TurnCorner.desc, // 鍚嶇О
+// mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D, // 灞炴�ш皰
+// lastCode.getData(), // 鍦伴潰鐮�
+// String.valueOf(destStaWorkDirection), // 鍔ㄤ綔鍙傛暟
+// ActionTypeType.TurnCorner.val(), // 鍔ㄤ綔绫诲瀷
+// actionPrepareSts, // 鍔ㄤ綔杩涘害
+// agvId, // AGV
+// now // 宸ヤ綔鏃堕棿
+// ));
+// lastDirection = destStaWorkDirection;
+// }
// 鏆傚瓨鐐瑰彇璐�
assert backpackType != null;
actionList.add(new Action(
@@ -1115,11 +1160,11 @@
task.getId(), // 浠诲姟
null, // 鍔ㄤ綔鍙�
null, // 浼樺厛绾�
- ActionTypeType.ReadyReleaseToConveyorSta.desc, // 鍚嶇О
- staWorkDirection, // 灞炴�ш皰
+ ActionTypeType.ReadyReleaseToShelvesLoc.desc, // 鍚嶇О
+ Double.parseDouble("0"), // 灞炴�у��
lastCode.getData(), // 鍦伴潰鐮�
String.valueOf(destSta.getOffset()), // 鍔ㄤ綔鍙傛暟
- ActionTypeType.ReadyReleaseToConveyorSta.val(), // 鍔ㄤ綔绫诲瀷
+ ActionTypeType.ReadyReleaseToShelvesLoc.val(), // 鍔ㄤ綔绫诲瀷
actionPrepareSts, // 鍔ㄤ綔杩涘害
agvId, // AGV
now, // 宸ヤ綔鏃堕棿
@@ -1131,7 +1176,7 @@
// 妫�楠屾柟鍚�
FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString());
Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle());
- if (!lastDirection.equals(chargeDirection)) {
+ if (!lastDirection.equals(chargeDirection)&&lastCode.getCornerBool()) {
actionList.add(new Action(
null, // 缂栧彿
null, // 鎬荤嚎
@@ -1288,7 +1333,6 @@
}
-
/**
* 鏍规嵁鍒嗙墖鐢熸垚鍔ㄤ綔 ( 杞﹁締鍙兘宸茬粡鍋氳繃涓�浜涗换鍔′簡,姝e湪绛夊緟涓嬩竴娈典换鍔� )
*/
@@ -1322,11 +1366,14 @@
throw new CoolException("AGV[" + agvNo + "]瀹氫綅鍋忕Щ...");
}
- String lastCorner = null;
- for (int i = pathList.size(); i <0; i++) {
- Code nextCode = codeService.getCacheByData(pathList.get(i - 1));
- if (nextCode!=null&&nextCode.getCornerBool()){
- lastCorner =pathList.get(i - 1);
+ //String lastCorner = null;
+ Integer index = -1;
+ boolean corner = false;
+ for (int i = pathList.size(); i < 0; i++) {
+ Code nextCode = codeService.getCacheByData(pathList.get(i));
+ if (nextCode != null && nextCode.getCornerBool()) {
+ //lastCorner = pathList.get(i);
+ index = i;
}
}
@@ -1350,19 +1397,21 @@
if (i == 0) {
continue;
}
-
String next = pathListPart.get(i);
-
Code nextCode = codeService.getCacheByData(next);
- Double nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
+ Double nextDirection;
boolean reverse = false;
- if (lastCorner.equals(lastCode)){
- // DOTO
+ if (index >= i) {
+ // DOTO 娣诲姞杞集
+ Code endCode = codeService.getCacheByData(pathList.get(pathList.size() - 1));
+ nextDirection = mapService.calculateDirection(lastCode, endCode, angleOffsetVal);
+ reverse = true;
+ } else {
+ nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
- }else {
// 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
- if (nextDirection.equals((workDirection + 180) % 360)) {
+ if (!nextDirection.equals((workDirection+180) % 360)) {
nextDirection = workDirection;
reverse = true;
}
@@ -1708,7 +1757,7 @@
// 妫�楠屾柟鍚�
FuncSta chargeFuncSta = funcStaService.query(lastCode.getId(), FuncStaType.CHARGE.toString());
Double chargeDirection = Double.parseDouble(chargeFuncSta.getAngle());
- if (!lastDirection.equals(chargeDirection)) {
+ if (!lastDirection.equals(chargeDirection) && lastCode.getCornerBool()) {
actionList.add(new Action(
null, // 缂栧彿
null, // 鎬荤嚎
@@ -1851,7 +1900,7 @@
log.info("{}鍙稟gv鍔ㄤ綔缁勮瀹屾垚锛屾寚浠ゆ暟閲忥細{}", agvNo, newActionList.size());
} catch (Exception e) {
- log.error("mainService.generateAction", e);
+ log.error("mainService.generateActionV2", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
if (!Cools.isEmpty(pathList)) {
@@ -1860,7 +1909,7 @@
mapDataDispatcher.clearDynamicMatrixByCodeList(null, codeMatrixIdxList);
}
- throw new RuntimeException("generateAction method caught an exception, rolling back transaction.", e);
+ throw new RuntimeException("generateActionV2 method caught an exception, rolling back transaction.", e);
}
}
--
Gitblit v1.9.1