From 3e6cd2231fc99a855129d1a293b8d65adf1683b5 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期三, 04 二月 2026 10:55:11 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java |   94 +++++++++++++++++++++++++---------------------
 1 files changed, 51 insertions(+), 43 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 d1aa9eb..230d0e6 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
@@ -23,7 +23,7 @@
 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.manager.controller.param.OpenBusSubmitParam;
+import com.zy.acs.manager.core.integrate.dto.OpenBusSubmitParam;
 import com.zy.acs.manager.manager.entity.*;
 import com.zy.acs.manager.manager.enums.*;
 import com.zy.acs.manager.manager.service.*;
@@ -104,11 +104,12 @@
     @Transactional
     public Bus generateBusAndTask(OpenBusSubmitParam busSubmitParam, String memo) {
         String errorMsg = busService.checkoutValid(busSubmitParam);
+        Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
         if (!Cools.isEmpty(errorMsg)) {
             throw new BusinessException(errorMsg);
         }
-        String batch = busSubmitParam.getBatch();
-        List<TaskDto> taskDtoList = busSubmitParam.getTaskList();
+        String batchNo = busSubmitParam.getBatchNo();
+        List<TaskDto> taskDtoList = busSubmitParam.getTasks();
         if (Cools.isEmpty(taskDtoList)) {
             throw new BusinessException("taskList can't be empty!");
         }
@@ -123,7 +124,7 @@
         Date now = new Date();
         Bus bus = new Bus();
         bus.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
-        bus.setBusNo(batch);
+        bus.setBusNo(batchNo);
         bus.setStartTime(now);
         bus.setBusSts(BusStsType.RECEIVE.val());
         bus.setMemo(memo);
@@ -147,35 +148,39 @@
             Sta destSta = null;
             switch (TaskTypeType.get(task.getTaskTypeEl())) {
                 case LOC_TO_LOC:
-                    oriLoc = locService.getById(task.getOriLoc());
-                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
-                        throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
-                    }
-                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
-                    oriLoc.setUpdateTime(now);
-                    if (!locService.updateById(oriLoc)) {
-                        throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
-                    }
+                    if (maintainLocSts) {
+                        oriLoc = locService.getById(task.getOriLoc());
+                        if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+                            throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
+                        }
+                        oriLoc.setLocSts(LocStsType.PAKOUT.val());
+                        oriLoc.setUpdateTime(now);
+                        if (!locService.updateById(oriLoc)) {
+                            throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+                        }
 
-                    destLoc = locService.getById(task.getDestLoc());
-                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
-                        throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
-                    }
-                    destLoc.setLocSts(LocStsType.PAKIN.val());
-                    destLoc.setUpdateTime(now);
-                    if (!locService.updateById(destLoc)) {
-                        throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+                        destLoc = locService.getById(task.getDestLoc());
+                        if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+                            throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
+                        }
+                        destLoc.setLocSts(LocStsType.PAKIN.val());
+                        destLoc.setUpdateTime(now);
+                        if (!locService.updateById(destLoc)) {
+                            throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+                        }
                     }
                     break;
                 case LOC_TO_STA:
-                    oriLoc = locService.getById(task.getOriLoc());
-                    if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
-                        throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
-                    }
-                    oriLoc.setLocSts(LocStsType.PAKOUT.val());
-                    oriLoc.setUpdateTime(now);
-                    if (!locService.updateById(oriLoc)) {
-                        throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+                    if (maintainLocSts) {
+                        oriLoc = locService.getById(task.getOriLoc());
+                        if (!oriLoc.getLocSts().equals(LocStsType.STOCK.val())) {
+                            throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " is not in STOCK status");
+                        }
+                        oriLoc.setLocSts(LocStsType.PAKOUT.val());
+                        oriLoc.setUpdateTime(now);
+                        if (!locService.updateById(oriLoc)) {
+                            throw new BusinessException("oriLoc锛�" + task.getOriLoc$() + " failed to update");
+                        }
                     }
 
                     destSta = staService.getById(task.getDestSta());
@@ -189,14 +194,16 @@
                         throw new BusinessException("oriSta锛�" + task.getOriSta$() + " failed to reserve");
                     }
 
