diff --git a/frontend/src/views/OutboundOrder/Index.vue b/frontend/src/views/OutboundOrder/Index.vue index b4e80e1..7f1c130 100644 --- a/frontend/src/views/OutboundOrder/Index.vue +++ b/frontend/src/views/OutboundOrder/Index.vue @@ -215,14 +215,22 @@ async function transit(action: 'audit' | 'push' | 'complete' | 'cancel' | 'resto transiting.value = true try { const id = currentOrder.value.id - if (action === 'audit') await outboundOrderApi.audit(id) - else if (action === 'push') await outboundOrderApi.push(id) - else if (action === 'complete') await outboundOrderApi.complete(id) + if (action === 'audit') { + await outboundOrderApi.audit(id) + ElMessage.success('审核成功,已进入推送队列,稍后自动推送仓库') + } else if (action === 'push') { + await outboundOrderApi.push(id) + ElMessage.success('已推送仓库') + } else if (action === 'complete') await outboundOrderApi.complete(id) else if (action === 'cancel') await outboundOrderApi.cancel(id) else if (action === 'restore') await outboundOrderApi.restore(id) - ElMessage.success('操作成功') + if (action !== 'audit' && action !== 'push') ElMessage.success('操作成功') const map: Record = { audit: 2, push: 3, complete: 4, cancel: 9, restore: 1 } if (currentOrder.value) currentOrder.value.status = map[action] + // 重新拉取整单:自动/手动推送会写 pushed_at 与 wms_push_result,需刷新推送结果面板 + if (currentOrder.value) { + await outboundOrderApi.get(id).then(r => { currentOrder.value = r }).catch(() => {}) + } await fetchItems() await fetchList() } catch { @@ -337,6 +345,21 @@ const editTotal = computed(() => ) /** 明细锁定:仅「待出库(1)」可增删改明细,已审核及之后锁定(需先驳回) */ const itemsLocked = computed(() => !!currentOrder.value && currentOrder.value.status !== 1) +/** 推送失败原因(自动推送失败会退回「待出库」,列表上用感叹号提示,鼠标悬浮看原因) */ +function pushFailTip(row: OutboundOrder) { + const result = row.wms_push_result + if (!result || result.success !== false) return '' + const kindMap: Record = { + timeout: `连续 ${result.attempts || 1} 次无响应/超时`, + business: '仓库明确拒绝', + insufficient_stock: '库存不足', + lock_failed: '库存锁定失败', + empty_items: '单据无明细', + } + const kind = kindMap[String(result.failureKind)] || '推送异常' + const detail = result.message || result.error || '' + return `推送失败(${kind}):${detail}` +} // 始终保留一行空行在末尾,选商品填充后可继续往下添加 function ensureTrailingEmptyRow() { const arr = editItems.value @@ -497,9 +520,12 @@ onMounted(async () => { - + @@ -535,7 +561,7 @@ onMounted(async () => {