diff --git a/microservices/pdd-api/src/main/java/cn/qihangerp/api/pdd/controller/PddWaybillController.java b/microservices/pdd-api/src/main/java/cn/qihangerp/api/pdd/controller/PddWaybillController.java new file mode 100644 index 00000000..7ec53a46 --- /dev/null +++ b/microservices/pdd-api/src/main/java/cn/qihangerp/api/pdd/controller/PddWaybillController.java @@ -0,0 +1,64 @@ +package cn.qihangerp.api.pdd.controller; + +import cn.qihangerp.common.AjaxResult; +import cn.qihangerp.open.dou.DouRequest; +import cn.qihangerp.security.common.BaseController; +import lombok.AllArgsConstructor; +import lombok.extern.java.Log; +import org.springframework.web.bind.annotation.*; + +@Log +@AllArgsConstructor +@RestController +@RequestMapping("/pdd/ewaybill") +public class PddWaybillController extends BaseController { + + + @GetMapping(value = "/get_waybill_account_list") + public AjaxResult getWaybillAccountList(Long shopId) throws Exception { + return AjaxResult.error("开源版本不支持电子面单功能"); + } + + + /** + * 拉取电子面单账号 + * + * @param params + * @return + * @throws Exception + */ + @RequestMapping(value = "/pull_waybill_account", method = RequestMethod.POST) + public AjaxResult pullWaybillAccount(@RequestBody DouRequest params) throws Exception { + return AjaxResult.error("开源版本不支持电子面单功能"); + } + + @PostMapping("/get_waybill_code") + @ResponseBody + public AjaxResult getWaybillCode() { + return AjaxResult.error("开源版本不支持电子面单功能"); + } + + @PostMapping("/get_print_data") + @ResponseBody + public AjaxResult getPrintData() { + return AjaxResult.error("开源版本不支持电子面单功能"); + } + + @PostMapping("/push_print_success") + @ResponseBody + public AjaxResult pushPrintSuccess() { + return AjaxResult.error("开源版本不支持电子面单功能"); + } + + /** + * 发货 + * + * @param + * @return + */ + @PostMapping("/push_ship_send") + @ResponseBody + public AjaxResult pushShipSend() { + return AjaxResult.error("开源版本不支持电子面单功能"); + } +} diff --git a/vue/src/views/pdd/ewaybill/index.vue b/vue/src/views/pdd/ewaybill/index.vue index 0906e0c6..d90f4876 100644 --- a/vue/src/views/pdd/ewaybill/index.vue +++ b/vue/src/views/pdd/ewaybill/index.vue @@ -287,31 +287,7 @@ export default { this.multiple = !selection.length }, openWs() { - const ws = new WebSocket('ws://127.0.0.1:5000'); - ws.onopen = () => { - console.log('与打印组件建立连接成功: '); - // 或打印机 - ws.send(JSON.stringify({ - requestID: '1234554', - cmd: 'getPrinters', - "version": "1.0" - })) - }; - let obj = this.$modal; - ws.onmessage = (e) => { - const resp = JSON.parse(e.data || '{}') - if (resp.cmd === 'getPrinters') { - this.printerList = resp.printers - obj.msgSuccess("打印组件连接成功!"); - console.log('打印机列表: ', resp.printers); - } - }; - // 当发生错误时触发 - ws.onerror = function (error) { - obj.msgError("打印组件连接失败!请安装并启动拼多多打印组件!"); - console.error('WebSocket error:', error); - // alert('WebSocket error occurred. Check the console for more details.'); - }; + this.$modal.msgError("开源版本未实现电子面单相关功能!请自行对接发货"); }, // 取号弹窗 handleGetEwaybillCode() { @@ -355,67 +331,13 @@ export default { }); }, handlePrintEwaybill() { - // if (!this.ws) { - // this.$modal.msgError('打印组件连接失败!请安装并启动微信视频号小单打印组件!'); - // this.openWs() - // } - // if(!this.printParams.deliver){ - // this.$modal.msgError('请选择快递公司!'); - // return - // } + if (!this.printParams.printer) { this.$modal.msgError('请选择打印机!'); return } - const ids = this.ids; - getWaybillPrintData({shopId: this.queryParams.shopId, ids: ids}).then(response => { - console.log("======打印======", response.data) - if (response.data) { - const ws = new WebSocket('ws://127.0.0.1:5000'); - ws.onopen = () => { - let printData = [] - response.data.forEach(x => printData.push(JSON.parse(x.printData))) - console.log('开始打印: 组合打印数据:', printData); - // 打印 - ws.send(JSON.stringify({ - "cmd": "print", - "requestID": this.getUUID(8, 16), - "version": "1.0", - "task": { - "taskID": this.getUUID(8,10), - "preview": false, - "printer": this.printParams.printer, - "previewType": "pdf", - "firstDocumentNumber": 10, - "totalDocumentCount": 100, - "documents": [{ - "documentID": this.getUUID(8,10), - "contents": printData - }] - } - })) - }; - let obj = this.$modal; - ws.onmessage = (e) => { - const resp = JSON.parse(e.data || '{}') - if (resp.cmd === 'print') { - console.log('打印结果: ', resp); - obj.msgSuccess("打印成功!" + JSON.stringify(resp)); - // 请求回调 - return pushWaybillPrintSuccess({shopId: this.queryParams.shopId, ids: ids}) - } - }; - - - // 当发生错误时触发 - ws.onerror = function (error) { - obj.msgError("打印失败!"); - console.error('WebSocket error:', error); - // alert('WebSocket error occurred. Check the console for more details.'); - }; - } - }); + this.$modal.msgError("开源版本未实现电子面单相关功能!请自行对接发货"); }, handleShipSend(){