新火炬后端单体项目初始化代码
src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java
@@ -14,6 +14,7 @@
import org.jeecg.modules.sap.dto.OrderBomDTO;
import org.jeecg.modules.sap.dto.OrderProcessDTO;
import org.jeecg.modules.sap.dto.ProductionOrderDTO;
import org.jeecg.modules.sap.request.ProductionOrderSyncRequest;
import org.jeecg.modules.sap.service.OrderBomSync;
import org.jeecg.modules.sap.service.OrderProcessSync;
import org.jeecg.modules.sap.service.ProductionOrderSync;
@@ -100,15 +101,22 @@
        //获取上次同步时间
        String lastSyncDateLow = productionOrderService.getLastSyncCreateDate();
        String lastSyncDateHigh = null;
        if(lastSyncDateLow != null) {
        if (lastSyncDateLow != null) {
            lastSyncDateHigh = DateUtils.format(new Date(), "yyyyMMdd");
            if(lastSyncDateLow.equals(lastSyncDateHigh)) {
            if (lastSyncDateLow.equals(lastSyncDateHigh)) {
                lastSyncDateHigh = null;
            }
        }
        ProductionOrderSyncRequest request = new ProductionOrderSyncRequest();
        request.setFactoryCode(FACTORY_CODE);
        request.setOrderTypeCode(ORDER_TYPE_CODE);
        request.setProductionManager(PRODUCTION_MANAGER);
        request.setOrderStatus(ORDER_STATUS);
        request.setCreateTimeLow(lastSyncDateLow);
        request.setCreateTimeHigh(lastSyncDateHigh);
        try {
            //调用SAP接口获取生产订单
            Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(FACTORY_CODE, ORDER_TYPE_CODE, PRODUCTION_MANAGER, ORDER_STATUS, lastSyncDateLow, lastSyncDateHigh, null, null);
            Map<String, Object> productionOrderMap = productionOrderSync.syncProductionOrder(request);
            if (productionOrderMap == null || !SUCCESS_CODE.equals(productionOrderMap.get("ztype"))) {
                log.error("未同步到订单信息!日期:{}", LocalDateTime.now());
                return;
@@ -116,7 +124,7 @@
            //调用成功,获取返回数据
            Object result = productionOrderMap.get("result");
            boolean b = result instanceof List;
            if(!b) {
            if (!b) {
                log.error("返回类型错误, class:{}", result == null ? null : result.getClass());
                return;
            }
@@ -132,13 +140,13 @@
            //调用成功,获取返回数据
            result = orderBomMap.get("result");
            b = result instanceof List;
            if(!b) {
            if (!b) {
                log.error("返回类型错误, class:{}", result == null ? null : result.getClass());
                return;
            }
            List<OrderBomDTO> orderBomDTOList = (List<OrderBomDTO>) result;
            b = processBillMaterialsService.saveOrUpdateOrderBom(orderMap, orderBomDTOList);
            if(!b) {
            if (!b) {
                log.error("保存订单BOM失败,日期:{}", LocalDateTime.now());
                return;
            }
@@ -151,13 +159,13 @@
            //调用成功,获取返回数据
            result = orderProcessMap.get("result");
            b = result instanceof List;
            if(!b) {
            if (!b) {
                log.error("返回类型错误, class:{}", result == null ? null : result.getClass());
                return;
            }
            List<OrderProcessDTO> orderProcessDTOList = (List<OrderProcessDTO>) result;
            b = materialProcessService.saveOrUpdateOrderProcess(orderMap, orderProcessDTOList);
            if(!b) {
            if (!b) {
                log.error("保存订单工序失败,日期:{}", LocalDateTime.now());
            }
            quartzLog.setIsSuccess(0);