|
@@ -0,0 +1,1653 @@
|
|
|
+package com.uas.pda_smart_com.fragment;
|
|
|
+
|
|
|
+import android.app.Activity;
|
|
|
+import android.app.Dialog;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.support.v4.app.Fragment;
|
|
|
+import android.support.v4.app.FragmentManager;
|
|
|
+import android.support.v7.app.AlertDialog;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.Editable;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.text.TextWatcher;
|
|
|
+import android.text.format.DateFormat;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.view.inputmethod.InputMethodManager;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
+import android.widget.RadioButton;
|
|
|
+import android.widget.RadioGroup;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.AuthFailureError;
|
|
|
+import com.android.volley.DefaultRetryPolicy;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.android.volley.Response;
|
|
|
+import com.android.volley.VolleyError;
|
|
|
+import com.android.volley.toolbox.StringRequest;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.uas.pda_smart_com.R;
|
|
|
+import com.uas.pda_smart_com.activity.FunctionActivity;
|
|
|
+import com.uas.pda_smart_com.adapter.JLTSearchWhcodeAdapter;
|
|
|
+import com.uas.pda_smart_com.adapter.NewJLTStorageInTodoAdapter;
|
|
|
+import com.uas.pda_smart_com.adapter.SecondaryListAdapter;
|
|
|
+import com.uas.pda_smart_com.application.PdaApplication;
|
|
|
+import com.uas.pda_smart_com.bean.JLTBarcodeParseBean;
|
|
|
+import com.uas.pda_smart_com.bean.JLTBrandEntity;
|
|
|
+import com.uas.pda_smart_com.bean.JLTMpqEntity;
|
|
|
+import com.uas.pda_smart_com.bean.JLTPkgEntity;
|
|
|
+import com.uas.pda_smart_com.bean.JLTStorageModelBean;
|
|
|
+import com.uas.pda_smart_com.bean.WhcodeBean;
|
|
|
+import com.uas.pda_smart_com.global.GloableParams;
|
|
|
+import com.uas.pda_smart_com.listener.MyEditorActionListener;
|
|
|
+import com.uas.pda_smart_com.tools.SharedPreUtil;
|
|
|
+import com.uas.pda_smart_com.tools.VolleyUtil;
|
|
|
+import com.uas.pda_smart_com.util.CommonUtil;
|
|
|
+import com.uas.pda_smart_com.util.Constants;
|
|
|
+import com.uas.pda_smart_com.util.DateFormatUtil;
|
|
|
+import com.uas.pda_smart_com.util.FastjsonUtil;
|
|
|
+import com.uas.pda_smart_com.util.FragmentUtils;
|
|
|
+import com.uas.pda_smart_com.util.HttpCallback;
|
|
|
+import com.uas.pda_smart_com.util.HttpParams;
|
|
|
+import com.uas.pda_smart_com.util.StringUtil;
|
|
|
+import com.uas.pda_smart_com.util.VolleyRequest;
|
|
|
+import com.uas.pda_smart_com.util.VollyRequest;
|
|
|
+import com.uas.pda_smart_com.view.ClearableEditText;
|
|
|
+import com.uas.pda_smart_com.view.RecyclerItemDecoration;
|
|
|
+import com.uas.pda_smart_com.view.business.CommonSelectPop;
|
|
|
+import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
+
|
|
|
+import org.json.JSONException;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by RaoMeng on 2019/2/25
|
|
|
+ * Desc: 库存条码绑定
|
|
|
+ */
|
|
|
+public class InventoryBindingFragment extends BaseFragment implements View.OnClickListener {
|
|
|
+ private String DIALOG_DATE = "DialogDate";
|
|
|
+ private static final int REQUEST_DATE = 11;
|
|
|
+ private static final int SCAN_BARCODE_CODE = 101;
|
|
|
+ private static final int SCAN_MODEL_CODE = 102;
|
|
|
+ private Button mMoreButton, mSaveButton, mNextButton;
|
|
|
+ private PopupWindow mMenuPopupWindow;
|
|
|
+ private View mMenuView;
|
|
|
+ private TextView mBoxTextView, mPanEditText;
|
|
|
+ private ImageView mCalendarImageView, mEnclosureFitlerIv, mModelScanIv, mBarcodeScanIv;
|
|
|
+ private ClearableEditText mDateEditText, mModelEditText, mQuantityEditText,
|
|
|
+ mLotEditText, mPoEditText, mEnclosureEditText, mMpqEditText, mBrandEditText, mBarcodeEditText;
|
|
|
+ private CheckBox mPoCheckBox;
|
|
|
+ private String mBoxNum, mPiInoutno, mPiid, mPiClass, mRealBoxNum, mDatecodebyparse,pd_whcode;
|
|
|
+ private JLTBarcodeParseBean mBarcodeParseBean;
|
|
|
+ private RecyclerView mEnclosureRecyclerView;
|
|
|
+ private Dialog mEnclosureDialog;
|
|
|
+ private OnFinishListener mOnFinishListener;
|
|
|
+ private List<WhcodeBean> mEnclosureList;
|
|
|
+ private JLTSearchWhcodeAdapter mSearchEnclosureAdapter;
|
|
|
+ private CommonSelectPop mBrandSelectPop, mEnclosureSelectPop, mMpqSelectPop;
|
|
|
+ private boolean isMpqDiv = false;
|
|
|
+ private List<JLTBrandEntity> mBrandEntities;
|
|
|
+ private List<JLTPkgEntity> mPkgEntities;
|
|
|
+ private List<JLTMpqEntity> mMpqEntities;
|
|
|
+ private TextView mTypeTextView;
|
|
|
+ private NewJLTStorageInTodoAdapter mStorageInTodoAdapter;
|
|
|
+ private RecyclerView mRecyclerView;
|
|
|
+ private CheckBox jlt_check_ok;
|
|
|
+ private LinearLayout jlt_storage_in_barcode_line;
|
|
|
+ private ClearableEditText jlt_storage_in_barcode_et;
|
|
|
+ private int mFocusId;
|
|
|
+ private RadioGroup mMenuRadioGroup;
|
|
|
+ private RadioButton mInfoRadioButton;
|
|
|
+ private RadioButton mSignRadioButton;
|
|
|
+ private LinearLayout jlt_line_edit;
|
|
|
+ private ClearableEditText jlt_edit_lotno;
|
|
|
+ private ClearableEditText jlt_edit_dataecode;
|
|
|
+ private ClearableEditText jlt_edit_dc;
|
|
|
+ private ClearableEditText jlt_edit_qty;
|
|
|
+ private String prodcode;
|
|
|
+ private Fragment mFragment;
|
|
|
+ private StringRequest mStringRequest;
|
|
|
+ private TextView mResultTextView;
|
|
|
+ private String jlt_storage_in_barcode_etstrim;
|
|
|
+ private CheckBox check_box_positions;
|
|
|
+ private CheckBox check_box_lono;
|
|
|
+ private CheckBox check_box_date;
|
|
|
+ private CheckBox check_box_dc;
|
|
|
+ private ClearableEditText jlt_edit_warehouse;
|
|
|
+ private InputMethodManager imm;
|
|
|
+
|
|
|
+ public void setOnFinishListener(OnFinishListener onFinishListener) {
|
|
|
+ mOnFinishListener = onFinishListener;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_inventory_binging;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ ((FunctionActivity) getActivity()).setTitle("库存条码绑定");
|
|
|
+
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
|
|
|
+
|
|
|
+ mMoreButton = (Button) getActivity().findViewById(R.id.btn_actionbar_more);
|
|
|
+ mCalendarImageView = root.findViewById(R.id.jlt_storage_in_barcode_date_iv);
|
|
|
+ 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);
|
|
|
+ mBarcodeScanIv = 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);
|
|
|
+ mLotEditText = root.findViewById(R.id.jlt_storage_in_barcode_lot_et);
|
|
|
+ mPanEditText = root.findViewById(R.id.jlt_storage_in_barcode_reel_et);
|
|
|
+ mPoEditText = root.findViewById(R.id.jlt_storage_in_barcode_po_et);
|
|
|
+ mBrandEditText = root.findViewById(R.id.jlt_storage_in_barcode_brand_et);
|
|
|
+ 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);
|
|
|
+ mResultTextView = root.findViewById(R.id.material_in_collect_result_tv);
|
|
|
+// 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);
|
|
|
+
|
|
|
+ jlt_check_ok = root.findViewById(R.id.jlt_check_ok);
|
|
|
+ //条码框
|
|
|
+ jlt_storage_in_barcode_line = root.findViewById(R.id.jlt_storage_in_barcode_line);
|
|
|
+ jlt_storage_in_barcode_et = root.findViewById(R.id.jlt_storage_in_barcode_et);
|
|
|
+ //RadioGroup
|
|
|
+ mMenuRadioGroup = root.findViewById(R.id.jlt_pick_material_out_scan_menu_rg);
|
|
|
+ mInfoRadioButton = root.findViewById(R.id.jlt_pick_material_out_scan_info_rb);
|
|
|
+ mSignRadioButton = root.findViewById(R.id.jlt_pick_material_out_scan_sign_rb);
|
|
|
+ jlt_line_edit = root.findViewById(R.id.jlt_line_edit);
|
|
|
+
|
|
|
+ //输入框
|
|
|
+ //LotNo
|
|
|
+ jlt_edit_lotno = root.findViewById(R.id.jlt_edit_lotno);
|
|
|
+ jlt_edit_dataecode = root.findViewById(R.id.jlt_edit_dataecode);
|
|
|
+ jlt_edit_dc = root.findViewById(R.id.jlt_edit_DC);
|
|
|
+ jlt_edit_qty = root.findViewById(R.id.jlt_edit_QTY);
|
|
|
+ jlt_edit_warehouse = root.findViewById(R.id.jlt_edit_warehouse);
|
|
|
+ /**
|
|
|
+ * 勾选框
|
|
|
+ */
|
|
|
+ //仓位
|
|
|
+ check_box_positions = root.findViewById(R.id.check_box_positions);
|
|
|
+ //LoNo
|
|
|
+ check_box_lono = root.findViewById(R.id.check_box_lono);
|
|
|
+ //日期
|
|
|
+ check_box_date = root.findViewById(R.id.check_box_date);
|
|
|
+ //字符
|
|
|
+ check_box_dc = root.findViewById(R.id.check_box_dc);
|
|
|
+ LinearLayout linecheck_tv = root.findViewById(R.id.linecheck_tv);
|
|
|
+ linecheck_tv.setVisibility(View.GONE);
|
|
|
+ mBarcodeParseBean = new JLTBarcodeParseBean();
|
|
|
+ mBarcodeParseBean.setCHECKPO("N");
|
|
|
+
|
|
|
+ View enclosureView = View.inflate(mActivity, R.layout.dialog_jlt_search_whcode, null);
|
|
|
+ mEnclosureRecyclerView = enclosureView.findViewById(R.id.item_jlt_search_whcode_rv);
|
|
|
+ mEnclosureRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ mEnclosureRecyclerView.addItemDecoration(new RecyclerItemDecoration(1));
|
|
|
+ mEnclosureList = new ArrayList<>();
|
|
|
+ mSearchEnclosureAdapter = new JLTSearchWhcodeAdapter(mEnclosureList);
|
|
|
+ mEnclosureRecyclerView.setAdapter(mSearchEnclosureAdapter);
|
|
|
+ mEnclosureDialog = new AlertDialog.Builder(mActivity).setView(enclosureView).create();
|
|
|
+
|
|
|
+ mBrandSelectPop = new CommonSelectPop(mActivity, "请选择品牌");
|
|
|
+ mEnclosureSelectPop = new CommonSelectPop(mActivity, "请选择封装方式");
|
|
|
+ mMpqSelectPop = new CommonSelectPop(mActivity, "请选择MPQ");
|
|
|
+
|
|
|
+
|
|
|
+ mTypeTextView = root.findViewById(R.id.jlt_storage_in_todo_list_tv);
|
|
|
+ mRecyclerView = root.findViewById(R.id.jlt_storage_in_todo_list_rv);
|
|
|
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ mRecyclerView.addItemDecoration(new RecyclerItemDecoration(2));
|
|
|
+ mStorageInTodoAdapter = new NewJLTStorageInTodoAdapter(mActivity);
|
|
|
+ mFocusId = root.findFocus().getId();
|
|
|
+ CheckBoxData();
|
|
|
+ imm = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+
|
|
|
+ mMoreButton.setOnClickListener(this);
|
|
|
+ mCalendarImageView.setOnClickListener(this);
|
|
|
+ mBarcodeScanIv.setOnClickListener(this);
|
|
|
+ mModelScanIv.setOnClickListener(this);
|
|
|
+ mSaveButton.setOnClickListener(this);
|
|
|
+ mNextButton.setOnClickListener(this);
|
|
|
+ mEnclosureEditText.setOnClickListener(this);
|
|
|
+ mEnclosureFitlerIv.setOnClickListener(this);
|
|
|
+
|
|
|
+ mModelEditText.addTextChangedListener(new MyTextWatcher(mModelEditText));
|
|
|
+ mQuantityEditText.addTextChangedListener(new MyTextWatcher(mQuantityEditText));
|
|
|
+ mMpqEditText.addTextChangedListener(new MyTextWatcher(mMpqEditText));
|
|
|
+ mDateEditText.addTextChangedListener(new MyTextWatcher(mDateEditText));
|
|
|
+ mLotEditText.addTextChangedListener(new MyTextWatcher(mLotEditText));
|
|
|
+ mPanEditText.addTextChangedListener(new MyTextWatcher(mPanEditText));
|
|
|
+ mPoEditText.addTextChangedListener(new MyTextWatcher(mPoEditText));
|
|
|
+ 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(text);
|
|
|
+ if (!text.isEmpty()){
|
|
|
+ SharedPreUtil.saveString(mActivity,"house_text",text);
|
|
|
+ }
|
|
|
+
|
|
|
+ confirmRequest(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //QTY回车
|
|
|
+ CommonUtil.setEditorActionListener(jlt_edit_qty, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ newlineqtyEnter();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ //输入条码号回车
|
|
|
+ CommonUtil.setEditorActionListener(jlt_storage_in_barcode_et, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ newlinebarcodeEnter();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //仓位回车
|
|
|
+ CommonUtil.setEditorActionListener(mLotEditText, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ newlinemLotEnter();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //LONO回车
|
|
|
+ CommonUtil.setEditorActionListener(jlt_edit_lotno, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ newlinemLotonEnter();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //日期回车
|
|
|
+ CommonUtil.setEditorActionListener(jlt_edit_dataecode, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ newlinemdateEnter();
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //字符回车
|
|
|
+ CommonUtil.setEditorActionListener(jlt_edit_dc, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// CommonUtil.setEditorActionListener(mModelEditText, new MyEditorActionListener() {
|
|
|
+// @Override
|
|
|
+// public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+// modelParse();
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+ CommonUtil.setEditorActionListener(mMpqEditText, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ mBrandEditText.postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ mBrandEditText.requestFocus();
|
|
|
+ }
|
|
|
+ }, 100);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mPoCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ mBarcodeParseBean.setCHECKPO(isChecked ? "Y" : "N");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mSearchEnclosureAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ mBarcodeParseBean.setPRCODE(mEnclosureList.get(position).getWH_TYPE());
|
|
|
+
|
|
|
+ mEnclosureEditText.setText(mEnclosureList.get(position).getWH_CODE());
|
|
|
+ mEnclosureDialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mBrandSelectPop.setOnDataSelectListener(new CommonSelectPop.OnDataSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onDataSelect(int position) {
|
|
|
+ mBrandSelectPop.dismiss();
|
|
|
+ JLTBrandEntity brandEntity = mBrandEntities.get(position);
|
|
|
+ selectPkg(brandEntity);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mEnclosureSelectPop.setOnDataSelectListener(new CommonSelectPop.OnDataSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onDataSelect(int position) {
|
|
|
+ JLTPkgEntity pkgEntity = mPkgEntities.get(position);
|
|
|
+ String qtyStr = mQuantityEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(qtyStr)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "数量为空,请先采集数量信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ mEnclosureSelectPop.dismiss();
|
|
|
+ double qty = Double.parseDouble(qtyStr);
|
|
|
+ selectMpq(qty, pkgEntity);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mMpqSelectPop.setOnDataSelectListener(new CommonSelectPop.OnDataSelectListener() {
|
|
|
+ @Override
|
|
|
+ public void onDataSelect(int position) {
|
|
|
+ mMpqSelectPop.dismiss();
|
|
|
+ double qty = mBarcodeParseBean.getQTY();
|
|
|
+ if (qty != -1) {
|
|
|
+ double mpq = mMpqEntities.get(position).getMPQ();
|
|
|
+ verifyPan(qty, mpq);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ CommonUtil.setEditorActionListener(mQuantityEditText, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ String mpq = mMpqEditText.getText().toString().trim();
|
|
|
+ String qty = mQuantityEditText.getText().toString().trim();
|
|
|
+
|
|
|
+ if (TextUtils.isEmpty(mpq)) {
|
|
|
+ mMpqEditText.setText(qty);
|
|
|
+ }
|
|
|
+ mMpqEditText.requestFocus();
|
|
|
+ mMpqEditText.setSelection(mMpqEditText.getText().toString().trim().length());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mStorageInTodoAdapter.setOnSubItemClickListener(new NewJLTStorageInTodoAdapter.OnSubItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onSubItemClick(JLTStorageModelBean jltStorageModelBean) {
|
|
|
+ List<SecondaryListAdapter.SecondaryListBean<String, JLTStorageModelBean>> datas = mStorageInTodoAdapter.getDatas();
|
|
|
+ if (datas.size()!=0){
|
|
|
+ mModelEditText.setText(jltStorageModelBean.getPr_brand());
|
|
|
+ mModelEditText.requestFocus();
|
|
|
+ mModelEditText.setSelection(mModelEditText.getText().length());
|
|
|
+// mLotEditText.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+// mMenuRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
|
|
+// @Override
|
|
|
+// public void onCheckedChanged(RadioGroup group, int checkedId) {
|
|
|
+// if (checkedId == R.id.jlt_pick_material_out_scan_info_rb) {
|
|
|
+// mRecyclerView.setVisibility(View.GONE);
|
|
|
+// jlt_line_edit.setVisibility(View.VISIBLE);
|
|
|
+// } else if (checkedId == R.id.jlt_pick_material_out_scan_sign_rb) {
|
|
|
+// mRecyclerView.setVisibility(View.VISIBLE);
|
|
|
+// jlt_line_edit.setVisibility(View.GONE);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+ }
|
|
|
+ public void CheckBoxData(){
|
|
|
+ String ischecheds = SharedPreUtil.getString(mActivity, Constants.JLTSTORAGEINISCHCKED, null);
|
|
|
+ if (StringUtil.isEmpty(ischecheds)){
|
|
|
+ jlt_check_ok.setChecked(true);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.JLTSTORAGEINISCHCKED, "true");
|
|
|
+ }else {
|
|
|
+ if ("true".equals(ischecheds)){
|
|
|
+ jlt_check_ok.setChecked(true);
|
|
|
+ jlt_storage_in_barcode_line.setVisibility(View.VISIBLE);
|
|
|
+ }else {
|
|
|
+ jlt_check_ok.setChecked(false);
|
|
|
+ jlt_storage_in_barcode_line.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ jlt_check_ok.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked==true){
|
|
|
+ jlt_storage_in_barcode_line.setVisibility(View.VISIBLE);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.JLTSTORAGEINISCHCKED, "true");
|
|
|
+ }else {
|
|
|
+ jlt_storage_in_barcode_line.setVisibility(View.GONE);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.JLTSTORAGEINISCHCKED, "false");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ Bundle bundle = getArguments();
|
|
|
+ if (bundle != null) {
|
|
|
+ mBoxNum = bundle.getString("boxNum");
|
|
|
+ mPiid = bundle.getString("pi_id");
|
|
|
+ mPiClass = bundle.getString("pi_class");
|
|
|
+ mPiInoutno = bundle.getString("pi_inoutno");
|
|
|
+ pd_whcode = bundle.getString("pd_whcode");
|
|
|
+ }
|
|
|
+
|
|
|
+ mBoxTextView.setText(mPiInoutno);
|
|
|
+ mBarcodeParseBean.setOUTBOX(mBoxNum);
|
|
|
+
|
|
|
+ mTypeTextView.setText(mPiClass);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void barcodeParse(String barcode) {
|
|
|
+ if (TextUtils.isEmpty(barcode)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String mModelEditTexttrim = this.mModelEditText.getText().toString().trim();
|
|
|
+ String mLotEditTexttrim = mLotEditText.getText().toString().trim();
|
|
|
+ String mBarcodeEditTexttrim = mBarcodeEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(mBarcodeEditTexttrim)){
|
|
|
+ CommonUtil.toastNoRepeat(getContext(),"请输入条码号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// if (TextUtils.isEmpty(mModelEditTexttrim)){
|
|
|
+// CommonUtil.toastNoRepeat(getContext(),"请输入品牌");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// if (TextUtils.isEmpty(mLotEditTexttrim)){
|
|
|
+// CommonUtil.toastNoRepeat(getContext(),"请输入仓位");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_RECEIVING_BARCODEPARSE2)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("data", barcode)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mModelEditText.requestFocus();
|
|
|
+ confirmRequest(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void modelParse() {
|
|
|
+ mEnclosureList.clear();
|
|
|
+ mEnclosureEditText.setText("");
|
|
|
+ String model = mModelEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(model)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ mBarcodeParseBean.setDATA(model);
|
|
|
+
|
|
|
+ progressDialog.show();
|
|
|
+
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_JLT_RECEIVING_BARCODEPARSE)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "barcodeparse")
|
|
|
+ .addParam("data", model)
|
|
|
+ .addParam("pi_ids", mPiid)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mQuantityEditText.requestFocus();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ JSONArray brandArray = dataObject.getJSONArray("BRANDLIST");
|
|
|
+ if (brandArray != null && brandArray.size() > 0) {
|
|
|
+ JSONObject testBrand = brandArray.getJSONObject(0);
|
|
|
+ if (TextUtils.isEmpty(mQuantityEditText.getText().toString().trim())
|
|
|
+ && TextUtils.isEmpty(FastjsonUtil.getText(testBrand, "QTY"))) {
|
|
|
+ if (!TextUtils.isEmpty(FastjsonUtil.getText(testBrand, "PN"))
|
|
|
+ || !TextUtils.isEmpty(FastjsonUtil.getText(testBrand, "PKGLIST"))) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请先采集数量");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mBrandEntities == null) {
|
|
|
+ mBrandEntities = new ArrayList<>();
|
|
|
+ } else {
|
|
|
+ mBrandEntities.clear();
|
|
|
+ }
|
|
|
+ for (int i = 0; i < brandArray.size(); i++) {
|
|
|
+ JSONObject brandObject = brandArray.getJSONObject(i);
|
|
|
+ if (brandObject != null) {
|
|
|
+ JLTBrandEntity brandEntity = new JLTBrandEntity();
|
|
|
+ brandEntity.setBRAND(FastjsonUtil.getText(brandObject, "BRAND"));
|
|
|
+ brandEntity.setORDERCODE(FastjsonUtil.getText(brandObject, "ORDERCODE"));
|
|
|
+ if (!TextUtils.isEmpty(FastjsonUtil.getText(brandObject, "QTY"))) {
|
|
|
+ brandEntity.setQTY(FastjsonUtil.getDouble(brandObject, "QTY"));
|
|
|
+ } else {
|
|
|
+ brandEntity.setQTY(mBarcodeParseBean.getQTY());
|
|
|
+ }
|
|
|
+ brandEntity.setDATECODE(FastjsonUtil.getText(brandObject, "DATECODE"));
|
|
|
+ brandEntity.setLOTNO(FastjsonUtil.getText(brandObject, "LOTNO"));
|
|
|
+ brandEntity.setOUTBOX(FastjsonUtil.getText(brandObject, "OUTBOX"));
|
|
|
+ brandEntity.setDATECODEBYPARSE(FastjsonUtil.getText(brandObject, "DATECODEBYPARSE"));
|
|
|
+ brandEntity.setIsCheck(FastjsonUtil.getBoolean(brandObject, "isCheck"));
|
|
|
+ brandEntity.setPN(FastjsonUtil.getText(brandObject, "PN"));
|
|
|
+
|
|
|
+ JSONArray pkgArray = brandObject.getJSONArray("PKGLIST");
|
|
|
+ List<JLTPkgEntity> pkgEntities = null;
|
|
|
+ if (pkgArray != null && pkgArray.size() > 0) {
|
|
|
+ pkgEntities = new ArrayList<>();
|
|
|
+ for (int j = 0; j < pkgArray.size(); j++) {
|
|
|
+ JSONObject pkgObject = pkgArray.getJSONObject(j);
|
|
|
+ if (pkgObject != null) {
|
|
|
+ JLTPkgEntity pkgEntity = new JLTPkgEntity();
|
|
|
+
|
|
|
+ pkgEntity.setPR_CODE(FastjsonUtil.getText(pkgObject, "PR_CODE"));
|
|
|
+ pkgEntity.setPR_PKG(FastjsonUtil.getText(pkgObject, "PR_PKG"));
|
|
|
+ pkgEntity.setPR_FBBZL_USER(FastjsonUtil.getInt(pkgObject, "PR_FBBZL_USER"));
|
|
|
+
|
|
|
+ JSONArray mpqArray = pkgObject.getJSONArray("MPQ");
|
|
|
+ List<JLTMpqEntity> mpqEntities = null;
|
|
|
+ if (mpqArray != null && mpqArray.size() > 0) {
|
|
|
+ mpqEntities = new ArrayList<>();
|
|
|
+ for (int k = 0; k < mpqArray.size(); k++) {
|
|
|
+ JLTMpqEntity mpqEntity = new JLTMpqEntity();
|
|
|
+ Double mpq = mpqArray.getDouble(k);
|
|
|
+ mpqEntity.setMPQ(mpq);
|
|
|
+
|
|
|
+ mpqEntities.add(mpqEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pkgEntity.setMPQLIST(mpqEntities);
|
|
|
+
|
|
|
+ pkgEntities.add(pkgEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ brandEntity.setPKGLIST(pkgEntities);
|
|
|
+
|
|
|
+ mBrandEntities.add(brandEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (mBrandEntities.size() == 1) {
|
|
|
+ JLTBrandEntity brandEntity = (JLTBrandEntity) mBrandEntities.get(0);
|
|
|
+ selectPkg(brandEntity);
|
|
|
+ } else if (mBrandEntities.size() > 1) {
|
|
|
+ mBrandSelectPop.setData(mBrandEntities);
|
|
|
+ mBrandSelectPop.showPopupWindow();
|
|
|
+ }
|
|
|
+
|
|
|
+/*
|
|
|
+ JSONArray pkgArray = dataObject.getJSONArray("PKGLIST");
|
|
|
+ if (pkgArray != null && pkgArray.size() > 0) {
|
|
|
+ for (int i = 0; i < pkgArray.size(); i++) {
|
|
|
+ JSONObject pkgObject = pkgArray.getJSONObject(i);
|
|
|
+ if (pkgObject != null) {
|
|
|
+ WhcodeBean enclosureBean = new WhcodeBean();
|
|
|
+ enclosureBean.setWhCode(FastjsonUtil.getText(pkgObject, "PR_PKG"));
|
|
|
+ enclosureBean.setPrcode(FastjsonUtil.getText(pkgObject, "PR_CODE"));
|
|
|
+
|
|
|
+ mEnclosureList.add(enclosureBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mSearchEnclosureAdapter.notifyDataSetChanged();*/
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+
|
|
|
+ mModelEditText.setText("");
|
|
|
+ mModelEditText.requestFocus();
|
|
|
+ mSearchEnclosureAdapter.notifyDataSetChanged();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setValuableText(TextView view, String text) {
|
|
|
+ if (!TextUtils.isEmpty(text)) {
|
|
|
+ view.setText(text);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void selectPkg(JLTBrandEntity brandEntity) {
|
|
|
+ setValuableText(mBrandEditText, brandEntity.getBRAND());
|
|
|
+ setValuableText(mPoEditText, brandEntity.getORDERCODE());
|
|
|
+ String po = mPoEditText.getText().toString().trim();
|
|
|
+ mPoCheckBox.setChecked(!TextUtils.isEmpty(po));
|
|
|
+ double qty = brandEntity.getQTY();
|
|
|
+ if (qty > 0) {
|
|
|
+ mQuantityEditText.setText(CommonUtil.doubleFormat(qty));
|
|
|
+ }
|
|
|
+ setValuableText(mDateEditText,
|
|
|
+ TextUtils.isEmpty(brandEntity.getDATECODEBYPARSE()) ? brandEntity.getDATECODE() : brandEntity.getDATECODEBYPARSE());
|
|
|
+ setValuableText(mLotEditText, brandEntity.getLOTNO());
|
|
|
+ setValuableText(mModelEditText, brandEntity.getPN());
|
|
|
+
|
|
|
+ if (!TextUtils.isEmpty(brandEntity.getOUTBOX())) {
|
|
|
+ mRealBoxNum = brandEntity.getOUTBOX();
|
|
|
+ }
|
|
|
+ if (!TextUtils.isEmpty(brandEntity.getDATECODEBYPARSE())) {
|
|
|
+ mDatecodebyparse = brandEntity.getDATECODEBYPARSE();
|
|
|
+ }
|
|
|
+
|
|
|
+ List<JLTPkgEntity> pkglist = brandEntity.getPKGLIST();
|
|
|
+ mPkgEntities = pkglist;
|
|
|
+ if (mPkgEntities.size() == 1) {
|
|
|
+ JLTPkgEntity pkgEntity = mPkgEntities.get(0);
|
|
|
+
|
|
|
+ selectMpq(qty, pkgEntity);
|
|
|
+ } else if (mPkgEntities.size() > 1) {
|
|
|
+ mEnclosureSelectPop.setData(mPkgEntities);
|
|
|
+ mEnclosureSelectPop.showPopupWindow();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void selectMpq(double qty, JLTPkgEntity pkgEntity) {
|
|
|
+ mBarcodeParseBean.setPRCODE(pkgEntity.getPR_CODE());
|
|
|
+ mEnclosureEditText.setText(pkgEntity.getPR_PKG());
|
|
|
+ isMpqDiv = pkgEntity.getPR_FBBZL_USER() == 0;
|
|
|
+
|
|
|
+ List<JLTMpqEntity> mpqlist = pkgEntity.getMPQLIST();
|
|
|
+ if (mpqlist == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<JLTMpqEntity> requireMpqs = new ArrayList<>();
|
|
|
+ for (int i = 0; i < mpqlist.size(); i++) {
|
|
|
+ JLTMpqEntity mpqEntity = mpqlist.get(i);
|
|
|
+ try {
|
|
|
+ double mpqNum = mpqEntity.getMPQ();
|
|
|
+ double v = qty / mpqNum;
|
|
|
+ if (CommonUtil.isIntegerForDouble(v)) {
|
|
|
+ requireMpqs.add(mpqEntity);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (requireMpqs.size() == 1) {
|
|
|
+ verifyPan(qty, requireMpqs.get(0).getMPQ());
|
|
|
+ } else if (isMpqDiv) {
|
|
|
+ if (requireMpqs.size() == 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "采集数不满足最小包,请重新采集!");
|
|
|
+ } else {
|
|
|
+ showMpqPop(requireMpqs);
|
|
|
+ }
|
|
|
+ } else if (mpqlist.size() > 0) {
|
|
|
+ if (mpqlist.size() == 1) {
|
|
|
+ verifyPan(qty, mpqlist.get(0).getMPQ());
|
|
|
+ } else {
|
|
|
+ showMpqPop(mpqlist);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void showMpqPop(List<JLTMpqEntity> mpqlist) {
|
|
|
+ mMpqEntities = mpqlist;
|
|
|
+ mMpqSelectPop.setData(mMpqEntities);
|
|
|
+ mMpqSelectPop.showPopupWindow();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void verifyPan(double qty, double mpq) {
|
|
|
+ try {
|
|
|
+ double pan = qty / mpq;
|
|
|
+ if (isMpqDiv) {
|
|
|
+ if (!CommonUtil.isIntegerForDouble(pan)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "采集数不满足最小包,请重新采集!");
|
|
|
+ } else {
|
|
|
+ mPanEditText.setText(CommonUtil.doubleFormat(Math.ceil(pan)));
|
|
|
+ mMpqEditText.setText(CommonUtil.doubleFormat(mpq));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mPanEditText.setText(CommonUtil.doubleFormat(Math.ceil(pan)));
|
|
|
+ mMpqEditText.setText(CommonUtil.doubleFormat(mpq));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ mPanEditText.setText(0);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ switch (v.getId()) {
|
|
|
+ case R.id.btn_actionbar_more:
|
|
|
+ showMoreMenu();
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_date_iv:
|
|
|
+ FragmentManager fragmentManager = getFragmentManager();
|
|
|
+ DatePickerFragment dialog = new DatePickerFragment();
|
|
|
+ dialog.setTargetFragment(InventoryBindingFragment.this, REQUEST_DATE);
|
|
|
+ dialog.show(fragmentManager, DIALOG_DATE);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_scan_iv:
|
|
|
+ CommonUtil.scanBarcode(mActivity, InventoryBindingFragment.this, SCAN_BARCODE_CODE);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_model_scan_iv:
|
|
|
+ CommonUtil.scanBarcode(mActivity, InventoryBindingFragment.this, SCAN_MODEL_CODE);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_save_btn:
|
|
|
+// saveBarcode(false, true);
|
|
|
+
|
|
|
+ clearableedittextjudge();
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_next_btn:
|
|
|
+ saveBarcode(true, true);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_enclosure_et:
|
|
|
+ case R.id.jlt_storage_in_barcode_enclosure_filter_iv:
|
|
|
+ if (mPkgEntities.size() <= 1) {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "封装形式为空");
|
|
|
+ } else {
|
|
|
+ mEnclosureSelectPop.showPopupWindow();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //输入框回车换行
|
|
|
+ public void newlineqtyEnter (){
|
|
|
+ String jlt_storage_in_barcode_ets = jlt_storage_in_barcode_et.getText().toString().trim();
|
|
|
+ String mLotEditTexts = mLotEditText.getText().toString().trim();//仓位
|
|
|
+ String jlt_edit_lotnos = jlt_edit_lotno.getText().toString().trim();//LoNo
|
|
|
+ String jlt_edit_dataecodes = jlt_edit_dataecode.getText().toString().trim();//日期
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ if (jlt_check_ok.isChecked()==true&&jlt_storage_in_barcode_ets.isEmpty()){
|
|
|
+ jlt_storage_in_barcode_et.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_positions.isChecked()==true&&mLotEditTexts.isEmpty()){
|
|
|
+ mLotEditText.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_lono.isChecked()==true&&jlt_edit_lotnos.isEmpty()){
|
|
|
+ jlt_edit_lotno.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_date.isChecked()==true&&jlt_edit_dataecodes.isEmpty()){
|
|
|
+ jlt_edit_dataecode.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ jlt_edit_dc.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ public void newlinebarcodeEnter(){
|
|
|
+ String mLotEditTexts = mLotEditText.getText().toString().trim();//仓位
|
|
|
+ String jlt_edit_lotnos = jlt_edit_lotno.getText().toString().trim();//LoNo
|
|
|
+ String jlt_edit_dataecodes = jlt_edit_dataecode.getText().toString().trim();//日期
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ if (check_box_positions.isChecked()==true&&mLotEditTexts.isEmpty()){
|
|
|
+ mLotEditText.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_lono.isChecked()==true&&jlt_edit_lotnos.isEmpty()){
|
|
|
+ jlt_edit_lotno.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_date.isChecked()==true&&jlt_edit_dataecodes.isEmpty()){
|
|
|
+ jlt_edit_dataecode.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ jlt_edit_dc.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ public void newlinemLotEnter(){
|
|
|
+ String jlt_edit_lotnos = jlt_edit_lotno.getText().toString().trim();//LoNo
|
|
|
+ String jlt_edit_dataecodes = jlt_edit_dataecode.getText().toString().trim();//日期
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ if (check_box_lono.isChecked()==true&&jlt_edit_lotnos.isEmpty()){
|
|
|
+ jlt_edit_lotno.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_date.isChecked()==true&&jlt_edit_dataecodes.isEmpty()){
|
|
|
+ jlt_edit_dataecode.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ jlt_edit_dc.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ public void newlinemLotonEnter(){
|
|
|
+ String jlt_edit_dataecodes = jlt_edit_dataecode.getText().toString().trim();//日期
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ if (check_box_date.isChecked()==true&&jlt_edit_dataecodes.isEmpty()){
|
|
|
+ jlt_edit_dataecode.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ jlt_edit_dc.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ public void newlinemdateEnter(){
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ jlt_edit_dc.requestFocus();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ clearableedittextjudge();
|
|
|
+ }
|
|
|
+ public void clearableedittextjudge(){
|
|
|
+ String mBarcodeEditTexts = mBarcodeEditText.getText().toString().trim();//采集条码号
|
|
|
+ String jlt_storage_in_barcode_ets = jlt_storage_in_barcode_et.getText().toString().trim();//条码号
|
|
|
+ String mLotEditTexts = mLotEditText.getText().toString().trim();//仓位
|
|
|
+ String jlt_edit_lotnos = jlt_edit_lotno.getText().toString().trim();//LoNo
|
|
|
+ String jlt_edit_dataecodes = jlt_edit_dataecode.getText().toString().trim();//日期
|
|
|
+ String jlt_edit_dcs = jlt_edit_dc.getText().toString().trim();//字符
|
|
|
+ String jlt_edit_qtys = jlt_edit_qty.getText().toString().trim();//QTY
|
|
|
+ if (check_box_positions.isChecked()==true&&mLotEditTexts.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "仓位不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_lono.isChecked()==true&&jlt_edit_lotnos.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "LoNo不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_date.isChecked()==true&&jlt_edit_dataecodes.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "日期不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (check_box_dc.isChecked()==true&&jlt_edit_dcs.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "字符不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Savebtn_barcode(mBarcodeEditTexts,jlt_storage_in_barcode_ets,mLotEditTexts,jlt_edit_lotnos,jlt_edit_dataecodes,jlt_edit_dcs,jlt_edit_qtys);
|
|
|
+ }
|
|
|
+ public void Savebtn_barcode(String mBarcodeEditTexts,String jlt_storage_in_barcode_ets,String mLotEditTexts,String jlt_edit_lotnos,
|
|
|
+ String jlt_edit_dataecodes,String jlt_edit_dcs,String jlt_edit_qtys){
|
|
|
+ if (jlt_edit_qtys.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "数量不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mBarcodeEditTexts.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "条码号不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String house_text = SharedPreUtil.getString(mActivity, "house_text", null);
|
|
|
+ String jlt_edit_warehousetrim = jlt_edit_warehouse.getText().toString().trim();
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("LOCATION", mLotEditTexts);
|
|
|
+ obj.put("PRODCODE", prodcode);
|
|
|
+ obj.put("PI_IDS", mPiid);
|
|
|
+ if (jlt_check_ok.isChecked()==true){
|
|
|
+ if (jlt_storage_in_barcode_ets.isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "条码号不可为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else if(jlt_check_ok.isChecked()==false){
|
|
|
+ jlt_storage_in_barcode_et.setText(mBarcodeEditTexts);
|
|
|
+ jlt_storage_in_barcode_ets = jlt_storage_in_barcode_et.getText().toString().trim();
|
|
|
+ }
|
|
|
+
|
|
|
+ obj.put("BARCODE", jlt_storage_in_barcode_ets);
|
|
|
+ obj.put("LOTNO", jlt_edit_lotnos);
|
|
|
+ obj.put("DC", jlt_edit_dcs);
|
|
|
+ obj.put("RE_MADEDATE",jlt_edit_dataecodes);
|
|
|
+ obj.put("CONTENT", mBarcodeEditTexts);
|
|
|
+ obj.put("QTY", jlt_edit_qtys);
|
|
|
+ obj.put("whcode", jlt_edit_warehousetrim);
|
|
|
+ String stores = obj.toString();
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_INVENTORYBINDING)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "savebarcode")
|
|
|
+ .addParam("store", stores)
|
|
|
+ .addParam("sourcebarcode",house_text)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+// String result = o.toString();
|
|
|
+// JSONObject resultObject = JSON.parseObject(result);
|
|
|
+// JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "归属入库单:"
|
|
|
+// + FastjsonUtil.getText(dataObject, "INOUTNO")
|
|
|
+// + "成功");
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "归属成功");
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ jlt_storage_in_barcode_et.setText("");
|
|
|
+ jlt_edit_lotno.setText("");
|
|
|
+ jlt_edit_dataecode.setText("");
|
|
|
+ jlt_edit_dc.setText("");
|
|
|
+ jlt_edit_qty.setText("");
|
|
|
+// resetState();
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private void saveBarcode(boolean exist, boolean checkDate) {
|
|
|
+ if (TextUtils.isEmpty(mBarcodeParseBean.getPN()) ||
|
|
|
+ TextUtils.isEmpty(mBarcodeParseBean.getBRAND()) ||
|
|
|
+ TextUtils.isEmpty(mBarcodeParseBean.getMPQ())) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集条码获取必填数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mPoCheckBox.isChecked() && TextUtils.isEmpty(mBarcodeParseBean.getORDERCODE())) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "已勾选PO校验,PO号不允许为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ /*if (mBoxNum == null || !mBoxNum.equals(mRealBoxNum)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "当前采集的条码不属于当前箱号");
|
|
|
+ return;
|
|
|
+ }*/
|
|
|
+ if (mEnclosureList.size() > 0 && TextUtils.isEmpty(mBarcodeParseBean.getPR_PKG())) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择封装形式");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+// String qtyStr = mQuantityEditText.getText().toString().trim();
|
|
|
+// if (TextUtils.isEmpty(qtyStr)) {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "数量为空,请先采集数量信息");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// String mpqStr = mMpqEditText.getText().toString().trim();
|
|
|
+// if (TextUtils.isEmpty(mpqStr)) {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "最小包为空,请采集最小包");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// if (isMpqDiv) {
|
|
|
+// try {
|
|
|
+// double qty = Double.parseDouble(qtyStr);
|
|
|
+// double mpq = Double.parseDouble(mpqStr);
|
|
|
+// double pan = qty / mpq;
|
|
|
+// if (!CommonUtil.isIntegerForDouble(pan)) {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "采集数不满足最小包,请重新采集!");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ if (checkDate && !TextUtils.isEmpty(mDatecodebyparse)) {
|
|
|
+ long limitDays = SharedPreUtil.getInt(mActivity, Constants.FLAG.JLT_VALID_DAYS_CACHE, 0);
|
|
|
+ int daysInterval = DateFormatUtil.getDaysInterval(mDatecodebyparse, DateFormatUtil.long2Str("yyyyMMdd")
|
|
|
+ , DateFormatUtil.getFormat("yyyyMMdd"));
|
|
|
+
|
|
|
+ if (limitDays != 0 && daysInterval > limitDays) {
|
|
|
+ new AlertDialog.Builder(mActivity)
|
|
|
+ .setTitle("提示")
|
|
|
+ .setMessage("入库校验 生产日期(" + mDatecodebyparse
|
|
|
+ + ")+ 有效天数(" + limitDays
|
|
|
+ + ")<当天,是否确认入库?")
|
|
|
+ .setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ confirmRequest(exist);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton("取消", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ mBarcodeEditText.setText("");
|
|
|
+ resetState();
|
|
|
+ }
|
|
|
+ }).create().show();
|
|
|
+ } else {
|
|
|
+ confirmRequest(exist);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ confirmRequest(exist);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //扫描 条码号
|
|
|
+ private void confirmRequest(boolean exist) {
|
|
|
+ String mModelEditTexttrim = this.mModelEditText.getText().toString().trim();
|
|
|
+ String mLotEditTexttrim = mLotEditText.getText().toString().trim();
|
|
|
+ String mBarcodeEditTexttrim = mBarcodeEditText.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(mBarcodeEditTexttrim)){
|
|
|
+ CommonUtil.toastNoRepeat(getContext(),"请输入条码号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_INVENTORYBINDING2)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "savebarcode")
|
|
|
+ .addParam("pi_ids", mPiid)
|
|
|
+ .addParam("brand", mModelEditTexttrim)
|
|
|
+ .addParam("location", mLotEditTexttrim)
|
|
|
+ .addParam("barcode", mBarcodeEditText.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ String result = o.toString();
|
|
|
+ Log.e("result",result);
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String lotno = FastjsonUtil.getText(dataObject, "LOTNO");
|
|
|
+ String datecode = FastjsonUtil.getText(dataObject, "DATECODE");
|
|
|
+ String dc = FastjsonUtil.getText(dataObject, "DC");
|
|
|
+ String qty = FastjsonUtil.getText(dataObject, "QTY");
|
|
|
+ prodcode = FastjsonUtil.getText(dataObject, "PRODCODE");
|
|
|
+ String lc = FastjsonUtil.getText(dataObject, "LC");
|
|
|
+ mLotEditText.setText(lc);
|
|
|
+
|
|
|
+ jlt_edit_lotno.setText(lotno);
|
|
|
+ jlt_edit_dataecode.setText(datecode);
|
|
|
+ jlt_edit_dc.setText(dc);
|
|
|
+ jlt_edit_qty.setText(qty);
|
|
|
+ }
|
|
|
+ if (jlt_check_ok.isChecked()==true&&jlt_storage_in_barcode_et.getText().toString().trim().isEmpty()){
|
|
|
+ jlt_storage_in_barcode_et.requestFocus();
|
|
|
+ jlt_storage_in_barcode_et.setSelection(jlt_edit_qty.getText().toString().trim().length());
|
|
|
+ }else {
|
|
|
+ newlinebarcodeEnter();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+// check_box_positions.setChecked(true);
|
|
|
+// check_box_lono.setChecked(true);
|
|
|
+// check_box_date.setChecked(true);
|
|
|
+// check_box_dc.setChecked(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mBarcodeEditText.selectAll();
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ imm.showSoftInput(mBarcodeEditText, InputMethodManager.RESULT_HIDDEN);
|
|
|
+
|
|
|
+ }
|
|
|
+ //清空所有输入框
|
|
|
+ private void resetState() {
|
|
|
+ mModelEditText.setText("");
|
|
|
+ mQuantityEditText.setText("");
|
|
|
+ mMpqEditText.setText("");
|
|
|
+ mDateEditText.setText("");
|
|
|
+ mLotEditText.setText("");
|
|
|
+ mPanEditText.setText("");
|
|
|
+ mPoEditText.setText("");
|
|
|
+ mBrandEditText.setText("");
|
|
|
+ mEnclosureEditText.setText("");
|
|
|
+
|
|
|
+ mBarcodeEditText.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ if (resultCode != Activity.RESULT_OK) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (requestCode == REQUEST_DATE) {
|
|
|
+ try {
|
|
|
+ Date date = (Date) data.getSerializableExtra("extra_date");
|
|
|
+ String formatDate = DateFormat.format("yyyy-MM-dd", date).toString();
|
|
|
+ jlt_edit_dataecode.setText(formatDate);
|
|
|
+ jlt_edit_dataecode.setSelection(jlt_edit_dataecode.getText().toString().trim().length());
|
|
|
+ mDatecodebyparse = formatDate;
|
|
|
+ } catch (Exception e) {
|
|
|
+ jlt_edit_dataecode.setText("");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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());
|
|
|
+// barcodeParse(result);
|
|
|
+ confirmRequest(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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());
|
|
|
+ modelParse();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (mFocusId==R.id.jlt_storage_in_barcode_et){
|
|
|
+ String result = data.getExtras().getString(CodeUtils.RESULT_STRING);
|
|
|
+ jlt_storage_in_barcode_et.setText(result);
|
|
|
+ jlt_storage_in_barcode_et.setSelection(result.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 展示扩展菜单
|
|
|
+ */
|
|
|
+ private void showMoreMenu() {
|
|
|
+ if (mMenuView == null) {
|
|
|
+ mMenuView = View.inflate(mActivity, R.layout.pop_jlt_storage_in_box_menu, null);
|
|
|
+ }
|
|
|
+ Button todoListBtn = (Button) mMenuView.findViewById(R.id.pop_jlt_storage_in_box_menu_1);
|
|
|
+ Button doneListInBtn = (Button) mMenuView.findViewById(R.id.pop_jlt_storage_in_box_menu_2);
|
|
|
+ Button revokeCollectBtn = (Button) mMenuView.findViewById(R.id.pop_jlt_storage_in_box_menu_3);
|
|
|
+ Button postBtn = (Button) mMenuView.findViewById(R.id.pop_jlt_storage_in_box_menu_4);
|
|
|
+
|
|
|
+ Button pop_material_in_menu_1 = (Button) mMenuView.findViewById(R.id.pop_material_in_menu_1);
|
|
|
+ Button pop_material_in_menu_5 = (Button) mMenuView.findViewById(R.id.pop_material_in_menu_5);
|
|
|
+ Button pop_material_in_menu_2 = (Button) mMenuView.findViewById(R.id.pop_material_in_menu_2);
|
|
|
+ Button pop_toadoptprompt = (Button) mMenuView.findViewById(R.id.pop_toadoptprompt);
|
|
|
+
|
|
|
+ postBtn.setVisibility(View.GONE);
|
|
|
+ todoListBtn.setVisibility(View.GONE);
|
|
|
+ revokeCollectBtn.setText("确认入库");
|
|
|
+ revokeCollectBtn.setVisibility(View.GONE);
|
|
|
+ pop_toadoptprompt.setOnClickListener(new View.OnClickListener() {//待采提示
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+// FragmentUtils.switchFragment(InventoryBindingFragment.this, ToadoptpromptFragment.newInstance(mPiid,mPiInoutno));
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ todoListBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+// JLTStorageInTodoListFragment jltStorageInTodoListFragment = new JLTStorageInTodoListFragment();
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putString("pi_id", mPiid);
|
|
|
+// bundle.putString("pi_class", mPiClass);
|
|
|
+// jltStorageInTodoListFragment.setArguments(bundle);
|
|
|
+// FragmentUtils.switchFragment(InventoryBindingFragment.this, jltStorageInTodoListFragment);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ doneListInBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+// JLTStorageInDoneListFragment jltStorageInDoneListFragment = new JLTStorageInDoneListFragment();
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putString("pi_id", mPiid);
|
|
|
+// bundle.putString("pi_class", mPiClass);
|
|
|
+// jltStorageInDoneListFragment.setArguments(bundle);
|
|
|
+// FragmentUtils.switchFragment(InventoryBindingFragment.this, jltStorageInDoneListFragment);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ revokeCollectBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ confirmStorageIn(false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ postBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ new AlertDialog.Builder(mActivity)
|
|
|
+ .setMessage("确认将单据过账?")
|
|
|
+ .setNegativeButton(R.string.cancel, null)
|
|
|
+ .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_PDAIO_CONFIRMPOST)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .addParam("piid", mPiid)
|
|
|
+ .tag(TAG + "confirmpost")
|
|
|
+ .build(), 30 * 1000, new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "过账成功");
|
|
|
+ getActivity().getSupportFragmentManager().popBackStackImmediate();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).create().show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //确认入库
|
|
|
+ pop_material_in_menu_1.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ confirmIn();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //已采集列表
|
|
|
+ pop_material_in_menu_5.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+// FragmentUtils.switchFragment(InventoryBindingFragment.this, StorageInBarDetailsCollectListFragment.newInstance(mPiid, pd_whcode,mPiClass));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //撤销入库
|
|
|
+ pop_material_in_menu_2.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ mBarcodeEditText.setOnFocusChangeListener(null);
|
|
|
+ jlt_storage_in_barcode_et.setOnFocusChangeListener(null);
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+// ((FunctionActivity) getActivity()).setScanIvVisible(false);
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("pi_id", mPiid);
|
|
|
+ bundle.putString("pi_inoutno", mPiInoutno);
|
|
|
+ bundle.putString("pd_whcode", pd_whcode);
|
|
|
+ bundle.putString("whichpage", "materialin");
|
|
|
+ mFragment = new MaterialOutRevocationStockFragment();
|
|
|
+ mFragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(InventoryBindingFragment.this, mFragment);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ if (mMenuPopupWindow == null) {
|
|
|
+ mMenuPopupWindow = new PopupWindow(mMenuView, LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ }
|
|
|
+ mMenuPopupWindow.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ mMenuPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeMenuPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 0.5f);
|
|
|
+ mMenuPopupWindow.showAsDropDown(mMoreButton);
|
|
|
+ }
|
|
|
+ private void confirmIn() {
|
|
|
+ progressDialog.show();
|
|
|
+ String url = GloableParams.ADDRESS_INMATERIAL_CONFIRM_IN + "?pi_id=" + mPiid + "&whcode=" + pd_whcode;
|
|
|
+
|
|
|
+ PdaApplication.mRequestQueue.cancelAll(TAG + "confirmin");
|
|
|
+
|
|
|
+ mStringRequest = new StringRequest(Request.Method.GET, url,
|
|
|
+ new Response.Listener<String>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(String s) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+// mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ try {
|
|
|
+ org.json.JSONObject resultObject = new org.json.JSONObject(s);
|
|
|
+// mResultTextView.setText(resultObject.optString("data"));
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ new Response.ErrorListener() {
|
|
|
+ @Override
|
|
|
+ public void onErrorResponse(VolleyError volleyError) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mResultTextView.setVisibility(View.VISIBLE);
|
|
|
+ String errorToast = CommonUtil.showErrorToast(volleyError, true);
|
|
|
+ mResultTextView.setText(errorToast);
|
|
|
+ }
|
|
|
+ }) {
|
|
|
+ @Override
|
|
|
+ public Map<String, String> getHeaders() throws AuthFailureError {
|
|
|
+ return VolleyUtil.getVolleyUtil().setCookies();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
|
|
|
+ mStringRequest.setTag(TAG + "confirmin");
|
|
|
+ PdaApplication.mRequestQueue.add(mStringRequest);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认入库
|
|
|
+ *
|
|
|
+ * @param forceNewBio
|
|
|
+ */
|
|
|
+ private void confirmStorageIn(boolean forceNewBio) {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_RECEIVING_NEWBAOCODEIO)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "newbarcodeio")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("pi_id", mPiid)
|
|
|
+ .addParam("forceNewBio", Boolean.toString(forceNewBio))
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
+ if (dataObject != null && FastjsonUtil.getBoolean(dataObject, "qtyCheck")) {
|
|
|
+ new AlertDialog.Builder(mActivity)
|
|
|
+ .setTitle("提示")
|
|
|
+ .setMessage("存在采集数量与单据明细数量不一致,是否继续确认入库?")
|
|
|
+ .setNegativeButton(R.string.cancel, null)
|
|
|
+ .setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ if (dialog != null) {
|
|
|
+ dialog.dismiss();
|
|
|
+ }
|
|
|
+ confirmStorageIn(true);
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "入库成功");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeMenuPopupWindow() {
|
|
|
+ if (mMenuPopupWindow != null) {
|
|
|
+ mMenuPopupWindow.dismiss();
|
|
|
+ mMenuPopupWindow = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ if (hidden) {
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ } else {
|
|
|
+ ((FunctionActivity) getActivity()).setTitle("库存条码绑定");
|
|
|
+// ((FunctionActivity) getActivity()).setMoreBtnVisible(true);
|
|
|
+ mMoreButton.setOnClickListener(this);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private class MyTextWatcher implements TextWatcher {
|
|
|
+ private TextView view;
|
|
|
+
|
|
|
+ public MyTextWatcher(TextView view) {
|
|
|
+ this.view = view;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString().trim();
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.jlt_storage_in_barcode_model_et:
|
|
|
+ mBarcodeParseBean.setPN(text);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_quantity_et:
|
|
|
+ try {
|
|
|
+ double qty = Double.parseDouble(text);
|
|
|
+ mBarcodeParseBean.setQTY(qty);
|
|
|
+ String mpq = mMpqEditText.getText().toString().trim();
|
|
|
+ try {
|
|
|
+ if (!TextUtils.isEmpty(mpq)) {
|
|
|
+ double mpqNum = Double.parseDouble(mpq);
|
|
|
+ if (mpqNum <= 0) {
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ } else {
|
|
|
+ double pan = qty / mpqNum;
|
|
|
+ mPanEditText.setText(CommonUtil.doubleFormat(Math.ceil(pan)));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ mBarcodeParseBean.setQTY(0);
|
|
|
+ mBarcodeParseBean.setPAN(0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_mpq_et:
|
|
|
+ mBarcodeParseBean.setMPQ(text);
|
|
|
+ String qty = mQuantityEditText.getText().toString().trim();
|
|
|
+ try {
|
|
|
+ if (!TextUtils.isEmpty(qty)) {
|
|
|
+ double qtyNum = Double.parseDouble(qty);
|
|
|
+ double mpqNum = Double.parseDouble(text);
|
|
|
+ if (mpqNum <= 0) {
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ } else {
|
|
|
+ double pan = qtyNum / mpqNum;
|
|
|
+ mPanEditText.setText(CommonUtil.doubleFormat(Math.ceil(pan)));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ mPanEditText.setText("0");
|
|
|
+ mBarcodeParseBean.setPAN(0);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_date_et:
|
|
|
+ mBarcodeParseBean.setDATECODE(text);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_lot_et:
|
|
|
+ mBarcodeParseBean.setLOTNO(text);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_reel_et:
|
|
|
+ try {
|
|
|
+ int pan = Integer.parseInt(text);
|
|
|
+ mBarcodeParseBean.setPAN(pan);
|
|
|
+ } catch (Exception e) {
|
|
|
+ mBarcodeParseBean.setPAN(0);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_po_et:
|
|
|
+ mBarcodeParseBean.setORDERCODE(text);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_brand_et:
|
|
|
+ mBarcodeParseBean.setBRAND(text);
|
|
|
+ break;
|
|
|
+ case R.id.jlt_storage_in_barcode_enclosure_et:
|
|
|
+ mBarcodeParseBean.setPR_PKG(text);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// private void getNeedList() {
|
|
|
+// progressDialog.show();
|
|
|
+//
|
|
|
+// VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+// .url(GloableParams.ADDRESS_JLT_RECEIVING_GETNEEDLIST)
|
|
|
+// .method(Request.Method.GET)
|
|
|
+// .tag(TAG + "getneedlist")
|
|
|
+// .addParam("pi_ids", mPiid)
|
|
|
+// .build(), new HttpCallback() {
|
|
|
+// @Override
|
|
|
+// public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+// try {
|
|
|
+// progressDialog.dismiss();
|
|
|
+// String result = o.toString();
|
|
|
+//
|
|
|
+// JSONObject resultObject = JSON.parseObject(result);
|
|
|
+// JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+// if (dataArray == null || dataArray.size() == 0) {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "数据为空");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<SecondaryListAdapter.SecondaryListBean<String, JLTStorageModelBean>> mSecondaryListBeen = new ArrayList<>();
|
|
|
+// for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+// JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+// if (dataObject != null) {
|
|
|
+// String inoutno = FastjsonUtil.getText(dataObject, "PB_INOUTNO");
|
|
|
+//
|
|
|
+// JSONArray modelArray = dataObject.getJSONArray("list");
|
|
|
+// List<JLTStorageModelBean> jltStorageModelBeans = new ArrayList<>();
|
|
|
+// if (modelArray != null && modelArray.size() > 0) {
|
|
|
+// for (int j = 0; j < modelArray.size(); j++) {
|
|
|
+// JSONObject modelObject = modelArray.getJSONObject(j);
|
|
|
+// if (modelObject != null) {
|
|
|
+// JLTStorageModelBean jltStorageModelBean = new JLTStorageModelBean();
|
|
|
+// jltStorageModelBean.setModel(FastjsonUtil.getText(modelObject, "ORISPECCODE"));
|
|
|
+// jltStorageModelBean.setProdcode(FastjsonUtil.getText(modelObject,"PD_PRODCODE"));
|
|
|
+// jltStorageModelBean.setQuantity(FastjsonUtil.getText(modelObject, "RESTQTY"));
|
|
|
+// jltStorageModelBean.setDoneQty(FastjsonUtil.getText(modelObject, "PBQTY"));
|
|
|
+// jltStorageModelBean.setPr_brand(FastjsonUtil.getText(modelObject, "PR_BRAND"));
|
|
|
+// jltStorageModelBean.setPrcode(FastjsonUtil.getText(modelObject, "PRCODE"));
|
|
|
+// jltStorageModelBeans.add(jltStorageModelBean);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// SecondaryListAdapter.SecondaryListBean<String, JLTStorageModelBean> secondaryListBean
|
|
|
+// = new SecondaryListAdapter.SecondaryListBean<>(inoutno, jltStorageModelBeans);
|
|
|
+//
|
|
|
+// mSecondaryListBeen.add(secondaryListBean);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// mStorageInTodoAdapter.setDatas(mSecondaryListBeen);
|
|
|
+// mRecyclerView.setAdapter(mStorageInTodoAdapter);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public void onFail(int flag, String failStr) throws Exception {
|
|
|
+// progressDialog.dismiss();
|
|
|
+//
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+ public interface OnFinishListener {
|
|
|
+ void onFinish();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroy() {
|
|
|
+ super.onDestroy();
|
|
|
+
|
|
|
+ }
|
|
|
+}
|