|
|
@@ -0,0 +1,119 @@
|
|
|
+package com.uas.pda_smart_sa.fragment;
|
|
|
+
|
|
|
+import android.os.Handler;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.uas.pda_smart_sa.R;
|
|
|
+import com.uas.pda_smart_sa.global.GloableParams;
|
|
|
+import com.uas.pda_smart_sa.listener.MyEditorActionListener;
|
|
|
+import com.uas.pda_smart_sa.util.CommonUtil;
|
|
|
+import com.uas.pda_smart_sa.util.HttpCallback;
|
|
|
+import com.uas.pda_smart_sa.util.HttpParams;
|
|
|
+import com.uas.pda_smart_sa.util.VolleyRequest;
|
|
|
+import com.uas.pda_smart_sa.view.ClearableEditText;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by RaoMeng on 2020/9/28
|
|
|
+ * Desc: 出货检验
|
|
|
+ */
|
|
|
+public class DeliveryInspectionFragment extends BaseFragment {
|
|
|
+ private ClearableEditText mBarcodeEditText;
|
|
|
+ private Button mConfirmButton;
|
|
|
+ private TextView mResultTextView;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_delivery_inspection;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ setTitle("出货检验");
|
|
|
+
|
|
|
+ mBarcodeEditText = root.findViewById(R.id.delivery_inspection_barcode_cet);
|
|
|
+ mConfirmButton = root.findViewById(R.id.delivery_inspection_confirm_btn);
|
|
|
+ mResultTextView = root.findViewById(R.id.delivery_inspection_result_tv);
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ CommonUtil.setEditorActionListener(mBarcodeEditText, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ confirmEvent();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mConfirmButton.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ confirmEvent();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void confirmEvent() {
|
|
|
+ String barcode = mBarcodeEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(barcode)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集单号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ mResultTextView.setText("");
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_RESERVE_CONFIRMTHENAGREE)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("code", barcode)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "单号:" + barcode + "审核成功");
|
|
|
+ mResultTextView.setText("单号:" + barcode + "审核成功");
|
|
|
+ new Handler().postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+ }, 150);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ CommonUtil.makeNotice();
|
|
|
+ mResultTextView.setText(failStr);
|
|
|
+ new Handler().postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+ }, 150);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|