Quellcode durchsuchen

ERP出入库单-修改erp中间表orderstate

LZH vor 2 Jahren
Ursprung
Commit
71e478ea4b

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/init/StartService.java

@@ -67,12 +67,12 @@ public class StartService implements CommandLineRunner {
     }
 
     // 回传ERP入库单
-    public void callBackAsn() {
+    public void callBackAsn() throws Exception {
         iSyncService.callBackAsn();
     }
 
     // 回传ERP出库单
-    public void callBackOrder() {
+    public void callBackOrder() throws Exception {
         iSyncService.callBackOrder();
     }
 

+ 2 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java

@@ -5,7 +5,7 @@ import com.ruoyi.common.utils.StringUtils;
 
 /**
  * 定时任务调度测试
- * 
+ *
  * @author ruoyi
  */
 @Component("ryTask")
@@ -25,4 +25,5 @@ public class RyTask
     {
         System.out.println("执行无参方法");
     }
+
 }

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/erp/service/ISyncService.java

@@ -19,7 +19,7 @@ public interface ISyncService {
 
     boolean updateErpOrderStatus(ErpOrderList erpOrderList) throws Exception;
 
-    void callBackAsn();
+    void callBackAsn() throws Exception;
 
-    void callBackOrder();
+    void callBackOrder() throws Exception;
 }

+ 58 - 6
warewms-ams/src/main/java/com/ruoyi/ams/erp/service/impl/SyncServiceImpl.java

@@ -2,10 +2,16 @@ package com.ruoyi.ams.erp.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
+import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
+import com.ruoyi.ams.asn.service.IWmsDocAsnDetailsService;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
 import com.ruoyi.ams.erp.domain.ErpBarCodeList;
 import com.ruoyi.ams.erp.domain.ErpOrderList;
 import com.ruoyi.ams.erp.service.ISyncService;
+import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
+import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
+import com.ruoyi.ams.order.service.IWmsDocOrderDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseSku;
@@ -47,6 +53,10 @@ public class SyncServiceImpl implements ISyncService {
     private IWmsDocAsnHeaderService wmsDocAsnHeaderService;
     @Autowired
     private IWmsDocOrderHeaderService wmsDocOrderHeaderService;
+    @Autowired
+    IWmsDocAsnDetailsService wmsDocAsnDetailsService;
+    @Autowired
+    IWmsDocOrderDetailsService wmsDocOrderDetailsService;
 
     @Override
     public void syncSkuType() {
@@ -162,16 +172,58 @@ public class SyncServiceImpl implements ISyncService {
     }
 
     @Override
-    public void callBackAsn() {
+    public void callBackAsn() throws Exception {
         // 查出入库单(单头状态为99,edi_send_flag为空或者为0)
-        // 查出所有明细
-        // 循环明细调updateErpOrderStatus方法 setOrderState setOrderName setOrderNo
-        // 成功之后修改edi_send_flag为1
+        WmsDocAsnHeader wmsDocAsnHeader = new WmsDocAsnHeader();
+        wmsDocAsnHeader.setAsnStatus(Constant.ASN_STS.STS99.getValue());
+        wmsDocAsnHeader.setEdiSendFlag("N");
+        List<WmsDocAsnHeader> wmsDocAsnHeaders = wmsDocAsnHeaderService.selectWmsDocAsnHeaderList(wmsDocAsnHeader);
+        for (WmsDocAsnHeader wmsDocAsnHeader1 : wmsDocAsnHeaders) {
+            String asnNo = wmsDocAsnHeader1.getAsnNo();
+            WmsDocAsnDetails wmsDocAsnDetails = new WmsDocAsnDetails();
+            wmsDocAsnDetails.setAsnNo(asnNo);
+            // 查出所有明细
+            List<WmsDocAsnDetails> wmsDocAsnDetails1 = wmsDocAsnDetailsService.selectWmsDocAsnDetailsList(wmsDocAsnDetails);
+            // 循环明细调updateErpOrderStatus方法 setOrderState setOrderName setOrderNo
+            for (WmsDocAsnDetails wmsDocAsnDetails2:wmsDocAsnDetails1) {
+                ErpOrderList erpOrderList = new ErpOrderList();
+                erpOrderList.setOrderNo(wmsDocAsnDetails2.getAsnLineNo().intValue());
+                erpOrderList.setOrderName(wmsDocAsnDetails2.getAsnNo());
+                erpOrderList.setOrderState("2");
+                boolean b = updateErpOrderStatus(erpOrderList);
+                // 成功之后修改edi_send_flag为Y
+                if (b = true){
+                    wmsDocAsnHeader1.setEdiSendFlag("Y");
+                    wmsDocAsnHeaderService.updateWmsDocAsnHeader(wmsDocAsnHeader1);
+                }
+            }
+        }
 
     }
 
     @Override
-    public void callBackOrder() {
-        // 同入库
+    public void callBackOrder() throws Exception {
+        WmsDocOrderHeader wmsDocOrderHeader = new WmsDocOrderHeader();
+        wmsDocOrderHeader.setOrderStatus(Constant.ASN_STS.STS99.getValue());
+        wmsDocOrderHeader.setEdiSendFlag("N");
+        List<WmsDocOrderHeader> wmsDocOrderHeaders = wmsDocOrderHeaderService.selectWmsDocOrderHeaderList(wmsDocOrderHeader);
+        for (WmsDocOrderHeader wmsDocOrderHeader1 : wmsDocOrderHeaders) {
+            String orderNo = wmsDocOrderHeader1.getOrderNo();
+            WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
+            wmsDocOrderDetails.setOrderNo(orderNo);
+            List<WmsDocOrderDetails> list = wmsDocOrderDetailsService.selectWmsDocOrderDetailsList(wmsDocOrderDetails);
+            for (WmsDocOrderDetails wmsDocOrderDetails1:list) {
+                ErpOrderList erpOrderList = new ErpOrderList();
+                erpOrderList.setOrderNo(wmsDocOrderDetails1.getOrderLineNo().intValue());
+                erpOrderList.setOrderName(wmsDocOrderDetails1.getOrderNo());
+                erpOrderList.setOrderState("2");
+                boolean b = updateErpOrderStatus(erpOrderList);
+                // 成功之后修改edi_send_flag为Y
+                if (b = true){
+                    wmsDocOrderHeader1.setEdiSendFlag("Y");
+                    wmsDocOrderHeaderService.updateWmsDocOrderHeader(wmsDocOrderHeader1);
+            }
+        }
     }
 }
+}