feat(consignment): 统一寄卖匹配看板口径并收口占用与重匹配

- 看板与引擎统一数量、模板规格、正向规格信号判定,纳入 internal_matching/unassigned

- 库存侧改走新引擎匹配,移除旧 /fulfill 手动入口与旧弹窗

- 验收时将 reserved allocation 收口为 consumed,补份额级收口

- 拼单重新匹配通过 material 排除全部原库存/原卖家

- 开发/测试环境放宽迁移顺序校验,生产保持严格;修正集成测试份额报酬口径
This commit is contained in:
2026-11-12 15:17:09 +08:00
parent 229eef31a8
commit e39f640dac
18 changed files with 962 additions and 759 deletions
@@ -12,13 +12,25 @@ import { formatDateTime } from '@/utils/date-time'
const { Text } = Typography
function resolveScoreTag(pair: PendingPistolMatchPair) {
if (pair.matchType === 'exact') return { color: 'green', label: '精确' }
if (pair.quantitySufficient === false) return { color: 'orange', label: '数量不足' }
if (pair.matchType === 'exact') {
return pair.autoMatchable === false
? { color: 'gold', label: '需人工' }
: { color: 'green', label: '精确' }
}
if (pair.matchType === 'conflict') return { color: 'default', label: '不匹配' }
if (pair.autoMatchable) return { color: 'blue', label: '可自动' }
if (pair.score >= 90) return { color: 'blue', label: '非精确' }
if (pair.score >= 70) return { color: 'orange', label: '非精确' }
return { color: 'gold', label: '需核对' }
}
function resolveOrderStatusTag(status?: string) {
if (status === 'internal_matching') return { color: 'purple', label: '内部匹配中' }
if (status === 'unassigned') return { color: 'default', label: '待分配' }
return { color: 'blue', label: '待抢单' }
}
export default function ConsignmentPendingMatchModal({
open,
onClose,
@@ -106,9 +118,28 @@ export default function ConsignmentPendingMatchModal({
<Text type="secondary" style={{ fontSize: 11 }}>
录单 {record.workOrderCreatedAt ? formatDateTime(record.workOrderCreatedAt) : '-'}
</Text>
{Number(record.totalQuantity || 1) > 1 ? (
<Text type="secondary" style={{ fontSize: 11 }}>
拼单剩余 {record.remainingQuantity ?? 0} / {record.totalQuantity} 份
<Space size={4} wrap>
<Tag
color={resolveOrderStatusTag(record.workOrderStatus).color}
style={{ marginInlineEnd: 0 }}
>
{resolveOrderStatusTag(record.workOrderStatus).label}
</Tag>
{Number(record.totalQuantity || 1) > 1 ? (
<Text type="secondary" style={{ fontSize: 11 }}>
拼单剩余 {record.remainingQuantity ?? 0} / {record.totalQuantity} 份
</Text>
) : null}
</Space>
{Number(record.requiredQuantity || 0) > 0 ? (
<Text
type={record.quantitySufficient === false ? 'danger' : 'secondary'}
style={{ fontSize: 11 }}
>
{record.sharingEnabled
? `拼单还需 ${record.requiredQuantity} 份 / 该库存剩 ${record.availableQuantity ?? '-'} 件`
: `需求 ${record.requiredQuantity} 件 / 该库存剩 ${record.availableQuantity ?? '-'} 件`}
{record.quantitySufficient === false ? '(整单汇总不足)' : ''}
</Text>
) : null}
</Space>
@@ -198,7 +229,11 @@ export default function ConsignmentPendingMatchModal({
return (
<Modal
title={categoryName ? `匹配 · ${categoryName} 待抢单 × 在库现货` : '匹配 · 待抢单 × 在库现货'}
title={
categoryName
? `匹配 · ${categoryName} 待匹配订单 × 在库现货`
: '匹配 · 待匹配订单 × 在库现货'
}
open={open}
width="min(1320px, 94vw)"
footer={null}
@@ -211,19 +246,21 @@ export default function ConsignmentPendingMatchModal({
showIcon
message={
categoryName
? `只统计「${categoryName}」分类下的待抢单 × 在库待匹配现货,不直接改单。`
: '按寄卖配置匹配全部待抢单 × 在库待匹配现货,不直接改单。'
? `只统计「${categoryName}」分类下的待匹配订单 × 在库待匹配现货,不直接改单。`
: '按寄卖配置匹配全部待匹配订单 × 在库待匹配现货,不直接改单。'
}
description="有寄卖配置的订单按该分类的规格逐项判定(精确 / 非精确 / 不匹配);拼单订单按剩余份数展示。"
description="有寄卖配置的订单按该分类的规格逐项判定(精确 / 非精确 / 不匹配);内部匹配中、待分配、待抢单的工单都会纳入。数量不足或没有正向规格信号的非精确项会单独标记,自动匹配不会选中。"
/>
<Space wrap size={12}>
{categoryName ? <Tag color="blue">分类:{categoryName}</Tag> : null}
<Tag>待抢单 {data?.pendingOrderCount ?? 0} 单</Tag>
<Tag>待匹配 {data?.pendingOrderCount ?? 0} 单</Tag>
<Tag>在库待匹配 {data?.inStockInventoryCount ?? 0} 件</Tag>
<Tag color="blue">匹配组合 {data?.pairCount ?? 0} 条</Tag>
<Tag color="green">精确 {data?.exactCount ?? 0}</Tag>
<Tag color="orange">非精确 {data?.partialCount ?? 0}</Tag>
<Tag color="purple">数量不足 {data?.quantityShortCount ?? 0}</Tag>
<Tag color="cyan">可自动 {data?.autoMatchableCount ?? 0}</Tag>
{includeConflicts ? <Tag>不匹配 {data?.conflictCount ?? 0}</Tag> : null}
</Space>