1. 来自于WHCombineBatchFragment.java
2.部分代码
private void getPrintData() {
String str = SharedPreUtil.getString(getActivity(), SharedPreUtil.KEY_URI);
LogUtil.e("URIIIII", str);
IPPORT ip = JsonTools.parseJsonToBean(str, IPPORT.class);
LogUtil.e("msg", "ssss" + ip.uriArray.get().ip);
LogUtil.e("msg", "ssss" + ip.uriArray.get().port);
LogUtil.e("strPrintDataList", ""+strPrintDataList);
/* 测试数据
strPrintDataList = "[{bar_remain:4.0,bar_code:E7206360316025,bar_id:1131950}]";*/ String url = "http://" + ip.uriArray.get().ip + ":" + ip.uriArray.get().port + Url.LABELPRINT + "?data="+strPrintDataList; stringRequest3 = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
LogUtil.e("getPrintData0000", s);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
ErrorMsg errorMsg = JsonTools.parseJsonToBean(new String(volleyError.networkResponse.data), ErrorMsg.class);
Toast.makeText(getActivity().getApplicationContext(), errorMsg.exceptionInfo, Toast.LENGTH_LONG).show();
LogUtil.e("getPrintData11111", new String(volleyError.networkResponse.data));
}
})
{
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map map = VolleyUtil.getVolleyUtil().setCookies();
//不用改动
map.put("Content-Type", "text/html; charset=UTF-8");
return map;
}
};
stringRequest3.setTag(GETPRINTDATA);
mRequestQueue.add(stringRequest3);
}
private void getPrintData() {
String str = SharedPreUtil.getString(getActivity(), SharedPreUtil.KEY_URI);
LogUtil.e("URIIIII", str);
IPPORT ip = JsonTools.parseJsonToBean(str, IPPORT.class);
LogUtil.e("msg", "ssss" + ip.uriArray.get().ip);
LogUtil.e("msg", "ssss" + ip.uriArray.get().port);
LogUtil.e("strPrintDataList", ""+strPrintDataList);
/* 测试数据
strPrintDataList = "[{bar_remain:4.0,bar_code:E7206360316025,bar_id:1131950}]";*/ String url = "http://" + ip.uriArray.get().ip + ":" + ip.uriArray.get().port + Url.LABELPRINT + "?data="+strPrintDataList; stringRequest3 = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
LogUtil.e("getPrintData0000", s);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
ErrorMsg errorMsg = JsonTools.parseJsonToBean(new String(volleyError.networkResponse.data), ErrorMsg.class);
Toast.makeText(getActivity().getApplicationContext(), errorMsg.exceptionInfo, Toast.LENGTH_LONG).show();
LogUtil.e("getPrintData11111", new String(volleyError.networkResponse.data));
}
})
{
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map map = VolleyUtil.getVolleyUtil().setCookies();
//不用改动
map.put("Content-Type", "text/html; charset=UTF-8");
return map;
}
};
stringRequest3.setTag(GETPRINTDATA);
mRequestQueue.add(stringRequest3);
}