From 15ef33c98e26f95aa6fa14f9cb24c140bc876fb0 Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期三, 03 四月 2024 14:57:57 +0800
Subject: [PATCH] change 通信逻辑

---
 jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java b/jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java
index d0f1e89..5752e5b 100644
--- a/jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java
+++ b/jcdm-quartz/src/main/java/com/jcdm/quartz/task/RyTask.java
@@ -1,7 +1,13 @@
 package com.jcdm.quartz.task;
 
+import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
+import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
+import com.jcdm.main.webservice.service.ReceivingServices;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.jcdm.common.utils.StringUtils;
+
+import java.util.List;
 
 /**
  * 瀹氭椂浠诲姟璋冨害娴嬭瘯
@@ -25,4 +31,58 @@
     {
         System.out.println("鎵ц鏃犲弬鏂规硶");
     }
+
+    @Autowired
+    private IBsOrderSchedulingService bsOrderSchedulingService;
+    String url = "http://podqapp.cfmoto.com.cn:50200/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_MES&receiverParty=&receiverService=&interface=SI_ZPP_CF_BC_001_SYN_OUT&interfaceNamespace=http://cfmoto.com/xi/MES";
+    public void workReportingTasks(){
+        report10();
+        report20();
+    }
+
+    public void report10(){
+        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
+        bsOrderScheduling.setReport10("0");
+        List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
+        for (BsOrderScheduling orderScheduling : bsOrderSchedulings) {
+            String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0010"));
+            String status = ReceivingServices.xmlToJSON3(xmlResult);
+            if(status.equals("1")){
+                orderScheduling.setReport10("1");
+                int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling);
+                System.out.println("鏇存柊鐘舵�佹垚鍔�");
+            }
+        }
+    }
+
+    public void report20(){
+        BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
+        bsOrderScheduling.setReport20("0");
+        List<BsOrderScheduling> bsOrderSchedulings = bsOrderSchedulingService.selectBsOrderSchedulingList(bsOrderScheduling);
+        for (BsOrderScheduling orderScheduling : bsOrderSchedulings) {
+            String xmlResult = ReceivingServices.getInterfaceInformationXml(url, getProductionPlanInformationXml(orderScheduling.getOrderNo(), "0790"));
+            String status = ReceivingServices.xmlToJSON3(xmlResult);
+            if(status.equals("1")){
+                orderScheduling.setReport10("1");
+                int i = bsOrderSchedulingService.updateBsOrderScheduling(orderScheduling);
+                System.out.println("鏇存柊鐘舵�佹垚鍔�");
+            }
+        }
+    }
+
+    public static String getProductionPlanInformationXml(String orderNo,String location){
+        String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:rfc:functions\">\n" +
+                "   <soapenv:Header/>\n" +
+                "   <soapenv:Body>\n" +
+                "      <urn:ZPP_BC_001>\n" +
+                "         <IV_AUFNR>"+orderNo+"</IV_AUFNR>\n" +
+                "          <IV_VORNR>"+location+"</IV_VORNR>\n" +
+                "           <IV_LMNGA>1</IV_LMNGA>\n" +
+                "           <IV_XMNGA>0</IV_XMNGA>   \n" +
+                "         <IV_STATU>1</IV_STATU>  \n" +
+                "      </urn:ZPP_BC_001>\n" +
+                "   </soapenv:Body>\n" +
+                "</soapenv:Envelope>";
+        return content;
+    }
 }

--
Gitblit v1.9.3