From 33664d7d7f8478fb961f8fbda44c885fd854bf3d Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 13 八月 2025 16:43:33 +0800
Subject: [PATCH] 保存一个版本

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java            |    8 ++++
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/ValidService.java           |    5 +-
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java   |   45 ++++++++++++++++++++++
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaServiceImpl.java |    5 ++
 zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/StaService.java          |    2 +
 5 files changed, 63 insertions(+), 2 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 2eb63f7..87ff4d9 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
@@ -1643,6 +1643,14 @@
      */
     private void report(Task task, TaskReportStsType taskReportStsType) {
         // TODO 鎻掑叆涓�鏉′笂鎶ヨ褰�
+        if (task.getBusId() == null) {
+            return;
+        }
+        List<TaskReport> list = taskReportService.list(new LambdaQueryWrapper<TaskReport>().eq(TaskReport::getSeqNum, task.getSeqNum()).eq(TaskReport::getBusNo, task.getBusId$()).eq(TaskReport::getTaskSts, taskReportStsType.status));
+        if (!Cools.isEmpty(list)) {
+            log.info("TaskReport [{}] 宸查噸澶嶏紝涓嶅啀鎻掑叆 ==========>> ", JSON.toJSONString(task));
+            return;
+        }
         TaskReport taskReport = new TaskReport();
         taskReport.setAgvId(task.getAgvId());
         taskReport.setBusNo(task.getBusId$());
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 1c75b7f..406d15a 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
@@ -59,7 +59,8 @@
 //                task.setOriCode(oriLoc.getCode());
             }
             if (!Cools.isEmpty(taskDto.getOriSta())) {
-                Sta oriSta = staService.selectByStaNo(taskDto.getOriSta());
+                Sta oriSta = staService.selectByStaNoOrName(taskDto.getOriSta());
+
                 if (null == oriSta) {
                     throw new BusinessException("oriSta: " + taskDto.getOriSta() + " doesn't exist!");
                 }
@@ -76,7 +77,7 @@
                 task.setDestCode(destLoc.getCode());
             }
             if (!Cools.isEmpty(taskDto.getDestSta())) {
-                Sta destSta = staService.selectByStaNo(taskDto.getDestSta());
+                Sta destSta = staService.selectByStaNoOrName(taskDto.getDestSta());
                 if (null == destSta) {
                     throw new BusinessException("destSta: " + taskDto.getDestSta() + " doesn't exist!");
                 }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java
index 848bb03..6c11241 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/OpenController.java
@@ -1,12 +1,16 @@
 package com.zy.acs.manager.manager.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.zy.acs.framework.common.Cools;
 import com.zy.acs.framework.common.R;
 import com.zy.acs.manager.common.annotation.OperationLog;
 import com.zy.acs.manager.common.domain.BaseParam;
 import com.zy.acs.manager.common.domain.PageParam;
+import com.zy.acs.manager.core.constant.LocGroupConstant;
 import com.zy.acs.manager.core.service.MainService;
 import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam;
 import com.zy.acs.manager.manager.entity.Loc;
+import com.zy.acs.manager.manager.enums.LocStsType;
 import com.zy.acs.manager.manager.service.LocService;
 import com.zy.acs.manager.system.controller.BaseController;
 import io.swagger.annotations.Api;
@@ -16,6 +20,8 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -49,4 +55,43 @@
         return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true)));
     }
 
+    @PostMapping("/loc/one")
+    @OperationLog("one loc")
+    public R emptyLoc(@RequestBody Map<String, Object> map) {
+        String staNo = map.get("staNo").toString();
+        Integer startRow = null;
+        Integer endRow = null;
+        if (staNo.equals("101-2")||staNo.equals("101-3")||staNo.equals("102-2")||staNo.equals("102-3")){
+             startRow = Collections.min(LocGroupConstant.FAR_RIGHT_LOC_ROW_LIST);
+             endRow = Collections.max(LocGroupConstant.FAR_RIGHT_LOC_ROW_LIST);
+        } else if (staNo.equals("103-2")||staNo.equals("103-3")||staNo.equals("104-2")||staNo.equals("104-3")) {
+             startRow = Collections.min(LocGroupConstant.RIGHT_LOC_ROW_LIST);
+             endRow = Collections.max(LocGroupConstant.RIGHT_LOC_ROW_LIST);
+        }else if (staNo.equals("105-2")||staNo.equals("105-3")||staNo.equals("106-2")||staNo.equals("106-3")) {
+             startRow = Collections.min(LocGroupConstant.MIDDLE_LOC_ROW_LIST);
+             endRow = Collections.max(LocGroupConstant.MIDDLE_LOC_ROW_LIST);
+        }else if (staNo.equals("107-2")||staNo.equals("107-3")||staNo.equals("108-2")||staNo.equals("108-3")) {
+             startRow = Collections.min(LocGroupConstant.LEFT_LOC_ROW_LIST);
+             endRow = Collections.max(LocGroupConstant.LEFT_LOC_ROW_LIST);
+        }else if (staNo.equals("1007")){
+             startRow = Collections.min(LocGroupConstant.FAR_LEFT_LOC_ROW_LIST);
+             endRow = Collections.max(LocGroupConstant.FAR_LEFT_LOC_ROW_LIST);
+        }else {
+            return R.error("staNo is not support");
+        }
+        LambdaQueryWrapper<Loc> idleWrapper = new LambdaQueryWrapper<Loc>().eq(Loc::getLocSts, LocStsType.IDLE.val());
+        if (null != startRow) {
+            idleWrapper.ge(Loc::getRow, startRow);
+        }
+        if (null != endRow) {
+            idleWrapper.le(Loc::getRow, endRow);
+        }
+        List<Loc> idleList = locService.list(idleWrapper);
+        if (Cools.isEmpty(idleList)) {
+            return R.error("娌$┖搴撲綅");
+        }
+        Collections.shuffle(idleList);
+        return R.ok().add(idleList.get(0));
+    }
+
 }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/StaService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/StaService.java
index 673cd8e..4138f39 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/StaService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/StaService.java
@@ -7,4 +7,6 @@
 
     Sta selectByStaNo(String staNo);
 
+    Sta selectByStaNoOrName(String staNo);
+
 }
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaServiceImpl.java
index cf25400..88ac127 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaServiceImpl.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/StaServiceImpl.java
@@ -15,4 +15,9 @@
         return this.getOne(new LambdaQueryWrapper<Sta>().eq(Sta::getStaNo, staNo));
     }
 
+    @Override
+    public Sta selectByStaNoOrName(String staNo) {
+        return this.getOne(new LambdaQueryWrapper<Sta>().eq(Sta::getStaNo, staNo).or().eq(Sta::getName, staNo));
+    }
+
 }

--
Gitblit v1.9.1