From 9060f76d710ec5a1ea4102e207941ffedf565f1f Mon Sep 17 00:00:00 2001 From: Richie <280645618@qq.com> Date: Sat, 31 May 2025 20:27:53 +0800 Subject: [PATCH] fixbugs --- .../jd/controller/JdWaybillController.java | 64 +++++++++++ vue/src/views/jd/ewaybill/index.vue | 108 +----------------- 2 files changed, 67 insertions(+), 105 deletions(-) create mode 100644 microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdWaybillController.java diff --git a/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdWaybillController.java b/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdWaybillController.java new file mode 100644 index 00000000..2f83b1ef --- /dev/null +++ b/microservices/jd-api/src/main/java/cn/qihangerp/api/jd/controller/JdWaybillController.java @@ -0,0 +1,64 @@ +package cn.qihangerp.api.jd.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("/jd/ewaybill") +public class JdWaybillController 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/jd/ewaybill/index.vue b/vue/src/views/jd/ewaybill/index.vue index c30f5e1d..49b10625 100644 --- a/vue/src/views/jd/ewaybill/index.vue +++ b/vue/src/views/jd/ewaybill/index.vue @@ -281,31 +281,7 @@ export default { this.multiple = !selection.length }, openWs() { - const ws = new WebSocket('ws://127.0.0.1:9113'); - ws.onopen = () => { - console.log('与打印组件建立连接成功: '); - // 或打印机 - ws.send(JSON.stringify({ - requestID: '12345', - 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() { @@ -332,16 +308,7 @@ export default { const ids = this.ids; console.log('=========3333========', ids) if (ids) { - console.log('===请求参数=====', {shopId: this.queryParams.shopId, ids: ids, accountId: this.form.accountId}) - getWaybillCode({ - shopId: this.queryParams.shopId, - ids: ids, - accountId: this.form.accountId - }).then(response => { - this.$modal.msgSuccess("取号成功") - this.getList() - this.getCodeOpen = false - }); + this.$modal.msgError("开源版本未实现电子面单相关功能!请自行对接发货"); } else { this.$modal.msgError("请选择订单") } @@ -349,14 +316,6 @@ 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 @@ -364,50 +323,7 @@ export default { 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:9113'); - 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.'); - }; - } }); @@ -419,25 +335,7 @@ export default { this.getList() }) }, - getUUID(len, radix) { - var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); - var uuid = [], i; - radix = radix || chars.length; - if (len) { - for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]; - } else { - var r; - uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; - uuid[14] = '4'; - for (i = 0; i < 36; i++) { - if (!uuid[i]) { - r = 0 | Math.random() * 16; - uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; - } - } - } - return uuid.join(''); - } + } };