Przeglądaj źródła

将条码入库页面修改为和瑞梓仓库通用版一致

songw 2 miesięcy temu
rodzic
commit
496882aa84

+ 133 - 92
app/src/main/java/com/uas/jc_wms/fragment/BarcodeInCollectFragment.java

@@ -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);
     }
 
     @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,114 @@ 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

+ 33 - 25
app/src/main/res/layout/fragment_barcode_in_collect.xml

@@ -13,6 +13,39 @@
         android:layout_marginTop="@dimen/spacing_big"
         android:stretchColumns="1">
 
+        <TableRow
+            android:id="@+id/material_in_collect_location_tr"
+            android:layout_marginTop="5dp">
+
+            <TextView
+                style="@style/tl_tv_style"
+                android:layout_height="match_parent"
+                android:background="@color/white"
+                android:gravity="center"
+                android:padding="10dp"
+                android:text="仓位"
+                android:textColor="@color/body_text_1"
+                android:textSize="16sp" />
+
+            <com.uas.jc_wms.view.ClearableEditText
+                android:id="@+id/barcode_in_collect_location_et"
+                style="@style/EditTextStyle"
+                android:layout_width="0dp"
+                android:layout_weight="1"
+                android:focusable="true"
+                android:focusableInTouchMode="true"
+                android:hint="请输入仓位"
+                android:textColor="@color/black" />
+            <CheckBox
+                android:id="@+id/ck_isclear"
+                android:layout_gravity="center"
+                android:gravity="center"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="保留仓位"
+                android:checked="true"/>
+        </TableRow>
+
         <TableRow
             android:background="@color/white">
 
@@ -74,31 +107,6 @@
         </TableRow>
 
 
-        <TableRow
-            android:id="@+id/material_in_collect_location_tr"
-            android:layout_marginTop="5dp">
-
-            <TextView
-                style="@style/tl_tv_style"
-                android:layout_height="match_parent"
-                android:background="@color/white"
-                android:gravity="center"
-                android:padding="10dp"
-                android:text="仓位"
-                android:textColor="@color/body_text_1"
-                android:textSize="16sp" />
-
-            <com.uas.jc_wms.view.ClearableEditText
-                android:id="@+id/barcode_in_collect_location_et"
-                style="@style/EditTextStyle"
-                android:layout_width="0dp"
-                android:layout_weight="1"
-                android:focusable="true"
-                android:focusableInTouchMode="true"
-                android:hint="请输入仓位"
-                android:textColor="@color/black" />
-        </TableRow>
-
     </TableLayout>
 
     <Button