|
@@ -9,7 +9,6 @@ import java.io.*;
|
|
|
import java.net.HttpURLConnection;
|
|
import java.net.HttpURLConnection;
|
|
|
import java.net.MalformedURLException;
|
|
import java.net.MalformedURLException;
|
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
|
-import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
public class DataUtil {
|
|
public class DataUtil {
|
|
|
|
|
|
|
@@ -129,16 +128,11 @@ public class DataUtil {
|
|
|
String msgType = "MQDW";
|
|
String msgType = "MQDW";
|
|
|
String craft = "100000";
|
|
String craft = "100000";
|
|
|
String params = "";
|
|
String params = "";
|
|
|
- String enconding = "UTF-8";
|
|
|
|
|
- InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
|
|
- Properties pro = new Properties();
|
|
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
|
|
- pro.load(br);
|
|
|
|
|
- String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 8);
|
|
|
|
|
|
|
+ String gw = "GW"+rightPad(MesClient.mes_gw, 8);
|
|
|
String start = "aaaabbbbbABW";
|
|
String start = "aaaabbbbbABW";
|
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
|
String reslx = "LX" + rightPad("", 2);
|
|
String reslx = "LX" + rightPad("", 2);
|
|
|
- String id = pro.getProperty("mes.line_sn") + rightPad(sn, 36);
|
|
|
|
|
|
|
+ String id = MesClient.mes_line_sn + rightPad(sn, 36);
|
|
|
String rs = "RS"+ rightPad(ret, 2);
|
|
String rs = "RS"+ rightPad(ret, 2);
|
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
@@ -154,16 +148,11 @@ public class DataUtil {
|
|
|
|
|
|
|
|
public static Boolean sendMessage(NettyClient nettyClient,String msgType,String craft,String lx,String sn,String result,String user,String paramNums,String params){
|
|
public static Boolean sendMessage(NettyClient nettyClient,String msgType,String craft,String lx,String sn,String result,String user,String paramNums,String params){
|
|
|
try{
|
|
try{
|
|
|
- String enconding = "UTF-8";
|
|
|
|
|
- InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
|
|
- Properties pro = new Properties();
|
|
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
|
|
- pro.load(br);
|
|
|
|
|
- String gw = "GW"+rightPad(pro.getProperty("mes.gw"), 8);
|
|
|
|
|
|
|
+ String gw = "GW"+rightPad(MesClient.mes_gw, 8);
|
|
|
String start = "aaaabbbbbABW";
|
|
String start = "aaaabbbbbABW";
|
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
String gy = "GY" + rightPad(craft, 6);
|
|
|
String reslx = "LX" + rightPad(lx, 2);
|
|
String reslx = "LX" + rightPad(lx, 2);
|
|
|
- String id = pro.getProperty("mes.line_sn") + rightPad(sn, 36);
|
|
|
|
|
|
|
+ String id = MesClient.mes_line_sn + rightPad(sn, 36);
|
|
|
String rs = "RS"+ rightPad(result, 2);
|
|
String rs = "RS"+ rightPad(result, 2);
|
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
String da = "DA" + DateLocalUtils.getCurrentDate();
|
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
String zt = "ZT" + DateLocalUtils.getCurrentTimeHMS();
|
|
@@ -192,14 +181,9 @@ public class DataUtil {
|
|
|
|
|
|
|
|
public static JSONObject getBindMaterail() {
|
|
public static JSONObject getBindMaterail() {
|
|
|
try{
|
|
try{
|
|
|
- String enconding = "UTF-8";
|
|
|
|
|
- InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
|
|
- Properties pro = new Properties();
|
|
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
|
|
- pro.load(br);
|
|
|
|
|
- String mes_server_ip = pro.getProperty("mes.server_ip");
|
|
|
|
|
- String oprno = pro.getProperty("mes.gw").trim();
|
|
|
|
|
- String lineSn = pro.getProperty("mes.line_sn").trim();
|
|
|
|
|
|
|
+ String mes_server_ip = MesClient.mes_server_ip;
|
|
|
|
|
+ String oprno = MesClient.mes_gw.trim();
|
|
|
|
|
+ String lineSn = MesClient.mes_line_sn.trim();
|
|
|
String url = "http://"+mes_server_ip+":8980/js/a/mes/mesLineProcessMaterial/materials";
|
|
String url = "http://"+mes_server_ip+":8980/js/a/mes/mesLineProcessMaterial/materials";
|
|
|
String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn;
|
|
String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn;
|
|
|
System.out.println("params="+params);
|
|
System.out.println("params="+params);
|
|
@@ -218,14 +202,9 @@ public class DataUtil {
|
|
|
|
|
|
|
|
public static JSONObject saveBindMaterail(String batchSn,String craft,String materialId,String type) {
|
|
public static JSONObject saveBindMaterail(String batchSn,String craft,String materialId,String type) {
|
|
|
try{
|
|
try{
|
|
|
- String enconding = "UTF-8";
|
|
|
|
|
- InputStream is = ClassLoader.getSystemResourceAsStream("config/config.properties");
|
|
|
|
|
- Properties pro = new Properties();
|
|
|
|
|
- BufferedReader br = new BufferedReader(new InputStreamReader(is, enconding));
|
|
|
|
|
- pro.load(br);
|
|
|
|
|
- String mes_server_ip = pro.getProperty("mes.server_ip");
|
|
|
|
|
- String oprno = pro.getProperty("mes.gw").trim();
|
|
|
|
|
- String lineSn = pro.getProperty("mes.line_sn").trim();
|
|
|
|
|
|
|
+ String mes_server_ip = MesClient.mes_server_ip;
|
|
|
|
|
+ String oprno = MesClient.mes_gw.trim();
|
|
|
|
|
+ String lineSn = MesClient.mes_line_sn.trim();
|
|
|
String url = "http://"+mes_server_ip+":8980/js/a/mes/mesMaterialPrebind/bind";
|
|
String url = "http://"+mes_server_ip+":8980/js/a/mes/mesMaterialPrebind/bind";
|
|
|
String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn+"&batchSn="+batchSn+"&craft="+craft+"&materialId="+materialId+"&type="+type;
|
|
String params = "__ajax=json&oprno="+oprno+"&lineSn="+lineSn+"&batchSn="+batchSn+"&craft="+craft+"&materialId="+materialId+"&type="+type;
|
|
|
System.out.println("params="+params);
|
|
System.out.println("params="+params);
|