|
|
@@ -51,14 +51,14 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
private static final int REQUEST_START_DATE = 21;
|
|
|
private static final int REQUEST_END_DATE = 22;
|
|
|
|
|
|
- private ClearableEditText mSupplierEditText, mWhcodeEditText, mSupplierSearchEt, mWhcodeSearchEt;
|
|
|
+ private ClearableEditText mSupplierEditText, mWhcodeEditText, mClassEditText, mSupplierSearchEt, mWhcodeSearchEt, mClassSearchEt;
|
|
|
private TextView mSupplierTextView, mStartdatTextView, mEnddateTextView;
|
|
|
- private ImageView mSupplierIv, mWhcodeIv, mStartIv, mEndIv;
|
|
|
+ private ImageView mSupplierIv, mWhcodeIv, mStartIv, mEndIv, mClassIv;
|
|
|
private Button mConfirmButton;
|
|
|
- private Dialog mWhcodeDialog, mSupplierDialog;
|
|
|
- private RecyclerView mWhcodeRecyclerView, mSupplierRecyclerView;
|
|
|
- private List<WhcodeBean> mWhcodeList, mSupplierList, mAllWhcodeList, mAllSupplierList;
|
|
|
- private JLTSearchWhcodeAdapter mSearchWhcodeAdapter, mSearchSupplierAdapter;
|
|
|
+ private Dialog mWhcodeDialog, mSupplierDialog, mClassDialog;
|
|
|
+ private RecyclerView mWhcodeRecyclerView, mSupplierRecyclerView, mClassRecyclerView;
|
|
|
+ private List<WhcodeBean> mWhcodeList, mSupplierList, mClassList, mAllWhcodeList, mAllSupplierList, mAllClassList;
|
|
|
+ private JLTSearchWhcodeAdapter mSearchWhcodeAdapter, mSearchSupplierAdapter, mSearchClassAdapter;
|
|
|
private long mStartDate, mEndDate;
|
|
|
private OnFilterConfirmListener mOnFilterConfirmListener;
|
|
|
private String mWhichPage = "IN";
|
|
|
@@ -92,6 +92,8 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
mSupplierEditText = root.findViewById(R.id.pda_wms_in_filter_supplier_et);
|
|
|
mSupplierTextView = root.findViewById(R.id.pda_wms_in_filter_supplier_tv);
|
|
|
mWhcodeEditText = root.findViewById(R.id.pda_wms_in_filter_whcode_et);
|
|
|
+ mClassEditText = root.findViewById(R.id.pda_wms_in_filter_class_et);
|
|
|
+ mClassIv = root.findViewById(R.id.pda_wms_in_filter_class_iv);
|
|
|
mStartdatTextView = root.findViewById(R.id.pda_wms_in_filter_startdate_et);
|
|
|
mEnddateTextView = root.findViewById(R.id.pda_wms_in_filter_enddate_et);
|
|
|
mSupplierIv = root.findViewById(R.id.pda_wms_in_filter_supplier_iv);
|
|
|
@@ -99,15 +101,17 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
mStartIv = root.findViewById(R.id.pda_wms_in_filter_startdate_iv);
|
|
|
mEndIv = root.findViewById(R.id.pda_wms_in_filter_enddate_iv);
|
|
|
mConfirmButton = root.findViewById(R.id.pda_wms_in_filter_confirm_btn);
|
|
|
- mSupplierEditText.postDelayed(new Runnable() {
|
|
|
+ mClassEditText.postDelayed(new Runnable() {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
- mSupplierEditText.requestFocus();
|
|
|
+ mClassEditText.requestFocus();
|
|
|
}
|
|
|
}, 100);
|
|
|
|
|
|
mAllSupplierList = new ArrayList<>();
|
|
|
mAllWhcodeList = new ArrayList<>();
|
|
|
+ mAllClassList = new ArrayList<>();
|
|
|
+
|
|
|
View whcodeView = View.inflate(mActivity, R.layout.dialog_jlt_search_whcode, null);
|
|
|
mWhcodeSearchEt = whcodeView.findViewById(R.id.common_search_et);
|
|
|
mWhcodeRecyclerView = whcodeView.findViewById(R.id.item_jlt_search_whcode_rv);
|
|
|
@@ -127,12 +131,23 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
mSearchSupplierAdapter = new JLTSearchWhcodeAdapter(mSupplierList);
|
|
|
mSupplierRecyclerView.setAdapter(mSearchSupplierAdapter);
|
|
|
mSupplierDialog = new AlertDialog.Builder(mActivity).setView(supplierView).create();
|
|
|
+
|
|
|
+ View classView = View.inflate(mActivity, R.layout.dialog_jlt_search_whcode, null);
|
|
|
+ mClassSearchEt = classView.findViewById(R.id.common_search_et);
|
|
|
+ mClassRecyclerView = classView.findViewById(R.id.item_jlt_search_whcode_rv);
|
|
|
+ mClassRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ mClassRecyclerView.addItemDecoration(new RecyclerItemDecoration(1));
|
|
|
+ mClassList = new ArrayList<>();
|
|
|
+ mSearchClassAdapter = new JLTSearchWhcodeAdapter(mClassList);
|
|
|
+ mClassRecyclerView.setAdapter(mSearchClassAdapter);
|
|
|
+ mClassDialog = new AlertDialog.Builder(mActivity).setView(classView).create();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void initEvents() {
|
|
|
mSupplierIv.setOnClickListener(this);
|
|
|
mWhcodeIv.setOnClickListener(this);
|
|
|
+ mClassIv.setOnClickListener(this);
|
|
|
mStartdatTextView.setOnClickListener(this);
|
|
|
mStartIv.setOnClickListener(this);
|
|
|
mEnddateTextView.setOnClickListener(this);
|
|
|
@@ -155,6 +170,14 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ mSearchClassAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ mClassEditText.setText(mClassList.get(position).getWhCode());
|
|
|
+ mClassDialog.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
mSupplierSearchEt.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
@@ -198,6 +221,28 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
mSearchWhcodeAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ mClassSearchEt.addTextChangedListener(new TextWatcher() {
|
|
|
+ @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();
|
|
|
+ List<WhcodeBean> filterList = getWhcodeBeans(text, mAllClassList);
|
|
|
+
|
|
|
+ mClassList.clear();
|
|
|
+ mClassList.addAll(filterList);
|
|
|
+ mSearchClassAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
private List<WhcodeBean> getWhcodeBeans(String text, List<WhcodeBean> whcodeList) {
|
|
|
@@ -236,6 +281,7 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
|
|
|
mStartDate = SharedPreUtil.getLong(mActivity, Constants.FLAG.STORAGE_IN_FILTER_STARTTIME, 0);
|
|
|
mEndDate = SharedPreUtil.getLong(mActivity, Constants.FLAG.STORAGE_IN_FILTER_ENDTIME, 0);
|
|
|
+ mClassEditText.setText(SharedPreUtil.getString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_CLASS, ""));
|
|
|
mSupplierEditText.setText(SharedPreUtil.getString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_SUPPLIAR, ""));
|
|
|
mWhcodeEditText.setText(SharedPreUtil.getString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_BOX, ""));
|
|
|
mStartdatTextView.setText(SharedPreUtil.getString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_STARTDATE, ""));
|
|
|
@@ -255,10 +301,14 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
break;
|
|
|
}
|
|
|
case R.id.pda_wms_in_filter_whcode_iv: {
|
|
|
- mWhcodeEditText.setText("");
|
|
|
+ mWhcodeSearchEt.setText("");
|
|
|
searchWhcode();
|
|
|
break;
|
|
|
}
|
|
|
+ case R.id.pda_wms_in_filter_class_iv:
|
|
|
+ mClassSearchEt.setText("");
|
|
|
+ searchClass();
|
|
|
+ break;
|
|
|
case R.id.pda_wms_in_filter_startdate_iv:
|
|
|
case R.id.pda_wms_in_filter_startdate_et: {
|
|
|
dateSelect(REQUEST_START_DATE);
|
|
|
@@ -273,11 +323,13 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
CommonUtil.toastNoRepeat(mActivity, "开始日期不能大于结束日期");
|
|
|
return;
|
|
|
}
|
|
|
+ String mclass = mClassEditText.getText().toString().trim();
|
|
|
String supplier = mSupplierEditText.getText().toString().trim();
|
|
|
String whcode = mWhcodeEditText.getText().toString().trim();
|
|
|
String startDate = mStartdatTextView.getText().toString().trim();
|
|
|
String endDate = mEnddateTextView.getText().toString().trim();
|
|
|
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_CLASS, mclass);
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_BOX, whcode);
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_SUPPLIAR, supplier);
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.STORAGE_IN_FILTER_STARTDATE, startDate);
|
|
|
@@ -286,7 +338,7 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
SharedPreUtil.saveLong(mActivity, Constants.FLAG.STORAGE_IN_FILTER_ENDTIME, mEndDate);
|
|
|
|
|
|
if (mOnFilterConfirmListener != null) {
|
|
|
- mOnFilterConfirmListener.onFilterConfirm(supplier, whcode, startDate, endDate);
|
|
|
+ mOnFilterConfirmListener.onFilterConfirm(mclass, supplier, whcode, startDate, endDate);
|
|
|
getActivity().getSupportFragmentManager().popBackStack();
|
|
|
}
|
|
|
break;
|
|
|
@@ -408,6 +460,56 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void searchClass() {
|
|
|
+ progressDialog.show();
|
|
|
+
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_JLT_RECEIVING_GETPICLASSCOMBO)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "classsearch")
|
|
|
+ .addParam("type", mWhichPage)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ mClassList.clear();
|
|
|
+ mAllClassList.clear();
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+ if (dataArray != null && dataArray.size() > 0) {
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ WhcodeBean whcodeBean = new WhcodeBean();
|
|
|
+ whcodeBean.setWhCode(FastjsonUtil.getText(dataObject, "DISPLAYNAME"));
|
|
|
+// whcodeBean.setWhDes(FastjsonUtil.getText(dataObject, "REALVALUE"));
|
|
|
+
|
|
|
+ mClassList.add(whcodeBean);
|
|
|
+ mAllClassList.add(whcodeBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mSearchClassAdapter.notifyDataSetChanged();
|
|
|
+ if (mClassList.size() == 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "单据类型为空");
|
|
|
+ } else {
|
|
|
+ mClassDialog.show();
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
if (resultCode != Activity.RESULT_OK) {
|
|
|
@@ -458,7 +560,7 @@ public class JltStorageInFilterFragment extends BaseFragment implements View.OnC
|
|
|
}
|
|
|
|
|
|
public interface OnFilterConfirmListener {
|
|
|
- void onFilterConfirm(String supplier, String whcode, String startDate, String endDate);
|
|
|
+ void onFilterConfirm(String mclass, String supplier, String whcode, String startDate, String endDate);
|
|
|
}
|
|
|
|
|
|
private class filterTextWatcher implements TextWatcher {
|