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