From 7692db6072ef569b5734d218cb11fa82e80171d1 Mon Sep 17 00:00:00 2001
From: chen.llin <1442464845@qq.comm>
Date: 星期四, 22 一月 2026 17:12:17 +0800
Subject: [PATCH] agv出库逻辑调整
---
src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 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 cd66568..0b531e7 100644
--- a/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/TaskLogServiceImpl.java
@@ -1,20 +1,23 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Task;
-import com.zy.asrs.entity.WrkMast;
-import com.zy.asrs.entity.WrkMastLog;
-import com.zy.asrs.mapper.TaskLogMapper;
+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.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.service.TaskService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
import java.util.Objects;
@Service("taskLogService")
@@ -22,6 +25,10 @@
@Autowired
private TaskService taskService;
+ @Autowired
+ private TaskDetlService taskDetlService;
+ @Autowired
+ private TaskDetlLogService taskDetlLogService;
/**
* @author Ryan
@@ -32,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