提交 | 用户 | 时间
|
0ca254
|
1 |
package com.jcdm.main.restful.factoryMes.service; |
A |
2 |
|
|
3 |
import cn.hutool.http.HttpRequest; |
|
4 |
import cn.hutool.http.HttpResponse; |
|
5 |
import cn.hutool.json.JSONObject; |
20635f
|
6 |
import com.jcdm.main.constant.Constants; |
0ca254
|
7 |
import org.springframework.web.bind.annotation.RequestMapping; |
A |
8 |
import org.springframework.web.bind.annotation.RequestParam; |
|
9 |
|
|
10 |
public class RestfulService { |
|
11 |
/** |
|
12 |
* 生产工单请求接口 |
|
13 |
* @param productNum |
|
14 |
* @param stationCode |
|
15 |
* @return |
|
16 |
*/ |
|
17 |
//{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","materialCode":"LCV001_3","productionOrderNum":"500000258"},"message":"API调用成功"} |
35c489
|
18 |
public static String getProductionWorkOrderRequest(String productNum,String stationCode,String materialCode) |
0ca254
|
19 |
{ |
971788
|
20 |
String url = Constants.FACTORY_EMS_UAT_GET_RUL + "productionWorkOrderRequest?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&materialCode="+materialCode; |
0ca254
|
21 |
HttpResponse response = HttpRequest.get(url).execute(); |
A |
22 |
HttpRequest httpRequest = HttpRequest.get(url); |
|
23 |
return response.body(); |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* AMES报工结果回传 |
|
28 |
* @param productNum |
|
29 |
* @param stationCode |
|
30 |
* @param confirmTime |
|
31 |
* @return |
|
32 |
*/ |
|
33 |
//{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"报工成功"},"message":"API调用成功"} |
|
34 |
public static String getWorkReportResultFeedback(String productNum,String stationCode,String confirmTime) |
|
35 |
{ |
|
36 |
String result = ""; |
|
37 |
try { |
971788
|
38 |
String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; |
0ca254
|
39 |
HttpResponse response = HttpRequest.get(url).execute(); |
A |
40 |
HttpRequest httpRequest = HttpRequest.get(url); |
|
41 |
result = response.body(); |
|
42 |
}catch (Exception e){ |
|
43 |
e.printStackTrace(); |
|
44 |
}finally { |
|
45 |
return result; |
|
46 |
} |
|
47 |
|
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* 生产工单组件请求接口 |
|
52 |
* @param productionOrderNum |
|
53 |
* @return |
|
54 |
* |
|
55 |
*/ |
|
56 |
//{"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调用成功"} |
|
57 |
public static String getProductionOrderComponentRequest(String productionOrderNum) |
|
58 |
{ |
971788
|
59 |
String url = Constants.FACTORY_EMS_UAT_GET_RUL + "productionOrderComponentRequest?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&productionOrderNum="+productionOrderNum; |
0ca254
|
60 |
HttpResponse response = HttpRequest.get(url).execute(); |
A |
61 |
HttpRequest httpRequest = HttpRequest.get(url); |
|
62 |
return response.body(); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 产品队列请求 |
|
67 |
* @param productNum |
|
68 |
* @param stationCode |
|
69 |
* @return |
|
70 |
*/ |
|
71 |
//{"code":"success","data":[{"configValues":{"FXPTX":"","ZJTX":"","JSYZYZC":"","CDGDTX":"","CHLXTX":""},"productTrackInfo":{"ProductNum":"LCVLCVTS3P0600388","StationCode":"1A03"}}],"message":"API调用成功"} |
|
72 |
public static String postPRODUCTION_QUEUE(String productNum,String stationCode) |
|
73 |
{ |
971788
|
74 |
String url = Constants.FACTORY_EMS_UAT_POST_RUL + "PRODUCTION_QUEUE"; |
0ca254
|
75 |
HttpResponse response = HttpRequest.post(url) |
A |
76 |
// 表单参数,可以通过多次调用 form 方法添加多个参数 |
971788
|
77 |
.form("siteCode", Constants.FACTORY_EMS_SITE_CODE) |
0ca254
|
78 |
.form("interfaceCode", "PRODUCTION_QUEUE") |
A |
79 |
.form("parameter", "{\"productNum\":\""+productNum+"\",\"stationCode\":\""+stationCode+"\",\"requestQty\":1}") |
|
80 |
// 执行请求 |
|
81 |
.execute(); |
|
82 |
return response.body(); |
|
83 |
} |
|
84 |
//HttpResponse response = HttpRequest.post(url).body(JSONUtil.toJsonStr(vo)).execute(); |
|
85 |
} |