|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.collection.fragment;
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.Color;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
@@ -45,8 +46,10 @@ import com.uas.collection.bean.IpAndPortBean;
|
|
|
import com.uas.collection.bean.LinecodeBean;
|
|
|
import com.uas.collection.bean.ResourcesBean;
|
|
|
import com.uas.collection.bean.TestcollectDataBean;
|
|
|
+import com.uas.collection.camera.CaptureActivity;
|
|
|
import com.uas.collection.global.GloableParams;
|
|
|
import com.uas.collection.tools.SharedPreUtil;
|
|
|
+import com.uas.collection.util.CameraUtil;
|
|
|
import com.uas.collection.util.CommonUtil;
|
|
|
import com.uas.collection.util.Constants;
|
|
|
import com.uas.collection.util.FastjsonUtil;
|
|
|
@@ -84,9 +87,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
private TextView tv_pr_code;
|
|
|
private TextView tv_pr_detail;
|
|
|
private ImageView iv_resources_delete;
|
|
|
- private AutoCompleteTextView ce_unhealthy;
|
|
|
private ImageView iv_unhealthy_delete;
|
|
|
- private ImageView iv_unhealthy;
|
|
|
private SmartTable mSmartTable;
|
|
|
private Column<String> va_classColumn,va_codeColumn,va_statusColumn;
|
|
|
private TableData<TestcollectDataBean> mTableData;
|
|
|
@@ -112,7 +113,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
private TextView tv_em_name;
|
|
|
private TextView tv_station;
|
|
|
private String em_name;
|
|
|
-
|
|
|
+ private String pr_code;
|
|
|
+ private String pr_detail;
|
|
|
+ private ClearableEditText tv_dc_emcode;
|
|
|
+ private ImageView iv_dc_emcode;
|
|
|
+ private int mFocusId;
|
|
|
+ private static final int SCAN_BARCODE_CODESD = 925;
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
return R.layout.fragment_datacollection;
|
|
|
@@ -143,16 +149,15 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
iv_resources = root.findViewById(R.id.iv_resources);
|
|
|
ce_bit_number = root.findViewById(R.id.ce_bit_number);
|
|
|
ec_passqty = root.findViewById(R.id.ec_passqty);
|
|
|
- ce_unhealthy = root.findViewById(R.id.ce_unhealthy);
|
|
|
iv_unhealthy_delete = root.findViewById(R.id.iv_unhealthy_delete);
|
|
|
- iv_unhealthy = root.findViewById(R.id.iv_unhealthy);
|
|
|
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);
|
|
|
tv_station = root.findViewById(R.id.tv_station);
|
|
|
-
|
|
|
+ tv_dc_emcode = root.findViewById(R.id.tv_dc_emcode);
|
|
|
+ iv_dc_emcode = root.findViewById(R.id.iv_dc_emcode);
|
|
|
|
|
|
mFilterStorageInBeans = Collections.synchronizedList(new ArrayList<>());
|
|
|
|
|
|
@@ -307,31 +312,61 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
});
|
|
|
|
|
|
/**----------------------------------不良现象------------------------------**/
|
|
|
- iv_unhealthy_delete.setOnClickListener(new View.OnClickListener() {
|
|
|
+
|
|
|
+// iv_unhealthy.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+//// initunhealthyPopupWindow();
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ tv_save.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- ce_unhealthy.setText("");
|
|
|
- ce_unhealthy.requestFocus();
|
|
|
+
|
|
|
+ getNewData();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- iv_unhealthy.setOnClickListener(new View.OnClickListener() {
|
|
|
+ tv_dc_emcode.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 dc_emcode = tv_dc_emcode.getText().toString().trim();
|
|
|
+ getOrImage(dc_emcode);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ iv_dc_emcode.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- initunhealthyPopupWindow();
|
|
|
+ tv_dc_emcode.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_CODESD);
|
|
|
+ SharedPreUtil.saveString(mActivity, Constants.STORAGEERECHADD, "NO");
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择您要操作的输入框");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, getString(R.string.no_camera_detected));
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
- tv_save.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
|
|
|
- getNewData();
|
|
|
- }
|
|
|
- });
|
|
|
- getOrImage();
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -346,8 +381,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
/**
|
|
|
* 关于人员资料
|
|
|
*/
|
|
|
- public void getOrImage(){
|
|
|
- String em_code = SharedPreUtil.getString(mActivity, Constants.FLAG.CACHE_USER_EMCODE, null);
|
|
|
+ public void getOrImage(String em_code){
|
|
|
progressDialog.show();
|
|
|
VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
new HttpParams.Builder()
|
|
|
@@ -835,10 +869,9 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
public void getNewData(){
|
|
|
String ce_work_codetrim = et_linecode_smts.getText().toString().trim();
|
|
|
String at_stationtrim = ce_resources.getText().toString().trim();
|
|
|
- String ce_unhealthytrim = ce_unhealthy.getText().toString().trim();
|
|
|
String ce_bit_numbertrim = ce_bit_number.getText().toString().trim();
|
|
|
if (ce_bit_numbertrim.isEmpty()){
|
|
|
- ce_bit_numbertrim="1";
|
|
|
+ ce_bit_numbertrim="0";
|
|
|
}
|
|
|
String ec_passqtytrim = ec_passqty.getText().toString().trim();
|
|
|
if (ec_passqtytrim.isEmpty()){
|
|
|
@@ -852,7 +885,7 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
object_1.put("SR_SOURCECODE", at_stationtrim);//资源
|
|
|
object_1.put("SR_PASSQTY", "0");//通过数量
|
|
|
object_1.put("SR_NGQTY", ec_passqtytrim);//NG数量
|
|
|
- object_1.put("SR_BADNAME",ce_unhealthytrim);//不良现象
|
|
|
+ object_1.put("SR_BADNAME","ce_unhealthytrim");//不良现象
|
|
|
object_1.put("SR_TYPE", "数据采集");//种类(数据采集/、外观维修/性能维修)
|
|
|
object_1.put("SR_LOCATION", ce_bit_numbertrim);//位号
|
|
|
object_1.put("SR_REASON", "");//原因
|
|
|
@@ -923,14 +956,12 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
});
|
|
|
|
|
|
ipAndlinecodePortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
List<LinecodeBean> ipAndPortBeans = ipAndlinecodePortAdapter.getmList();
|
|
|
ma_code = ipAndPortBeans.get(position).getMA_CODE();
|
|
|
-
|
|
|
+ pr_code = ipAndPortBeans.get(position).getPR_CODE();
|
|
|
+ pr_detail = ipAndPortBeans.get(position).getPR_DETAIL();
|
|
|
for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
ipAndPortBeans.get(i).setChecked(false);
|
|
|
}
|
|
|
@@ -945,6 +976,8 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
et_linecode_smts.setText(ma_code);
|
|
|
+ tv_pr_code.setText("产品编号 "+pr_code);
|
|
|
+ tv_pr_detail.setText("产品名称 "+pr_detail);
|
|
|
closeListPopupWindow();
|
|
|
}
|
|
|
});
|
|
|
@@ -1194,7 +1227,6 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- ce_unhealthy.setText(st_remark);
|
|
|
closeListPopupWindow();
|
|
|
}
|
|
|
});
|
|
|
@@ -1297,6 +1329,19 @@ public class DataCollectionFragment extends BaseFragment implements View.OnClick
|
|
|
}
|
|
|
@Override
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ if (resultCode != Activity.RESULT_OK) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (requestCode == SCAN_BARCODE_CODESD && data != null) {
|
|
|
+ if (data.getExtras() != null) {
|
|
|
+ String result = data.getExtras().getString(com.uas.collection.camera.CodeUtils.RESULT_STRING);
|
|
|
+ if (mFocusId == R.id.tv_dc_emcode) {
|
|
|
+ tv_dc_emcode.setText(result);
|
|
|
+ tv_dc_emcode.setSelection(result.length());
|
|
|
+ getOrImage(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
@Override
|