From a27f1b573fc5cf9a3b78e2eacb56e44310f83456 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 27 八月 2025 12:17:01 +0800
Subject: [PATCH] art: 添加入库逻辑,SAP订单同步参数动态配置

---
 src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java
index d81111b..1d0c9fa 100644
--- a/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java
+++ b/src/main/java/org/jeecg/modules/mes/job/ProductionOrderSyncCreationJob.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.mes.job;
 
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.lsw.service.ILswMaterialService;
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdc.util.ThrowableUtil;
 import org.jeecg.modules.mes.entity.MesProductionOrder;
@@ -22,6 +23,7 @@
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.time.LocalDateTime;
@@ -33,7 +35,8 @@
 @Slf4j
 public class ProductionOrderSyncCreationJob implements Job {
     //宸ュ巶缂栫爜(鏂扮伀鐐� 2301)
-    private static final String FACTORY_CODE = "2301";
+    @Value("${xhj.factoryCode:2301}")
+    private String FACTORY_CODE;
     /**
      * 璁㈠崟绫诲瀷
      * 鏍囧噯鐢熶骇璁㈠崟 Z001
@@ -42,7 +45,8 @@
      * 璇曞埗鐢熶骇璁㈠崟(鏂扮伀鐐�)  Z011
      * 鎷嗛浂鐢熶骇璁㈠崟(鏂扮伀鐐�)  2012
      */
-    private static final String ORDER_TYPE_CODE = "Z001";
+    @Value("${xhj.orderType:Z001}")
+    private String ORDER_TYPE_CODE;
     /**
      * 鐢熶骇璋冨害鍛�
      * 001 涓�鍒嗗巶璋冨害鍛�
@@ -57,14 +61,16 @@
      * 010 鍏巶璋冨害鍛�
      * 012 鍏垎鍘傝皟搴﹀憳
      */
-    private static final String PRODUCTION_MANAGER = "010";
+    @Value("${xhj.productionManager:012}")
+    private String PRODUCTION_MANAGER;
     /**
      * 鐢熶骇璁㈠崟鐘舵�侊紝瀹為檯涓婏紝鍙湁REL鐘舵�佺殑宸ュ崟鎵嶅彲浠ヨ繘琛屾搷浣�
      * CRTD 鏂板缓
      * REL 涓嬭揪
      * TECO 鍏抽棴
      */
-    private static final String ORDER_STATUS = "REL";
+    @Value("${xhj.orderStatus:REL}")
+    private String ORDER_STATUS;
 
     /**
      * 璇锋眰鎴愬姛缂栫爜
@@ -87,6 +93,8 @@
     private ISysQuartzLogService sysQuartzLogService;
     @Autowired
     private IQuartzJobService quartzJobService;
+    @Autowired
+    private ILswMaterialService lswMaterialService;
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@@ -144,12 +152,19 @@
                 log.error("杩斿洖绫诲瀷閿欒锛� class:{}", result == null ? null : result.getClass());
                 return;
             }
+            //璁㈠崟BOM鏁版嵁澶勭悊
             List<OrderBomDTO> orderBomDTOList = (List<OrderBomDTO>) result;
             b = processBillMaterialsService.saveOrUpdateOrderBom(orderMap, orderBomDTOList);
             if (!b) {
                 log.error("淇濆瓨璁㈠崟BOM澶辫触锛屾棩鏈燂細{}", LocalDateTime.now());
                 return;
             }
+            //鐗╂枡鏁版嵁澶勭悊
+            b = lswMaterialService.saveOrUpdateMaterial(orderMap, orderBomDTOList);
+            if (!b) {
+                log.error("淇濆瓨鐗╂枡澶辫触锛屾棩鏈燂細{}", LocalDateTime.now());
+                return;
+            }
             //璁㈠崟宸ュ簭鍚屾
             Map<String, Object> orderProcessMap = orderProcessSync.syncOrderProcess(FACTORY_CODE, orderCodes);
             if (orderBomMap == null || !SUCCESS_CODE.equals(orderProcessMap.get("ztype"))) {

--
Gitblit v1.9.3