From afbdf224dcc6f4c5d0f9331e25b99e0621cb6afd Mon Sep 17 00:00:00 2001
From: yy <yy123>
Date: 星期二, 30 十二月 2025 14:37:40 +0800
Subject: [PATCH] no message

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |  334 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 236 insertions(+), 98 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 9c66bdc..520d46f 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
@@ -18,6 +18,7 @@
 import com.zy.acs.common.utils.GsonUtils;
 import com.zy.acs.common.utils.Utils;
 import com.zy.acs.framework.common.Cools;
+import com.zy.acs.framework.common.R;
 import com.zy.acs.framework.common.SnowflakeIdWorker;
 import com.zy.acs.framework.exception.CoolException;
 import com.zy.acs.manager.common.domain.TaskDto;
@@ -28,6 +29,7 @@
 import com.zy.acs.manager.core.domain.TaskPosDto;
 import com.zy.acs.manager.core.service.astart.MapDataDispatcher;
 import com.zy.acs.manager.core.utils.HttpHandler;
+import com.zy.acs.manager.manager.controller.param.LocSiteParams;
 import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam;
 import com.zy.acs.manager.manager.entity.*;
 import com.zy.acs.manager.manager.enums.*;
@@ -104,6 +106,8 @@
     private TaskReportService taskReportService;
     @Autowired
     private AgvDurationService agvDurationService;
+    @Autowired
+    private LocStsService locStsService;
 
     @SuppressWarnings("all")
     @Transactional
@@ -138,7 +142,6 @@
         }
         Boolean locStaStatusCheck = configService.getVal("LOC_STA_STATUS_CHECK", Boolean.class, true);
         Integer locStaTaskNum = configService.getVal("LOC_STA_TASK_NUM", Integer.class, 2);
-
 
         // 淇濆瓨浠诲姟
         for (Task task : taskList) {
@@ -205,11 +208,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)) {
@@ -761,16 +764,16 @@
 
             boolean first = true;
             for (Segment segment : segmentList) {
-
                 // 鍒嗘鎵�灞炵殑Task
                 Task task = taskService.getById(segment.getTaskId());
-
+                TaskPosDto.PosType posType = Objects.requireNonNull(TaskPosDto.queryPosType(segment.getPosType()));
+                boolean isStation = posType.equals(TaskPosDto.PosType.ORI_STA) || posType.equals(TaskPosDto.PosType.DEST_STA);
+                boolean isLoc = posType.equals(TaskPosDto.PosType.ORI_LOC) || posType.equals(TaskPosDto.PosType.DEST_LOC);
                 // 鑺傜偣鏉$爜
                 Code code = codeService.getCacheById(segment.getEndNode());
 
                 // 闇�瑕佽蛋琛�
                 if (!lastCode.getData().equals(code.getData())) {
-
                     // 璧拌璺緞鑺傜偣
 //                    List<String> pathList = mapService.checkoutPath(agv.getUuid(), lastCode, code);
                     List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1);
@@ -788,8 +791,14 @@
                         // 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
                         boolean reverse = false;
                         if (nextDirection.equals((workDirection + 180) % 360)) {
-                            nextDirection = workDirection;
-                            reverse = true;
+                            List<String> list = Arrays.asList("00000050", "00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084");
+                            if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
+                                reverse = false;
+                                lastDirection = nextDirection;
+                            } else {
+                                nextDirection = workDirection;
+                                reverse = true;
+                            }
                         }
 
                         // 绗簩姝ワ細鍒ゆ柇褰撳墠鑺傜偣鏄惁鍙互鏃嬭浆
@@ -810,7 +819,65 @@
                                     nextDirection = lastDirection;
                                     reverse = true;
                                 } else {
+                                    if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
+                                        // 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    // 宸ヤ綔鏃堕棿
+                                        ));
+                                        log.info("1TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
+                                                posType,
+                                                lastCode.getData(),
+                                                lastCode.getCornerBool(),
+                                                nextDirection,
+                                                180);
+                                    } else {
+                                        List<String> list = Arrays.asList("00000051", "00000052", "00000053", "00000054");
+                                        Double turnDirection = nextDirection;
+                                        if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
+                                            turnDirection = 180.0;
+                                        }
+                                        // 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(turnDirection),   // 鍔ㄤ綔鍙傛暟
+                                                ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
+                                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                                agvId,    // AGV
+                                                now    // 宸ヤ綔鏃堕棿
+                                        ));
+                                        log.info("2TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
+                                                posType,
+                                                lastCode.getData(),
+                                                lastCode.getCornerBool(),
+                                                nextDirection,
+                                                nextDirection);
+                                    }
+                                    lastDirection = nextDirection;
+                                }
+                            } else {
+                                if ((isStation && lastCode.getData().equals("00000050")) || (isLoc && lastCode.getData().equals("00000080"))) {
                                     // turn
+                                    reverse = false;
                                     actionList.add(new Action(
                                             null,    // 缂栧彿s
                                             task.getBusId(),    // 鎬荤嚎
@@ -820,20 +887,24 @@
                                             ActionTypeType.TurnCorner.desc,    // 鍚嶇О
                                             mapService.isTurnCorner(lastCode.getData()) ? 1D : 0D,    // 灞炴�у��
                                             lastCode.getData(),    // 鍦伴潰鐮�
-                                            String.valueOf(nextDirection),   // 鍔ㄤ綔鍙傛暟
+                                            String.valueOf(180),   // 鍔ㄤ綔鍙傛暟
                                             ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
                                             actionPrepareSts,    // 鍔ㄤ綔杩涘害
                                             agvId,    // AGV
                                             now    // 宸ヤ綔鏃堕棿
                                     ));
-
-                                    lastDirection = nextDirection;
+                                    log.info("3TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
+                                            posType,
+                                            lastCode.getData(),
+                                            lastCode.getCornerBool(),
+                                            nextDirection,
+                                            180);
                                 }
                             }
                         }
 
                         // 绗竴涓姩浣滀竴瀹氭槸 turn
