From b47369fbc73269f0661ba169c6387e04fb037e87 Mon Sep 17 00:00:00 2001
From: cl <1442464845@qq.com>
Date: 星期一, 16 三月 2026 14:26:23 +0800
Subject: [PATCH] 发货通知单打印日志

---
 src/main/java/com/zy/common/service/erp/task/ErpScheduler.java |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java b/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java
index a1c7963..5975b76 100644
--- a/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java
+++ b/src/main/java/com/zy/common/service/erp/task/ErpScheduler.java
@@ -231,13 +231,17 @@
     @Transactional
     public void syncOutStock(){
         List<OutStockBill> outStockBills = erpService.syncOutStock();
+        log.info("鍑哄簱鍚屾寮�濮嬶紝ERP鏈鍗曟暟={}", outStockBills != null ? outStockBills.size() : 0);
+        if (outStockBills == null || outStockBills.isEmpty()) {
+            return;
+        }
         for (Integer i = 0; i < outStockBills.size(); i++) {
             OutStockBill outStockBill = outStockBills.get(i);
 
             //鍚屼竴鍗曞彿瀛樺湪鐩稿悓鐗╂枡缂栫爜鏁版嵁锛岃鍗曞彿涓嶄簣澶勭悊
             Number fnumberCount = erpService.QueryFnumberOutCount(outStockBill.getFInterID());
             if(fnumberCount.intValue() > 1){
-                log.info("鍑哄簱閫氱煡鍗曞瓨鍦ㄧ墿鏂欑浉鍚屾暟鎹甗FBillNo={},FInterID={},]", outStockBill.getFBillNo(), outStockBill.getFInterID());
+                log.info("鍑哄簱鍚屾璺宠繃锛氬悓涓�鍗曞彿瀛樺湪鐩稿悓鐗╂枡[FBillNo={},FInterID={}]锛屼笉浜堝悓姝�", outStockBill.getFBillNo(), outStockBill.getFInterID());
                 if (!erpService.haveReadOutBill(outStockBill.getFBillNo(),outStockBill.getFInterID(),-1)) {
                     log.error("鏇存柊鍑哄簱閫氱煡鍗曡鍙栫姸鎬佷负-1澶辫触[FBrNo={},FInterID={}]", outStockBill.getFBrNo(),outStockBill.getFInterID());
                 }
@@ -246,12 +250,17 @@
 
             OutStockBill main = outStockMainService.selectOne(new EntityWrapper<OutStockBill>().eq("FBillNo",outStockBill.getFBillNo()).and().eq("FInterID", outStockBill.getFInterID()));
             if (null == main) {
+                log.info("鍑哄簱鍚屾鏂板崟锛欶BillNo={}, FInterID={}锛屼粠ERP鍚屾鍒癢MS", outStockBill.getFBillNo(), outStockBill.getFInterID());
                 outStockBill.setFflag_rw(1);
                 if (!outStockMainService.insert(outStockBill)) {
-                    log.info("鍚屾鍑哄簱閫氱煡涓昏〃OutStockBill澶辫触");
+                    log.error("鍑哄簱鍚屾澶辫触锛氬悓姝ュ嚭搴撻�氱煡涓昏〃OutStockBill澶辫触[FBillNo={},FInterID={}]", outStockBill.getFBillNo(), outStockBill.getFInterID());
                     exceptionHandle("鍚屾鍑哄簱閫氱煡涓昏〃OutStockBill澶辫触[FBillNo={0},FInterID={1}]",outStockBill.getFBillNo(),outStockBill.getFInterID());
                 };
                 List<OutStockBillEntry> outStockBillEntries = erpService.syncOutStockDetail(outStockBill.getFInterID());
+                if (outStockBillEntries == null || outStockBillEntries.isEmpty()) {
+                    log.warn("鍑哄簱鍚屾锛欵RP璇ュ崟鏄庣粏鏁颁负0锛孎BillNo={}, FInterID={}锛堝彲鑳紼RP鏉′欢FAuxCommitQty=0鏃犳暟鎹級", outStockBill.getFBillNo(), outStockBill.getFInterID());
+                }
+                if (outStockBillEntries != null) {
                 for (Integer j = 0; j < outStockBillEntries.size(); j++) {
                     OutStockBillEntry outStockBillEntry = outStockBillEntries.get(j);
                     Wrapper<OutStockBillEntry> wrapper = new EntityWrapper<OutStockBillEntry>().eq("FInterID", outStockBillEntry.getFInterID()).
@@ -286,8 +295,9 @@
                         }
                     }
                 }
+                }
             } else {
-
+                log.debug("鍑哄簱鍚屾锛歐MS宸插瓨鍦ㄨ鍗曪紝璺宠繃鍚屾鏄庣粏 FBillNo={}, FInterID={}", outStockBill.getFBillNo(), outStockBill.getFInterID());
             }
 
             if (!erpService.haveReadOutBill(outStockBill.getFBillNo(),outStockBill.getFInterID(),1)) {

--
Gitblit v1.9.1