取消运单导致运单操作异常处理

This commit is contained in:
lijia 2024-10-14 16:58:40 +08:00
parent 6d2656a1f7
commit ba86cfb234
7 changed files with 200 additions and 19 deletions

View File

@ -0,0 +1,56 @@
package com.arpa.hndahesudintocctmsdriver.bean;
/**
* @ClassName WaybillStatusBean
* @Author john
* @Date 2024/10/14 15:40
* @Description TODO
*/
public class WaybillStatusBean {
private int res;
private int code;
private boolean success;
private String msg;
private String data;
public int getRes() {
return res;
}
public void setRes(int res) {
this.res = res;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}

View File

@ -8,9 +8,26 @@ package com.arpa.hndahesudintocctmsdriver.event;
*/ */
public class HomeWaybillEvent { public class HomeWaybillEvent {
private int message;
public int getMessage() {
return message;
}
public void setMessage(int message) {
this.message = message;
}
public HomeWaybillEvent() { public HomeWaybillEvent() {
} }
/**
*
* @param message 1:刷新运单列表
*/
public HomeWaybillEvent(int message) {
this.message = message;
}
} }

View File

@ -142,6 +142,32 @@ public class HuoYuanRequset{
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getEvaluationV2(),MapUtil.mapJson(map)),getToken(con),con); Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getEvaluationV2(),MapUtil.mapJson(map)),getToken(con),con);
RequestUtil.start(1, StartYunDanActivity.KEEP_EVALUTE,re,con,hd); RequestUtil.start(1, StartYunDanActivity.KEEP_EVALUTE,re,con,hd);
} }
/**
* 获取运单状态
* @param waybillId
*/
public void getWaybillStatus(int waybillId){
// Map<String,Object> map=new HashMap<>();
// map.put("waybillId",waybillId);
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getGetWaybillStatus()+"?waybillId="+waybillId,""),getToken(con),con);
RequestUtil.start(1, "waybillStatus",re,con,hd);
}
/**
* 获取货源状态
* @param orderId
*/
public void getOrderStatus(int orderId){
// Map<String,Object> map=new HashMap<>();
// map.put("waybillId",waybillId);
Request re = OkHttpUtil.posts(new OkDate(RequestConstant.getGetOrderStatus()+"?orderId="+orderId,""),getToken(con),con);
RequestUtil.start(1, "orderStatus",re,con,hd);
}
public final static String ASYMMETRYWAYBILL="waybill_getAsymmetryWaybill"; public final static String ASYMMETRYWAYBILL="waybill_getAsymmetryWaybill";
//获取装货失败信息 //获取装货失败信息

View File

@ -81,6 +81,8 @@ public class RequestConstant {
private static final String COMPLAINT = "/app/driver/waybill/complaintV2"; private static final String COMPLAINT = "/app/driver/waybill/complaintV2";
//保存评价信息 //保存评价信息
private static final String EVALUATION_V2 = "/app/driver/waybill/evaluationV2"; private static final String EVALUATION_V2 = "/app/driver/waybill/evaluationV2";
private static final String GET_WAYBILL_STATUS = "/app/driver/waybill/getWaybillStatus";
private static final String GET_ORDER_STATUS = "/app/driver/order/getOrderStatus";
//车辆列表 //车辆列表
private static final String GET_CAR_LIST = "/app/carDriver/getCarList"; private static final String GET_CAR_LIST = "/app/carDriver/getCarList";
//车辆详情 //车辆详情
@ -331,6 +333,14 @@ public class RequestConstant {
return BASE_URL + EVALUATION_V2; return BASE_URL + EVALUATION_V2;
} }
public static String getGetWaybillStatus() {
return BASE_URL + GET_WAYBILL_STATUS;
}
public static String getGetOrderStatus() {
return BASE_URL + GET_ORDER_STATUS;
}
public static String getDRIVERAUTHIDCARD() { public static String getDRIVERAUTHIDCARD() {
return BASE_URL + DRIVERAUTHIDCARD; return BASE_URL + DRIVERAUTHIDCARD;
} }

