From 14411ddd5b7ac4622c5ac734354011cbef031578 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期五, 17 十月 2025 14:03:48 +0800
Subject: [PATCH] 联调
---
src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java | 56 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java b/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
index 6d3aed0..abe3b38 100644
--- a/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
+++ b/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
@@ -7,6 +7,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -34,17 +35,53 @@
private ErpSqlServer erpSqlServer;
- @Transactional(rollbackFor = Throwable.class)
+ //@Transactional(rollbackFor = Throwable.class)
@Scheduled(cron = "${erp.refreshtime}")
+ @Async("orderThreadPool")
public void OutHedTBScheduler() {
//log.info("OutHedTBScheduler寮�濮嬩簡");
if (!erpEnabled) return;
- String sqlInHed = "select * from erp_OutHedTB where LKName='涓壃浜屾湡'";
+ String sqlInHed = "select * from erp_OutHedTB where LKName='楂橀湒绔嬪簱'";
List<OutHedTB> inHeds = erpSqlServer.select(sqlInHed, OutHedTB.class);
if (!inHeds.isEmpty()) {
for (OutHedTB inHed : inHeds) {
if (!Cools.isEmpty(inHed.getTemp3()) && inHed.getTemp3().equals("fault")) {
+ //continue;
+ }
+ HashMap<String, String> condition = new HashMap<>();
+ condition.put("bill_no", "'" + inHed.getBillNo() + "'");
+ List<OutDetTB> inDetTBS = erpSqlServer.selectList(OutDetTB.class, condition);
+ HashMap<String, Object> hedAndDet = new HashMap<>();
+ hedAndDet.put("hed", inHed);
+ hedAndDet.put("det", inDetTBS);
+ if (inDetTBS == null || inDetTBS.isEmpty()) {
continue;
+ }
+ try {
+ inMS.createOutOrder(inHed, inDetTBS);
+ log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);
+ move(hedAndDet);
+ } catch (Exception e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ String sql = "UPDATE erp_OutHedTB SET Temp3 = 'fault' WHERE BillNo = '" + inHed.getBillNo() + "'";
+ erpSqlServer.update(sql);
+//
+ }
+ }
+ }
+ }
+
+
+ public void OutHedTBScheduler(String orderNo) {
+ //log.info("OutHedTBScheduler寮�濮嬩簡");
+ if (!erpEnabled) return;
+ String sqlInHed = "select * from erp_OutHedTB where LKName='楂橀湒绔嬪簱' and BillNo = '" + orderNo + "'";
+ List<OutHedTB> inHeds = erpSqlServer.select(sqlInHed, OutHedTB.class);
+ if (!inHeds.isEmpty()) {
+ for (OutHedTB inHed : inHeds) {
+ if (!Cools.isEmpty(inHed.getTemp3()) && inHed.getTemp3().equals("fault")) {
+ //continue;
}
HashMap<String, String> condition = new HashMap<>();
condition.put("BillNo", "'" + inHed.getBillNo() + "'");
@@ -54,14 +91,15 @@
hedAndDet.put("det", inDetTBS);
try {
inMS.createOutOrder(inHed, inDetTBS);
+ log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);
+ move(hedAndDet);
} catch (Exception e) {
- e.printStackTrace();
+ log.info(e.getMessage());
+// e.printStackTrace();
String sql = "UPDATE erp_OutHedTB SET Temp3 = 'fault' WHERE BillNo = '" + inHed.getBillNo() + "'";
erpSqlServer.update(sql);
+//
}
- log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);
- move(hedAndDet);
-
}
}
}
@@ -71,12 +109,12 @@
OutHedTB hed = (OutHedTB) hedAndDet.get("hed");
ArrayList<OutDetTB> dets = (ArrayList<OutDetTB>) hedAndDet.get("det");
HashMap<String, String> condition = new HashMap<>();
- condition.put("BillNo", "'" + hed.getBillNo() + "'");
+ condition.put("bill_no", "'" + hed.getBillNo() + "'");
erpSqlServer.delete(OutHedTB.class, condition);
for (OutDetTB det : dets) {
HashMap<String, String> condition2 = new HashMap<>();
- condition2.put("BillNo", "'" + det.getBillNo() + "'");
- condition2.put("iNo", String.valueOf(det.getINO()));
+ condition2.put("bill_no", "'" + det.getBillNo() + "'");
+ condition2.put("i_no", String.valueOf(det.getINO()));
erpSqlServer.delete(OutDetTB.class, condition2);
}
--
Gitblit v1.9.1