-
admin
2024-04-27 7a08677172276853ea984a26b76bae0e88ab00ed
提交 | 用户 | 时间
ddb300 1 package com.jcdm.main.restful.factoryMes.service;
c1aa9d 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 {
70cc26 9     public static void main(String[] args) {
A 10         String str = "uuuuuu11uuuuuuuuuuuuuuu";
11         System.out.println(str.length());
12     }
13
7a0867 14     public static final String getRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/aMesSysIntegration";
c1aa9d 15
16     public static final String postRealmName = "https://imes-uat-group.geelycv-test.com/api/mom-open/restful/interface";
17
7a0867 18     public static final String siteCode = "3983";
c1aa9d 19
20     /**
21      * 生产工单请求接口
22      * @param productNum
23      * @param stationCode
24      * @return
25      */
26     //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","materialCode":"LCV001_3","productionOrderNum":"500000258"},"message":"API调用成功"}
27     public static String getProductionWorkOrderRequest(String productNum,String stationCode)
28     {
29         String url = getRealmName + "/productionWorkOrderRequest?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum;
30         HttpResponse response = HttpRequest.get(url).execute();
31         HttpRequest httpRequest = HttpRequest.get(url);
32         return response.body();
33     }
34
35     /**
36      * AMES报工结果回传
37      * @param productNum
38      * @param stationCode
39      * @param confirmTime
40      * @return
41      */
42     //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"}
43     public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime)
44     {
45         String url = getRealmName + "/workReportResultFeedback?siteCode="+siteCode+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime;
46         HttpResponse response = HttpRequest.get(url).execute();
47         HttpRequest httpRequest = HttpRequest.get(url);
48         return response.body();
49     }
50
51     /**
52      * 生产工单组件请求接口
53      * @param productionOrderNum
54      * @return
55      *
56      */
57     //{"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调用成功"}
58     public static String getProductionOrderComponentRequest(String productionOrderNum)
59     {
60         String url = getRealmName + "/productionOrderComponentRequest?siteCode="+siteCode+"&productionOrderNum="+productionOrderNum;
61         HttpResponse response = HttpRequest.get(url).execute();
62         HttpRequest httpRequest = HttpRequest.get(url);
63         return response.body();
64     }
65
66     /**
67      * 产品队列请求
68      * @param productNum
69      * @param stationCode
70      * @return
71      */
72     //{"code":"success","data":[{"configValues":{"FXPTX":"","ZJTX":"","JSYZYZC":"","CDGDTX":"","CHLXTX":""},"productTrackInfo":{"ProductNum":"LCVLCVTS3P0600388","StationCode":"1A03"}}],"message":"API调用成功"}
73     public static String postPRODUCTION_QUEUE(String productNum,String stationCode)
74     {
75         String url = postRealmName + "/PRODUCTION_QUEUE";
76         HttpResponse response = HttpRequest.post(url)
77                 // 表单参数,可以通过多次调用 form 方法添加多个参数
78                 .form("siteCode", siteCode)
79                 .form("interfaceCode", "PRODUCTION_QUEUE")
80                 .form("parameter", "{\"productNum\":\""+productNum+"\",\"stationCode\":\""+stationCode+"\",\"requestQty\":1}")
81                 // 执行请求
82                 .execute();
83         return response.body();
84     }
70cc26 85     //HttpResponse response = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute();
c1aa9d 86 }