Browse Source

入库采集,去掉条码采集框,条码解析事件移到型号输入框处理

RaoMeng 6 years ago
parent
commit
5612db2003

BIN
.idea/caches/build_file_checksums.ser


+ 29 - 34
app/src/main/java/com/uas/keg_storage/fragment/JLTStorageInBarcodeFragment.java

@@ -72,8 +72,8 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
     private PopupWindow mMenuPopupWindow;
     private View mMenuView;
     private TextView mBoxTextView, mPanEditText;
-    private ImageView mCalendarImageView, mScanImageView, mEnclosureFitlerIv, mModelScanIv;
-    private ClearableEditText mDateEditText, mBarcodeEditText, mModelEditText, mQuantityEditText,
+    private ImageView mCalendarImageView, mEnclosureFitlerIv, mModelScanIv;
+    private ClearableEditText mDateEditText, mModelEditText, mQuantityEditText,
             mLotEditText, mPoEditText, mEnclosureEditText, mMpqEditText, mBrandEditText;
     private CheckBox mPoCheckBox;
     private String mBoxNum, mPiInoutno, mPiid, mPiClass, mRealBoxNum, mDatecodebyparse;
@@ -109,8 +109,8 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
         mModelScanIv = root.findViewById(R.id.jlt_storage_in_barcode_model_scan_iv);
         mDateEditText = root.findViewById(R.id.jlt_storage_in_barcode_date_et);
         mBoxTextView = root.findViewById(R.id.jlt_storage_in_barcode_box_tv);
-        mScanImageView = root.findViewById(R.id.jlt_storage_in_barcode_scan_iv);
-        mBarcodeEditText = root.findViewById(R.id.jlt_storage_in_barcode_barcode_et);
+//        mScanImageView = root.findViewById(R.id.jlt_storage_in_barcode_scan_iv);
+//        mBarcodeEditText = root.findViewById(R.id.jlt_storage_in_barcode_barcode_et);
         mModelEditText = root.findViewById(R.id.jlt_storage_in_barcode_model_et);
         mQuantityEditText = root.findViewById(R.id.jlt_storage_in_barcode_quantity_et);
         mMpqEditText = root.findViewById(R.id.jlt_storage_in_barcode_mpq_et);
@@ -121,7 +121,8 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
         mSaveButton = root.findViewById(R.id.jlt_storage_in_barcode_save_btn);
         mNextButton = root.findViewById(R.id.jlt_storage_in_barcode_next_btn);
         mPoCheckBox = root.findViewById(R.id.jlt_storage_in_barcode_po_cb);
-        mBarcodeEditText.requestFocus();
+        mModelEditText.requestFocus();
+//        mBarcodeEditText.requestFocus();
         mEnclosureEditText = root.findViewById(R.id.jlt_storage_in_barcode_enclosure_et);
         mEnclosureFitlerIv = root.findViewById(R.id.jlt_storage_in_barcode_enclosure_filter_iv);
 
@@ -146,7 +147,7 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
     protected void initEvents() {
         mMoreButton.setOnClickListener(this);
         mCalendarImageView.setOnClickListener(this);
-        mScanImageView.setOnClickListener(this);
+//        mScanImageView.setOnClickListener(this);
         mModelScanIv.setOnClickListener(this);
         mSaveButton.setOnClickListener(this);
         mNextButton.setOnClickListener(this);
@@ -163,22 +164,17 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
         mBrandEditText.addTextChangedListener(new MyTextWatcher(mBrandEditText));
         mEnclosureEditText.addTextChangedListener(new MyTextWatcher(mEnclosureEditText));
 
-        CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
-            @Override
-            public void MyEditorAction(String text, int actionId, KeyEvent event) {
-                barcodeParse();
-            }
-        });
+//        CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
+//            @Override
+//            public void MyEditorAction(String text, int actionId, KeyEvent event) {
+//                barcodeParse();
+//            }
+//        });
 
         CommonUtil.setEditorActionListener(mModelEditText, new MyEditorActionListener() {
             @Override
             public void MyEditorAction(String text, int actionId, KeyEvent event) {
-                mQuantityEditText.postDelayed(new Runnable() {
-                    @Override
-                    public void run() {
-                        mQuantityEditText.requestFocus();
-                    }
-                }, 100);
+                barcodeParse();
             }
         });
 
