From bfe51f9c2ce2181fee372ed5f9017c7af59cc896 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期一, 01 九月 2025 12:49:55 +0800
Subject: [PATCH] 1
---
zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/TaskServiceImpl.java | 84 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 78 insertions(+), 6 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 9074ef0..0d41401 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
@@ -6,6 +6,9 @@
import com.zy.acs.framework.common.Cools;
import com.zy.acs.framework.common.SnowflakeIdWorker;
import com.zy.acs.framework.exception.CoolException;
+import com.zy.acs.manager.common.domain.BaseParam;
+import com.zy.acs.manager.common.domain.PageParam;
+import com.zy.acs.manager.common.domain.PageResult;
import com.zy.acs.manager.common.exception.BusinessException;
import com.zy.acs.manager.core.domain.Lane;
import com.zy.acs.manager.core.service.LaneService;
@@ -40,6 +43,11 @@
private LaneService laneService;
@Override
+ public PageResult<Task> pageRel(PageParam<Task, BaseParam> pageParam) {
+ return new PageResult<>(this.baseMapper.selectPageRel(pageParam, pageParam.checkoutMap()), pageParam.getTotal());
+ }
+
+ @Override
public synchronized String generateSeqNum() {
return String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19);
}
@@ -54,6 +62,12 @@
public Task selectByUuid(String uuid) {
return this.getOne(new LambdaQueryWrapper<Task>().eq(Task::getUuid, uuid));
}
+
+ @Override
+ public Task selectBySeqNum(String seqNum) {
+ return this.list(new LambdaQueryWrapper<Task>().eq(Task::getSeqNum, seqNum)).get(0);
+ }
+
@Override
public List<Task> selectBySts(TaskStsType taskStsType) {
@@ -120,6 +134,29 @@
}
@Override
+ @Transactional
+ public Boolean cancelCheckTaskSts(Long taskId, Long userId) {
+ Task task = this.getById(taskId);
+ if (null == task) {
+ return Boolean.FALSE;
+ }
+ if ( task.getTaskSts() >= TaskStsType.ASSIGN.val()){
+ throw new BusinessException("浠诲姟宸插垎閰嶆垨鎵ц锛屼笉鑳藉彇娑�");
+ }
+
+ this.maintainLocSts(task, Boolean.FALSE);
+
+ task.setTaskSts(TaskStsType.CANCEL.val());
+ task.setUpdateTime(new Date());
+ task.setUpdateBy(userId);
+ if (!this.updateById(task)) {
+ throw new CoolException(BaseRes.ERROR);
+ }
+ busService.checkoutComplete(task.getBusId());
+ return Boolean.TRUE;
+ }
+
+ @Override
public Lane checkoutOriginLane(Task task) {
Long codeId = null;
TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl());
@@ -139,7 +176,7 @@
if (null == codeId) {
return null;
}
- return laneService.search(codeService.getById(codeId).getData());
+ return laneService.search(codeService.getCacheById(codeId).getData());
}
@Override
@@ -162,7 +199,7 @@
if (null == codeId) {
return null;
}
- return laneService.search(codeService.getById(codeId).getData());
+ return laneService.search(codeService.getCacheById(codeId).getData());
}
@Override
@@ -188,6 +225,14 @@
wrapper.in(Task::getTaskSts, TaskStsType.WAITING.val(), TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val());
wrapper.notIn(Task::getTaskType, TaskTypeType.MOVE.val(), TaskTypeType.TO_CHARGE.val(), TaskTypeType.TO_STANDBY.val());
return this.list(wrapper);
+ }
+
+ @Override
+ public Integer findTransportTasksCountByAgv(Long agvId) {
+ LambdaQueryWrapper<Task> wrapper = new LambdaQueryWrapper<Task>().eq(Task::getAgvId, agvId);
+ wrapper.in(Task::getTaskSts, TaskStsType.WAITING.val(), TaskStsType.ASSIGN.val(), TaskStsType.PROGRESS.val());
+ wrapper.notIn(Task::getTaskType, TaskTypeType.MOVE.val(), TaskTypeType.TO_CHARGE.val(), TaskTypeType.TO_STANDBY.val());
+ return this.count(wrapper);
}
@Override
@@ -218,13 +263,13 @@
oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
oriLoc.setUpdateTime(now);
if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + task.getOriLoc$() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ 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 [" + task.getDestLoc$() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
}
break;
case LOC_TO_STA:
@@ -232,18 +277,45 @@
oriLoc.setLocSts(complete?LocStsType.IDLE.val():LocStsType.STOCK.val());
oriLoc.setUpdateTime(now);
if (!locService.updateById(oriLoc)) {
- throw new BusinessException("Loc [" + task.getOriLoc$() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ throw new BusinessException("Loc [" + oriLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
+
+ destSta = staService.getById(task.getDestSta());
+ destSta.setStaSts(complete?StaStsType.STOCK.val():StaStsType.IDLE.val());
+ destSta.setUpdateTime(now);
+ if (!staService.updateById(destSta)) {
+ throw new BusinessException("Sta [" + destSta.getStaNo() + "] 绔欑偣淇敼鐘舵�佸け璐� 锛侊紒锛�");
}
break;
case STA_TO_LOC:
+ oriSta = staService.getById(task.getOriSta());
+ oriSta.setStaSts(complete?StaStsType.IDLE.val():StaStsType.STOCK.val());
+ oriSta.setUpdateTime(now);
+ if (!staService.updateById(oriSta)) {
+ throw new BusinessException("Sta [" + oriSta.getStaNo() + "] 绔欑偣淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
+
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 [" + task.getDestLoc$() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ throw new BusinessException("Loc [" + destLoc.getLocNo() + "] 搴撲綅淇敼鐘舵�佸け璐� 锛侊紒锛�");
}
break;
case STA_TO_STA:
+ oriSta = staService.getById(task.getOriSta());
+ oriSta.setStaSts(complete?StaStsType.IDLE.val():StaStsType.STOCK.val());
+ oriSta.setUpdateTime(now);
+ if (!staService.updateById(oriSta)) {
+ throw new BusinessException("Sta [" + oriSta.getStaNo() + "] 绔欑偣淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
+
+ destSta = staService.getById(task.getDestSta());
+ destSta.setStaSts(complete?StaStsType.STOCK.val():StaStsType.IDLE.val());
+ destSta.setUpdateTime(now);
+ if (!staService.updateById(destSta)) {
+ throw new BusinessException("Sta [" + destSta.getStaNo() + "] 绔欑偣淇敼鐘舵�佸け璐� 锛侊紒锛�");
+ }
break;
case TO_CHARGE:
case TO_STANDBY:
--
Gitblit v1.9.1