Commit 6b48e616 by mReturn

服务工单备件发货功能开发

parent 71bcc145
......@@ -32,6 +32,7 @@ import com.dayu.order.api.protocol.bean.ServiceStationBean;
import com.dayu.order.api.protocol.bean.SopListBean;
import com.dayu.order.api.protocol.companyManager;
import com.dayu.order.api.protocol.data.AddDialRecordData;
import com.dayu.order.api.protocol.data.PartSendData;
import com.dayu.order.api.protocol.data.ReceivePartData;
import com.dayu.order.api.protocol.data.SendPartData;
import com.dayu.order.common.OrderConstant;
......@@ -498,8 +499,14 @@ public interface OrderService {
/**
* 工单向商家发送备件
*/
@POST(Constants.API_7700 + "/spSendOutGoods/engineerSave")
Observable<BaseResponse<Boolean>> sendPart(@Body PartSendData data);
/**
* 工单向商家发送备件(旧版)
*/
@POST(Constants.API_7200 + "/ordersLogistics")
Observable<BaseResponse<Boolean>> sendPart(@Body SendPartData data);
Observable<BaseResponse<Boolean>> sendPartOld(@Body SendPartData data);
/**
* 备件收货
......
package com.dayu.order.api.protocol.data;
public class PartSendData {
public int orderId; //工单ID ,
public String orderNum; //工单编号
public int pointToPoint = 2; //发送方向 2engineer_to_sp ,
public String receiverAddress; //详细地址 ,
public String receiverMobile; //收货人手机号 ,
public String receiverName; //收货人 ,
public String sendPicUrl; //发货图片
public String sendAddress; //发货人地址 ,
public String sendCourierNumber; //发货方发货快递公司单号
public String sendCourierCompany; //发货方发货快递公司 ,
public String sendShipperCode; //发货方发货快递公司编码
public String sendMobile; //发货人手机号 ,
public String sendName; //发货人 ,
public String sendStoreName; //发货方(对于服务商/服务站,记录服务商/服务站名。对于师傅端记录师傅名称) ,
public int sendType = 2; //2其他 ,
public String sparePartName; //备件的名称/发货清单 ,
public int status = 2; //2已发货
public int sendStoreId; //发货库ID , (服务商 createdproviderid 服务站 sitid 大鱼 -1)
public int sendStoreType; //1总库(服务商) 2分库(服务站【自营的和授权的服务站】)
public PartSendData() {
}
public PartSendData(int orderId, String orderNum, String receiverAddress, String receiverMobile,
String receiverName, String sendPicUrl, String sendAddress,
String sendCourierNumber, String sendCourierCompany, String sendShipperCode,
String sendMobile, String sendName, String sendStoreName, String sparePartName,
int sendStoreId, int sendStoreType) {
this.orderId = orderId;
this.orderNum = orderNum;
this.receiverAddress = receiverAddress;
this.receiverMobile = receiverMobile;
this.receiverName = receiverName;
this.sendPicUrl = sendPicUrl;
this.sendAddress = sendAddress;
this.sendCourierNumber = sendCourierNumber;
this.sendCourierCompany = sendCourierCompany;
this.sendShipperCode = sendShipperCode;
this.sendMobile = sendMobile;
this.sendName = sendName;
this.sendStoreName = sendStoreName;
this.sparePartName = sparePartName;
this.sendStoreId = sendStoreId;
this.sendStoreType = sendStoreType;
}
}
......@@ -15,8 +15,10 @@ import com.dayu.order.api.OrderService;
import com.dayu.order.api.protocol.OrderDetail;
import com.dayu.order.api.protocol.ShipperCompany;
import com.dayu.order.api.protocol.bean.OrderPardDeatilBean;
import com.dayu.order.api.protocol.data.PartSendData;
import com.dayu.order.api.protocol.data.SendPartData;
import com.dayu.order.common.PartSendEvent;
import com.dayu.utils.CommonUtils;
import com.dayu.utils.ToastUtils;
import com.dayu.utils.UserManager;
......@@ -38,6 +40,9 @@ public class PartSendPresenter extends PartSendContract.Presenter {
private String mShipperCode;
private UserInfo mUser;
private boolean canEdit;
private int sendStoreId = -1;
private int sendStoreType = -1;
private String useAddress;
@Override
......@@ -53,9 +58,13 @@ public class PartSendPresenter extends PartSendContract.Presenter {
return;
}
if (mDetail.getSource() == 1) {
sendStoreType = 2;
sendStoreId = mDetail.getSiteId();
mView.showDialog();
getStationInfo();
} else if (mDetail.getSource() == 5 || mDetail.getSource() == 6) {
sendStoreType = 1;
sendStoreId = mDetail.getCreateProviderId();
mView.showDialog();
getProviderInfo();
} else {
......@@ -64,6 +73,17 @@ public class PartSendPresenter extends PartSendContract.Presenter {
contacter.set("大鱼云服");
contactPhone.set("400-0086-898");
}
getUserAddrData();
}
//获取用户地址
private void getUserAddrData() {
Api.getService(APIService.class).getAddressInfo(Integer.parseInt(mUser.getAccountId())).compose(Api.applySchedulers())
.subscribe(baseObserver(data -> {
useAddress = data.getProvinceName()+" "+data.getCityName()
+" "+data.getDistrictName()+" "+data.getAddress();
}));
}
//获取发货详情
......@@ -193,6 +213,25 @@ public class PartSendPresenter extends PartSendContract.Presenter {
//发货
private void sendPart(List<String> imgs) {
String picUrl = CommonUtils.list2String(imgs);
mView.showDialog();
PartSendData sendData = new PartSendData(mDetail.getId(),mDetail.getOrderNum(),address.get(),contactPhone.get(),
contacter.get(),picUrl,useAddress,courierNum.get(),courierCompany.get(),mShipperCode,
mUser.getMobile(),mUser.getAccountName(),mUser.getAccountName(),goodsListStr.get(),sendStoreId,sendStoreType);
Api.getService(OrderService.class).sendPart(sendData).compose(Api.applySchedulers())
.subscribe(baseObserver(success -> {
if (success) {
ToastUtils.showShortToast("发送成功");
EventBus.getDefault().post(new PartSendEvent());
mView.dumpBack();
} else {
ToastUtils.showShortToast("发送失败");
}
}));
}
//发货(旧版废弃)
private void sendPartOld(List<String> imgs) {
mView.showDialog();
List<SendPartData.PicItem> pics = new ArrayList<>();
if (imgs != null && imgs.size() > 0) {
......@@ -206,7 +245,7 @@ public class PartSendPresenter extends PartSendContract.Presenter {
address.get(), contactPhone.get(), contacter.get(), mUser.getSiteId(), goodsListStr.get(),
mUser.getMobile(), mUser.getAccountName(), mShipperCode);
sendData.receiveOrg = company.get();
Api.getService(OrderService.class).sendPart(sendData).compose(Api.applySchedulers())
Api.getService(OrderService.class).sendPartOld(sendData).compose(Api.applySchedulers())
.subscribe(baseObserver(success -> {
if (success) {
ToastUtils.showShortToast("发送成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment