Compare commits
11 Commits
master
...
manyflavor
Author | SHA1 | Date | |
---|---|---|---|
9620f13b42 | |||
ea649da8dd | |||
edf3f494da | |||
2bdf0d45dc | |||
725860544a | |||
befc5419a2 | |||
f0778a34e3 | |||
fbe1492800 | |||
b5fb6bec07 | |||
80c67f9c79 | |||
932a33f3d1 |
@ -126,6 +126,22 @@ android {
|
||||
resValue "string", "appName", "大河好运司机"
|
||||
}
|
||||
|
||||
productbc {
|
||||
applicationId "com.arpa.hndahesudintocctmsdriver.bc"
|
||||
manifestPlaceholders = [CHANNEL_VALUE: "司机运营",
|
||||
app_icon : "@drawable/diver_logo_yunying",
|
||||
GAODEKEY : "f960bc6d14788238918bd014fa08a870",
|
||||
JPUSH_PKGNAME: applicationId,
|
||||
JPUSH_APPKEY : "571d93ae5117da6dee848c92", //JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_CHANNEL: "developer-default"//暂时填写默认值即可.
|
||||
]
|
||||
buildConfigField("String", "OPEN_AL_URL", "\"https://oapi.alct56.com\"")
|
||||
buildConfigField("String", "BASE_URL", "\"http://app.dahehuoyun.com/api/\"")
|
||||
buildConfigField "boolean", "isTest", "false"
|
||||
//APP名称,可以在androidMainfest中引用
|
||||
resValue "string", "appName", "司机运营"
|
||||
}
|
||||
|
||||
}
|
||||
// productFlavors.all { flavor ->
|
||||
// flavor.manifestPlaceholders = [CHANNEL_VALUE: name]
|
||||
|
@ -97,8 +97,9 @@
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.auth.VehicleAuthActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity"
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivityBC"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<intent-filter>
|
||||
@ -109,10 +110,8 @@
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivityBC"
|
||||
</activity> <activity
|
||||
android:name="com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity"
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
<intent-filter>
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.request;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LUInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.TrackInputBean;
|
||||
@ -8,7 +9,6 @@ import com.arpa.hndahesudintocctmsdriver.ui.home.HuoYuanFragmengt;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.HuoYunDelActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.StartYunDanActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.OrderComplaintActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.map.MapUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
@ -137,18 +137,18 @@ public class UserRequset {
|
||||
|
||||
//app更新
|
||||
public void upApp() {
|
||||
String vs = "1.0.0";
|
||||
try {
|
||||
// isOpenAppNoRe();
|
||||
vs = con.getPackageManager().getPackageInfo(con.getPackageName(), 0).versionName;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("source", 0);
|
||||
map.put("version", vs);
|
||||
Request re = OkHttpUtil.post(new OkDate(RequestConstant.getVERSION(), MapUtil.mapJson(map)), con);
|
||||
RequestUtil.start(1, "up_app", re, con, hd);
|
||||
// String vs = "1.0.0";
|
||||
// try {
|
||||
//// isOpenAppNoRe();
|
||||
// vs = con.getPackageManager().getPackageInfo(con.getPackageName(), 0).versionName;
|
||||
// } catch (PackageManager.NameNotFoundException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("source", 0);
|
||||
// map.put("version", vs);
|
||||
// Request re = OkHttpUtil.post(new OkDate(RequestConstant.getVERSION(), MapUtil.mapJson(map)), con);
|
||||
// RequestUtil.start(1, "up_app", re, con, hd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
|
||||
import com.alct.mdp.MDPLocationCollectionManager;
|
||||
import com.alct.mdp.callback.OnDownloadResultListener;
|
||||
@ -35,6 +36,7 @@ import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.MyLocationStyle;
|
||||
import com.arpa.hndahesudintocctmsdriver.App;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.DriverExpireBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.ImageConfig;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.JTT;
|
||||
@ -84,7 +86,13 @@ import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.time.Timer;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.lxj.xpopup.util.XPermission;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
import com.permissionx.guolindev.callback.RequestCallback;
|
||||
import com.permissionx.guolindev.dialog.RationaleDialog;
|
||||
import com.permissionx.guolindev.request.ChainTask;
|
||||
import com.permissionx.guolindev.request.ExplainScope;
|
||||
import com.permissionx.guolindev.request.ForwardScope;
|
||||
import com.youth.banner.Banner;
|
||||
import com.youth.banner.BannerConfig;
|
||||
import com.youth.banner.Transformer;
|
||||
@ -96,6 +104,9 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
import pub.devrel.easypermissions.helper.PermissionHelper;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
|
@ -31,7 +31,6 @@ import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
|
||||
import com.amap.api.services.core.AMapException;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.route.BusRouteResult;
|
||||
import com.amap.api.services.route.DrivePath;
|
||||
@ -40,7 +39,7 @@ import com.amap.api.services.route.DriveStep;
|
||||
import com.amap.api.services.route.RideRouteResult;
|
||||
import com.amap.api.services.route.RouteSearch;
|
||||
import com.amap.api.services.route.WalkRouteResult;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.TimeUtil;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
@ -55,7 +54,6 @@ import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.UiAuxiliary;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.GetShangChuanActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.OrderComplaintActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.WebPDFActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.location.LocationGDUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
@ -71,7 +69,6 @@ import com.arpa.hndahesudintocctmsdriver.util.view.ScoreView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class StartYunDanActivity extends BaseActivity {
|
||||
|
@ -513,6 +513,11 @@ public class ShangChuangImgActivityBC extends BaseAppCompatActivity implements I
|
||||
// for(int i=0;i<imgIds.size();i++){
|
||||
// Log.e("--imgIds--",imgIds.get(i)+"");
|
||||
// }
|
||||
if(TextUtils.isEmpty(tempLoca.getTime())||TextUtils.isEmpty(tempLoca.getAddress())){
|
||||
ToastUtils.showToast(this,"请选择时间以及地点");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
case 0:
|
||||
//装货
|
||||
@ -566,9 +571,9 @@ public class ShangChuangImgActivityBC extends BaseAppCompatActivity implements I
|
||||
case 2:
|
||||
if (imgIds != null && imgIds.size() > 0) {//卸货回单
|
||||
//上传回单
|
||||
urib.setLatitude(lgdu.getLatitude() + "");
|
||||
urib.setLongitude(lgdu.getLongitude() + "");
|
||||
urib.setLocationAddress(lgdu.getAddress());
|
||||
urib.setLatitude(tempLoca.getLatitude() + "");
|
||||
urib.setLongitude(tempLoca.getLongitude() + "");
|
||||
urib.setLocationAddress(tempLoca.getAddress());
|
||||
//装卸货类型
|
||||
urib.setType(h_type + 1);
|
||||
//回单id 数组
|
||||
|
@ -31,23 +31,23 @@ public class GetCarImageAlert {
|
||||
PopupWindow popupWindow;
|
||||
ImageView img;
|
||||
|
||||
public void showPopueWindow(AppCompatActivity act,boolean key){
|
||||
View popView = View.inflate(act, R.layout.choice_car_timg,null);
|
||||
Button btn_xiangce =popView.findViewById(R.id.btn_xiangce);
|
||||
public void showPopueWindow(AppCompatActivity act, boolean key) {
|
||||
View popView = View.inflate(act, R.layout.choice_car_timg, null);
|
||||
Button btn_xiangce = popView.findViewById(R.id.btn_xiangce);
|
||||
Button btn_paizhao = popView.findViewById(R.id.btn_paizhao);
|
||||
Button btn_quxiao = popView.findViewById(R.id.btn_quxiao);
|
||||
View v_1=popView.findViewById(R.id.v_1);
|
||||
TextView tv_ts=popView.findViewById(R.id.tv_ts);
|
||||
img=popView.findViewById(R.id.img);
|
||||
Button btn_quxiao = popView.findViewById(R.id.btn_quxiao);
|
||||
View v_1 = popView.findViewById(R.id.v_1);
|
||||
TextView tv_ts = popView.findViewById(R.id.tv_ts);
|
||||
img = popView.findViewById(R.id.img);
|
||||
//获取屏幕宽高
|
||||
int weight =act.getResources().getDisplayMetrics().widthPixels;
|
||||
int height = act.getResources().getDisplayMetrics().heightPixels*2/3;
|
||||
popupWindow = new PopupWindow(popView,weight,height);
|
||||
int weight = act.getResources().getDisplayMetrics().widthPixels;
|
||||
int height = act.getResources().getDisplayMetrics().heightPixels * 2 / 3;
|
||||
popupWindow = new PopupWindow(popView, weight, height);
|
||||
//popupWindow.setAnimationStyle(R.style.anim_popup_dir);
|
||||
popupWindow.setFocusable(true);
|
||||
//点击外部popueWindow消失
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
if(key){
|
||||
if (key) {
|
||||
btn_xiangce.setVisibility(View.VISIBLE);
|
||||
img.setImageResource(R.drawable.huidan);
|
||||
tv_ts.setText("请按照如图所示拍摄回单照片,回单照片必须保持清晰完整,能看清具体吨数,便于结算运费时核查,感谢配合。");
|
||||
@ -55,31 +55,41 @@ public class GetCarImageAlert {
|
||||
//请按照如图所示拍摄回单照片,回单照片必须保持清晰完整,能看清具体吨数,便于结算运费时核查,感谢配合。
|
||||
}
|
||||
btn_xiangce.setOnClickListener(v -> {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
PicturlUtil.selectPicter(act, new ArrayList<>(), 1);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
try {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
PicturlUtil.selectPicter(act, new ArrayList<>(), 1);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(act.getBaseContext(), "程序出现问题了,请重新登录后重试!!!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
});
|
||||
btn_paizhao.setOnClickListener(v -> {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
openCam(act);
|
||||
try{
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
openCam(act);
|
||||
// file=ImageGetUtil.createImageFile(act);
|
||||
// ImageGetUtil.cameraAlbumGetImage(act,file);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
}catch (Exception e){
|
||||
Toast.makeText(act.getBaseContext(), "程序出现问题了,请重新登录后重试!!!", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
});
|
||||
img.setOnClickListener(v -> {
|
||||
if (!key){
|
||||
if (!key) {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
@ -102,22 +112,22 @@ public class GetCarImageAlert {
|
||||
WindowManager.LayoutParams lp = act.getWindow().getAttributes();
|
||||
lp.alpha = 0.5f;
|
||||
act.getWindow().setAttributes(lp);
|
||||
popupWindow.showAtLocation(popView, Gravity.BOTTOM,0,50);
|
||||
popupWindow.showAtLocation(popView, Gravity.BOTTOM, 0, 50);
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void dis(){
|
||||
public void dis() {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
|
||||
private void openCam(AppCompatActivity act){
|
||||
file=ImageGetUtil.createImageFile(act);
|
||||
if (file!=null){
|
||||
ImageGetUtil.cameraAlbumGetImage(act,file);
|
||||
}else{
|
||||
private void openCam(AppCompatActivity act) {
|
||||
file = ImageGetUtil.createImageFile(act);
|
||||
if (file != null) {
|
||||
ImageGetUtil.cameraAlbumGetImage(act, file);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(), "路径创建失败,请清除缓存后重试", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import android.provider.MediaStore;
|
||||
|
||||
import androidx.core.content.FileProvider;
|
||||
|
||||
import com.sdk.base.framework.utils.app.AppUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -39,7 +41,7 @@ public class ImageGetUtil {
|
||||
if(imageFile!=null){
|
||||
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.N){
|
||||
/*7.0以上要通过FileProvider将File转化为Uri*/
|
||||
uri = FileProvider.getUriForFile(act.getApplicationContext(),"com.arpa.hndahesudintocctmsdriver.fileprovider",imageFile);
|
||||
uri = FileProvider.getUriForFile(act.getApplicationContext(), AppUtils.getPackageName()+".fileprovider",imageFile);
|
||||
}else {
|
||||
/*7.0以下则直接使用Uri的fromFile方法将File转化为Uri*/
|
||||
uri = Uri.fromFile(imageFile);
|
||||
|
BIN
app/src/main/res/drawable/diver_logo_yunying.png
Normal file
BIN
app/src/main/res/drawable/diver_logo_yunying.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 426 KiB |
@ -46,7 +46,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/btn_news"
|
||||
|
@ -0,0 +1,876 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alct.mdp.MDPLocationCollectionManager;
|
||||
import com.alct.mdp.callback.OnResultListener;
|
||||
import com.alct.mdp.model.Goods;
|
||||
import com.alct.mdp.model.Image;
|
||||
import com.alct.mdp.model.Location;
|
||||
import com.amap.api.services.core.AMapException;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.geocoder.GeocodeSearch;
|
||||
import com.amap.api.services.help.Inputtips;
|
||||
import com.amap.api.services.help.InputtipsQuery;
|
||||
import com.amap.api.services.help.Tip;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.OCRRequest;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.NfcUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.img.GetCarImageAlert;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.location.LocationUtil;
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.baidu.mapapi.utils.CoordinateConverter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.github.gzuliyujiang.wheelpicker.DatimePicker;
|
||||
import com.github.gzuliyujiang.wheelpicker.annotation.TimeMode;
|
||||
import com.github.gzuliyujiang.wheelpicker.entity.DatimeEntity;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.StartOrderBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UploadBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LUInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.UploadReceiptInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.location.LocationGDUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.CustomDialog;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.file.FileUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.file.ImageFileCompressUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.time.Timer;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.lxj.xpopup.interfaces.OnSelectListener;
|
||||
import com.lxj.xpopup.util.SmartGlideImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShangChuangImgActivity extends BaseAppCompatActivity implements Inputtips.InputtipsListener {
|
||||
|
||||
private TextView submit, name_top, name_body, address, tips, tips_x,tvDate,tvLocation;
|
||||
private RelativeLayout getImg;
|
||||
private EditText etAddress;
|
||||
private Button btnOk;
|
||||
private ImageView res_img, img_icon, img_delete;
|
||||
private String[] names = {"装货", "卸货", "回单"};
|
||||
public static String[] TYPE_NAME = {"zhuanghuo", "xiehuo", "huidan"};
|
||||
private int index = 0;
|
||||
//
|
||||
private Gson gson = new Gson();
|
||||
//
|
||||
private LUInputBean lub = new LUInputBean();
|
||||
private UploadReceiptInputBean urib = new UploadReceiptInputBean();
|
||||
private LocationGDUtil lgdu;
|
||||
public LocationUtil lu;
|
||||
private List<Integer> imgIds = new ArrayList<>();
|
||||
private UploadBean ub;
|
||||
private HuoYuanRequset hyr;
|
||||
//
|
||||
private GetCarImageAlert gia = new GetCarImageAlert();
|
||||
private CustomDialog customDialog;
|
||||
private int id = 0;
|
||||
private boolean key = true;
|
||||
private boolean keys = false;
|
||||
private boolean locationKey = false;
|
||||
private TextView tv_loaction;
|
||||
|
||||
|
||||
private String selDate;
|
||||
private GeocodeSearch geocoderSearch;
|
||||
|
||||
private TempLoca tempLoca = new TempLoca();
|
||||
private TempLoca tempLocaBd = new TempLoca();
|
||||
|
||||
|
||||
@Override
|
||||
public void onGetInputtips(List<Tip> tipList, int rCode) {
|
||||
if (rCode == AMapException.CODE_AMAP_SUCCESS) {
|
||||
List<String> names = new ArrayList<String>();
|
||||
if(tipList != null) {
|
||||
int size = tipList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
Tip tip = tipList.get(i);
|
||||
if(tip != null) {
|
||||
names.add(tip.getDistrict()+tip.getName());
|
||||
}
|
||||
}
|
||||
|
||||
new XPopup.Builder(this)
|
||||
.isDestroyOnDismiss(true) //对于只使用一次的弹窗,推荐设置这个
|
||||
.hasShadowBg(false) // 去掉半透明背景
|
||||
.atView(etAddress)
|
||||
.asAttachList(names.toArray(new String[0]), new int[]{}, new OnSelectListener() {
|
||||
@Override
|
||||
public void onSelect(int position, String text) {
|
||||
Tip tip = tipList.get(position);
|
||||
etAddress.setText(tip.getDistrict()+tip.getAddress()+tip.getName());
|
||||
LatLonPoint latLonPoint = tip.getPoint();
|
||||
tempLoca.setAddress(etAddress.getText().toString());
|
||||
tempLoca.setLatitude(latLonPoint.getLatitude());
|
||||
tempLoca.setLongitude(latLonPoint.getLongitude());
|
||||
tempLoca.setTime(tvDate.getText().toString());
|
||||
|
||||
LatLng latLng = convertGPSToBaidu(new LatLng(latLonPoint.getLatitude(), latLonPoint.getLongitude()));
|
||||
tempLocaBd.setLongitude(latLng.longitude);
|
||||
tempLocaBd.setLatitude(latLng.latitude);
|
||||
tempLocaBd.setAddress(etAddress.getText().toString());
|
||||
tempLocaBd.setTime(tvDate.getText().toString());
|
||||
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
|
||||
|
||||
// SimpleAdapter aAdapter = new SimpleAdapter(getApplicationContext(), listString, R.layout.item_layout,
|
||||
// new String[]{"name", "address"}, new int[]{R.id.poi_field_id, R.id.poi_value_id});
|
||||
//
|
||||
// minputlist.setAdapter(aAdapter);
|
||||
// aAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
class TempLoca{
|
||||
private double latitude;
|
||||
private double longitude;
|
||||
private String address;
|
||||
private String time;
|
||||
|
||||
public TempLoca() {
|
||||
|
||||
}
|
||||
|
||||
public TempLoca(double latitude, double longitude, String address, String time) {
|
||||
this.latitude = latitude;
|
||||
this.longitude = longitude;
|
||||
this.address = address;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
super.msgMethod(m);
|
||||
switch (m.what) {
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
Log.e("upload", CacheGroup.cacheList.get("upload"));
|
||||
ub = gson.fromJson(CacheGroup.cacheList.remove("upload"), UploadBean.class);
|
||||
if (ub.getCode() == 200) {
|
||||
imgIds.add(ub.getData().getId());
|
||||
Glide.with(con).load(ub.getData().getUrl()).into(res_img);
|
||||
res_img.setVisibility(View.VISIBLE);
|
||||
img_delete.setVisibility(View.VISIBLE);
|
||||
img_icon.setVisibility(View.GONE);
|
||||
key = false;
|
||||
} else {
|
||||
Toast.makeText(con, ub.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove("upload");
|
||||
}
|
||||
for (int i = 0; i < TYPE_NAME.length; i++) {
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[i]) != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[i]), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
if (index == 2) {
|
||||
if (!keys){//装货回单
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (CacheGroup.cacheList.get("carName") != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("carName"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
|
||||
}
|
||||
CacheGroup.cacheList.remove("carName");
|
||||
}
|
||||
|
||||
if (CacheGroup.cacheList.get("carNum") != null) {
|
||||
Log.e("upload", CacheGroup.cacheList.get("carNum"));
|
||||
CarInfoBean ub = gson.fromJson(CacheGroup.cacheList.remove("carNum"), CarInfoBean.class);
|
||||
if (ub.getCode() == 200 && ub.getData().getData().getPrism_keyValueInfo().size() > 0) {
|
||||
String value = ub.getData().getData().getPrism_keyValueInfo().get(0).getValue();
|
||||
String forceMatching = ub.getData().getForceMatching();
|
||||
if ("1".equals(forceMatching)) {//是否强校验车牌号 1:强校验
|
||||
if (sob.getData().getCarNumber().equals(value)) {
|
||||
hyr.uploadFile(new File(path));
|
||||
} else {
|
||||
new MessageUtils().showCenMessage(ShangChuangImgActivity.this, "车牌号不匹配!", "请重新拍照或联系管理员");
|
||||
}
|
||||
} else {
|
||||
hyr.uploadFile(new File(path));
|
||||
}
|
||||
} else {//识别失败后返回code500
|
||||
if (index == 0) {//装卸货车辆需要识别车牌号){
|
||||
Toast.makeText(con, "装货照片包含车牌号、三分之二车身或者装卸货场景。", Toast.LENGTH_SHORT).show();
|
||||
} else if (index == 1) {
|
||||
Toast.makeText(con, "卸货照片包含车牌号、三分之二车身或者装卸货场景。", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
CacheGroup.cacheList.remove("carNum");
|
||||
}
|
||||
break;
|
||||
case 14://定位成功
|
||||
locationKey = true;
|
||||
customDialog.dismiss();
|
||||
tv_loaction.setText("定位成功");
|
||||
tv_loaction.setTextColor(getResources().getColor(R.color.theme_color, null));
|
||||
latLng = convertGPSToBaidu(new LatLng(lgdu.getLatitude(), lgdu.getLongitude()));
|
||||
initLocation();
|
||||
break;
|
||||
case 16://定位失败
|
||||
locationKey = false;
|
||||
customDialog.dismiss();
|
||||
tv_loaction.setText("定位失败,点击重试");
|
||||
tv_loaction.setTextColor(getResources().getColor(R.color.loaction_no_color, null));
|
||||
Toast.makeText(con, "定位失败,请确认开启定位后重试!", Toast.LENGTH_LONG).show();
|
||||
//定位结果接收
|
||||
//finish();
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
|
||||
case ImageFileCompressUtil.COMPRESS_SUCCESS:
|
||||
path = (String) m.obj;
|
||||
Log.e("res:", "选定图片结果");
|
||||
Log.e("res:", path);
|
||||
//选定图片结果
|
||||
// if(index==1 || index==2){
|
||||
// new OCRRequest().OCRPlateLicense(con,hd,new File(path));
|
||||
// }
|
||||
if (index == 0 || index == 1) {//装卸货车辆需要识别车牌号
|
||||
new OCRRequest().OCRCarPlateLicense(con, hd, new File(path));
|
||||
} else {
|
||||
hyr.uploadFile(new File(path));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private LatLng latLng;
|
||||
|
||||
public LatLng convertGPSToBaidu(LatLng srLatLng) {
|
||||
CoordinateConverter converter = new CoordinateConverter();
|
||||
converter.from(CoordinateConverter.CoordType.COMMON);
|
||||
converter.coord(srLatLng);
|
||||
return converter.convert();
|
||||
}
|
||||
|
||||
private String wid;
|
||||
private int h_type;
|
||||
String sobStr = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StateStyleUtil.stateTextColor(this);
|
||||
setContentView(R.layout.activity_shangchuan_bc);
|
||||
con = this;
|
||||
submit = findViewById(R.id.submit);
|
||||
name_top = findViewById(R.id.name_top);
|
||||
name_body = findViewById(R.id.name_body);
|
||||
address = findViewById(R.id.address);
|
||||
getImg = findViewById(R.id.getImg);
|
||||
res_img = findViewById(R.id.res_img);
|
||||
img_icon = findViewById(R.id.img_icon);
|
||||
img_delete = findViewById(R.id.img_delete);
|
||||
tv_loaction = findViewById(R.id.tv_loaction);
|
||||
btnOk = findViewById(R.id.btnOk);
|
||||
etAddress = findViewById(R.id.etAddress);
|
||||
tvDate = findViewById(R.id.tvDate);
|
||||
tvLocation = findViewById(R.id.tvLocation);
|
||||
tips = findViewById(R.id.tips);
|
||||
tips_x = findViewById(R.id.tips_x);
|
||||
Bundle ins = getIntent().getExtras();
|
||||
index = ins.getInt("type");
|
||||
wid = ins.getString("wid");
|
||||
h_type = ins.getInt("h_type");
|
||||
keys = ins.getBoolean("keys");
|
||||
sobStr = getIntent().getExtras().getString("sob");
|
||||
//Log.e("---sdwStr--",sdwStr);
|
||||
sob = new Gson().fromJson(sobStr, StartOrderBean.class);
|
||||
initView(null);
|
||||
customDialog = new CustomDialog(con, "正在定位当前位置...");
|
||||
customDialog.show();
|
||||
lgdu = new LocationGDUtil(con, hd);
|
||||
//启动定位
|
||||
lgdu.onCreate();
|
||||
tv_loaction.setOnClickListener(v -> {
|
||||
if (!locationKey) {
|
||||
customDialog.show();
|
||||
lgdu.onCreate();
|
||||
}
|
||||
});
|
||||
|
||||
btnOk.setOnClickListener(v -> {
|
||||
String s = etAddress.getText().toString();
|
||||
if (TextUtils.isEmpty(selDate)){
|
||||
ToastUtils.showToast(this,"请先选择时间");
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isEmpty(s)&&s.length()>=4){
|
||||
|
||||
InputtipsQuery inputquery = new InputtipsQuery(s, "");
|
||||
// inputquery.setCityLimit(true);
|
||||
Inputtips inputTips = new Inputtips(this, inputquery);
|
||||
inputTips.setInputtipsListener(this);
|
||||
inputTips.requestInputtipsAsyn();
|
||||
|
||||
|
||||
// GeocodeQuery query = new GeocodeQuery(s, "100000");// 第一个参数表示地址,第二个参数表示查询城市,中文或者中文全拼,citycode、adcode,
|
||||
// geocoderSearch.getFromLocationNameAsyn(query);// 设置同步地理编码请求
|
||||
}else{
|
||||
ToastUtils.showToast(this,"请输入地址且长度大于4");
|
||||
}
|
||||
});
|
||||
|
||||
tvDate.setOnClickListener(v -> {
|
||||
|
||||
DatimePicker datimePicker = new DatimePicker(this);
|
||||
datimePicker.setBodyWidth(300);
|
||||
datimePicker.getWheelLayout().setRange(DatimeEntity.yearOnFuture(-1),DatimeEntity.yearOnFuture(10),DatimeEntity.now());
|
||||
datimePicker.setOnDatimePickedListener((year, month, day, hour, minute, second) -> {
|
||||
selDate = year+"-"+month+"-"+day+" "+ hour+":"+minute;
|
||||
tvDate.setText(selDate);
|
||||
});
|
||||
datimePicker.getWheelLayout().setDateLabel("年", "月", "日");
|
||||
datimePicker.getWheelLayout().setTimeLabel("时","分","");
|
||||
datimePicker.getWheelLayout().setTimeMode(TimeMode.HOUR_24_NO_SECOND);
|
||||
datimePicker.show();
|
||||
});
|
||||
|
||||
hyr = new HuoYuanRequset(con, hd);
|
||||
}
|
||||
|
||||
public void initData() {
|
||||
//nfc初始化设置
|
||||
NfcUtils nfcUtils = new NfcUtils(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
name_top.setText("上传" + names[index] + "照片");
|
||||
name_body.setText(names[index] + "照片");
|
||||
if (index == 1) {
|
||||
tips.setVisibility(View.VISIBLE);
|
||||
tips_x.setVisibility(View.VISIBLE);
|
||||
}
|
||||
submit.setOnClickListener(v -> {
|
||||
if (imgIds.size() != 0) {
|
||||
typeRequest();
|
||||
} else {
|
||||
Toast.makeText(con, "请先上传一张图片", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
getImg.setOnClickListener(v -> {
|
||||
if (key) {
|
||||
Log.e("--imgIds.size()--", imgIds.size() + "");
|
||||
gia.showPopueWindow(this, true);
|
||||
} else {
|
||||
new XPopup.Builder(con)
|
||||
.asImageViewer(res_img, ub.getData().getUrl(), new SmartGlideImageLoader(R.mipmap.ic_launcher))
|
||||
.show();
|
||||
// new XPopup.Builder(con)
|
||||
// .asImageViewer(res_img, ub.getData().getUrl(), true, -1, -1, 50, false,new CertificatesActivity.ImageLoader())
|
||||
// .show();
|
||||
Toast.makeText(con, "查看了照片", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
img_delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
imgIds = new ArrayList<>();
|
||||
ub = new UploadBean();
|
||||
res_img.setVisibility(View.GONE);
|
||||
img_delete.setVisibility(View.GONE);
|
||||
img_icon.setVisibility(View.VISIBLE);
|
||||
key = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String path;
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 12 && resultCode == RESULT_OK) {
|
||||
if (null == gia.getFile()) {
|
||||
new ToastUtil(con, Gravity.CENTER, "图片选择失败").show(Toast.LENGTH_SHORT);
|
||||
return;
|
||||
}
|
||||
path = gia.getFile().getPath();
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
ImageFileCompressUtil.imageFileCompress(con, new File(path), hd);
|
||||
} else if (requestCode == PictureConfig.CHOOSE_REQUEST && resultCode == RESULT_OK) {
|
||||
List<LocalMedia> imgs = PictureSelector.obtainMultipleResult(data);
|
||||
if (imgs != null && imgs.size() > 0) {
|
||||
LocalMedia image = imgs.get(0);
|
||||
|
||||
String paths = image.getAndroidQToPath();
|
||||
if (TextUtils.isEmpty(paths)) {
|
||||
paths = image.getPath();
|
||||
}
|
||||
path = paths;
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
ImageFileCompressUtil.imageFileCompress(con, new File(path), hd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initLocation() {
|
||||
address.setText(lgdu.getAddress());
|
||||
}
|
||||
|
||||
public void typeRequest() {
|
||||
// for(int i=0;i<imgIds.size();i++){
|
||||
// Log.e("--imgIds--",imgIds.get(i)+"");
|
||||
// }
|
||||
switch (index) {
|
||||
case 0:
|
||||
//装货
|
||||
if (imgIds != null && imgIds.size() > 0) {
|
||||
lub.setLatitude(tempLoca.getLatitude() + "");
|
||||
lub.setLongitude(tempLoca.getLongitude() + "");
|
||||
lub.setLocationAddress(tempLoca.getAddress());
|
||||
lub.setImageId(imgIds);
|
||||
lub.setWaybillId(wid);
|
||||
Log.e("--装货信息", gson.toJson(lub));
|
||||
if (locationKey) {//高德定位
|
||||
if (keys) {
|
||||
nfc();
|
||||
loadInfo();
|
||||
// up_traffic_start();
|
||||
// up_image_z();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (imgIds != null && imgIds.size() > 0) {
|
||||
//卸货
|
||||
lub.setLatitude(tempLoca.getLatitude() + "");
|
||||
lub.setLongitude(tempLoca.getLongitude() + "");
|
||||
lub.setLocationAddress(tempLoca.getAddress());
|
||||
lub.setImageId(imgIds);
|
||||
lub.setWaybillId(wid);
|
||||
lub.setRealLoadTime(tempLoca.getTime());
|
||||
Log.e("--卸货信息", gson.toJson(lub));
|
||||
if (locationKey&&!TextUtils.isEmpty(tempLoca.address)) {
|
||||
if (keys) {
|
||||
nfc();
|
||||
uploadInfo();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (imgIds != null && imgIds.size() > 0) {//卸货回单
|
||||
//上传回单
|
||||
urib.setLatitude(lgdu.getLatitude() + "");
|
||||
urib.setLongitude(lgdu.getLongitude() + "");
|
||||
urib.setLocationAddress(lgdu.getAddress());
|
||||
//装卸货类型
|
||||
urib.setType(h_type + 1);
|
||||
//回单id 数组
|
||||
urib.setReceiptId(imgIds);
|
||||
//子运运单ID
|
||||
urib.setWaybillId(wid);
|
||||
Log.e("--回单信息", gson.toJson(urib));
|
||||
if (locationKey) {
|
||||
if (index == 2 && keys && !TextUtils.isEmpty(tempLoca.address)) {
|
||||
up_trafficSign();
|
||||
up_trafficReceipt();
|
||||
receipt_image();
|
||||
}
|
||||
hyr.receipt(urib);
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private StartOrderBean sob;
|
||||
|
||||
public void nfc() {
|
||||
// if(sob.getData().getNfcId().equals(nfcStr)){
|
||||
// Toast.makeText(con,"nfcId匹配失败",Toast.LENGTH_LONG).show();
|
||||
// }
|
||||
if ("".equals(sob.getData().getNfcId()) || sob.getData().getNfcId() == null) {
|
||||
return;
|
||||
}
|
||||
MDPLocationCollectionManager.checkNfc(con, sob.getData().getShippingNoteNumber(),
|
||||
sob.getData().getNfcId(), new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Toast.makeText(con, "nfcId匹配成功", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("不匹配", "" + s + s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//上传安联-签收
|
||||
public void up_trafficSign() {
|
||||
//安联
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(tempLocaBd.longitude);
|
||||
l.setBaiduLatitude(tempLocaBd.latitude);
|
||||
l.setLocation(tempLocaBd.getAddress());
|
||||
l.setTime(tempLocaBd.getTime());
|
||||
List<Goods> gs = new ArrayList<>();
|
||||
for (StartOrderBean.DataDTO.WayChildrenDTO wayChild : sob.getData().getWayChildren()) {
|
||||
if (wid.equals(wayChild.getId() + "")) {
|
||||
for (StartOrderBean.DataDTO.WayChildrenDTO.GoodsDTO good : wayChild.getGoods()) {
|
||||
Goods g = new Goods();
|
||||
g.setGoodsName(good.getGoodName());
|
||||
g.setUnit(good.getGoodUnit());
|
||||
g.setItemNo(good.getId());
|
||||
//实收
|
||||
g.setQuantity(1);
|
||||
//应收
|
||||
g.setReceivedQuantity(1);
|
||||
//破损
|
||||
g.setDamageQuantity(1);
|
||||
//丢失
|
||||
g.setQuantity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
MDPLocationCollectionManager.sign(con, sob.getData().getShippingNoteNumber(), l, gs, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "签收成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(签收):", s + s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//上传安联-回单
|
||||
public void up_trafficReceipt() {
|
||||
//安联
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(tempLocaBd.longitude);
|
||||
l.setBaiduLatitude(tempLocaBd.latitude);
|
||||
l.setLocation(tempLocaBd.getAddress());
|
||||
l.setTime(tempLocaBd.getTime());
|
||||
MDPLocationCollectionManager.pod(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "回单上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(回单):", s + s1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void up_image_z() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(Timer.getTimerT());
|
||||
image.setBaiduLongitude(tempLocaBd.longitude);
|
||||
image.setBaiduLatitude(tempLocaBd.latitude);
|
||||
image.setLocation(tempLocaBd.getAddress());
|
||||
MDPLocationCollectionManager.uploadPickupImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "装货照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","装货",sob.getData().getShippingNoteNumber());
|
||||
// SPUtil.insSP(con,"make","装货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void up_image() {
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(tempLocaBd.getTime());
|
||||
image.setBaiduLongitude(tempLocaBd.longitude);
|
||||
image.setBaiduLatitude(tempLocaBd.latitude);
|
||||
image.setLocation(tempLocaBd.getAddress());
|
||||
MDPLocationCollectionManager.uploadUnloadImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "卸货照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","卸货",sob.getData().getShippingNoteNumber());
|
||||
// SPUtil.insSP(con,"make","卸货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void receipt_image() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(tempLocaBd.getTime());
|
||||
image.setBaiduLongitude(tempLocaBd.longitude);
|
||||
image.setBaiduLatitude(tempLocaBd.latitude);
|
||||
image.setLocation(tempLocaBd.getAddress());
|
||||
MDPLocationCollectionManager.uploadPODImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "回单照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(回单照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||
//// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
//// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
//// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//开启前台调度系统
|
||||
//NfcUtils.mNfcAdapter.enableForegroundDispatch(this, NfcUtils.mPendingIntent, NfcUtils.mIntentFilter, NfcUtils.mTechList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//关闭前台调度系统
|
||||
//NfcUtils.mNfcAdapter.disableForegroundDispatch(this);
|
||||
}
|
||||
|
||||
String nfcStr = "";
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
//当该Activity接收到NFC标签时,运行该方法
|
||||
//调用工具方法,读取NFC数据
|
||||
try {
|
||||
nfcStr = NfcUtils.readNFCId(intent);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.e("nfc", nfcStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传安联和交通厅,平台-装货
|
||||
*/
|
||||
private void loadInfo() {
|
||||
//安联
|
||||
if (sob.getData().getReportAlct() == 1) {
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(tempLocaBd.longitude);
|
||||
l.setBaiduLatitude(tempLocaBd.latitude);
|
||||
l.setLocation(tempLocaBd.getAddress());
|
||||
l.setTime(tempLocaBd.getTime());
|
||||
MDPLocationCollectionManager.pickup(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "装货上传成功");
|
||||
//交通厅
|
||||
if (sob.getData().getReport() == 1) {
|
||||
JTTProcess.start(con, sob, "");
|
||||
}
|
||||
//装货状态
|
||||
hyr.loading(lub);
|
||||
//装货照片
|
||||
up_image_z();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货):", s + s1);
|
||||
new MessageUtils().showCenMessage(con, s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传安联和交通厅,平台-卸货
|
||||
*/
|
||||
private void uploadInfo() {
|
||||
|
||||
//安联
|
||||
if (sob.getData().getReportAlct() == 1) {
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(tempLocaBd.longitude);
|
||||
l.setBaiduLatitude(tempLocaBd.latitude);
|
||||
l.setLocation(tempLocaBd.getAddress());
|
||||
l.setTime(tempLocaBd.getTime());
|
||||
Log.e("-安联卸货信息-", gson.toJson(l));
|
||||
MDPLocationCollectionManager.unload(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "卸货上传成功");
|
||||
//交通厅
|
||||
if (sob.getData().getReport() == 1) {
|
||||
JTTProcess.stop(con, sob, "");
|
||||
}
|
||||
//卸货状态-平台
|
||||
hyr.dischargeCargo4(lub);
|
||||
//卸货照片-安联
|
||||
up_image();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货):", s + s1);
|
||||
// new MessageUtils().showCenMessage(con, s1);
|
||||
//运单状态不一致,平台更新状态
|
||||
hyr.dischargeCargo4(lub);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,725 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alct.mdp.MDPLocationCollectionManager;
|
||||
import com.alct.mdp.callback.OnResultListener;
|
||||
import com.alct.mdp.model.Goods;
|
||||
import com.alct.mdp.model.Image;
|
||||
import com.alct.mdp.model.Location;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.StartOrderBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UploadBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.HuoYuanRequset;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.OCRRequest;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LUInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.UploadReceiptInputBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.NfcUtils;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.CustomDialog;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.file.FileUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.file.ImageFileCompressUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.img.GetCarImageAlert;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.location.LocationGDUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.location.LocationUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.time.Timer;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.baidu.mapapi.model.LatLng;
|
||||
import com.baidu.mapapi.utils.CoordinateConverter;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.util.SmartGlideImageLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShangChuangImgActivity extends BaseAppCompatActivity {
|
||||
|
||||
private TextView submit, name_top, name_body, address, tips, tips_x;
|
||||
private RelativeLayout getImg;
|
||||
private ImageView res_img, img_icon, img_delete;
|
||||
private String[] names = {"装货", "卸货", "回单"};
|
||||
public static String[] TYPE_NAME = {"zhuanghuo", "xiehuo", "huidan"};
|
||||
private int index = 0;
|
||||
//
|
||||
private Gson gson = new Gson();
|
||||
//
|
||||
private LUInputBean lub = new LUInputBean();
|
||||
private UploadReceiptInputBean urib = new UploadReceiptInputBean();
|
||||
private LocationGDUtil lgdu;
|
||||
public LocationUtil lu;
|
||||
private List<Integer> imgIds = new ArrayList<>();
|
||||
private UploadBean ub;
|
||||
private HuoYuanRequset hyr;
|
||||
//
|
||||
private GetCarImageAlert gia = new GetCarImageAlert();
|
||||
private CustomDialog customDialog;
|
||||
private int id = 0;
|
||||
private boolean key = true;
|
||||
private boolean keys = false;
|
||||
private boolean locationKey = false;
|
||||
private TextView tv_loaction;
|
||||
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
super.msgMethod(m);
|
||||
switch (m.what) {
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if (CacheGroup.cacheList.get("upload") != null) {
|
||||
Log.e("upload", CacheGroup.cacheList.get("upload"));
|
||||
ub = gson.fromJson(CacheGroup.cacheList.remove("upload"), UploadBean.class);
|
||||
if (ub.getCode() == 200) {
|
||||
imgIds.add(ub.getData().getId());
|
||||
Glide.with(con).load(ub.getData().getUrl()).into(res_img);
|
||||
res_img.setVisibility(View.VISIBLE);
|
||||
img_delete.setVisibility(View.VISIBLE);
|
||||
img_icon.setVisibility(View.GONE);
|
||||
key = false;
|
||||
} else {
|
||||
Toast.makeText(con, ub.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove("upload");
|
||||
}
|
||||
for (int i = 0; i < TYPE_NAME.length; i++) {
|
||||
if (CacheGroup.cacheList.get(TYPE_NAME[i]) != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[i]), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
if (index == 2) {
|
||||
if (!keys){//装货回单
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, bb.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(TYPE_NAME[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (CacheGroup.cacheList.get("carName") != null) {
|
||||
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get("carName"), BaseBean.class);
|
||||
if (bb.getCode() == 200) {
|
||||
|
||||
}
|
||||
CacheGroup.cacheList.remove("carName");
|
||||
}
|
||||
|
||||
if (CacheGroup.cacheList.get("carNum") != null) {
|
||||
Log.e("upload", CacheGroup.cacheList.get("carNum"));
|
||||
CarInfoBean ub = gson.fromJson(CacheGroup.cacheList.remove("carNum"), CarInfoBean.class);
|
||||
if (ub.getCode() == 200 && ub.getData().getData().getPrism_keyValueInfo().size() > 0) {
|
||||
String value = ub.getData().getData().getPrism_keyValueInfo().get(0).getValue();
|
||||
String forceMatching = ub.getData().getForceMatching();
|
||||
if ("1".equals(forceMatching)) {//是否强校验车牌号 1:强校验
|
||||
if (sob.getData().getCarNumber().equals(value)) {
|
||||
hyr.uploadFile(new File(path));
|
||||
} else {
|
||||
new MessageUtils().showCenMessage(ShangChuangImgActivity.this, "车牌号不匹配!", "请重新拍照或联系管理员");
|
||||
}
|
||||
} else {
|
||||
hyr.uploadFile(new File(path));
|
||||
}
|
||||
} else {//识别失败后返回code500
|
||||
if (index == 0) {//装卸货车辆需要识别车牌号){
|
||||
Toast.makeText(con, "装货照片包含车牌号、三分之二车身或者装卸货场景。", Toast.LENGTH_SHORT).show();
|
||||
} else if (index == 1) {
|
||||
Toast.makeText(con, "卸货照片包含车牌号、三分之二车身或者装卸货场景。", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
CacheGroup.cacheList.remove("carNum");
|
||||
}
|
||||
break;
|
||||
case 14://定位成功
|
||||
locationKey = true;
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
tv_loaction.setText("定位成功");
|
||||
tv_loaction.setTextColor(getResources().getColor(R.color.theme_color, null));
|
||||
latLng = convertGPSToBaidu(new LatLng(lgdu.getLatitude(), lgdu.getLongitude()));
|
||||
initLocation();
|
||||
break;
|
||||
case 16://定位失败
|
||||
locationKey = false;
|
||||
if (!isFinishing()&&customDialog!=null&&customDialog.isShowing()){
|
||||
customDialog.dismiss();
|
||||
}
|
||||
tv_loaction.setText("定位失败,点击重试");
|
||||
tv_loaction.setTextColor(getResources().getColor(R.color.loaction_no_color, null));
|
||||
Toast.makeText(con, "定位失败,请确认开启定位后重试!", Toast.LENGTH_LONG).show();
|
||||
//定位结果接收
|
||||
//finish();
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
|
||||
case ImageFileCompressUtil.COMPRESS_SUCCESS:
|
||||
path = (String) m.obj;
|
||||
Log.e("res:", "选定图片结果");
|
||||
Log.e("res:", path);
|
||||
//选定图片结果
|
||||
// if(index==1 || index==2){
|
||||
// new OCRRequest().OCRPlateLicense(con,hd,new File(path));
|
||||
// }
|
||||
if (index == 0 || index == 1) {//装卸货车辆需要识别车牌号
|
||||
new OCRRequest().OCRCarPlateLicense(con, hd, new File(path));
|
||||
} else {
|
||||
hyr.uploadFile(new File(path));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private LatLng latLng;
|
||||
|
||||
public LatLng convertGPSToBaidu(LatLng srLatLng) {
|
||||
CoordinateConverter converter = new CoordinateConverter();
|
||||
converter.from(CoordinateConverter.CoordType.COMMON);
|
||||
converter.coord(srLatLng);
|
||||
return converter.convert();
|
||||
}
|
||||
|
||||
private String wid;
|
||||
private int h_type;
|
||||
String sobStr = "";
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StateStyleUtil.stateTextColor(this);
|
||||
setContentView(R.layout.activity_shangchuan);
|
||||
con = this;
|
||||
submit = findViewById(R.id.submit);
|
||||
name_top = findViewById(R.id.name_top);
|
||||
name_body = findViewById(R.id.name_body);
|
||||
address = findViewById(R.id.address);
|
||||
getImg = findViewById(R.id.getImg);
|
||||
res_img = findViewById(R.id.res_img);
|
||||
img_icon = findViewById(R.id.img_icon);
|
||||
img_delete = findViewById(R.id.img_delete);
|
||||
tv_loaction = findViewById(R.id.tv_loaction);
|
||||
tips = findViewById(R.id.tips);
|
||||
tips_x = findViewById(R.id.tips_x);
|
||||
Bundle ins = getIntent().getExtras();
|
||||
index = ins.getInt("type");
|
||||
wid = ins.getString("wid");
|
||||
h_type = ins.getInt("h_type");
|
||||
keys = ins.getBoolean("keys");
|
||||
sobStr = getIntent().getExtras().getString("sob");
|
||||
//Log.e("---sdwStr--",sdwStr);
|
||||
sob = new Gson().fromJson(sobStr, StartOrderBean.class);
|
||||
initView(null);
|
||||
customDialog = new CustomDialog(con, "正在定位当前位置...");
|
||||
customDialog.show();
|
||||
lgdu = new LocationGDUtil(con, hd);
|
||||
//启动定位
|
||||
lgdu.onCreate();
|
||||
// lu = new LocationUtil(con, hd);
|
||||
// lu.onCreate();
|
||||
// if (keys) {
|
||||
// lu = new LocationUtil(con, hd);
|
||||
// lu.onCreate();
|
||||
// }
|
||||
tv_loaction.setOnClickListener(v -> {
|
||||
if (!locationKey) {
|
||||
customDialog.show();
|
||||
lgdu.onCreate();
|
||||
// lu = new LocationUtil(con, hd);
|
||||
// lu.onCreate();
|
||||
}
|
||||
});
|
||||
hyr = new HuoYuanRequset(con, hd);
|
||||
// if (!NfcUtils.hasNfc(con)) {
|
||||
// Toast.makeText(con,"请先开启nfc",Toast.LENGTH_LONG).show();
|
||||
// }else{
|
||||
// initData();
|
||||
// }
|
||||
}
|
||||
|
||||
public void initData() {
|
||||
//nfc初始化设置
|
||||
NfcUtils nfcUtils = new NfcUtils(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
name_top.setText("上传" + names[index] + "照片");
|
||||
name_body.setText(names[index] + "照片");
|
||||
if (index == 1) {
|
||||
tips.setVisibility(View.VISIBLE);
|
||||
tips_x.setVisibility(View.VISIBLE);
|
||||
}
|
||||
submit.setOnClickListener(v -> {
|
||||
if (imgIds.size() != 0) {
|
||||
typeRequest();
|
||||
} else {
|
||||
Toast.makeText(con, "请先上传一张图片", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
getImg.setOnClickListener(v -> {
|
||||
if (key) {
|
||||
Log.e("--imgIds.size()--", imgIds.size() + "");
|
||||
gia.showPopueWindow(this, index == 2);
|
||||
} else {
|
||||
new XPopup.Builder(con)
|
||||
.asImageViewer(res_img, ub.getData().getUrl(), new SmartGlideImageLoader(R.mipmap.ic_launcher))
|
||||
.show();
|
||||
// new XPopup.Builder(con)
|
||||
// .asImageViewer(res_img, ub.getData().getUrl(), true, -1, -1, 50, false,new CertificatesActivity.ImageLoader())
|
||||
// .show();
|
||||
Toast.makeText(con, "查看了照片", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
img_delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
imgIds = new ArrayList<>();
|
||||
ub = new UploadBean();
|
||||
res_img.setVisibility(View.GONE);
|
||||
img_delete.setVisibility(View.GONE);
|
||||
img_icon.setVisibility(View.VISIBLE);
|
||||
key = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String path;
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 12 && resultCode == RESULT_OK) {
|
||||
if (null == gia.getFile()) {
|
||||
new ToastUtil(con, Gravity.CENTER, "图片选择失败").show(Toast.LENGTH_SHORT);
|
||||
return;
|
||||
}
|
||||
path = gia.getFile().getPath();
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
ImageFileCompressUtil.imageFileCompress(con, new File(path), hd);
|
||||
} else if (requestCode == PictureConfig.CHOOSE_REQUEST && resultCode == RESULT_OK) {
|
||||
List<LocalMedia> imgs = PictureSelector.obtainMultipleResult(data);
|
||||
if (imgs != null && imgs.size() > 0) {
|
||||
LocalMedia image = imgs.get(0);
|
||||
|
||||
String paths = image.getAndroidQToPath();
|
||||
if (TextUtils.isEmpty(paths)) {
|
||||
paths = image.getPath();
|
||||
}
|
||||
path = paths;
|
||||
Log.e("图片地址:", path);
|
||||
gia.dis();
|
||||
ImageFileCompressUtil.imageFileCompress(con, new File(path), hd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void initLocation() {
|
||||
address.setText(lgdu.getAddress());
|
||||
}
|
||||
|
||||
public void typeRequest() {
|
||||
// for(int i=0;i<imgIds.size();i++){
|
||||
// Log.e("--imgIds--",imgIds.get(i)+"");
|
||||
// }
|
||||
switch (index) {
|
||||
case 0:
|
||||
//装货
|
||||
if (imgIds != null && imgIds.size() > 0) {
|
||||
lub.setLatitude(lgdu.getLatitude() + "");
|
||||
lub.setLongitude(lgdu.getLongitude() + "");
|
||||
lub.setLocationAddress(lgdu.getAddress());
|
||||
lub.setImageId(imgIds);
|
||||
lub.setWaybillId(wid);
|
||||
Log.e("--装货信息", gson.toJson(lub));
|
||||
if (locationKey) {//高德定位
|
||||
if (keys) {
|
||||
nfc();
|
||||
loadInfo();
|
||||
// up_traffic_start();
|
||||
// up_image_z();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (imgIds != null && imgIds.size() > 0) {
|
||||
//卸货
|
||||
lub.setLatitude(lgdu.getLatitude() + "");
|
||||
lub.setLongitude(lgdu.getLongitude() + "");
|
||||
lub.setLocationAddress(lgdu.getAddress());
|
||||
lub.setImageId(imgIds);
|
||||
lub.setWaybillId(wid);
|
||||
Log.e("--卸货信息", gson.toJson(lub));
|
||||
if (locationKey) {
|
||||
if (keys) {
|
||||
nfc();
|
||||
uploadInfo();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (imgIds != null && imgIds.size() > 0) {//卸货回单
|
||||
//上传回单
|
||||
urib.setLatitude(lgdu.getLatitude() + "");
|
||||
urib.setLongitude(lgdu.getLongitude() + "");
|
||||
urib.setLocationAddress(lgdu.getAddress());
|
||||
//装卸货类型
|
||||
urib.setType(h_type + 1);
|
||||
//回单id 数组
|
||||
urib.setReceiptId(imgIds);
|
||||
//子运运单ID
|
||||
urib.setWaybillId(wid);
|
||||
Log.e("--回单信息", gson.toJson(urib));
|
||||
if (locationKey) {
|
||||
if (index == 2 && keys) {
|
||||
up_trafficSign();
|
||||
up_trafficReceipt();
|
||||
receipt_image();
|
||||
}
|
||||
hyr.receipt(urib);
|
||||
} else {
|
||||
Toast.makeText(con, "定位异常,请重新定位", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, "图片上传异常,请重新上传", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private StartOrderBean sob;
|
||||
|
||||
public void nfc() {
|
||||
// if(sob.getData().getNfcId().equals(nfcStr)){
|
||||
// Toast.makeText(con,"nfcId匹配失败",Toast.LENGTH_LONG).show();
|
||||
// }
|
||||
if ("".equals(sob.getData().getNfcId()) || sob.getData().getNfcId() == null) {
|
||||
return;
|
||||
}
|
||||
MDPLocationCollectionManager.checkNfc(con, sob.getData().getShippingNoteNumber(),
|
||||
sob.getData().getNfcId(), new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Toast.makeText(con, "nfcId匹配成功", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("不匹配", "" + s + s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//上传安联-签收
|
||||
public void up_trafficSign() {
|
||||
//安联
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(latLng.longitude);
|
||||
l.setBaiduLatitude(latLng.latitude);
|
||||
l.setLocation(lgdu.getAddress());
|
||||
l.setTime(Timer.getTimerT());
|
||||
List<Goods> gs = new ArrayList<>();
|
||||
for (StartOrderBean.DataDTO.WayChildrenDTO wayChild : sob.getData().getWayChildren()) {
|
||||
if (wid.equals(wayChild.getId() + "")) {
|
||||
for (StartOrderBean.DataDTO.WayChildrenDTO.GoodsDTO good : wayChild.getGoods()) {
|
||||
Goods g = new Goods();
|
||||
g.setGoodsName(good.getGoodName());
|
||||
g.setUnit(good.getGoodUnit());
|
||||
g.setItemNo(good.getId());
|
||||
//实收
|
||||
g.setQuantity(1);
|
||||
//应收
|
||||
g.setReceivedQuantity(1);
|
||||
//破损
|
||||
g.setDamageQuantity(1);
|
||||
//丢失
|
||||
g.setQuantity(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
MDPLocationCollectionManager.sign(con, sob.getData().getShippingNoteNumber(), l, gs, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "签收成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(签收):", s + s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//上传安联-回单
|
||||
public void up_trafficReceipt() {
|
||||
//安联
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(latLng.longitude);
|
||||
l.setBaiduLatitude(latLng.latitude);
|
||||
l.setLocation(lgdu.getAddress());
|
||||
l.setTime(Timer.getTimerT());
|
||||
MDPLocationCollectionManager.pod(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "回单上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(回单):", s + s1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void up_image_z() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(Timer.getTimerT());
|
||||
image.setBaiduLongitude(latLng.longitude);
|
||||
image.setBaiduLatitude(latLng.latitude);
|
||||
image.setLocation(lgdu.getAddress());
|
||||
MDPLocationCollectionManager.uploadPickupImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "装货照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","装货",sob.getData().getShippingNoteNumber());
|
||||
// SPUtil.insSP(con,"make","装货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void up_image() {
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(Timer.getTimerT());
|
||||
image.setBaiduLongitude(latLng.longitude);
|
||||
image.setBaiduLatitude(latLng.latitude);
|
||||
image.setLocation(lgdu.getAddress());
|
||||
MDPLocationCollectionManager.uploadUnloadImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "卸货照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","卸货",sob.getData().getShippingNoteNumber());
|
||||
// SPUtil.insSP(con,"make","卸货-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void receipt_image() {
|
||||
///storage/emulated/0/Android/data/com.oneclouds.wangluohuoyun/files/Pictures/163124593063154.jpg
|
||||
File file = new File(path);
|
||||
Image image = new Image();
|
||||
String base = BitmapUtil.imageToBase64(path);
|
||||
image.setFileData("data:image/" + FileUtil.lastName(file) + ";base64," + base);
|
||||
image.setFileExt(FileUtil.lastName(file));
|
||||
image.setFileName(FileUtil.fileName(file));
|
||||
image.setImageTakenDate(Timer.getTimerT());
|
||||
image.setBaiduLongitude(latLng.longitude);
|
||||
image.setBaiduLatitude(latLng.latitude);
|
||||
image.setLocation(lgdu.getAddress());
|
||||
MDPLocationCollectionManager.uploadPODImage(con, sob.getData().getShippingNoteNumber(), image, new OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "回单照片上传成功");
|
||||
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(回单照片):", s + s1);
|
||||
// SPUtil.insSP(con,"make","回单",sob.getData().getShippingNoteNumber());
|
||||
//// SPUtil.insSP(con,"make","回单-"+sob.getData().getShippingNoteNumber(),gson.toJson(image));
|
||||
//// Intent serviceIn=new Intent(con, MakeUpAlService.class);
|
||||
//// startService(serviceIn);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
//开启前台调度系统
|
||||
//NfcUtils.mNfcAdapter.enableForegroundDispatch(this, NfcUtils.mPendingIntent, NfcUtils.mIntentFilter, NfcUtils.mTechList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
//关闭前台调度系统
|
||||
//NfcUtils.mNfcAdapter.disableForegroundDispatch(this);
|
||||
}
|
||||
|
||||
String nfcStr = "";
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
//当该Activity接收到NFC标签时,运行该方法
|
||||
//调用工具方法,读取NFC数据
|
||||
try {
|
||||
nfcStr = NfcUtils.readNFCId(intent);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.e("nfc", nfcStr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上传安联和交通厅,平台-装货
|
||||
*/
|
||||
private void loadInfo() {
|
||||
//安联
|
||||
if (sob.getData().getReportAlct() == 1) {
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(latLng.longitude);
|
||||
l.setBaiduLatitude(latLng.latitude);
|
||||
l.setLocation(lgdu.getAddress());
|
||||
l.setTime(Timer.getTimerT());
|
||||
MDPLocationCollectionManager.pickup(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "装货上传成功");
|
||||
//交通厅
|
||||
if (sob.getData().getReport() == 1) {
|
||||
JTTProcess.start(con, sob, "");
|
||||
}
|
||||
//装货状态
|
||||
hyr.loading(lub);
|
||||
//装货照片
|
||||
up_image_z();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货):", s + s1);
|
||||
new MessageUtils().showCenMessage(con, s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传安联和交通厅,平台-卸货
|
||||
*/
|
||||
private void uploadInfo() {
|
||||
|
||||
//安联
|
||||
if (sob.getData().getReportAlct() == 1) {
|
||||
Location l = new Location();
|
||||
l.setBaiduLongitude(latLng.longitude);
|
||||
l.setBaiduLatitude(latLng.latitude);
|
||||
l.setLocation(lgdu.getAddress());
|
||||
l.setTime(Timer.getTimerT());
|
||||
Log.e("-安联卸货信息-", gson.toJson(l));
|
||||
MDPLocationCollectionManager.unload(con, sob.getData().getShippingNoteNumber(), l, new OnResultListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联", "卸货上传成功");
|
||||
//交通厅
|
||||
if (sob.getData().getReport() == 1) {
|
||||
JTTProcess.stop(con, sob, "");
|
||||
}
|
||||
//卸货状态-平台
|
||||
hyr.dischargeCargo(lub);
|
||||
//卸货照片-安联
|
||||
up_image();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货):", s + s1);
|
||||
new MessageUtils().showCenMessage(con, s1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user