|
|
@@ -1,15 +1,23 @@
|
|
|
package com.uas.huiyan.fragment;
|
|
|
|
|
|
import android.content.Context;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
+import android.support.annotation.Nullable;
|
|
|
import android.support.v4.app.Fragment;
|
|
|
+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.TextUtils;
|
|
|
import android.text.TextWatcher;
|
|
|
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.view.inputmethod.InputMethodManager;
|
|
|
import android.widget.AutoCompleteTextView;
|
|
|
@@ -18,6 +26,8 @@ import android.widget.CheckBox;
|
|
|
import android.widget.CompoundButton;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.PopupWindow;
|
|
|
import android.widget.RadioButton;
|
|
|
import android.widget.RadioGroup;
|
|
|
import android.widget.TextView;
|
|
|
@@ -29,19 +39,25 @@ import com.android.volley.Request;
|
|
|
import com.android.volley.Response;
|
|
|
import com.android.volley.VolleyError;
|
|
|
import com.android.volley.toolbox.StringRequest;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.uas.huiyan.R;
|
|
|
import com.uas.huiyan.application.PdaApplication;
|
|
|
import com.uas.huiyan.bean.LineInfoBean;
|
|
|
+import com.uas.huiyan.bean.SmtWorkorder;
|
|
|
import com.uas.huiyan.global.GloableParams;
|
|
|
import com.uas.huiyan.tools.DataSourceManager;
|
|
|
import com.uas.huiyan.tools.SharedPreUtil;
|
|
|
import com.uas.huiyan.tools.VolleyUtil;
|
|
|
import com.uas.huiyan.util.CommonUtil;
|
|
|
import com.uas.huiyan.util.Constants;
|
|
|
+import com.uas.huiyan.util.FastjsonUtil;
|
|
|
import com.uas.huiyan.util.HttpCallback;
|
|
|
import com.uas.huiyan.util.HttpParams;
|
|
|
import com.uas.huiyan.util.JsonUtils;
|
|
|
+import com.uas.huiyan.util.LogUtil;
|
|
|
import com.uas.huiyan.util.MyArrayAdapter;
|
|
|
+import com.uas.huiyan.util.StringUtil;
|
|
|
import com.uas.huiyan.util.VolleyRequest;
|
|
|
import com.uas.huiyan.view.ClearableEditText;
|
|
|
import com.uas.huiyan.view.ConfirmDialog;
|
|
|
@@ -56,6 +72,8 @@ import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+import razerdp.basepopup.BasePopupWindow;
|
|
|
+
|
|
|
/**
|
|
|
* SMT 作业设备
|
|
|
* Created by RaoMeng
|
|
|
@@ -67,8 +85,8 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
|
|
|
private ClearableEditText etLineCode;
|
|
|
private AutoCompleteTextView etJobCode;
|
|
|
- private RadioGroup mBoardRadioGroup,rg_tietiaoma;
|
|
|
- private RadioButton mARadioButton, mBRadioButton,mCRadioButton;
|
|
|
+ private RadioGroup mBoardRadioGroup;
|
|
|
+ private RadioButton mARadioButton, mBRadioButton, mCRadioButton;
|
|
|
Context context;
|
|
|
private TextView tvNotice;
|
|
|
private CheckBox mOrderCheckBox;
|
|
|
@@ -83,7 +101,15 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
private MyArrayAdapter<String> mAutoStringAdapter;
|
|
|
private boolean mIgnoreFocusChange = false;
|
|
|
private String mCacheLine = "";
|
|
|
- private String isPasteBarcode = "";
|
|
|
+ private ClearableEditText cet_program_name;
|
|
|
+ private ImageView iv_search;
|
|
|
+ private ArrayList<SmtWorkorder> smtWorkorderList;
|
|
|
+ private ClearableEditText edit_et;
|
|
|
+ private RecyclerView rv_line_ip_port_data;
|
|
|
+ private SmtWorkorderAdapter smtWorkorderAdapter;
|
|
|
+ private PopupWindow editPW;
|
|
|
+ private String processcode; //程序名称
|
|
|
+ private String prodcode; //产品编号
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -104,7 +130,9 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
mCRadioButton = (RadioButton) root.findViewById(R.id.smt_feeder_C_rb);
|
|
|
mOrderCheckBox = (CheckBox) root.findViewById(R.id.smt_feeder_order_cb);
|
|
|
mJobsTitleTextView = (TextView) root.findViewById(R.id.smt_feeder_job_title_tv);
|
|
|
- rg_tietiaoma = root.findViewById(R.id.rg_tietiaoma);
|
|
|
+
|
|
|
+ cet_program_name = (ClearableEditText) root.findViewById(R.id.cet_program_name);
|
|
|
+ iv_search = (ImageView) root.findViewById(R.id.iv_search);
|
|
|
|
|
|
etLineCode.requestFocus();
|
|
|
|
|
|
@@ -114,6 +142,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
makeCraft = new JSONObject();
|
|
|
mLineInfo = new LineInfoBean();
|
|
|
|
|
|
+ smtWorkorderList = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -122,15 +151,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
mConfirmButton.setOnClickListener(this);
|
|
|
etJobCode.addTextChangedListener(this);
|
|
|
mBoardRadioGroup.setOnCheckedChangeListener(this);
|
|
|
-
|
|
|
- rg_tietiaoma.setOnCheckedChangeListener((group, checkedId) -> {
|
|
|
- if (checkedId == R.id.rb_yes) {
|
|
|
- isPasteBarcode = "是";
|
|
|
- } else if (checkedId == R.id.rb_no) {
|
|
|
- isPasteBarcode = "否";
|
|
|
- }
|
|
|
- Log.e("aaa","贴条码:" + isPasteBarcode);
|
|
|
- });
|
|
|
+ iv_search.setOnClickListener(this);
|
|
|
|
|
|
mCleanIv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
@@ -209,7 +230,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
|| (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
//disposeClick();
|
|
|
String trim = etJobCode.getText().toString().trim();
|
|
|
- getPasteBarcodeData(trim,isPasteBarcode);
|
|
|
+ //getPasteBarcodeData(trim,isPasteBarcode);
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
@@ -234,13 +255,13 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private void getPasteBarcodeData(String wo,String isPasteBarcode) {
|
|
|
+ private void getPasteBarcodeData(String wo, String isPasteBarcode) {
|
|
|
progressDialog.show();
|
|
|
VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
.url(GloableParams.ADDRESS_GET_PASTE_BARCODE)
|
|
|
.method(Request.Method.POST)
|
|
|
- .addParam("wo",wo)
|
|
|
+ .addParam("wo", wo)
|
|
|
.addParam("res", isPasteBarcode)
|
|
|
.build(), new HttpCallback() {
|
|
|
@Override
|
|
|
@@ -248,14 +269,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
String result = o.toString();
|
|
|
com.alibaba.fastjson.JSONObject resultObject = JSON.parseObject(result);
|
|
|
com.alibaba.fastjson.JSONObject dataObject = resultObject.getJSONObject("data");
|
|
|
- if (dataObject != null) {
|
|
|
- String pr_tm_user = dataObject.getString("PR_TM_USER");
|
|
|
- if (pr_tm_user.equals("是")) {
|
|
|
- rg_tietiaoma.check(R.id.rb_ok);
|
|
|
- }else if (pr_tm_user.equals("否")){
|
|
|
- rg_tietiaoma.check(R.id.rb_no);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
progressDialog.dismiss();
|
|
|
}
|
|
|
|
|
|
@@ -269,95 +283,172 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 设备编号输入框回车事件以及失去焦点事件
|
|
|
+ * 线别输入框回车事件以及失去焦点事件
|
|
|
* 获取线别信息
|
|
|
*
|
|
|
* @param lineCode
|
|
|
*/
|
|
|
private void getLineInfo(String lineCode) {
|
|
|
- final String maCode = etJobCode.getText().toString().trim();
|
|
|
-
|
|
|
progressDialog.show();
|
|
|
- String url = null;
|
|
|
- try {
|
|
|
- if (!TextUtils.isEmpty(maCode)) {
|
|
|
- url = GloableParams.ADDRESS_SMT_GET_DEVICE_LINE
|
|
|
- + "?li_code=" + URLEncoder.encode(lineCode, "utf-8")
|
|
|
- + "&dl_table=" + mDlTable + "&ma_code=" + URLEncoder.encode(maCode, "utf-8")
|
|
|
- + "&has_noma=" + mOrderCheckBox.isChecked();
|
|
|
- } else {
|
|
|
- url = GloableParams.ADDRESS_SMT_GET_DEVICE_LINE
|
|
|
- + "?li_code=" + URLEncoder.encode(lineCode, "utf-8");
|
|
|
- }
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- e.printStackTrace();
|
|
|
+ String maCode = etJobCode.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(maCode)) {
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SMT_GET_DEVICE_LINE)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getNameData")
|
|
|
+ .addParam("li_code", lineCode) //线别
|
|
|
+ .flag(0)
|
|
|
+ .build(), httpCallback);
|
|
|
+ }else {
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SMT_GET_DEVICE_LINE)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getNameData")
|
|
|
+ .addParam("li_code", lineCode) //线别
|
|
|
+ .addParam("ma_code", maCode) //工单
|
|
|
+ .addParam("dl_table", mDlTable) //板面
|
|
|
+ .addParam("ps_processcode", processcode) //程序名称
|
|
|
+ .addParam("has_noma", "" + mOrderCheckBox.isChecked()) //是否有工单
|
|
|
+ .flag(0)
|
|
|
+ .build(), httpCallback);
|
|
|
}
|
|
|
- PdaApplication.mRequestQueue.cancelAll(TAG + "getLine");
|
|
|
|
|
|
- mStringRequest = new StringRequest(Request.Method.GET, url,
|
|
|
- new Response.Listener<String>() {
|
|
|
- @Override
|
|
|
- public void onResponse(String s) {
|
|
|
- if (progressDialog.isShowing())
|
|
|
- progressDialog.dismiss();
|
|
|
- try {
|
|
|
- Log.d("result", s);
|
|
|
- JSONObject resultObject = new JSONObject(s);
|
|
|
- if (resultObject.optBoolean("success")) {
|
|
|
- JSONObject dataObject = resultObject.optJSONObject("data");
|
|
|
- if (dataObject != null) {
|
|
|
- mLineInfo = new LineInfoBean();
|
|
|
- mLineInfo.setDL_ID(JsonUtils.optLongNotNull(dataObject, "DL_ID"));
|
|
|
- mLineInfo.setDL_DECODE(JsonUtils.optStringNull(dataObject, "DL_DECODE"));
|
|
|
- mLineInfo.setDL_LINECODE(JsonUtils.optStringNull(dataObject, "DL_LINECODE"));
|
|
|
- mLineInfo.setDL_MACODE(JsonUtils.optStringNull(dataObject, "DL_MACODE"));
|
|
|
- mLineInfo.setDL_TABLE(JsonUtils.optStringNull(dataObject, "DL_TABLE"));
|
|
|
- mLineInfo.setDL_STATUSCODE(JsonUtils.optStringNull(dataObject, "DL_STATUSCODE"));
|
|
|
- mLineInfo.setDL_STATUS(JsonUtils.optStringNull(dataObject, "DL_STATUS"));
|
|
|
- mLineInfo.setPS_ID(JsonUtils.optLongNotNull(dataObject, "PS_ID"));
|
|
|
- mLineInfo.setMA_ID(JsonUtils.optLongNotNull(dataObject, "MA_ID"));
|
|
|
- mLineInfo.setDL_PRODCODE(JsonUtils.optStringNotNull(dataObject, "DL_PRODCODE"));
|
|
|
-
|
|
|
- PdaApplication.putDataCache2Map(Constants.FLAG.SMT_DEVICE_LINE_CACHE, mLineInfo);
|
|
|
- gotoSMTContentFragment();
|
|
|
- } else {
|
|
|
- CommonUtil.toastNoRepeat(mActivity, "请录入工单号或产品代码!");
|
|
|
- etJobCode.requestFocus();
|
|
|
- CommonUtil.openKeybord(etJobCode, mActivity);
|
|
|
- mIgnoreFocusChange = false;
|
|
|
- }
|
|
|
+// progressDialog.show();
|
|
|
+// String url = null;
|
|
|
+// try {
|
|
|
+// if (!TextUtils.isEmpty(maCode)) {
|
|
|
+// url = GloableParams.ADDRESS_SMT_GET_DEVICE_LINE
|
|
|
+// + "?li_code=" + URLEncoder.encode(lineCode, "utf-8")
|
|
|
+// + "&dl_table=" + mDlTable + "&ma_code=" + URLEncoder.encode(maCode, "utf-8")
|
|
|
+// + "&has_noma=" + mOrderCheckBox.isChecked();
|
|
|
+// } else {
|
|
|
+// url = GloableParams.ADDRESS_SMT_GET_DEVICE_LINE
|
|
|
+// + "?li_code=" + URLEncoder.encode(lineCode, "utf-8");
|
|
|
+// }
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// PdaApplication.mRequestQueue.cancelAll(TAG + "getLine");
|
|
|
+//
|
|
|
+// mStringRequest = new StringRequest(Request.Method.GET, url,
|
|
|
+// new Response.Listener<String>() {
|
|
|
+// @Override
|
|
|
+// public void onResponse(String s) {
|
|
|
+// if (progressDialog.isShowing())
|
|
|
+// progressDialog.dismiss();
|
|
|
+// try {
|
|
|
+// Log.d("result", s);
|
|
|
+// JSONObject resultObject = new JSONObject(s);
|
|
|
+// if (resultObject.optBoolean("success")) {
|
|
|
+// JSONObject dataObject = resultObject.optJSONObject("data");
|
|
|
+// if (dataObject != null) {
|
|
|
+// mLineInfo = new LineInfoBean();
|
|
|
+// mLineInfo.setDL_ID(JsonUtils.optLongNotNull(dataObject, "DL_ID"));
|
|
|
+// mLineInfo.setDL_DECODE(JsonUtils.optStringNull(dataObject, "DL_DECODE"));
|
|
|
+// mLineInfo.setDL_LINECODE(JsonUtils.optStringNull(dataObject, "DL_LINECODE"));
|
|
|
+// mLineInfo.setDL_MACODE(JsonUtils.optStringNull(dataObject, "DL_MACODE"));
|
|
|
+// mLineInfo.setDL_TABLE(JsonUtils.optStringNull(dataObject, "DL_TABLE"));
|
|
|
+// mLineInfo.setDL_STATUSCODE(JsonUtils.optStringNull(dataObject, "DL_STATUSCODE"));
|
|
|
+// mLineInfo.setDL_STATUS(JsonUtils.optStringNull(dataObject, "DL_STATUS"));
|
|
|
+// mLineInfo.setPS_ID(JsonUtils.optLongNotNull(dataObject, "PS_ID"));
|
|
|
+// mLineInfo.setMA_ID(JsonUtils.optLongNotNull(dataObject, "MA_ID"));
|
|
|
+// mLineInfo.setDL_PRODCODE(JsonUtils.optStringNotNull(dataObject, "DL_PRODCODE"));
|
|
|
+//
|
|
|
+// PdaApplication.putDataCache2Map(Constants.FLAG.SMT_DEVICE_LINE_CACHE, mLineInfo);
|
|
|
+// gotoSMTContentFragment();
|
|
|
+// } else {
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "请录入工单号或产品代码!");
|
|
|
+// etJobCode.requestFocus();
|
|
|
+// CommonUtil.openKeybord(etJobCode, mActivity);
|
|
|
+// mIgnoreFocusChange = false;
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
+// } catch (JSONException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// },
|
|
|
+// new Response.ErrorListener() {
|
|
|
+// @Override
|
|
|
+// public void onErrorResponse(VolleyError volleyError) {
|
|
|
+// String errorToast = CommonUtil.showErrorToast(volleyError, true);
|
|
|
+// if (progressDialog.isShowing())
|
|
|
+// progressDialog.dismiss();
|
|
|
+// mIgnoreFocusChange = false;
|
|
|
+// etJobCode.setText("");
|
|
|
+// if (TextUtils.isEmpty(maCode)) {
|
|
|
+// etLineCode.setText("");
|
|
|
+// etLineCode.requestFocus();
|
|
|
+// } else {
|
|
|
+// etJobCode.requestFocus();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }) {
|
|
|
+// @Override
|
|
|
+// public Map<String, String> getHeaders() throws AuthFailureError {
|
|
|
+// return VolleyUtil.getVolleyUtil().setCookies();
|
|
|
+// }
|
|
|
+// };
|
|
|
+// mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
|
|
|
+// mStringRequest.setTag(TAG + "getLine");
|
|
|
+// PdaApplication.mRequestQueue.add(mStringRequest);\
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- new Response.ErrorListener() {
|
|
|
- @Override
|
|
|
- public void onErrorResponse(VolleyError volleyError) {
|
|
|
- String errorToast = CommonUtil.showErrorToast(volleyError, true);
|
|
|
- if (progressDialog.isShowing())
|
|
|
- progressDialog.dismiss();
|
|
|
+ private HttpCallback httpCallback = new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ if (progressDialog.isShowing())
|
|
|
+ progressDialog.dismiss();
|
|
|
+ try {
|
|
|
+ Log.d("result", o.toString());
|
|
|
+ JSONObject resultObject = new JSONObject(o.toString());
|
|
|
+ if (resultObject.optBoolean("success")) {
|
|
|
+ JSONObject dataObject = resultObject.optJSONObject("data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ mLineInfo = new LineInfoBean();
|
|
|
+ mLineInfo.setDL_ID(JsonUtils.optLongNotNull(dataObject, "DL_ID"));
|
|
|
+ mLineInfo.setDL_DECODE(JsonUtils.optStringNull(dataObject, "DL_DECODE"));
|
|
|
+ mLineInfo.setDL_LINECODE(JsonUtils.optStringNull(dataObject, "DL_LINECODE"));
|
|
|
+ mLineInfo.setDL_MACODE(JsonUtils.optStringNull(dataObject, "DL_MACODE"));
|
|
|
+ mLineInfo.setDL_TABLE(JsonUtils.optStringNull(dataObject, "DL_TABLE"));
|
|
|
+ mLineInfo.setDL_STATUSCODE(JsonUtils.optStringNull(dataObject, "DL_STATUSCODE"));
|
|
|
+ mLineInfo.setDL_STATUS(JsonUtils.optStringNull(dataObject, "DL_STATUS"));
|
|
|
+ mLineInfo.setPS_ID(JsonUtils.optLongNotNull(dataObject, "PS_ID"));
|
|
|
+ mLineInfo.setMA_ID(JsonUtils.optLongNotNull(dataObject, "MA_ID"));
|
|
|
+ mLineInfo.setDL_PRODCODE(JsonUtils.optStringNotNull(dataObject, "DL_PRODCODE"));
|
|
|
+
|
|
|
+ PdaApplication.putDataCache2Map(Constants.FLAG.SMT_DEVICE_LINE_CACHE, mLineInfo);
|
|
|
+ gotoSMTContentFragment();
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请录入工单号或产品代码!");
|
|
|
+ etJobCode.requestFocus();
|
|
|
+ CommonUtil.openKeybord(etJobCode, mActivity);
|
|
|
mIgnoreFocusChange = false;
|
|
|
- etJobCode.setText("");
|
|
|
- if (TextUtils.isEmpty(maCode)) {
|
|
|
- etLineCode.setText("");
|
|
|
- etLineCode.requestFocus();
|
|
|
- } else {
|
|
|
- etJobCode.requestFocus();
|
|
|
- }
|
|
|
}
|
|
|
- }) {
|
|
|
- @Override
|
|
|
- public Map<String, String> getHeaders() throws AuthFailureError {
|
|
|
- return VolleyUtil.getVolleyUtil().setCookies();
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- };
|
|
|
- mStringRequest.setRetryPolicy(new DefaultRetryPolicy(10 * 1000, 0, 1f));
|
|
|
- mStringRequest.setTag(TAG + "getLine");
|
|
|
- PdaApplication.mRequestQueue.add(mStringRequest);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ mIgnoreFocusChange = false;
|
|
|
+ etJobCode.setText("");
|
|
|
+ if (TextUtils.isEmpty(etJobCode.getText().toString().trim())) {
|
|
|
+ etLineCode.setText("");
|
|
|
+ etLineCode.requestFocus();
|
|
|
+ } else {
|
|
|
+ etJobCode.requestFocus();
|
|
|
+ }
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
@Override
|
|
|
protected void initDatas() {
|
|
|
@@ -366,7 +457,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
VolleyUtil.getVolleyUtil().setVolleyHandler(handler);
|
|
|
//界面配置
|
|
|
((TextView) (getActivity().findViewById(R.id.tv_actionbar_withback))).setText(getString(R.string.title_device_smt));
|
|
|
-// editTextGetFocus(etLineCode);
|
|
|
+ // editTextGetFocus(etLineCode);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -383,18 +474,18 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
@Override
|
|
|
public void onPause() {
|
|
|
//销毁配置
|
|
|
-// hideKeyboard(etJobCode);
|
|
|
+ // hideKeyboard(etJobCode);
|
|
|
mIgnoreFocusChange = true;
|
|
|
super.onPause();
|
|
|
-// if (TextUtils.isEmpty(mCacheLine))
|
|
|
-// mCacheLine = etLineCode.getText().toString();
|
|
|
+ // if (TextUtils.isEmpty(mCacheLine))
|
|
|
+ // mCacheLine = etLineCode.getText().toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onDestroy() {
|
|
|
Log.e("SMT", "onDestroy");
|
|
|
//销毁配置
|
|
|
-// hideKeyboard(etJobCode);
|
|
|
+ // hideKeyboard(etJobCode);
|
|
|
VolleyUtil.distoryVolley();
|
|
|
mIgnoreFocusChange = true;
|
|
|
super.onDestroy();
|
|
|
@@ -444,8 +535,8 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
//获得用户输入的设备号
|
|
|
String serverDev = makeCraft.getString("mc_devcode").trim();
|
|
|
//如果用户输入的设备号与服务器返回的设备号不一致
|
|
|
-// disposeDeviceAfterConfirmDevice();
|
|
|
-// gotoSMTContentFragment();
|
|
|
+ // disposeDeviceAfterConfirmDevice();
|
|
|
+ // gotoSMTContentFragment();
|
|
|
if (!(serverDev.equals(userStr))) {
|
|
|
//弹出对话框让用户选择
|
|
|
Log.e("SCSMT", "1");
|
|
|
@@ -520,7 +611,7 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
|
|
|
//跳转到SMT采集页面 上料操作主页面
|
|
|
private void gotoSMTContentFragment() {
|
|
|
-// etLineCode.setText("");
|
|
|
+ // etLineCode.setText("");
|
|
|
SharedPreUtil.saveString(mActivity, Constants.FLAG.SMT_LINECODE_CACHE + CommonUtil.getUserName(mActivity) + CommonUtil.getFunMaster(mActivity), mLineInfo.getDL_LINECODE());
|
|
|
etJobCode.setText("");
|
|
|
Fragment tmpFragment = new SCSMTIndexFragment();
|
|
|
@@ -628,12 +719,274 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- String trim = etJobCode.getText().toString().trim();
|
|
|
- getPasteBarcodeData(trim,isPasteBarcode);
|
|
|
-// disposeClick();
|
|
|
-// confirmDevice();
|
|
|
- String lineCode = etLineCode.getText().toString().trim();
|
|
|
- getLineInfo(lineCode);
|
|
|
+ switch (v.getId()) {
|
|
|
+ case R.id.iv_search:
|
|
|
+ String liceCode = etLineCode.getText().toString().trim();
|
|
|
+ String jobCode = etJobCode.getText().toString().trim();
|
|
|
+ if (TextUtils.isEmpty(jobCode)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请填写工单和选择板面");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getNameData(liceCode, jobCode, mDlTable);
|
|
|
+ break;
|
|
|
+ case R.id.btn_device_ok_smt:
|
|
|
+ //String trim = etJobCode.getText().toString().trim();
|
|
|
+ // getPasteBarcodeData(trim,isPasteBarcode);
|
|
|
+ // disposeClick();
|
|
|
+ // confirmDevice();
|
|
|
+ String lineCode = etLineCode.getText().toString().trim();
|
|
|
+ getLineInfo(lineCode);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getNameData(String li_code, String ma_code, String dl_table) {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GET_PROD_SMT)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getNameData")
|
|
|
+ .addParam("li_code", li_code)
|
|
|
+ .addParam("ma_code", ma_code)
|
|
|
+ .addParam("dl_table", dl_table)
|
|
|
+ .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 {
|
|
|
+ smtWorkorderList.clear();
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ com.alibaba.fastjson.JSONObject data = (com.alibaba.fastjson.JSONObject) index;
|
|
|
+ SmtWorkorder smtWorkorder = new SmtWorkorder();
|
|
|
+ smtWorkorder.setPS_ID(data.getInteger("PS_ID"));
|
|
|
+ smtWorkorder.setPS_PROCESSCODE(data.getString("PS_PROCESSCODE"));
|
|
|
+ smtWorkorder.setPS_TABLE(data.getString("PS_TABLE"));
|
|
|
+ smtWorkorder.setPS_PRODCODE(data.getString("PS_PRODCODE"));
|
|
|
+ smtWorkorderList.add(smtWorkorder);
|
|
|
+ }
|
|
|
+ initresourcesPopupWindow();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ etLineCode.setText("");
|
|
|
+ etJobCode.setText("");
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ 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));
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(smtWorkorderList);
|
|
|
+// smtWorkorderAdapter.setmList(smtWorkorderList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+// setlineAdapter(smtWorkorderList);
|
|
|
+
|
|
|
+ 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<SmtWorkorder> thisList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < smtWorkorderList.size(); i++) {
|
|
|
+ if (smtWorkorderList.get(i).getPS_PROCESSCODE().contains(mSearchStr) || smtWorkorderList.get(i).getPS_PRODCODE().contains(mSearchStr)) {
|
|
|
+ thisList.add(smtWorkorderList.get(i));
|
|
|
+ }
|
|
|
+ if (i == smtWorkorderList.size() - 1) {
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(thisList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+ }
|
|
|
+ List<SmtWorkorder> lineCodeEntities = smtWorkorderAdapter.getmList();
|
|
|
+ for (int j = 0; j < lineCodeEntities.size(); j++) {
|
|
|
+ lineCodeEntities.get(j).setIsSelect(false);
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(smtWorkorderList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ List<SmtWorkorder> lineCodeEntities = smtWorkorderAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<SmtWorkorder> ipAndPortBeans = smtWorkorderAdapter.getmList();
|
|
|
+ processcode = ipAndPortBeans.get(position).getPS_PROCESSCODE();
|
|
|
+ prodcode = ipAndPortBeans.get(position).getPS_PRODCODE();
|
|
|
+ for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ ipAndPortBeans.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ ipAndPortBeans.get(position).setIsSelect(true);
|
|
|
+ smtWorkorderAdapter.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<SmtWorkorder> thisList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < smtWorkorderList.size(); i++) {
|
|
|
+ if (smtWorkorderList.get(i).getPS_PROCESSCODE().contains(mSearchStr) || smtWorkorderList.get(i).getPS_PRODCODE().contains(mSearchStr)) {
|
|
|
+ thisList.add(smtWorkorderList.get(i));
|
|
|
+ }
|
|
|
+ if (i == smtWorkorderList.size() - 1) {
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(thisList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+
|
|
|
+ }
|
|
|
+ List<SmtWorkorder> lineCodeEntities = smtWorkorderAdapter.getmList();
|
|
|
+ for (int j = 0; j < lineCodeEntities.size(); j++) {
|
|
|
+ lineCodeEntities.get(j).setIsSelect(false);
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(smtWorkorderList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ List<SmtWorkorder> lineCodeEntities = smtWorkorderAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ }
|
|
|
+ // getRepairStep(mSearchStr);
|
|
|
+ smtWorkorderAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<SmtWorkorder> ipAndPortBeans = smtWorkorderAdapter.getmList();
|
|
|
+ processcode = ipAndPortBeans.get(position).getPS_PROCESSCODE();
|
|
|
+ prodcode = ipAndPortBeans.get(position).getPS_PRODCODE();
|
|
|
+ for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ ipAndPortBeans.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ ipAndPortBeans.get(position).setIsSelect(true);
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ //确定
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (StringUtil.isEmpty(processcode)) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择程序名称");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ cet_program_name.setText(processcode);
|
|
|
+ cet_program_name.requestFocus();
|
|
|
+ cet_program_name.setSelection(cet_program_name.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()) {
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(smtWorkorderList);
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ List<SmtWorkorder> lineCodeEntities = smtWorkorderAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ smtWorkorderAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<SmtWorkorder> ipAndPortBeans = smtWorkorderAdapter.getmList();
|
|
|
+ processcode = ipAndPortBeans.get(position).getPS_PROCESSCODE();
|
|
|
+ prodcode = ipAndPortBeans.get(position).getPS_PRODCODE();
|
|
|
+ for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+ ipAndPortBeans.get(i).setIsSelect(false);
|
|
|
+ }
|
|
|
+ ipAndPortBeans.get(position).setIsSelect(true);
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setlineAdapter(ArrayList<SmtWorkorder> mList) {
|
|
|
+ LogUtil.i("mList", JSON.toJSONString(mList));
|
|
|
+ smtWorkorderAdapter = new SmtWorkorderAdapter(mList);
|
|
|
+ smtWorkorderAdapter.setmList(smtWorkorderList);
|
|
|
+ smtWorkorderAdapter.notifyDataSetChanged();
|
|
|
+ rv_line_ip_port_data.setAdapter(smtWorkorderAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeListPopupWindow() {
|
|
|
+ if (editPW != null) {
|
|
|
+ editPW.dismiss();
|
|
|
+ editPW = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void confirmDevice() {
|
|
|
@@ -868,8 +1221,8 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
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 (confirmDialog != null && confirmDialog.isShowing()) {
|
|
|
@@ -895,4 +1248,38 @@ public class SCSMTFragment extends BaseFragment implements View.OnClickListener,
|
|
|
mDlTable = "C";
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private static class SmtWorkorderAdapter extends BaseQuickAdapter<SmtWorkorder, BaseViewHolder> {
|
|
|
+ private List<SmtWorkorder> mmmmList;
|
|
|
+
|
|
|
+ public List<SmtWorkorder> getmList() {
|
|
|
+ return mmmmList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setmList(List<SmtWorkorder> mList) {
|
|
|
+ this.mmmmList = mList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public SmtWorkorder getBeanByPositon(int position) {
|
|
|
+ return mmmmList.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ private SmtWorkorderAdapter(@Nullable List<SmtWorkorder> data) {
|
|
|
+ super(R.layout.item_smt_workorder, data);
|
|
|
+ this.mmmmList = data;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void convert(BaseViewHolder helper, SmtWorkorder item) {
|
|
|
+ helper.setText(R.id.tv_program_name, item.getPS_PROCESSCODE());
|
|
|
+ helper.setText(R.id.tv_product_no, item.getPS_PRODCODE());
|
|
|
+ LinearLayout line_true = helper.itemView.findViewById(R.id.ll_line_true);
|
|
|
+ if (item.getIsSelect()) {
|
|
|
+ line_true.setSelected(true);
|
|
|
+ } else {
|
|
|
+ line_true.setSelected(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|