View File

@ -199,7 +199,7 @@ public class HomeFragment extends BaseFragment {
dealCurWay(sob.getData()); dealCurWay(sob.getData());
ur.getJtts(sob.getData().getShippingNoteNumber()); ur.getJtts(sob.getData().getShippingNoteNumber());
} else { } else {
SPUtils.remove(con,"curWaybillId"); SPUtils.remove(con, "curWaybillId");
llCurWay.setVisibility(View.GONE); llCurWay.setVisibility(View.GONE);
} }
} else { } else {
@ -600,7 +600,7 @@ public class HomeFragment extends BaseFragment {
llCurWay.setVisibility(View.VISIBLE); llCurWay.setVisibility(View.VISIBLE);
tvWaybill.setText(data.getShippingNoteNumber()); tvWaybill.setText(data.getShippingNoteNumber());
tvGo.setText(getGoText(zData.getStatus(),xData.getStatus())); tvGo.setText(getGoText(zData.getStatus(), xData.getStatus()));
if (data.getWaybillStatus().equals("待装货")) { if (data.getWaybillStatus().equals("待装货")) {
tvZX.setText(zData.getAddress()); tvZX.setText(zData.getAddress());
ivType.setBackgroundResource(R.mipmap.zhuang); ivType.setBackgroundResource(R.mipmap.zhuang);
@ -647,8 +647,8 @@ public class HomeFragment extends BaseFragment {
in.putExtra("sob", gson.toJson(sob)); in.putExtra("sob", gson.toJson(sob));
in.putExtra("keys", true); in.putExtra("keys", true);
startActivity(in); startActivity(in);
}else{ } else {
ToastUtils.showToast(con,"已完成该运单"); ToastUtils.showToast(con, "已完成该运单");
} }
}); });
} }
@ -688,9 +688,9 @@ public class HomeFragment extends BaseFragment {
WalletRequest qr = new WalletRequest(con, hd); WalletRequest qr = new WalletRequest(con, hd);
if (UiAuxiliary.isLogin(con)) { if (UiAuxiliary.isLogin(con)) {
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1); // int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
ur.User(); ur.User();
if (!OneDayShowUtils.getInstance().todayIsShow(con)){ if (!OneDayShowUtils.getInstance().todayIsShow(con)) {
qr.getBankCardList(); qr.getBankCardList();
} }
ur.getDriverExpire(); ur.getDriverExpire();
@ -1145,8 +1145,14 @@ public class HomeFragment extends BaseFragment {
@Subscribe @Subscribe
public void processResult(HomeWaybillEvent home) { public void processResult(HomeWaybillEvent home) {
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1); if (home.getMessage() == 1) {
hyr.startOrder(curWaybillId==-1 ? 0 : curWaybillId); hyr.getHuoYuan(1, 100);
} else {
int curWaybillId = (int) SPUtils.get(con, "curWaybillId", -1);
hyr.startOrder(curWaybillId == -1 ? 0 : curWaybillId);
}
} }
class Model { class Model {

View File

@ -29,14 +29,18 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.arpa.hndahesudintocctmsdriver.H5Activity; import com.arpa.hndahesudintocctmsdriver.H5Activity;
import com.arpa.hndahesudintocctmsdriver.bean.JTT; import com.arpa.hndahesudintocctmsdriver.bean.JTT;
import com.arpa.hndahesudintocctmsdriver.bean.WaybillStatusBean;
import com.arpa.hndahesudintocctmsdriver.event.FaceEvent; import com.arpa.hndahesudintocctmsdriver.event.FaceEvent;
import com.arpa.hndahesudintocctmsdriver.event.HomeEvent; import com.arpa.hndahesudintocctmsdriver.event.HomeEvent;
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts; import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
import com.arpa.hndahesudintocctmsdriver.parts.UserParts; import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
import com.arpa.hndahesudintocctmsdriver.report.ALProcess; import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess; import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
import com.arpa.hndahesudintocctmsdriver.ui.auth.PersonalAuthActivity; import com.arpa.hndahesudintocctmsdriver.ui.auth.PersonalAuthActivity;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils; import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.SPUtils;
import com.arpa.hndahesudintocctmsdriver.util.img.ImageGetUtil; import com.arpa.hndahesudintocctmsdriver.util.img.ImageGetUtil;
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil; import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil; import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
@ -141,6 +145,38 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
} }
CacheGroup.cacheList.remove("jttRes"); CacheGroup.cacheList.remove("jttRes");
} }
if (CacheGroup.cacheList.get("orderStatus") != null) {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
Log.e("orderStatus", CacheGroup.cacheList.get("orderStatus"));
WaybillStatusBean status = gson.fromJson(CacheGroup.cacheList.get("orderStatus"), WaybillStatusBean.class);
if (status.getCode() == 200) {
if (status.getData() != null) {
//执行运单下一步操作
new XPopup.Builder(con)
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
.asConfirm("请确认接单", "是否确定承运此运单?",
"取消", "确认",
() -> {
Log.e("--id--", "cid:" + cid + "---wid:" + id);
hyr.confirm(cid, id);
}, () -> customDialog.dismiss(), false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
.show();
} else {//订单已取消
new MessageUtils().showSimCenPop(con, "运单异常将无法进行下步操作,请返回首页", "取消", "确定", () -> {
SPUtils.remove(con, "curWaybillId");
EventBus.getDefault().post(new HomeWaybillEvent(1));
ActivityUtils.finishToActivity(MainActivity.class, false);
});
}
} else {
Toast.makeText(con, status.getMsg(), Toast.LENGTH_SHORT).show();
}
CacheGroup.cacheList.remove("orderStatus");
}
break; break;
case 13: case 13:
int index = Integer.valueOf((String) m.obj); int index = Integer.valueOf((String) m.obj);
@ -148,16 +184,18 @@ public class HuoYunDelActivity extends BaseAppCompatActivity {
car.setText("选择车辆:" + clb.getData().get(index).getCarNumber()); car.setText("选择车辆:" + clb.getData().get(index).getCarNumber());
cid = clb.getData().get(index).getCarId(); cid = clb.getData().get(index).getCarId();
break; break;
case 1111://安联用户验证通过接单 case 1111://安联用户验证通过接单
new XPopup.Builder(con) hyr.getOrderStatus(id);
.isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个 // new XPopup.Builder(con)
.asConfirm("请确认接单", "是否确定承运此运单?", // .isDestroyOnDismiss(true) //对于只使用一次的弹窗推荐设置这个
"取消", "确认", // .asConfirm("请确认接单", "是否确定承运此运单?",
() -> { // "取消", "确认",
Log.e("--id--", "cid:" + cid + "---wid:" + id); // () -> {
hyr.confirm(cid, id); // Log.e("--id--", "cid:" + cid + "---wid:" + id);
}, () -> customDialog.dismiss(), false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局 // hyr.confirm(cid, id);
.show(); // }, () -> customDialog.dismiss(), false, R.layout.alert_ok_cancel) //最后一个参数绑定已有布局
// .show();
break; break;
case 2222://安联用户验证不通过 case 2222://安联用户验证不通过
customDialog.dismiss(); customDialog.dismiss();

View File

@ -21,10 +21,13 @@ import com.alct.mdp.model.Image;
import com.alct.mdp.model.Location; import com.alct.mdp.model.Location;
import com.arpa.hndahesudintocctmsdriver.BuildConfig; import com.arpa.hndahesudintocctmsdriver.BuildConfig;
import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean; import com.arpa.hndahesudintocctmsdriver.bean.CarInfoBean;
import com.arpa.hndahesudintocctmsdriver.bean.WaybillStatusBean;
import com.arpa.hndahesudintocctmsdriver.cuspop.SimCenterPop;
import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent; import com.arpa.hndahesudintocctmsdriver.event.HomeWaybillEvent;
import com.arpa.hndahesudintocctmsdriver.report.ALProcess; import com.arpa.hndahesudintocctmsdriver.report.ALProcess;
import com.arpa.hndahesudintocctmsdriver.report.JTTProcess; import com.arpa.hndahesudintocctmsdriver.report.JTTProcess;
import com.arpa.hndahesudintocctmsdriver.request.OCRRequest; import com.arpa.hndahesudintocctmsdriver.request.OCRRequest;
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil; import com.arpa.hndahesudintocctmsdriver.util.BitmapUtil;
import com.arpa.hndahesudintocctmsdriver.util.MessageUtils; import com.arpa.hndahesudintocctmsdriver.util.MessageUtils;
import com.arpa.hndahesudintocctmsdriver.util.NfcUtils; import com.arpa.hndahesudintocctmsdriver.util.NfcUtils;
@ -35,6 +38,7 @@ import com.arpa.hndahesudintocctmsdriver.util.location.LocationUtil;
import com.baidu.mapapi.model.LatLng; import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.utils.CoordinateConverter; import com.baidu.mapapi.utils.CoordinateConverter;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.dahe.mylibrary.utils.ActivityUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.luck.picture.lib.PictureSelector; import com.luck.picture.lib.PictureSelector;
import com.luck.picture.lib.config.PictureConfig; import com.luck.picture.lib.config.PictureConfig;
@ -116,6 +120,28 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
} }
CacheGroup.cacheList.remove("upload"); CacheGroup.cacheList.remove("upload");
} }
if (CacheGroup.cacheList.get("waybillStatus") != null) {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss();
}
Log.e("waybillStatus", CacheGroup.cacheList.get("waybillStatus"));
WaybillStatusBean status = gson.fromJson(CacheGroup.cacheList.get("waybillStatus"), WaybillStatusBean.class);
if (status.getCode() == 200) {
if (status.getData() != null) {
//执行运单下一步操作
typeRequest();
} else {//订单已取消
new MessageUtils().showSimCenPop(con, "运单异常将无法进行下步操作,请返回首页", "取消", "确定", () -> {
SPUtils.remove(con, "curWaybillId");
EventBus.getDefault().post(new HomeWaybillEvent());
ActivityUtils.finishToActivity(MainActivity.class, false);
});
}
} else {
Toast.makeText(con, status.getMsg(), Toast.LENGTH_SHORT).show();
}
CacheGroup.cacheList.remove("waybillStatus");
}
for (int i = 0; i < TYPE_NAME.length; i++) { for (int i = 0; i < TYPE_NAME.length; i++) {
if (CacheGroup.cacheList.get(TYPE_NAME[i]) != null) { if (CacheGroup.cacheList.get(TYPE_NAME[i]) != null) {
BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[i]), BaseBean.class); BaseBean bb = gson.fromJson(CacheGroup.cacheList.get(TYPE_NAME[i]), BaseBean.class);
@ -302,7 +328,9 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
} }
submit.setOnClickListener(v -> { submit.setOnClickListener(v -> {
if (imgIds.size() != 0) { if (imgIds.size() != 0) {
typeRequest(); //判断运单是否已取消
hyr.getWaybillStatus(sob.getData().getWaybillId());
// typeRequest();
} else { } else {
Toast.makeText(con, "请先上传一张图片", Toast.LENGTH_SHORT).show(); Toast.makeText(con, "请先上传一张图片", Toast.LENGTH_SHORT).show();
} }
@ -651,7 +679,7 @@ public class ShangChuangImgActivity extends BaseAppCompatActivity {
if (!isFinishing() && customDialog != null && customDialog.isShowing()) { if (!isFinishing() && customDialog != null && customDialog.isShowing()) {
customDialog.dismiss(); customDialog.dismiss();
} }
SPUtils.remove(con,"curWaybillId"); SPUtils.remove(con, "curWaybillId");
EventBus.getDefault().post(new HomeWaybillEvent()); EventBus.getDefault().post(new HomeWaybillEvent());
Log.e("上报安联", "回单照片上传成功"); Log.e("上报安联", "回单照片上传成功");
Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show(); Toast.makeText(con, "上传成功", Toast.LENGTH_SHORT).show();