|
@@ -35,6 +35,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.elvishew.xlog.XLog;
|
|
|
import com.fxy.R;
|
|
|
+import com.fxy.base.fragment.ShowImgFragment;
|
|
|
import com.fxy.baselibrary.base.BaseActivity;
|
|
|
import com.fxy.baselibrary.bean.BaseEventBusBean;
|
|
|
import com.fxy.baselibrary.interfaces.OnRxScanerListener;
|
|
@@ -45,6 +46,7 @@ import com.fxy.baselibrary.views.MarqueeTextView;
|
|
|
import com.fxy.bean.ActionBean;
|
|
|
import com.fxy.bean.ScanBean;
|
|
|
import com.fxy.common.CommonDialog;
|
|
|
+import com.fxy.common.PictureSelectorUpload;
|
|
|
import com.fxy.constant.BaseConfig;
|
|
|
import com.fxy.constant.EventCode;
|
|
|
import com.fxy.constant.SPCache;
|
|
@@ -56,6 +58,7 @@ import com.fxy.net.Urls;
|
|
|
import com.fxy.view.FloatingImageView;
|
|
|
import com.fxy.view.PopupWindowManager;
|
|
|
import com.google.zxing.Result;
|
|
|
+import com.luck.picture.lib.config.PictureConfig;
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
@@ -139,6 +142,16 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
@BindView(R.id.iv_drag)
|
|
|
FloatingImageView iv_drag;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @BindView(R.id.rv_show_img)
|
|
|
+ RecyclerView rvShowImg;
|
|
|
+
|
|
|
+
|
|
|
+ @BindView(R.id.ll_pictures_box)
|
|
|
+ LinearLayout llPicturesBox;
|
|
|
+
|
|
|
+
|
|
|
private View notDataView; //没有数据显示页
|
|
|
private View errorView; //错误显示页
|
|
|
private View emptyView; //空显示页
|
|
@@ -158,6 +171,13 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
|
|
|
private CommonDialog commonDialog;
|
|
|
|
|
|
+ //图片列表
|
|
|
+ private ArrayList photoList =new ArrayList<>();
|
|
|
+
|
|
|
+ private PictureSelectorUpload pictureSelectorUpload;
|
|
|
+
|
|
|
+ private ShowImgFragment showImgFragment;
|
|
|
+
|
|
|
//是否需要显示客户
|
|
|
private boolean needCustomer;
|
|
|
private boolean needCtn;
|
|
@@ -209,6 +229,12 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
{
|
|
|
}else if (resultCode==0){
|
|
|
}
|
|
|
+
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ if (requestCode == PictureConfig.CHOOSE_REQUEST) {// 图片选择结果回调
|
|
|
+ pictureSelectorUpload.getSelectImg(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -250,6 +276,26 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ initUpload();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void initUpload(){
|
|
|
+ pictureSelectorUpload = new PictureSelectorUpload(TallyMainActivity.this,rvShowImg,"tally",1);
|
|
|
+ pictureSelectorUpload.setOnChangeListener(new PictureSelectorUpload.UploadChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void uploadResult(boolean State) {
|
|
|
+ if (State) {
|
|
|
+ System.out.println("文件上传回调成功");
|
|
|
+ doPutIn();
|
|
|
+ } else {
|
|
|
+ System.out.println("文件上传失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|
|
@@ -607,7 +653,7 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void doPutIn() {
|
|
|
+ public void doPutIn() {
|
|
|
//校验数据
|
|
|
if (!validate()){
|
|
|
return;
|
|
@@ -621,7 +667,8 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
param.put("tracking_number",tracking_number);
|
|
|
|
|
|
if (needCustomer){
|
|
|
- param.put("customer_code",customerCode);
|
|
|
+ //param.put("customer_code",customerCode);
|
|
|
+ param.put("label_img",photoList.get(0));
|
|
|
}
|
|
|
if (isChange>0){
|
|
|
param.put("is_change",isChange);
|
|
@@ -654,18 +701,36 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
setPageViewData(result);
|
|
|
if(bean.code == 1){
|
|
|
showSuccessToast(bean.msg);
|
|
|
+ llPicturesBox.setVisibility(View.GONE);
|
|
|
clearData(false);
|
|
|
}else{
|
|
|
|
|
|
if (result.has("tag") && result.getString("tag").equals("need_customer")){
|
|
|
|
|
|
- commonDialog.setTitle("客户编号","请输入客户编号")
|
|
|
- .setTypeCode("need_customer")
|
|
|
- .setContent("")
|
|
|
- .show();
|
|
|
- llCustomerCode.setVisibility(View.VISIBLE);
|
|
|
- needCustomer = true;
|
|
|
+// commonDialog.setTitle("客户编号","请输入客户编号")
|
|
|
+// .setTypeCode("need_customer")
|
|
|
+// .setContent("")
|
|
|
+// .show();
|
|
|
+// llCustomerCode.setVisibility(View.VISIBLE);
|
|
|
+ new AlertDialog.Builder(mContext)
|
|
|
+ .setTitle(R.string.dl_hint)
|
|
|
+ .setMessage(bean.msg)
|
|
|
+ .setNegativeButton(R.string.str_submit, new DialogInterface.OnClickListener() {
|
|
|
+ @RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ needCustomer = true;
|
|
|
+ llPicturesBox.setVisibility(View.VISIBLE);
|
|
|
+ pictureSelectorUpload.authCamera();
|
|
|
|
|
|
+ }
|
|
|
+ }).setPositiveButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ //取消不做操作
|
|
|
+
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
|
|
|
|
|
|
}else if (result.has("is_change") && result.getInt("is_change")==1){
|
|
@@ -728,12 +793,18 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
return false;
|
|
|
}
|
|
|
if (needCustomer){
|
|
|
- if (customerCode.isEmpty()){
|
|
|
- commonDialog.setTitle("客户编号","请输入客户编号")
|
|
|
- .setTypeCode("need_customer")
|
|
|
- .setContent("")
|
|
|
- .show();
|
|
|
- showWarningToast("请输入客户编号");
|
|
|
+// if (customerCode.isEmpty()){
|
|
|
+// commonDialog.setTitle("客户编号","请输入客户编号")
|
|
|
+// .setTypeCode("need_customer")
|
|
|
+// .setContent("")
|
|
|
+// .show();
|
|
|
+// showWarningToast("请输入客户编号");
|
|
|
+// return false;
|
|
|
+// }
|
|
|
+
|
|
|
+ photoList = pictureSelectorUpload.getPhotoList();
|
|
|
+ if (photoList.size()==0){
|
|
|
+ showWarningToast("请拍照");
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -856,9 +927,10 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
}
|
|
|
setEditTextNormal(etContainerCode,true);
|
|
|
setEditTextNormal(etOrderNo,true);
|
|
|
+ pictureSelectorUpload.emptyRemake();//清空图片
|
|
|
}
|
|
|
|
|
|
- @OnClick({R.id.btn_confirm,R.id.btn_change_confirm,R.id.tv_edit_customer,R.id.tv_edit_cnt})
|
|
|
+ @OnClick({R.id.btn_confirm,R.id.btn_change_confirm,R.id.tv_edit_customer,R.id.tv_edit_cnt,R.id.add_tally})
|
|
|
public void onViewClicked(View view) {
|
|
|
Bundle bundle = new Bundle();
|
|
|
switch (view.getId()) {
|
|
@@ -902,6 +974,12 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
.setContent(mtCnt.getText().toString())
|
|
|
.show();
|
|
|
break;
|
|
|
+ case R.id.add_tally:
|
|
|
+ doPutIn();
|
|
|
+ break;
|
|
|
+// case R.id.tv_clear_pictures:
|
|
|
+// pictureSelectorUpload.emptyRemake();
|
|
|
+// break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
@@ -1006,7 +1084,7 @@ public class TallyMainActivity extends BaseActivity implements StoJNI.ScanCallB
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
unbinder.unbind();
|
|
|
-
|
|
|
+ pictureSelectorUpload.removeHandler();
|
|
|
|
|
|
super.onDestroy();
|
|
|
}
|