Browse Source

推送失败显示具体数据

master
常熟吴彦祖 3 weeks ago
parent
commit
b16b375f6c
  1. 54
      src/utils/haianWcsPushResult.js
  2. 5
      src/views/modules/haianWarehouse/noOrderIssue/noOrderNotification54.vue
  3. 5
      src/views/modules/haianWarehouse/poOrder/searchPoIssureNotify54.vue
  4. 5
      src/views/modules/haianWarehouse/shipment/shipmentNotification54.vue
  5. 5
      src/views/modules/haianWarehouse/shopOrderIssueNotify/searchIssureNotify54.vue

54
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
})
}

5
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()

5
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 {

5
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 {

5
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 {

Loading…
Cancel
Save