-                        if (actionList.isEmpty()) {
+                        if (actionList.isEmpty() && lastCode.getCornerBool()) {
                             // turn
                             actionList.add(new Action(
                                     null,    // 缂栧彿
@@ -850,6 +921,12 @@
                                     agvId,    // AGV
                                     now    // 宸ヤ綔鏃堕棿
                             ));
+                            log.info("4TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
+                                    posType,
+                                    lastCode.getData(),
+                                    lastCode.getCornerBool(),
+                                    nextDirection,
+                                    nextDirection);
 
                             lastDirection = nextDirection;
                         }
@@ -879,31 +956,41 @@
                         lastCode = nextCode;
 
                     }
-
                 }
 
                 // 鍒濆鏂瑰悜鍊艰ˉ涓�
                 if (first) {
                     if (Cools.isEmpty(actionList) || !actionList.get(0).getActionType().equals(ActionTypeType.TurnCorner.val())) {
-                        // 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(workDirection),   // 鍔ㄤ綔鍙傛暟
-                                ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
-                                actionPrepareSts,    // 鍔ㄤ綔杩涘害
-                                agvId,    // AGV
-                                now    // 宸ヤ綔鏃堕棿
-                        ));
-
-                        lastDirection = workDirection;
-
+                        Double turnDirection = workDirection;
+                        List<String> list = Arrays.asList("00000050","00000051", "00000052", "00000053", "00000054", "00000080", "00000081", "00000082", "00000083", "00000084");
+                        if ((isStation && list.contains("00000050")) || (isLoc && list.contains("00000080"))) {
+                            turnDirection = workDirection + 180.0;
+                        }
+                        if (lastCode.getCornerBool()) {
+                            // 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(turnDirection),   // 鍔ㄤ綔鍙傛暟
+                                    ActionTypeType.TurnCorner.val(),    // 鍔ㄤ綔绫诲瀷
+                                    actionPrepareSts,    // 鍔ㄤ綔杩涘害
+                                    agvId,    // AGV
+                                    now    // 宸ヤ綔鏃堕棿
+                            ));
+                            log.info("5TurnCorner posType={}, code={}, corner={}, nextDirection={}, finalAngle={}",
+                                    posType,
+                                    lastCode.getData(),
+                                    lastCode.getCornerBool(),
+                                    null,
+                                    turnDirection);
+                            lastDirection = workDirection;
+                        }
                     }
                     first = false;
                 }
