完善pdd电子面单打印
This commit is contained in:
parent
7e7c895ef4
commit
facc210f82
|
|
@ -239,4 +239,23 @@ public class EwaybillController extends BaseController {
|
||||||
erpShipWaybillService.printSuccess(req.getShopId(), req.getIds());
|
erpShipWaybillService.printSuccess(req.getShopId(), req.getIds());
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发货
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/push_ship_send")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult pushShipSend(@RequestBody PddWaybillGetBo 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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,6 @@ public interface ErpShipWaybillService extends IService<ErpShipWaybill> {
|
||||||
List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds);
|
List<ErpShipWaybill> getListByOrderIds(Long shopId, String[] orderIds);
|
||||||
|
|
||||||
ResultVo<Integer> printSuccess(Long shopId,String[] orderIds);
|
ResultVo<Integer> printSuccess(Long shopId,String[] orderIds);
|
||||||
|
|
||||||
|
ResultVo<Integer> pushShipSend(Long shopId,String[] orderIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,19 @@
|
||||||
package com.qihang.pdd.service.impl;
|
package com.qihang.pdd.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.qihang.common.common.ResultVo;
|
import com.qihang.common.common.ResultVo;
|
||||||
import com.qihang.common.enums.EnumShopType;
|
import com.qihang.common.enums.EnumShopType;
|
||||||
|
import com.qihang.common.mq.MqMessage;
|
||||||
|
import com.qihang.common.mq.MqType;
|
||||||
import com.qihang.pdd.domain.ErpShipWaybill;
|
import com.qihang.pdd.domain.ErpShipWaybill;
|
||||||
import com.qihang.pdd.domain.OmsPddOrder;
|
import com.qihang.pdd.domain.OmsPddOrder;
|
||||||
import com.qihang.pdd.mapper.OmsPddOrderMapper;
|
import com.qihang.pdd.mapper.OmsPddOrderMapper;
|
||||||
import com.qihang.pdd.service.ErpShipWaybillService;
|
import com.qihang.pdd.service.ErpShipWaybillService;
|
||||||
import com.qihang.pdd.mapper.ErpShipWaybillMapper;
|
import com.qihang.pdd.mapper.ErpShipWaybillMapper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
|
@ -28,7 +32,7 @@ public class ErpShipWaybillServiceImpl extends ServiceImpl<ErpShipWaybillMapper,
|
||||||
implements ErpShipWaybillService{
|
implements ErpShipWaybillService{
|
||||||
private final ErpShipWaybillMapper mapper;
|
private final ErpShipWaybillMapper mapper;
|
||||||
private final OmsPddOrderMapper orderMapper;
|
private final OmsPddOrderMapper orderMapper;
|
||||||
|
private final KafkaTemplate<String,Object> kafkaTemplate;
|
||||||
/**
|
/**
|
||||||
* 更新电子面单信息
|
* 更新电子面单信息
|
||||||
* @param shipWaybill
|
* @param shipWaybill
|
||||||
|
|
@ -109,9 +113,41 @@ public class ErpShipWaybillServiceImpl extends ServiceImpl<ErpShipWaybillMapper,
|
||||||
|
|
||||||
//TODO: 打印成功之后 加入备货清单
|
//TODO: 打印成功之后 加入备货清单
|
||||||
|
|
||||||
|
// 打印完成,通知备货
|
||||||
|
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状态
|
||||||
|
OmsPddOrder orderUpdate = new OmsPddOrder();
|
||||||
|
orderUpdate.setErpSendStatus(update.getStatus());
|
||||||
|
|
||||||
|
orderMapper.update(orderUpdate, new LambdaQueryWrapper<OmsPddOrder>().eq(OmsPddOrder::getOrderSn, 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();
|
return ResultVo.success();
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,10 @@ export function pushWaybillPrintSuccess(data) {
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function pushShipSend(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pdd-api/ewaybill/push_ship_send',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleGetEwaybillCode"
|
@click="handleGetEwaybillCode"
|
||||||
>取号</el-button>
|
>电子面单取号</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
icon="el-icon-printer"
|
icon="el-icon-printer"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handlePrintEwaybill"
|
@click="handlePrintEwaybill"
|
||||||
>打印电子面单</el-button>
|
>电子面单打印</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleShipSend"
|
@click="handleShipSend"
|
||||||
>发货</el-button>
|
>电子面单发货</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -187,9 +187,10 @@ import {
|
||||||
pullWaybillAccount,
|
pullWaybillAccount,
|
||||||
getWaybillCode,
|
getWaybillCode,
|
||||||
getWaybillPrintData,
|
getWaybillPrintData,
|
||||||
pushWaybillPrintSuccess
|
pushWaybillPrintSuccess,pushShipSend
|
||||||
} from "@/api/pdd/ewaybill";
|
} from "@/api/pdd/ewaybill";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "printPdd",
|
name: "printPdd",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -418,8 +419,13 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
handleShipSend(){
|
handleShipSend(){
|
||||||
this.$modal.msgError("开源版本未实现平台发货!请自行对接发货");
|
// this.$modal.msgError("开源版本未实现平台发货!请自行对接发货");
|
||||||
|
pushShipSend({shopId: this.queryParams.shopId, ids: this.ids}).then(response => {
|
||||||
|
this.$modal.msgSuccess("发货成功!");
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getUUID(len, radix) {
|
getUUID(len, radix) {
|
||||||
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
||||||
var uuid = [], i;
|
var uuid = [], i;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue