|
|
@@ -25,7 +25,7 @@ public class DataUtil {
|
|
|
//TCP连接后,直接先发同步报文
|
|
|
String start = "aaaabbbbbABW";
|
|
|
String msgType = "SYNR";
|
|
|
- String gw = "GW"+DataUtil.rightPad(mes_gw, 6);
|
|
|
+ String gw = "GW"+DataUtil.rightPad(mes_gw, 8);
|
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
|
String synr_str = start + msgType + gw + da + zt;
|
|
|
@@ -47,7 +47,7 @@ public class DataUtil {
|
|
|
//TCP连接后,直接先发同步报文
|
|
|
String start = "aaaabbbbbABW";
|
|
|
String msgType = "AXTW";
|
|
|
- String gw = "GW"+DataUtil.rightPad(mes_gw, 6);
|
|
|
+ String gw = "GW"+DataUtil.rightPad(mes_gw, 8);
|
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
|
String axtw_str = start + msgType + gw + da + zt;
|
|
|
@@ -141,7 +141,7 @@ public class DataUtil {
|
|
|
Properties pro = new Properties();
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
pro.load(br);
|
|
|
- String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 6);
|
|
|
+ String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 8);
|
|
|
String start = "aaaabbbbbABW";
|
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
|
String reslx = "LX" + rightPad("", 2);
|
|
|
@@ -166,7 +166,7 @@ public class DataUtil {
|
|
|
Properties pro = new Properties();
|
|
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
pro.load(br);
|
|
|
- String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 6);
|
|
|
+ String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 8);
|
|
|
String start = "aaaabbbbbABW";
|
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
|
String reslx = "LX" + rightPad(lx, 2);
|
|
|
@@ -306,12 +306,12 @@ public class DataUtil {
|
|
|
String url = "http://" + mes_server_ip + ":8980/js/a/mes/mesProductRecord/pcresult";
|
|
|
|
|
|
String params = "__ajax=json"
|
|
|
- + "&sn=" + sn
|
|
|
- + "&oprno=" + oprno
|
|
|
- + "&lineSn=" + lineSn
|
|
|
- + "&ldFlag=" + ldFlag
|
|
|
- + "&ucode=" + userCode
|
|
|
- + "&result=" + result
|
|
|
+ + "&sn=" + formEncode(sn)
|
|
|
+ + "&oprno=" + formEncode(oprno)
|
|
|
+ + "&lineSn=" + formEncode(lineSn)
|
|
|
+ + "&ldFlag=" + formEncode(ldFlag)
|
|
|
+ + "&ucode=" + formEncode(userCode)
|
|
|
+ + "&result=" + formEncode(result)
|
|
|
+ "&isRepair=" + isRepair
|
|
|
+ "&craft="
|
|
|
+ "&remark="
|
|
|
@@ -351,10 +351,10 @@ public class DataUtil {
|
|
|
String url = "http://" + mes_server_ip + ":8980/js/a/mes/mesProductRecord/pccheck";
|
|
|
|
|
|
String params = "__ajax=json"
|
|
|
- + "&sn=" + sn
|
|
|
- + "&oprno=" + oprno
|
|
|
- + "&lineSn=" + lineSn
|
|
|
- + "&ucode=" + userCode
|
|
|
+ + "&sn=" + formEncode(sn)
|
|
|
+ + "&oprno=" + formEncode(oprno)
|
|
|
+ + "&lineSn=" + formEncode(lineSn)
|
|
|
+ + "&ucode=" + formEncode(userCode)
|
|
|
+ "&isRepair=" + isRepair;
|
|
|
|
|
|
System.out.println("params=" + params);
|
|
|
@@ -389,10 +389,17 @@ public class DataUtil {
|
|
|
connection.setReadTimeout(60000);
|
|
|
connection.setDoOutput(true);
|
|
|
connection.setDoInput(true);
|
|
|
- connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
|
|
- connection.setRequestProperty("Authorization", "Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0");
|
|
|
+ connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
|
|
|
+ String requestParam = param == null ? "" : param;
|
|
|
+ if (MesClient.sessionid != null && !MesClient.sessionid.trim().isEmpty()
|
|
|
+ && !requestParam.contains("__sid=")) {
|
|
|
+ if (!requestParam.isEmpty()) {
|
|
|
+ requestParam += "&";
|
|
|
+ }
|
|
|
+ requestParam += "__sid=" + URLEncoder.encode(MesClient.sessionid, "UTF-8");
|
|
|
+ }
|
|
|
os = connection.getOutputStream();
|
|
|
- os.write(param.getBytes());
|
|
|
+ os.write(requestParam.getBytes("UTF-8"));
|
|
|
if (connection.getResponseCode() == 200) {
|
|
|
is = connection.getInputStream();
|
|
|
br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
|
|
|
@@ -435,6 +442,10 @@ public class DataUtil {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ private static String formEncode(String value) throws UnsupportedEncodingException {
|
|
|
+ return URLEncoder.encode(value == null ? "" : value, "UTF-8");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询工作记录
|
|
|
* @param oprno 工位号(空则查所有工位)
|