1. 来自于WHCombineBatchFragment.java
/**
* 当编辑框里面的内容完成的时候,自动的,同时获取服务器的批量数
*/
private void barcodeEnterEvent(String outboxcode) {
mRequestQueue = Volley.newRequestQueue(getActivity());
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(0).ip);
LogUtil.e("msg", "ssss" + ip.uriArray.get(0).port);
String url = "http://" + ip.uriArray.get(0).ip + ":" + ip.uriArray.get(0).port + Url.BARCODEENTEREVENT + "?code=" + outboxcode + "&pr_ismsd=" + "false";
//String url = "http://" + ip.uriArray.get(0).ip + ":" + ip.uriArray.get(0).port + Url.BarcodeEnterEvent + "?code=" + outboxcode + "&pr_ismsd=" + "false";
stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String s) {
LogUtil.e("msg", "ssss" + s);
WHBreakingBatchGetBarcodeData whBreakingBatchGetBarcodeData = JsonTools.parseJsonToBean(s, WHBreakingBatchGetBarcodeData.class);
LogUtil.e("msg", "ssss" + whBreakingBatchGetBarcodeData.message.data.bar_remain);
tvOrRemain.setText(whBreakingBatchGetBarcodeData.message.data.bar_remain);
getLoadingView();
CommonUtil.setEnabled(btnBreaking);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Toast.makeText(getActivity().getApplicationContext(), volleyError.toString(), Toast.LENGTH_SHORT).show();
etOrBarcode.setText("");
getLoadingView();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
String cookie = SharedPreUtil.getString(getActivity().getApplicationContext(), "cookie");
Map<String, String> headers = new HashMap<>();
headers.put("Cookie", cookie);
return headers;
}
};
stringRequest.setTag(TAG);
mRequestQueue.add(stringRequest);
}