|
@@ -4,7 +4,9 @@ import android.content.Intent;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
+import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
@@ -41,6 +43,7 @@ public class BarcodeInCollectFragment extends BaseFragment {
|
|
|
private ImageView mScanImageView;
|
|
|
private int mFocusId;
|
|
|
private static final int SCAN_BARCODE_CODE = 101;
|
|
|
+ private CheckBox ck_isclear;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
@@ -64,12 +67,39 @@ public class BarcodeInCollectFragment extends BaseFragment {
|
|
|
mBatchcodeTextView = root.findViewById(R.id.barcode_in_collect_result_batchcode_tv);
|
|
|
mLocationTextView = root.findViewById(R.id.barcode_in_collect_result_location_tv);
|
|
|
mPrdetailTextView = root.findViewById(R.id.barcode_in_collect_result_prdetail_tv);
|
|
|
+ ck_isclear = root.findViewById(R.id.ck_isclear);
|
|
|
|
|
|
- CommonUtil.editTextGetFocus(mBarcodeEditText);
|
|
|
+ CommonUtil.editTextGetFocus(mLocationEditText);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void initEvents() {
|
|
|
+ mBarcodeEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_DONE
|
|
|
+ || actionId == EditorInfo.IME_ACTION_SEND
|
|
|
+ || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
+ getConfirmbarlocation();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mLocationEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_DONE
|
|
|
+ || actionId == EditorInfo.IME_ACTION_SEND
|
|
|
+ || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
mScanImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
@@ -89,103 +119,113 @@ public class BarcodeInCollectFragment extends BaseFragment {
|
|
|
mConfirmButton.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View view) {
|
|
|
- String barcode = mBarcodeEditText.getText().toString();
|
|
|
- String location = mLocationEditText.getText().toString();
|
|
|
- if (TextUtils.isEmpty(barcode)) {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "请采集条码号");
|
|
|
- return;
|
|
|
- }
|
|
|
- if (TextUtils.isEmpty(location)) {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "请输入仓位");
|
|
|
- return;
|
|
|
- }
|
|
|
- progressDialog.show();
|
|
|
- VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
- new HttpParams.Builder()
|
|
|
- .url(GloableParams.ADDRESS_INBARCODE_CONFIRMBARLOCATION)
|
|
|
- .method(Request.Method.POST)
|
|
|
- .addParam("barcode", barcode)
|
|
|
- .addParam("location", location)
|
|
|
- .tag(TAG + "CONFIRMBARLOCATION")
|
|
|
- .flag(1)
|
|
|
- .build(), new HttpCallback() {
|
|
|
- @Override
|
|
|
- public void onSuccess(int flag, Object o) throws Exception {
|
|
|
- mResultLayout.setVisibility(View.GONE);
|
|
|
- mBarcodeTextView.setText("");
|
|
|
- mInqtyTextView.setText("");
|
|
|
- mPrcodeTextView.setText("");
|
|
|
- mOrispeccodeTextView.setText("");
|
|
|
- mBatchcodeTextView.setText("");
|
|
|
- mLocationTextView.setText("");
|
|
|
- mPrdetailTextView.setText("");
|
|
|
-
|
|
|
- progressDialog.dismiss();
|
|
|
- try {
|
|
|
- mBarcodeEditText.setText("");
|
|
|
- mLocationEditText.setText("");
|
|
|
- mBarcodeEditText.requestFocus();
|
|
|
- String result = o.toString();
|
|
|
- if (FastjsonUtil.validate(result)) {
|
|
|
- JSONObject resultObject = JSON.parseObject(result);
|
|
|
- JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
- if (dataObject != null) {
|
|
|
- boolean isOk = FastjsonUtil.getBoolean(dataObject, "isOk");
|
|
|
- if (isOk) {
|
|
|
- String barcode = FastjsonUtil.getText(dataObject, "barcode");
|
|
|
- String location = FastjsonUtil.getText(dataObject, "location");
|
|
|
- String pResult = FastjsonUtil.getText(dataObject, "pResult");
|
|
|
- String bi_inqty = FastjsonUtil.getText(dataObject, "bi_inqty");
|
|
|
- String pr_code = FastjsonUtil.getText(dataObject, "pr_code");
|
|
|
- String pr_orispeccode = FastjsonUtil.getText(dataObject, "pr_orispeccode");
|
|
|
- String bi_batchcode = FastjsonUtil.getText(dataObject, "bi_batchcode");
|
|
|
- String pr_detail = FastjsonUtil.getText(dataObject, "pr_detail");
|
|
|
-
|
|
|
- if (TextUtils.isEmpty(pResult)) {
|
|
|
- String resultMsg = "条码号:" +
|
|
|
- barcode + "绑定仓位:" + location + "成功";
|
|
|
- CommonUtil.toastNoRepeat(mActivity, resultMsg);
|
|
|
-
|
|
|
- mResultLayout.setVisibility(View.VISIBLE);
|
|
|
- mBarcodeTextView.setText(barcode);
|
|
|
- mInqtyTextView.setText(bi_inqty);
|
|
|
- mPrcodeTextView.setText(pr_code);
|
|
|
- mOrispeccodeTextView.setText(pr_orispeccode);
|
|
|
- mBatchcodeTextView.setText(bi_batchcode);
|
|
|
- mLocationTextView.setText(location);
|
|
|
- mPrdetailTextView.setText(pr_detail);
|
|
|
- } else {
|
|
|
- String resultMsg = "条码号:" +
|
|
|
- barcode + "绑定仓位:" + location + "成功\n" + pResult;
|
|
|
- CommonUtil.toastNoRepeat(mActivity, resultMsg);
|
|
|
-
|
|
|
- mResultLayout.setVisibility(View.VISIBLE);
|
|
|
- mBarcodeTextView.setText(barcode);
|
|
|
- mInqtyTextView.setText(bi_inqty);
|
|
|
- mPrcodeTextView.setText(pr_code);
|
|
|
- mOrispeccodeTextView.setText(pr_orispeccode);
|
|
|
- mBatchcodeTextView.setText(bi_batchcode);
|
|
|
- mLocationTextView.setText(location);
|
|
|
- mPrdetailTextView.setText(pr_detail);
|
|
|
- }
|
|
|
- } else {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "条码绑定失败");
|
|
|
- }
|
|
|
+ getConfirmbarlocation();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void getConfirmbarlocation(){
|
|
|
+ String barcode = mBarcodeEditText.getText().toString();
|
|
|
+ String location = mLocationEditText.getText().toString();
|
|
|
+ if (TextUtils.isEmpty(barcode)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集条码号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(location)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入仓位");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_INBARCODE_CONFIRMBARLOCATION)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("barcode", barcode)
|
|
|
+ .addParam("location", location)
|
|
|
+ .tag(TAG + "CONFIRMBARLOCATION")
|
|
|
+ .flag(1)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ mResultLayout.setVisibility(View.GONE);
|
|
|
+ mBarcodeTextView.setText("");
|
|
|
+ mInqtyTextView.setText("");
|
|
|
+ mPrcodeTextView.setText("");
|
|
|
+ mOrispeccodeTextView.setText("");
|
|
|
+ mBatchcodeTextView.setText("");
|
|
|
+ mLocationTextView.setText("");
|
|
|
+ mPrdetailTextView.setText("");
|
|
|
+
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ if (!ck_isclear.isChecked()){
|
|
|
+ mLocationEditText.setText("");
|
|
|
+ mLocationEditText.requestFocus();
|
|
|
+ }else {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ String result = o.toString();
|
|
|
+ if (FastjsonUtil.validate(result)) {
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ boolean isOk = FastjsonUtil.getBoolean(dataObject, "isOk");
|
|
|
+ if (isOk) {
|
|
|
+ String barcode = FastjsonUtil.getText(dataObject, "barcode");
|
|
|
+ String location = FastjsonUtil.getText(dataObject, "location");
|
|
|
+ String pResult = FastjsonUtil.getText(dataObject, "pResult");
|
|
|
+ String bi_inqty = FastjsonUtil.getText(dataObject, "bi_inqty");
|
|
|
+ String pr_code = FastjsonUtil.getText(dataObject, "pr_code");
|
|
|
+ String pr_orispeccode = FastjsonUtil.getText(dataObject, "pr_orispeccode");
|
|
|
+ String bi_batchcode = FastjsonUtil.getText(dataObject, "bi_batchcode");
|
|
|
+ String pr_detail = FastjsonUtil.getText(dataObject, "pr_detail");
|
|
|
+
|
|
|
+ if (TextUtils.isEmpty(pResult)) {
|
|
|
+ String resultMsg = "条码号:" +
|
|
|
+ barcode + "绑定仓位:" + location + "成功";
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, resultMsg);
|
|
|
+
|
|
|
+ mResultLayout.setVisibility(View.VISIBLE);
|
|
|
+ mBarcodeTextView.setText(barcode);
|
|
|
+ mInqtyTextView.setText(bi_inqty);
|
|
|
+ mPrcodeTextView.setText(pr_code);
|
|
|
+ mOrispeccodeTextView.setText(pr_orispeccode);
|
|
|
+ mBatchcodeTextView.setText(bi_batchcode);
|
|
|
+ mLocationTextView.setText(location);
|
|
|
+ mPrdetailTextView.setText(pr_detail);
|
|
|
+ } else {
|
|
|
+ String resultMsg = "条码号:" +
|
|
|
+ barcode + "绑定仓位:" + location + "成功\n" + pResult;
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, resultMsg);
|
|
|
+
|
|
|
+ mResultLayout.setVisibility(View.VISIBLE);
|
|
|
+ mBarcodeTextView.setText(barcode);
|
|
|
+ mInqtyTextView.setText(bi_inqty);
|
|
|
+ mPrcodeTextView.setText(pr_code);
|
|
|
+ mOrispeccodeTextView.setText(pr_orispeccode);
|
|
|
+ mBatchcodeTextView.setText(bi_batchcode);
|
|
|
+ mLocationTextView.setText(location);
|
|
|
+ mPrdetailTextView.setText(pr_detail);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "条码绑定失败");
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+ getConfirmbarlocation();
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
- @Override
|
|
|
- public void onFail(int flag, String failStr) throws Exception {
|
|
|
- progressDialog.dismiss();
|
|
|
- CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
@Override
|