From 4b1c3470712263e8ff9feb7749eebab2c1c6b25a Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 20 五月 2025 19:32:34 +0800
Subject: [PATCH] 添加定时任务--出库任务
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 4 ++--
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java | 15 +++++++++++++++
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java | 1 +
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java | 2 +-
4 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
index b2bc885..f04bf96 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
@@ -159,6 +159,7 @@
.setAsnCode(asnOrder.getCode())
.setAsnId(asnOrder.getId())
.setProdTime(orderItem.getProdTime())
+ .setPlatItemId(orderItem.getPlatItemId())
.setPlatOrderCode(orderItem.getPlatOrderCode())
.setPlatWorkCode(orderItem.getPlatWorkCode())
.setProjectCode(orderItem.getProjectCode())
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
index e32ac6b..0573073 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -65,6 +65,21 @@
taskService.completeTask(tasks);
}
+ /**
+ * @author Ryan
+ * @date 2025/5/20
+ * @description: 瀹屾垚鍑哄簱浠诲姟锛屾洿鏂板簱瀛�
+ * @version 1.0
+ */
+ @Scheduled(cron = "0/5 * * * * ?")
+ @Transactional(rollbackFor = Exception.class)
+ public void complateOutStock() throws Exception {
+ List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id));
+ if (tasks.isEmpty()) {
+ return;
+ }
+ taskService.completeTask(tasks);
+ }
/**
* @author Ryan
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
index 2ad9a14..7978c57 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -17,6 +17,6 @@
R generateAGVTasks(WaitPakin waitPakins,String locCode,String orgSta, Long loginUserId);
// R completeTask(String id);
+ void completeTask(List<Task> task) throws Exception;
- void completeTask(List<Task> task) throws Exception;
}
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 0e747a6..a943509 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
@@ -371,7 +371,7 @@
*/
@Override
@Transactional(rollbackFor = Exception.class)
- public void completeTask(List<Task> tasks) throws Exception {
+ public synchronized void completeTask(List<Task> tasks) throws Exception {
for (Task task : tasks) {
if (task.getTaskType() < TaskType.TASK_TYPE_OUT.type) {
//鍏ュ簱浠诲姟
@@ -390,7 +390,7 @@
* @version 1.0
*/
@Transactional(rollbackFor = Exception.class)
- public void complateOutStock(Task task) {
+ public synchronized void complateOutStock(Task task) {
if (Objects.isNull(task)) {
return;
}
--
Gitblit v1.9.1