From 9611dc686299be640ce5e5f5990c747765161ec7 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期三, 21 一月 2026 10:59:38 +0800
Subject: [PATCH] agv逻辑调整2

---
 src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
index d762b67..0b531e7 100644
--- a/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
@@ -4,8 +4,12 @@
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.Task;
+import com.zy.asrs.entity.TaskDetl;
+import com.zy.asrs.entity.TaskDetlLog;
 import com.zy.asrs.entity.TaskLog;
 import com.zy.asrs.mapper.TaskLogMapper;
+import com.zy.asrs.service.TaskDetlLogService;
+import com.zy.asrs.service.TaskDetlService;
 import com.zy.asrs.service.TaskLogService;
 import com.zy.asrs.service.TaskService;
 import org.springframework.beans.BeanUtils;
@@ -13,6 +17,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
 import java.util.Objects;
 
 @Service("taskLogService")
@@ -20,6 +25,10 @@
 
     @Autowired
     private TaskService taskService;
+    @Autowired
+    private TaskDetlService taskDetlService;
+    @Autowired
+    private TaskDetlLogService taskDetlLogService;
 
     /**
      * @author Ryan
@@ -30,18 +39,33 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean save(Integer wrkNo) {
-        Task task = taskService.selectOne(new EntityWrapper<Task>().eq("wrk_no", wrkNo));
+        Task task = taskService.selectOne(new EntityWrapper<Task>()
+                .eq("wrk_no", wrkNo)
+                .andNew("(is_deleted = 0)"));
         if (Objects.isNull(task)) {
             throw new CoolException("鏁版嵁閿欒锛氫换鍔′笉瀛樺湪锛侊紒");
         }
         TaskLog taskLog = new TaskLog();
         BeanUtils.copyProperties(task, taskLog);
-        taskLog.setLogId(task.getId());
 
         if (!this.insert(taskLog)) {
             throw new CoolException("浠诲姟鏃ュ織淇濆瓨澶辫触锛侊紒");
         }
 
-        return false;
+        List<TaskDetl> detls = taskDetlService.selectList(new EntityWrapper<TaskDetl>().eq("wrk_no", wrkNo));
+        // 绌烘墭鍏ュ簱(io_type=10)鍜岀┖鎵樺嚭搴�(io_type=110)鍙兘娌℃湁鏄庣粏锛屽厑璁镐负绌�
+        if (Objects.nonNull(detls) && !detls.isEmpty()) {
+            detls.forEach(detl -> {
+                TaskDetlLog detlLog = new TaskDetlLog();
+                BeanUtils.copyProperties(detl, detlLog);
+                detlLog.setId(null);
+                detlLog.setTaskID(taskLog.getId());
+                if (!taskDetlLogService.insert(detlLog)) {
+                    throw new CoolException("宸ヤ綔妗f槑缁嗗巻鍙蹭繚瀛樺け璐ワ紒锛�");
+                }
+            });
+        }
+
+        return true;
     }
 }

--
Gitblit v1.9.1