|
|
@@ -0,0 +1,1018 @@
|
|
|
+package com.uas.baigang_workshop_workstation.fragment;
|
|
|
+
|
|
|
+import android.annotation.SuppressLint;
|
|
|
+import android.app.AlertDialog;
|
|
|
+import android.content.Context;
|
|
|
+import android.content.DialogInterface;
|
|
|
+import android.content.Intent;
|
|
|
+import android.graphics.drawable.BitmapDrawable;
|
|
|
+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.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.Gravity;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
+import android.view.Window;
|
|
|
+import android.widget.ArrayAdapter;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.CheckBox;
|
|
|
+import android.widget.CompoundButton;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.LinearLayout;
|
|
|
+import android.widget.ListView;
|
|
|
+import android.widget.PopupWindow;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.android.volley.Request;
|
|
|
+import com.android.volley.toolbox.StringRequest;
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
+import com.uas.baigang_workshop_workstation.R;
|
|
|
+import com.uas.baigang_workshop_workstation.activity.FunctionActivity;
|
|
|
+import com.uas.baigang_workshop_workstation.adapter.ReportingWorkAdapter;
|
|
|
+import com.uas.baigang_workshop_workstation.bean.CaiPiBlueBean;
|
|
|
+import com.uas.baigang_workshop_workstation.bean.LineCodeEntity;
|
|
|
+import com.uas.baigang_workshop_workstation.bean.ReportingWorkB;
|
|
|
+import com.uas.baigang_workshop_workstation.bean.ReportingWorkBean;
|
|
|
+import com.uas.baigang_workshop_workstation.global.GloableParams;
|
|
|
+import com.uas.baigang_workshop_workstation.interfaces.OnTextBaoFeiListener;
|
|
|
+import com.uas.baigang_workshop_workstation.interfaces.OnTextBaoGongListener;
|
|
|
+import com.uas.baigang_workshop_workstation.interfaces.OnTextBeiZhuListener;
|
|
|
+import com.uas.baigang_workshop_workstation.interfaces.OnTextYiChangGongSiListener;
|
|
|
+import com.uas.baigang_workshop_workstation.tools.SharedPreUtil;
|
|
|
+import com.uas.baigang_workshop_workstation.util.CommonUtil;
|
|
|
+import com.uas.baigang_workshop_workstation.util.Constants;
|
|
|
+import com.uas.baigang_workshop_workstation.util.FastjsonUtil;
|
|
|
+import com.uas.baigang_workshop_workstation.util.FragmentUtils;
|
|
|
+import com.uas.baigang_workshop_workstation.util.HttpCallback;
|
|
|
+import com.uas.baigang_workshop_workstation.util.HttpParams;
|
|
|
+import com.uas.baigang_workshop_workstation.util.LogUtil;
|
|
|
+import com.uas.baigang_workshop_workstation.util.PrintUtils;
|
|
|
+import com.uas.baigang_workshop_workstation.util.StringUtil;
|
|
|
+import com.uas.baigang_workshop_workstation.util.VolleyRequest;
|
|
|
+import com.uas.baigang_workshop_workstation.view.ClearableEditText;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import razerdp.basepopup.BasePopupWindow;
|
|
|
+
|
|
|
+public class GdTimeReportFragmentNew2 extends BaseFragment {
|
|
|
+ private StringRequest mStringRequest;
|
|
|
+ private CheckBox cb_is_print;
|
|
|
+ private Button bt_printjson;
|
|
|
+ private RecyclerView rv_reporting_for_work;
|
|
|
+ private TextView tv_result;
|
|
|
+ private Boolean isPrinting = false;
|
|
|
+
|
|
|
+ private ReportingWorkAdapter reportingWorkAdapter;
|
|
|
+ private String sc_code; //岗位
|
|
|
+ private ArrayList<ReportingWorkBean> reportingWorkBeans;
|
|
|
+ private String ma_code; //工单
|
|
|
+ private AlertDialog dialog;
|
|
|
+
|
|
|
+ private JSONArray dataArrayjson;
|
|
|
+ private PopupWindow splitPop;
|
|
|
+ private int mPrintDpi = 203;
|
|
|
+ private boolean isConnected = false;
|
|
|
+ private List<CaiPiBlueBean.DataBean> messages = new ArrayList<>();
|
|
|
+ private LinearLayout ll_search;
|
|
|
+ private ClearableEditText cet_search;
|
|
|
+ private ImageView search_im;
|
|
|
+ private String my_prodcode;
|
|
|
+ private String my_name;
|
|
|
+ private String personnel_id;
|
|
|
+
|
|
|
+ private ArrayList<LineCodeEntity> personnelList;
|
|
|
+ private GetLinePortAdapter getLinePortAdapter;
|
|
|
+ private ClearableEditText edit_et;
|
|
|
+ private RecyclerView rv_getline_ip_port_data;
|
|
|
+ private PopupWindow editPW;
|
|
|
+ private String li_personne_id;
|
|
|
+ private CheckBox cb_all_select;
|
|
|
+ private List<ReportingWorkB> listb; //批量处理报工
|
|
|
+ private Button bt_piliangbaogong;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fragment_gd_time_report_new2;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ ((FunctionActivity) getActivity()).setTitle("报工");
|
|
|
+
|
|
|
+ cb_is_print = root.findViewById(R.id.cb_is_print);
|
|
|
+ bt_printjson = root.findViewById(R.id.bt_printjson);
|
|
|
+ tv_result = root.findViewById(R.id.tv_result);
|
|
|
+ rv_reporting_for_work = root.findViewById(R.id.rv_reporting_for_work);
|
|
|
+ ll_search = root.findViewById(R.id.ll_search);
|
|
|
+ cet_search = root.findViewById(R.id.cet_search);
|
|
|
+ search_im = root.findViewById(R.id.search_im);
|
|
|
+ cb_all_select = root.findViewById(R.id.cb_all_select);
|
|
|
+ bt_piliangbaogong = root.findViewById(R.id.bt_piliangbaogong);
|
|
|
+
|
|
|
+ personnelList = new ArrayList<>();
|
|
|
+
|
|
|
+ rv_reporting_for_work.addItemDecoration(new DividerItemDecoration(mActivity, LinearLayout.VERTICAL));
|
|
|
+ rv_reporting_for_work.setLayoutManager(new LinearLayoutManager(mActivity));
|
|
|
+ reportingWorkBeans = new ArrayList<>();
|
|
|
+ reportingWorkAdapter = new ReportingWorkAdapter(getActivity(), reportingWorkBeans, new OnTextBaoGongListener() {
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(int position, String text) {
|
|
|
+ try {
|
|
|
+ reportingWorkBeans.get(position).setTextBaoGong(text);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new OnTextBaoFeiListener() {
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(int position, String text) {
|
|
|
+ try {
|
|
|
+ reportingWorkBeans.get(position).setTextBaoFei(text);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new OnTextBeiZhuListener() {
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(int position, String text) {
|
|
|
+ try {
|
|
|
+ reportingWorkBeans.get(position).setTextBeiZhu(text);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new OnTextYiChangGongSiListener() {
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(int position, String text) {
|
|
|
+ try {
|
|
|
+ reportingWorkBeans.get(position).setTextYiChangGongSi(text);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ reportingWorkAdapter.setList(reportingWorkBeans);
|
|
|
+ rv_reporting_for_work.setAdapter(reportingWorkAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ cb_is_print.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
|
+ if (buttonView.isPressed()) {
|
|
|
+ isPrinting = isChecked;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ bt_printjson.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (dataArrayjson == null || dataArrayjson.size() <= 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "条码数据为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ initBreakPopupWindow(dataArrayjson);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ reportingWorkAdapter.setReportingWorkListener((baogong, baofei, beizhu, yichanggongshi, gongdanhao, position) -> {
|
|
|
+ new AlertDialog.Builder(mActivity).setTitle("提示")
|
|
|
+ .setMessage("是否推送相关人员?")
|
|
|
+ .setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ initGetPersonnelID(baogong,gongdanhao,baofei, beizhu, yichanggongshi,position);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setNegativeButton("取消",
|
|
|
+ new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+ setReportingWork(baogong, baofei, beizhu, yichanggongshi, position);
|
|
|
+ }
|
|
|
+ }).create().show();
|
|
|
+ });
|
|
|
+
|
|
|
+ search_im.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (reportingWorkBeans.size() > 0) {
|
|
|
+ String trim = cet_search.getText().toString().trim();
|
|
|
+ if (!TextUtils.isEmpty(trim)) {
|
|
|
+ ArrayList<ReportingWorkBean> reportingWorkBeans1 = new ArrayList<>();
|
|
|
+ for (int i = 0; i < reportingWorkBeans.size(); i++) {
|
|
|
+ ReportingWorkBean reportingWorkBean = reportingWorkBeans.get(i);
|
|
|
+ // 将字符串转换为小写,并检查是否包含关键字
|
|
|
+ boolean containsKeyword = reportingWorkBean.getMPD_ORDERCODE().toLowerCase().contains(trim.toLowerCase());
|
|
|
+ if (containsKeyword) {
|
|
|
+ reportingWorkBeans1.add(reportingWorkBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportingWorkAdapter.setList(reportingWorkBeans1);
|
|
|
+ }else {
|
|
|
+ reportingWorkAdapter.setList(reportingWorkBeans);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ reportingWorkAdapter.setOnGetSelectState((pwb, position) -> {
|
|
|
+ try {
|
|
|
+ if (pwb.isSelet()) {
|
|
|
+ listb.add(pwb);
|
|
|
+ }else {
|
|
|
+ for (int i = 0; i < listb.size(); i++) {
|
|
|
+ if (listb.get(i).getGongdanhao().equals(pwb.getGongdanhao())) {
|
|
|
+ listb.remove(i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reportingWorkBeans.size() == listb.size()) {
|
|
|
+ cb_all_select.setChecked(true);
|
|
|
+ }else {
|
|
|
+ cb_all_select.setChecked(false);
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ cb_all_select.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
|
|
+ if (buttonView.isPressed()) {
|
|
|
+ listb.clear();
|
|
|
+ if (isChecked) {
|
|
|
+ List<ReportingWorkB> allSelect = reportingWorkAdapter.getAllSelect();
|
|
|
+ listb.addAll(allSelect);
|
|
|
+ }else {
|
|
|
+ reportingWorkAdapter.getNoAllSelect();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ bt_piliangbaogong.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ try {
|
|
|
+ if (listb.size() <= 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择报工工单");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ setAllReportingWork(listb);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setAllReportingWork(List<ReportingWorkB> listRWB) {
|
|
|
+ JSONArray reportdataArr = new JSONArray();
|
|
|
+ for (int i = 0; i < listRWB.size(); i++) {
|
|
|
+ ReportingWorkB reportingWorkB = listRWB.get(i);
|
|
|
+ JSONObject jb2 = new JSONObject();
|
|
|
+ JSONObject jb3 = new JSONObject();
|
|
|
+ JSONArray jsonArray2 = new JSONArray();
|
|
|
+
|
|
|
+ jb3.put("scrapqty",reportingWorkB.getBaofei()); //报废数
|
|
|
+ jb3.put("lotno",reportingWorkB.getPici()); //批次号
|
|
|
+ jb3.put("remark",reportingWorkB.getBeizhu()); //备注
|
|
|
+ jb3.put("unworkhour",reportingWorkB.getYichanggongshi()); //异常工时
|
|
|
+ jb3.put("madeqty",reportingWorkB.getBaogong()); //报工数
|
|
|
+ jsonArray2.add(jb3);
|
|
|
+
|
|
|
+ jb2.put("ma_code", reportingWorkB.getGongdanhao());
|
|
|
+ jb2.put("sc_code", sc_code);
|
|
|
+ jb2.put("data", jsonArray2);
|
|
|
+ reportdataArr.add(jb2);
|
|
|
+ }
|
|
|
+ Log.e("aaa", reportdataArr.toString());
|
|
|
+
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_REPORT_MAS)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "reportMa")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("data", reportdataArr.toString())
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ if (isSuccess) {
|
|
|
+ tv_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.green));
|
|
|
+ tv_result.setText("批量报工成功");
|
|
|
+ getReportingForWork();
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ tv_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setReportingWork(String baogong, String baofei, String beizhu, String yichanggongshi, int position) {
|
|
|
+ Map<Object, String> exchangeData = new HashMap<>();
|
|
|
+ String pici = "";//批次号
|
|
|
+ String madeqty = baogong;//报工数
|
|
|
+ String scrapqty = baofei;//报废数
|
|
|
+ String remark = beizhu;//备注
|
|
|
+ String yichang = yichanggongshi;//异常工时
|
|
|
+ exchangeData.put("lotno", pici);
|
|
|
+ exchangeData.put("madeqty", madeqty);
|
|
|
+ exchangeData.put("scrapqty", scrapqty);
|
|
|
+ exchangeData.put("remark", remark);
|
|
|
+ exchangeData.put("unworkhour", yichang);
|
|
|
+ //工单
|
|
|
+ String maCode = reportingWorkAdapter.getList().get(position).getMA_CODE();
|
|
|
+ LogUtil.i(TAG, JSON.toJSONString(exchangeData));
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_PDA_REPORTMA)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag(TAG + "reportMa")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("ma_code", maCode) //工单
|
|
|
+ .addParam("sc_code", sc_code) //岗位
|
|
|
+ .addParam("data", JSON.toJSONString(exchangeData))
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ dataArrayjson = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
+ if (isSuccess) {
|
|
|
+ tv_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.green));
|
|
|
+ tv_result.setText("报工成功");
|
|
|
+ getReportingForWork();
|
|
|
+ if (isPrinting) {
|
|
|
+ initBreakPopupWindow(dataArrayjson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ tv_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ listb = new ArrayList<>();
|
|
|
+ Bundle bundle = getArguments();//从activity传过来的Bundle
|
|
|
+ if (bundle != null) {
|
|
|
+ sc_code = bundle.getString(Constants.FLAG.SC_CODE); //岗位
|
|
|
+ ma_code = bundle.getString(Constants.FLAG.MA_CODE); //工单
|
|
|
+ my_prodcode = bundle.getString("ma_prodcode"); //产品编号
|
|
|
+ my_name = bundle.getString("index_detail_doc"); //名称
|
|
|
+ personnel_id = bundle.getString("personnel_id"); //人员编号
|
|
|
+ getReportingForWork();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getReportingForWork() {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GET_REPORT_MACODE)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag(TAG + "getReportingForWork")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("sc_code", sc_code)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ JSONArray dataArrayjson = FastjsonUtil.getJSONArray(o.toString(), "data");
|
|
|
+ if (isSuccess) {
|
|
|
+ reportingWorkBeans.clear();
|
|
|
+ if (dataArrayjson.size() > 0) {
|
|
|
+ for (int i = 0; i < dataArrayjson.size(); i++) {
|
|
|
+ JSONObject barcodeObject = dataArrayjson.getJSONObject(i);
|
|
|
+ if (barcodeObject != null) {
|
|
|
+ ReportingWorkBean reportingWorkBean = new ReportingWorkBean();
|
|
|
+ reportingWorkBean.setPRSPEC(barcodeObject.getString("PRSPEC"));
|
|
|
+ reportingWorkBean.setMPD_REMARK(barcodeObject.getString("MPD_REMARK"));
|
|
|
+ reportingWorkBean.setMA_WCCODE(barcodeObject.getString("MA_WCCODE"));
|
|
|
+ reportingWorkBean.setCR_NAME(barcodeObject.getString("CR_NAME"));
|
|
|
+ reportingWorkBean.setPR_CODE(barcodeObject.getString("PR_CODE"));
|
|
|
+ reportingWorkBean.setMPD_ORDERCODE(barcodeObject.getString("MPD_ORDERCODE"));
|
|
|
+ reportingWorkBean.setMA_DOWNMAN(barcodeObject.getString("MA_DOWNMAN"));
|
|
|
+ reportingWorkBean.setMA_CODE(barcodeObject.getString("MA_CODE"));
|
|
|
+ reportingWorkBean.setMPD_PRODCODE(barcodeObject.getString("MPD_PRODCODE"));
|
|
|
+ reportingWorkBean.setMA_QTY(barcodeObject.getInteger("MA_QTY"));
|
|
|
+ reportingWorkBean.setMPD_PLANQTY(barcodeObject.getString("MPD_PLANQTY"));
|
|
|
+ reportingWorkBean.setPR_DETAIL(barcodeObject.getString("PR_DETAIL"));
|
|
|
+ reportingWorkBean.setPR_SPEC(barcodeObject.getString("PR_SPEC"));
|
|
|
+ reportingWorkBean.setMP_BEGINTIME(barcodeObject.getString("MP_BEGINTIME"));
|
|
|
+ reportingWorkBean.setNOWQTY(barcodeObject.getString("NOWQTY"));
|
|
|
+ reportingWorkBean.setSUMQTY(barcodeObject.getString("SUMQTY"));
|
|
|
+ reportingWorkBean.setUNWORKHOUR(barcodeObject.getString("UNWORKHOUR"));
|
|
|
+ reportingWorkBean.setSTARTTIME(barcodeObject.getString("STARTTIME"));
|
|
|
+ reportingWorkBean.setWORKHOUR(barcodeObject.getString("WORKHOUR"));
|
|
|
+ reportingWorkBeans.add(reportingWorkBean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reportingWorkBeans.size() > 0) {
|
|
|
+ ll_search.setVisibility(View.VISIBLE);
|
|
|
+ } else {
|
|
|
+ ll_search.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (mActivity != null) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "没有报工数据");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reportingWorkAdapter.setList(reportingWorkBeans);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ tv_result.setVisibility(View.VISIBLE);
|
|
|
+ tv_result.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_result.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void initGetPersonnelID(String baoGong,String gongdanhao,String baofei,String beizhu,String yichanggongshi,int position) {
|
|
|
+ li_personne_id = "";
|
|
|
+ personnelList.clear();
|
|
|
+ getLinePortAdapter = new GetLinePortAdapter(personnelList);
|
|
|
+ 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);
|
|
|
+ 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(personnelList);
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ getPersonnelID();
|
|
|
+
|
|
|
+ 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) {
|
|
|
+ String mSearchStr = edit_et.getText().toString().trim();
|
|
|
+ if (!mSearchStr.isEmpty()) {
|
|
|
+ List<LineCodeEntity> thisList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < personnelList.size(); i++) {
|
|
|
+ if (personnelList.get(i).getLI_CODE().contains(mSearchStr) ||
|
|
|
+ personnelList.get(i).getLI_NAME().contains(mSearchStr)
|
|
|
+ ) {
|
|
|
+ thisList.add(personnelList.get(i));
|
|
|
+ }
|
|
|
+ if (i == personnelList.size() - 1) {
|
|
|
+ getLinePortAdapter = new GetLinePortAdapter(thisList);
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ LogUtil.i("mSearchStr", JSON.toJSONString(thisList));
|
|
|
+
|
|
|
+ }
|
|
|
+ List<LineCodeEntity> lineCodeEntities = getLinePortAdapter.getmList();
|
|
|
+ for (int j = 0; j < lineCodeEntities.size(); j++) {
|
|
|
+ lineCodeEntities.get(j).setChecked(false);
|
|
|
+ }
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ getLinePortAdapter = new GetLinePortAdapter(personnelList);
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ List<LineCodeEntity> lineCodeEntities = getLinePortAdapter.getmList();
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ lineCodeEntities.get(i).setChecked(false);
|
|
|
+ }
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+
|
|
|
+ }
|
|
|
+ getLinePortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ try {
|
|
|
+ List<LineCodeEntity> lineCodeEntities = getLinePortAdapter.getmList();
|
|
|
+ String li_code = lineCodeEntities.get(position).getLI_CODE();
|
|
|
+ if (TextUtils.isEmpty(li_personne_id)) {
|
|
|
+ li_personne_id = li_code;
|
|
|
+ }else{
|
|
|
+ if (li_personne_id.contains(li_code)){
|
|
|
+ String[] split = li_personne_id.split(",");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if (split[i].equals(li_code)) {
|
|
|
+ if (li_personne_id.length() > li_code.length()) {
|
|
|
+ int start = li_personne_id.indexOf(li_code) - 1;
|
|
|
+ int end = start + li_code.length() + 1;
|
|
|
+ if(start <= 0) {
|
|
|
+ li_personne_id = li_personne_id.substring(end);
|
|
|
+ }else {
|
|
|
+ li_personne_id = li_personne_id.substring(0, start).concat(li_personne_id.substring(end));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ li_personne_id = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ li_personne_id += "," + li_code;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ String[] split = li_personne_id.split(",");
|
|
|
+ for (int i1 = 0; i1 < split.length; i1++) {
|
|
|
+ if (li_code.equals(split[i1])) {
|
|
|
+ lineCodeEntities.get(position).setChecked(true);
|
|
|
+ }else {
|
|
|
+ lineCodeEntities.get(position).setChecked(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ getLinePortAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
|
|
+ try {
|
|
|
+ List<LineCodeEntity> lineCodeEntities = getLinePortAdapter.getmList();
|
|
|
+ String li_code = lineCodeEntities.get(position).getLI_CODE();
|
|
|
+ if (TextUtils.isEmpty(li_personne_id)) {
|
|
|
+ li_personne_id = li_code;
|
|
|
+ }else{
|
|
|
+ if (li_personne_id.contains(li_code)){
|
|
|
+ String[] split = li_personne_id.split(",");
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if (split[i].equals(li_code)) {
|
|
|
+ if (li_personne_id.length() > li_code.length()) {
|
|
|
+ int start = li_personne_id.indexOf(li_code) - 1;
|
|
|
+ int end = start + li_code.length() + 1;
|
|
|
+ if(start <= 0) {
|
|
|
+ li_personne_id = li_personne_id.substring(end);
|
|
|
+ }else {
|
|
|
+ li_personne_id = li_personne_id.substring(0, start).concat(li_personne_id.substring(end));
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ li_personne_id = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ li_personne_id += "," + li_code;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < lineCodeEntities.size(); i++) {
|
|
|
+ String[] split = li_personne_id.split(",");
|
|
|
+ for (int i1 = 0; i1 < split.length; i1++) {
|
|
|
+ if (li_code.equals(split[i1])) {
|
|
|
+ lineCodeEntities.get(position).setChecked(true);
|
|
|
+ }else {
|
|
|
+ lineCodeEntities.get(position).setChecked(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //确定
|
|
|
+ sure_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (!StringUtil.isEmpty(li_personne_id)) {
|
|
|
+ reportWorkPush(sc_code,baoGong,gongdanhao,li_personne_id);
|
|
|
+ setReportingWork(baoGong, baofei, beizhu, yichanggongshi, position);
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请选择人员编号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //取消
|
|
|
+ cancle_tv.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeListPopupWindow();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void reportWorkPush(String sc_code,String ma_qty,String ma_code,String em_code) {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_SEND_NOTIFY)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .addParam("sc_code",sc_code)
|
|
|
+ .addParam("ma_qty",ma_qty)
|
|
|
+ .addParam("ma_code",ma_code)
|
|
|
+ .addParam("em_code",em_code)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ personnelList.clear();
|
|
|
+ try {
|
|
|
+ String result = o.toString();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ if (resultObject.getString("success") != null) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "报工推送成功");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void setcodelineAdapter(ArrayList<LineCodeEntity> mList) {
|
|
|
+ getLinePortAdapter.setmList(mList);
|
|
|
+ getLinePortAdapter.notifyDataSetChanged();
|
|
|
+ rv_getline_ip_port_data.setAdapter(getLinePortAdapter);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeListPopupWindow() {
|
|
|
+ if (editPW != null) {
|
|
|
+ editPW.dismiss();
|
|
|
+ editPW = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getPersonnelID() {
|
|
|
+ progressDialog.show();
|
|
|
+ VolleyRequest.getInstance().stringRequest(new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADD_GET_PERSONNEL_ID)
|
|
|
+ .addParam("type","完工报工")
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ try {
|
|
|
+ personnelList.clear();
|
|
|
+ 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, "EM_CODE"));
|
|
|
+ lineCodeEntity.setLI_NAME(FastjsonUtil.getText(dataObject, "EM_NAME"));
|
|
|
+ personnelList.add(lineCodeEntity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (personnelList.size() == 0) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "人员编号数据为空");
|
|
|
+ } else {
|
|
|
+ setcodelineAdapter(personnelList);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void printEvent(JSONArray printArray) {
|
|
|
+ if (isPrinting) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "正在打印中,请勿重复操作");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ isPrinting = true;
|
|
|
+ if (printArray != null && printArray.size() > 0) {
|
|
|
+ boolean isFail = false;
|
|
|
+ for (int i = 0; i < printArray.size(); i++) {
|
|
|
+ try {
|
|
|
+ int printResult = PrintUtils.printBar(mActivity, printArray.toString(), mPrintDpi, null);
|
|
|
+ if (printResult <= 0) {
|
|
|
+ isFail = true;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ closeSplitPopupWindow();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ if (isFail) {
|
|
|
+ isConnected = false;
|
|
|
+ SharedPreUtil.saveInt(mActivity, "printConnect", 0);
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "打印失败,请重新连接打印机");
|
|
|
+
|
|
|
+ BlueToothPrintFragment blueToothPrintFragment = new BlueToothPrintFragment();
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(Constants.KEY.BARCODE_PRINT_ARRAY, printArray.toString());
|
|
|
+ Log.e("listArraythree", printArray.toString());
|
|
|
+ blueToothPrintFragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(GdTimeReportFragmentNew2.this, blueToothPrintFragment);
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "打印成功");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "打印失败,条码数据为空");
|
|
|
+ }
|
|
|
+ isPrinting = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void closeSplitPopupWindow() {
|
|
|
+ if (splitPop != null) {
|
|
|
+ splitPop.dismiss();
|
|
|
+ splitPop = null;
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 1f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void initBreakPopupWindow(JSONArray listArray) {
|
|
|
+ for (int i = 0; i < listArray.size(); i++) {
|
|
|
+ messages.clear();
|
|
|
+ try {
|
|
|
+ JSONObject barcodeObject = listArray.getJSONObject(i);
|
|
|
+
|
|
|
+ if (barcodeObject != null) {
|
|
|
+ CaiPiBlueBean.DataBean dataBean=new CaiPiBlueBean.DataBean();
|
|
|
+ // dataBean.setLotno(JsonUtils.optStringNotNull(barcodeObject, "LOTNO"));
|
|
|
+ // dataBean.setQty(JsonUtils.optStringNotNull(barcodeObject, "QTY"));
|
|
|
+ Log.e("BAR_CODE",barcodeObject.getString("BAR_CODE"));//PR_CODE
|
|
|
+ dataBean.setLotno("新条码号:"+barcodeObject.getString("BAR_CODE"));
|
|
|
+ dataBean.setQty("数量:"+barcodeObject.getString("BAR_REMAIN")
|
|
|
+ +"\n产品名称:"+barcodeObject.getString("PR_DETAIL")
|
|
|
+ +"\n工单号:"+barcodeObject.getString("MA_CODE")
|
|
|
+ +"\n料号:"+barcodeObject.getString("PR_CODE")
|
|
|
+ +"\n打印时间:"+barcodeObject.getString("PRINTDATE"));
|
|
|
+ messages.add(dataBean);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ View popView = LayoutInflater.from(getActivity()).inflate(R.layout.popupwindow_whbreaking_batch, null);
|
|
|
+ ListView listView = (ListView) popView.findViewById(R.id.list_view);
|
|
|
+ Button btnPrintf = (Button) popView.findViewById(R.id.btn_print);
|
|
|
+ Button btnPrintfSet = (Button) popView.findViewById(R.id.btn_print_setting);
|
|
|
+ Button btnClose = (Button) popView.findViewById(R.id.btn_close);
|
|
|
+ Button btnBack = (Button) popView.findViewById(R.id.btn_back);
|
|
|
+
|
|
|
+ btnBack.setVisibility(View.GONE);
|
|
|
+ btnClose.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeSplitPopupWindow();
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ btnPrintf.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ if (isConnected) {
|
|
|
+ progressDialog.show();
|
|
|
+ // listArray.remove(0);
|
|
|
+ printEvent(listArray);
|
|
|
+ } else {
|
|
|
+ closeSplitPopupWindow();
|
|
|
+ BlueToothPrintFragment blueToothPrintFragment = new BlueToothPrintFragment();
|
|
|
+
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(Constants.KEY.BARCODE_PRINT_ARRAY, listArray.toString());
|
|
|
+ Log.e("listArrayone",listArray.toString());
|
|
|
+ blueToothPrintFragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(GdTimeReportFragmentNew2.this, blueToothPrintFragment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ btnPrintfSet.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ closeSplitPopupWindow();
|
|
|
+ BlueToothPrintFragment blueToothPrintFragment = new BlueToothPrintFragment();
|
|
|
+
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString(Constants.KEY.BARCODE_PRINT_ARRAY, listArray.toString());
|
|
|
+ Log.e("listArraytwo",listArray.toString());
|
|
|
+ blueToothPrintFragment.setArguments(bundle);
|
|
|
+ FragmentUtils.switchFragment(GdTimeReportFragmentNew2.this, blueToothPrintFragment);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ MyAdapter adapter = new MyAdapter(getActivity(), R.layout.item_list_whbreakingbatchfragment, messages);
|
|
|
+ listView.setAdapter(adapter);
|
|
|
+ //当只有一条数据的时候可以加上
|
|
|
+ /*
|
|
|
+ if (messages.size()>1){
|
|
|
+ btnBack.setVisibility(View.GONE);
|
|
|
+ }*/
|
|
|
+ // PopupWindow实例化,参数的意思是 view,长(不包括状态栏),高(不包括状态栏),是否聚焦
|
|
|
+ splitPop = new PopupWindow(popView, LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
|
+ LinearLayout.LayoutParams.WRAP_CONTENT, true);
|
|
|
+ splitPop.setAnimationStyle(R.style.MenuAnimationFade);
|
|
|
+ splitPop.setBackgroundDrawable(new BitmapDrawable());
|
|
|
+ // 弹出窗口显示内容视图,默认以锚定视图的左下角为起点,这里为点击按钮
|
|
|
+ splitPop.showAtLocation(getActivity().getWindow().getDecorView(), Gravity.CENTER, 0, 0);
|
|
|
+ splitPop.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
|
|
+ @Override
|
|
|
+ public void onDismiss() {
|
|
|
+ closeSplitPopupWindow();
|
|
|
+ // specialOut();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ CommonUtil.setBackgroundAlpha(mActivity, 0.5f);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFragmentBackPressed() {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ }
|
|
|
+
|
|
|
+ private class MyAdapter extends ArrayAdapter<CaiPiBlueBean.DataBean> {
|
|
|
+ private int resourceId;
|
|
|
+
|
|
|
+ public MyAdapter(Context context, int resource, List<CaiPiBlueBean.DataBean> objects) {
|
|
|
+ super(context, resource, objects);
|
|
|
+ resourceId = resource;
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressLint("ViewHolder")
|
|
|
+ @Override
|
|
|
+ public View getView(int position, View convertView, ViewGroup parent) {
|
|
|
+ CaiPiBlueBean.DataBean person = getItem(position);
|
|
|
+ convertView = LayoutInflater.from(getContext()).inflate(resourceId, null);
|
|
|
+ TextView tv_gone1 = (TextView) convertView.findViewById(R.id.tv_bar_code);
|
|
|
+ TextView tv_gone2 = (TextView) convertView.findViewById(R.id.tv_bar_remain);
|
|
|
+ tv_gone1.setText(person.getLotno());
|
|
|
+ tv_gone2.setText(person.getQty());
|
|
|
+ return convertView;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private class ComListAdapter extends BaseQuickAdapter<ComDataBean, BaseViewHolder> {
|
|
|
+ private List<ComDataBean> mmmmList;
|
|
|
+
|
|
|
+ public List<ComDataBean> getmList() {
|
|
|
+ return mmmmList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setmList(List<ComDataBean> mList) {
|
|
|
+ this.mmmmList = mList;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ComDataBean getBeanByPositon(int position) {
|
|
|
+ return mmmmList.get(position);
|
|
|
+ }
|
|
|
+
|
|
|
+ private ComListAdapter(@Nullable List<ComDataBean> data) {
|
|
|
+ super(R.layout.fuzzy_search_item, data);
|
|
|
+ this.mmmmList = data;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void convert(BaseViewHolder helper, ComDataBean item) {
|
|
|
+ helper.setText(R.id.macode_Tv, item.getItemName());
|
|
|
+ helper.setText(R.id.remark_Tv, item.getItemremark());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private class ComDataBean {
|
|
|
+ String itemName = null;
|
|
|
+ String itemremark = null;
|
|
|
+
|
|
|
+ public String getItemName() {
|
|
|
+ return itemName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setItemName(String itemName) {
|
|
|
+ this.itemName = itemName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getItemremark() {
|
|
|
+ return itemremark;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setItemremark(String itemremark) {
|
|
|
+ this.itemremark = itemremark;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 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_item2, 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() + ")");
|
|
|
+ helper.setGone(R.id.rl_2, false);
|
|
|
+ helper.setGone(R.id.rl_3, false);
|
|
|
+ LinearLayout line_true = helper.itemView.findViewById(R.id.line_true);
|
|
|
+ if (item.getChecked()) {
|
|
|
+ line_true.setSelected(true);
|
|
|
+ } else {
|
|
|
+ line_true.setSelected(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|