From b16b375f6c38644eb71b12a42d067f36c52f764a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Thu, 22 Oct 2026 10:03:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=A4=B1=E8=B4=A5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=85=B7=E4=BD=93=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/haianWcsPushResult.js | 54 +++++++++++++++++++ .../noOrderIssue/noOrderNotification54.vue | 5 +- .../poOrder/searchPoIssureNotify54.vue | 5 +- .../shipment/shipmentNotification54.vue | 5 +- .../searchIssureNotify54.vue | 5 +- 5 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 src/utils/haianWcsPushResult.js diff --git a/src/utils/haianWcsPushResult.js b/src/utils/haianWcsPushResult.js new file mode 100644 index 0000000..6005bc5 --- /dev/null +++ b/src/utils/haianWcsPushResult.js @@ -0,0 +1,54 @@ +/** + * 展示海安四类申请单的 WCS 确认推送结果:保留后端摘要,并逐订单展示失败和跳过原因。- rqrq + * @param vm 当前 Vue 页面实例,用于创建安全文本节点和打开必须确认的弹框。- rqrq + * @param data WCS 推送接口的成功响应,优先读取 row,兼容顶层结果字段。- rqrq + * @returns Element UI 弹框 Promise;缺少逐单原因时明确提示核查,避免把部分成功误报为全部成功。- rqrq + */ +export function showHaianWcsPushResult (vm, data) { + const result = data.row || data + const failedMessages = Array.isArray(result.failedOrderMessages) ? result.failedOrderMessages : [] + const skippedMessages = Array.isArray(result.skippedOrderNos) ? result.skippedOrderNos : [] + const pushedCount = Number(result.pushedOrderCount) || 0 + const failedCount = Number(result.failedOrderCount) || 0 + const skippedCount = Number(result.skippedOrderCount) || 0 + const hasUnpushedOrders = failedCount > 0 || skippedCount > 0 || failedMessages.length > 0 || skippedMessages.length > 0 + const h = vm.$createElement + const children = [ + h('div', {style: {fontWeight: 'bold', marginBottom: '8px'}}, + `本次成功 ${pushedCount} 单,失败 ${failedCount} 单,跳过 ${skippedCount} 单`), + h('div', {style: {marginBottom: '12px', whiteSpace: 'normal', wordBreak: 'break-all'}}, + result.message || data.msg || 'WCS推送处理完成') + ] + + // 后端每条 failedOrderMessages 含订单号和具体错误,逐行渲染为文本节点,避免将错误内容当 HTML 执行。- rqrq + if (failedCount > 0 || failedMessages.length > 0) { + children.push(h('div', {style: {fontWeight: 'bold', color: '#F56C6C'}}, '推送失败原因:')) + children.push(h('ol', {style: {margin: '6px 0 12px', paddingLeft: '22px'}}, + failedMessages.map(message => h('li', {style: {marginBottom: '6px', wordBreak: 'break-all'}}, String(message))))) + if (failedMessages.length < failedCount) { + children.push(h('div', {style: {color: '#F56C6C', marginBottom: '12px'}}, + `还有 ${failedCount - failedMessages.length} 单未返回逐单原因,请按申请单号核查服务端日志。`)) + } + } + + // 未满足库存或区域条件的订单属于跳过,单独列出后端原因,避免与外呼失败混淆。- rqrq + if (skippedCount > 0 || skippedMessages.length > 0) { + children.push(h('div', {style: {fontWeight: 'bold', color: '#E6A23C'}}, '本次未推送原因:')) + children.push(h('ol', {style: {margin: '6px 0 0', paddingLeft: '22px'}}, + skippedMessages.map(message => h('li', {style: {marginBottom: '6px', wordBreak: 'break-all'}}, String(message))))) + if (skippedMessages.length < skippedCount) { + children.push(h('div', {style: {color: '#E6A23C'}}, + `还有 ${skippedCount - skippedMessages.length} 单未返回逐单原因,请重新预览申请单。`)) + } + } + + // 限制内容高度并保留滚动条,批量失败时所有原因仍可查看;只能点击确认按钮关闭。- rqrq + return vm.$alert(h('div', {style: {maxHeight: '55vh', overflowY: 'auto', textAlign: 'left'}}, children), + 'WCS推送结果', { + type: hasUnpushedOrders ? 'warning' : 'success', + confirmButtonText: '确定', + showClose: false, + closeOnClickModal: false, + closeOnPressEscape: false + }) +} diff --git a/src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue b/src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue index f50515b..3d59fda 100644 --- a/src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue +++ b/src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue @@ -609,6 +609,7 @@ import { cancelNoOrderIssueNotify, haiAnDeleteUnpushedNotify } from '@/api/haianWarehouse/noOrderIssueNotify.js' +import { showHaianWcsPushResult } from '@/utils/haianWcsPushResult' import { getTableDefaultListLanguage, getTableUserListLanguage, @@ -2836,9 +2837,9 @@ export default { notifyNo: this.currentNotifyRow.notifyNo }).then(({data}) => { if (data && data.code === 0) { - const result = data.row || {} - this.$message.success(result.message || data.msg || '推送WCS成功') this.closePreviewDialog(true) + // WCS按订单部分成功也返回code=0;弹框保留全部失败及跳过原因,等待人工确认。- rqrq + showHaianWcsPushResult(this, data) // 推送成功后刷新主单、申请物料、指定清单和预定标签清单 - rqrq this.getDataList() this.getNotifyNoOrderDetailByType() diff --git a/src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue b/src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue index ed88b8b..fbafe09 100644 --- a/src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue +++ b/src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue @@ -697,6 +697,7 @@ import { getNoOrderAvailableInStockLabelList, getNoOrderMaterialAllocListByNotifyNo } from '@/api/haianWarehouse/poOrderIssueNotify.js' +import { showHaianWcsPushResult } from '@/utils/haianWcsPushResult' export default { name: 'searchPoIssureNotify54', @@ -2578,9 +2579,9 @@ export default { notifyNo: this.currentNotifyRow.notifyNo }).then(({data}) => { if (data && data.code === 0) { - const result = data.row || {} - this.$message.success(result.message || data.msg || '推送WCS成功') this.closePreviewDialog(true) + // WCS按订单部分成功也返回code=0;弹框保留全部失败及跳过原因,等待人工确认。- rqrq + showHaianWcsPushResult(this, data) this.searchTable() this.refreshCurrentTabTable() } else { diff --git a/src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue b/src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue index 1e9570b..a167511 100644 --- a/src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue +++ b/src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue @@ -697,6 +697,7 @@ import { getNoOrderAvailableInStockLabelList, getNoOrderMaterialAllocListByNotifyNo } from '@/api/haianWarehouse/shipmentIssue.js' +import { showHaianWcsPushResult } from '@/utils/haianWcsPushResult' export default { name: 'shipmentNotification54', @@ -2578,9 +2579,9 @@ export default { notifyNo: this.currentNotifyRow.notifyNo }).then(({data}) => { if (data && data.code === 0) { - const result = data.row || {} - this.$message.success(result.message || data.msg || '推送WCS成功') this.closePreviewDialog(true) + // WCS按订单部分成功也返回code=0;弹框保留全部失败及跳过原因,等待人工确认。- rqrq + showHaianWcsPushResult(this, data) this.searchTable() this.refreshCurrentTabTable() } else { diff --git a/src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue b/src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue index eba75c3..2b4c674 100644 --- a/src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue +++ b/src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue @@ -697,6 +697,7 @@ import { getNoOrderAvailableInStockLabelList, getNoOrderMaterialAllocListByNotifyNo } from '@/api/haianWarehouse/searchIssureNotify.js' +import { showHaianWcsPushResult } from '@/utils/haianWcsPushResult' export default { name: 'searchIssureNotify54', @@ -2578,9 +2579,9 @@ export default { notifyNo: this.currentNotifyRow.notifyNo }).then(({data}) => { if (data && data.code === 0) { - const result = data.row || {} - this.$message.success(result.message || data.msg || '推送WCS成功') this.closePreviewDialog(true) + // WCS按订单部分成功也返回code=0;弹框保留全部失败及跳过原因,等待人工确认。- rqrq + showHaianWcsPushResult(this, data) this.searchTable() this.refreshCurrentTabTable() } else {