From 9fe1ec3afe8696c628d076d1f76686c4efc3012e Mon Sep 17 00:00:00 2001
From: zc <zyzc>
Date: 星期二, 21 十月 2025 10:49:55 +0800
Subject: [PATCH] 容器初始化功能优化
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 45 ++++++++++++++++++++++++++++++---------------
1 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index 601c72a..ed192ce 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -23,6 +23,7 @@
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import lombok.Synchronized;
+import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +35,7 @@
import java.util.*;
import java.util.stream.Collectors;
+@Slf4j
@Service("taskService")
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
@@ -345,6 +347,17 @@
if (!this.save(task)) {
throw new CoolException("浠诲姟淇濆瓨澶辫触锛侊紒");
}
+ BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, deviceSite.getSite()));
+ if (Objects.isNull(station) || station.getUseStatus() != LocStsType.LOC_STS_TYPE_O.type) {
+ throw new CoolException("绔欑偣涓嶅瓨鍦ㄦ垨绔欑偣涓嶅浜庣┖搴撶姸鎬侊紒锛�");
+ }
+ station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type);
+
+ if (basStationService.updateById(station)) {
+ throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
+ }
+
+
if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc())
.set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) {
throw new CoolException("搴撲綅棰勭害澶辫触锛侊紒");
@@ -406,22 +419,24 @@
*/
@Synchronized
@Override
- @Transactional(rollbackFor = Exception.class)
public void complateInTask(List<Task> tasks) throws Exception {
Long loginUserId = SystemAuthUtils.getLoginUserId();
for (Task task : tasks) {
- if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
- //1.鍏ュ簱
- complateInstock(task, loginUserId);
- } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
- //53.鎷f枡鍐嶅叆搴�
- //57.鐩樼偣鍐嶅叆搴�
- pickComplateInStock(task, loginUserId);
- } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
- //绉诲簱
- moveInStock(task, loginUserId);
+ try {
+ if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
+ //1.鍏ュ簱
+ complateInstock(task, loginUserId);
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
+ //53.鎷f枡鍐嶅叆搴�
+ //57.鐩樼偣鍐嶅叆搴�
+ pickComplateInStock(task, loginUserId);
+ } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
+ //绉诲簱
+ moveInStock(task, loginUserId);
+ }
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
}
-
}
}
@@ -590,7 +605,7 @@
//鏇存柊搴撲綅鏄庣粏
saveLocItem(taskItems, task.getId(), loginUserId);
} catch (Exception e) {
- throw new CoolException("搴撲綅鏄庣粏鏇存柊澶辫触锛侊紒");
+ throw new CoolException("浠诲姟鍙凤細" + task.getTaskCode() + "搴撲綅鏄庣粏鏇存柊澶辫触锛侊紒");
}
if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) {
@@ -635,7 +650,6 @@
*/
@Synchronized
@Override
- @Transactional(rollbackFor = Exception.class)
public void completeTask(List<Task> tasks) {
Long loginUserId = SystemAuthUtils.getLoginUserId();
for (Task task : tasks) {
@@ -643,7 +657,8 @@
try {
complateOutStock(task, loginUserId);
} catch (Exception e) {
- throw new CoolException(e.getMessage());
+ log.error(e.getMessage(), e);
+// throw new CoolException(e.getMessage());
}
}
}
--
Gitblit v1.9.1