@@ -283,11 +279,11 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
     private void barcodeParse() {
         mEnclosureList.clear();
         mEnclosureEditText.setText("");
-        String barcode = mBarcodeEditText.getText().toString().trim();
-        if (TextUtils.isEmpty(barcode)) {
+        String model = mModelEditText.getText().toString().trim();
+        if (TextUtils.isEmpty(model)) {
             return;
         }
-        mBarcodeParseBean.setDATA(barcode);
+        mBarcodeParseBean.setDATA(model);
 
         progressDialog.show();
 
@@ -295,15 +291,14 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
                 .url(GloableParams.ADDRESS_JLT_RECEIVING_BARCODEPARSE)
                 .method(Request.Method.POST)
                 .tag(TAG + "barcodeparse")
-                .addParam("data", barcode)
+                .addParam("data", model)
                 .addParam("pi_ids", mPiid)
                 .build(), new HttpCallback() {
             @Override
             public void onSuccess(int flag, Object o) throws Exception {
                 progressDialog.dismiss();
                 try {
-                    mBarcodeEditText.setText("");
-                    mBarcodeEditText.requestFocus();
+                    mQuantityEditText.requestFocus();
                     String result = o.toString();
                     JSONObject resultObject = JSON.parseObject(result);
                     JSONObject dataObject = resultObject.getJSONObject("data");
@@ -414,8 +409,8 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
             public void onFail(int flag, String failStr) throws Exception {
                 progressDialog.dismiss();
 
-                mBarcodeEditText.setText("");
-                mBarcodeEditText.requestFocus();
+                mModelEditText.setText("");
+                mModelEditText.requestFocus();
                 mSearchEnclosureAdapter.notifyDataSetChanged();
                 CommonUtil.toastNoRepeat(mActivity, failStr);
             }
@@ -539,9 +534,9 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
                 dialog.setTargetFragment(JLTStorageInBarcodeFragment.this, REQUEST_DATE);
                 dialog.show(fragmentManager, DIALOG_DATE);
                 break;
-            case R.id.jlt_storage_in_barcode_scan_iv:
-                CommonUtil.scanBarcode(mActivity, JLTStorageInBarcodeFragment.this, SCAN_BARCODE_CODE);
-                break;
+//            case R.id.jlt_storage_in_barcode_scan_iv:
+//                CommonUtil.scanBarcode(mActivity, JLTStorageInBarcodeFragment.this, SCAN_BARCODE_CODE);
+//                break;
             case R.id.jlt_storage_in_barcode_model_scan_iv:
                 CommonUtil.scanBarcode(mActivity, JLTStorageInBarcodeFragment.this, SCAN_MODEL_CODE);
                 break;
@@ -566,7 +561,7 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
 
     private void saveBarcode(boolean exist, boolean checkDate) {
         if (TextUtils.isEmpty(mBarcodeParseBean.getPN()) ||
-//                TextUtils.isEmpty(mBarcodeParseBean.getBRAND()) ||
+                TextUtils.isEmpty(mBarcodeParseBean.getBRAND()) ||
                 TextUtils.isEmpty(mBarcodeParseBean.getMPQ())) {
             CommonUtil.toastNoRepeat(mActivity, "请采集条码获取必填数据");
             return;
@@ -706,7 +701,6 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
     }
 
     private void resetState() {
-        mBarcodeEditText.setText("");
         mModelEditText.setText("");
         mQuantityEditText.setText("");
         mMpqEditText.setText("");
@@ -717,7 +711,7 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
         mBrandEditText.setText("");
         mEnclosureEditText.setText("");
 
-        mBarcodeEditText.requestFocus();
+        mModelEditText.requestFocus();
     }
 
 
@@ -737,18 +731,19 @@ public class JLTStorageInBarcodeFragment extends BaseFragment implements View.On
                 mDateEditText.setText("");
             }
         }
-        if (requestCode == SCAN_BARCODE_CODE && data != null) {
+        /*if (requestCode == SCAN_BARCODE_CODE && data != null) {
             if (data.getExtras() != null) {
                 String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
                 mBarcodeEditText.setText(result);
                 mBarcodeEditText.setSelection(result.length());
             }
-        }
+        }*/
         if (requestCode == SCAN_MODEL_CODE && data != null) {
             if (data.getExtras() != null) {
                 String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
                 mModelEditText.setText(result);
                 mModelEditText.setSelection(result.length());
+                barcodeParse();
             }
         }
     }

+ 11 - 10
app/src/main/res/layout/fragment_jlt_storage_in_barcode.xml

@@ -27,7 +27,7 @@
     </LinearLayout>
 
 
-    <LinearLayout
+    <!--<LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="6dp"
@@ -52,7 +52,7 @@
             android:layout_marginRight="10dp"
             android:clickable="false"
             android:src="@drawable/ic_edittext_scan" />
-    </LinearLayout>
+    </LinearLayout>-->
 
     <ScrollView
         android:layout_width="match_parent"
@@ -62,6 +62,7 @@
         <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_marginTop="6dp"
             android:orientation="vertical">
 
             <LinearLayout
@@ -90,9 +91,9 @@
                     android:layout_width="wrap_content"
                     android:layout_height="match_parent"
                     android:layout_gravity="center"
-                    android:paddingRight="10dp"
                     android:background="@color/white"
                     android:clickable="false"
+                    android:paddingRight="10dp"
                     android:src="@drawable/ic_edittext_scan" />
             </LinearLayout>
 
@@ -118,9 +119,9 @@
                     <com.uas.keg_storage.view.ClearableEditText
                         android:id="@+id/jlt_storage_in_barcode_quantity_et"
                         style="@style/EditTextStyle"
-                        android:inputType="numberDecimal"
                         android:layout_width="0dp"
-                        android:layout_weight="1" />
+                        android:layout_weight="1"
+                        android:inputType="numberDecimal" />
                 </LinearLayout>
 
                 <LinearLayout
@@ -140,9 +141,9 @@
                     <com.uas.keg_storage.view.ClearableEditText
                         android:id="@+id/jlt_storage_in_barcode_mpq_et"
                         style="@style/EditTextStyle"
-                        android:inputType="numberDecimal"
                         android:layout_width="0dp"
-                        android:layout_weight="1" />
+                        android:layout_weight="1"
+                        android:inputType="numberDecimal" />
                 </LinearLayout>
             </LinearLayout>
 
@@ -214,7 +215,7 @@
 
                     <com.uas.keg_storage.view.ClearableEditText
                         android:id="@+id/jlt_storage_in_barcode_brand_et"
-                        style="@style/EditTextStyle"
+                        style="@style/EditTextUnableStyle"
                         android:layout_width="0dp"
                         android:layout_weight="1" />
                 </LinearLayout>
@@ -236,9 +237,9 @@
                     <TextView
                         android:id="@+id/jlt_storage_in_barcode_reel_et"
                         style="@style/EditTextUnableStyle"
-                        android:inputType="numberDecimal"
                         android:layout_width="0dp"
-                        android:layout_weight="1" />
+                        android:layout_weight="1"
+                        android:inputType="numberDecimal" />
                 </LinearLayout>
             </LinearLayout>