|
|
@@ -0,0 +1,782 @@
|
|
|
+package com.uas.pda_smart_com_lg.fragment;
|
|
|
+
|
|
|
+import android.annotation.SuppressLint;
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+import android.os.Bundle;
|
|
|
+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.util.Log;
|
|
|
+import android.view.Gravity;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.view.Window;
|
|
|
+import android.view.inputmethod.EditorInfo;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.android.volley.toolbox.StringRequest;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
+
|
|
|
+import com.uas.pda_smart_com_lg.R;
|
|
|
+import com.uas.pda_smart_com_lg.activity.FunctionActivity;
|
|
|
+import com.uas.pda_smart_com_lg.adapter.CangKuAdapter;
|
|
|
+import com.uas.pda_smart_com_lg.bean.AddRuKubean;
|
|
|
+import com.uas.pda_smart_com_lg.bean.WhcodeBean;
|
|
|
+import com.uas.pda_smart_com_lg.global.GloableParams;
|
|
|
+import com.uas.pda_smart_com_lg.listener.MyEditorActionListener;
|
|
|
+import com.uas.pda_smart_com_lg.tools.SharedPreUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.CommonUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.Constants;
|
|
|
+import com.uas.pda_smart_com_lg.util.FastjsonUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.FragmentUtils;
|
|
|
+import com.uas.pda_smart_com_lg.util.HttpCallback;
|
|
|
+import com.uas.pda_smart_com_lg.util.HttpParams;
|
|
|
+import com.uas.pda_smart_com_lg.util.LogUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.StringUtil;
|
|
|
+import com.uas.pda_smart_com_lg.util.VollyRequest;
|
|
|
+import com.uas.pda_smart_com_lg.view.ClearableEditText;
|
|
|
+
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import razerdp.basepopup.BasePopupWindow;
|
|
|
+
|
|
|
+
|
|
|
+public class GoodOrBadFragment extends BaseFragment implements View.OnClickListener{
|
|
|
+
|
|
|
+ private static final int SCAN_BARCODE_CODE = 121;
|
|
|
+
|
|
|
+ private ClearableEditText ed_jump;
|
|
|
+ private StringRequest mStringRequest;
|
|
|
+ private PopupWindow mMenuPopupWindow;
|
|
|
+
|
|
|
+ private String pi_class;
|
|
|
+ private Button storage_in_add_detail_commit_btn;
|
|
|
+ private ImageView iv_search;
|
|
|
+ private String mwhcode;
|
|
|
+ private ImageView mListImageView;
|
|
|
+ private OnFinishListener mOnFinishListener;
|
|
|
+ private ArrayList<ComDataBean> ComDataBeanList;
|
|
|
+ private ClearableEditText edit_et;
|
|
|
+ private RecyclerView rv_line_ip_port_data;
|
|
|
+ private PopupWindow editPW;
|
|
|
+ private IpAndResourcesPortAdapter ipAndResourcesPortAdapter;
|
|
|
+ private String sc_name;
|
|
|
+ private String sc_code;
|
|
|
+ private String pi_type;
|
|
|
+ private String default_warehouse;
|
|
|
+ private List<AddRuKubean> stringList;
|
|
|
+ private ArrayList<AddRuKubean> Liststring;
|
|
|
+ private RecyclerView rv_content;
|
|
|
+ private CangKuAdapter reportDetailAdapter;
|
|
|
+ private String defaultRejectsWarehouse;
|
|
|
+ private TextView tv_moren;
|
|
|
+
|
|
|
+ public void setOnFinishListener(OnFinishListener onFinishListener) {
|
|
|
+ mOnFinishListener = onFinishListener;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDestroyView() {
|
|
|
+ super.onDestroyView();
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setListIconIvVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setScanIvVisible(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_goodorbadl;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setListIconIvVisible(false);
|
|
|
+ ed_jump = (ClearableEditText) root.findViewById(R.id.ed_jump);
|
|
|
+ ed_jump.requestFocus();
|
|
|
+ storage_in_add_detail_commit_btn = root.findViewById(R.id.storage_in_add_detail_commit_btn);
|
|
|
+ iv_search = root.findViewById(R.id.iv_search);
|
|
|
+ mListImageView = (ImageView) getActivity().findViewById(R.id.btn_actionbar_list_icon_iv);
|
|
|
+ rv_content = root.findViewById(R.id.rv_data);
|
|
|
+ tv_moren = root.findViewById(R.id.tv_moren);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+// pi_class = SharedPreUtil.getString(mActivity, "pi_class", "");
|
|
|
+// pi_type = SharedPreUtil.getString(mActivity, "pi_type", "");
|
|
|
+
|
|
|
+ pi_class = "完工入库单";
|
|
|
+ pi_type = "良品";
|
|
|
+ FunctionActivity.setTitle("新增入库("+pi_type+")");
|
|
|
+
|
|
|
+ Log.e("pi_class",pi_class);
|
|
|
+ storage_in_add_detail_commit_btn.setOnClickListener(this);
|
|
|
+ iv_search.setOnClickListener(this);
|
|
|
+
|
|
|
+ //隐藏右上角列表
|
|
|
+ ImageView btn_actionbar_list_icon_iv = mActivity.findViewById(R.id.btn_actionbar_list_icon_iv);
|
|
|
+ btn_actionbar_list_icon_iv.setVisibility(View.GONE);
|
|
|
+
|
|
|
+ stringList = new ArrayList<>();
|
|
|
+ Liststring = new ArrayList<>();
|
|
|
+ default_warehouse = SharedPreUtil.getString(mActivity
|
|
|
+ , Constants.FLAG.DEFAULT_WAREHOUSE_CACHE + CommonUtil.getUserName(mActivity), null);
|
|
|
+ defaultRejectsWarehouse = SharedPreUtil.getString(mActivity
|
|
|
+ , Constants.FLAG.CACHE_DEFAULT_REJECTS_WAREHOUSE + CommonUtil.getUserName(mActivity), null);
|
|
|
+
|
|
|
+ rv_content.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ reportDetailAdapter = new CangKuAdapter(Liststring);
|
|
|
+ reportDetailAdapter.setmList(Liststring);
|
|
|
+ rv_content.setAdapter(reportDetailAdapter);
|
|
|
+ reportDetailAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
|
|
|
+ List<AddRuKubean> addRuKubeans = reportDetailAdapter.getmList();
|
|
|
+ sc_code=addRuKubeans.get(i).getCode();
|
|
|
+ ed_jump.setText(addRuKubeans.get(i).getCode()+addRuKubeans.get(i).getName());
|
|
|
+ ed_jump.setSelection(ed_jump.getText().length());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (pi_type.equals("良品")){
|
|
|
+ if (!StringUtil.isEmpty(default_warehouse)){
|
|
|
+ tv_moren.setVisibility(View.VISIBLE);
|
|
|
+ getReparukuirStep(default_warehouse);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (!StringUtil.isEmpty(defaultRejectsWarehouse)){
|
|
|
+ tv_moren.setVisibility(View.VISIBLE);
|
|
|
+ getReparukuirStep(defaultRejectsWarehouse);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CommonUtil.setEditorActionListener(ed_jump, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mListImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+// GoodBadAddListFragment storageInAddListFragment = new GoodBadAddListFragment();
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putString("pi_class", GoodOrBadFragment.this.pi_class);
|
|
|
+// bundle.putInt("whichPage", StorageInAddListFragment.PAGE_STORAGE_ADD);
|
|
|
+// storageInAddListFragment.setArguments(bundle);
|
|
|
+// FragmentUtils.switchFragment(GoodOrBadFragment.this, storageInAddListFragment);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ ComDataBeanList = new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @SuppressLint("NonConstantResourceId")
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.iv_search:
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putInt(NewCheckCangKuFragment.FLAG_WHICH_PAGE, NewCheckCangKuFragment.STORAGE_IN_ADD_WAREHOUSE);
|
|
|
+// bundle.putString("etname",ed_jump.getText().toString().trim());
|
|
|
+// goSingleFragment(bundle);
|
|
|
+ getRepairStep("");
|
|
|
+ break;
|
|
|
+ case R.id.storage_in_add_detail_commit_btn:
|
|
|
+ getNewProdinout();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void getReparukuirStep(String data) {
|
|
|
+ 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","")
|
|
|
+ .addParam("piclass",pi_class)
|
|
|
+ .addParam("pi_type",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");
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
+ if (isSuccess){
|
|
|
+ if (dataArray == null){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"未搜索到匹配数据");
|
|
|
+ }else {
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ AddRuKubean addRuKubean = new AddRuKubean();
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ addRuKubean.setCode(data.getString("WH_CODE"));
|
|
|
+ addRuKubean.setName(data.getString("WH_DESCRIPTION"));
|
|
|
+ stringList.add(addRuKubean);
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] split = data.split(",");
|
|
|
+ for (String s : split) {
|
|
|
+ for (int i=0;i<stringList.size();i++){
|
|
|
+ AddRuKubean addRuKubean = new AddRuKubean();
|
|
|
+ if(stringList.get(i).getName().contains(s)||stringList.get(i).getCode().contains(s)){
|
|
|
+ addRuKubean.setCode(stringList.get(i).getCode());
|
|
|
+ addRuKubean.setName(stringList.get(i).getName());
|
|
|
+ Liststring.add(addRuKubean);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportDetailAdapter = new CangKuAdapter(Liststring);
|
|
|
+ reportDetailAdapter.setmList(Liststring);
|
|
|
+ rv_content.setAdapter(reportDetailAdapter);
|
|
|
+ reportDetailAdapter.notifyDataSetChanged();
|
|
|
+ reportDetailAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
|
|
|
+ List<AddRuKubean> addRuKubeans = reportDetailAdapter.getmList();
|
|
|
+ sc_code=addRuKubeans.get(i).getCode();
|
|
|
+ ed_jump.setText(addRuKubeans.get(i).getCode()+addRuKubeans.get(i).getName());
|
|
|
+ ed_jump.setSelection(ed_jump.getText().length());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getRepairStep(String trim) {
|
|
|
+ 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",pi_class)
|
|
|
+ .addParam("pi_type",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");
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
+ 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(JSONArray dataArray,String trim) {
|
|
|
+ ComDataBean bean;
|
|
|
+ ComDataBeanList.clear();
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ bean= new ComDataBean();
|
|
|
+ bean.setItemName(data.getString("WH_DESCRIPTION"));
|
|
|
+ bean.setItemremark(data.getString("WH_CODE"));
|
|
|
+ ComDataBeanList.add(bean);
|
|
|
+ }
|
|
|
+ if (trim.isEmpty()){
|
|
|
+ initresourcesPopupWindow();
|
|
|
+ }else {
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ ipAndResourcesPortAdapter.setmList(ComDataBeanList);
|
|
|
+ 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);
|
|
|
+ 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);
|
|
|
+ rv_line_ip_port_data = contView.findViewById(R.id.rv_ip_port_data);
|
|
|
+ rv_line_ip_port_data.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
+ rv_line_ip_port_data.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ ipAndResourcesPortAdapter.setmList(ComDataBeanList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ setlineAdapter(ComDataBeanList);
|
|
|
+// edit_et.setText(ct_qty.getText().toString().trim());
|
|
|
+
|
|
|
+ edit_et.requestFocus();
|
|
|
+ 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();
|
|
|
+ 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)){
|
|
|
+ thisList.add(ComDataBeanList.get(i));
|
|
|
+ }
|
|
|
+ if(i == ComDataBeanList.size() -1){
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+
|
|
|
+ }
|
|
|
+ List<ComDataBean> lineCodeEntities = ipAndResourcesPortAdapter.getmList();
|
|
|
+ for (int j = 0; j < lineCodeEntities.size(); j++) {
|
|
|
+ lineCodeEntities.get(j).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ List<ComDataBean> lineCodeEntities = ipAndResourcesPortAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<ComDataBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
+ sc_name = ipAndPortBeans.get(position).getItemName();
|
|
|
+ sc_code = ipAndPortBeans.get(position).getItemremark();
|
|
|
+ for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ ipAndPortBeans.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndPortBeans.get(position).setChecked(true);
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ search_im.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ 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)){
|
|
|
+ thisList.add(ComDataBeanList.get(i));
|
|
|
+ }
|
|
|
+ if(i == ComDataBeanList.size() -1){
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+
|
|
|
+ }
|
|
|
+ List<ComDataBean> lineCodeEntities = ipAndResourcesPortAdapter.getmList();
|
|
|
+ for (int j = 0; j < lineCodeEntities.size(); j++) {
|
|
|
+ lineCodeEntities.get(j).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ List<ComDataBean> lineCodeEntities = ipAndResourcesPortAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ }
|
|
|
+// getRepairStep(mSearchStr);
|
|
|
+ ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<ComDataBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
+ sc_name = ipAndPortBeans.get(position).getItemName();
|
|
|
+ sc_code = ipAndPortBeans.get(position).getItemremark();
|
|
|
+ for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ ipAndPortBeans.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndPortBeans.get(position).setChecked(true);
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ 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,"请选择工序");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ed_jump.setText(sc_code + "(" +sc_name+ ")");
|
|
|
+ ed_jump.requestFocus();
|
|
|
+ ed_jump.setSelection(ed_jump.getText().length());
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //取消
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ String mSearchStr = edit_et.getText().toString().trim();
|
|
|
+ if (mSearchStr.isEmpty()) {
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(ComDataBeanList);
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ List<ComDataBean> lineCodeEntities = ipAndResourcesPortAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<ComDataBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
+ sc_name = ipAndPortBeans.get(position).getItemName();
|
|
|
+ sc_code = ipAndPortBeans.get(position).getItemremark();
|
|
|
+ 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();
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setlineAdapter(ArrayList<ComDataBean> mList) {
|
|
|
+ LogUtil.i("mList", JSON.toJSONString(mList));
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(mList);
|
|
|
+ ipAndResourcesPortAdapter.setmList(ComDataBeanList);
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeListPopupWindow() {
|
|
|
+ if (editPW != null) {
|
|
|
+ editPW.dismiss();
|
|
|
+ editPW = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getNewProdinout() {
|
|
|
+ if (pi_type.equals("良品")){
|
|
|
+ pi_type="";
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_OUTMATERIAL_NEWPRODINOUT)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "getMaCode")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("pi_class", pi_class)//必填单据类型
|
|
|
+ .addParam("pi_whcode",sc_code)//必填 仓库
|
|
|
+ .addParam("pi_type",pi_type)//必填 仓库
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
+ if (isSuccess){
|
|
|
+ JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(),"data");
|
|
|
+ if (dataObject == null){
|
|
|
+
|
|
|
+ }else {
|
|
|
+ String pi_id = dataObject.getString("PI_ID") == null ? "" : dataObject.getString("PI_ID");
|
|
|
+ String pi_inoutno = dataObject.getString("PI_INOUTNO") == null ? "" : dataObject.getString("PI_INOUTNO");
|
|
|
+ String pi_status = dataObject.getString("PI_STATUS") == null ? "" : dataObject.getString("PI_STATUS");
|
|
|
+ String pi_invostatus = dataObject.getString("PI_INVOSTATUS") == null ? "" : dataObject.getString("PI_INVOSTATUS");
|
|
|
+ String pi_whcode = dataObject.getString("PI_WHCODE") == null ? "" : dataObject.getString("PI_WHCODE");
|
|
|
+ String pi_whname = dataObject.getString("PI_WHNAME") == null ? "" : dataObject.getString("PI_WHNAME");
|
|
|
+ jumpToStorageInAddDetail(pi_id,pi_inoutno,pi_whcode,pi_whname);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ private void jumpToStorageInAddDetail(String pi_id, String pi_inoutno, String pi_whcode,String pi_whname) {
|
|
|
+// GoodOrBadAddDetailFragment mFragment = new GoodOrBadAddDetailFragment();
|
|
|
+// Bundle bundle = new Bundle();
|
|
|
+// bundle.putString("pi_class", pi_class);
|
|
|
+// bundle.putString("pi_id", pi_id);
|
|
|
+// bundle.putString("pi_inoutno", pi_inoutno);
|
|
|
+// bundle.putString("pi_whcode", pi_whcode);
|
|
|
+// bundle.putString("pi_whname", pi_whname);
|
|
|
+// mFragment.setArguments(bundle);
|
|
|
+// FragmentUtils.switchFragment(GoodOrBadFragment.this, mFragment);
|
|
|
+
|
|
|
+ NewBePutInStorageOrderDetailFragment newOutboundDeliveryOrderDetailFragment = new NewBePutInStorageOrderDetailFragment();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("pi_inoutno", pi_inoutno);
|
|
|
+ newOutboundDeliveryOrderDetailFragment.setArguments(bundle);
|
|
|
+ // jltStorageInBarcodeFragment.setOnFinishListener(this);
|
|
|
+ FragmentUtils.switchFragment(GoodOrBadFragment.this, newOutboundDeliveryOrderDetailFragment);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode != Activity.RESULT_OK) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ if (hidden) {
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setListIconIvVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setScanIvVisible(false);
|
|
|
+ } else {
|
|
|
+ pi_class = "完工入库单";
|
|
|
+ pi_type = "良品";
|
|
|
+ FunctionActivity.setTitle("新增入库("+pi_type+")");
|
|
|
+ ((FunctionActivity) getActivity()).setMoreBtnVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setListIconIvVisible(false);
|
|
|
+ ((FunctionActivity) getActivity()).setScanIvVisible(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+// if (mWhichPage == PAGE_STORAGE_IN_ADD) {
|
|
|
+// if (mOnStorageInToListListener != null) {
|
|
|
+// mOnStorageInToListListener.onStorageInToList();
|
|
|
+// return true;
|
|
|
+// } else {
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+ return false;
|
|
|
+// }
|
|
|
+ }
|
|
|
+
|
|
|
+// private WhcodeBean mWhcodeBean;
|
|
|
+// @SuppressLint("SetTextI18n")
|
|
|
+// @Override
|
|
|
+// public void onSelection(int flag, Object selection) {
|
|
|
+// switch (flag) {
|
|
|
+// case NewCheckCangKuFragment.STORAGE_IN_ADD_WAREHOUSE:
|
|
|
+// mWhcodeBean = (WhcodeBean) selection;
|
|
|
+// mwhcode = mWhcodeBean.getWH_CODE();
|
|
|
+// ed_jump.setText(mWhcodeBean.getWH_CODE() + "(" + mWhcodeBean.getWH_DESCRIPTION() + ")");
|
|
|
+// ed_jump.requestFocus();
|
|
|
+// ed_jump.setSelection(ed_jump.getText().length());
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
+ public interface OnStorageInAddListener {
|
|
|
+ void onStorageInAdd();
|
|
|
+ }
|
|
|
+
|
|
|
+ public interface OnStorageInToListListener {
|
|
|
+ void onStorageInToList();
|
|
|
+ }
|
|
|
+
|
|
|
+ public interface OnFinishListener {
|
|
|
+ void onFinish(String pi_class, String pi_whcode, String pi_cardcode, long pi_id, String pi_inoutno, String pi_status, String pi_invostatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ private class IpAndResourcesPortAdapter extends BaseQuickAdapter<ComDataBean, BaseViewHolder> {
|
|
|
+ private List<ComDataBean> mmmmList;
|
|
|
+
|
|
|
+ public List<ComDataBean> getmList() {
|
|
|
+ return mmmmList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setmList(List<ComDataBean> mList) {
|
|
|
+ this.mmmmList = mList;
|
|
|
+ }
|
|
|
+ public ComDataBean getBeanByPositon(int position){
|
|
|
+ return mmmmList.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ private IpAndResourcesPortAdapter(@Nullable List<ComDataBean> data) {
|
|
|
+ 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()+")");
|
|
|
+ LinearLayout line_true = helper.itemView.findViewById(R.id.line_true);
|
|
|
+ if (item.getChecked()) {
|
|
|
+ line_true.setSelected(true);
|
|
|
+ } else {
|
|
|
+ line_true.setSelected(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private class ComDataBean{
|
|
|
+ String itemName = null;
|
|
|
+ String itemremark = null;
|
|
|
+ boolean Checked;
|
|
|
+
|
|
|
+ public boolean getChecked() {
|
|
|
+ return Checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setChecked(boolean checked) {
|
|
|
+ Checked = checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getItemName() {
|
|
|
+ return itemName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setItemName(String itemName) {
|
|
|
+ this.itemName = itemName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getItemremark() {
|
|
|
+ return itemremark;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setItemremark(String itemremark) {
|
|
|
+ this.itemremark = itemremark;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|