|
|
@@ -0,0 +1,986 @@
|
|
|
+package com.uas.hystorage.fragment;
|
|
|
+
|
|
|
+import android.Manifest;
|
|
|
+import android.app.Activity;
|
|
|
+import android.content.Intent;
|
|
|
+import android.content.pm.PackageManager;
|
|
|
+import android.database.Cursor;
|
|
|
+import android.graphics.Color;
|
|
|
+import android.net.Uri;
|
|
|
+import android.os.Bundle;
|
|
|
+import android.os.Handler;
|
|
|
+import android.provider.MediaStore;
|
|
|
+import android.support.v4.app.ActivityCompat;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.text.TextUtils;
|
|
|
+import android.util.Log;
|
|
|
+import android.view.KeyEvent;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
+import android.widget.ImageView;
|
|
|
+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.google.gson.Gson;
|
|
|
+import com.uas.hystorage.R;
|
|
|
+import com.uas.hystorage.activity.SampleDeliveryListAct;
|
|
|
+import com.uas.hystorage.adapter.AnnexAdapter;
|
|
|
+import com.uas.hystorage.bean.AnnexBean;
|
|
|
+import com.uas.hystorage.bean.AnnexInfo;
|
|
|
+import com.uas.hystorage.bean.InspectionPaintBean;
|
|
|
+import com.uas.hystorage.bean.SampleDeliveryBean;
|
|
|
+import com.uas.hystorage.global.GloableParams;
|
|
|
+import com.uas.hystorage.interfaces.ProgressListener;
|
|
|
+import com.uas.hystorage.listener.MyEditorActionListener;
|
|
|
+import com.uas.hystorage.util.ClickUtils;
|
|
|
+import com.uas.hystorage.util.CommonUtil;
|
|
|
+import com.uas.hystorage.util.Constants;
|
|
|
+import com.uas.hystorage.util.FastjsonUtil;
|
|
|
+import com.uas.hystorage.util.HttpCallback;
|
|
|
+import com.uas.hystorage.util.HttpParams;
|
|
|
+import com.uas.hystorage.util.MyLog;
|
|
|
+import com.uas.hystorage.util.OKHttpUitls;
|
|
|
+import com.uas.hystorage.util.OnDownloadListener;
|
|
|
+import com.uas.hystorage.util.UploadUtils;
|
|
|
+import com.uas.hystorage.util.VollyRequest;
|
|
|
+import com.uas.hystorage.util.YLDownload;
|
|
|
+import com.uas.hystorage.view.ClearableEditText;
|
|
|
+import com.uas.hystorage.view.business.ProgressPopup;
|
|
|
+import com.umeng.commonsdk.debug.E;
|
|
|
+import com.uuzuche.lib_zxing.activity.CodeUtils;
|
|
|
+
|
|
|
+import org.json.JSONException;
|
|
|
+import org.w3c.dom.Text;
|
|
|
+
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileOutputStream;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
+import java.net.URL;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.LinkedList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Callback;
|
|
|
+import okhttp3.MediaType;
|
|
|
+import okhttp3.MultipartBody;
|
|
|
+import okhttp3.RequestBody;
|
|
|
+import okhttp3.Response;
|
|
|
+
|
|
|
+public class ReportPageFra extends BaseFragment {
|
|
|
+
|
|
|
+ private Button bt_gengxin;
|
|
|
+ private ClearableEditText cet_danhao, cet_beizhu1, cet_beizhu2;
|
|
|
+ private ImageView iv_qc_fujian, iv_shiyanfujian;
|
|
|
+ private RecyclerView rv_qc_fujian, rv_shiyanfujian;
|
|
|
+ private StringRequest mStringRequest;
|
|
|
+ private String sr_sendtype;
|
|
|
+
|
|
|
+ private final int REQUEST_EXTERNAL_STORAGE = 1;
|
|
|
+ private String[] PERMISSIONS_STORAGE = {
|
|
|
+ Manifest.permission.READ_EXTERNAL_STORAGE,
|
|
|
+ Manifest.permission.WRITE_EXTERNAL_STORAGE};
|
|
|
+ private static final int REQUEST_CODE1 = 1;
|
|
|
+ private static final int REQUEST_CODE2 = 2;
|
|
|
+
|
|
|
+ private List<String> selectedImagePaths = new ArrayList<>();
|
|
|
+ private ProgressPopup mProgressPopup;
|
|
|
+
|
|
|
+ private int fujian = 0;
|
|
|
+ private List<AnnexBean> fujianList1;
|
|
|
+ private List<AnnexBean> fujianList2;
|
|
|
+ private AnnexAdapter annexQCFuJianAdapter;
|
|
|
+ private AnnexAdapter annexShiYanFuJianAdapter;
|
|
|
+ private int uploadRecords;
|
|
|
+ private int uploadRecordsNumber;
|
|
|
+ private List<AnnexBean> templist;
|
|
|
+ private TextView tv_updater_info;
|
|
|
+
|
|
|
+ private String sr_qcattach;
|
|
|
+ private String sr_laboratoryattach;
|
|
|
+ private String sr_qcremark;
|
|
|
+ private String sr_laboratoryremark;
|
|
|
+ private List<AnnexInfo> imageQCUrlList;
|
|
|
+ private List<AnnexInfo> imageTestUrlList;
|
|
|
+ private int numberOfTimes = 0; //下载完成次数
|
|
|
+ private String pathQc;
|
|
|
+ private String pathTest;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayout() {
|
|
|
+ return R.layout.fra_report_page;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initViews() {
|
|
|
+ cet_danhao = root.findViewById(R.id.cet_danhao);
|
|
|
+ rv_qc_fujian = root.findViewById(R.id.rv_qc_fujian);
|
|
|
+ rv_shiyanfujian = root.findViewById(R.id.rv_shiyanfujian);
|
|
|
+
|
|
|
+ iv_qc_fujian = root.findViewById(R.id.iv_qc_fujian);
|
|
|
+ iv_shiyanfujian = root.findViewById(R.id.iv_shiyanfujian);
|
|
|
+
|
|
|
+ cet_beizhu1 = root.findViewById(R.id.cet_beizhu1);
|
|
|
+ cet_beizhu2 = root.findViewById(R.id.cet_beizhu2);
|
|
|
+ bt_gengxin = root.findViewById(R.id.bt_gengxin);
|
|
|
+ tv_updater_info = root.findViewById(R.id.tv_updater_info);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initEvents() {
|
|
|
+ CommonUtil.setEditorActionListener(cet_danhao, new MyEditorActionListener() {
|
|
|
+ @Override
|
|
|
+ public void MyEditorAction(String text, int actionId, KeyEvent event) {
|
|
|
+ getTrackingNumberInquiry(text);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ bt_gengxin.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ ClickUtils.pauseTime = 2000;
|
|
|
+ if (ClickUtils.isFastClick()) {
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "请勿点击过快");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ getUpdater();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ iv_qc_fujian.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ verifyStoragePermissions(mActivity);
|
|
|
+ // 启动文件选择器
|
|
|
+ Intent intent = new Intent(Intent.ACTION_PICK);
|
|
|
+ intent.setType("image/*");
|
|
|
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
|
+ startActivityForResult(Intent.createChooser(intent, "Select Images"), REQUEST_CODE1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ iv_shiyanfujian.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ verifyStoragePermissions(mActivity);
|
|
|
+ // 启动文件选择器
|
|
|
+ Intent intent = new Intent(Intent.ACTION_PICK);
|
|
|
+ intent.setType("image/*");
|
|
|
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
|
+ startActivityForResult(Intent.createChooser(intent, "Select Images"), REQUEST_CODE2);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void initDatas() {
|
|
|
+ pathQc = Constants.CONSTANT.APP_DIR_NAME + getActivity().getPackageName() + "/imageQC/";
|
|
|
+ pathTest = Constants.CONSTANT.APP_DIR_NAME + getActivity().getPackageName() + "/imageTest/";
|
|
|
+ deleteFile();
|
|
|
+
|
|
|
+
|
|
|
+ cet_danhao.requestFocus();
|
|
|
+ Bundle arguments = getArguments();
|
|
|
+ if (arguments != null) {
|
|
|
+ sr_sendtype = arguments.getString("sr_sendtype", "");
|
|
|
+ setTitle(sr_sendtype + "报告");
|
|
|
+ }
|
|
|
+ //如果单号没有数据,并且没有执行enter 校验不成功的情况,不允许编辑下面的字段,包含上传图片、备注、点更新按钮(新增)
|
|
|
+
|
|
|
+ LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
|
|
|
+ rv_qc_fujian.setLayoutManager(linearLayoutManager);
|
|
|
+
|
|
|
+ LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
|
|
|
+ rv_shiyanfujian.setLayoutManager(linearLayoutManager2);
|
|
|
+
|
|
|
+ fujianList1 = new ArrayList<>();
|
|
|
+// fujianList1.add(new AnnexBean(true, "", "", false));
|
|
|
+ annexQCFuJianAdapter = new AnnexAdapter(getActivity(), fujianList1);
|
|
|
+ rv_qc_fujian.setAdapter(annexQCFuJianAdapter);
|
|
|
+ annexQCFuJianAdapter.setImageUpload(new AnnexAdapter.AddImage() {
|
|
|
+ @Override
|
|
|
+ public void startAdd() {
|
|
|
+ verifyStoragePermissions(mActivity);
|
|
|
+ // 启动文件选择器
|
|
|
+ Intent intent = new Intent(Intent.ACTION_PICK);
|
|
|
+ intent.setType("image/*");
|
|
|
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
|
+ startActivityForResult(Intent.createChooser(intent, "Select Images"), REQUEST_CODE1);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delete(int position) {
|
|
|
+ if(position < fujianList1.size()) {
|
|
|
+ fujianList1.remove(position);
|
|
|
+ annexQCFuJianAdapter.setListNotTitle(fujianList1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ fujianList2 = new ArrayList<>();
|
|
|
+// fujianList2.add(new AnnexBean(true, "", "", false));
|
|
|
+ annexShiYanFuJianAdapter = new AnnexAdapter(getActivity(), fujianList2);
|
|
|
+ rv_shiyanfujian.setAdapter(annexShiYanFuJianAdapter);
|
|
|
+ annexShiYanFuJianAdapter.setImageUpload(new AnnexAdapter.AddImage() {
|
|
|
+ @Override
|
|
|
+ public void startAdd() {
|
|
|
+ verifyStoragePermissions(mActivity);
|
|
|
+ // 启动文件选择器
|
|
|
+ Intent intent = new Intent(Intent.ACTION_PICK);
|
|
|
+ intent.setType("image/*");
|
|
|
+ intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
|
+ startActivityForResult(Intent.createChooser(intent, "Select Images"), REQUEST_CODE2);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void delete(int position) {
|
|
|
+ if(position < fujianList2.size()) {
|
|
|
+ fujianList2.remove(position);
|
|
|
+ annexShiYanFuJianAdapter.setListNotTitle(fujianList2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ imageQCUrlList = new ArrayList<>();
|
|
|
+ imageTestUrlList = new ArrayList<>();
|
|
|
+
|
|
|
+ cet_beizhu1.setEnabled(false);
|
|
|
+ cet_beizhu2.setEnabled(false);
|
|
|
+ bt_gengxin.setEnabled(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void deleteFile() {
|
|
|
+ try{
|
|
|
+ File fileQc = new File(pathQc);
|
|
|
+ File fileTest = new File(pathTest);
|
|
|
+ if (!fileQc.exists()) {
|
|
|
+ fileQc.mkdirs();
|
|
|
+ }
|
|
|
+ if (!fileTest.exists()) {
|
|
|
+ fileTest.mkdirs();
|
|
|
+ }
|
|
|
+ deleteFiles(fileQc);
|
|
|
+ deleteFiles(fileTest);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void deleteFiles(File file) {
|
|
|
+ if (file.exists()) {
|
|
|
+ if (file.isDirectory()) {
|
|
|
+ File[] files = file.listFiles();
|
|
|
+ if (files != null) {
|
|
|
+ for (File f : files) {
|
|
|
+ deleteFiles(f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ file.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void verifyStoragePermissions(Activity activity) {
|
|
|
+ int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
|
|
+ if (permission != PackageManager.PERMISSION_GRANTED) {
|
|
|
+ ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getUpdater() {
|
|
|
+ if (TextUtils.isEmpty(cet_danhao.getText().toString().trim())) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "请输入单号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String fujianStr1 = "";
|
|
|
+ if (fujianList1.size() > 0) {
|
|
|
+ for (int i = 1; i < fujianList1.size(); i++) {
|
|
|
+ String s = fujianList1.get(i).getImageID();
|
|
|
+ fujianStr1 += s;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fujianStr2 = "";
|
|
|
+ if (fujianList2.size() > 0) {
|
|
|
+ for (int i = 1; i < fujianList2.size(); i++) {
|
|
|
+ String s = fujianList2.get(i).getImageID();
|
|
|
+ fujianStr2 += s;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("sr_qcattach", fujianStr1);
|
|
|
+ params.put("sr_qcremark ", cet_beizhu1.getText().toString().trim());
|
|
|
+ params.put("sr_laboratoryattach", fujianStr2);
|
|
|
+ params.put("sr_laboratoryremark", cet_beizhu2.getText().toString().trim());
|
|
|
+ params.put("sr_sendtype", sr_sendtype);
|
|
|
+ String data = JSON.toJSONString(params);
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_UPDATESAMPLEREPORT)
|
|
|
+ .method(Request.Method.POST)
|
|
|
+ .tag("getMaCode")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("sr_code", cet_danhao.getText().toString().trim())
|
|
|
+ .addParam("data", data) //首件或巡检
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ if (isSuccess) {
|
|
|
+ tv_updater_info.setTextColor(getResources().getColor(R.color.blue));
|
|
|
+ tv_updater_info.setText("更新成功");
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "更新成功");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ tv_updater_info.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_updater_info.setText(failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private void getTrackingNumberInquiry(String text) {
|
|
|
+ if (TextUtils.isEmpty(text)) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "请输入单号");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ progressDialog.show();
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GETSAMPLEREPORT)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag("getMaCode")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("sr_code", text)
|
|
|
+ .addParam("sr_sendtype", sr_sendtype) //首件或巡检
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ //progressDialog.dismiss();
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ if (isSuccess) {
|
|
|
+ JSONObject dataObject = FastjsonUtil.getJSONObject(o.toString(), "data");
|
|
|
+ if (dataObject != null) {
|
|
|
+ String SC_CODE = dataObject.getString("SR_CODE") == null ? "" : dataObject.getString("SC_CODE");
|
|
|
+ sr_qcattach = dataObject.getString("SR_QCATTACH") == null ? "" : dataObject.getString("SR_QCATTACH");
|
|
|
+ sr_laboratoryattach = dataObject.getString("SR_LABORATORYATTACH") == null ? "" : dataObject.getString("SR_LABORATORYATTACH");
|
|
|
+ sr_qcremark = dataObject.getString("SR_QCREMARK") == null ? "" : dataObject.getString("SR_QCREMARK");
|
|
|
+ sr_laboratoryremark = dataObject.getString("SR_LABORATORYREMARK") == null ? "" : dataObject.getString("SR_LABORATORYREMARK");
|
|
|
+ cet_beizhu1.setText(sr_qcremark);
|
|
|
+ cet_beizhu2.setText(sr_laboratoryremark);
|
|
|
+ //先删除文件在下载
|
|
|
+ deleteFile();
|
|
|
+ numberOfTimes = 0;
|
|
|
+ imageQCUrlList.clear();
|
|
|
+ imageTestUrlList.clear();
|
|
|
+ fujianList1.clear();
|
|
|
+ fujianList2.clear();
|
|
|
+ fujianList1.add(new AnnexBean(true, "", "", false));
|
|
|
+ fujianList2.add(new AnnexBean(true, "", "", false));
|
|
|
+ cet_beizhu1.setEnabled(true);
|
|
|
+ cet_beizhu2.setEnabled(true);
|
|
|
+ bt_gengxin.setEnabled(true);
|
|
|
+ for (int i = 0; i < fujianList1.size(); i++) {
|
|
|
+ fujianList1.get(i).setUsable(true);
|
|
|
+ }
|
|
|
+ annexQCFuJianAdapter.setListNotTitle(fujianList1);
|
|
|
+ for (int i = 0; i < fujianList2.size(); i++) {
|
|
|
+ fujianList2.get(i).setUsable(true);
|
|
|
+ }
|
|
|
+ annexShiYanFuJianAdapter.setListNotTitle(fujianList2);
|
|
|
+ //获取附件图片数据
|
|
|
+ if (!TextUtils.isEmpty(sr_qcattach)) {
|
|
|
+ getImageData(sr_qcattach);
|
|
|
+ }
|
|
|
+ if (!TextUtils.isEmpty(sr_laboratoryattach)) {
|
|
|
+ getImageData2(sr_laboratoryattach, "Test");
|
|
|
+ }
|
|
|
+ if (TextUtils.isEmpty(sr_qcattach) && TextUtils.isEmpty(sr_laboratoryattach)) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void getImageData(String imageDataID) {
|
|
|
+// new Handler().postDelayed(new Runnable() {
|
|
|
+// @Override
|
|
|
+// public void run() {
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GETFILEPATHS)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag("getMaCode1")
|
|
|
+ .flag(1)
|
|
|
+ .addParam("id",imageDataID)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "files");
|
|
|
+ if (isSuccess) {
|
|
|
+ if (dataArray == null) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "未搜索到匹配数据");
|
|
|
+ } else {
|
|
|
+ if (dataArray.size() <= 0) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }else {
|
|
|
+ downloadImages(dataArray,"QC");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+// }
|
|
|
+// }, 3 * 1000);
|
|
|
+
|
|
|
+
|
|
|
+// VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+// new HttpParams.Builder()
|
|
|
+// .url(GloableParams.ADDRESS_GETFILEPATHS)
|
|
|
+// .method(Request.Method.GET)
|
|
|
+// .tag("getMaCode1")
|
|
|
+// .flag(1)
|
|
|
+// .addParam("id",imageDataID)
|
|
|
+// .build(), new HttpCallback() {
|
|
|
+// @Override
|
|
|
+// public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+// Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+// JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "files");
|
|
|
+// if (isSuccess) {
|
|
|
+// if (dataArray == null) {
|
|
|
+// CommonUtil.toastNoRepeat(getActivity(), "未搜索到匹配数据");
|
|
|
+// } else {
|
|
|
+// if (dataArray.size() <= 0) {
|
|
|
+// progressDialog.dismiss();
|
|
|
+// }else {
|
|
|
+// downloadImages(dataArray,"QC");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// @Override
|
|
|
+// public void onFail(int flag, String failStr) throws Exception {
|
|
|
+// progressDialog.dismiss();
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// String url = GloableParams.ADDRESS_GETFILEPATHS + "?" + "id=" + imageDataID;
|
|
|
+// OKHttpUitls okHttpUitls = new OKHttpUitls();
|
|
|
+// okHttpUitls.get(url);
|
|
|
+// okHttpUitls.setOnOKHttpGetListener(new OKHttpUitls.OKHttpGetListener() {
|
|
|
+// @Override
|
|
|
+// public void error(String error) {
|
|
|
+// progressDialog.dismiss();
|
|
|
+// CommonUtil.toastNoRepeat(mActivity, "附件加载失败");
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public void success(String json) {
|
|
|
+// try {
|
|
|
+// // org.json.JSONObject jsonObject = new org.json.JSONObject(json);
|
|
|
+// Boolean isSuccess = FastjsonUtil.getBoolean(json, "success");
|
|
|
+// // String success = jsonObject.getString("success");
|
|
|
+// JSONArray dataArray = FastjsonUtil.getJSONArray(json, "files");
|
|
|
+// if (isSuccess) {
|
|
|
+// if (dataArray == null) {
|
|
|
+// CommonUtil.toastNoRepeat(getActivity(), "未搜索到匹配数据");
|
|
|
+// } else {
|
|
|
+// if (dataArray.size() <= 0) {
|
|
|
+// progressDialog.dismiss();
|
|
|
+// } else {
|
|
|
+// downloadImages(dataArray, "QC");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void getImageData2(String imageDataID, String type) {
|
|
|
+ VollyRequest.getInstance().stringRequest(mStringRequest,
|
|
|
+ new HttpParams.Builder()
|
|
|
+ .url(GloableParams.ADDRESS_GETFILEPATHS)
|
|
|
+ .method(Request.Method.GET)
|
|
|
+ .tag("getMaCode")
|
|
|
+ .flag(0)
|
|
|
+ .addParam("id", imageDataID)
|
|
|
+ .build(), new HttpCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(int flag, Object o) throws Exception {
|
|
|
+ Boolean isSuccess = FastjsonUtil.getBoolean(o.toString(), "success");
|
|
|
+ JSONArray dataArray = FastjsonUtil.getJSONArray(o.toString(), "files");
|
|
|
+ if (isSuccess) {
|
|
|
+ if (dataArray == null) {
|
|
|
+ CommonUtil.toastNoRepeat(getActivity(), "未搜索到匹配数据");
|
|
|
+ } else {
|
|
|
+ if (dataArray.size() <= 0) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ } else {
|
|
|
+ downloadImages(dataArray, "Test");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFail(int flag, String failStr) throws Exception {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, failStr);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void downloadImages(JSONArray dataArray,String type) {
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ AnnexInfo annexInfo = new Gson().fromJson(data.toString(), AnnexInfo.class);
|
|
|
+ imageQCUrlList.add(annexInfo);
|
|
|
+ }
|
|
|
+ getImageStream(imageQCUrlList, type);
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ for (Object index : dataArray) {
|
|
|
+ JSONObject data = (JSONObject) index;
|
|
|
+ AnnexInfo annexInfo = new Gson().fromJson(data.toString(), AnnexInfo.class);
|
|
|
+ imageTestUrlList.add(annexInfo);
|
|
|
+ }
|
|
|
+ getImageStream2(imageTestUrlList, type);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private int index;
|
|
|
+ private String path = "";
|
|
|
+ private List<AnnexInfo> qcList;
|
|
|
+ private synchronized void getImageStream(List<AnnexInfo> list, String type) {
|
|
|
+ index = 0;
|
|
|
+ qcList = list;
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ String Path = "http://" + GloableParams.IP + ":"
|
|
|
+ + GloableParams.PORT + "/" + GloableParams.SITE
|
|
|
+ + "/api/pdashop/quality/download.action?" + "path="
|
|
|
+ + list.get(i).getFp_path() + "&" + "size=" + list.get(i).getFp_size()
|
|
|
+ + "&" + "fileName=" + list.get(i).getFp_name();
|
|
|
+ path = "";
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ path = pathQc;
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ path = pathTest;
|
|
|
+ }
|
|
|
+// new Thread(new Runnable() {
|
|
|
+// @Override
|
|
|
+// public void run() {
|
|
|
+ String fileName = list.get(i).getFp_name();
|
|
|
+ fileName = System.currentTimeMillis() + fileName;
|
|
|
+ YLDownload.getInstance().download(Path, path, fileName, new OnDownloadListener() {
|
|
|
+ @Override
|
|
|
+ public void onDownloadFailed(Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "附件下载出错,请重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDownloadSuccess() {
|
|
|
+ MyLog.e("aaa","Qc下载次数:" + index + ",list大小:" + qcList.size());
|
|
|
+ index++;
|
|
|
+ if (index == qcList.size()) {
|
|
|
+ //校验完整性
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ File dirFire = new File(pathQc);
|
|
|
+ setImagePath(dirFire, imageQCUrlList, "QC");
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ File dirFire = new File(pathTest);
|
|
|
+ setImagePath(dirFire, imageTestUrlList, "Test");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDownloading(int i) {
|
|
|
+ Log.e("aaa", "下载图片的进度是: " + i);
|
|
|
+ }
|
|
|
+ });
|
|
|
+// }
|
|
|
+// }).start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private int index2;
|
|
|
+ private String path2 = "";
|
|
|
+ private List<AnnexInfo> testList;
|
|
|
+ private synchronized void getImageStream2(List<AnnexInfo> list, String type) {
|
|
|
+ index2 = 0;
|
|
|
+ testList = list;
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ String Path = "http://" + GloableParams.IP + ":"
|
|
|
+ + GloableParams.PORT + "/" + GloableParams.SITE
|
|
|
+ + "/api/pdashop/quality/download.action?" + "path="
|
|
|
+ + list.get(i).getFp_path() + "&" + "size=" + list.get(i).getFp_size()
|
|
|
+ + "&" + "fileName=" + list.get(i).getFp_name();
|
|
|
+ path2 = "";
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ path2 = pathQc;
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ path2 = pathTest;
|
|
|
+ }
|
|
|
+ // new Thread(new Runnable() {
|
|
|
+ // @Override
|
|
|
+ // public void run() {
|
|
|
+ String fileName = list.get(i).getFp_name();
|
|
|
+ fileName = System.currentTimeMillis() + fileName;
|
|
|
+ YLDownload.getInstance().download(Path, path2, fileName, new OnDownloadListener() {
|
|
|
+ @Override
|
|
|
+ public void onDownloadFailed(Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ progressDialog.dismiss();
|
|
|
+ CommonUtil.toastNoRepeat(mActivity, "附件下载出错,请重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDownloadSuccess() {
|
|
|
+ MyLog.e("aaa","Test下载次数:" + index2 + ",list大小:" + testList.size());
|
|
|
+ index2++;
|
|
|
+ if (index2 == testList.size()) {
|
|
|
+ //校验完整性
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ File dirFire = new File(pathQc);
|
|
|
+ setImagePath(dirFire, imageQCUrlList, "QC");
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ File dirFire = new File(pathTest);
|
|
|
+ setImagePath(dirFire, imageTestUrlList, "Test");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDownloading(int i) {
|
|
|
+ Log.e("aaa", "下载图片的进度是: " + i);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // }
|
|
|
+ // }).start();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private synchronized void setImagePath(File dirFire, List<AnnexInfo> list, String type) {
|
|
|
+ try{
|
|
|
+ MyLog.e("aaa","我执行了type:" + type + ",数量是:" + list.size());
|
|
|
+ long QCDownloadFileSize = 0;
|
|
|
+ for (int i1 = 0; i1 < list.size(); i1++) {
|
|
|
+ QCDownloadFileSize += Long.parseLong(list.get(i1).getFp_size());
|
|
|
+ }
|
|
|
+ File[] listOfFiles = dirFire.listFiles();
|
|
|
+ long QCFileSize = 0;
|
|
|
+ String filePath = "";
|
|
|
+ List<AnnexBean> fujianList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < listOfFiles.length; i++) {
|
|
|
+ if (listOfFiles[i].isFile()) {
|
|
|
+ // 获取文件路径
|
|
|
+ filePath = listOfFiles[i].getAbsolutePath();
|
|
|
+ fujianList.add(new AnnexBean(false, filePath,
|
|
|
+ list.get(i).getFp_id() + ";", true));
|
|
|
+ // 获取文件大小
|
|
|
+ QCFileSize += listOfFiles[i].length();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // if (QCDownloadFileSize == QCFileSize) {
|
|
|
+ // if (listOfFiles.length == list.size()) {
|
|
|
+ getActivity().runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ MyLog.e("aaa","22222添加了文件类型:" + type + ",数量是:" + fujianList.size());
|
|
|
+ if (type.equals("QC")) {
|
|
|
+ // annexQCFuJianAdapter.addList(fujianList);
|
|
|
+// annexQCFuJianAdapter.setList(fujianList);
|
|
|
+// fujianList1.addAll(fujianList);
|
|
|
+
|
|
|
+// fujianList1.addAll(fujianList);
|
|
|
+// annexQCFuJianAdapter.addList(fujianList);
|
|
|
+
|
|
|
+ fujianList1.clear();
|
|
|
+ fujianList1.add(new AnnexBean(true, "", "", false));
|
|
|
+ fujianList1.addAll(fujianList);
|
|
|
+ annexQCFuJianAdapter.setListNotTitle(fujianList1);
|
|
|
+ for (int i = 0; i < fujianList1.size(); i++) {
|
|
|
+ MyLog.e("aaa","33333添加了文件类型:" + type + ",id是:" + fujianList1.get(i)+",是否是加号:" + fujianList1.get(i).isAddImage());
|
|
|
+ }
|
|
|
+ } else if (type.equals("Test")) {
|
|
|
+ // annexShiYanFuJianAdapter.addList(fujianList);
|
|
|
+// annexShiYanFuJianAdapter.setList(fujianList);
|
|
|
+// fujianList2.addAll(fujianList);
|
|
|
+
|
|
|
+ fujianList2.clear();
|
|
|
+ fujianList2.add(new AnnexBean(true, "", "", false));
|
|
|
+ fujianList2.addAll(fujianList);
|
|
|
+ annexShiYanFuJianAdapter.setListNotTitle(fujianList2);
|
|
|
+
|
|
|
+// fujianList2.addAll(fujianList);
|
|
|
+// annexShiYanFuJianAdapter.addList(fujianList);
|
|
|
+
|
|
|
+ for (int i = 0; i < fujianList2.size(); i++) {
|
|
|
+ MyLog.e("aaa","33333添加了文件类型:" + type + ",id是:" + fujianList2.get(i)+",是否是加号:" + fujianList2.get(i).isAddImage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (imageQCUrlList.size() > 0 && imageTestUrlList.size() > 0) {
|
|
|
+ numberOfTimes++;
|
|
|
+ if (numberOfTimes >= 2) {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ progressDialog.dismiss();
|
|
|
+ }
|
|
|
+ // }
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @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);
|
|
|
+ if (resultCode != Activity.RESULT_OK) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (requestCode == REQUEST_CODE1 && data != null) {
|
|
|
+ fujian = 1;
|
|
|
+ } else if (requestCode == REQUEST_CODE2 && data != null) {
|
|
|
+ fujian = 2;
|
|
|
+ }
|
|
|
+ selectedImagePaths.clear();
|
|
|
+ if (data.getClipData() != null) {
|
|
|
+ // 用户选择了多个图片
|
|
|
+ int count = data.getClipData().getItemCount();
|
|
|
+ for (int i = 0; i < count; i++) {
|
|
|
+ Uri imageUri = data.getClipData().getItemAt(i).getUri();
|
|
|
+ selectedImagePaths.add(getRealPathFromUri(imageUri));
|
|
|
+ }
|
|
|
+ } else if (data.getData() != null) {
|
|
|
+ // 用户选择了单个图片
|
|
|
+ Uri imageUri = data.getData();
|
|
|
+ selectedImagePaths.add(getRealPathFromUri(imageUri));
|
|
|
+ }
|
|
|
+ // 批量上传图片
|
|
|
+ uploadImages(selectedImagePaths);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getRealPathFromUri(Uri uri) {
|
|
|
+ // 获取真实的文件路径
|
|
|
+ String filePath;
|
|
|
+ String[] projection = {MediaStore.Images.Media.DATA};
|
|
|
+ Cursor cursor = mActivity.getContentResolver().query(uri, projection, null, null, null);
|
|
|
+ if (cursor == null) {
|
|
|
+ filePath = uri.getPath();
|
|
|
+ } else {
|
|
|
+ cursor.moveToFirst();
|
|
|
+ int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
|
|
+ filePath = cursor.getString(columnIndex);
|
|
|
+ cursor.close();
|
|
|
+ }
|
|
|
+ return filePath;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void uploadImages(List<String> imagePaths) {
|
|
|
+ uploadRecords = 0;
|
|
|
+ if (templist == null) {
|
|
|
+ templist = new ArrayList<>();
|
|
|
+ } else {
|
|
|
+ templist.clear();
|
|
|
+ }
|
|
|
+ uploadRecordsNumber = imagePaths.size();
|
|
|
+ for (String imagePath : imagePaths) {
|
|
|
+ try {
|
|
|
+ File mFile = new File(imagePath);
|
|
|
+ // 获得文件名
|
|
|
+ String fileName = mFile.getName();
|
|
|
+ MultipartBody.Builder builder = new MultipartBody.Builder();
|
|
|
+ builder.setType(MultipartBody.FORM);
|
|
|
+ //第一个参数要与Servlet中的一致
|
|
|
+ builder.addFormDataPart("file", fileName,
|
|
|
+ RequestBody.create(MediaType.parse("application/octet-stream"), mFile))
|
|
|
+ .addFormDataPart("type", "common")
|
|
|
+ .addFormDataPart("master", CommonUtil.getMaster(mActivity));
|
|
|
+ RequestBody multipartBody = builder.build();
|
|
|
+ if (mProgressPopup == null) {
|
|
|
+ mProgressPopup = new ProgressPopup(mActivity);
|
|
|
+ mProgressPopup.setTitle("附件上传中...");
|
|
|
+ }
|
|
|
+ mProgressPopup.setProgress(0);
|
|
|
+ mProgressPopup.showPopupWindow();
|
|
|
+
|
|
|
+ UploadUtils.getInstance().postFile(GloableParams.ADDRESS_MOBILE_UPLOADATTACHS, multipartBody, new ProgressListener() {
|
|
|
+ @Override
|
|
|
+ public void onProgress(long currentBytes, long contentLength, boolean isDone) {
|
|
|
+ int progress = (int) ((double) currentBytes * 100 / (double) contentLength);
|
|
|
+ mProgressPopup.setProgress(progress);
|
|
|
+ if (isDone || progress == 100) {
|
|
|
+ mProgressPopup.dismiss();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new Callback() {
|
|
|
+ @Override
|
|
|
+ public void onFailure(Call call, IOException e) {
|
|
|
+ mProgressPopup.dismiss();
|
|
|
+ Log.d("raomeng_uploadf", e.getMessage());
|
|
|
+ mActivity.runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ //CommonUtil.toastNoRepeat(mActivity, "附件上传失败");
|
|
|
+ tv_updater_info.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_updater_info.setText("附件上传失败");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Call call, Response response) throws IOException {
|
|
|
+ mProgressPopup.dismiss();
|
|
|
+ if (response.code() == 200) {
|
|
|
+ try {
|
|
|
+ String result = response.body().string();
|
|
|
+ JSONObject resultObject = JSON.parseObject(result);
|
|
|
+ String mEnclusureId = FastjsonUtil.getText(resultObject, "id");
|
|
|
+ String s = removeSpace(mEnclusureId);
|
|
|
+ String s1 = removeSpace2(s);
|
|
|
+ Log.d("aaa", "切割后的数据: " + s1 + "");
|
|
|
+ if (fujian == 1) {
|
|
|
+// templist.add(new AnnexBean(false, mFile.getAbsolutePath(), s1 + ";", true));
|
|
|
+ for (int i = 0; i < fujianList1.size(); i++) {
|
|
|
+ MyLog.e("aaa","是否为+号" + fujianList1.get(i).isAddImage() + "当前的id是:" + fujianList1.get(i).getImageID());
|
|
|
+ }
|
|
|
+ fujianList1.add(new AnnexBean(false, mFile.getAbsolutePath(), s1 + ";", true));
|
|
|
+
|
|
|
+ } else if (fujian == 2) {
|
|
|
+// templist.add(new AnnexBean(false, mFile.getAbsolutePath(), s1 + ";", true));
|
|
|
+ fujianList2.add(new AnnexBean(false, mFile.getAbsolutePath(), s1 + ";", true));
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ mActivity.runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ uploadRecords++;
|
|
|
+ if (uploadRecords == uploadRecordsNumber) {
|
|
|
+ tv_updater_info.setTextColor(getResources().getColor(R.color.blue));
|
|
|
+ tv_updater_info.setText("附件上传成功");
|
|
|
+ // CommonUtil.toastNoRepeat(mActivity, "附件上传成功");
|
|
|
+ if (fujian == 1) {
|
|
|
+ // Collections.reverse(fujianList1);
|
|
|
+// annexQCFuJianAdapter.addList(templist);
|
|
|
+// fujianList1.addAll(templist);
|
|
|
+ annexQCFuJianAdapter.setListNotTitle(fujianList1);
|
|
|
+ for (int i = 0; i < fujianList1.size(); i++) {
|
|
|
+ MyLog.e("aaa","2222是否为+号" + fujianList1.get(i).isAddImage() + "当前的id是:" + fujianList1.get(i).getImageID());
|
|
|
+ }
|
|
|
+ } else if (fujian == 2) {
|
|
|
+ // Collections.reverse(fujianList2);
|
|
|
+// annexShiYanFuJianAdapter.addList(templist);
|
|
|
+// fujianList2.addAll(templist);
|
|
|
+ annexShiYanFuJianAdapter.setListNotTitle(fujianList2);
|
|
|
+ }
|
|
|
+ cet_beizhu1.setEnabled(true);
|
|
|
+ cet_beizhu2.setEnabled(true);
|
|
|
+ bt_gengxin.setEnabled(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, new File[]{mFile});
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (mProgressPopup != null) {
|
|
|
+ mProgressPopup.dismiss();
|
|
|
+ }
|
|
|
+ tv_updater_info.setTextColor(getResources().getColor(R.color.red));
|
|
|
+ tv_updater_info.setText("附件上传失败");
|
|
|
+ //CommonUtil.toastNoRepeat(mActivity, "附件上传失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public String removeSpace(String s) {
|
|
|
+ String regex = "\\[";
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ Matcher matcher = pattern.matcher(s);
|
|
|
+ return matcher.replaceAll("");
|
|
|
+ }
|
|
|
+
|
|
|
+ public String removeSpace2(String s) {
|
|
|
+ String regex = "]";
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ Matcher matcher = pattern.matcher(s);
|
|
|
+ return matcher.replaceAll("");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
+ // if (!hidden) {
|
|
|
+ // setTitle("质量管理");
|
|
|
+ // }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|