From 0aecb1b1d0164f092e258422162d3e29d9c65938 Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期一, 16 三月 2026 16:22:25 +0800
Subject: [PATCH] 定时任务同步单据去除异步

---
 src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 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 84fdaa0..c4ae3a1 100644
--- a/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
+++ b/src/main/java/com/zy/third/erp/task/ERPOutHedTBScheduler.java
@@ -7,7 +7,6 @@
 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;
@@ -37,7 +36,7 @@
 
     //@Transactional(rollbackFor = Throwable.class)
     @Scheduled(cron = "${erp.refreshtime}")
-    @Async("orderThreadPool")
+//    @Async("orderThreadPool")
     public void OutHedTBScheduler() {
         //log.info("OutHedTBScheduler寮�濮嬩簡");
         if (!erpEnabled) return;
@@ -54,6 +53,41 @@
                 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);
+//
+                }
+            }
+        }
+    }
+
+    @Transactional(rollbackFor = Throwable.class)
+    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() + "'");
+                List<OutDetTB> inDetTBS = erpSqlServer.selectList(OutDetTB.class, condition);
+                HashMap<String, Object> hedAndDet = new HashMap<>();
+                hedAndDet.put("hed", inHed);
+                hedAndDet.put("det", inDetTBS);
                 try {
                     inMS.createOutOrder(inHed, inDetTBS);
                     log.info("鍑哄簱鍗曟嵁鎴愬姛,{}", inHed);

--
Gitblit v1.9.1