|
@@ -10,25 +10,39 @@ import android.view.inputmethod.EditorInfo;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
+import com.android.volley.AuthFailureError;
|
|
|
|
+import com.android.volley.DefaultRetryPolicy;
|
|
import com.android.volley.Request;
|
|
import com.android.volley.Request;
|
|
|
|
+import com.android.volley.Response;
|
|
|
|
+import com.android.volley.VolleyError;
|
|
|
|
+import com.android.volley.toolbox.JsonObjectRequest;
|
|
import com.android.volley.toolbox.JsonRequest;
|
|
import com.android.volley.toolbox.JsonRequest;
|
|
-import com.android.volley.toolbox.StringRequest;
|
|
|
|
import com.uas.uas_mes_standard.R;
|
|
import com.uas.uas_mes_standard.R;
|
|
import com.uas.uas_mes_standard.activity.FunctionActivity;
|
|
import com.uas.uas_mes_standard.activity.FunctionActivity;
|
|
|
|
+import com.uas.uas_mes_standard.application.PdaApplication;
|
|
|
|
+import com.uas.uas_mes_standard.bean.RevocationStockMultipleBean;
|
|
import com.uas.uas_mes_standard.global.GloableParams;
|
|
import com.uas.uas_mes_standard.global.GloableParams;
|
|
import com.uas.uas_mes_standard.tools.SharedPreUtil;
|
|
import com.uas.uas_mes_standard.tools.SharedPreUtil;
|
|
|
|
+import com.uas.uas_mes_standard.tools.VolleyUtil;
|
|
import com.uas.uas_mes_standard.util.CameraUtil;
|
|
import com.uas.uas_mes_standard.util.CameraUtil;
|
|
import com.uas.uas_mes_standard.util.CommonUtil;
|
|
import com.uas.uas_mes_standard.util.CommonUtil;
|
|
import com.uas.uas_mes_standard.util.Constants;
|
|
import com.uas.uas_mes_standard.util.Constants;
|
|
-import com.uas.uas_mes_standard.util.FastjsonUtil;
|
|
|
|
-import com.uas.uas_mes_standard.util.HttpCallback;
|
|
|
|
-import com.uas.uas_mes_standard.util.HttpParams;
|
|
|
|
-import com.uas.uas_mes_standard.util.VollyRequest;
|
|
|
|
|
|
+import com.uas.uas_mes_standard.util.JsonUtils;
|
|
|
|
+import com.uas.uas_mes_standard.util.LogUtil;
|
|
import com.uas.uas_mes_standard.view.ClearableEditText;
|
|
import com.uas.uas_mes_standard.view.ClearableEditText;
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
|
|
+import org.json.JSONArray;
|
|
|
|
+import org.json.JSONException;
|
|
|
|
+import org.json.JSONObject;
|
|
|
|
+
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
+import java.net.URLEncoder;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 材料出库撤销备料页面
|
|
* 材料出库撤销备料页面
|
|
* Created by RaoMeng on 2017/3/14.
|
|
* Created by RaoMeng on 2017/3/14.
|
|
@@ -42,11 +56,10 @@ public class MaterialOutRevocationStockFragment extends BaseFragment {
|
|
private String mRevokeType;
|
|
private String mRevokeType;
|
|
private boolean isMultiple;
|
|
private boolean isMultiple;
|
|
private ImageView mScanImageView;
|
|
private ImageView mScanImageView;
|
|
- private StringRequest mStringRequest;
|
|
|
|
|
|
+
|
|
private JsonRequest mJsonRequest;
|
|
private JsonRequest mJsonRequest;
|
|
private int mFocusId;
|
|
private int mFocusId;
|
|
private OnRevocationSuccessListener mOnRevocationSuccessListener;
|
|
private OnRevocationSuccessListener mOnRevocationSuccessListener;
|
|
-
|
|
|
|
public void setOnRevocationSuccessListener(OnRevocationSuccessListener onRevocationSuccessListener) {
|
|
public void setOnRevocationSuccessListener(OnRevocationSuccessListener onRevocationSuccessListener) {
|
|
mOnRevocationSuccessListener = onRevocationSuccessListener;
|
|
mOnRevocationSuccessListener = onRevocationSuccessListener;
|
|
}
|
|
}
|
|
@@ -190,256 +203,194 @@ public class MaterialOutRevocationStockFragment extends BaseFragment {
|
|
progressDialog.show();
|
|
progressDialog.show();
|
|
mResultTextView.setText(null);
|
|
mResultTextView.setText(null);
|
|
String barcode = mBarcodeEditText.getText().toString().trim();
|
|
String barcode = mBarcodeEditText.getText().toString().trim();
|
|
- VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
|
- new HttpParams.Builder()
|
|
|
|
- .url(GloableParams.ADDRESS_PDAIO_OUT_REVOKEBARCODE)
|
|
|
|
- .method(Request.Method.POST)
|
|
|
|
- .tag(TAG + "revokebarcode")
|
|
|
|
- .flag(0)
|
|
|
|
- .addParam("pi_id", mPiid)
|
|
|
|
- .addParam("barcode", barcode)
|
|
|
|
- .build(), new HttpCallback() {
|
|
|
|
|
|
+ String url = "";
|
|
|
|
+ if (mRevokeType != null) {
|
|
|
|
+ try {
|
|
|
|
+ url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid + "&whcode="
|
|
|
|
+ + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ if (mRevokeType.equals("byBarcode")) {
|
|
|
|
+ if ("materialin".equals(mWhichPage)) {
|
|
|
|
+
|
|
|
|
+ url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
+ + "&whcode=" + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+
|
|
|
|
+ } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
+// if (isMultiple) {
|
|
|
|
+ if (true) {
|
|
|
|
+ url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL_DEAL + "?ids=" + mPiid
|
|
|
|
+ + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ } else {
|
|
|
|
+ url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
+ + "&whcode=" + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (mRevokeType.equals("byBox")) {
|
|
|
|
+ if ("materialin".equals(mWhichPage)) {
|
|
|
|
+ url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
+ + "&whcode=" + mWhcode + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
+// if (isMultiple) {
|
|
|
|
+ if (true) {
|
|
|
|
+ url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL_DEAL + "?ids=" + mPiid
|
|
|
|
+ + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ } else {
|
|
|
|
+ url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
+ + "&whcode=" + mWhcode + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PdaApplication.mRequestQueue.cancelAll(TAG + "revoke");
|
|
|
|
+
|
|
|
|
+ mJsonRequest = new JsonObjectRequest(Request.Method.GET, url, null,
|
|
|
|
+ new Response.Listener<JSONObject>() {
|
|
@Override
|
|
@Override
|
|
- public void onSuccess(int flag, Object o) throws Exception {
|
|
|
|
- try {
|
|
|
|
- progressDialog.dismiss();
|
|
|
|
- mResultTextView.setVisibility(View.VISIBLE);
|
|
|
|
-
|
|
|
|
- String result = o.toString();
|
|
|
|
- com.alibaba.fastjson.JSONObject resultObject = JSON.parseObject(result);
|
|
|
|
- com.alibaba.fastjson.JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
|
- if (dataObject != null) {
|
|
|
|
- if (mOnRevocationSuccessListener != null) {
|
|
|
|
- mOnRevocationSuccessListener.onRevocationSuccess();
|
|
|
|
- }
|
|
|
|
- String barcodeResult
|
|
|
|
- = "撤销备料成功!\n料号:" + FastjsonUtil.getText(dataObject, "BI_PRODCODE")
|
|
|
|
- + ";品牌:" + FastjsonUtil.getText(dataObject, "BI_BRAND")
|
|
|
|
- + ";名称规格:" + FastjsonUtil.getText(dataObject, "PR_DETAIL")
|
|
|
|
- + " " + FastjsonUtil.getText(dataObject, "PR_SPEC")
|
|
|
|
- + ";数量:" + FastjsonUtil.getText(dataObject, "sumQty")
|
|
|
|
- + ";lotno:" + FastjsonUtil.getText(dataObject, "BI_LOTNO")
|
|
|
|
- + ";Datecode:" + FastjsonUtil.getText(dataObject, "BI_DATECODE")
|
|
|
|
- + ";PO:" + FastjsonUtil.getText(dataObject, "BI_ORDERCODE");
|
|
|
|
-
|
|
|
|
- if (mResultTextView != null) {
|
|
|
|
- mResultTextView.setText(barcodeResult);
|
|
|
|
|
|
+ public void onResponse(JSONObject jsonObject) {
|
|
|
|
+ LogUtil.i("revokeResult", jsonObject.toString());
|
|
|
|
+ progressDialog.dismiss();
|
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
|
+ if ("materialin".equals(mWhichPage)) {
|
|
|
|
+ mResultTextView.setText(jsonObject.optString("data"));
|
|
|
|
+ mBarcodeEditText.setText(null);
|
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "撤销入库成功");
|
|
|
|
+ } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
+// if (isMultiple) {
|
|
|
|
+ if (true) {
|
|
|
|
+ try {
|
|
|
|
+ JSONArray dataArray = jsonObject.optJSONArray("data");
|
|
|
|
+ if (dataArray != null && dataArray.length() > 0) {
|
|
|
|
+ List<RevocationStockMultipleBean> revocationStockMultipleBeans = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < dataArray.length(); i++) {
|
|
|
|
+ JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
|
+ if (dataObject != null) {
|
|
|
|
+ RevocationStockMultipleBean revocationStockMultipleBean = new RevocationStockMultipleBean();
|
|
|
|
+ revocationStockMultipleBean.setBI_PIID(JsonUtils.optLongNotNull(dataObject, "BI_PIID"));
|
|
|
|
+ revocationStockMultipleBean.setBI_INOUTNO(JsonUtils.optStringNotNull(dataObject, "BI_INOUTNO"));
|
|
|
|
+ revocationStockMultipleBean.setBI_OUTQTY(JsonUtils.optDoubleNotNull(dataObject, "BI_OUTQTY"));
|
|
|
|
+ revocationStockMultipleBean.setBI_WHCODE(JsonUtils.optStringNotNull(dataObject, "BI_WHCODE"));
|
|
|
|
+ revocationStockMultipleBean.setBI_PRODCODE(JsonUtils.optStringNotNull(dataObject, "BI_PRODCODE"));
|
|
|
|
+ revocationStockMultipleBean.setBI_BATCHCODE(JsonUtils.optStringNotNull(dataObject, "BI_BATCHCODE"));
|
|
|
|
+ revocationStockMultipleBean.setBARCODE(JsonUtils.optStringNotNull(dataObject, "BARCODE"));
|
|
|
|
+ revocationStockMultipleBean.setBARID(JsonUtils.optLongNotNull(dataObject, "BARID"));
|
|
|
|
+ revocationStockMultipleBean.setPR_DETAIL(JsonUtils.optStringNotNull(dataObject, "PR_DETAIL"));
|
|
|
|
+ revocationStockMultipleBean.setPR_SPEC(JsonUtils.optStringNotNull(dataObject, "PR_SPEC"));
|
|
|
|
+
|
|
|
|
+ revocationStockMultipleBeans.add(revocationStockMultipleBean);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (revocationStockMultipleBeans.size() > 0) {
|
|
|
|
+ if (mRevokeType.equals("byBarcode")) {
|
|
|
|
+ String barcodeResult = "撤销备料成功;料号:" + revocationStockMultipleBeans.get(0).getBI_PRODCODE()
|
|
|
|
+ + ";名称:" + revocationStockMultipleBeans.get(0).getPR_DETAIL()
|
|
|
|
+ + ";规格:" + revocationStockMultipleBeans.get(0).getPR_SPEC()
|
|
|
|
+ + ";仓库:" + revocationStockMultipleBeans.get(0).getBI_WHCODE();
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < revocationStockMultipleBeans.size(); i++) {
|
|
|
|
+ barcodeResult = barcodeResult + "\n单号:" + revocationStockMultipleBeans.get(i).getBI_INOUTNO()
|
|
|
|
+ + ",条码:" + revocationStockMultipleBeans.get(i).getBARCODE()
|
|
|
|
+ + ",数量:" + CommonUtil.doubleFormat(revocationStockMultipleBeans.get(i).getBI_OUTQTY());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (mResultTextView != null)
|
|
|
|
+ mResultTextView.setText(barcodeResult);
|
|
|
|
+
|
|
|
|
+ } else if (mRevokeType.equals("byBox")) {
|
|
|
|
+ String boxResult = "撤销备料成功;料号:" + revocationStockMultipleBeans.get(0).getBI_PRODCODE()
|
|
|
|
+ + ";名称:" + revocationStockMultipleBeans.get(0).getPR_DETAIL()
|
|
|
|
+ + ";规格:" + revocationStockMultipleBeans.get(0).getPR_SPEC()
|
|
|
|
+ + ";仓库:" + revocationStockMultipleBeans.get(0).getBI_WHCODE();
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < revocationStockMultipleBeans.size(); i++) {
|
|
|
|
+ boxResult = boxResult + "\n单号:" + revocationStockMultipleBeans.get(i).getBI_INOUTNO()
|
|
|
|
+ + ",条码:" + revocationStockMultipleBeans.get(i).getBARCODE()
|
|
|
|
+ + ",数量:" + CommonUtil.doubleFormat(revocationStockMultipleBeans.get(i).getBI_OUTQTY());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (mResultTextView != null)
|
|
|
|
+ mResultTextView.setText(boxResult);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (mBarcodeEditText != null) {
|
|
|
|
+ mBarcodeEditText.setText(null);
|
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
|
+ }
|
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "撤销备料成功");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ try {
|
|
|
|
+ JSONObject messageObject = jsonObject.getJSONObject("data");
|
|
|
|
+ if (messageObject != null) {
|
|
|
|
+ if (mRevokeType.equals("byBarcode")) {
|
|
|
|
+ String barcodeResult = "撤销备料成功;条码:" + JsonUtils.optStringNotNull(messageObject, "BAR_CODE")
|
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
|
+ + ";物料:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
|
+ + ";名称规格:" + JsonUtils.optStringNotNull(messageObject, "PR_DETAIL")
|
|
|
|
+ + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC")
|
|
|
|
+ + ";批号:" + JsonUtils.optStringNotNull(messageObject, "BAR_BATCHCODE")
|
|
|
|
+ + ";仓位:" + JsonUtils.optStringNotNull(messageObject, "BAR_LOCATION");
|
|
|
|
+ if (mResultTextView != null)
|
|
|
|
+ mResultTextView.setText(barcodeResult);
|
|
|
|
+
|
|
|
|
+ } else if (mRevokeType.equals("byBox")) {
|
|
|
|
+ String boxResult = "撤销备料成功;箱号:" + JsonUtils.optStringNotNull(messageObject, "BAR_OUTBOXCODE1")
|
|
|
|
+ + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
|
+ + ";物料:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
|
+ + ";名称规格:" + JsonUtils.optStringNotNull(messageObject, "PR_DETAIL")
|
|
|
|
+ + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC");
|
|
|
|
+
|
|
|
|
+ if (mResultTextView != null)
|
|
|
|
+ mResultTextView.setText(boxResult);
|
|
|
|
|
|
- if (mBarcodeEditText != null) {
|
|
|
|
- mBarcodeEditText.setText(null);
|
|
|
|
- mBarcodeEditText.requestFocus();
|
|
|
|
|
|
+ }
|
|
|
|
+ if (mBarcodeEditText != null) {
|
|
|
|
+ mBarcodeEditText.setText(null);
|
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
|
+ }
|
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "撤销备料成功");
|
|
|
|
+ }
|
|
|
|
+ } catch (JSONException e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
- CommonUtil.toastNoRepeat(mActivity, "撤销备料成功");
|
|
|
|
}
|
|
}
|
|
- } catch (Exception e) {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ new Response.ErrorListener() {
|
|
@Override
|
|
@Override
|
|
- public void onFail(int flag, String failStr) throws Exception {
|
|
|
|
|
|
+ public void onErrorResponse(VolleyError volleyError) {
|
|
progressDialog.dismiss();
|
|
progressDialog.dismiss();
|
|
- CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
|
|
|
+ String errorToast = CommonUtil.showErrorToast(volleyError, true);
|
|
mBarcodeEditText.setText(null);
|
|
mBarcodeEditText.setText(null);
|
|
mBarcodeEditText.requestFocus();
|
|
mBarcodeEditText.requestFocus();
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
mResultTextView.setVisibility(View.VISIBLE);
|
|
- mResultTextView.setText(failStr);
|
|
|
|
|
|
+ mResultTextView.setText(errorToast);
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ }) {
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, String> getHeaders() throws AuthFailureError {
|
|
|
|
+ return VolleyUtil.getVolleyUtil().setCookies();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ mJsonRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
|
|
|
|
+ mJsonRequest.setTag(TAG + "revoke");
|
|
|
|
+ PdaApplication.mRequestQueue.add(mJsonRequest);
|
|
}
|
|
}
|
|
-// private void revokeStock() {
|
|
|
|
-// progressDialog.show();
|
|
|
|
-// mResultTextView.setText(null);
|
|
|
|
-// String barcode = mBarcodeEditText.getText().toString().trim();
|
|
|
|
-// String url = "";
|
|
|
|
-// if (mRevokeType != null) {
|
|
|
|
-// try {
|
|
|
|
-// url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid + "&whcode="
|
|
|
|
-// + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// if (mRevokeType.equals("byBarcode")) {
|
|
|
|
-// if ("materialin".equals(mWhichPage)) {
|
|
|
|
-//
|
|
|
|
-// url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
-// + "&whcode=" + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-//
|
|
|
|
-// } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
-//// if (isMultiple) {
|
|
|
|
-// if (true) {
|
|
|
|
-// url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL_DEAL + "?ids=" + mPiid
|
|
|
|
-// + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// } else {
|
|
|
|
-// url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
-// + "&whcode=" + mWhcode + "&barcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } else if (mRevokeType.equals("byBox")) {
|
|
|
|
-// if ("materialin".equals(mWhichPage)) {
|
|
|
|
-// url = GloableParams.ADDRESS_IN_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
-// + "&whcode=" + mWhcode + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
-//// if (isMultiple) {
|
|
|
|
-// if (true) {
|
|
|
|
-// url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL_DEAL + "?ids=" + mPiid
|
|
|
|
-// + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// } else {
|
|
|
|
-// url = GloableParams.ADDRESS_OUT_MATERIAL_DELETE_DETAIL + "?bi_piid=" + mPiid
|
|
|
|
-// + "&whcode=" + mWhcode + "&outboxcode=" + URLEncoder.encode(barcode, "utf-8");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// } catch (UnsupportedEncodingException e) {
|
|
|
|
-// e.printStackTrace();
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// PdaApplication.mRequestQueue.cancelAll(TAG + "revoke");
|
|
|
|
-//
|
|
|
|
-// mJsonRequest = new JsonObjectRequest(Request.Method.GET, url, null,
|
|
|
|
-// new Response.Listener<JSONObject>() {
|
|
|
|
-// @Override
|
|
|
|
-// public void onResponse(JSONObject jsonObject) {
|
|
|
|
-// LogUtil.i("revokeResult", jsonObject.toString());
|
|
|
|
-// progressDialog.dismiss();
|
|
|
|
-// mResultTextView.setVisibility(View.VISIBLE);
|
|
|
|
-// if ("materialin".equals(mWhichPage)) {
|
|
|
|
-// mResultTextView.setText(jsonObject.optString("data"));
|
|
|
|
-// mBarcodeEditText.setText(null);
|
|
|
|
-// mBarcodeEditText.requestFocus();
|
|
|
|
-// CommonUtil.toastNoRepeat(getActivity(), "撤销入库成功");
|
|
|
|
-// } else if ("materialout".equals(mWhichPage)) {
|
|
|
|
-//// if (isMultiple) {
|
|
|
|
-// if (true) {
|
|
|
|
-// try {
|
|
|
|
-// JSONArray dataArray = jsonObject.optJSONArray("data");
|
|
|
|
-// if (dataArray != null && dataArray.length() > 0) {
|
|
|
|
-// List<RevocationStockMultipleBean> revocationStockMultipleBeans = new ArrayList<>();
|
|
|
|
-// for (int i = 0; i < dataArray.length(); i++) {
|
|
|
|
-// JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
|
-// if (dataObject != null) {
|
|
|
|
-// RevocationStockMultipleBean revocationStockMultipleBean = new RevocationStockMultipleBean();
|
|
|
|
-// revocationStockMultipleBean.setBI_PIID(JsonUtils.optLongNotNull(dataObject, "BI_PIID"));
|
|
|
|
-// revocationStockMultipleBean.setBI_INOUTNO(JsonUtils.optStringNotNull(dataObject, "BI_INOUTNO"));
|
|
|
|
-// revocationStockMultipleBean.setBI_OUTQTY(JsonUtils.optDoubleNotNull(dataObject, "BI_OUTQTY"));
|
|
|
|
-// revocationStockMultipleBean.setBI_WHCODE(JsonUtils.optStringNotNull(dataObject, "BI_WHCODE"));
|
|
|
|
-// revocationStockMultipleBean.setBI_PRODCODE(JsonUtils.optStringNotNull(dataObject, "BI_PRODCODE"));
|
|
|
|
-// revocationStockMultipleBean.setBI_BATCHCODE(JsonUtils.optStringNotNull(dataObject, "BI_BATCHCODE"));
|
|
|
|
-// revocationStockMultipleBean.setBARCODE(JsonUtils.optStringNotNull(dataObject, "BARCODE"));
|
|
|
|
-// revocationStockMultipleBean.setBARID(JsonUtils.optLongNotNull(dataObject, "BARID"));
|
|
|
|
-// revocationStockMultipleBean.setPR_DETAIL(JsonUtils.optStringNotNull(dataObject, "PR_DETAIL"));
|
|
|
|
-// revocationStockMultipleBean.setPR_SPEC(JsonUtils.optStringNotNull(dataObject, "PR_SPEC"));
|
|
|
|
-//
|
|
|
|
-// revocationStockMultipleBeans.add(revocationStockMultipleBean);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if (revocationStockMultipleBeans.size() > 0) {
|
|
|
|
-// if (mRevokeType.equals("byBarcode")) {
|
|
|
|
-// String barcodeResult = "撤销备料成功;料号:" + revocationStockMultipleBeans.get(0).getBI_PRODCODE()
|
|
|
|
-// + ";名称:" + revocationStockMultipleBeans.get(0).getPR_DETAIL()
|
|
|
|
-// + ";规格:" + revocationStockMultipleBeans.get(0).getPR_SPEC()
|
|
|
|
-// + ";仓库:" + revocationStockMultipleBeans.get(0).getBI_WHCODE();
|
|
|
|
-//
|
|
|
|
-// for (int i = 0; i < revocationStockMultipleBeans.size(); i++) {
|
|
|
|
-// barcodeResult = barcodeResult + "\n单号:" + revocationStockMultipleBeans.get(i).getBI_INOUTNO()
|
|
|
|
-// + ",条码:" + revocationStockMultipleBeans.get(i).getBARCODE()
|
|
|
|
-// + ",数量:" + CommonUtil.doubleFormat(revocationStockMultipleBeans.get(i).getBI_OUTQTY());
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if (mResultTextView != null)
|
|
|
|
-// mResultTextView.setText(barcodeResult);
|
|
|
|
-//
|
|
|
|
-// } else if (mRevokeType.equals("byBox")) {
|
|
|
|
-// String boxResult = "撤销备料成功;料号:" + revocationStockMultipleBeans.get(0).getBI_PRODCODE()
|
|
|
|
-// + ";名称:" + revocationStockMultipleBeans.get(0).getPR_DETAIL()
|
|
|
|
-// + ";规格:" + revocationStockMultipleBeans.get(0).getPR_SPEC()
|
|
|
|
-// + ";仓库:" + revocationStockMultipleBeans.get(0).getBI_WHCODE();
|
|
|
|
-//
|
|
|
|
-// for (int i = 0; i < revocationStockMultipleBeans.size(); i++) {
|
|
|
|
-// boxResult = boxResult + "\n单号:" + revocationStockMultipleBeans.get(i).getBI_INOUTNO()
|
|
|
|
-// + ",条码:" + revocationStockMultipleBeans.get(i).getBARCODE()
|
|
|
|
-// + ",数量:" + CommonUtil.doubleFormat(revocationStockMultipleBeans.get(i).getBI_OUTQTY());
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if (mResultTextView != null)
|
|
|
|
-// mResultTextView.setText(boxResult);
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// if (mBarcodeEditText != null) {
|
|
|
|
-// mBarcodeEditText.setText(null);
|
|
|
|
-// mBarcodeEditText.requestFocus();
|
|
|
|
-// }
|
|
|
|
-// CommonUtil.toastNoRepeat(mActivity, "撤销备料成功");
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// } else {
|
|
|
|
-// try {
|
|
|
|
-// JSONObject messageObject = jsonObject.getJSONObject("data");
|
|
|
|
-// if (messageObject != null) {
|
|
|
|
-// if (mRevokeType.equals("byBarcode")) {
|
|
|
|
-// String barcodeResult = "撤销备料成功;条码:" + JsonUtils.optStringNotNull(messageObject, "BAR_CODE")
|
|
|
|
-// + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
|
-// + ";物料:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
|
-// + ";名称规格:" + JsonUtils.optStringNotNull(messageObject, "PR_DETAIL")
|
|
|
|
-// + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC")
|
|
|
|
-// + ";批号:" + JsonUtils.optStringNotNull(messageObject, "BAR_BATCHCODE")
|
|
|
|
-// + ";仓位:" + JsonUtils.optStringNotNull(messageObject, "BAR_LOCATION");
|
|
|
|
-// if (mResultTextView != null)
|
|
|
|
-// mResultTextView.setText(barcodeResult);
|
|
|
|
-//
|
|
|
|
-// } else if (mRevokeType.equals("byBox")) {
|
|
|
|
-// String boxResult = "撤销备料成功;箱号:" + JsonUtils.optStringNotNull(messageObject, "BAR_OUTBOXCODE1")
|
|
|
|
-// + ";数量:" + CommonUtil.doubleFormat(messageObject.optDouble("BAR_REMAIN"))
|
|
|
|
-// + ";物料:" + JsonUtils.optStringNotNull(messageObject, "BAR_PRODCODE")
|
|
|
|
-// + ";名称规格:" + JsonUtils.optStringNotNull(messageObject, "PR_DETAIL")
|
|
|
|
-// + " " + JsonUtils.optStringNotNull(messageObject, "PR_SPEC");
|
|
|
|
-//
|
|
|
|
-// if (mResultTextView != null)
|
|
|
|
-// mResultTextView.setText(boxResult);
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// if (mBarcodeEditText != null) {
|
|
|
|
-// mBarcodeEditText.setText(null);
|
|
|
|
-// mBarcodeEditText.requestFocus();
|
|
|
|
-// }
|
|
|
|
-// CommonUtil.toastNoRepeat(mActivity, "撤销备料成功");
|
|
|
|
-// }
|
|
|
|
-// } catch (JSONException e) {
|
|
|
|
-// e.printStackTrace();
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// },
|
|
|
|
-// new Response.ErrorListener() {
|
|
|
|
-// @Override
|
|
|
|
-// public void onErrorResponse(VolleyError volleyError) {
|
|
|
|
-// progressDialog.dismiss();
|
|
|
|
-// String errorToast = CommonUtil.showErrorToast(volleyError, true);
|
|
|
|
-// mBarcodeEditText.setText(null);
|
|
|
|
-// mBarcodeEditText.requestFocus();
|
|
|
|
-// mResultTextView.setVisibility(View.VISIBLE);
|
|
|
|
-// mResultTextView.setText(errorToast);
|
|
|
|
-// }
|
|
|
|
-// }) {
|
|
|
|
-// @Override
|
|
|
|
-// public Map<String, String> getHeaders() throws AuthFailureError {
|
|
|
|
-// return VolleyUtil.getVolleyUtil().setCookies();
|
|
|
|
-// }
|
|
|
|
-// };
|
|
|
|
-// mJsonRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
|
|
|
|
-// mJsonRequest.setTag(TAG + "revoke");
|
|
|
|
-// PdaApplication.mRequestQueue.add(mJsonRequest);
|
|
|
|
-// }
|
|
|
|
|
|
|
|
private void changeToTypeBarcode() {
|
|
private void changeToTypeBarcode() {
|
|
mBarcodeEditText.setHint(R.string.please_collect_barcode);
|
|
mBarcodeEditText.setHint(R.string.please_collect_barcode);
|