-                    destLoc = locService.getById(task.getDestLoc());
-                    if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
-                        throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
-                    }
-                    destLoc.setLocSts(LocStsType.PAKIN.val());
-                    destLoc.setUpdateTime(now);
-                    if (!locService.updateById(destLoc)) {
-                        throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+                    if (maintainLocSts) {
+                        destLoc = locService.getById(task.getDestLoc());
+                        if (!destLoc.getLocSts().equals(LocStsType.IDLE.val())) {
+                            throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " is not in IDLE status");
+                        }
+                        destLoc.setLocSts(LocStsType.PAKIN.val());
+                        destLoc.setUpdateTime(now);
+                        if (!locService.updateById(destLoc)) {
+                            throw new BusinessException("destLoc锛�" + task.getDestLoc$() + " failed to update");
+                        }
                     }
                     break;
                 case STA_TO_STA:
@@ -791,6 +798,7 @@
             task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE)?2:1);
             task.setTaskSts(TaskStsType.ASSIGN.val());
             task.setTaskType(taskType.val());
+            task.setUplinkSts(TaskUplinkStateType.SKIPPED.toString());
             task.setIoTime(now);
             task.setStartTime(now);
             if (!taskService.save(task)) {
@@ -892,8 +900,8 @@
             long actionPrepareSts = ActionStsType.PREPARE.val();
 //            JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class);
             int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class);
-            Double defaultShelfDepth = configService.getVal("defaultShelfDepth", Double.class);
-            defaultShelfDepth = Optional.ofNullable(defaultShelfDepth).orElse((double) 0);
+//            Double defaultShelfDepth = configService.getVal("defaultShelfDepth", Double.class);
+//            defaultShelfDepth = Optional.ofNullable(defaultShelfDepth).orElse((double) 0);
             String agvNo = agvService.getAgvNo(agvId);
 //            if (!agvService.judgeEnable(agvId)) {
 //                throw new CoolException("AGV[" + agvNo + "]褰撳墠涓嶅彲鐢�...");
@@ -1170,7 +1178,7 @@
                                 ActionTypeType.ReadyTakeFromShelvesLoc.desc,    // 鍚嶇О
                                 (double) agvDirectionType.val,    // 灞炴�у��
                                 lastCode.getData(),    // 鍦伴潰鐮�
-                                JSON.toJSONString(new HeightDepthDto(oriLoc.getOffset(), defaultShelfDepth)),   // 鍔ㄤ綔鍙傛暟
+                                JSON.toJSONString(new HeightDepthDto(oriLoc.getOffset())),   // 鍔ㄤ綔鍙傛暟
                                 ActionTypeType.ReadyTakeFromShelvesLoc.val(),    // 鍔ㄤ綔绫诲瀷
                                 actionPrepareSts,    // 鍔ㄤ綔杩涘害
                                 agvId,    // AGV
@@ -1233,7 +1241,7 @@
                                 ActionTypeType.ReadyReleaseToShelvesLoc.desc,    // 鍚嶇О
                                 (double) agvDirectionType.val,    // 灞炴�у��
                                 lastCode.getData(),    // 鍦伴潰鐮�
-                                JSON.toJSONString(new HeightDepthDto(destLoc.getOffset(), defaultShelfDepth)),   // 鍔ㄤ綔鍙傛暟
+                                JSON.toJSONString(new HeightDepthDto(destLoc.getOffset())),   // 鍔ㄤ綔鍙傛暟
                                 ActionTypeType.ReadyReleaseToShelvesLoc.val(),    // 鍔ㄤ綔绫诲瀷
                                 actionPrepareSts,    // 鍔ㄤ綔杩涘害
                                 agvId,    // AGV
@@ -1869,7 +1877,7 @@
                                 // load from sta
                                 sta = staService.getById(currTask.getOriSta());
                                 // reserve to be waiting
-                                if (!staReserveService.waitingStaReserve(sta, currTask, 1, StaReserveType.OUT)) {
+                                if (!staReserveService.waitingStaReserve(sta, currTask, currSeg, 1, StaReserveType.OUT)) {
                                     break;
                                 }
                                 // convey plc valid
@@ -1885,7 +1893,7 @@
                                 // place to sta
                                 sta = staService.getById(currTask.getDestSta());
                                 // reserve to be waiting
-                                if (!staReserveService.waitingStaReserve(sta, currTask, 1, StaReserveType.IN)) {
+                                if (!staReserveService.waitingStaReserve(sta, currTask, currSeg, 1, StaReserveType.IN)) {
                                     break;
                                 }
                                 // convey plc valid

--
Gitblit v1.9.1