@@ -917,7 +1004,8 @@
                         assert backpackType != null;
                         // 妫�楠屾柟鍚�
                         if (!lastDirection.equals(workDirection)) {
-                            throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+                            lastDirection = workDirection;
+//                            throw new CoolException(agvNo agvNo+ "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
                         }
                         // 璐ф灦鍙栬揣
                         Loc oriLoc = locService.getById(task.getOriLoc());
@@ -959,7 +1047,8 @@
                         assert backpackType != null;
                         // 妫�楠屾柟鍚�
                         if (!lastDirection.equals(workDirection)) {
-                            throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
+                            lastDirection = workDirection;
+//                            throw new CoolException(agvNo + "鍙峰皬杞︽柟鍚戦敊璇紝璇锋帹鑷宠浆寮偣鎵嬪姩璋冩暣");
                         }
                         // 鏆傚瓨鐐瑰彇璐ц揣
                         actionList.add(new Action(
@@ -1003,28 +1092,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 +1122,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 +1155,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 +1222,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 +1238,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,    // 鎬荤嚎
@@ -1323,10 +1430,8 @@
 
             //String lastCorner = null;
             Integer index = -1;
+            boolean corner = false;
             for (int i = pathList.size(); i < 0; i++) {
-                if (i == 0) {
-                    continue;
-                }
                 Code nextCode = codeService.getCacheByData(pathList.get(i));
                 if (nextCode != null && nextCode.getCornerBool()) {
                     //lastCorner = pathList.get(i);
@@ -1363,16 +1468,12 @@
                             // DOTO 娣诲姞杞集
                             Code endCode = codeService.getCacheByData(pathList.get(pathList.size() - 1));
                             nextDirection = mapService.calculateDirection(lastCode, endCode, angleOffsetVal);
-                            if (nextDirection.equals((workDirection + 180) % 360)) {
-                                nextDirection = workDirection;
-                                reverse = true;
-                            }
-
+                            reverse = true;
                         } else {
                             nextDirection = mapService.calculateDirection(lastCode, nextCode, angleOffsetVal);
 
                             // 绗竴姝ワ細濡傛灉涓嬩竴涓柟鍚戞濂芥槸浣滀笟鏂瑰悜鐨勭浉鍙嶆柟鍚戯紝鍒欓噸缃笅涓�涓柟鍚戜负浣滀笟鏂瑰悜锛屾爣璁� reverse = true
-                            if (nextDirection.equals((workDirection + 180) % 360)) {
+                            if (!nextDirection.equals((workDirection + 180) % 360)) {
                                 nextDirection = workDirection;
                                 reverse = true;
                             }
@@ -1718,7 +1819,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,    // 鎬荤嚎
@@ -2339,4 +2440,41 @@
         }
         return false;
     }
+
+    /**
+     * @author Ryan
+     * @date 2025/11/10
+     * @description: 淇敼搴撲綅鐘舵��
+     * @version 1.0
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public R modifyStatus(LocSiteParams params) {
+        if (Objects.isNull(params.getStatus())) {
+            return R.error("淇敼鐘舵�佷笉鑳戒负绌猴紒锛�");
+        }
+        LocSts locSts = locStsService.getOne(new LambdaQueryWrapper<LocSts>().eq(LocSts::getUuid, params.getStatus()));
+        if (Objects.isNull(locSts)) {
+            return R.error("鏁版嵁閿欒锛屾湭鎵惧埌瀵瑰簲宸ヤ綔鐘舵�侊紒锛�");
+        }
+        if (params.getType().equals("loc")) {
+            Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, params.getCode()));
+            if (Objects.isNull(loc)) {
+                return R.error("搴撲綅淇℃伅涓嶅瓨鍦紒锛�");
+            }
+            loc.setLocSts(locSts.getId());
+            if (!locService.updateById(loc)) {
+                return R.ok("搴撲綅鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+            }
+        } else {
+            Sta sta = staService.getOne(new LambdaQueryWrapper<Sta>().eq(Sta::getStaNo, params.getCode()));
+            if (Objects.isNull(sta)) {
+                return R.error("绔欑偣淇℃伅涓嶅瓨鍦紒锛�");
+            }
+            sta.setStatus(locSts.getStatus());
+            if (!staService.updateById(sta)) {
+                return R.error("绔欑偣鐘舵�佷慨鏀瑰け璐ワ紒锛�");
+            }
+        }
+        return R.ok();
+    }
 }

--
Gitblit v1.9.1