This commit is contained in:
yin 2026-07-06 18:16:55 +08:00
parent 57dd323679
commit 4dc2935ba5
10 changed files with 278 additions and 72 deletions

Binary file not shown.

View File

@ -16,8 +16,6 @@ export type {
export const orderPendingOrderDownloadCreateTemplate = orderModulePendingOrderDownloadCreateTemplate;
export const orderPendingOrderManualWaybill = orderModulePendingOrderManualWaybill;
// 啊大王大大
export type OrderWhere = Record<string, any>;
export type OrderSort = {
sortField?: string;
@ -769,5 +767,5 @@ export const orderPendingOrder: OrderPendingOrderApi = {
batchLock: orderPendingOrderBatchLock,
batchLockTaskProgress: orderPendingOrderBatchLockTaskProgress,
batchUnlock: orderPendingOrderBatchUnlock,
batchUnlockTaskProgress: orderPendingOrderBatchUnlockTaskProgress
batchUnlockTaskProgress: orderPendingOrderBatchUnlockTaskProgress,
};

View File

@ -110,6 +110,36 @@ export type PickWavePickTaskCompleteResponse = {
progress: Record<string, unknown>
}
export type PickWavePickCompleteParams = {
wave_id: number
}
export type PickWavePickCompleteResponse = {
task_id: number
status: string
tip: string
confirmed_order_ids?: Array<number | string>
is_completed?: boolean
progress?: Record<string, unknown>
}
/** pick.wavePickComplete:按波次 ID 一键完成整个波次的拣货 */
export function pickWavePickComplete(
data: PickWavePickCompleteParams
): Promise<PickWavePickCompleteResponse & { code?: number; message?: string; data?: Partial<PickWavePickCompleteResponse> }> {
return request({
url: '/system',
method: 'post',
params: {
method: 'pick.wavePickComplete',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
/** pick.wavePickTaskComplete:完全提交拣货任务 */
export function pickWavePickTaskComplete(
data: PickWavePickTaskCompleteParams
@ -129,6 +159,7 @@ export function pickWavePickTaskComplete(
export const pick = {
query: pickQuery,
wavePickComplete: pickWavePickComplete,
wavePickTaskDetail: pickWavePickTaskDetail,
wavePickTaskSubmit: pickWavePickTaskSubmit,
wavePickTaskComplete: pickWavePickTaskComplete

View File

@ -64,16 +64,17 @@ export const COMMON_TRANSLATIONS: Record<string, Record<string, string>> = {
'none': '未分配'
},
outbound_status: {
'none': '未出库',
'padding': '待出库',
'pending': '待出库',
'pedding': '待出库',
'processing': '出库中',
'fin': '已出库',
'done': '已出库',
'finished': '已出库',
'error': '出库异常',
'failed': '出库失败'
'none': '未归档',
'padding': '归档中',
'pending': '归档中',
'pedding': '归档中',
'processing': '归档中',
'fin': '已归档',
'done': '已归档',
'finished': '已归档',
'archived': '已归档',
'error': '归档异常',
'failed': '归档失败'
},
order_type: {
'JYCK': '交易出库',
@ -206,6 +207,7 @@ export const COMMON_TAG_TYPES: Record<string, Record<string, string>> = {
'fin': 'success',
'done': 'success',
'finished': 'success',
'archived': 'success',
'error': 'danger',
'failed': 'danger'
},
@ -724,8 +726,7 @@ export const orderDetailFullSections: OrderDetailSectionConfig[] = [
{ prop: 'warehouse_code', label: '仓库编码' },
{ prop: 'create_channel', label: '来源' },
{ prop: 'order_flag', label: '订单标记', span: 4, multiline: true },
{ prop: 'sys_platform_name', label: '平台' },
{ prop: 'sys_platform_code', label: '平台编码', tag: true },
{ prop: 'sys_platform_name', label: '平台编码' },
{ prop: 'source_platform_name', label: '来源平台名' },
{ prop: 'source_platform_code', label: '来源平台编码', tag: true },
{ prop: 'source_order_codes', label: '平台交易单号' },
@ -755,7 +756,7 @@ export const orderDetailFullSections: OrderDetailSectionConfig[] = [
{ prop: 'sync_status', label: '同步状态', tag: true },
{ prop: 'inspection_status', label: '审核状态', tag: true },
{ prop: 'recheck_status', label: '复核状态', tag: true },
{ prop: 'outbound_status', label: '出库状态', tag: true },
{ prop: 'outbound_status', label: '数据归档', tag: true },
{ prop: 'storage_status', label: '储位状态', tag: true },
{ prop: 'post_status', label: '快递状态', tag: true },
{ prop: 'pick_status', label: '拣货状态', tag: true },
@ -865,7 +866,7 @@ export const orderDetailCompactSections: OrderDetailSectionConfig[] = [
{ prop: 'recheck_status', label: '复核状态', tag: true },
{ prop: 'storage_status', label: '储位状态', tag: true },
{ prop: 'post_status', label: '快递状态', tag: true },
{ prop: 'outbound_status', label: '出库状态', tag: true },
{ prop: 'outbound_status', label: '数据归档', tag: true },
{ prop: 'wave_no', label: '波次号' },
{ prop: 'pick_status', label: '拣货状态', tag: true },
{ prop: 'pack_status', label: '打包状态', tag: true },
@ -1068,9 +1069,9 @@ export const printStatusFilterOptions = [
]
export const outboundStatusFilterOptions = [
{ label: '未出库', value: 'none' },
{ label: '待出库', value: 'padding' },
{ label: '已出库', value: 'fin' },
{ label: '未归档', value: 'none' },
{ label: '归档中', value: 'padding' },
{ label: '已归档', value: 'fin' },
]
export const interceptStatusFilterOptions = [
@ -1152,7 +1153,7 @@ export const pendingOrderCodeScanField = scanBasicField({ label: '发货单号',
export const exceptionOrderCodeScanField = scanBasicField({ label: '发货单号', value: 'order_code', type: 'text', operators: ORDER_BULK_SEARCH_OPERATORS, defaultOperator: 'eq' })
export const shopNickScanField = scanBasicField({ label: '店铺名称', value: 'shop_nick', type: 'text' })
export const sysPlatformNameScanField = scanBasicField({ label: '平台', value: 'sys_platform_name', type: 'select', options: [] })
export const sysPlatformCodeScanField = scanBasicField({ label: '平台编码', value: 'sys_platform_code', type: 'select', options: [] })
export const sysPlatformCodeScanField = scanBasicField({ label: '平台编码', value: 'sys_platform_name', type: 'select', options: [] })
export const buyerNickScanField = scanBasicField({ label: '买家昵称', value: 'buyer_nick', type: 'text' })
export const receiverNameScanField = scanBasicField({ label: '收件人', value: 'name', type: 'text' })
export const receiverMobileScanField = scanBasicField({ label: '电话', value: 'mobile', type: 'text' })
@ -1181,7 +1182,7 @@ export const postStatusScanField = scanWorkflowField({ label: '快递状态', va
export const pickStatusScanField = scanWorkflowField({ label: '拣货状态', value: 'pick_status', type: 'select', options: pickStatusFilterOptions })
export const packStatusScanField = scanWorkflowField({ label: '打包状态', value: 'pack_status', type: 'select', options: packStatusFilterOptions })
export const printStatusScanField = scanWorkflowField({ label: '打印状态', value: 'print_status', type: 'select', options: printStatusFilterOptions })
export const outboundStatusScanField = scanWorkflowField({ label: '出库状态', value: 'outbound_status', type: 'select', options: outboundStatusFilterOptions })
export const outboundStatusScanField = scanWorkflowField({ label: '数据归档', value: 'outbound_status', type: 'select', options: outboundStatusFilterOptions })
export const claimStatusScanField = scanWorkflowField({ label: '认领状态', value: 'claim_status', type: 'select', options: claimStatusFilterOptions })
export const lockStatusScanField = scanWorkflowField({ label: '锁定状态', value: 'lock_status', type: 'select', options: lockStatusFilterOptions })
export const interceptStatusScanField = scanWorkflowField({ label: '拦截状态', value: 'intercept_status', type: 'select', options: interceptStatusFilterOptions })
@ -1367,7 +1368,7 @@ export const deliveryColumns = applyOrderListCopyActions([
{ prop: 'order_flag', label: '订单标记', minWidth: '220' },
{ prop: 'sys_platform_name', label: '平台', width: '110' },
{ prop: 'create_channel', label: '来源', width: '120' },
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
{ prop: 'sys_platform_name', label: '平台编码', width: '100' },
{ prop: 'order_type', label: '订单类型', width: '90', formatter: orderTypeFormatter },
{ prop: 'buyer_nick', label: '买家昵称', width: '120' },
{ prop: 'seller_nick', label: '卖家昵称', width: '120' },
@ -1378,7 +1379,7 @@ export const deliveryColumns = applyOrderListCopyActions([
{ prop: 'city', label: '城市', width: '90' },
{ prop: 'area', label: '区/县', width: '90' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'outbound_status', label: '出库状态', width: '100' },
{ prop: 'outbound_status', label: '数据归档', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
{ prop: 'inspection_status', label: '审核状态', width: '100' },
{ prop: 'recheck_status', label: '复核状态', width: '100' },
@ -1494,7 +1495,7 @@ export const reviewColums = applyOrderListCopyActions([
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'sys_platform_code', label: '平台编码', width: '100' },
{ prop: 'sys_platform_name', label: '平台编码', width: '100' },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'status', label: '订单状态', width: '100' },
{ prop: 'sync_status', label: '同步状态', width: '100' },
@ -1518,9 +1519,8 @@ export const reviewOrderDetail = [
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'sys_platform_name', label: '平台' },
{ prop: 'create_channel', label: '来源' },
{ prop: 'sys_platform_code', label: '平台编码' },
{ prop: 'sys_platform_name', label: '平台编码' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
@ -1657,6 +1657,7 @@ export const pendingCloums = [
{ prop: 'order_flag', label: '订单标记', minWidth: '260' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,
{ prop: 'sys_platform_name', label: '平台编码', width: '100' },
{ prop: 'name', label: '收件人', width: '110' },
{ prop: 'mobile', label: '电话', width: '120' },
{ prop: 'buyer_message', label: '买家留言', minWidth: '180' },
@ -1676,7 +1677,6 @@ export const pendingCloums = [
{ prop: 'create_at', label: '创建时间', width: '165', formatter: orderTimeFormatter },
{ prop: 'pay_time', label: '支付时间', width: '160', formatter: orderTimeFormatter },
{ prop: 'place_order_time', label: '时效', width: '165', formatter: orderTimeFormatter },
{ prop: 'sys_platform_name', label: '平台', width: '120' },
{ prop: 'create_channel', label: '来源', width: '120' },
{ prop: 'source_order_codes', label: '平台交易单号', width: '140' },
{ prop: 'logistics_name', label: '快递', width: '120' },
@ -1688,10 +1688,9 @@ export const ORDER_LIST_FIELD_LABELS: Record<string, string> = {
...Object.fromEntries(pendingCloums.map((col) => [col.prop, col.label])),
recheck_status: '复核状态',
print_status: '打印状态',
outbound_status: '出库状态',
outbound_status: '数据归档',
inspection_status: '审核状态',
order_code: '发货单号',
sys_platform_code: '平台编码',
total_amount: '订单金额',
source_order_codes: '平台交易单号',
order_type: '订单类型',
@ -1741,9 +1740,8 @@ export const pendingOrderDetail = [
{ prop: 'pre_delivery_order_code', label: '前置单号' },
{ prop: 'order_type', label: '订单类型' },
{ prop: 'order_flag', label: '订单标记' },
{ prop: 'sys_platform_name', label: '平台' },
{ prop: 'create_channel', label: '来源' },
{ prop: 'sys_platform_code', label: '平台编码' },
{ prop: 'sys_platform_name', label: '平台编码' },
{ prop: 'shop_nick', label: '店铺名称' },
{ prop: 'buyer_nick', label: '买家昵称' },
{ prop: 'seller_nick', label: '卖家昵称' },
@ -1917,7 +1915,7 @@ export const workbenchColumns = applyOrderListCopyActions([
{ prop: 'status', label: '订单状态', minWidth: 120 },
{ prop: 'sync_status', label: '同步状态', minWidth: 110 },
{ prop: 'inspection_status', label: '审核状态', minWidth: 110 },
{ prop: 'outbound_status', label: '出库状态', minWidth: 120 },
{ prop: 'outbound_status', label: '数据归档', minWidth: 120 },
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
{ prop: 'waybill_codes', label: '运单号', minWidth: 140, formatter: waybillCodesFormatter },
{ prop: 'items_total', label: '商品总数', minWidth: 100 },
@ -1979,7 +1977,7 @@ export const expectionColumns = [
{ prop: 'id', label: '订单ID', width: '80' },
{ prop: 'delivery_order_code', label: '发货单号', width: '170' },
{ prop: 'wave_no', label: '波次号', width: '170' },
{ prop: 'sys_platform_name', label: '平台', width: '120' },
{ prop: 'sys_platform_name', label: '平台编码', width: '120' },
{ prop: 'create_channel', label: '来源', width: '120' },
{ prop: 'shop_nick', label: '店铺名称', width: '140' },
orderStoreRemarkColumn,

View File

@ -11,7 +11,7 @@
type="info"
:closable="false"
show-icon
title="为指定待处理订单创建运单记录(wms_order_express),仅允许步骤为 1~3 且出库状态非待出库的订单。"
title="为指定待处理订单创建运单记录(wms_order_express),仅允许步骤为 1~3 且数据归档状态非归档中的订单。"
class="manual-waybill-alert"
/> -->
<el-form

View File

@ -56,10 +56,6 @@
@refresh="loadData"
@selection-change="onSelectionChange"
>
<template #column-sys_platform_code="{ row }">
{{ translateOrderField('sys_platform_code', row.sys_platform_code) }}
</template>
<template #column-status="{ row }">
<el-tag :type="getTagType('status', row.status)" size="small">
{{ translateOrderField('status', row.status) }}
@ -275,18 +271,17 @@ function normalizeOptionValue(value: unknown) {
return String(value ?? '').trim()
}
function mapCodeOptions(rawList: any[], codeKeys: string[], nameKeys: string[]) {
function mapNameOptions(rawList: any[], nameKeys: string[]) {
const result: Array<{ label: string; value: string }> = []
const seen = new Set<string>()
for (const item of rawList || []) {
const code = normalizeOptionValue(codeKeys.map((k) => item?.[k]).find((v) => v !== undefined && v !== null && v !== ''))
if (!code || seen.has(code)) continue
const name = normalizeOptionValue(nameKeys.map((k) => item?.[k]).find((v) => v !== undefined && v !== null && v !== ''))
if (!name || seen.has(name)) continue
result.push({
value: code,
label: name ? `${code} - ${name}` : code
value: name,
label: name
})
seen.add(code)
seen.add(name)
}
return result
}
@ -302,14 +297,14 @@ async function loadOrderMetaOptions() {
const platformRaw = platformData?.list || platformData || []
const expressData: any = expressRes?.data
const expressRaw = expressData?.list || expressData || []
const platformField = availableFieldsRef.find((i: any) => i.value === 'sys_platform_code')
const platformField = availableFieldsRef.find((i: any) => i.value === 'sys_platform_name')
if (platformField) {
platformField.options = mapCodeOptions(platformRaw, ['code', 'platform_code'], ['name', 'platform_name'])
platformField.options = mapNameOptions(platformRaw, ['name', 'platform_name'])
}
fillExpressCompanyScanFieldOptions(availableFieldsRef, expressRaw)
fillStoreScanFieldOptions(availableFieldsRef, extractStoreListFromResponse(storesRes))
} catch {
const platformField = availableFieldsRef.find((i: any) => i.value === 'sys_platform_code')
const platformField = availableFieldsRef.find((i: any) => i.value === 'sys_platform_name')
if (platformField) platformField.options = []
fillExpressCompanyScanFieldOptions(availableFieldsRef, [])
fillStoreScanFieldOptions(availableFieldsRef, [])

View File

@ -112,6 +112,12 @@
</el-tag>
</template>
<template #column-pick_assignment_status="{ row }">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.pick_assignment_status)">
{{ formatWavePickAssignmentStatusLabel(row.pick_assignment_status) }}
</el-tag>
</template>
<template #column-review_assignment_status="{ row }">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.review_assignment_status)">
{{ formatWaveReviewAssignmentStatusLabel(row.review_assignment_status) }}
@ -158,6 +164,15 @@
<template #column-operation="{ row }">
<el-button link type="primary" size="small" @click.stop="openPendingOrdersByWave(row)">处理订单</el-button>
<el-button
link
type="success"
size="small"
:loading="isWavePickCompleteLoading(row)"
@click.stop="handleWavePickComplete(row)"
>
批量拣货
</el-button>
</template>
<template #empty>
@ -865,6 +880,7 @@ import {
unwrapWavePlatformPrintPayload,
formatWaveExpressAssignmentStatusLabel,
formatWavePrintAssignmentStatusLabel,
formatWavePickAssignmentStatusLabel,
formatWaveReviewAssignmentStatusLabel,
getWaveAssignmentAggregateTagType,
buildOutboundPrintQueue,
@ -873,6 +889,7 @@ import {
} from './config/wave-config'
import { safeInvoke } from '@/utils/safe-invoke'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useWavePickComplete } from './composables/useWavePickComplete'
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
import WavePlatformPrintPreviewDialog from './component/WavePlatformPrintPreviewDialog.vue'
import PendingOrderListPanel from './component/PendingOrderListPanel.vue'
@ -1344,6 +1361,10 @@ const batchPrintDisabled = computed(() => {
})
const pendingOrderDialogTitle = computed(() => pendingOrderDialogWaveNo.value ? `待处理订单 - ${pendingOrderDialogWaveNo.value}` : '待处理订单')
const { handleWavePickComplete, isWavePickCompleteLoading } = useWavePickComplete({
onSuccess: () => loadData()
})
watch(
() => singleOrderActiveTab.value,
(tab) => {

View File

@ -112,6 +112,12 @@
</el-tag>
</template>
<template #column-pick_assignment_status="{ row }">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.pick_assignment_status)">
{{ formatWavePickAssignmentStatusLabel(row.pick_assignment_status) }}
</el-tag>
</template>
<template #column-review_assignment_status="{ row }">
<el-tag size="small" :type="getWaveAssignmentAggregateTagType(row.review_assignment_status)">
{{ formatWaveReviewAssignmentStatusLabel(row.review_assignment_status) }}
@ -158,6 +164,15 @@
<template #column-operation="{ row }">
<el-button link type="primary" size="small" @click.stop="openPendingOrdersByWave(row)">处理订单</el-button>
<el-button
link
type="success"
size="small"
:loading="isWavePickCompleteLoading(row)"
@click.stop="handleWavePickComplete(row)"
>
批量拣货
</el-button>
</template>
<template #empty>
@ -458,6 +473,7 @@ import {
unwrapWavePlatformPrintPayload,
formatWaveExpressAssignmentStatusLabel,
formatWavePrintAssignmentStatusLabel,
formatWavePickAssignmentStatusLabel,
formatWaveReviewAssignmentStatusLabel,
getWaveAssignmentAggregateTagType,
fetchOutboundPrintDataFromPendingOrders,
@ -466,6 +482,7 @@ import {
} from './config/wave-config'
import { safeInvoke } from '@/utils/safe-invoke'
import { useVerticalSplitPane } from '@/composables/useVerticalSplitPane'
import { useWavePickComplete } from './composables/useWavePickComplete'
import BatchReceivingPrintDialog from '@/components/BatchReceivingPrintDialog.vue'
import WavePlatformPrintPreviewDialog from './component/WavePlatformPrintPreviewDialog.vue'
import PrinterComponentConnectionPanel from './component/PrinterComponentConnectionPanel.vue'
@ -788,6 +805,10 @@ const batchPrintDisabled = computed(() => {
})
const pendingOrderDialogTitle = computed(() => pendingOrderDialogWaveNo.value ? `待处理订单 - ${pendingOrderDialogWaveNo.value}` : '待处理订单')
const { handleWavePickComplete, isWavePickCompleteLoading } = useWavePickComplete({
onSuccess: () => loadData()
})
onMounted(() => {
initializePage()
})

View File

@ -0,0 +1,75 @@
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { pickWavePickComplete } from '@/api/pick/pick'
function okCode(code: unknown) {
return code === 1 || code === 200 || code === 0
}
export function resolveWavePickCompleteWaveId(row: any): number | null {
const id = row?.wave_id ?? row?.id ?? row?.batch_id
const num = Number(id)
return Number.isFinite(num) && num > 0 ? num : null
}
function getWavePickCompleteLoadingKey(row: any) {
return String(row?.id ?? row?.wave_id ?? row?.batch_id ?? '')
}
export function useWavePickComplete(options: { onSuccess?: () => void | Promise<void> } = {}) {
const wavePickCompleteLoadingKey = ref('')
function isWavePickCompleteLoading(row: any) {
return wavePickCompleteLoadingKey.value === getWavePickCompleteLoadingKey(row)
}
async function handleWavePickComplete(row: any) {
const waveId = resolveWavePickCompleteWaveId(row)
if (!waveId) {
ElMessage.warning('当前波次缺少可用的波次 ID')
return
}
const waveNo = String(row?.wave_no || row?.wave_code || row?.batch_no || waveId).trim()
try {
await ElMessageBox.confirm(
`确定要对波次「${waveNo}」执行批量拣货(一键完成整个波次拣货)吗?`,
'批量拣货',
{ type: 'warning', confirmButtonText: '确认拣货', cancelButtonText: '取消' }
)
} catch {
return
}
const loadingKey = getWavePickCompleteLoadingKey(row)
wavePickCompleteLoadingKey.value = loadingKey
try {
const res = await pickWavePickComplete({ wave_id: waveId }) as Record<string, any>
if (res?.code !== undefined && res?.code !== null && !okCode(res.code)) {
throw new Error(res?.message || res?.tip || '批量拣货失败')
}
const data = (res?.data && typeof res.data === 'object') ? res.data : res
const status = String(data?.status ?? '').trim().toLowerCase()
const tip = String(data?.tip || res?.message || '').trim()
if (status === 'already_completed') {
ElMessage.info(tip || '该波次拣货已完成')
} else {
ElMessage.success(tip || '批量拣货成功')
}
await options.onSuccess?.()
} catch (error: any) {
console.error('wave pick complete failed:', error)
ElMessage.error(error?.message || '批量拣货失败')
} finally {
wavePickCompleteLoadingKey.value = ''
}
}
return {
handleWavePickComplete,
isWavePickCompleteLoading
}
}

View File

@ -146,6 +146,16 @@ export const waveAvailableFields = [
{ label: '已打印', value: 'printed' },
]
}),
scanWorkflowField({
label: '拣货状态',
value: 'pick_assignment_status',
type: 'select',
options: [
{ label: '未拣货', value: '未拣货' },
{ label: '部分拣货', value: '部分拣货' },
{ label: '已拣货', value: '已拣货' },
]
}),
scanWorkflowField({
label: '复核状态',
value: 'review_assignment_status',
@ -315,6 +325,7 @@ export const waveBatchColumns = applyWaveListCopyActions([
{ prop: 'storage_assignment_status', label: '库位分配', minWidth: 120 },
{ prop: 'express_assignment_status', label: '快递分配', minWidth: 120 },
{ prop: 'print_assignment_status', label: '打印状态', minWidth: 110 },
{ prop: 'pick_assignment_status', label: '拣货状态', minWidth: 110 },
{ prop: 'review_assignment_status', label: '复核状态', minWidth: 110 },
{ prop: 'unreviewed_order_count', label: '未复核数', minWidth: 96 },
{ prop: 'logistics_name', label: '快递', minWidth: 120 },
@ -323,7 +334,7 @@ export const waveBatchColumns = applyWaveListCopyActions([
{ prop: 'warehouse_id', label: '仓库ID', minWidth: 110 },
{ prop: 'create_time', label: '创建时间', minWidth: 168 },
{ prop: 'update_time', label: '更新时间', minWidth: 168 },
{ prop: 'operation', label: '操作', minWidth: 110, fixed: 'right' }
{ prop: 'operation', label: '操作', minWidth: 180, fixed: 'right' }
])
/** 列表查询 where 白名单(与 sanitizeWaveWhere 一致) */
@ -342,6 +353,7 @@ export const waveWhereAllowedFieldList = [
'storage_assignment_status',
'express_assignment_status',
'print_assignment_status',
'pick_assignment_status',
'review_assignment_status',
'total_orders_min',
'total_orders_max',
@ -371,6 +383,22 @@ const wavePrintAssignmentStatusLabelMap: Record<string, string> = {
已打印: '已打印'
}
const wavePickAssignmentStatusLabelMap: Record<string, string> = {
unpicked: '未拣货',
partially_picked: '部分拣货',
picked: '已拣货',
未拣货: '未拣货',
部分拣货: '部分拣货',
已拣货: '已拣货',
// 兼容历史/别名枚举
unassigned: '未拣货',
partially_assigned: '部分拣货',
assigned: '已拣货',
未分配: '未拣货',
部分分配: '部分拣货',
已分配: '已拣货'
}
const waveReviewAssignmentStatusLabelMap: Record<string, string> = {
unreviewed: '未复核',
partially_reviewed: '部分复核',
@ -392,6 +420,12 @@ export function formatWavePrintAssignmentStatusLabel(value: string | number | nu
return wavePrintAssignmentStatusLabelMap[key] ?? wavePrintAssignmentStatusLabelMap[key.toLowerCase()] ?? key
}
export function formatWavePickAssignmentStatusLabel(value: string | number | null | undefined): string {
if (value === undefined || value === null || value === '') return '—'
const key = String(value).trim()
return wavePickAssignmentStatusLabelMap[key] ?? wavePickAssignmentStatusLabelMap[key.toLowerCase()] ?? key
}
export function formatWaveReviewAssignmentStatusLabel(value: string | number | null | undefined): string {
if (value === undefined || value === null || value === '') return '—'
const key = String(value).trim()
@ -401,15 +435,15 @@ export function formatWaveReviewAssignmentStatusLabel(value: string | number | n
/** 快递分配 / 打印状态 / 库位分配等聚合状态列的 tag 类型(兼容英文枚举与中文文案) */
export function getWaveAssignmentAggregateTagType(value: string | number | null | undefined): 'success' | 'warning' | 'info' | 'danger' {
const v = String(value ?? '').toLowerCase().trim()
if (v === 'unassigned' || v === 'unprinted' || v === 'unsynced' || v === 'unreviewed') return 'info'
if (v === 'partially_assigned' || v === 'partially_printed' || v === 'partially_synced' || v === 'partially_reviewed') return 'warning'
if (v === 'assigned' || v === 'printed' || v === 'synced' || v === 'reviewed') return 'success'
if (v === 'unassigned' || v === 'unprinted' || v === 'unsynced' || v === 'unreviewed' || v === 'unpicked') return 'info'
if (v === 'partially_assigned' || v === 'partially_printed' || v === 'partially_synced' || v === 'partially_reviewed' || v === 'partially_picked') return 'warning'
if (v === 'assigned' || v === 'printed' || v === 'synced' || v === 'reviewed' || v === 'picked') return 'success'
const text = String(value ?? '')
if (text.includes('异常') || text.includes('失败') || text.includes('超时')) return 'danger'
if (text.includes('处理中')) return 'warning'
if (text.includes('已分配') || text.includes('完成') || text.includes('已打印')) return 'success'
if (text.includes('已分配') || text.includes('完成') || text.includes('已打印') || text.includes('已拣货')) return 'success'
if (text.includes('部分')) return 'warning'
if (text.includes('未分配') || text.includes('未打印')) return 'info'
if (text.includes('未分配') || text.includes('未打印') || text.includes('未拣货')) return 'info'
return 'info'
}
@ -1149,6 +1183,7 @@ export function toOutboundPrintForm(order: Record<string, unknown>, wave: Record
...order,
wave_no: String(wave.wave_no ?? wave.batch_no ?? wave.wave_code ?? wave.id ?? '—'),
delivery_order_code: resolveOutboundQueueNo(order),
remark: normalizePrintEmptyLabel(order.remark ?? order.seller_message ?? order.buyer_message ?? ''),
details: mapPendingOrderItemsToPrintDetails(lineItems),
}
}
@ -1262,13 +1297,35 @@ function resolveItemSnapshot(item: Record<string, unknown>): Record<string, unkn
return {}
}
function snapshotField(snap: Record<string, unknown>, key: string): string {
const value = snap[key]
function normalizePrintEmptyLabel(value: unknown): string {
if (value == null || value === '') return SNAPSHOT_EMPTY_LABEL
const text = String(value).trim()
return text || SNAPSHOT_EMPTY_LABEL
}
function snapshotField(snap: Record<string, unknown>, key: string): string {
return normalizePrintEmptyLabel(snap[key])
}
/** 订单行字段优先,其次 item_snapshot;均无则返回「无」 */
function resolvePrintLineField(
item: Record<string, unknown>,
snap: Record<string, unknown>,
...keys: string[]
): string {
for (const key of keys) {
const fromItem = item[key]
if (fromItem != null && fromItem !== '' && String(fromItem).trim() !== '') {
return String(fromItem).trim()
}
const fromSnap = snap[key]
if (fromSnap != null && fromSnap !== '' && String(fromSnap).trim() !== '') {
return String(fromSnap).trim()
}
}
return SNAPSHOT_EMPTY_LABEL
}
function orderLineQuantity(item: Record<string, unknown>): string {
const value = item.plan_qty ?? item.quantity ?? item.qty
if (value == null || value === '') return SNAPSHOT_EMPTY_LABEL
@ -1276,29 +1333,39 @@ function orderLineQuantity(item: Record<string, unknown>): string {
return text || SNAPSHOT_EMPTY_LABEL
}
/** 商品明细:商品信息仅用 item_snapshot;数量取订单行 plan_qty */
/** 商品明细:优先订单行字段,回退 item_snapshot;数量取订单行 plan_qty */
function mapPendingOrderItemsToPrintDetails(items: Record<string, unknown>[]) {
return items.map((item) => {
const snap = resolveItemSnapshot(item)
const quantity = orderLineQuantity(item)
const itemCode = resolvePrintLineField(item, snap, 'item_code')
const itemName = resolvePrintLineField(item, snap, 'item_name')
const unitPrice = resolvePrintLineField(item, snap, 'actual_price', 'retail_price', 'price', 'unit_price')
return {
item_snapshot: snap,
item_code: snapshotField(snap, 'item_code'),
item_name: snapshotField(snap, 'item_name'),
barcode: snapshotField(snap, 'barcode'),
sku_property: snapshotField(snap, 'sku_property'),
goods_code: snapshotField(snap, 'goods_code'),
brand_name: snapshotField(snap, 'brand_name'),
category_name: snapshotField(snap, 'category_name'),
stock_unit: snapshotField(snap, 'stock_unit'),
item_type: snapshotField(snap, 'item_type'),
inventory_type: snapshotField(snap, 'inventory_type'),
retail_price: snapshotField(snap, 'retail_price'),
item_snapshot: {
...snap,
item_code: itemCode === SNAPSHOT_EMPTY_LABEL ? snap.item_code : itemCode,
item_name: itemName === SNAPSHOT_EMPTY_LABEL ? snap.item_name : itemName,
goods_code: resolvePrintLineField(item, snap, 'goods_code'),
retail_price: unitPrice === SNAPSHOT_EMPTY_LABEL ? snap.retail_price : unitPrice,
},
item_code: itemCode,
item_name: itemName,
barcode: resolvePrintLineField(item, snap, 'barcode'),
sku_property: resolvePrintLineField(item, snap, 'sku_property', 'ext_code'),
goods_code: resolvePrintLineField(item, snap, 'goods_code'),
brand_name: resolvePrintLineField(item, snap, 'brand_name'),
category_name: resolvePrintLineField(item, snap, 'category_name'),
stock_unit: resolvePrintLineField(item, snap, 'stock_unit'),
item_type: resolvePrintLineField(item, snap, 'item_type'),
inventory_type: resolvePrintLineField(item, snap, 'inventory_type'),
retail_price: unitPrice,
plan_qty: quantity,
quantity,
actual_price: snapshotField(snap, 'retail_price'),
price: snapshotField(snap, 'retail_price'),
actual_price: unitPrice,
price: unitPrice,
unit_price: unitPrice,
}
})
}
@ -1379,7 +1446,7 @@ export function mapPendingOrderToOutboundPrintForm(
town: order.town ?? '',
detail_address: order.detail_address ?? '',
address: addressParts.join(''),
remark: order.remark ?? order.seller_message ?? order.buyer_message ?? '',
remark: normalizePrintEmptyLabel(order.remark ?? order.seller_message ?? order.buyer_message ?? ''),
print_time: formatOutboundPrintDateTime(new Date()),
details: mapPendingOrderItemsToPrintDetails(items),
})