#
18516761980
2021-11-05 acdc4b3427cbd2a6dc811aed202fbd3e9c309d69
src/main/java/com/zy/common/service/erp/task/ErpScheduler.java
@@ -16,6 +16,7 @@
import com.zy.common.service.erp.ErpService;
import com.zy.common.service.erp.dto.InStockDto;
import com.zy.common.service.erp.entity.*;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
@@ -23,6 +24,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -52,7 +54,8 @@
    /**
     * 原材料入库单
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    @Scheduled(cron = "0/30 * * * * ? ")
    @Synchronized
//    @PostConstruct
    public void inStockExecute(){
        List<InStockDto> readyInStock = erpService.getReadyInStock();
@@ -121,7 +124,8 @@
    /**
     * 成品入库单
     */
    @Scheduled(cron = "0/5 * * * * ? ")
    @Scheduled(cron = "0/20 * * * * ? ")
    @Synchronized
//    @PostConstruct
    public void inCPICMOExecute(){
        List<CPICMO> cpicmos = erpService.getReadyCPICMO();
@@ -178,7 +182,8 @@
        }
    }
    @Scheduled(cron = "0/5 * * * * ? ")
    @Scheduled(cron = "0/30 * * * * ? ")
    @Synchronized
    public void syncMat(){
        List<M_item> items = erpService.getItem();
        for (M_item item : items) {
@@ -213,6 +218,7 @@
     * 成品出库 发货通知单表头,表明细
     */
    @Scheduled(cron = "0/15 * * * * ? ")
    @Synchronized
    @Transactional
    public void syncOutStock(){
        List<OutStockBill> outStockBills = erpService.syncOutStock();
@@ -244,6 +250,7 @@
                    if (null == one) {
//                        String Fnumber = (Cools.isEmpty(outStockBillEntry.getFSourceBillNo())) ? outStockBillEntry.getFnumber() : outStockBillEntry.getFnumber()+"|"+outStockBillEntry.getFSourceBillNo();
//                        outStockBillEntry.setFnumber(Fnumber);  //产品代码|生产单号
                        outStockBillEntry.setFAmount(new BigDecimal(0));
                        if (!outStockService.insert(outStockBillEntry)) {
                            log.info("提取出库通知明细表OutStockBillEntry失败[FBrNo={},FInterID={},FEntryID={}]",outStockBillEntry.getFBrNo(),
                                    outStockBillEntry.getFInterID(),outStockBillEntry.getFEntryID());
@@ -256,6 +263,7 @@
                    } else {
                        // 数量有变化进行更新
                        if (Double.doubleToLongBits(one.getFAuxQty().doubleValue()) != Double.doubleToLongBits(outStockBillEntry.getFAuxQty().doubleValue())) {
                            outStockBillEntry.setFAmount(new BigDecimal(0));
                            if (!outStockService.update(outStockBillEntry, wrapper)) {
                                log.info("同步更新通知明细表OutStockBillEntry失败[FBrNo={},FInterID={},FEntryID={}]",outStockBillEntry.getFBrNo(),
                                        outStockBillEntry.getFInterID(),outStockBillEntry.getFEntryID());