完善视频号小店电子面单打印
This commit is contained in:
parent
90443ce3ec
commit
68ce2785c5
Binary file not shown.
|
|
@ -32,9 +32,9 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>wei-api</groupId>
|
<groupId>wei-api</groupId>
|
||||||
<artifactId>wei-api</artifactId>
|
<artifactId>wei-api</artifactId>
|
||||||
<version>1.6.3</version>
|
<version>1.6.20</version>
|
||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/libs/wei-api-1.6.3.jar</systemPath>
|
<systemPath>${project.basedir}/libs/wei-api-1.6.20.jar</systemPath>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
package com.qihang.wei.controller;
|
package com.qihang.wei.controller;
|
||||||
|
|
||||||
|
import cn.qihangerp.open.wei.EwaybillAccountApiHelper;
|
||||||
import cn.qihangerp.open.wei.EwaybillApiHelper;
|
import cn.qihangerp.open.wei.EwaybillApiHelper;
|
||||||
|
import cn.qihangerp.open.wei.bo.ewaybill.EcOrderInfo;
|
||||||
|
import cn.qihangerp.open.wei.bo.ewaybill.GoodsInfo;
|
||||||
|
import cn.qihangerp.open.wei.bo.ewaybill.SenderAddressBo;
|
||||||
|
import cn.qihangerp.open.wei.bo.ewaybill.WaybillRequest;
|
||||||
import cn.qihangerp.open.wei.common.ApiResultVo;
|
import cn.qihangerp.open.wei.common.ApiResultVo;
|
||||||
import cn.qihangerp.open.wei.vo.ewaybill.AccountVo;
|
import cn.qihangerp.open.wei.vo.ewaybill.AccountVo;
|
||||||
import cn.qihangerp.open.wei.vo.ewaybill.DeliveryVo;
|
import cn.qihangerp.open.wei.vo.ewaybill.DeliveryVo;
|
||||||
|
import cn.qihangerp.open.wei.vo.ewaybill.EwaybillOrderCreateVo;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.qihang.common.common.AjaxResult;
|
import com.qihang.common.common.AjaxResult;
|
||||||
|
|
@ -12,7 +18,11 @@ import com.qihang.common.enums.HttpStatus;
|
||||||
import com.qihang.wei.bo.PullRequest;
|
import com.qihang.wei.bo.PullRequest;
|
||||||
|
|
||||||
import com.qihang.wei.bo.WeiWaybillGetBo;
|
import com.qihang.wei.bo.WeiWaybillGetBo;
|
||||||
|
import com.qihang.wei.domain.ErpShipWaybill;
|
||||||
|
import com.qihang.wei.domain.OmsWeiOrder;
|
||||||
import com.qihang.wei.domain.OmsWeiWaybillAccount;
|
import com.qihang.wei.domain.OmsWeiWaybillAccount;
|
||||||
|
import com.qihang.wei.service.ErpShipWaybillService;
|
||||||
|
import com.qihang.wei.service.OmsWeiOrderService;
|
||||||
import com.qihang.wei.service.OmsWeiWaybillAccountService;
|
import com.qihang.wei.service.OmsWeiWaybillAccountService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
|
|
@ -30,6 +40,8 @@ import java.util.List;
|
||||||
public class WayBillController {
|
public class WayBillController {
|
||||||
private final WeiApiCommon apiCommon;
|
private final WeiApiCommon apiCommon;
|
||||||
private final OmsWeiWaybillAccountService waybillAccountService;
|
private final OmsWeiWaybillAccountService waybillAccountService;
|
||||||
|
private final OmsWeiOrderService orderService;
|
||||||
|
private final ErpShipWaybillService erpShipWaybillService;
|
||||||
@RequestMapping(value = "/get_waybill_account_list", method = RequestMethod.POST)
|
@RequestMapping(value = "/get_waybill_account_list", method = RequestMethod.POST)
|
||||||
public AjaxResult getWaybillAccountList(@RequestBody PullRequest params) throws Exception {
|
public AjaxResult getWaybillAccountList(@RequestBody PullRequest params) throws Exception {
|
||||||
if (params.getShopId() == null || params.getShopId() <= 0) {
|
if (params.getShopId() == null || params.getShopId() <= 0) {
|
||||||
|
|
@ -57,7 +69,7 @@ public class WayBillController {
|
||||||
String appSecret = checkResult.getData().getAppSecret();
|
String appSecret = checkResult.getData().getAppSecret();
|
||||||
|
|
||||||
// ApiResultVo<DeliveryVo> apiResultVo = EwaybillApiHelper.getDeliveryList(appKey, appSecret, accessToken);
|
// ApiResultVo<DeliveryVo> apiResultVo = EwaybillApiHelper.getDeliveryList(appKey, appSecret, accessToken);
|
||||||
ApiResultVo<AccountVo> apiResultVo = EwaybillApiHelper.getAccountList(appKey, appSecret, accessToken);
|
ApiResultVo<AccountVo> apiResultVo = EwaybillAccountApiHelper.getAccountList(appKey, appSecret, accessToken);
|
||||||
|
|
||||||
List<OmsWeiWaybillAccount> list = new ArrayList<>();
|
List<OmsWeiWaybillAccount> list = new ArrayList<>();
|
||||||
if(apiResultVo.getCode()==0){
|
if(apiResultVo.getCode()==0){
|
||||||
|
|
@ -85,6 +97,11 @@ public class WayBillController {
|
||||||
vo.setSenderCity(item.getSenderAddress().getCity());
|
vo.setSenderCity(item.getSenderAddress().getCity());
|
||||||
vo.setSenderCounty(item.getSenderAddress().getCounty());
|
vo.setSenderCounty(item.getSenderAddress().getCounty());
|
||||||
}
|
}
|
||||||
|
if(item.getSiteInfo()!=null){
|
||||||
|
vo.setSiteCode(item.getSiteInfo().getSiteCode());
|
||||||
|
vo.setSiteName(item.getSiteInfo().getSiteName());
|
||||||
|
vo.setSenderStreet(item.getSiteInfo().getAddress().getStreetName());
|
||||||
|
}
|
||||||
list.add(vo);
|
list.add(vo);
|
||||||
waybillAccountService.save(vo);
|
waybillAccountService.save(vo);
|
||||||
log.info("========添加wei电子面单账户信息==========");
|
log.info("========添加wei电子面单账户信息==========");
|
||||||
|
|
@ -106,11 +123,11 @@ public class WayBillController {
|
||||||
if (req.getShopId() == null || req.getShopId() <= 0) {
|
if (req.getShopId() == null || req.getShopId() <= 0) {
|
||||||
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||||
}
|
}
|
||||||
if(req.getIds()==null || req.getIds().length<=0) {
|
if (req.getIds() == null || req.getIds().length <= 0) {
|
||||||
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
|
||||||
}
|
}
|
||||||
var checkResult = apiCommon.checkBefore(req.getShopId());
|
var checkResult = apiCommon.checkBefore(req.getShopId());
|
||||||
if (checkResult.getCode() != HttpStatus.SUCCESS) {
|
if (checkResult.getCode() != 0) {
|
||||||
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
|
return AjaxResult.error(checkResult.getCode(), checkResult.getMsg(), checkResult.getData());
|
||||||
}
|
}
|
||||||
String accessToken = checkResult.getData().getAccessToken();
|
String accessToken = checkResult.getData().getAccessToken();
|
||||||
|
|
@ -121,85 +138,126 @@ public class WayBillController {
|
||||||
// 获取电子面单账户信息(包含了发货地址信息)
|
// 获取电子面单账户信息(包含了发货地址信息)
|
||||||
OmsWeiWaybillAccount account = waybillAccountService.getById(req.getAccountId());
|
OmsWeiWaybillAccount account = waybillAccountService.getById(req.getAccountId());
|
||||||
|
|
||||||
// WaybillCloudPrintApplyNewRequest request = new WaybillCloudPrintApplyNewRequest();
|
WaybillRequest apiBo = new WaybillRequest();
|
||||||
// request.setCp_code(account.getCpCode());
|
|
||||||
//
|
apiBo.setDelivery_id(account.getDeliveryId());
|
||||||
// WaybillCloudPrintApplyNewRequestSender sender = new WaybillCloudPrintApplyNewRequestSender();
|
apiBo.setEwaybill_acct_id(account.getAcctId());
|
||||||
// sender.setName(account.getName());
|
|
||||||
// sender.setMobile(account.getMobile());
|
SenderAddressBo sender = new SenderAddressBo();
|
||||||
// WaybillCloudPrintApplyNewRequestSender.AddressDTO addressDTO = new WaybillCloudPrintApplyNewRequestSender.AddressDTO();
|
sender.setName(account.getName());
|
||||||
// addressDTO.setCity(account.getCity());
|
sender.setMobile(account.getMobile());
|
||||||
// addressDTO.setProvince(account.getProvince());
|
sender.setProvince(account.getSenderProvince());
|
||||||
// addressDTO.setDistrict(account.getArea());
|
sender.setCity(account.getSenderCity());
|
||||||
// addressDTO.setTown("");
|
sender.setCounty(account.getSenderCounty());
|
||||||
// addressDTO.setDetail(account.getAddressDetail());
|
sender.setStreet(account.getSenderStreet());
|
||||||
// sender.setAddress(addressDTO);
|
sender.setAddress(account.getSenderAddress());
|
||||||
// request.setSender(sender);
|
apiBo.setSender(sender);
|
||||||
//
|
|
||||||
// // 组合取号的订单信息trade_order_info_dtos
|
for (String orderId : req.getIds()) {
|
||||||
// List<WaybillCloudPrintApplyNewRequestTradeOrderInfoDto> orderList = new ArrayList<>();
|
if (StringUtils.hasText(orderId)) {
|
||||||
//
|
OmsWeiOrder order = orderService.queryDetailByOrderId(orderId);
|
||||||
// for(String orderId:req.getIds()){
|
if (order != null) {
|
||||||
// if(StringUtils.hasText(orderId)){
|
|
||||||
// OmsTaoOrder omsTaoOrder = orderService.queryDetailByTid(orderId);
|
SenderAddressBo receiver = new SenderAddressBo();
|
||||||
// if(omsTaoOrder!=null) {
|
receiver.setName(order.getUserName());
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto dto = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto();
|
receiver.setMobile(order.getTelNumber());
|
||||||
// dto.setObjectId(omsTaoOrder.getTid());
|
receiver.setProvince(order.getProvinceName());
|
||||||
// dto.setTemplateUrl("http://cloudprint.cainiao.com/template/standard/101");
|
receiver.setCity(order.getCityName());
|
||||||
// dto.setUserId(sellerShopId.intValue());
|
receiver.setCounty(order.getCountyName());
|
||||||
//
|
receiver.setStreet("");
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO orderInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.OrderInfoDTO();
|
receiver.setAddress("****");
|
||||||
// orderInfoDTO.setOrderChannelsType("TB");
|
apiBo.setReceiver(receiver);
|
||||||
// orderInfoDTO.setTradeOrderList(omsTaoOrder.getTid());
|
|
||||||
// dto.setOrderInfo(orderInfoDTO);
|
List<EcOrderInfo> orderInfos = new ArrayList<>();
|
||||||
//
|
// 订单信息
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO packageInfoDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO();
|
EcOrderInfo orderInfo = new EcOrderInfo();
|
||||||
// List<WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO> items = new ArrayList<>();
|
orderInfo.setEc_order_id(Long.parseLong(order.getOrderId()));
|
||||||
// for (var orderItem : omsTaoOrder.getItems()) {
|
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO itemsDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.PackageInfoDTO.ItemsDTO();
|
List<GoodsInfo> goodsInfos = new ArrayList<>();
|
||||||
// itemsDTO.setCount(orderItem.getNum());
|
if(order.getItems()!=null&&order.getItems().size()>0) {
|
||||||
// itemsDTO.setName(orderItem.getTitle());
|
for (var item:order.getItems()) {
|
||||||
// items.add(itemsDTO);
|
GoodsInfo gi = new GoodsInfo();
|
||||||
// }
|
gi.setProduct_id(Long.parseLong(item.getProductId()));
|
||||||
// packageInfoDTO.setItems(items);
|
gi.setSku_id(Long.parseLong(item.getSkuId()));
|
||||||
// dto.setPackageInfo(packageInfoDTO);
|
gi.setGood_name(item.getTitle());
|
||||||
//
|
gi.setGood_count(item.getSkuCnt());
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO recipientDTO = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO();
|
goodsInfos.add(gi);
|
||||||
// WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO addressDTO1 = new WaybillCloudPrintApplyNewRequestTradeOrderInfoDto.RecipientDTO.AddressDTO();
|
}
|
||||||
// addressDTO1.setCity(omsTaoOrder.getReceiverCity());
|
|
||||||
// addressDTO1.setTown(omsTaoOrder.getReceiverTown());
|
}
|
||||||
// addressDTO1.setProvince(omsTaoOrder.getReceiverState());
|
|
||||||
// addressDTO1.setDistrict(omsTaoOrder.getReceiverDistrict());
|
orderInfo.setGoods_list(goodsInfos);
|
||||||
// addressDTO1.setDetail(omsTaoOrder.getReceiverAddress());
|
orderInfos.add(orderInfo);
|
||||||
// recipientDTO.setAddress(addressDTO1);
|
|
||||||
// recipientDTO.setName(omsTaoOrder.getReceiverName());
|
apiBo.setEc_order_list(orderInfos);
|
||||||
// recipientDTO.setOaid(omsTaoOrder.getOaid());
|
|
||||||
// recipientDTO.setTid(omsTaoOrder.getTid());
|
apiBo.setShop_id(account.getSellerShopId());
|
||||||
// dto.setRecipient(recipientDTO);
|
|
||||||
// orderList.add(dto);
|
ApiResultVo<EwaybillOrderCreateVo> apiResultVo = EwaybillApiHelper.getWaybillCode(appKey, appSecret, accessToken, apiBo);
|
||||||
// }
|
if (apiResultVo.getCode() == 0) {
|
||||||
// }
|
// 保持数据
|
||||||
// }
|
ErpShipWaybill waybill = new ErpShipWaybill();
|
||||||
//
|
waybill.setShopId(req.getShopId());
|
||||||
// request.setTrade_order_info_dtos(orderList);
|
waybill.setOrderId(order.getOrderId());
|
||||||
//
|
waybill.setWaybillOrderId(apiResultVo.getData().getEwaybill_order_id());
|
||||||
// ApiResultVo<WaybillCloudPrint> apiResultVo = WaybillApiHelper.waybillCloudPrintApplyNew(appKey, appSecret, accessToken, request);
|
waybill.setWaybillCode(apiResultVo.getData().getWaybill_id());
|
||||||
// if(apiResultVo.getCode()==0){
|
waybill.setLogisticsCode(account.getDeliveryId());
|
||||||
// // 保持数据
|
waybill.setPrintData(apiResultVo.getData().getPrint_info());
|
||||||
// for(var result: apiResultVo.getList()){
|
waybill.setStatus(1);//1已取号
|
||||||
// ErpShipWaybill waybill = new ErpShipWaybill();
|
erpShipWaybillService.waybillUpdate(waybill);
|
||||||
// waybill.setShopId(req.getShopId());
|
log.info("====保存wei電子面單信息========" + order.getOrderId());
|
||||||
// waybill.setOrderId(result.getObjectId());
|
|
||||||
// waybill.setWaybillCode(result.getWaybillCode());
|
} else {
|
||||||
// waybill.setLogisticsCode(result.getCpCode());
|
return AjaxResult.error(apiResultVo.getMsg());
|
||||||
// waybill.setPrintData(result.getPrintData());
|
}
|
||||||
// waybill.setStatus(1);//1已取号
|
}
|
||||||
// erpShipWaybillService.waybillUpdate(waybill);
|
}
|
||||||
// log.info("====保存電子面單信息========"+result.getObjectId());
|
}
|
||||||
// }
|
return AjaxResult.success();
|
||||||
// }else{
|
}
|
||||||
// return AjaxResult.error(apiResultVo.getMsg());
|
|
||||||
// }
|
@PostMapping("/get_print_data")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult getPrintData(@RequestBody WeiWaybillGetBo req) {
|
||||||
|
if (req.getShopId() == null || req.getShopId() <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||||
|
}
|
||||||
|
if (req.getIds() == null || req.getIds().length <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
|
||||||
|
}
|
||||||
|
List<ErpShipWaybill> listByOrderIds = erpShipWaybillService.getListByOrderIds(req.getShopId(), req.getIds());
|
||||||
|
return AjaxResult.success(listByOrderIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/push_print_success")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult pushPrintSuccess(@RequestBody WeiWaybillGetBo req) {
|
||||||
|
if (req.getShopId() == null || req.getShopId() <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||||
|
}
|
||||||
|
if (req.getIds() == null || req.getIds().length <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
|
||||||
|
}
|
||||||
|
erpShipWaybillService.printSuccess(req.getShopId(), req.getIds());
|
||||||
|
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/push_ship_send")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult pushShipSend(@RequestBody WeiWaybillGetBo req) {
|
||||||
|
if (req.getShopId() == null || req.getShopId() <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有店铺Id");
|
||||||
|
}
|
||||||
|
if (req.getIds() == null || req.getIds().length <= 0) {
|
||||||
|
return AjaxResult.error(HttpStatus.PARAMS_ERROR, "参数错误,没有选择订单");
|
||||||
|
}
|
||||||
|
erpShipWaybillService.pushShipSend(req.getShopId(), req.getIds());
|
||||||
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.qihang.wei.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货电子面单记录表
|
||||||
|
* @TableName erp_ship_waybill
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ErpShipWaybill implements Serializable {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺类型
|
||||||
|
*/
|
||||||
|
private Integer shopType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递单号
|
||||||
|
*/
|
||||||
|
private String waybillCode;
|
||||||
|
private String waybillOrderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 快递公司编码
|
||||||
|
*/
|
||||||
|
private String logisticsCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印数据
|
||||||
|
*/
|
||||||
|
private String printData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1已取号2已打印3已发货)
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
|
|
@ -38,6 +38,16 @@ public class OmsWeiWaybillAccount implements Serializable {
|
||||||
*/
|
*/
|
||||||
private Integer companyType;
|
private Integer companyType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网点编码
|
||||||
|
*/
|
||||||
|
private String siteCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网点名称
|
||||||
|
*/
|
||||||
|
private String siteName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电子面单账号id,每绑定一个网点分配一个acct_id
|
* 电子面单账号id,每绑定一个网点分配一个acct_id
|
||||||
*/
|
*/
|
||||||
|
|
@ -98,6 +108,11 @@ public class OmsWeiWaybillAccount implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String senderCounty;
|
private String senderCounty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String senderStreet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详细地址
|
* 详细地址
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.qihang.wei.mapper;
|
||||||
|
|
||||||
|
import com.qihang.wei.domain.ErpShipWaybill;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TW
|
||||||
|
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Mapper
|
||||||
|
* @createDate 2024-06-20 10:05:35
|
||||||
|
* @Entity com.qihang.wei.domain.ErpShipWaybill
|
||||||
|
*/
|
||||||
|
public interface ErpShipWaybillMapper extends BaseMapper<ErpShipWaybill> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Mapper
|
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Mapper
|
||||||
* @createDate 2024-06-19 17:08:54
|
* @createDate 2024-06-20 09:18:48
|
||||||
* @Entity com.qihang.wei.domain.OmsWeiWaybillAccount
|
* @Entity com.qihang.wei.domain.OmsWeiWaybillAccount
|
||||||
*/
|
*/
|
||||||
public interface OmsWeiWaybillAccountMapper extends BaseMapper<OmsWeiWaybillAccount> {
|
public interface OmsWeiWaybillAccountMapper extends BaseMapper<OmsWeiWaybillAccount> {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.qihang.wei.service;
|
||||||
|
|
||||||
|
import com.qihang.common.common.ResultVo;
|
||||||
|
import com.qihang.wei.domain.ErpShipWaybill;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TW
|
||||||
|
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service
|
||||||
|
* @createDate 2024-06-20 10:05:35
|
||||||
|
*/
|
||||||
|
public interface ErpShipWaybillService extends IService<ErpShipWaybill> {
|
||||||
|
ResultVo<Integer> waybillUpdate(ErpShipWaybill shipWaybill);
|
||||||
|
List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds);
|
||||||
|
|
||||||
|
ResultVo<Integer> printSuccess(Long shopId,String[] orderIds);
|
||||||
|
ResultVo<Integer> pushShipSend(Long shopId,String[] orderIds);
|
||||||
|
}
|
||||||
|
|
@ -16,5 +16,5 @@ public interface OmsWeiOrderService extends IService<OmsWeiOrder> {
|
||||||
PageResult<OmsWeiOrder> queryPageList(OmsWeiOrder bo, PageQuery pageQuery);
|
PageResult<OmsWeiOrder> queryPageList(OmsWeiOrder bo, PageQuery pageQuery);
|
||||||
ResultVo<Integer> saveOrder(Long shopId, OmsWeiOrder order);
|
ResultVo<Integer> saveOrder(Long shopId, OmsWeiOrder order);
|
||||||
OmsWeiOrder queryDetailById(Long id);
|
OmsWeiOrder queryDetailById(Long id);
|
||||||
|
OmsWeiOrder queryDetailByOrderId(String orderId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Service
|
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Service
|
||||||
* @createDate 2024-06-19 17:08:54
|
* @createDate 2024-06-20 09:18:48
|
||||||
*/
|
*/
|
||||||
public interface OmsWeiWaybillAccountService extends IService<OmsWeiWaybillAccount> {
|
public interface OmsWeiWaybillAccountService extends IService<OmsWeiWaybillAccount> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.qihang.wei.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.qihang.common.common.ResultVo;
|
||||||
|
import com.qihang.common.enums.EnumShopType;
|
||||||
|
import com.qihang.common.mq.MqMessage;
|
||||||
|
import com.qihang.common.mq.MqType;
|
||||||
|
import com.qihang.wei.domain.ErpShipWaybill;
|
||||||
|
import com.qihang.wei.domain.OmsWeiOrder;
|
||||||
|
import com.qihang.wei.mapper.OmsWeiOrderMapper;
|
||||||
|
import com.qihang.wei.service.ErpShipWaybillService;
|
||||||
|
import com.qihang.wei.mapper.ErpShipWaybillMapper;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TW
|
||||||
|
* @description 针对表【erp_ship_waybill(发货电子面单记录表)】的数据库操作Service实现
|
||||||
|
* @createDate 2024-06-20 10:05:35
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class ErpShipWaybillServiceImpl extends ServiceImpl<ErpShipWaybillMapper, ErpShipWaybill>
|
||||||
|
implements ErpShipWaybillService{
|
||||||
|
private final ErpShipWaybillMapper mapper;
|
||||||
|
private final OmsWeiOrderMapper orderMapper;
|
||||||
|
private final KafkaTemplate<String,Object> kafkaTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新电子面单信息
|
||||||
|
* @param shipWaybill
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ResultVo<Integer> waybillUpdate(ErpShipWaybill shipWaybill) {
|
||||||
|
String orderId= shipWaybill.getOrderId();
|
||||||
|
if(shipWaybill.getId()!=null&&shipWaybill.getId()>0){
|
||||||
|
// 存在,修改
|
||||||
|
shipWaybill.setCreateBy(null);
|
||||||
|
shipWaybill.setCreateTime(null);
|
||||||
|
shipWaybill.setOrderId(null);
|
||||||
|
shipWaybill.setShopId(null);
|
||||||
|
shipWaybill.setShopType(null);
|
||||||
|
mapper.updateById(shipWaybill);
|
||||||
|
}else{
|
||||||
|
// 新增
|
||||||
|
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(new LambdaQueryWrapper<ErpShipWaybill>().eq(ErpShipWaybill::getOrderId, orderId));
|
||||||
|
if(erpShipWaybills==null|| erpShipWaybills.size()==0) {
|
||||||
|
shipWaybill.setStatus(1);//已取号
|
||||||
|
shipWaybill.setShopType(EnumShopType.TAO.getIndex());
|
||||||
|
shipWaybill.setCreateTime(new Date());
|
||||||
|
mapper.insert(shipWaybill);
|
||||||
|
}else{
|
||||||
|
ErpShipWaybill update = new ErpShipWaybill();
|
||||||
|
update.setId(erpShipWaybills.get(0).getId());
|
||||||
|
update.setWaybillCode(shipWaybill.getWaybillCode());
|
||||||
|
update.setLogisticsCode(shipWaybill.getLogisticsCode());
|
||||||
|
update.setPrintData(shipWaybill.getPrintData());
|
||||||
|
update.setStatus(1);
|
||||||
|
update.setUpdateTime(new Date());
|
||||||
|
update.setUpdateBy("重新取号");
|
||||||
|
mapper.updateById(update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 更新关联订单erp_send_status状态
|
||||||
|
OmsWeiOrder orderUpdate = new OmsWeiOrder();
|
||||||
|
orderUpdate.setErpSendStatus(shipWaybill.getStatus());
|
||||||
|
orderUpdate.setErpSendCode(shipWaybill.getWaybillCode());
|
||||||
|
orderUpdate.setErpSendCompany(shipWaybill.getLogisticsCode());
|
||||||
|
orderMapper.update(orderUpdate,new LambdaQueryWrapper<OmsWeiOrder>().eq(OmsWeiOrder::getOrderId,orderId));
|
||||||
|
|
||||||
|
return ResultVo.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds) {
|
||||||
|
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
|
||||||
|
new LambdaQueryWrapper<ErpShipWaybill>()
|
||||||
|
.eq(ErpShipWaybill::getShopId,shopId)
|
||||||
|
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
|
||||||
|
return erpShipWaybills;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ResultVo<Integer> printSuccess(Long shopId, String[] orderIds) {
|
||||||
|
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
|
||||||
|
new LambdaQueryWrapper<ErpShipWaybill>()
|
||||||
|
.eq(ErpShipWaybill::getShopId,shopId)
|
||||||
|
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
|
||||||
|
if(erpShipWaybills!=null){
|
||||||
|
for (var w : erpShipWaybills){
|
||||||
|
if(w.getStatus()==1) {
|
||||||
|
ErpShipWaybill update = new ErpShipWaybill();
|
||||||
|
update.setId(erpShipWaybills.get(0).getId());
|
||||||
|
update.setStatus(2);
|
||||||
|
update.setUpdateTime(new Date());
|
||||||
|
update.setUpdateBy("打印面单");
|
||||||
|
mapper.updateById(update);
|
||||||
|
|
||||||
|
// 更新关联订单erp_send_status状态
|
||||||
|
OmsWeiOrder orderUpdate = new OmsWeiOrder();
|
||||||
|
orderUpdate.setErpSendStatus(update.getStatus());
|
||||||
|
|
||||||
|
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsWeiOrder>().eq(OmsWeiOrder::getOrderId, w.getOrderId()));
|
||||||
|
|
||||||
|
//TODO: 打印成功之后 加入备货清单 采用kafka推送消息处理
|
||||||
|
|
||||||
|
// 打印完成,通知备货
|
||||||
|
kafkaTemplate.send(MqType.SHIP_STOCK_UP_MQ, JSONObject.toJSONString(MqMessage.build(w.getShopId(), w.getOrderId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResultVo.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public ResultVo<Integer> pushShipSend(Long shopId, String[] orderIds) {
|
||||||
|
List<ErpShipWaybill> erpShipWaybills = mapper.selectList(
|
||||||
|
new LambdaQueryWrapper<ErpShipWaybill>()
|
||||||
|
.eq(ErpShipWaybill::getShopId,shopId)
|
||||||
|
.in(ErpShipWaybill::getOrderId, Arrays.stream(orderIds).toList()));
|
||||||
|
if(erpShipWaybills!=null){
|
||||||
|
for (var w : erpShipWaybills){
|
||||||
|
if(w.getStatus() > 0 && w.getStatus()<3) {
|
||||||
|
ErpShipWaybill update = new ErpShipWaybill();
|
||||||
|
update.setId(erpShipWaybills.get(0).getId());
|
||||||
|
update.setStatus(3);// 已发货
|
||||||
|
update.setUpdateTime(new Date());
|
||||||
|
update.setUpdateBy("电子面单发货");
|
||||||
|
mapper.updateById(update);
|
||||||
|
|
||||||
|
// 更新关联订单erp_send_status状态
|
||||||
|
OmsWeiOrder orderUpdate = new OmsWeiOrder();
|
||||||
|
orderUpdate.setErpSendStatus(update.getStatus());
|
||||||
|
|
||||||
|
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsWeiOrder>().eq(OmsWeiOrder::getOrderId, w.getOrderId()));
|
||||||
|
|
||||||
|
// 更新erp_sale_order发货状态(controller层采用kafka推送消息处理)
|
||||||
|
// 发货完成,通知发货出库
|
||||||
|
kafkaTemplate.send(MqType.SHIP_SEND_MQ, JSONObject.toJSONString(MqMessage.build(w.getShopId(),w.getOrderId(),w.getLogisticsCode(),w.getWaybillCode())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResultVo.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -123,7 +123,14 @@ public class OmsWeiOrderServiceImpl extends ServiceImpl<OmsWeiOrderMapper, OmsWe
|
||||||
}
|
}
|
||||||
return weiOrder;
|
return weiOrder;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public OmsWeiOrder queryDetailByOrderId(String orderId) {
|
||||||
|
List<OmsWeiOrder> weiOrders = mapper.selectList(new LambdaQueryWrapper<OmsWeiOrder>().eq(OmsWeiOrder::getOrderId,orderId));
|
||||||
|
if(weiOrders!=null&&weiOrders.size()>0){
|
||||||
|
weiOrders.get(0).setItems(itemMapper.selectList(new LambdaQueryWrapper<OmsWeiOrderItem>().eq(OmsWeiOrderItem::getOrderId,orderId)));
|
||||||
|
return weiOrders.get(0);
|
||||||
|
}else return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
|
||||||
/**
|
/**
|
||||||
* @author TW
|
* @author TW
|
||||||
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Service实现
|
* @description 针对表【oms_wei_waybill_account(视频号小店电子面单账户信息表)】的数据库操作Service实现
|
||||||
* @createDate 2024-06-19 17:08:54
|
* @createDate 2024-06-20 09:18:48
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class OmsWeiWaybillAccountServiceImpl extends ServiceImpl<OmsWeiWaybillAccountMapper, OmsWeiWaybillAccount>
|
public class OmsWeiWaybillAccountServiceImpl extends ServiceImpl<OmsWeiWaybillAccountMapper, OmsWeiWaybillAccount>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.qihang.wei.mapper.ErpShipWaybillMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="com.qihang.wei.domain.ErpShipWaybill">
|
||||||
|
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||||
|
<result property="orderId" column="order_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="shopId" column="shop_id" jdbcType="BIGINT"/>
|
||||||
|
<result property="shopType" column="shop_type" jdbcType="INTEGER"/>
|
||||||
|
<result property="waybillCode" column="waybill_code" jdbcType="VARCHAR"/>
|
||||||
|
<result property="waybillOrderId" column="waybill_order_id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="logisticsCode" column="logistics_code" jdbcType="VARCHAR"/>
|
||||||
|
<result property="printData" column="print_data" jdbcType="VARCHAR"/>
|
||||||
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||||
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id,order_id,shop_id,
|
||||||
|
shop_type,waybill_code,waybill_order_id,logistics_code,
|
||||||
|
print_data,status,create_time,
|
||||||
|
create_by,update_time,update_by
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
<result property="sellerShopId" column="seller_shop_id" jdbcType="BIGINT"/>
|
||||||
<result property="deliveryId" column="delivery_id" jdbcType="VARCHAR"/>
|
<result property="deliveryId" column="delivery_id" jdbcType="VARCHAR"/>
|
||||||
<result property="companyType" column="company_type" jdbcType="INTEGER"/>
|
<result property="companyType" column="company_type" jdbcType="INTEGER"/>
|
||||||
|
<result property="siteCode" column="site_code" jdbcType="VARCHAR"/>
|
||||||
|
<result property="siteName" column="site_name" jdbcType="VARCHAR"/>
|
||||||
<result property="acctId" column="acct_id" jdbcType="BIGINT"/>
|
<result property="acctId" column="acct_id" jdbcType="BIGINT"/>
|
||||||
<result property="acctType" column="acct_type" jdbcType="INTEGER"/>
|
<result property="acctType" column="acct_type" jdbcType="INTEGER"/>
|
||||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||||
|
|
@ -22,6 +24,7 @@
|
||||||
<result property="senderProvince" column="sender_province" jdbcType="VARCHAR"/>
|
<result property="senderProvince" column="sender_province" jdbcType="VARCHAR"/>
|
||||||
<result property="senderCity" column="sender_city" jdbcType="VARCHAR"/>
|
<result property="senderCity" column="sender_city" jdbcType="VARCHAR"/>
|
||||||
<result property="senderCounty" column="sender_county" jdbcType="VARCHAR"/>
|
<result property="senderCounty" column="sender_county" jdbcType="VARCHAR"/>
|
||||||
|
<result property="senderStreet" column="sender_street" jdbcType="VARCHAR"/>
|
||||||
<result property="senderAddress" column="sender_address" jdbcType="VARCHAR"/>
|
<result property="senderAddress" column="sender_address" jdbcType="VARCHAR"/>
|
||||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||||
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
|
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
|
||||||
|
|
@ -31,11 +34,12 @@
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id,shop_id,seller_shop_id,
|
id,shop_id,seller_shop_id,
|
||||||
delivery_id,company_type,acct_id,
|
delivery_id,company_type,site_code,
|
||||||
acct_type,status,available,
|
site_name,acct_id,acct_type,
|
||||||
allocated,cancel,recycled,
|
status,available,allocated,
|
||||||
monthly_card,site_info,sender_province,
|
cancel,recycled,monthly_card,
|
||||||
sender_city,sender_county,sender_address,
|
site_info,sender_province,sender_city,
|
||||||
|
sender_county,sender_street,sender_address,
|
||||||
name,mobile,phone,
|
name,mobile,phone,
|
||||||
is_show
|
is_show
|
||||||
</sql>
|
</sql>
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export function getWaybillPrintData(data) {
|
||||||
// 打印成功
|
// 打印成功
|
||||||
export function pushWaybillPrintSuccess(data) {
|
export function pushWaybillPrintSuccess(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/tao-api/ewaybill/push_print_success',
|
url: '/api/wei-api/ewaybill/push_print_success',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|
@ -48,7 +48,7 @@ export function pushWaybillPrintSuccess(data) {
|
||||||
|
|
||||||
export function pushShipSend(data) {
|
export function pushShipSend(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/tao-api/ewaybill/push_ship_send',
|
url: '/api/wei-api/ewaybill/push_ship_send',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@
|
||||||
:label="item.deliveryId"
|
:label="item.deliveryId"
|
||||||
:value="item.id">
|
:value="item.id">
|
||||||
<span style="float: left">{{ item.deliveryId }}</span>
|
<span style="float: left">{{ item.deliveryId }}</span>
|
||||||
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.senderProvince}}{{item.senderCity}}{{item.senderCounty}}{{item.senderAddress}}:{{item.available}}</span>
|
<span style="float: right; color: #8492a6; font-size: 13px" >{{item.siteName}}:{{item.available}}</span>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button type="success" plain @click="updateWaybillAccount" >更新电子面单账户信息</el-button>
|
<el-button type="success" plain @click="updateWaybillAccount" >更新电子面单账户信息</el-button>
|
||||||
|
|
@ -171,8 +171,10 @@
|
||||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||||
|
|
||||||
import {listShop} from "@/api/shop/shop";
|
import {listShop} from "@/api/shop/shop";
|
||||||
import {getWaybillAccountList,pullWaybillAccount,getWaybillCode} from "@/api/wei/ewaybill";
|
import {getWaybillAccountList, pullWaybillAccount, getWaybillCode, pushWaybillPrintSuccess,pushShipSend} from "@/api/wei/ewaybill";
|
||||||
import {listOrder} from "@/api/wei/order";
|
import {listOrder} from "@/api/wei/order";
|
||||||
|
import {getWaybillPrintData} from "@/api/tao/ewaybill";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "printWei",
|
name: "printWei",
|
||||||
|
|
@ -218,7 +220,6 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.openWs()
|
|
||||||
this.openWs()
|
this.openWs()
|
||||||
listShop({platform: 2}).then(response => {
|
listShop({platform: 2}).then(response => {
|
||||||
this.shopList = response.rows;
|
this.shopList = response.rows;
|
||||||
|
|
@ -357,23 +358,19 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handlePrintEwaybill() {
|
handlePrintEwaybill() {
|
||||||
// if (!this.ws) {
|
if (!this.printParams.printer) {
|
||||||
// this.$modal.msgError('打印组件连接失败!请安装并启动微信视频号小单打印组件!');
|
|
||||||
// this.openWs()
|
|
||||||
// }
|
|
||||||
// if(!this.printParams.deliver){
|
|
||||||
// this.$modal.msgError('请选择快递公司!');
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
if(!this.printParams.printer){
|
|
||||||
this.$modal.msgError('请选择打印机!');
|
this.$modal.msgError('请选择打印机!');
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
getWaybillPrintData({shopId: this.queryParams.shopId, ids: this.ids}).then(response => {
|
||||||
|
console.log("======打印======", response.data)
|
||||||
|
if (response.data) {
|
||||||
const ws = new WebSocket('ws://127.0.0.1:12705');
|
const ws = new WebSocket('ws://127.0.0.1:12705');
|
||||||
|
|
||||||
ws.onopen = () => {
|
ws.onopen = () => {
|
||||||
console.log('开始打印: ');
|
console.log('开始打印: ');
|
||||||
// 打印
|
// 打印
|
||||||
this.ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
command: 'print',
|
command: 'print',
|
||||||
version: '2.0', // 必传
|
version: '2.0', // 必传
|
||||||
requestID: '1234', // String, 调用方保证唯一
|
requestID: '1234', // String, 调用方保证唯一
|
||||||
|
|
@ -384,7 +381,7 @@ export default {
|
||||||
curNum: 1, // 打印计数-当前张数
|
curNum: 1, // 打印计数-当前张数
|
||||||
sumNum: 2, // 打印计数-总张数
|
sumNum: 2, // 打印计数-总张数
|
||||||
},
|
},
|
||||||
splitControl: 0 ,// 可不传, 默认为0, 根据自定义内容自动分页;1,禁止分页;2;强制分页, 内容打印在第二页
|
splitControl: 0,// 可不传, 默认为0, 根据自定义内容自动分页;1,禁止分页;2;强制分页, 内容打印在第二页
|
||||||
showDeliveryLogo: 0, // 可不传, 默认为1, 传0时不展示快递公司logo
|
showDeliveryLogo: 0, // 可不传, 默认为1, 传0时不展示快递公司logo
|
||||||
// 自定义模板信息,没有自定义模板需求可不传
|
// 自定义模板信息,没有自定义模板需求可不传
|
||||||
|
|
||||||
|
|
@ -399,24 +396,36 @@ export default {
|
||||||
printer: this.printParams.printer, // 选中的打印机,printer.name
|
printer: this.printParams.printer, // 选中的打印机,printer.name
|
||||||
}))
|
}))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let obj = this.$modal;
|
let obj = this.$modal;
|
||||||
ws.onmessage = (e) => {
|
ws.onmessage = (e) => {
|
||||||
const resp = JSON.parse(e.data || '{}')
|
const resp = JSON.parse(e.data || '{}')
|
||||||
if (resp.command === 'print') {
|
if (resp.command === 'print') {
|
||||||
console.log('打印结果: ', resp);
|
console.log('打印结果: ', resp);
|
||||||
obj.msgError("打印结果!"+JSON.stringify(resp));
|
// 请求回调
|
||||||
|
return pushWaybillPrintSuccess({shopId: this.queryParams.shopId, ids: this.ids})
|
||||||
|
// obj.msgError("打印结果!"+JSON.stringify(resp));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 当发生错误时触发
|
// 当发生错误时触发
|
||||||
ws.onerror = function(error) {
|
ws.onerror = function (error) {
|
||||||
obj.msgError("打印失败!");
|
obj.msgError("打印失败!");
|
||||||
console.error('WebSocket error:', error);
|
console.error('WebSocket error:', error);
|
||||||
// alert('WebSocket error occurred. Check the console for more details.');
|
// alert('WebSocket error occurred. Check the console for more details.');
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleShipSend(){
|
||||||
|
// this.$modal.msgError("开源版本未实现平台发货!请自行对接发货");
|
||||||
|
pushShipSend({shopId: this.queryParams.shopId, ids: this.ids}).then(response => {
|
||||||
|
this.$modal.msgSuccess("发货成功!");
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue