From e8f46086c37e4012482950cdb56b4a67766c897c Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 01 八月 2024 14:07:47 +0800
Subject: [PATCH] V1.0
---
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
index 770ff8c..be7a0c9 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/timer/TaskTimer.java
@@ -11,6 +11,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.Date;
import java.util.List;
@@ -32,6 +33,8 @@
private LocDetlFieldService locDetlFieldService;
@Autowired
private WaitPakinService waitPakinService;
+ @Autowired
+ private WaitPakinLogService waitPakinLogService;
@Scheduled(cron = "0/3 * * * * ? ")
@Transactional
@@ -68,7 +71,7 @@
List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(task.getId());
if(taskDetls.isEmpty()) {
- throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦�");
+ throw new CoolException("浠诲姟鏄庣粏涓嶅瓨鍦�");
}
//娣诲姞搴撳瓨鏄庣粏
@@ -100,6 +103,17 @@
}
}
+ //缁勬墭閫氱煡妗h浆鍘嗗彶妗�
+ WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId));
+ if (waitPakin == null) {
+ throw new CoolException("缁勬墭閫氱煡妗d笉瀛樺湪");
+ }
+ WaitPakinLog waitPakinLog = new WaitPakinLog();
+ waitPakinLog.sync(waitPakin);
+ if (!waitPakinLogService.save(waitPakinLog)) {
+ throw new CoolException("缁勬墭閫氱煡妗h浆鍘嗗彶妗eけ璐�");
+ }
+
//鍒犻櫎缁勬墭閫氱煡妗�
waitPakinService.remove(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, task.getBarcode()).eq(WaitPakin::getHostId, hostId));
@@ -113,7 +127,8 @@
}
}
} catch (Exception e) {
-
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}finally {
InterceptorIgnoreHelper.clearIgnoreStrategy();
}
@@ -122,7 +137,15 @@
@Scheduled(cron = "0/3 * * * * ? ")
@Transactional
public void outExecute() {
+ InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
+ try {
+ } catch (Exception e) {
+ e.printStackTrace();
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ }finally {
+ InterceptorIgnoreHelper.clearIgnoreStrategy();
+ }
}
}
--
Gitblit v1.9.1