|
|
@@ -12,6 +12,7 @@ import android.support.v7.widget.GridLayoutManager;
|
|
|
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.Base64;
|
|
|
import android.util.Log;
|
|
|
@@ -63,6 +64,7 @@ import com.uas.collection.util.Constants;
|
|
|
import com.uas.collection.util.FastjsonUtil;
|
|
|
import com.uas.collection.util.HttpCallback;
|
|
|
import com.uas.collection.util.HttpParams;
|
|
|
+import com.uas.collection.util.JsonUtils;
|
|
|
import com.uas.collection.util.LogUtil;
|
|
|
import com.uas.collection.util.MyArrayAdapter;
|
|
|
import com.uas.collection.util.StringUtil;
|
|
|
@@ -73,7 +75,6 @@ import org.jetbrains.annotations.NotNull;
|
|
|
import org.json.JSONException;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -108,7 +109,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
private PopupWindow editPW;
|
|
|
private List<IpAndPortBean> delists;
|
|
|
private List<LinecodeBean> linecodeBeanList;
|
|
|
- private List<ResourcesBean> resourcesBeanList;
|
|
|
+ private ArrayList<ResourcesBean> resourcesBeanList;
|
|
|
private IpAndPortAdapter andPortAdapter;
|
|
|
private IpAndlinecodePortAdapter ipAndlinecodePortAdapter;
|
|
|
private IpAndResourcesPortAdapter ipAndResourcesPortAdapter;
|
|
|
@@ -126,9 +127,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
private String pr_code;
|
|
|
private String pr_detail;
|
|
|
private ClearableEditText tv_dc_emcode;
|
|
|
+ private ClearableEditText tv_dc_line;
|
|
|
private ImageView iv_dc_emcode;
|
|
|
+ private ImageView iv_dc_line;
|
|
|
private int mFocusId;
|
|
|
private static final int SCAN_BARCODE_CODESD = 925;
|
|
|
+ private static final int SCAN_BARCODE_LINE = 888;
|
|
|
private RecyclerView rv_datachange;
|
|
|
private ArrayList<StorageRechargeAloneBean> mFeededList;
|
|
|
private SelectAdapter selectAdapter;
|
|
|
@@ -139,9 +143,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
private String sc_codecolleone;
|
|
|
private String ma_id;
|
|
|
private TextView tv_macode;
|
|
|
- private String va_codechushihua;
|
|
|
private String st_remarkce;
|
|
|
- private List<String> listce;
|
|
|
+ private RecyclerView rv_line_ip_port_data;
|
|
|
+ private RecyclerView rv_undesirable;
|
|
|
+ private SelectAdapterundesirable myAdapterundesirable;
|
|
|
+ private ArrayList<StorageRechargeAloneBean> mFeededListundesirable;
|
|
|
+ private String undesirablalone;
|
|
|
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
@@ -174,7 +181,6 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
ce_bit_number = root.findViewById(R.id.ce_bit_number);
|
|
|
iv_unhealthy_delete = root.findViewById(R.id.iv_unhealthy_delete);
|
|
|
iv_personnel_data = root.findViewById(R.id.iv_personnel_data);
|
|
|
-
|
|
|
mSmartTable = root.findViewById(R.id.jlt_storage_in_filter_list_st);
|
|
|
rv_data = root.findViewById(R.id.rv_data);
|
|
|
tv_em_name = root.findViewById(R.id.tv_em_name);
|
|
|
@@ -184,6 +190,9 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
rv_datachange = root.findViewById(R.id.rv_datachange);
|
|
|
rv_datapassqty = root.findViewById(R.id.rv_datapassqty);
|
|
|
tv_macode = root.findViewById(R.id.tv_macode);
|
|
|
+ tv_dc_line = root.findViewById(R.id.tv_dc_line);
|
|
|
+ iv_dc_line = root.findViewById(R.id.iv_dc_line);
|
|
|
+ rv_undesirable = root.findViewById(R.id.rv_undesirable);
|
|
|
|
|
|
mFilterStorageInBeans = Collections.synchronizedList(new ArrayList<>());
|
|
|
|
|
|
@@ -256,9 +265,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
|
|
|
@Override
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
- if (s.length() >=2) {
|
|
|
- getfuzzySearchData(et_linecode_smts.getText().toString().trim(),"");
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -277,6 +284,9 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
public void onClick(View v) {
|
|
|
et_linecode_smts.setText("");
|
|
|
et_linecode_smts.requestFocus();
|
|
|
+ tv_macode.setText("");
|
|
|
+ tv_pr_code.setText("产品编号");
|
|
|
+ tv_pr_detail.setText("产品名称");
|
|
|
}
|
|
|
});
|
|
|
linecodeBeanList = new ArrayList<>();
|
|
|
@@ -294,8 +304,8 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
if (actionId == EditorInfo.IME_ACTION_DONE
|
|
|
|| actionId == EditorInfo.IME_ACTION_SEND
|
|
|
|| (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
|
|
|
- String va_code = ce_resources.getText().toString().trim();
|
|
|
- getfuzzySearchSourceData(va_code,"");
|
|
|
+// String va_code = ce_resources.getText().toString().trim();
|
|
|
+// getfuzzySearchSourceData(va_code,"");
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
@@ -309,9 +319,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
|
|
|
@Override
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
- if (s.length() >=2) {
|
|
|
- getfuzzySearchSourceData(ce_resources.getText().toString().trim(),"");
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -353,7 +361,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
LinearLayoutManager layoutmanager = new LinearLayoutManager(mActivity);
|
|
|
// MyLayoutManager layout = new MyLayoutManager();
|
|
|
// layout.setAutoMeasureEnabled(true);//防止recyclerview高度为wrap时测量item高度0(一定要加这个属性,否则显示不出来)
|
|
|
- GridLayoutManager gridLayoutManager=new GridLayoutManager(mActivity,3);
|
|
|
+ GridLayoutManager gridLayoutManager=new GridLayoutManager(mActivity,5);
|
|
|
layoutmanager.setOrientation(LinearLayoutManager.HORIZONTAL);//列表横向显示
|
|
|
rv_datachange.setLayoutManager(gridLayoutManager);
|
|
|
setAdapter(mFeededList);
|
|
|
@@ -433,14 +441,34 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ iv_dc_line.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ tv_dc_line.requestFocus();
|
|
|
+ if (CameraUtil.hasCamera()) {
|
|
|
+ if (root.findFocus() != null) {
|
|
|
+ mFocusId = root.findFocus().getId();
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.setClass(mActivity, CaptureActivity.class);
|
|
|
+ startActivityForResult(intent, SCAN_BARCODE_LINE);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.STORAGEERECHADD, "NO");
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择您要操作的输入框");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
sc_codecolleone = SharedPreUtil.getString(mActivity, "sc_codecolleone", null);
|
|
|
ce_resources.setText(sc_codecolleone);
|
|
|
tv_station.setText(sc_codecolleone);
|
|
|
- va_codechushihua = ce_resources.getText().toString().trim();
|
|
|
- listce = new ArrayList<>();
|
|
|
- getfuzzySearchSourceData(va_codechushihua,"不良");
|
|
|
+ getunhealthyDataList(sc_codecolleone);
|
|
|
+ recycleDataundesirable(sc_codecolleone);
|
|
|
+
|
|
|
+
|
|
|
+// getfuzzySearchSourceData(va_codechushihua,"不良");
|
|
|
// for (int i=0;i<resourcesBeanList.size();i++){
|
|
|
// st_remarkce = resourcesBeanList.get(i).getST_REMARK();
|
|
|
// }
|
|
|
@@ -509,6 +537,9 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
String path = data2.getString("path");
|
|
|
String str2 = new String(Base64.decode(path.getBytes(),Base64.DEFAULT));
|
|
|
Glide.with(mActivity).load(str2).into(iv_personnel_data);
|
|
|
+ et_linecode_smts.clearFocus();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -720,7 +751,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
@Override
|
|
|
protected void convert(BaseViewHolder helper, ResourcesBean item) {
|
|
|
- helper.setText(R.id.macode_ip__Tv,item.getSC_NAME()+"("+item.getSC_CODE()+")");
|
|
|
+ helper.setText(R.id.macode_ip__Tv,item.getSC_CODE());
|
|
|
LinearLayout line_true = helper.itemView.findViewById(R.id.line_true);
|
|
|
if (item.getChecked()) {
|
|
|
line_true.setSelected(true);
|
|
|
@@ -804,22 +835,28 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
ipAndlinecodePortAdapter.notifyDataSetChanged();
|
|
|
|
|
|
}
|
|
|
-// else {
|
|
|
-// if (dataArray != null) {
|
|
|
-// for (int i = 0; i < dataArray.length(); i++) {
|
|
|
-// org.json.JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
-// if (dataObject != null) {
|
|
|
-// String pi_inoutno = JsonUtils.optStringNotNull(dataObject, "MA_CODE");
|
|
|
-// String pr_code = JsonUtils.optStringNotNull(dataObject, "PR_CODE");
|
|
|
-// String pr_detail = JsonUtils.optStringNotNull(dataObject, "PR_DETAIL");
|
|
|
-// if (!TextUtils.isEmpty(pi_inoutno))
|
|
|
-// mAutoStringAdapter.add(pi_inoutno);
|
|
|
-// tv_pr_code.setText("产品编号 "+pr_code);
|
|
|
-// tv_pr_detail.setText("产品名称 "+pr_detail);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ else {
|
|
|
+ if (dataArray != null) {
|
|
|
+ for (int i = 0; i < dataArray.length(); i++) {
|
|
|
+ org.json.JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ String ma_code = JsonUtils.optStringNotNull(dataObject, "MA_CODE");
|
|
|
+ String pr_code = JsonUtils.optStringNotNull(dataObject, "PR_CODE");
|
|
|
+ String pr_detail = JsonUtils.optStringNotNull(dataObject, "PR_DETAIL");
|
|
|
+ String ma_id = JsonUtils.optStringNotNull(dataObject, "MA_ID");
|
|
|
+ if (!TextUtils.isEmpty(ma_id))
|
|
|
+ mAutoStringAdapter.add(ma_code);
|
|
|
+ tv_pr_code.setText("产品编号 "+pr_code);
|
|
|
+ tv_pr_detail.setText("产品名称 "+pr_detail);
|
|
|
+ tv_macode.setText(""+ma_code);
|
|
|
+ et_linecode_smts.setText(ma_id);
|
|
|
+ et_linecode_smts.clearFocus();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
} catch (JSONException e) {
|
|
|
@@ -894,7 +931,6 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
for (int i = 0; i< resourcesBeanList.size(); i++){
|
|
|
StorageRechargeAloneBean bean=new StorageRechargeAloneBean(resourcesBeanList.get(i).getST_REMARK());
|
|
|
object_1ce.put("alone", resourcesBeanList.get(i).getST_REMARK());
|
|
|
- Log.e("listce===",resourcesBeanList.get(i).getST_REMARK()+"!");
|
|
|
jsonArrayce.add(bean);
|
|
|
}
|
|
|
|
|
|
@@ -917,19 +953,52 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-// else {
|
|
|
-// if (dataArray != null) {
|
|
|
-// for (int i = 0; i < dataArray.length(); i++) {
|
|
|
-// org.json.JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
-// if (dataObject != null) {
|
|
|
-// String pi_inoutno = JsonUtils.optStringNotNull(dataObject, "SC_CODE");
|
|
|
-// String st_remark = JsonUtils.optStringNotNull(dataObject, "ST_REMARK");
|
|
|
-// if (!TextUtils.isEmpty(pi_inoutno))
|
|
|
-// mAutoStringAdapte.add(pi_inoutno);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ else {
|
|
|
+ if (dataArray != null) {
|
|
|
+ for (int i = 0; i < dataArray.length(); i++) {
|
|
|
+ org.json.JSONObject dataObject = dataArray.optJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ String sc_code = JsonUtils.optStringNotNull(dataObject, "SC_CODE");
|
|
|
+ String st_remark = JsonUtils.optStringNotNull(dataObject, "ST_REMARK");
|
|
|
+ ce_resources.setText(sc_code);
|
|
|
+ if (!StringUtil.isEmpty(sc_code)){
|
|
|
+ SharedPreUtil.saveString(mActivity,"sc_codecolleone",sc_code);
|
|
|
+ }
|
|
|
+
|
|
|
+ tv_station.setText("当前岗位:"+sc_code);
|
|
|
+ if (!StringUtil.isEmpty(st_remark)){
|
|
|
+ if (st_remark.contains("|")){
|
|
|
+ String[] split = st_remark.split("\\|");
|
|
|
+ for (int j=0;j<split.length;j++){
|
|
|
+ ResourcesBean bean = new ResourcesBean();
|
|
|
+ bean.setST_REMARK(split[j]);
|
|
|
+ resourcesBeanList.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject jsonObjectce = new JSONObject();
|
|
|
+ JSONArray jsonArrayce = new JSONArray();
|
|
|
+ JSONObject object_1ce = new JSONObject();
|
|
|
+ for (int f = 0; f< resourcesBeanList.size(); f++){
|
|
|
+ StorageRechargeAloneBean bean=new StorageRechargeAloneBean(resourcesBeanList.get(f).getST_REMARK());
|
|
|
+ object_1ce.put("alone", resourcesBeanList.get(f).getST_REMARK());
|
|
|
+ jsonArrayce.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ jsonObjectce.put("formStore", jsonArrayce);
|
|
|
+ JSONArray dataArrayce = FastjsonUtil.getJSONArray(jsonObjectce.toString(), "formStore");
|
|
|
+ handleFeededData(dataArrayce);
|
|
|
+ ipAndunhealthyPortAdapter.setmList(resourcesBeanList);
|
|
|
+ ipAndunhealthyPortAdapter.notifyDataSetChanged();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
+ ce_bit_number.clearFocus();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -1006,6 +1075,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
String ec_passqtytrim;
|
|
|
public void getNewData(){
|
|
|
+ if (tv_dc_emcode.getText().toString().trim().isEmpty()){
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请采集人员编号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
String ce_work_codetrim = tv_macode.getText().toString().trim();
|
|
|
String at_stationtrim = ce_resources.getText().toString().trim();
|
|
|
String ce_bit_numbertrim = ce_bit_number.getText().toString().trim();
|
|
|
@@ -1020,6 +1095,17 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
for (int i=0;i<selectedItem.size();i++){
|
|
|
alonedata = selectedItem.get(i).getAlonedata();
|
|
|
}
|
|
|
+ ArrayList<StorageRechargeAloneBean> selectedundesirablItem = myAdapterundesirable.getSelectedItem();
|
|
|
+ if (selectedundesirablItem.size()==0){
|
|
|
+ undesirablalone=null;
|
|
|
+ }else {
|
|
|
+ for (int i=0;i<selectedundesirablItem.size();i++){
|
|
|
+ undesirablalone = selectedundesirablItem.get(i).getAlonedata();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
ArrayList<StorageRechargeAloneBean> selectAdapterQtySelectedItem = selectAdapterQty.getSelectedItem();
|
|
|
if (selectAdapterQtySelectedItem.size()==0){
|
|
|
ec_passqtytrim="1";
|
|
|
@@ -1039,11 +1125,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
object_1.put("SR_BADNAME",alonedata);//不良现象
|
|
|
object_1.put("SR_TYPE", "数据采集");//种类(数据采集/、外观维修/性能维修)
|
|
|
object_1.put("SR_LOCATION", ce_bit_numbertrim);//位号
|
|
|
- object_1.put("SR_REASON", "");//原因
|
|
|
+ object_1.put("SR_REASON", undesirablalone);//原因
|
|
|
object_1.put("SR_SN", "");//SN号
|
|
|
object_1.put("SR_REMARK", "");//备注/其他
|
|
|
object_1.put("SR_INMAN", "");//录入人
|
|
|
object_1.put("SR_INDATE", "");//录入时间
|
|
|
+ object_1.put("SR_EMCODE", tv_dc_emcode.getText().toString().trim());//人员编号
|
|
|
jsonArray.add(object_1);
|
|
|
Log.e("jsonArray=====",jsonArray.toJSONString());
|
|
|
progressDialog.show();
|
|
|
@@ -1056,7 +1143,17 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
progressDialog.dismiss();
|
|
|
CommonUtil.toastYESRepeat(mActivity, "保存成功");
|
|
|
+ et_linecode_smts.clearFocus();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
+ ce_bit_number.clearFocus();
|
|
|
+ setAdaptertwo(passFeededListQty);
|
|
|
getTestcollectdata(tv_macode.getText().toString().trim(),ce_resources.getText().toString().trim());
|
|
|
+ getunhealthyDataList(ce_resources.getText().toString().trim());
|
|
|
+ recycleDataundesirable(ce_resources.getText().toString().trim());
|
|
|
+ setAdaptertwo(passFeededListQty);
|
|
|
+ ce_bit_number.setText("");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1134,6 +1231,9 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
tv_pr_code.setText("产品编号 "+pr_code);
|
|
|
tv_pr_detail.setText("产品名称 "+pr_detail);
|
|
|
tv_macode.setText(""+ma_code);
|
|
|
+ et_linecode_smts.clearFocus();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
closeListPopupWindow();
|
|
|
}
|
|
|
});
|
|
|
@@ -1194,29 +1294,233 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
// }
|
|
|
//
|
|
|
// });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不良原因
|
|
|
+ */
|
|
|
+ public void recycleDataundesirable(String sc_code){
|
|
|
+ mFeededListundesirable = new ArrayList<>();
|
|
|
+ myAdapterundesirable = new SelectAdapterundesirable(mFeededListundesirable);
|
|
|
+ GridLayoutManager gridLayoutManager=new GridLayoutManager(mActivity,5);
|
|
|
+ LinearLayoutManager layoutmanager = new LinearLayoutManager(mActivity);
|
|
|
+// MyLayoutManager layout = new MyLayoutManager();
|
|
|
+// layout.setAutoMeasureEnabled(true);//防止recyclerview高度为wrap时测量item高度0(一定要加这个属性,否则显示不出来)
|
|
|
+ layoutmanager.setOrientation(LinearLayoutManager.HORIZONTAL);//列表横向显示
|
|
|
+ rv_undesirable.setLayoutManager(gridLayoutManager);
|
|
|
+ setAdapterundesirable(mFeededListundesirable);
|
|
|
+ rv_undesirable.setAdapter(myAdapterundesirable);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ JSONObject object_1 = new JSONObject();
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
+
|
|
|
+ if (sc_code.equals("炉前目检")){
|
|
|
+ list.add("少件");
|
|
|
+ list.add("错件");
|
|
|
+ list.add("反向");
|
|
|
+ list.add("歪斜");
|
|
|
+ list.add("错孔");
|
|
|
+ list.add("不出脚");
|
|
|
+ }else if (sc_code.equals("检焊目检")){
|
|
|
+ list.add("少件");
|
|
|
+ list.add("错件");
|
|
|
+ list.add("反向");
|
|
|
+ list.add("歪斜");
|
|
|
+ list.add("错孔");
|
|
|
+ list.add("空焊");
|
|
|
+ list.add("连锡");
|
|
|
+ list.add("少锡");
|
|
|
+ list.add("不出脚");
|
|
|
+ }else if (sc_code.equals("线材目检")){
|
|
|
+ list.add("空焊");
|
|
|
+ list.add("连锡");
|
|
|
+ list.add("少锡");
|
|
|
+ list.add("反向");
|
|
|
+ list.add("错孔");
|
|
|
+ list.add("不出脚");
|
|
|
+ }else {
|
|
|
+ list.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i=0;i<list.size();i++){
|
|
|
+ StorageRechargeAloneBean bean=new StorageRechargeAloneBean(list.get(i));
|
|
|
+ object_1.put("alone", list.get(i));
|
|
|
+ jsonArray.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ jsonObject.put("formStore", jsonArray);
|
|
|
+
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(jsonObject.toString(), "formStore");
|
|
|
+ handleFeededDataundesirable(dataArray);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void handleFeededDataundesirable(JSONArray dataArray) {
|
|
|
+ StorageRechargeAloneBean bean;
|
|
|
+ mFeededListundesirable.clear();
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ bean= new StorageRechargeAloneBean(
|
|
|
+ data.getString("alonedata"));
|
|
|
+ mFeededListundesirable.add(bean);
|
|
|
+ }
|
|
|
+ setAdapterundesirable(mFeededListundesirable);
|
|
|
+ }
|
|
|
+ private void setAdapterundesirable(ArrayList<StorageRechargeAloneBean> mList) {
|
|
|
+ LogUtil.i("mList", JSON.toJSONString(mList));
|
|
|
+ myAdapterundesirable = new SelectAdapterundesirable(mList);
|
|
|
+ rv_undesirable.setAdapter(myAdapterundesirable);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不良现象
|
|
|
+ */
|
|
|
+ private void getunhealthyDataList(String sc_code){
|
|
|
+ List<String> linelist=new ArrayList<>();
|
|
|
+ JSONObject jsonObjectce = new JSONObject();
|
|
|
+ JSONArray jsonArrayce = new JSONArray();
|
|
|
+ JSONObject object_1ce = new JSONObject();
|
|
|
+ if (sc_code.equals("炉前目检")||sc_code.equals("检焊目检")){
|
|
|
+ linelist.add("电阻");
|
|
|
+ linelist.add("电容");
|
|
|
+ linelist.add("电感");
|
|
|
+ linelist.add("保险");
|
|
|
+ linelist.add("桥堆");
|
|
|
+ linelist.add("二极管");
|
|
|
+ linelist.add("三极管");
|
|
|
+ linelist.add("IC");
|
|
|
+ linelist.add("共模电感");
|
|
|
+ linelist.add("变压器");
|
|
|
+ linelist.add("热敏");
|
|
|
+ linelist.add("安规电容");
|
|
|
+ linelist.add("其他");
|
|
|
+ }else if (sc_code.equals("组装外观目检")||sc_code.equals("包装外观目检")){
|
|
|
+ linelist.add("磕伤");
|
|
|
+ linelist.add("划伤");
|
|
|
+ linelist.add("白胶");
|
|
|
+ linelist.add("黄胶");
|
|
|
+ linelist.add("断差");
|
|
|
+ linelist.add("压伤");
|
|
|
+ linelist.add("脏污");
|
|
|
+ linelist.add("缝隙大");
|
|
|
+ linelist.add("USB错位");
|
|
|
+ linelist.add("贴标");
|
|
|
+ linelist.add("镭雕");
|
|
|
+ linelist.add("来料");
|
|
|
+ linelist.add("其他");
|
|
|
+ }else if (sc_code.equals("线材目检")){
|
|
|
+ linelist.add("AC线");
|
|
|
+ linelist.add("DC线");
|
|
|
+ }else if (sc_code.equals("组装测试")){
|
|
|
+ linelist.add("无输出");
|
|
|
+ linelist.add("电压高");
|
|
|
+ linelist.add("电压低");
|
|
|
+ linelist.add("电流高");
|
|
|
+ linelist.add("电流低");
|
|
|
+ linelist.add("纹波大");
|
|
|
+ linelist.add("纹波小");
|
|
|
+ linelist.add("起机慢");
|
|
|
+ linelist.add("AC短路");
|
|
|
+ linelist.add("DC短路");
|
|
|
+ linelist.add("OCP不保护");
|
|
|
+ linelist.add("电压跳变");
|
|
|
+ linelist.add("拐点不良");
|
|
|
+ linelist.add("耐压不良");
|
|
|
+ linelist.add("绝缘电阻");
|
|
|
+ linelist.add("其他");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ linelist.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i< linelist.size(); i++){
|
|
|
+ StorageRechargeAloneBean bean=new StorageRechargeAloneBean(linelist.get(i));
|
|
|
+ object_1ce.put("alone", linelist.get(i));
|
|
|
+ jsonArrayce.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ jsonObjectce.put("formStore", jsonArrayce);
|
|
|
+ JSONArray dataArrayce = FastjsonUtil.getJSONArray(jsonObjectce.toString(), "formStore");
|
|
|
+ handleFeededData(dataArrayce);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * 关于岗位资源弹框
|
|
|
+ * 岗位资源
|
|
|
*/
|
|
|
- private void initresourcesPopupWindow() {
|
|
|
+ private void getlineDataList(){
|
|
|
+ List<String> linelist=new ArrayList<>();
|
|
|
+ linelist.add("炉前目检");
|
|
|
+ linelist.add("检焊目检");
|
|
|
+ linelist.add("组装测试");
|
|
|
+ linelist.add("组装外观目检");
|
|
|
+ linelist.add("包装外观目检");
|
|
|
+ linelist.add("线材目检");
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ JSONObject object_1 = new JSONObject();
|
|
|
+ for (int i=0;i<linelist.size();i++){
|
|
|
+ StorageRechargeAloneBean bean=new StorageRechargeAloneBean(linelist.get(i));
|
|
|
+ object_1.put("alone", linelist.get(i));
|
|
|
+ jsonArray.add(bean);
|
|
|
+ }
|
|
|
|
|
|
+ jsonObject.put("formStore", jsonArray);
|
|
|
+ Log.e("alone===2",jsonObject.toString());
|
|
|
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(jsonObject.toString(), "formStore");
|
|
|
+ handleFeededlineData(dataArray);
|
|
|
+ }
|
|
|
+ private void handleFeededlineData(JSONArray dataArray) {
|
|
|
+ ResourcesBean bean;
|
|
|
+ resourcesBeanList.clear();
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ bean= new ResourcesBean();
|
|
|
+ bean.setSC_CODE(data.getString("alonedata"));
|
|
|
+ resourcesBeanList.add(bean);
|
|
|
+ }
|
|
|
+ setlineAdapter(resourcesBeanList);
|
|
|
+ }
|
|
|
+ private void setlineAdapter(ArrayList<ResourcesBean> mList) {
|
|
|
+ LogUtil.i("mList", JSON.toJSONString(mList));
|
|
|
+ ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(mList);
|
|
|
+ ipAndResourcesPortAdapter.setmList(resourcesBeanList);
|
|
|
+ ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 关于岗位资源弹框
|
|
|
+ */
|
|
|
+ private void initresourcesPopupWindow() {
|
|
|
View contView = LayoutInflater.from(mActivity).inflate(R.layout.index_edit_pup, 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);
|
|
|
-
|
|
|
- RecyclerView rv_ip_port_data = contView.findViewById(R.id.rv_ip_port_data);
|
|
|
- rv_ip_port_data.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
- rv_ip_port_data.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ LinearLayout line_top = contView.findViewById(R.id.line_top);
|
|
|
+ line_top.setVisibility(View.GONE);
|
|
|
+ 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.setmList(resourcesBeanList);
|
|
|
- rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
- getfuzzySearchSourceData(edit_et.getText().toString().trim(),"弹框");
|
|
|
+ rv_line_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+// getfuzzySearchSourceData(edit_et.getText().toString().trim(),"弹框");
|
|
|
+ getlineDataList();
|
|
|
|
|
|
editPW = new PopupWindow(contView, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
editPW.setTouchable(true);
|
|
|
@@ -1233,7 +1537,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
search_im.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- getfuzzySearchSourceData(edit_et.getText().toString().trim(),"弹框");
|
|
|
+// getfuzzySearchSourceData(edit_et.getText().toString().trim(),"弹框");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -1264,27 +1568,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
|
|
|
tv_station.setText("当前岗位:"+sc_code);
|
|
|
- if (!StringUtil.isEmpty(st_remark)){
|
|
|
- if (st_remark.contains("|")){
|
|
|
- String[] split = st_remark.split("\\|");
|
|
|
- list.addAll(Arrays.asList(split));
|
|
|
- }else {
|
|
|
- list.add(st_remark);
|
|
|
- }
|
|
|
- }
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- JSONObject object_1 = new JSONObject();
|
|
|
- for (int i=0;i<list.size();i++){
|
|
|
- StorageRechargeAloneBean bean=new StorageRechargeAloneBean(list.get(i));
|
|
|
- object_1.put("alone", list.get(i));
|
|
|
- jsonArray.add(bean);
|
|
|
- }
|
|
|
-
|
|
|
- jsonObject.put("formStore", jsonArray);
|
|
|
- JSONArray dataArray = FastjsonUtil.getJSONArray(jsonObject.toString(), "formStore");
|
|
|
- handleFeededData(dataArray);
|
|
|
+ tv_station.clearFocus();
|
|
|
+ tv_dc_emcode.clearFocus();
|
|
|
+ ce_resources.clearFocus();
|
|
|
|
|
|
+ getunhealthyDataList(sc_code);
|
|
|
+ recycleDataundesirable(sc_code);
|
|
|
|
|
|
closeListPopupWindow();
|
|
|
}
|
|
|
@@ -1612,11 +1901,166 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public class SelectAdapterundesirable extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
|
|
+ private int checkedPosition = -1;
|
|
|
+ private boolean onBind;
|
|
|
+ private ArrayList<StorageRechargeAloneBean> mList = new ArrayList<>();
|
|
|
+ private SparseBooleanArray mSelectedPositions = new SparseBooleanArray();
|
|
|
+ private boolean mIsSelectable = false;
|
|
|
+
|
|
|
+
|
|
|
+ public SelectAdapterundesirable(ArrayList<StorageRechargeAloneBean> list) {
|
|
|
+ if (list == null) {
|
|
|
+ throw new IllegalArgumentException("model Data must not be null");
|
|
|
+ }
|
|
|
+ mList = list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新adpter的数据和选择状态
|
|
|
+ public void updateDataSet(ArrayList<StorageRechargeAloneBean> list) {
|
|
|
+ this.mList = list;
|
|
|
+ mSelectedPositions = new SparseBooleanArray();
|
|
|
+// ab.setTitle("已选择" + 0 + "项");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
|
+ View itemView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recyclerview_item, viewGroup, false);
|
|
|
+ return new SelectAdapterundesirable.ListItemViewHolder(itemView);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<Integer, Boolean> map = new HashMap<>();
|
|
|
+ //绑定界面,设置监听
|
|
|
+ @SuppressLint("SetTextI18n")
|
|
|
+ @Override
|
|
|
+ public void onBindViewHolder(final RecyclerView.@NotNull ViewHolder holder, @SuppressLint("RecyclerView") int i) {
|
|
|
+
|
|
|
+ //设置条目状态
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).mainTitle.setText(mList.get(i).getAlonedata());
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).ce_other.setVisibility(View.GONE);
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).ce_qty.setVisibility(View.GONE);
|
|
|
+
|
|
|
+// ((ListItemViewHolder) holder).checkBox.setChecked();
|
|
|
+ //checkBox的监听
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (isChecked == true) {
|
|
|
+ map.clear();
|
|
|
+ map.put(i, true);
|
|
|
+ checkedPosition = i;
|
|
|
+ } else {
|
|
|
+ map.remove(i);
|
|
|
+ if (map.size() == 0) {
|
|
|
+ checkedPosition = -1; //-1 代表一个都未选择
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!onBind) {
|
|
|
+ notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ onBind = true;
|
|
|
+ if (map != null && map.containsKey(i)) {
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).checkBox.setChecked(true);
|
|
|
+ } else {
|
|
|
+ ((SelectAdapterundesirable.ListItemViewHolder) holder).checkBox.setChecked(false);
|
|
|
+ }
|
|
|
+ onBind = false;
|
|
|
+
|
|
|
+ (( SelectAdapterundesirable.ListItemViewHolder) holder).ce_other.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) {
|
|
|
+ mList.get(i).setInputce((( SelectAdapterundesirable.ListItemViewHolder) holder).ce_other.getText().toString().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ (( SelectAdapterundesirable.ListItemViewHolder) holder).ce_qty.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) {
|
|
|
+ mList.get(i).setQtyce((( SelectAdapterundesirable.ListItemViewHolder) holder).ce_qty.getText().toString().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //获得选中条目的结果
|
|
|
+ public ArrayList<StorageRechargeAloneBean> getSelectedItem() {
|
|
|
+ ArrayList<StorageRechargeAloneBean> selectList = new ArrayList<>();
|
|
|
+ int checkedPosition = getCheckedPosition();
|
|
|
+ if (checkedPosition==-1){
|
|
|
+ selectList.clear();
|
|
|
+ }else {
|
|
|
+ selectList.add(mList.get(checkedPosition));
|
|
|
+ }
|
|
|
+ return selectList;
|
|
|
+ }
|
|
|
+ //设置给定位置条目的选择状态
|
|
|
+ private void setItemChecked(int position, boolean isChecked) {
|
|
|
+ mSelectedPositions.put(position, isChecked);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //根据位置判断条目是否选中
|
|
|
+ private boolean isItemChecked(int position) {
|
|
|
+ return mSelectedPositions.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ //得到当前选中的位置
|
|
|
+ public int getCheckedPosition() {
|
|
|
+ return checkedPosition;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public int getItemCount() {
|
|
|
+ return mList == null ? 0 : mList.size();
|
|
|
+ }
|
|
|
+ //根据位置判断条目是否可选
|
|
|
+ private boolean isSelectable() {
|
|
|
+ return mIsSelectable;
|
|
|
+ }
|
|
|
+ //设置给定位置条目的可选与否的状态
|
|
|
+ private void setSelectable(boolean selectable) {
|
|
|
+ mIsSelectable = selectable;
|
|
|
+ }
|
|
|
+ public class ListItemViewHolder extends RecyclerView.ViewHolder{
|
|
|
+ //ViewHolder
|
|
|
+ CheckBox checkBox;
|
|
|
+ TextView mainTitle;
|
|
|
+ ClearableEditText ce_other;
|
|
|
+ AutoCompleteTextView ce_qty;
|
|
|
+ ListItemViewHolder(View view) {
|
|
|
+ super(view);
|
|
|
+ this.mainTitle = (TextView) view.findViewById(R.id.text);
|
|
|
+ this.checkBox = (CheckBox) view.findViewById(R.id.select_checkbox);
|
|
|
+ this.ce_other = (ClearableEditText) view.findViewById(R.id.ce_other);
|
|
|
+ this.ce_qty = (AutoCompleteTextView) view.findViewById(R.id.ce_qty);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -1663,6 +2107,15 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (requestCode == SCAN_BARCODE_LINE && data != null) {
|
|
|
+ if (data.getExtras() != null) {
|
|
|
+ String result = data.getExtras().getString(com.uas.collection.camera.CodeUtils.RESULT_STRING);
|
|
|
+ if (mFocusId == R.id.tv_dc_line) {
|
|
|
+ tv_dc_line.setText(result);
|
|
|
+ tv_dc_line.setSelection(result.length());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
@Override
|