From 5c7e7501878caca3e4b4e7316681ade4de415fb1 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期四, 05 二月 2026 13:56:51 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java |   43 ++++++++++++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java
index 31435f3..c337c2c 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSON;
 import com.zy.acs.framework.common.Cools;
 import com.zy.acs.framework.common.SnowflakeIdWorker;
+import com.zy.acs.manager.common.config.UplinkProperties;
 import com.zy.acs.manager.common.domain.TaskDto;
 import com.zy.acs.manager.common.exception.BusinessException;
 import com.zy.acs.manager.manager.entity.Code;
@@ -10,6 +11,7 @@
 import com.zy.acs.manager.manager.entity.Sta;
 import com.zy.acs.manager.manager.entity.Task;
 import com.zy.acs.manager.manager.enums.TaskTypeType;
+import com.zy.acs.manager.manager.enums.TaskUplinkStateType;
 import com.zy.acs.manager.manager.service.CodeService;
 import com.zy.acs.manager.manager.service.LocService;
 import com.zy.acs.manager.manager.service.StaService;
@@ -19,6 +21,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
 /**
  * Created by vincent on 2023/6/14
@@ -36,26 +39,31 @@
     private MapService mapService;
     @Autowired
     private SnowflakeIdWorker snowflakeIdWorker;
+    @Autowired
+    private UplinkProperties uplinkProperties;
 
-    public List<Task> validBusDto(List<TaskDto> taskDtoList) {
+    public List<Task> validTaskDtoList(List<TaskDto> taskDtoList) {
         List<Task> taskList = new ArrayList<>();
+        String uplinkSts = uplinkProperties.getEnabled() ? TaskUplinkStateType.PENDING.toString() : TaskUplinkStateType.SKIPPED.toString();
         for (TaskDto taskDto : taskDtoList) {
-            if (Cools.isEmpty(taskDto.getSeqNum())) {
+            if (Cools.isEmpty(taskDto.getTaskNo())) {
                 throw new BusinessException("Task seqNum can't be empty!");
             }
+            taskDto.setPriority(Optional.ofNullable(taskDto.getPriority()).orElse(1));
             Task task = new Task();
             taskList.add(task);
             task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3));
-            task.setSeqNum(taskDto.getSeqNum());
+            task.setSeqNum(taskDto.getTaskNo());
             task.setPriority(taskDto.getPriority());
 
             // ori --------------------------
             if (!Cools.isEmpty(taskDto.getOriLoc())) {
-                Loc oriLoc = locService.selecatByLocNo(taskDto.getOriLoc());
+                Loc oriLoc = locService.selectByLocNo(taskDto.getOriLoc());
                 if (null == oriLoc) {
                     throw new BusinessException("oriLoc: " + taskDto.getOriLoc() + " doesn't exist!");
                 }
                 task.setOriLoc(oriLoc.getId());
+//                task.setOriCode(oriLoc.getCode());
             }
             if (!Cools.isEmpty(taskDto.getOriSta())) {
                 Sta oriSta = staService.selectByStaNo(taskDto.getOriSta());
@@ -63,10 +71,11 @@
                     throw new BusinessException("oriSta: " + taskDto.getOriSta() + " doesn't exist!");
                 }
                 task.setOriSta(oriSta.getId());
+//                task.setOriCode(oriSta.getCode());
             }
             // dest --------------------------
             if (!Cools.isEmpty(taskDto.getDestLoc())) {
-                Loc destLoc = locService.selecatByLocNo(taskDto.getDestLoc());
+                Loc destLoc = locService.selectByLocNo(taskDto.getDestLoc());
                 if (null == destLoc) {
                     throw new BusinessException("destLoc: " + taskDto.getDestLoc() + " doesn't exist!");
                 }
@@ -125,8 +134,8 @@
                     oriLoc = locService.getById(task.getOriLoc());
                     destLoc = locService.getById(task.getDestLoc());
 
-                    startCode = codeService.getById(oriLoc.getCode());
-                    endCode = codeService.getById(destLoc.getCode());
+                    startCode = codeService.getCacheById(oriLoc.getCode());
+                    endCode = codeService.getCacheById(destLoc.getCode());
                     if (null == startCode) {
                         throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " hasn't been bound to a QrCode yet");
                     }
@@ -138,13 +147,14 @@
                         throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong锛宱riLoc锛�" + task.getOriLoc() + " is unable to reach destLoc" + task.getDestLoc());
                     }
                     task.setPhase(JSON.toJSONString(pathList));
+                    task.setUplinkSts(uplinkSts);
                     break;
                 case LOC_TO_STA:
                     oriLoc = locService.getById(task.getOriLoc());
                     destSta = staService.getById(task.getDestSta());
 
-                    startCode = codeService.getById(oriLoc.getCode());
-                    endCode = codeService.getById(destSta.getCode());
+                    startCode = codeService.getCacheById(oriLoc.getCode());
+                    endCode = codeService.getCacheById(destSta.getCode());
                     if (null == startCode) {
                         throw new BusinessException("oriLoc锛�" + oriLoc.getLocNo() + " hasn't been bound to QrCode yet");
                     }
@@ -156,13 +166,14 @@
                         throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong锛宱riLoc锛�" + task.getOriLoc() + " can't move to destSta" + task.getDestSta());
                     }
                     task.setPhase(JSON.toJSONString(pathList));
+                    task.setUplinkSts(uplinkSts);
                     break;
                 case STA_TO_LOC:
                     oriSta = staService.getById(task.getOriSta());
                     destLoc = locService.getById(task.getDestLoc());
 
-                    startCode = codeService.getById(oriSta.getCode());
-                    endCode = codeService.getById(destLoc.getCode());
+                    startCode = codeService.getCacheById(oriSta.getCode());
+                    endCode = codeService.getCacheById(destLoc.getCode());
                     if (null == startCode) {
                         throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " hasn't bound to QrCode yet");
                     }
@@ -174,24 +185,26 @@
                         throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong锛宱riSta锛�" + task.getOriSta() + " is unable to react destLoc" + task.getDestLoc());
                     }
                     task.setPhase(JSON.toJSONString(pathList));
+                    task.setUplinkSts(uplinkSts);
                     break;
                 case STA_TO_STA:
                     oriSta = staService.getById(task.getOriSta());
                     destSta = staService.getById(task.getDestSta());
 
-                    startCode = codeService.getById(oriSta.getCode());
-                    endCode = codeService.getById(destSta.getCode());
+                    startCode = codeService.getCacheById(oriSta.getCode());
+                    endCode = codeService.getCacheById(destSta.getCode());
                     if (null == startCode) {
-                        throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " 鏈粦瀹氬湴闈㈢爜");
+                        throw new BusinessException("oriSta锛�" + oriSta.getStaNo() + " hasn't been bound to a QrCode yet");
                     }
                     if (null == endCode) {
-                        throw new BusinessException("destSta锛�" + destSta.getStaNo() + " 鏈粦瀹氬湴闈㈢爜");
+                        throw new BusinessException("destSta锛�" + destSta.getStaNo() + " is not bound to a QrCode yet");
                     }
                     pathList = mapService.validFeasibility(startCode, endCode);
                     if (Cools.isEmpty(pathList)) {
                         throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong锛宱riSta锛�" + task.getOriSta() + " can't move to destSta" + task.getDestSta());
                     }
                     task.setPhase(JSON.toJSONString(pathList));
+                    task.setUplinkSts(uplinkSts);
                     break;
                 default:
                     throw new BusinessException("seqNum:" + task.getSeqNum() + " is wrong锛� cause this type not exist");

--
Gitblit v1.9.1