-
懒羊羊
2024-03-27 054a699a156ca607e95f220b364136d42a19ab0f
提交 | 用户 | 时间
c1aa9d 1 package com.jcdm.main.restful.service;
2
3 import cn.hutool.http.HttpRequest;
4 import cn.hutool.http.HttpResponse;
5 import org.springframework.web.bind.annotation.RequestMapping;
6 import org.springframework.web.bind.annotation.RequestParam;
7
523903 8 public class RestfulService {
c1aa9d 9     public static final String getRealmName = "https://imes-test-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration";
10
11     public static final String postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface";
12
13     public static final String siteCode = "9786";
14
15     /**
16      * 生产工单请求接口
17      * @param productNum
18      * @param stationCode
19      * @return
20      */
21     //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","materialCode":"LCV001_3","productionOrderNum":"500000258"},"message":"API调用成功"}
22     public static String getProductionWorkOrderRequest(String productNum,String stationCode)
23     {
24         String url = getRealmName + "/productionWorkOrderRequest?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum;
25         HttpResponse response = HttpRequest.get(url).execute();
26         HttpRequest httpRequest = HttpRequest.get(url);
27         return response.body();
28     }
29
30     /**
31      * AMES报工结果回传
32      * @param productNum
33      * @param stationCode
34      * @param confirmTime
35      * @return
36      */
37     //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"}
38     public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime)
39     {
40         String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime;
41         HttpResponse response = HttpRequest.get(url).execute();
42         HttpRequest httpRequest = HttpRequest.get(url);
43         return response.body();
44     }
45
46     /**
47      * 生产工单组件请求接口
48      * @param productionOrderNum
49      * @return
50      *
51      */
52     //{"code":"success","data":[{"productionOrderNum":"500000258","componentCode":"LCV_TZ_002","quantity":"1.0","stationCode":"C01"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_001","quantity":"1.0","stationCode":"C01"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_002","quantity":"1.0","stationCode":"C01"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_003","quantity":"1.0","stationCode":"C01"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_004","quantity":"1.0","stationCode":"C01"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_005","quantity":"1.0","stationCode":"C02"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_006","quantity":"1.0","stationCode":"C03"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_007","quantity":"1.0","stationCode":"C04"},{"productionOrderNum":"500000258","componentCode":"LCV_CG_009","quantity":"2.0","stationCode":"C05"}],"message":"API调用成功"}
53     public static String getProductionOrderComponentRequest(String productionOrderNum)
54     {
55         String url = getRealmName + "/productionOrderComponentRequest?siteCode="+siteCode+"&productionOrderNum="+productionOrderNum;
56         HttpResponse response = HttpRequest.get(url).execute();
57         HttpRequest httpRequest = HttpRequest.get(url);
58         return response.body();
59     }
60
61     /**
62      * 产品队列请求
63      * @param productNum
64      * @param stationCode
65      * @return
66      */
67     //{"code":"success","data":[{"configValues":{"FXPTX":"","ZJTX":"","JSYZYZC":"","CDGDTX":"","CHLXTX":""},"productTrackInfo":{"ProductNum":"LCVLCVTS3P0600388","StationCode":"1A03"}}],"message":"API调用成功"}
68     public static String postPRODUCTION_QUEUE(String productNum,String stationCode)
69     {
70         String url = postRealmName + "/PRODUCTION_QUEUE";
71         HttpResponse response = HttpRequest.post(url)
72                 // 表单参数,可以通过多次调用 form 方法添加多个参数
73                 .form("siteCode", siteCode)
74                 .form("interfaceCode", "PRODUCTION_QUEUE")
75                 .form("parameter", "{\"productNum\":\""+productNum+"\",\"stationCode\":\""+stationCode+"\",\"requestQty\":1}")
76                 // 执行请求
77                 .execute();
78         return response.body();
79     }
80 }