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