|
@@ -34,15 +34,20 @@ import com.fxy.baselibrary.util.JsonUtil;
|
|
|
import com.fxy.baselibrary.views.MarqueeTextView;
|
|
|
import com.fxy.bean.ActionBean;
|
|
|
import com.fxy.bean.ScanBean;
|
|
|
+import com.fxy.common.AsyncPictureSelector;
|
|
|
+import com.fxy.common.AsyncPictureUpload;
|
|
|
import com.fxy.common.CommonDialog;
|
|
|
import com.fxy.constant.BaseConfig;
|
|
|
import com.fxy.constant.EventCode;
|
|
|
+import com.fxy.detection.bean.TakePictureBean;
|
|
|
import com.fxy.detection.bean.TrackingBoxBean;
|
|
|
+import com.fxy.detection.bean.TrayMakeBean;
|
|
|
import com.fxy.net.MyDialogCallback;
|
|
|
import com.fxy.net.Urls;
|
|
|
import com.fxy.utils.UploadUtils;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.zxing.Result;
|
|
|
+import com.luck.picture.lib.config.PictureConfig;
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
@@ -87,11 +92,17 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
@BindView(R.id.mt_customer_code)
|
|
|
MarqueeTextView mtCustomerCode;
|
|
|
|
|
|
+ @BindView(R.id.ll_label_picture)
|
|
|
+ LinearLayout llLabelPicture;
|
|
|
+
|
|
|
+ @BindView(R.id.ll_order_number)
|
|
|
+ LinearLayout llOrderNumber;
|
|
|
|
|
|
private HashMap<String, Object> postData = new HashMap<>();
|
|
|
|
|
|
private TrackingBoxBean trackingBoxBean;
|
|
|
|
|
|
+ private TrackingBoxBean customerTrackingBoxBean;
|
|
|
//
|
|
|
//扫码扫码动作
|
|
|
private ScanBean scanBean;
|
|
@@ -105,6 +116,14 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
protected String action;
|
|
|
|
|
|
|
|
|
+ private HashMap<String, AsyncPictureSelector> mapPictureSelector = new HashMap<>();
|
|
|
+
|
|
|
+ private List<TakePictureBean> takePictureBeanList = new ArrayList<>();
|
|
|
+ private AsyncPictureUpload asyncPictureUpload = new AsyncPictureUpload(this);
|
|
|
+
|
|
|
+
|
|
|
+ private String currentPictureType= "label_img";
|
|
|
+
|
|
|
private Unbinder unbinder;
|
|
|
|
|
|
|
|
@@ -148,7 +167,21 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
@Override
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ if (resultCode == RESULT_OK) {
|
|
|
+ // 图片选择结果回调
|
|
|
+ if (requestCode == PictureConfig.CHOOSE_REQUEST) {
|
|
|
+ if (mapPictureSelector.containsKey(currentPictureType)){
|
|
|
+ mapPictureSelector.get(currentPictureType).getSelectImg(data);
|
|
|
+ }
|
|
|
+ totalAwaitNum();
|
|
|
+
|
|
|
+ if (mapPictureSelector.get("label_img").getOssPhotoList().size()>0){
|
|
|
+ //页面跳转
|
|
|
+ submitLabelImg();
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
if (requestCode == 200 && resultCode == 200)//之前提到的两个标志,在这里显示出了作用
|
|
|
{
|
|
|
initFinish();
|
|
@@ -191,12 +224,32 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
|
|
|
initEdit();
|
|
|
iniData();
|
|
|
+ RecyclerView rvLabelShowImg = (RecyclerView)llLabelPicture.findViewById(R.id.rv_show_img);
|
|
|
+ mapPictureSelector.put("label_img",setItemPicture("label_img",rvLabelShowImg,1));
|
|
|
+
|
|
|
initDialog();
|
|
|
totalAwaitNum();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 设置多个上传文件
|
|
|
+ * @param uploadType String
|
|
|
+ * @param showImg RecyclerView
|
|
|
+ */
|
|
|
+ private AsyncPictureSelector setItemPicture(String uploadType,RecyclerView showImg,int num){
|
|
|
+
|
|
|
+ String notifyUrl = Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN;
|
|
|
+ AsyncPictureSelector pictureUpload = new AsyncPictureSelector(BoxPutInMainActivity.this,showImg,"detection",uploadType,notifyUrl,false);
|
|
|
+ pictureUpload.setUploadType(uploadType);
|
|
|
+ pictureUpload.setCompress(true,100,100);
|
|
|
+ pictureUpload.setOnlyCamera(true);
|
|
|
+ pictureUpload.setMaxSelectNum(num);
|
|
|
+
|
|
|
+ return pictureUpload;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
private void initDialog(){
|
|
@@ -212,14 +265,15 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
if (commonDialog.getTypeCode().equals("need_customer")){
|
|
|
customerCode = string;
|
|
|
}
|
|
|
- dialog.dismiss();
|
|
|
mtCustomerCode.setText(customerCode);
|
|
|
+ getCustomer();
|
|
|
|
|
|
- if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
- etOrderNumber.requestFocus();
|
|
|
- }else{
|
|
|
- getBoxNumber();
|
|
|
- }
|
|
|
+
|
|
|
+// if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
+// etOrderNumber.requestFocus();
|
|
|
+// }else{
|
|
|
+// getBoxNumber();
|
|
|
+// }
|
|
|
|
|
|
}
|
|
|
});
|
|
@@ -564,11 +618,15 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
}
|
|
|
|
|
|
needCustomer = trackingBoxBean.getNeedCustomer().equals("Y");
|
|
|
- if (needCustomer){
|
|
|
- commonDialog.setTitle("客户编号","请输入客户编号").setContent("").show();
|
|
|
+ if (needCustomer && !commonDialog.isShowing()){
|
|
|
+ commonDialog.setTitle("客户编号","请输入客户编号").setContent(customerCode).show();
|
|
|
+ }else{
|
|
|
+ commonDialog.dismiss();
|
|
|
}
|
|
|
llExtendInfo.setVisibility(needCustomer ? View.VISIBLE:View.GONE);
|
|
|
|
|
|
+ llOrderNumber.setVisibility(trackingBoxBean.getBusinessType().equals("1")?View.GONE:View.VISIBLE);
|
|
|
+
|
|
|
if(bean.code == 1){
|
|
|
showSuccessToast(bean.msg,voiceName);
|
|
|
etOrderNumber.setEnabled(true);
|
|
@@ -588,6 +646,93 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //获取跟踪单号
|
|
|
+ private void getCustomer(){
|
|
|
+
|
|
|
+ checkIsUpload();
|
|
|
+ if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
+ showErrorToast(etTrackingNumber.getHint().toString());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> math = new HashMap<>();
|
|
|
+ math.put("tracking_number",etTrackingNumber.getText().toString().trim());
|
|
|
+ math.put("customer_code",customerCode);
|
|
|
+ math.put("is_customer_code",1);
|
|
|
+
|
|
|
+ String mathJson = (new Gson()).toJson(math);
|
|
|
+ customerTrackingBoxBean = null;
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN_TRACK).upJson(mathJson)
|
|
|
+ .execute(new MyDialogCallback(this, true, true) {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(Response<String> response) {
|
|
|
+ super.onSuccess(response);
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
+ customerTrackingBoxBean = new TrackingBoxBean();
|
|
|
+ if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
+ customerTrackingBoxBean = JsonUtil.jsonString2Bean(bean.data,TrackingBoxBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String voiceName = customerTrackingBoxBean.getVoiceName();
|
|
|
+ final Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("data",(new Gson()).toJson(trackingBoxBean));
|
|
|
+ bundle.putString("customer_code",customerCode);
|
|
|
+
|
|
|
+ if (customerTrackingBoxBean.getNeedConfirm().equals("Y")){
|
|
|
+ new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
|
|
|
+ .setMessage(customerTrackingBoxBean.getConfirmMsg())
|
|
|
+ .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ }
|
|
|
+ }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+
|
|
|
+// etOrderNumber.setEnabled(true);
|
|
|
+// etOrderNumber.requestFocus();
|
|
|
+ intent2Page(BoxPutInMainActivity.this, BoxPutInDetailsMainActivity.class, false,bundle);
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ llOrderNumber.setVisibility(customerTrackingBoxBean.getBusinessType().equals("1")?View.GONE:View.VISIBLE);
|
|
|
+
|
|
|
+
|
|
|
+ if(bean.code == 1){
|
|
|
+ commonDialog.dismiss();
|
|
|
+ showSuccessToast(bean.msg,voiceName);
|
|
|
+ if (customerTrackingBoxBean.getBusinessType().equals("1")){
|
|
|
+ mapPictureSelector.get(currentPictureType).authCamera();
|
|
|
+ }else{
|
|
|
+ etOrderNumber.setEnabled(true);
|
|
|
+ etOrderNumber.requestFocus();
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
+ showWarningToast(bean.msg,voiceName);
|
|
|
+ commonDialog.authSoftKeyboard();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ XLog.e("确认错误",e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//获取跟踪单号
|
|
|
private void getBoxNumber(){
|
|
|
|
|
@@ -617,6 +762,7 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
|
|
|
String mathJson = (new Gson()).toJson(math);
|
|
|
trackingBoxBean = null;
|
|
|
+ customerTrackingBoxBean = null;
|
|
|
OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN_TRACK).upJson(mathJson)
|
|
|
.execute(new MyDialogCallback(this, true, true) {
|
|
|
@Override
|
|
@@ -631,9 +777,7 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
}
|
|
|
|
|
|
String voiceName = trackingBoxBean.getVoiceName();
|
|
|
- final Bundle bundle = new Bundle();
|
|
|
- bundle.putString("data",bean.data);
|
|
|
- bundle.putString("customer_code",customerCode);
|
|
|
+
|
|
|
|
|
|
if (trackingBoxBean.getNeedConfirm().equals("Y")){
|
|
|
new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
|
|
@@ -648,16 +792,24 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
|
|
-// etOrderNumber.setEnabled(true);
|
|
|
-// etOrderNumber.requestFocus();
|
|
|
- intentPageResult(BoxPutInMainActivity.this, BoxPutInDetailsMainActivity.class, bundle,200);
|
|
|
+ if (mapPictureSelector.get(currentPictureType).getOssPhotoList().size()>0){
|
|
|
+ submitLabelImg();
|
|
|
+ }else{
|
|
|
+ mapPictureSelector.get(currentPictureType).authCamera();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}).show();
|
|
|
}else{
|
|
|
|
|
|
if(bean.code == 1){
|
|
|
showSuccessToast(bean.msg,voiceName);
|
|
|
- intentPageResult(BoxPutInMainActivity.this, BoxPutInDetailsMainActivity.class, bundle,200);
|
|
|
+
|
|
|
+ if (mapPictureSelector.get(currentPictureType).getOssPhotoList().size()>0){
|
|
|
+ submitLabelImg();
|
|
|
+ }else{
|
|
|
+ mapPictureSelector.get(currentPictureType).authCamera();
|
|
|
+ }
|
|
|
}else{
|
|
|
showWarningToast(bean.msg,voiceName);
|
|
|
}
|
|
@@ -673,6 +825,92 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //提交面单信息
|
|
|
+ private void submitLabelImg(){
|
|
|
+ checkIsUpload();
|
|
|
+ if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
+ showErrorToast(etTrackingNumber.getHint().toString());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (customerTrackingBoxBean != null){
|
|
|
+ if (!customerTrackingBoxBean.getBusinessType().equals("1") && etOrderNumber.getText().toString().isEmpty()){
|
|
|
+ showErrorToast(etOrderNumber.getHint().toString());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
+ showErrorToast(etOrderNumber.getHint().toString());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Map<String,Object> math = new HashMap<>();
|
|
|
+ math.put("tracking_number",trackingBoxBean.getTrackingNumber().trim());
|
|
|
+
|
|
|
+
|
|
|
+ math.put("box_number",etOrderNumber.getText().toString().trim());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (needCustomer){
|
|
|
+
|
|
|
+ if (customerCode.isEmpty()){
|
|
|
+ showErrorToast("请输入客户代码");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ math.put("is_customer_code","1");
|
|
|
+ math.put("customer_code",customerCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ //面单
|
|
|
+ List<String> stringList = mapPictureSelector.get("label_img").getOssPhotoList();
|
|
|
+ if (stringList.size()==0){
|
|
|
+ showWarningToast("面单照片不能为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ math.put("label_img_tag",mapPictureSelector.get("label_img").getUniqueTag());
|
|
|
+ math.put("label_img",gson.toJson(stringList));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(gson.toJson(math))
|
|
|
+ .execute(new MyDialogCallback(this, true, false) {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(Response<String> response) {
|
|
|
+ super.onSuccess(response);
|
|
|
+ try {
|
|
|
+
|
|
|
+ ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
+ if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
+ trackingBoxBean = JsonUtil.jsonString2Bean(bean.data,TrackingBoxBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ String voiceName = trackingBoxBean.getVoiceName();
|
|
|
+ if(bean.code == 1){
|
|
|
+ showSuccessToast(bean.msg,voiceName);
|
|
|
+ Bundle bundle = new Bundle();
|
|
|
+ bundle.putString("data",bean.data);
|
|
|
+ bundle.putString("customer_code",customerCode);
|
|
|
+ intentPageResult(BoxPutInMainActivity.this, BoxPutInDetailsMainActivity.class, bundle,200);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ showWarningToast(bean.msg,voiceName);
|
|
|
+ }
|
|
|
+
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ XLog.e("错误",e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private void initFinish(){
|
|
|
llExtendInfo.setVisibility(View.GONE);
|
|
@@ -687,6 +925,12 @@ public class BoxPutInMainActivity extends BaseActivity implements StoJNI.ScanCa
|
|
|
|
|
|
etTrackingNumber.requestFocus();
|
|
|
|
|
|
+ for (int i=0;i<baseImgList.size();i++){
|
|
|
+ if (mapPictureSelector.containsKey(baseImgList.get(i))){
|
|
|
+ mapPictureSelector.get(baseImgList.get(i)).emptyRemake();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|