|
|
@@ -55,6 +55,7 @@ import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.uas.collection.R;
|
|
|
import com.uas.collection.activity.FunctionActivity;
|
|
|
import com.uas.collection.bean.IpAndPortBean;
|
|
|
+import com.uas.collection.bean.LineCodeEntity;
|
|
|
import com.uas.collection.bean.LinecodeBean;
|
|
|
import com.uas.collection.bean.ResourcesBean;
|
|
|
import com.uas.collection.bean.StorageRechargeAloneBean;
|
|
|
@@ -72,6 +73,7 @@ import com.uas.collection.util.JsonUtils;
|
|
|
import com.uas.collection.util.LogUtil;
|
|
|
import com.uas.collection.util.MyArrayAdapter;
|
|
|
import com.uas.collection.util.StringUtil;
|
|
|
+import com.uas.collection.util.VolleyRequest;
|
|
|
import com.uas.collection.util.VollyRequest;
|
|
|
import com.uas.collection.view.ClearableEditText;
|
|
|
|
|
|
@@ -172,6 +174,10 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
private String ma_bomversion;
|
|
|
private boolean pepolerboolean = false;
|
|
|
private InputMethodManager imm;
|
|
|
+ private ArrayList<LineCodeEntity> codeEntityArrayList;
|
|
|
+ private GetLinePortAdapter getLinePortAdapter;
|
|
|
+ private String li_code;
|
|
|
+ private RecyclerView rv_getline_ip_port_data;
|
|
|
@Override
|
|
|
protected int getLayout() {
|
|
|
return R.layout.fragment_quantitystatistics;
|
|
|
@@ -241,6 +247,7 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
@Override
|
|
|
protected void initDatas() {
|
|
|
resourcesBeanList = new ArrayList<>();
|
|
|
+ codeEntityArrayList = new ArrayList<>();
|
|
|
WindowManager wm = mActivity.getWindowManager();
|
|
|
int screenWith = wm.getDefaultDisplay().getWidth()/3;
|
|
|
mSmartTable.getConfig().setMinTableWidth(screenWith)
|
|
|
@@ -559,20 +566,7 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
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));
|
|
|
- }
|
|
|
+ initgetLinePopupWindow();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -596,7 +590,6 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|
|
|
private void handleFeededDataTwo(JSONArray dataArray) {
|
|
|
StorageRechargeAloneBean bean;
|
|
|
@@ -626,6 +619,185 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关于物理线体弹框
|
|
|
+ */
|
|
|
+
|
|
|
+ private void initgetLinePopupWindow() {
|
|
|
+ getLinePortAdapter = new GetLinePortAdapter(codeEntityArrayList);
|
|
|
+ View contView = LayoutInflater.from(mActivity).inflate(R.layout.index_line_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);
|
|
|
+ LinearLayout line_top = contView.findViewById(R.id.line_top);
|
|
|
+ line_top.setVisibility(View.GONE);
|
|
|
+ rv_getline_ip_port_data = contView.findViewById(R.id.rv_ip_port_data);
|
|
|
+ rv_getline_ip_port_data.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
+ rv_getline_ip_port_data.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ getLinePortAdapter.setmList(codeEntityArrayList);
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ requestLines();
|
|
|
+
|
|
|
+ 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);
|
|
|
+ search_im.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ getLinePortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ List<LineCodeEntity> lineCodeEntities = getLinePortAdapter.getmList();
|
|
|
+ li_code = lineCodeEntities.get(position).getLI_CODE();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ lineCodeEntities.get(position).setChecked(true);
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //确定
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+
|
|
|
+ if (!StringUtil.isEmpty(li_code)){
|
|
|
+ tv_dc_line.setText(li_code);
|
|
|
+ }else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity,"请选择物理线体");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //取消
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+// edit_et.addTextChangedListener(new TextWatcher() {
|
|
|
+// @Override
|
|
|
+// public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
|
|
+// @Override
|
|
|
+// public void onTextChanged(CharSequence s, int start, int before, int count) { }
|
|
|
+// @Override
|
|
|
+// public void afterTextChanged(Editable s) {
|
|
|
+// if (resourcesBeanList.isEmpty()){
|
|
|
+// getfuzzySearchSourceData(edit_et.getText().toString().trim(),"不良");
|
|
|
+// }
|
|
|
+// if (s.length() >= 0) {
|
|
|
+// String mSearchStr = s.toString().trim();
|
|
|
+// LogUtil.i("mSearchStr",mSearchStr);
|
|
|
+// List<ResourcesBean> thisList = new ArrayList<>();
|
|
|
+// for(int i=0;i<resourcesBeanList.size();i++){
|
|
|
+// if(resourcesBeanList.get(i).getSC_CODE().contains(mSearchStr)){
|
|
|
+// thisList.add(resourcesBeanList.get(i));
|
|
|
+// }
|
|
|
+// if(i == resourcesBeanList.size() -1){
|
|
|
+// ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(thisList);
|
|
|
+// rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+// LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+//
|
|
|
+// } else {
|
|
|
+//
|
|
|
+// ipAndResourcesPortAdapter = new IpAndResourcesPortAdapter(resourcesBeanList);
|
|
|
+// rv_ip_port_data.setAdapter(ipAndResourcesPortAdapter);
|
|
|
+//
|
|
|
+// }
|
|
|
+// ipAndResourcesPortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+// List<ResourcesBean> ipAndPortBeans = ipAndResourcesPortAdapter.getmList();
|
|
|
+// for (int i = 0; i < ipAndPortBeans.size(); i++) {
|
|
|
+// ipAndPortBeans.get(i).setChecked(false);
|
|
|
+// }
|
|
|
+// ipAndPortBeans.get(position).setChecked(true);
|
|
|
+// ipAndResourcesPortAdapter.notifyDataSetChanged();
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+//
|
|
|
+// });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void requestLines() {
|
|
|
+// progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SPM_GETLINE)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ codeEntityArrayList.clear();
|
|
|
+ try {
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ JSONArray dataArray = resultObject.getJSONArray("data");
|
|
|
+ if (dataArray != null) {
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataObject = dataArray.getJSONObject(i);
|
|
|
+ if (dataObject != null) {
|
|
|
+ LineCodeEntity lineCodeEntity = new LineCodeEntity();
|
|
|
+ lineCodeEntity.setLI_CODE(FastjsonUtil.getText(dataObject, "LI_CODE"));
|
|
|
+ lineCodeEntity.setLI_NAME(FastjsonUtil.getText(dataObject, "LI_NAME"));
|
|
|
+
|
|
|
+ codeEntityArrayList.add(lineCodeEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (codeEntityArrayList.size() == 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "线别数据为空");
|
|
|
+ } else {
|
|
|
+ setcodelineAdapter(codeEntityArrayList);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setcodelineAdapter(ArrayList< LineCodeEntity > mList) {
|
|
|
+ getLinePortAdapter.setmList(codeEntityArrayList);
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 关于人员资料
|
|
|
*/
|
|
|
@@ -877,8 +1049,11 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
}
|
|
|
@Override
|
|
|
protected void convert(BaseViewHolder helper, ResourcesBean item) {
|
|
|
+ TextView macode_ip__Tv = helper.itemView.findViewById(R.id.macode_ip__Tv);
|
|
|
+ macode_ip__Tv.setTextSize(30);
|
|
|
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);
|
|
|
} else {
|
|
|
@@ -1473,6 +1648,9 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
list.add("16");
|
|
|
list.add("100");
|
|
|
list.add("200");
|
|
|
+ list.add("500");
|
|
|
+ list.add("1000");
|
|
|
+ list.add("1500");
|
|
|
list.add("其他");
|
|
|
}else {
|
|
|
list.add("50");
|
|
|
@@ -1788,11 +1966,11 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
private void getlineDataList(){
|
|
|
List<String> linelist=new ArrayList<>();
|
|
|
linelist.add("插件投产");
|
|
|
- linelist.add("插件产出");
|
|
|
+// linelist.add("插件产出");
|
|
|
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();
|
|
|
@@ -2904,6 +3082,35 @@ public class QuantityStatisticsFragment extends BaseFragment implements View.OnC
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ private class GetLinePortAdapter extends BaseQuickAdapter<LineCodeEntity, BaseViewHolder> {
|
|
|
+ private List<LineCodeEntity> mmmmList;
|
|
|
+
|
|
|
+ public List<LineCodeEntity> getmList() {
|
|
|
+ return mmmmList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setmList(List<LineCodeEntity> mList) {
|
|
|
+ this.mmmmList = mList;
|
|
|
+ }
|
|
|
+ public LineCodeEntity getBeanByPositon(int position){
|
|
|
+ return mmmmList.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ private GetLinePortAdapter(@Nullable List<LineCodeEntity> data) {
|
|
|
+ super(R.layout.fuzzy_ipandport_item, data);
|
|
|
+ this.mmmmList = data;
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ protected void convert(BaseViewHolder helper, LineCodeEntity item) {
|
|
|
+ helper.setText(R.id.macode_ip__Tv,item.getLI_NAME()+"("+item.getLI_CODE()+")");
|
|
|
+ LinearLayout line_true = helper.itemView.findViewById(R.id.line_true);
|
|
|
+ if (item.getChecked()) {
|
|
|
+ line_true.setSelected(true);
|
|
|
+ } else {
|
|
|
+ line_true.setSelected(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
@Override
|
|
|
public void onDestroy() {
|
|
|
super.onDestroy();
|