|
|
@@ -4,20 +4,21 @@ import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
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.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
|
+import android.util.Log;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
+import android.widget.AdapterView;
|
|
|
+import android.widget.AutoCompleteTextView;
|
|
|
import android.widget.Button;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.android.volley.Request;
|
|
|
@@ -29,6 +30,8 @@ import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
|
|
|
import com.uas.hystorage.R;
|
|
|
import com.uas.hystorage.activity.FunctionActivity;
|
|
|
import com.uas.hystorage.activity.IndexActivity;
|
|
|
+import com.uas.hystorage.adapter.MyaddAdapter;
|
|
|
+import com.uas.hystorage.bean.AddworkorderBean;
|
|
|
import com.uas.hystorage.global.GloableParams;
|
|
|
import com.uas.hystorage.tools.SharedPreUtil;
|
|
|
import com.uas.hystorage.util.CameraUtil;
|
|
|
@@ -38,9 +41,9 @@ import com.uas.hystorage.util.FastjsonUtil;
|
|
|
import com.uas.hystorage.util.HttpCallback;
|
|
|
import com.uas.hystorage.util.HttpParams;
|
|
|
import com.uas.hystorage.util.LogUtil;
|
|
|
+import com.uas.hystorage.util.MyArrayAdapter;
|
|
|
import com.uas.hystorage.util.StringUtil;
|
|
|
import com.uas.hystorage.util.VollyRequest;
|
|
|
-import com.uas.hystorage.view.ClearableEditText;
|
|
|
import com.uuzuche.lib_zxing.activity.CaptureActivity;
|
|
|
import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
|
|
|
@@ -52,10 +55,9 @@ import java.util.List;
|
|
|
* function:
|
|
|
*/
|
|
|
public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
- private ClearableEditText mSearch;
|
|
|
+ private AutoCompleteTextView mSearch;
|
|
|
private StringRequest mStringRequest;
|
|
|
private RefreshLayout mRefreshLayout;
|
|
|
- private RecyclerView fuzzyRv;
|
|
|
private List<FuzzyBean> fuzzyBeans;
|
|
|
private FuzzySearchAdapter fuzzyAdapter;
|
|
|
private Button startBtn;
|
|
|
@@ -72,12 +74,16 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
private int mFocusId;
|
|
|
private static final int SCAN_BARCODE_CODE = 201;
|
|
|
private String ifneedmj;
|
|
|
- private ClearableEditText ce_moju;
|
|
|
+ private AutoCompleteTextView ce_moju;
|
|
|
private TextView tv_mju;
|
|
|
private LinearLayout line_mju;
|
|
|
private boolean chentrueorflase = true;
|
|
|
- private TextView text_moju;
|
|
|
- private LinearLayout line_moju;
|
|
|
+ private ArrayList<AddworkorderBean> mFilterStorageInBeans;
|
|
|
+ private RecyclerView recyclerView;
|
|
|
+ private MyArrayAdapter autoStringAdapter;
|
|
|
+ private ImageView clean_iv;
|
|
|
+ private ImageView sear_iv;
|
|
|
+ private MyArrayAdapter searStringAdapter;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -95,17 +101,15 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
ce_moju = root.findViewById(R.id.ce_moju);
|
|
|
tv_mju = root.findViewById(R.id.tv_mju);
|
|
|
line_mju = root.findViewById(R.id.line_mju);
|
|
|
- text_moju = root.findViewById(R.id.text_moju);
|
|
|
- line_moju = root.findViewById(R.id.line_moju);
|
|
|
- //模糊查询展示的工单号列表
|
|
|
- fuzzyRv = root.findViewById(R.id.fuzzy_rv);
|
|
|
- fuzzyRv.addItemDecoration(new DividerItemDecoration(mActivity,LinearLayout.VERTICAL));
|
|
|
- fuzzyRv.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ clean_iv = root.findViewById(R.id.clean_iv);
|
|
|
+ sear_iv = root.findViewById(R.id.sear_iv);
|
|
|
|
|
|
fuzzyBeans = new ArrayList<>();
|
|
|
fuzzyAdapter = new FuzzySearchAdapter(fuzzyBeans);
|
|
|
fuzzyAdapter.setmList(fuzzyBeans);
|
|
|
- fuzzyRv.setAdapter(fuzzyAdapter);
|
|
|
+
|
|
|
+ recyclerView = mActivity.findViewById(R.id.id_item_remove_recyclerview);
|
|
|
+
|
|
|
|
|
|
mRefreshLayout.setEnableRefresh(false);
|
|
|
mRefreshLayout.setEnableLoadMore(false);
|
|
|
@@ -124,7 +128,20 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
|
|
|
@Override
|
|
|
protected void initEvents() {
|
|
|
-
|
|
|
+ clean_iv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ ce_moju.setText("");
|
|
|
+ ce_moju.requestFocus();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ sear_iv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ mSearch.setText("");
|
|
|
+ mSearch.requestFocus();
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
|
|
|
mScanImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
@@ -148,24 +165,8 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
mRefreshLayout.finishRefresh();
|
|
|
}
|
|
|
});
|
|
|
- mSearch.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 (s.length() >= 3) {
|
|
|
- String mSearchStr = s.toString().trim();
|
|
|
- LogUtil.i("mSearchStr",mSearchStr);
|
|
|
- fuzzySearchMa(mSearchStr);
|
|
|
- } else {
|
|
|
- fuzzyBeans.clear();
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ mSearch.addTextChangedListener(searchNoTextWatcher);
|
|
|
+
|
|
|
mSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
@Override
|
|
|
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
@@ -176,102 +177,191 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
+ mSearch.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ getLastBean(mSearch.getText().toString().trim());
|
|
|
+ }
|
|
|
+ });
|
|
|
//----------模具模糊搜索------------------------
|
|
|
+ ce_moju.addTextChangedListener(inOutNoTextWatcher);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- ce_moju.addTextChangedListener(new TextWatcher() {
|
|
|
- @Override
|
|
|
- public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
|
|
+ ce_moju.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
@Override
|
|
|
- public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
|
|
- @Override
|
|
|
- public void afterTextChanged(Editable s) {
|
|
|
- if (s.length() >= 3) {
|
|
|
- String mSearchStr = s.toString().trim();
|
|
|
- LogUtil.i("mSearchStr",mSearchStr);
|
|
|
- fuzzySearchMould(mSearchStr);
|
|
|
- } else {
|
|
|
- fuzzyBeans.clear();
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
+ mSearch.requestFocus();
|
|
|
+ mSearch.setSelection(mSearch.getText().length());
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
fuzzyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
FuzzyBean bean = fuzzyAdapter.getBeanByPositon(position);
|
|
|
String macode = bean.getMA_CODE();
|
|
|
- if (chentrueorflase){
|
|
|
- if (macode.length() > 0){
|
|
|
- line_moju.setVisibility(View.VISIBLE);
|
|
|
- text_moju.setText(macode);
|
|
|
- mSearch.requestFocus();
|
|
|
- mSearch.setSelection(mSearch.getText().length());
|
|
|
- ce_moju.setText("");
|
|
|
- }
|
|
|
- }else {
|
|
|
- if (macode.length() > 0){
|
|
|
- getLastBean(macode);
|
|
|
- mSearch.setText("");
|
|
|
- }
|
|
|
+ if (macode.length() > 0){
|
|
|
+ getLastBean(macode);
|
|
|
+ mSearch.setText("");
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ mFilterStorageInBeans = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//启动按钮启动事件
|
|
|
startBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- if (!StringUtil.isEmpty(ifneedmj)){
|
|
|
- if(!ifneedmj.equals("0")){
|
|
|
- if (text_moju.getText().toString().trim().isEmpty()){
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "请输入模具编号");
|
|
|
- return;
|
|
|
+ if (mFilterStorageInBeans==null||mFilterStorageInBeans.size()==0){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集工单号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (mFilterStorageInBeans.size()==1){
|
|
|
+ downonebangding();
|
|
|
+ }else {
|
|
|
+ downbangding();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ //多工单绑定
|
|
|
+ public void downbangding(){
|
|
|
+ if (!StringUtil.isEmpty(ifneedmj)){
|
|
|
+ if(!ifneedmj.equals("0")){
|
|
|
+ if (ce_moju.getText().toString().trim().isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入模具编号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// JSONArray jsonArray = new JSONArray();
|
|
|
+// JSONArray jsonArray2 = new JSONArray();
|
|
|
+// for (int i=0;i<mFilterStorageInBeans.size();i++){
|
|
|
+// DataJsonBean bean=new DataJsonBean(mFilterStorageInBeans.get(i).getLOTNO(),"");
|
|
|
+// jsonArray.add(bean);
|
|
|
+// jsonArray2.add(mFilterStorageInBeans.get(i).getLOTNO());
|
|
|
+// }
|
|
|
+ StringBuilder stringtext = new StringBuilder();
|
|
|
+ for (int i=0;i<mFilterStorageInBeans.size();i++){
|
|
|
+ stringtext.append(mFilterStorageInBeans.get(i).getLOTNO()).append(",");
|
|
|
+ }
|
|
|
+// Log.e("alone===1",jsonArray.toString());
|
|
|
+// Log.e("alone===2",jsonArray2.toString());
|
|
|
+ Log.e("alone===3", stringtext.toString());
|
|
|
+
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+// .url(GloableParams.ADDRESS_PDA_STARTMA)
|
|
|
+ .url(GloableParams.ADDRESS_STARTMAS)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "startMa")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("sc_code", sc_code)
|
|
|
+// .addParam("ma_code", detailOne.getString("MA_CODE"))
|
|
|
+ .addParam("macodes", stringtext.toString())
|
|
|
+ .addParam("mouldcode",ce_moju.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
+ if (isSuccess){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"启动成功");
|
|
|
+ mFilterStorageInBeans.clear();
|
|
|
+ Intent intent = new Intent(mActivity, IndexActivity.class);
|
|
|
+ intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
|
|
|
+ startActivity(intent);
|
|
|
+ }else {
|
|
|
+
|
|
|
}
|
|
|
+ progressDialog.dismiss();
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //单个工单绑定
|
|
|
+ public void downonebangding(){
|
|
|
+ if (!StringUtil.isEmpty(ifneedmj)){
|
|
|
+ if(!ifneedmj.equals("0")){
|
|
|
+ if (ce_moju.getText().toString().trim().isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请输入模具编号");
|
|
|
+ return;
|
|
|
}
|
|
|
- progressDialog.show();
|
|
|
- VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
- new HttpParams.Builder()
|
|
|
- .url(GloableParams.ADDRESS_PDA_STARTMA)
|
|
|
- .method(Request.Method.GET)
|
|
|
- .tag(TAG + "startMa")
|
|
|
- .flag(0)
|
|
|
- .addParam("sc_code", sc_code)
|
|
|
- .addParam("ma_code", detailOne.getString("MA_CODE"))
|
|
|
- .addParam("mouldcode",text_moju.getText().toString().trim())
|
|
|
- .build(), new HttpCallback() {
|
|
|
- @Override
|
|
|
- public void onSuccess(int flag, Object o) throws Exception {
|
|
|
- Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
- if (isSuccess){
|
|
|
- CommonUtil.toastNoRepeat(mActivity,"启动成功");
|
|
|
- Intent intent = new Intent(mActivity, IndexActivity.class);
|
|
|
- intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
|
|
|
- startActivity(intent);
|
|
|
- }else {
|
|
|
-
|
|
|
- }
|
|
|
- progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ StringBuilder stringtext = new StringBuilder();
|
|
|
+ for (int i=0;i<mFilterStorageInBeans.size();i++){
|
|
|
+ stringtext.append(mFilterStorageInBeans.get(i).getLOTNO()).append("");
|
|
|
+ }
|
|
|
+ Log.e("alone===3", stringtext.toString());
|
|
|
|
|
|
- }
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_PDA_STARTMA)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "startMa")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("sc_code", sc_code)
|
|
|
+ .addParam("ma_code", stringtext.toString())
|
|
|
+ .addParam("mouldcode",ce_moju.getText().toString().trim())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
+ if (isSuccess){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"启动成功");
|
|
|
+ mFilterStorageInBeans.clear();
|
|
|
+// SharedPreUtil.saveString(mActivity,"mojucode",ce_moju.getText().toString().trim());
|
|
|
+ Intent intent = new Intent(mActivity, IndexActivity.class);
|
|
|
+ intent.putExtra(Constants.FLAG.SC_CODE,sc_code);
|
|
|
+ startActivity(intent);
|
|
|
+ }else {
|
|
|
|
|
|
- @Override
|
|
|
- public void onFail(int flag, String failStr) throws Exception {
|
|
|
- progressDialog.dismiss();
|
|
|
- CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -310,43 +400,12 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
}
|
|
|
|
|
|
private void showDetailOneOrder(JSONObject dataObject) {
|
|
|
-// startBtn = mActivity.findViewById(R.id.start_btn);
|
|
|
-// startLl = mActivity.findViewById(R.id.start_ll);
|
|
|
-// gongdanhaoTv = mActivity.findViewById(R.id.gongdanhao_tv);
|
|
|
-// gongdanshuTv = mActivity.findViewById(R.id.gongdanshu_tv);
|
|
|
-// yibaogongTv = mActivity.findViewById(R.id.yibaogong_tv);
|
|
|
-// changpingTv = mActivity.findViewById(R.id.changping_tv);
|
|
|
-// mingchenTv = mActivity.findViewById(R.id.mingchen_tv);
|
|
|
-// guigeTv = mActivity.findViewById(R.id.guige_tv);
|
|
|
-
|
|
|
-//
|
|
|
-// "MA_CODE":"23505Q5", //工单号
|
|
|
-// "MA_QTY":2334, //工单数量
|
|
|
-// "MA_REPORTQTY":123, //报工数
|
|
|
-// "PR_DETAIL":"433454543", //物料名称
|
|
|
-// "PR_SPEC":"3456677788", //物料规格
|
|
|
-// "MA_PRODCODE":"21345467" //产品编号
|
|
|
-//
|
|
|
-// "data": {
|
|
|
-// "MA_CHECKSTATUSCODE": "APPROVE",
|
|
|
-// "MA_STATUSCODE": "AUDITED",
|
|
|
-// "MA_FINISHSTATUSCODE": "UNCOMPLET",
|
|
|
-// "MA_QTY": 22, //工单数量
|
|
|
-// "MA_REPORTYQTY": null, //报工数
|
|
|
-// "PR_DETAIL": "测试工单存在ECN", //物料名称
|
|
|
-// "PR_SPEC": null, //物料规格
|
|
|
-// "MA_PRODCODE": "UAS20181206001", 产品编号
|
|
|
-// "MA_CODE": "BZMB20181206002" //工单号
|
|
|
-// }
|
|
|
-
|
|
|
if (dataObject == null){
|
|
|
CommonUtil.toastNoRepeat(mActivity,"暂无工单详细信息");
|
|
|
startLlS.setVisibility(View.GONE);
|
|
|
- fuzzyRv.setVisibility(View.VISIBLE);
|
|
|
return;
|
|
|
}else {
|
|
|
startLlS.setVisibility(View.VISIBLE);
|
|
|
- fuzzyRv.setVisibility(View.GONE);
|
|
|
fuzzyBeans.clear();
|
|
|
detailOne = dataObject;
|
|
|
gongdanhaoTv.setText(dataObject.getString("MA_CODE") == null ? "-" :dataObject.getString("MA_CODE"));
|
|
|
@@ -357,6 +416,26 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
changpingTv.setText(dataObject.getString("MA_PRODCODE") == null ? "-" :dataObject.getString("MA_PRODCODE"));
|
|
|
mingchenTv.setText(dataObject.getString("PR_DETAIL") == null ? "-" : dataObject.getString("PR_DETAIL"));
|
|
|
guigeTv.setText(dataObject.getString("PR_SPEC") == null ? "-" :dataObject.getString("PR_SPEC")+"");
|
|
|
+
|
|
|
+ for (int i=0;i<mFilterStorageInBeans.size();i++){
|
|
|
+ if (mFilterStorageInBeans.get(i).getLOTNO().equals(detailOne.getString("MA_CODE"))){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "工单重复");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ AddworkorderBean jltStorageInBean = new AddworkorderBean();
|
|
|
+ jltStorageInBean.setLOTNO(detailOne.getString("MA_CODE"));
|
|
|
+ jltStorageInBean.setQTY(detailOne.getString("MA_QTY"));
|
|
|
+ jltStorageInBean.setMA_PRODCODE(dataObject.getString("MA_PRODCODE"));
|
|
|
+ jltStorageInBean.setPR_DETAIL(dataObject.getString("PR_DETAIL"));
|
|
|
+ jltStorageInBean.setPR_SPEC(dataObject.getString("PR_SPEC"));
|
|
|
+ mFilterStorageInBeans.add(jltStorageInBean);
|
|
|
+ MyaddAdapter addadapter = new MyaddAdapter(mActivity, mFilterStorageInBeans);
|
|
|
+ recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ recyclerView.setAdapter(addadapter);
|
|
|
+ mSearch.requestFocus();
|
|
|
+ mSearch.setText("");
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -368,12 +447,13 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
}
|
|
|
|
|
|
ifneedmj = SharedPreUtil.getString(mActivity, Constants.FLAG.GANG_WEI_SOURCE_ifneedmj, null);
|
|
|
-
|
|
|
+ mSearch.setThreshold(1);
|
|
|
if (!StringUtil.isEmpty(ifneedmj)){
|
|
|
if (!ifneedmj.equals("0")){
|
|
|
line_mju.setVisibility(View.VISIBLE);
|
|
|
tv_mju.setTextColor(getResources().getColor(R.color.red));
|
|
|
ce_moju.requestFocus();
|
|
|
+ ce_moju.setThreshold(1);
|
|
|
}else {
|
|
|
line_mju.setVisibility(View.GONE);
|
|
|
tv_mju.setTextColor(getResources().getColor(R.color.blue));
|
|
|
@@ -381,20 +461,64 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- private void setfuzzyAdapter(List<FuzzyBean> mList) {
|
|
|
- fuzzyRv.setVisibility(View.VISIBLE);
|
|
|
- LogUtil.i("mList2", JSON.toJSONString(mList));
|
|
|
- if (fuzzyAdapter == null){
|
|
|
- fuzzyAdapter = new FuzzySearchAdapter(mList);
|
|
|
- fuzzyRv.setAdapter(fuzzyAdapter);
|
|
|
- }else {
|
|
|
- fuzzyAdapter.setmList(mList);
|
|
|
- fuzzyAdapter.notifyDataSetChanged();
|
|
|
+ private TextWatcher inOutNoTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
- //模糊查询
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+ //当字数超过3个,自动弹出输入提示框
|
|
|
+ if (charSequence.length() >= 3) {
|
|
|
+ LogUtil.i("mSearchStr",ce_moju.getText().toString().trim());
|
|
|
+ fuzzySearchMould(ce_moju.getText().toString().trim());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable editable) {
|
|
|
+ if (editable.length() == 0) {
|
|
|
+ clean_iv.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ clean_iv.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private TextWatcher searchNoTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
+ //当字数超过3个,自动弹出输入提示框
|
|
|
+ if (charSequence.length() >= 3) {
|
|
|
+ LogUtil.i("mSearchStr",mSearch.getText().toString().trim());
|
|
|
+ fuzzySearchMa(mSearch.getText().toString().trim());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable editable) {
|
|
|
+ if (editable.length() == 0) {
|
|
|
+ sear_iv.setVisibility(View.GONE);
|
|
|
+ } else {
|
|
|
+ sear_iv.setVisibility(View.VISIBLE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ //模糊查询工单号
|
|
|
private void fuzzySearchMa(String code){
|
|
|
VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
@@ -408,26 +532,23 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
- chentrueorflase = false;
|
|
|
Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
if (isSuccess){
|
|
|
JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(),"data");
|
|
|
if (dataArray == null || dataArray.size() == 0){
|
|
|
CommonUtil.toastNoRepeat(mActivity,"未搜索到匹配数据");
|
|
|
- fuzzyBeans.clear();
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
return;
|
|
|
}
|
|
|
- FuzzyBean bean = null;
|
|
|
- if (fuzzyBeans.size() > 0) fuzzyBeans.clear();
|
|
|
+ List<String> autoStrings = new ArrayList<>();
|
|
|
+ autoStrings.clear();
|
|
|
+ searStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, autoStrings);
|
|
|
+ if (mSearch != null) {
|
|
|
+ mSearch.setAdapter(searStringAdapter);
|
|
|
+ }
|
|
|
for (Object index : dataArray){
|
|
|
JSONObject data = (JSONObject) index;
|
|
|
- bean = new FuzzyBean(data.getString("MA_CODE"));
|
|
|
- fuzzyBeans.add(bean);
|
|
|
+ searStringAdapter.add(data.getString("MA_CODE"));
|
|
|
}
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
- startLlS.setVisibility(View.GONE);
|
|
|
- fuzzyRv.setVisibility(View.VISIBLE);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
@@ -458,27 +579,26 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
- chentrueorflase = true;
|
|
|
Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(),"success");
|
|
|
if (isSuccess){
|
|
|
JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(),"data");
|
|
|
if (dataArray == null || dataArray.size() == 0){
|
|
|
CommonUtil.toastNoRepeat(mActivity,"未搜索到匹配数据");
|
|
|
- fuzzyBeans.clear();
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
return;
|
|
|
}
|
|
|
- FuzzyBean bean = null;
|
|
|
- if (fuzzyBeans.size() > 0) fuzzyBeans.clear();
|
|
|
+ List<String> autoStrings = new ArrayList<>();
|
|
|
+ autoStrings.clear();
|
|
|
+ autoStringAdapter = new MyArrayAdapter<String>(mActivity, android.R.layout.simple_dropdown_item_1line, autoStrings);
|
|
|
+
|
|
|
+ if (ce_moju != null) {
|
|
|
+ ce_moju.setAdapter(autoStringAdapter);
|
|
|
+ }
|
|
|
for (Object index : dataArray){
|
|
|
+
|
|
|
JSONObject data = (JSONObject) index;
|
|
|
- bean = new FuzzyBean(data.getString("DE_CODE"),data.getString("DE_NAME"));
|
|
|
- fuzzyBeans.add(bean);
|
|
|
+// bean = new FuzzyBean(,data.getString("DE_NAME"));
|
|
|
+ autoStringAdapter.add(data.getString("DE_CODE"));
|
|
|
}
|
|
|
- setfuzzyAdapter(fuzzyBeans);
|
|
|
- startLlS.setVisibility(View.GONE);
|
|
|
- fuzzyRv.setVisibility(View.VISIBLE);
|
|
|
-
|
|
|
}else {
|
|
|
|
|
|
}
|
|
|
@@ -495,6 +615,8 @@ public class WorkOrderSearchFragment extends BaseFragment {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private class FuzzySearchAdapter extends BaseQuickAdapter<FuzzyBean, BaseViewHolder>{
|
|
|
private List<FuzzyBean> mList;
|
|
|
|