首页添加执行中运单跳转功能

This commit is contained in:
lijia 2024-09-04 09:23:31 +08:00
parent 0e9224a034
commit eeadd1d196
6 changed files with 291 additions and 21 deletions

View File

@ -0,0 +1,16 @@
package com.arpa.hndahesudintocctmsdriver.event;
/**
* @author hlh
* @version 1.0.0
* @date 2021/10/20 14:43
* @description:
*/
public class HomeWaybillEvent {
public HomeWaybillEvent() {
}
}

View File

@ -42,15 +42,20 @@ import com.arpa.hndahesudintocctmsdriver.bean.ImageConfig;
import com.arpa.hndahesudintocctmsdriver.bean.JTT;
import com.arpa.hndahesudintocctmsdriver.constant.JTTConstant;
import com.arpa.hndahesudintocctmsdriver.event.HomeEvent;
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.request.WalletRequest;
import com.arpa.hndahesudintocctmsdriver.ui.auth.CertificatesActivity;
import com.arpa.hndahesudintocctmsdriver.ui.home.shangchuan.ShangChuangImgActivity;
import com.arpa.hndahesudintocctmsdriver.ui.news.NewActivity;
import com.arpa.hndahesudintocctmsdriver.ui.wallet.UpBankActivity;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.SPUtils;
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
import com.bumptech.glide.Glide;
import com.dahe.mylibrary.utils.TimeUtil;
import com.dahe.mylibrary.utils.ToastUtils;
import com.google.gson.Gson;
import com.gyf.cactus.Cactus;
import com.hjq.xtoast.XToast;
@ -120,7 +125,11 @@ public class HomeFragment extends BaseFragment {
private HuoYuanListBean hb;
private Gson gson = new Gson();
private CardView btn_news, btn_loadin, btn_update;
private LinearLayout order_all;
private LinearLayout order_all, llCurWay;
private TextView tvWaybill, tvGo, tvZX;
private ImageView ivType;
private HuoYuanListBean uab;
private List<Marker> list = new ArrayList<>();
private HuoYuanListDealBean hdb;
@ -144,17 +153,17 @@ public class HomeFragment extends BaseFragment {
}
//银行卡信息接收
if(CacheGroup.cacheList.get(dataName2)!=null){
BankCardListBean bcb=new Gson().fromJson(CacheGroup.cacheList.get(dataName2), BankCardListBean.class);
if(bcb.getCode()==200){
if(bcb.getData() ==null || bcb.getData().getRecords()==null || bcb.getData().getRecords().size()<1){
new MessageUtils().showSimCenPop(con, "缺少银行卡可能会导致运费无法结算,是否去添加!","取消","确认", () -> {
Intent in333=new Intent(con, UpBankActivity.class);
if (CacheGroup.cacheList.get(dataName2) != null) {
BankCardListBean bcb = new Gson().fromJson(CacheGroup.cacheList.get(dataName2), BankCardListBean.class);
if (bcb.getCode() == 200) {
if (bcb.getData() == null || bcb.getData().getRecords() == null || bcb.getData().getRecords().size() < 1) {
new MessageUtils().showSimCenPop(con, "缺少银行卡可能会导致运费无法结算,是否去添加!", "取消", "确认", () -> {
Intent in333 = new Intent(con, UpBankActivity.class);
startActivity(in333);
});
}
}else{
Toast.makeText(con,bcb.getMsg(),Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(con, bcb.getMsg(), Toast.LENGTH_SHORT).show();
}
CacheGroup.cacheList.remove(dataName2);
}
@ -185,8 +194,11 @@ public class HomeFragment extends BaseFragment {
SPUtil.insSP(con, JTTConstant.JTT_DATA_NAME, JTTConstant.JTT_DATA_ORDER_KEY, gson.toJson(sob));
initStart();
StartOrderParts.setStartOrder(con, sob);
if (sob.getData() != null) {
if (sob.getData() != null && !sob.getData().getWaybillStatus().equals("已取消")) {
dealCurWay(sob.getData());
ur.getJtts(sob.getData().getShippingNoteNumber());
} else {
llCurWay.setVisibility(View.GONE);
}
} else {
Toast.makeText(con, sob.getMsg(), Toast.LENGTH_SHORT).show();
@ -261,8 +273,8 @@ public class HomeFragment extends BaseFragment {
in.putExtra("url", deb.getData().getIdCardUpdateUrl());
}
}
if (!TextUtils.isEmpty(deb.getData().getDriverLicenseUpdateUrl()) || !TextUtils.isEmpty(deb.getData().getIdCardUpdateUrl())||
!TextUtils.isEmpty(deb.getData().getQualificationUpdateUrl())||!TextUtils.isEmpty(deb.getData().getRoadLicenseUpdateUrl())||
if (!TextUtils.isEmpty(deb.getData().getDriverLicenseUpdateUrl()) || !TextUtils.isEmpty(deb.getData().getIdCardUpdateUrl()) ||
!TextUtils.isEmpty(deb.getData().getQualificationUpdateUrl()) || !TextUtils.isEmpty(deb.getData().getRoadLicenseUpdateUrl()) ||
!TextUtils.isEmpty(deb.getData().getInsuranceUpdateUrl())) {
new XToast<>(act)
.setContentView(R.layout.view_bc)
@ -340,8 +352,8 @@ public class HomeFragment extends BaseFragment {
EventBus.getDefault().register(this);
hyr = new HuoYuanRequset(con, hd);
ur = new UserRequset(con, hd);
initRefreshLoad();
initView(null);
initRefreshLoad();
btn_news.setOnClickListener(v -> {
});
@ -447,6 +459,13 @@ public class HomeFragment extends BaseFragment {
order_box = v.findViewById(R.id.order_box);
auth_box = v.findViewById(R.id.auth_box);
order_all = v.findViewById(R.id.order_all);
llCurWay = v.findViewById(R.id.llCurWay);
tvWaybill = v.findViewById(R.id.tvWaybill);
tvGo = v.findViewById(R.id.tvGo);
tvZX = v.findViewById(R.id.loadingAddress);
ivType = v.findViewById(R.id.ivType);
ImageView fun_left = v.findViewById(R.id.fun_left);
ImageView fun_right = v.findViewById(R.id.fun_right);
fun_left.setOnClickListener(v16 -> startActivity(new Intent(con, OrderListActivity.class)));
@ -532,10 +551,15 @@ public class HomeFragment extends BaseFragment {
startActivity(in4);
break;
case 3:
Intent in5 = new Intent(con, WebActivity.class);
in5.putExtra("url", "https://ks.wjx.top/vm/h6Jqu8A.aspx");
in5.putExtra("title", "知识竞猜");
startActivity(in5);
// Intent in5 = new Intent(con, WebActivity.class);
// in5.putExtra("url", "https://ks.wjx.top/vm/h6Jqu8A.aspx");
// in5.putExtra("title", "知识竞猜");
// startActivity(in5);
Intent in = new Intent(getContext(), WebActivity.class);
in.putExtra("url", "http://192.168.1.152:8080");
in.putExtra("title", "隐私政策");
getContext().startActivity(in);
break;
default:
break;
@ -546,6 +570,100 @@ public class HomeFragment extends BaseFragment {
initMap();
}
StartOrderBean.DataDTO.WayChildrenDTO zData = new StartOrderBean.DataDTO.WayChildrenDTO();
StartOrderBean.DataDTO.WayChildrenDTO xData = new StartOrderBean.DataDTO.WayChildrenDTO();
/**
* 一装一卸逻辑
*
* @param data
*/
private void dealCurWay(StartOrderBean.DataDTO data) {
SPUtils.put(con, "curWaybillId", data.getWaybillId());
for (int i = 0; i < data.getWayChildren().size(); i++) {
if (1 == data.getWayChildren().get(i).getType()) {
zData = data.getWayChildren().get(i);
break;
}
}
for (int i = 0; i < data.getWayChildren().size(); i++) {
if (2 == data.getWayChildren().get(i).getType()) {
xData = data.getWayChildren().get(i);
break;
}
}
llCurWay.setVisibility(View.VISIBLE);
tvWaybill.setText(data.getShippingNoteNumber());
tvGo.setText(getGoText(zData.getStatus(),xData.getStatus()));
if (data.getWaybillStatus().equals("待装货")) {
tvZX.setText(zData.getAddress());
ivType.setBackgroundResource(R.mipmap.zhuang);
} else {
tvZX.setText(xData.getAddress());
ivType.setBackgroundResource(R.mipmap.xie);
}
tvGo.setOnClickListener(v -> {
int zStatus = zData.getStatus();
int xStatus = xData.getStatus();
if (zStatus == 0) {//未装货
Intent in = new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type", 0);
in.putExtra("wid", zData.getId() + "");
in.putExtra("sob", gson.toJson(sob));
in.putExtra("keys", true);
startActivity(in);
} else if (zStatus == 1 && xStatus == 4) {//已装货未上传回单
Intent in = new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type", 2);
in.putExtra("wid", zData.getId() + "");
in.putExtra("h_type", 0);
in.putExtra("sob", gson.toJson(sob));
startActivity(in);
} else if (zStatus == 3 && xStatus == 4) {//已上传装货回单未卸货
int dis = TimeUtil.compareNowDate(TimeUtil.string2Millis(zData.getImageTakenDate(), TimeUtil.DEFAULT_FORMAT4));
if (dis > 5) {//大于五分钟可以接单
Intent in = new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type", 1);
in.putExtra("wid", xData.getId() + "");
in.putExtra("sob", gson.toJson(sob));
in.putExtra("keys", true);
startActivity(in);
} else {
ToastUtils.showToast(con, "请到卸货地再进行卸货操作!");
}
} else if (zStatus == 3 && xStatus == 2) {//已卸货未上传卸货回单
Intent in = new Intent(con, ShangChuangImgActivity.class);
in.putExtra("type", 2);
in.putExtra("wid", xData.getId() + "");
in.putExtra("h_type", 1);
in.putExtra("sob", gson.toJson(sob));
in.putExtra("keys", true);
startActivity(in);
}else{
ToastUtils.showToast(con,"已完成该运单");
}
});
}
private String getGoText(int zStatus, int xStatus) {
if (zStatus == 0) {//未装货
return "去装货";
} else if (zStatus == 1 && xStatus == 4) {//已装货未上传回单
return "装货回单";
} else if (zStatus == 3 && xStatus == 4) {//已上传装货回单未卸货
return "去卸货";
} else if (zStatus == 3 && xStatus == 2) {//已卸货未上传卸货回单
return "卸货回单";
}
return "已完成";
}
/**
*
*/
@ -565,13 +683,14 @@ public class HomeFragment extends BaseFragment {
ur.upApp();
hyr.getHuoYuan(1, 100);
ur.getImage(1);
WalletRequest qr=new WalletRequest(con,hd);
WalletRequest qr = new WalletRequest(con, hd);
if (UiAuxiliary.isLogin(con)) {
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
ur.User();
qr.getBankCardList();
ur.getDriverExpire();
hyr.startOrder(0);
hyr.startOrder(curWaybillId==-1 ? 0 : curWaybillId);
ur.driverAuthData();
}
// oldTime= Calendar.getInstance().getTimeInMillis();
@ -1019,6 +1138,12 @@ public class HomeFragment extends BaseFragment {
initView(null);
}
@Subscribe
public void processResult(HomeWaybillEvent home) {
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
hyr.startOrder(curWaybillId==-1 ? 0 : curWaybillId);
}
class Model {
private int imageId;

View File

@ -21,12 +21,14 @@ import com.alct.mdp.model.Image;
import com.alct.mdp.model.Location;
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
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.SPUtils;
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
import com.arpa.hndahesudintocctmsdriver.util.img.GetCarImageAlert;
import com.arpa.hndahesudintocctmsdriver.util.location.LocationUtil;
@ -56,6 +58,8 @@ import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
import com.lxj.xpopup.util.SmartGlideImageLoader;
import org.greenrobot.eventbus.EventBus;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
@ -121,6 +125,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
EventBus.getDefault().post(new HomeWaybillEvent());
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
finish();
}
@ -567,6 +572,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
EventBus.getDefault().post(new HomeWaybillEvent());
Log.e("上报安联", "装货照片上传成功");
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
finish();
@ -602,6 +608,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
EventBus.getDefault().post(new HomeWaybillEvent());
Log.e("上报安联", "卸货照片上传成功");
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
finish();
@ -641,6 +648,8 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
SPUtils.remove(con,"curWaybillId");
EventBus.getDefault().post(new HomeWaybillEvent());
Log.e("上报安联", "回单照片上传成功");
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();
finish();

View File

@ -203,7 +203,8 @@ public class WebActivity extends BaseActivity {
@JavascriptInterface
public String getUserToken(){
Log.e("-token-",UserParts.getUser(con).getData().getToken());
// Log.e("-token-",UserParts.getUser(con).getData().getToken());
// return "woshitoken-androidfasdf";
return UserParts.getUser(con).getData().getToken();
}
@ -211,7 +212,11 @@ public class WebActivity extends BaseActivity {
public void isSuccess(){
finish();
}
@JavascriptInterface
public void isPdfSuccess(){
Toast.makeText(con, "签署成功", Toast.LENGTH_SHORT).show();
finish();
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/red" />
<corners
android:radius="@dimen/dp_14" />
</shape>

View File

@ -168,6 +168,114 @@
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_12" />
</LinearLayout>
<LinearLayout
android:visibility="gone"
android:id="@+id/llCurWay"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_140"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:background="@drawable/bg_huoyuan">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_25"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginRight="@dimen/dp_25"
android:layout_marginBottom="@dimen/dp_22">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="运输中订单:"
android:textColor="#ff333333"
android:textSize="@dimen/sp_16" />
<TextView
android:id="@+id/tvWaybill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:text="1321561432123156"
android:textColor="#ff333333"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_6">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivType"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_gravity="center"
android:scaleType="fitXY"
android:background="@mipmap/zhuang" />
<TextView
android:id="@+id/loadingAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/dp_5"
android:ellipsize="end"
android:maxLines="1"
android:text="郑州市市委党校郑州市市委党校郑州市市委党校郑州市市委党校"
android:textColor="#ff333333"
android:textSize="@dimen/sp_15" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tvGo"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_28"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/shape_red_bg14"
android:paddingLeft="@dimen/dp_14"
android:paddingRight="@dimen/dp_14"
android:text="去装货"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/sp_13" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<!-- <LinearLayout
android:layout_marginTop="@dimen/dp_4"
android:layout_width="match_parent"