From 9062bd82b905d0b34239a33b1d02e7f5cd4e3f32 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期四, 23 九月 2021 09:02:40 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/service/erp/task/ErpScheduler.java | 75 ++++++++++++++++++++++++++++++++-----
1 files changed, 65 insertions(+), 10 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 ebd0150..5826690 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,13 +39,17 @@
private MatCodeService matCodeService;
@Autowired
private WaitPakinService waitPakinService;
+ @Autowired
+ private OutStockMainService outStockMainService;
+ @Autowired
+ private OutStockService outStockService;
private Map<Integer, M_item> itemMap = new HashMap<>();
/**
* 鍘熸潗鏂�
*/
-// @Scheduled(cron = "0/3 * * * * ? ")
+ @Scheduled(cron = "0/5 * * * * ? ")
// @PostConstruct
public void inStockExecute(){
// List<M_item> item = erpService.getItem();
@@ -74,7 +78,7 @@
waitPakin.setAppeTime(new Date());
waitPakin.setModiTime(new Date());
VersionUtils.setWaitPakIn(waitPakin, matCode);
- waitPakin.setMnemonic(entry.getFSourceBillNo()); // todo:luxiaotao 鍗曟嵁缂栧彿
+ waitPakin.setMnemonic(entry.getFOrderBillNo()); // todo:luxiaotao 鐢熶骇鍗曞彿
waitPakin.setSupplier(dto.getInStockBill().getFBillNo()); // todo:luxiaotao 閫氱煡鍗曞彿
Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
.eq("supplier", waitPakin.getSupplier())
@@ -109,7 +113,7 @@
/**
* 鎴愬搧
*/
-// @Scheduled(cron = "0/3 * * * * ? ")
+ @Scheduled(cron = "0/5 * * * * ? ")
// @PostConstruct
public void inCPICMOExecute(){
// List<M_item> item = erpService.getItem();
@@ -136,7 +140,7 @@
waitPakin.setAppeTime(new Date());
waitPakin.setModiTime(new Date());
VersionUtils.setWaitPakIn(waitPakin, matCode);
- waitPakin.setMnemonic(cpicmo.getFSourceBillNo()); // todo:luxiaotao 鍗曟嵁缂栧彿
+ waitPakin.setMnemonic(cpicmo.getFSourceBillNo()); // todo:luxiaotao 鐢熶骇鍗曞彿
waitPakin.setSupplier(cpicmo.getFBillNo()); // todo:luxiaotao 閫氱煡鍗曞彿
Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
.eq("supplier", waitPakin.getSupplier())
@@ -156,7 +160,7 @@
}
}
-// @Scheduled(cron = "0/3 * * * * ? ")
+ @Scheduled(cron = "0/5 * * * * ? ")
public void syncMat(){
List<M_item> items = erpService.getItem();
for (M_item item : items) {
@@ -166,11 +170,21 @@
VersionUtils.setMatCode(matCode, item);
matCode.setAppeTime(new Date());
matCode.setModiTime(new Date());
- matCodeService.insert(matCode);
+ boolean insert = matCodeService.insert(matCode);
+ if (insert) {
+ log.info("=====>> 鏂板鐗╂枡鎴愬姛 锛� {}", JSON.toJSONString(item));
+ } else {
+ log.error("=====>> 鏂板鐗╂枡澶辫触锛侊紒锛� 锛� {}", JSON.toJSONString(item));
+ }
} else {
VersionUtils.setMatCode(matCode, item);
matCode.setModiTime(new Date());
- matCodeService.updateById(matCode);
+ boolean b = matCodeService.updateById(matCode);
+ if (b) {
+ log.info("=====>> 鏇存柊鐗╂枡鎴愬姛 锛� {}", JSON.toJSONString(item));
+ } else {
+ log.error("=====>> 鏇存柊鐗╂枡澶辫触锛侊紒锛� 锛� {}", JSON.toJSONString(item));
+ }
}
// 鏇存柊瀹屼箣鍚庡垹闄�
erpService.deleteItem(item.getMnumber());
@@ -178,6 +192,47 @@
}
/**
+ * 鎴愬搧鍑哄簱-鍙戣揣閫氱煡鍗曡〃澶�
+ */
+ @Scheduled(cron = "0/15 * * * * ? ")
+ public void syncOutStock(){
+ 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鍚屾澶辫触");
+ };
+ } else {
+
+ }
+ }
+ }
+
+ /**
+ * 鎴愬搧鍑哄簱-鍙戣揣閫氱煡鍗曡〃浣�
+ */
+ @Scheduled(cron = "0/15 * * * * ? ")
+ public void syncOutStockDetail(){
+ 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鍚屾澶辫触");
+ };
+ } else {
+ // 鏁伴噺鏈夊彉鍖栬繘琛屾洿鏂�
+ if (Double.doubleToLongBits(main.getFAuxQty().doubleValue()) != Double.doubleToLongBits(result.get(i).getFAuxQty().doubleValue())) {
+ if (!outStockService.update(result.get(i), new EntityWrapper<OutStockBillEntry>().eq("FInterID", result.get(i).getFInterID()).and().eq("FEntryID", result.get(i).getFEntryID()))) {
+ log.info("鍑哄簱閫氱煡鏄庣粏琛∣utStockBillEntry鍚屾澶辫触");
+ };
+ }
+ }
+ }
+ }
+
+ /**
* 鍘熸潗鏂欏嚭搴�
*/
// @Scheduled(cron = "0/3 * * * * ? ")
--
Gitblit v1.9.1