From 9bd709ba929ca4885e2c118039d70f5268cc1e31 Mon Sep 17 00:00:00 2001 From: 王佳豪 <g675230687@126.com> Date: 星期三, 28 四月 2021 08:58:04 +0800 Subject: [PATCH] 发货通知逻辑调整 --- src/main/java/com/zy/common/service/erp/task/ErpScheduler.java | 40 +++++++++++++++++++++++++--------------- 1 files changed, 25 insertions(+), 15 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 c69f735..c103a4e 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 @@ -7,13 +7,13 @@ import com.zy.asrs.entity.MatCode; import com.zy.asrs.entity.WaitPakin; import com.zy.asrs.service.MatCodeService; +import com.zy.asrs.service.OutStockMainService; +import com.zy.asrs.service.OutStockService; import com.zy.asrs.service.WaitPakinService; import com.zy.asrs.utils.VersionUtils; import com.zy.common.service.erp.ErpService; import com.zy.common.service.erp.dto.InStockDto; -import com.zy.common.service.erp.entity.CPICMO; -import com.zy.common.service.erp.entity.InStockBillEntry; -import com.zy.common.service.erp.entity.M_item; +import com.zy.common.service.erp.entity.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -39,6 +39,10 @@ private MatCodeService matCodeService; @Autowired private WaitPakinService waitPakinService; + @Autowired + private OutStockMainService outStockMainService; + @Autowired + private OutStockService outStockService; private Map<Integer, M_item> itemMap = new HashMap<>(); @@ -190,26 +194,32 @@ /** * 鎴愬搧鍑哄簱-鍙戣揣閫氱煡鍗曡〃澶� */ - @Scheduled(cron = "0/30 * * * * ? ") + @Scheduled(cron = "0/15 * * * * ? ") public void syncOutStock(){ - boolean result = erpService.syncOutStock(); - if (result) { -// System.out.format("%s\33[%d;%dm%s%n", "", 32, 3, "==========OutStockBill琛ㄥ悓姝ユ垚鍔�=========="); - } else { - System.out.format("%s\33[%d;%dm%s%n", "", 31, 3, "==========OutStockBill琛ㄥ悓姝ュけ璐�=========="); + List<OutStockBill> result = erpService.syncOutStock(); + for (Integer i = 0; i < result.size(); i++) { + OutStockBill main = outStockMainService.selectOne(new EntityWrapper<OutStockBill>().eq("FBrNo", result.get(i).getFBrNo()).and().eq("FInterID", result.get(i).getFInterID())); + if (null == main) { + if (!outStockMainService.insert(result.get(i))) { + log.info("鍑哄簱閫氱煡涓昏〃OutStockBill鍚屾澶辫触"); + }; + } } } /** * 鎴愬搧鍑哄簱-鍙戣揣閫氱煡鍗曡〃浣� */ - @Scheduled(cron = "0/30 * * * * ? ") + @Scheduled(cron = "0/15 * * * * ? ") public void syncOutStockDetail(){ - boolean result = erpService.syncOutStockDetail(); - if (result) { -// System.out.format("%s\33[%d;%dm%s%n", "", 32, 3, "==========OutStockBillEntry琛ㄥ悓姝ユ垚鍔�=========="); - } else { - System.out.format("%s\33[%d;%dm%s%n", "", 31, 3, "==========OutStockBillEntry琛ㄥ悓姝ュけ璐�=========="); + List<OutStockBillEntry> result = erpService.syncOutStockDetail(); + for (Integer i = 0; i < result.size(); i++) { + OutStockBillEntry main = outStockService.selectOne(new EntityWrapper<OutStockBillEntry>().eq("FInterID", result.get(i).getFInterID()).and().eq("FEntryID", result.get(i).getFEntryID())); + if (null == main) { + if (!outStockService.insert(result.get(i))) { + log.info("鍑哄簱閫氱煡鏄庣粏琛∣utStockBillEntry鍚屾澶辫触"); + }; + } } } -- Gitblit v1.9.1