From bd4b7199d724280cd6536dc71d4afee263031464 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@gmail.com>
Date: 星期三, 04 二月 2026 10:14:01 +0800
Subject: [PATCH] #
---
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java | 109 +++++++++++++++++++++++++++++++-----------------------
1 files changed, 63 insertions(+), 46 deletions(-)
diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
index 5c78488..2613bdb 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java
@@ -17,6 +17,7 @@
import com.zy.acs.manager.manager.enums.*;
import com.zy.acs.manager.manager.mapper.TaskMapper;
import com.zy.acs.manager.manager.service.*;
+import com.zy.acs.manager.system.service.ConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -50,6 +51,8 @@
private ActionService actionService;
@Autowired
private TravelService travelService;
+ @Autowired
+ private ConfigService configService;
@Override
public PageResult<Task> pageRel(PageParam<Task, BaseParam> pageParam) {
@@ -288,6 +291,7 @@
if (!task.getTaskSts().equals(TaskStsType.COMPLETE.val())) {
return;
}
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
Date now = new Date();
// loc status
Loc oriLoc = null;
@@ -296,31 +300,35 @@
Sta destSta = null;
switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) {
case LOC_TO_LOC:
- oriLoc = locService.getById(task.getOriLoc());
- if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
- oriLoc.setLocSts(LocStsType.IDLE.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
+ oriLoc.setLocSts(LocStsType.IDLE.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ }
}
- }
- destLoc = locService.getById(task.getDestLoc());
- if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
- destLoc.setLocSts(LocStsType.STOCK.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ destLoc = locService.getById(task.getDestLoc());
+ if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
+ destLoc.setLocSts(LocStsType.STOCK.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ }
}
}
break;
case LOC_TO_STA:
- oriLoc = locService.getById(task.getOriLoc());
- if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
- oriLoc.setLocSts(LocStsType.IDLE.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ if (oriLoc.getLocSts().equals(LocStsType.PAKOUT.val())) {
+ oriLoc.setLocSts(LocStsType.IDLE.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getOriLoc$());
+ }
}
}
@@ -331,12 +339,14 @@
oriSta = staService.getById(task.getOriSta());
staReserveService.confirmStaReserve(oriSta, task, 1, StaReserveType.OUT);
- destLoc = locService.getById(task.getDestLoc());
- if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
- destLoc.setLocSts(LocStsType.STOCK.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ if (maintainLocSts) {
+ destLoc = locService.getById(task.getDestLoc());
+ if (destLoc.getLocSts().equals(LocStsType.PAKIN.val())) {
+ destLoc.setLocSts(LocStsType.STOCK.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ log.error("Loc [{}] 搴撲綅淇敼鐘舵�佸け璐�", task.getDestLoc$());
+ }
}
}
break;
@@ -361,31 +371,36 @@
public void maintainLocAndStaHandler(Task task, Boolean complete) {
Loc oriLoc = null; Loc destLoc = null;
Sta oriSta = null; Sta destSta = null;
+ Boolean maintainLocSts = configService.getVal("maintainLocSts", Boolean.class);
Date now = new Date();
TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl());
switch (Objects.requireNonNull(typeType)) {
case LOC_TO_LOC:
- oriLoc = locService.getById(task.getOriLoc());
- destLoc = locService.getById(task.getDestLoc());
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ destLoc = locService.getById(task.getDestLoc());
- oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
- }
+ oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
- destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
break;
case LOC_TO_STA:
- oriLoc = locService.getById(task.getOriLoc());
- oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
- oriLoc.setUpdateTime(now);
- if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ if (maintainLocSts) {
+ oriLoc = locService.getById(task.getOriLoc());
+ oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
+ oriLoc.setUpdateTime(now);
+ if (!locService.updateById(oriLoc)) {
+ throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
destSta = staService.getById(task.getDestSta());
@@ -403,11 +418,13 @@
staReserveService.cancelStaReserve(oriSta, task, 1, StaReserveType.OUT);
}
- destLoc = locService.getById(task.getDestLoc());
- destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
- destLoc.setUpdateTime(now);
- if (!locService.updateById(destLoc)) {
- throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ if (maintainLocSts) {
+ destLoc = locService.getById(task.getDestLoc());
+ destLoc.setLocSts(complete?LocStsType.STOCK.val():LocStsType.IDLE.val());
+ destLoc.setUpdateTime(now);
+ if (!locService.updateById(destLoc)) {
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
}
break;
case STA_TO_STA:
--
Gitblit v1.9.1