|
|
@@ -2,7 +2,9 @@ package com.uas.hy_electronic.fragment;
|
|
|
|
|
|
import android.app.ActionBar;
|
|
|
import android.app.Activity;
|
|
|
+import android.app.AlertDialog;
|
|
|
import android.content.Context;
|
|
|
+import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.os.AsyncTask;
|
|
|
@@ -10,14 +12,18 @@ import android.support.annotation.Nullable;
|
|
|
import android.support.v7.widget.DividerItemDecoration;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
import android.view.Gravity;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
import android.view.Window;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
import android.view.inputmethod.InputMethodManager;
|
|
|
+import android.widget.AdapterView;
|
|
|
+import android.widget.BaseAdapter;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
@@ -31,10 +37,13 @@ import com.android.volley.toolbox.StringRequest;
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
+import com.handmark.pulltorefresh.library.PullToRefreshBase;
|
|
|
+import com.handmark.pulltorefresh.library.PullToRefreshListView;
|
|
|
import com.uas.hy_electronic.R;
|
|
|
import com.uas.hy_electronic.activity.FunctionActivity;
|
|
|
import com.uas.hy_electronic.adapter.WHCheckMakeDetailListAdapter;
|
|
|
import com.uas.hy_electronic.adapter.WHCheckMakeMaterialListAdapter;
|
|
|
+import com.uas.hy_electronic.bean.ItemNumberBean;
|
|
|
import com.uas.hy_electronic.bean.WHMakeMaterialDetail;
|
|
|
import com.uas.hy_electronic.bean.WHMakeMaterialProduct;
|
|
|
import com.uas.hy_electronic.global.GloableParams;
|
|
|
@@ -46,11 +55,13 @@ import com.uas.hy_electronic.util.CommonUtil;
|
|
|
import com.uas.hy_electronic.util.FastjsonUtil;
|
|
|
import com.uas.hy_electronic.util.HttpCallback;
|
|
|
import com.uas.hy_electronic.util.HttpParams;
|
|
|
+import com.uas.hy_electronic.util.ListUtils;
|
|
|
import com.uas.hy_electronic.util.LogUtil;
|
|
|
import com.uas.hy_electronic.util.StringUtil;
|
|
|
import com.uas.hy_electronic.util.VollyRequest;
|
|
|
import com.uas.hy_electronic.view.ClearableEditText;
|
|
|
import com.uas.hy_electronic.view.ConfirmDialog;
|
|
|
+import com.uas.hy_electronic.view.EmptyLayout;
|
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
@@ -67,10 +78,10 @@ import razerdp.basepopup.BasePopupWindow;
|
|
|
* @note:物料库存核查Fragment
|
|
|
*/
|
|
|
public class WHCheckMakeMaterialFragment extends BaseFragment implements View.OnClickListener, DataSourceManager.NotifyData,
|
|
|
-// AdapterView.OnItemClickListener,
|
|
|
+ // AdapterView.OnItemClickListener,
|
|
|
VolleyUtil.VolleyFinishListener {
|
|
|
private static final int SCAN_BARCODE_CODE = 301;
|
|
|
- ClearableEditText etProdcode, etWhcode;
|
|
|
+ ClearableEditText etProdcode, etWhcode, cet_item_number;
|
|
|
TextView tvPrDetail, tvPrSpec;
|
|
|
TextView btnSearch;
|
|
|
WHCheckMakeMaterialListAdapter adapter;
|
|
|
@@ -83,15 +94,23 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
private String pi_type;
|
|
|
private ArrayList<ComDataBean> ComDataBeanList;
|
|
|
private ClearableEditText edit_et;
|
|
|
+ private View contView;
|
|
|
private IpAndResourcesPortAdapter ipAndResourcesPortAdapter;
|
|
|
private RecyclerView rv_line_ip_port_data;
|
|
|
private String sc_name;
|
|
|
private String sc_code;
|
|
|
private PopupWindow editPW;
|
|
|
private StringRequest mStringRequest;
|
|
|
- private ImageView iv_search;
|
|
|
+ private ImageView iv_search, iv_item_number_search;
|
|
|
private TextView tv_pr_qty;
|
|
|
|
|
|
+ private PullToRefreshListView ptrlv_item_number;
|
|
|
+ private EmptyLayout mEmptyLayout;
|
|
|
+ private int page = 1;
|
|
|
+ private int pageSize = 20;
|
|
|
+ private ItmeNumberListAdapter itmeNumberListAdapter;
|
|
|
+ private ArrayList<ItemNumberBean> itemNumberBeanList;
|
|
|
+
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
return R.layout.fragment_whcheck_makematerial;
|
|
|
@@ -114,6 +133,7 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
//->采集
|
|
|
etProdcode = (ClearableEditText) root.findViewById(R.id.et_prodcode_whmm);
|
|
|
etWhcode = (ClearableEditText) root.findViewById(R.id.et_whcode_whmm);
|
|
|
+ cet_item_number = (ClearableEditText) root.findViewById(R.id.cet_item_number);
|
|
|
btnSearch = (TextView) root.findViewById(R.id.btn_search_whmm);
|
|
|
//->信息显示
|
|
|
tvPrDetail = (TextView) root.findViewById(R.id.tv_pr_detail);
|
|
|
@@ -123,12 +143,20 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
|
|
|
mScanImageView = (ImageView) mActivity.findViewById(R.id.btn_actionbar_scan_iv);
|
|
|
iv_search = (ImageView) mActivity.findViewById(R.id.iv_search);
|
|
|
+ iv_item_number_search = (ImageView) mActivity.findViewById(R.id.iv_item_number_search);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
protected void initEvents() {
|
|
|
+ iv_item_number_search.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ getItemNuber("", page, pageSize);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
btnSearch.setOnClickListener(this);
|
|
|
-// lvDetail.setOnItemClickListener(this);
|
|
|
+ // lvDetail.setOnItemClickListener(this);
|
|
|
etProdcode.setOnKeyListener(new View.OnKeyListener() {
|
|
|
@Override
|
|
|
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
|
|
@@ -170,18 +198,209 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
iv_search.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- getRepairStep("");
|
|
|
+ getRepairStep(etProdcode.getText().toString().trim());
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void getItemNuber(String condition, int page, int pageSize) {
|
|
|
+ progressDialog.show();
|
|
|
+ HttpParams.Builder tag = new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GETPRODLIST)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getMaCode");
|
|
|
+ if (TextUtils.isEmpty(condition)) {
|
|
|
+ tag.addParam("page", page + "")
|
|
|
+ .addParam("pageSize", pageSize + "");
|
|
|
+ } else {
|
|
|
+ tag.addParam("condition", condition)
|
|
|
+ .addParam("page", page + "")
|
|
|
+ .addParam("pageSize", pageSize + "");
|
|
|
+ }
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest, tag.flag(0)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ com.alibaba.fastjson.JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
+ if (isSuccess) {
|
|
|
+ if (dataArray == null) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "未搜索到匹配数据");
|
|
|
+ } else {
|
|
|
+ handleItemNumberData(dataArray);
|
|
|
+ }
|
|
|
+ ptrlv_item_number.onRefreshComplete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ ptrlv_item_number.onRefreshComplete();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleItemNumberData(com.alibaba.fastjson.JSONArray dataArray) {
|
|
|
+ ItemNumberBean bean;
|
|
|
+ itemNumberBeanList.clear();
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ com.alibaba.fastjson.JSONObject data = (com.alibaba.fastjson.JSONObject) index;
|
|
|
+ bean = new ItemNumberBean();
|
|
|
+ bean.setPR_CODE(data.getString("PR_CODE"));
|
|
|
+ bean.setPR_DETAIL(data.getString("PR_DETAIL"));
|
|
|
+ bean.setPR_SPEC(data.getString("PR_SPEC"));
|
|
|
+ bean.setRN(data.getInteger("RN"));
|
|
|
+ bean.setSelect(false);
|
|
|
+ itemNumberBeanList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ initItemNumberDataPopupWindow();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initItemNumberDataPopupWindow() {
|
|
|
+ if (contView == null){
|
|
|
+ contView = LayoutInflater.from(mActivity).inflate(R.layout.pop_item_number, null);
|
|
|
+ edit_et = (ClearableEditText) contView.findViewById(R.id.edit_et);
|
|
|
+ TextView sure_tv = (TextView) contView.findViewById(R.id.sure_tv);
|
|
|
+ TextView cancle_tv = (TextView) contView.findViewById(R.id.cancle_tv);
|
|
|
+ ImageView search_im = contView.findViewById(R.id.search_im);
|
|
|
+ LinearLayout line_top = contView.findViewById(R.id.line_top);
|
|
|
+
|
|
|
+ ptrlv_item_number = contView.findViewById(R.id.ptrlv_item_number);
|
|
|
+ ptrlv_item_number.setMode(PullToRefreshBase.Mode.BOTH);
|
|
|
+ itmeNumberListAdapter = new ItmeNumberListAdapter(itemNumberBeanList);
|
|
|
+ ptrlv_item_number.setAdapter(itmeNumberListAdapter);
|
|
|
+ if (page == 1) {
|
|
|
+ itmeNumberListAdapter.setModels(itemNumberBeanList);
|
|
|
+ } else {
|
|
|
+ itmeNumberListAdapter.addModls(itemNumberBeanList);
|
|
|
+ }
|
|
|
+
|
|
|
+ mEmptyLayout = new EmptyLayout(getActivity(), ptrlv_item_number.getRefreshableView());
|
|
|
+ mEmptyLayout.setShowLoadingButton(false);
|
|
|
+ mEmptyLayout.setShowEmptyButton(false);
|
|
|
+ mEmptyLayout.setShowErrorButton(false);
|
|
|
+ mEmptyLayout.setEmptyMessage("暂无数据");
|
|
|
+
|
|
|
+ if (ListUtils.isEmpty(itemNumberBeanList)) {
|
|
|
+ mEmptyLayout.showEmpty();
|
|
|
+ }
|
|
|
+
|
|
|
+ ptrlv_item_number.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
|
|
|
+ @Override
|
|
|
+ public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
+ getItemNuber(cet_item_number.getText().toString().trim(), page = 1, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
|
|
|
+ getItemNuber(cet_item_number.getText().toString().trim(), page++, pageSize);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ ptrlv_item_number.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
+ try {
|
|
|
+ String numberId = itemNumberBeanList.get((int) l).getPR_CODE();
|
|
|
+ if (!TextUtils.isEmpty(numberId)) {
|
|
|
+ edit_et.setText(numberId);
|
|
|
+ }
|
|
|
+ for (int i1 = 0; i1 < itemNumberBeanList.size(); i1++) {
|
|
|
+ if (i1 == (int) l) {
|
|
|
+ itemNumberBeanList.get(i1).setSelect(true);
|
|
|
+ } else {
|
|
|
+ itemNumberBeanList.get(i1).setSelect(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ itmeNumberListAdapter.notifyDataSetChanged();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ edit_et.requestFocus();
|
|
|
+ if (editPW == null) {
|
|
|
+ editPW = new PopupWindow(contView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ }
|
|
|
+ editPW.setTouchable(true);
|
|
|
+ editPW.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ editPW.setOnDismissListener(new BasePopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ View parentView = mActivity.getWindow().findViewById(Window.ID_ANDROID_CONTENT);
|
|
|
+ editPW.showAtLocation(parentView, Gravity.CENTER, 0, 0);
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 0.5f);
|
|
|
+ edit_et.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_DONE
|
|
|
+ || actionId == EditorInfo.IME_ACTION_SEND
|
|
|
+ || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
+ String mSearchStr = edit_et.getText().toString().trim();
|
|
|
+ getItemNuber(mSearchStr, 1, 20);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ search_im.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ String mSearchStr = edit_et.getText().toString().trim();
|
|
|
+ getItemNuber(mSearchStr, 1, 20);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ //确定
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ String mSearchStr = edit_et.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(mSearchStr)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入料号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ cet_item_number.setText(mSearchStr);
|
|
|
+ cet_item_number.requestFocus();
|
|
|
+ cet_item_number.setSelection(cet_item_number.getText().length());
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //取消
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }else {
|
|
|
+ if (page == 1) {
|
|
|
+ itmeNumberListAdapter.setModels(itemNumberBeanList);
|
|
|
+ } else {
|
|
|
+ itmeNumberListAdapter.addModls(itemNumberBeanList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void initDatas() {
|
|
|
editTextGetFocus(etProdcode);
|
|
|
//->Actionbar
|
|
|
((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(R.string.title_makematerial_whmm);
|
|
|
ComDataBeanList = new ArrayList<>();
|
|
|
-
|
|
|
+ itemNumberBeanList = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -209,16 +428,17 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
//按钮点击事件
|
|
|
private void disposeOnClickEnter() {
|
|
|
String strProdcode = etProdcode.getText().toString().trim();
|
|
|
+ String strNumbssser = cet_item_number.getText().toString().trim();
|
|
|
String strWhcode = etWhcode.getText().toString().trim();
|
|
|
- if (strProdcode.equals("") || strProdcode == null) {
|
|
|
- etProdcode.setWarnIconVisible();
|
|
|
- return;
|
|
|
- }
|
|
|
+ // if (strProdcode.equals("") || strProdcode == null) {
|
|
|
+ // etProdcode.setWarnIconVisible();
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
//请求详细数据
|
|
|
showLoadingView();
|
|
|
requestType = VolleyUtil.FRAGMETN_WHCHECK_PRODUCT_CHECK;
|
|
|
- VolleyUtil.getVolleyUtil().requestMakeMaterialCheck(getActivity(), GloableParams.ADDRESS_WH_PRODUCT, VolleyUtil.METHOD_GET,
|
|
|
- requestType, strProdcode, strWhcode);
|
|
|
+ VolleyUtil.getVolleyUtil().requestMakeMaterialCheck2(getActivity(), GloableParams.ADDRESS_WH_PRODUCT, VolleyUtil.METHOD_GET,
|
|
|
+ requestType, strProdcode, strNumbssser, strWhcode);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -342,71 +562,70 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
}
|
|
|
|
|
|
/*=========================监听事件===================================*/
|
|
|
-// @Override
|
|
|
-// public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
-// //获取点击行所对应的detail对象
|
|
|
-// WHMakeMaterialProduct tmpProd = detailItemList.get(position);
|
|
|
-// String strPrcode = tmpProd.getBAR_PRODCODE().trim();
|
|
|
-// String strWhcode = tmpProd.getBAR_WHCODE().trim();
|
|
|
-// String strLocation = tmpProd.getBAR_LOCATION();
|
|
|
-// String bar_madedate = tmpProd.getBAR_MADEDATE();
|
|
|
-//
|
|
|
-// if (strLocation == null || strLocation.equals("null") || strLocation.equals("")) {
|
|
|
-// strLocation = "null";
|
|
|
-// }
|
|
|
-// //请求服务器获取明细
|
|
|
-// JSONObject paramJson = new JSONObject();
|
|
|
-// try {
|
|
|
-// paramJson.put("pr_code", strPrcode);
|
|
|
-// paramJson.put("wh_code", strWhcode);
|
|
|
-// paramJson.put("bar_location", strLocation);
|
|
|
-// paramJson.put("bar_madedate", bar_madedate);
|
|
|
-//
|
|
|
-// } catch (JSONException e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// Log.e("WHCheck", "!!!" + paramJson.toString());
|
|
|
-// requestType = VolleyUtil.FRAGMETN_WHCHECK_PRODUCT_DETAIL;
|
|
|
-// VolleyUtil.getVolleyUtil().requestMakeMaterialDetail(getActivity(), GloableParams.ADDRESS_WH_DETAIL, VolleyUtil.METHOD_GET,
|
|
|
-// requestType, strPrcode, strWhcode, strLocation);
|
|
|
-// }
|
|
|
+ // @Override
|
|
|
+ // public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ // //获取点击行所对应的detail对象
|
|
|
+ // WHMakeMaterialProduct tmpProd = detailItemList.get(position);
|
|
|
+ // String strPrcode = tmpProd.getBAR_PRODCODE().trim();
|
|
|
+ // String strWhcode = tmpProd.getBAR_WHCODE().trim();
|
|
|
+ // String strLocation = tmpProd.getBAR_LOCATION();
|
|
|
+ // String bar_madedate = tmpProd.getBAR_MADEDATE();
|
|
|
+ //
|
|
|
+ // if (strLocation == null || strLocation.equals("null") || strLocation.equals("")) {
|
|
|
+ // strLocation = "null";
|
|
|
+ // }
|
|
|
+ // //请求服务器获取明细
|
|
|
+ // JSONObject paramJson = new JSONObject();
|
|
|
+ // try {
|
|
|
+ // paramJson.put("pr_code", strPrcode);
|
|
|
+ // paramJson.put("wh_code", strWhcode);
|
|
|
+ // paramJson.put("bar_location", strLocation);
|
|
|
+ // paramJson.put("bar_madedate", bar_madedate);
|
|
|
+ //
|
|
|
+ // } catch (JSONException e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // }
|
|
|
+ // Log.e("WHCheck", "!!!" + paramJson.toString());
|
|
|
+ // requestType = VolleyUtil.FRAGMETN_WHCHECK_PRODUCT_DETAIL;
|
|
|
+ // VolleyUtil.getVolleyUtil().requestMakeMaterialDetail(getActivity(), GloableParams.ADDRESS_WH_DETAIL, VolleyUtil.METHOD_GET,
|
|
|
+ // requestType, strPrcode, strWhcode, strLocation);
|
|
|
+ // }
|
|
|
|
|
|
private void getRepairStep(String trim) {
|
|
|
-// if (pi_type.equals("良品")){
|
|
|
-// pi_type = "";
|
|
|
-// }
|
|
|
+ // if (pi_type.equals("良品")){
|
|
|
+ // pi_type = "";
|
|
|
+ // }
|
|
|
progressDialog.show();
|
|
|
VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
.url(GloableParams.ADDRESS_PDAIO_IN_GETWHCODE)
|
|
|
.method(Request.Method.GET)
|
|
|
.tag(TAG + "getMaCode")
|
|
|
- .addParam("condition",trim)
|
|
|
- .addParam("piclass","")
|
|
|
- .addParam("pi_type","")
|
|
|
+ .addParam("condition", trim)
|
|
|
+ .addParam("piclass", "")
|
|
|
+ .addParam("pi_type", "")
|
|
|
.flag(0)
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
- Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
com.alibaba.fastjson.JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
- if (isSuccess){
|
|
|
- if (dataArray == null){
|
|
|
- CommonUtil.toastNoRepeat(mActivity,"未搜索到匹配数据");
|
|
|
- }else {
|
|
|
- handleFeededlineData(dataArray,trim);
|
|
|
+ if (isSuccess) {
|
|
|
+ if (dataArray == null) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "未搜索到匹配数据");
|
|
|
+ } else {
|
|
|
+ handleFeededlineData(dataArray, trim);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void onFail(int flag, String failStr) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void handleFeededlineData(com.alibaba.fastjson.JSONArray dataArray, String trim) {
|
|
|
@@ -414,22 +633,22 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
ComDataBeanList.clear();
|
|
|
for (Object index : dataArray) {
|
|
|
com.alibaba.fastjson.JSONObject data = (com.alibaba.fastjson.JSONObject) index;
|
|
|
- bean= new ComDataBean();
|
|
|
+ bean = new ComDataBean();
|
|
|
bean.setItemName(data.getString("WH_DESCRIPTION"));
|
|
|
bean.setItemremark(data.getString("WH_CODE"));
|
|
|
ComDataBeanList.add(bean);
|
|
|
}
|
|
|
|
|
|
- if (trim.isEmpty()){
|
|
|
+ if (trim.isEmpty()) {
|
|
|
initresourcesPopupWindow();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
ipAndResourcesPortAdapter.setmList(ComDataBeanList);
|
|
|
- rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);;
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ ;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
private void initresourcesPopupWindow() {
|
|
|
View contView = LayoutInflater.from(mActivity).inflate(R.layout.index_recycle_item, null);
|
|
|
edit_et = (ClearableEditText) contView.findViewById(R.id.edit_et);
|
|
|
@@ -444,7 +663,7 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
ipAndResourcesPortAdapter.setmList(ComDataBeanList);
|
|
|
rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
setlineAdapter(ComDataBeanList);
|
|
|
-// edit_et.setText(ct_qty.getText().toString().trim());
|
|
|
+ // edit_et.setText(ct_qty.getText().toString().trim());
|
|
|
|
|
|
edit_et.requestFocus();
|
|
|
editPW = new PopupWindow(contView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
@@ -468,11 +687,11 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
String mSearchStr = edit_et.getText().toString().trim();
|
|
|
if (!mSearchStr.isEmpty()) {
|
|
|
List<ComDataBean> thisList = new ArrayList<>();
|
|
|
- for(int i=0;i<ComDataBeanList.size();i++){
|
|
|
- if(ComDataBeanList.get(i).getItemremark().contains(mSearchStr)||ComDataBeanList.get(i).getItemName().contains(mSearchStr)){
|
|
|
+ for (int i = 0; i < ComDataBeanList.size(); i++) {
|
|
|
+ if (ComDataBeanList.get(i).getItemremark().contains(mSearchStr) || ComDataBeanList.get(i).getItemName().contains(mSearchStr)) {
|
|
|
thisList.add(ComDataBeanList.get(i));
|
|
|
}
|
|
|
- if(i == ComDataBeanList.size() -1){
|
|
|
+ if (i == ComDataBeanList.size() - 1) {
|
|
|
ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
@@ -523,11 +742,11 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
String mSearchStr = edit_et.getText().toString().trim();
|
|
|
if (!mSearchStr.isEmpty()) {
|
|
|
List<ComDataBean> thisList = new ArrayList<>();
|
|
|
- for(int i=0;i<ComDataBeanList.size();i++){
|
|
|
- if(ComDataBeanList.get(i).getItemremark().contains(mSearchStr)||ComDataBeanList.get(i).getItemName().contains(mSearchStr)){
|
|
|
+ for (int i = 0; i < ComDataBeanList.size(); i++) {
|
|
|
+ if (ComDataBeanList.get(i).getItemremark().contains(mSearchStr) || ComDataBeanList.get(i).getItemName().contains(mSearchStr)) {
|
|
|
thisList.add(ComDataBeanList.get(i));
|
|
|
}
|
|
|
- if(i == ComDataBeanList.size() -1){
|
|
|
+ if (i == ComDataBeanList.size() - 1) {
|
|
|
ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
@@ -551,7 +770,7 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
|
|
|
}
|
|
|
-// getRepairStep(mSearchStr);
|
|
|
+ // getRepairStep(mSearchStr);
|
|
|
ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
@@ -570,16 +789,15 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
});
|
|
|
|
|
|
|
|
|
-
|
|
|
- List<String> list=new ArrayList<>();
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
//确定
|
|
|
sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
list.clear();
|
|
|
|
|
|
- if (StringUtil.isEmpty(sc_code)){
|
|
|
- CommonUtil.toastNoRepeat(mActivity,"请选择工序");
|
|
|
+ if (StringUtil.isEmpty(sc_code)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择工序");
|
|
|
return;
|
|
|
}
|
|
|
etWhcode.setText(sc_code);
|
|
|
@@ -622,52 +840,52 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-// edit_et.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) {
|
|
|
-// if (ComDataBeanList.isEmpty()){
|
|
|
-// getfuzzySearchSourceData(edit_et.getText().toString().trim(),"不良");
|
|
|
-// }
|
|
|
-// if (s.length() >= 0) {
|
|
|
-// String mSearchStr = s.toString().trim();
|
|
|
-// LogUtil.i("mSearchStr",mSearchStr);
|
|
|
-// List<ComDataBean> thisList = new ArrayList<>();
|
|
|
-// for(int i=0;i<ComDataBeanList.size();i++){
|
|
|
-// if(ComDataBeanList.get(i).getSC_CODE().contains(mSearchStr)){
|
|
|
-// thisList.add(ComDataBeanList.get(i));
|
|
|
-// }
|
|
|
-// if(i == ComDataBeanList.size() -1){
|
|
|
-// ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
-// rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
-// LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
-//
|
|
|
-// } else {
|
|
|
-//
|
|
|
-// ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
-// rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
-//
|
|
|
-// }
|
|
|
-// ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
-// @Override
|
|
|
-// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
-// List<ComDataBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
-// for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
-// ipAndPortBeans.get(i).setChecked(false);
|
|
|
-// }
|
|
|
-// ipAndPortBeans.get(position).setChecked(true);
|
|
|
-// ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
-// }
|
|
|
-// });
|
|
|
-// }
|
|
|
-//
|
|
|
-// });
|
|
|
+ // edit_et.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) {
|
|
|
+ // if (ComDataBeanList.isEmpty()){
|
|
|
+ // getfuzzySearchSourceData(edit_et.getText().toString().trim(),"不良");
|
|
|
+ // }
|
|
|
+ // if (s.length() >= 0) {
|
|
|
+ // String mSearchStr = s.toString().trim();
|
|
|
+ // LogUtil.i("mSearchStr",mSearchStr);
|
|
|
+ // List<ComDataBean> thisList = new ArrayList<>();
|
|
|
+ // for(int i=0;i<ComDataBeanList.size();i++){
|
|
|
+ // if(ComDataBeanList.get(i).getSC_CODE().contains(mSearchStr)){
|
|
|
+ // thisList.add(ComDataBeanList.get(i));
|
|
|
+ // }
|
|
|
+ // if(i == ComDataBeanList.size() -1){
|
|
|
+ // ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
+ // rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ // LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ //
|
|
|
+ // } else {
|
|
|
+ //
|
|
|
+ // ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ // rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ // @Override
|
|
|
+ // public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ // List<ComDataBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
+ // for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ // ipAndPortBeans.get(i).setChecked(false);
|
|
|
+ // }
|
|
|
+ // ipAndPortBeans.get(position).setChecked(true);
|
|
|
+ // ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // });
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -686,6 +904,9 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
editPW = null;
|
|
|
CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
}
|
|
|
+ if (contView != null) {
|
|
|
+ contView = null;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -751,8 +972,8 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
|
|
if (progressDialog != null && progressDialog.isShowing()) {
|
|
|
-// loadingView.dismiss();
|
|
|
-// VolleyUtil.distoryVolley();
|
|
|
+ // loadingView.dismiss();
|
|
|
+ // VolleyUtil.distoryVolley();
|
|
|
return true;
|
|
|
}
|
|
|
if (detailPopwin != null && detailPopwin.isShowing()) {
|
|
|
@@ -771,6 +992,7 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
public boolean onFragmentBackPressed() {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
private class IpAndResourcesPortAdapter extends BaseQuickAdapter<ComDataBean, BaseViewHolder> {
|
|
|
private List<ComDataBean> mmmmList;
|
|
|
|
|
|
@@ -781,7 +1003,8 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
public void setmList(List<ComDataBean> mList) {
|
|
|
this.mmmmList = mList;
|
|
|
}
|
|
|
- public ComDataBean getBeanByPositon(int position){
|
|
|
+
|
|
|
+ public ComDataBean getBeanByPositon(int position) {
|
|
|
return mmmmList.get(position);
|
|
|
}
|
|
|
|
|
|
@@ -789,9 +1012,10 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
super(R.layout.fuzzy_ipandport_item, data);
|
|
|
this.mmmmList = data;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
protected void convert(BaseViewHolder helper, ComDataBean item) {
|
|
|
- helper.setText(R.id.macode_ip__Tv,item.getItemremark()+"-("+item.getItemName()+")");
|
|
|
+ helper.setText(R.id.macode_ip__Tv, item.getItemremark() + "-(" + item.getItemName() + ")");
|
|
|
LinearLayout line_true = helper.itemView.findViewById(R.id.line_true);
|
|
|
if (item.getChecked()) {
|
|
|
line_true.setSelected(true);
|
|
|
@@ -802,7 +1026,7 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
}
|
|
|
|
|
|
|
|
|
- private class ComDataBean{
|
|
|
+ private class ComDataBean {
|
|
|
String itemName = null;
|
|
|
String itemremark = null;
|
|
|
boolean Checked;
|
|
|
@@ -832,5 +1056,76 @@ public class WHCheckMakeMaterialFragment extends BaseFragment implements View.On
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ class ItmeNumberListAdapter extends BaseAdapter {
|
|
|
+ private List<ItemNumberBean> models;
|
|
|
+
|
|
|
+ public ItemNumberBean getModels(int item) {
|
|
|
+ if (ListUtils.getSize(models) > item) {
|
|
|
+ return models.get(item);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ItmeNumberListAdapter(List<ItemNumberBean> models) {
|
|
|
+ this.models = models;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setModels(List<ItemNumberBean> models) {
|
|
|
+ this.models = models;
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void addModls(List<ItemNumberBean> models) {
|
|
|
+ if (this.models == null) {
|
|
|
+ this.models = new ArrayList<>();
|
|
|
+ }
|
|
|
+ this.models.addAll(models);
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int getCount() {
|
|
|
+ return ListUtils.getSize(this.models);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object getItem(int i) {
|
|
|
+ return models.get(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public long getItemId(int i) {
|
|
|
+ return i;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public View getView(int i, View view, ViewGroup viewGroup) {
|
|
|
+ ItmeNumberListAdapter.ViewHoler holer = null;
|
|
|
+ if (view == null) {
|
|
|
+ holer = new ItmeNumberListAdapter.ViewHoler();
|
|
|
+ view = LayoutInflater.from(getActivity()).inflate(R.layout.fuzzy_ipandport_item, null);
|
|
|
+ holer.line_true = view.findViewById(R.id.line_true);
|
|
|
+ holer.macode_ip__Tv = view.findViewById(R.id.macode_ip__Tv);
|
|
|
+ view.setTag(holer);
|
|
|
+ } else {
|
|
|
+ holer = (ItmeNumberListAdapter.ViewHoler) view.getTag();
|
|
|
+ }
|
|
|
+ ItemNumberBean bean = models.get(i);
|
|
|
+ if (bean.isSelect()) {
|
|
|
+ holer.line_true.setSelected(true);
|
|
|
+ }else {
|
|
|
+ holer.line_true.setSelected(false);
|
|
|
+ }
|
|
|
+ holer.macode_ip__Tv.setText("料号: " + bean.getPR_CODE() + "\n" +
|
|
|
+ "名称: " + bean.getPR_DETAIL() + "\n" +
|
|
|
+ "规格: " + bean.getPR_SPEC()); //料号编号 + 名称 + 规格
|
|
|
+ return view;
|
|
|
+ }
|
|
|
+
|
|
|
+ class ViewHoler {
|
|
|
+ TextView macode_ip__Tv;
|
|
|
+ LinearLayout line_true;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|