修复(寄卖): 恢复待抢单手枪简单匹配看板

This commit is contained in:
yml
2026-11-18 20:39:27 +08:00
parent 97a98ac162
commit d521c6b259
9 changed files with 233 additions and 277 deletions
@@ -94,10 +94,12 @@ test('筛选选项接口:按已开启寄卖的分类返回', () => {
)
})
test('一键查询待匹配订单:按当前寄卖分类查询', () => {
test('一键查询待匹配订单:恢复为全局手枪查询,不继承当前寄卖分类', () => {
const modalSource = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
const panelCall = panelSource.slice(panelSource.indexOf('<ConsignmentPendingMatchModal'))
assert.ok(modalSource.includes('categoryId: categoryId ?? undefined'), '必须把分类传给待匹配接口')
assert.ok(modalSource.includes('分类:{categoryName}'), '弹窗要标明当前分类')
assert.ok(panelSource.includes('categoryId={categoryId}'), '仓库面板必须把当前分类传给弹窗')
assert.ok(modalSource.includes('fetchPendingSuernanPistolMatches'), '必须调用简单手枪查询接口')
assert.ok(!modalSource.includes('categoryId: categoryId'), '简单手枪看板不得继承库存分类')
assert.ok(!panelCall.includes('categoryId={categoryId}'), '仓库面板不得向手枪看板传当前分类')
assert.ok(!panelCall.includes('categoryName='), '仓库面板不得向手枪看板传当前分类名称')
})
@@ -7,65 +7,54 @@ function readSource(relativePath: string): string {
return readFileSync(fileURLToPath(new URL(relativePath, import.meta.url)), 'utf8')
}
test('一键查询待匹配订单:每行提供「选择」,打开手动匹配并预选该库存', () => {
const source = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
assert.ok(source.includes("title: '操作'"), '必须新增操作列')
assert.ok(source.includes('选择'), '操作列按钮文案必须是「选择」')
assert.ok(source.includes('setSelectTarget({'), '点击选择必须记录订单与库存')
assert.ok(source.includes('<ConsignmentWorkOrderMatchModal'), '必须挂载手动匹配弹窗')
assert.ok(source.includes('initialInventoryIds'), '必须把选中的库存传给手动匹配弹窗')
assert.ok(source.includes('workOrderId={selectTarget?.workOrderId ?? null}'))
})
test('一键查询待匹配订单:快速匹配按履约权限门控,成功后刷新看板与库存', () => {
test('一键查询待匹配订单:恢复为独立只读的手枪匹配看板', () => {
const modal = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
const panel = readSource('../src/pages/admin/panels/ConsignmentInventoryPanel.tsx')
assert.ok(modal.includes('canMatch = false'), '默认无权限时不给操作入口')
assert.ok(modal.includes('void query.refetch()'), '匹配成功后必须刷新看板')
assert.ok(modal.includes('onMatched?.()'), '匹配成功后必须通知外层刷新库存')
assert.ok(modal.includes('fetchPendingSuernanPistolMatches'), '必须调用简单手枪匹配接口')
assert.ok(modal.includes('不直接改单'), '一键查询必须是只读看板')
assert.ok(!modal.includes('<ConsignmentWorkOrderMatchModal'), '不得再嵌套手动匹配弹窗')
assert.ok(!modal.includes('setSelectTarget('), '不得恢复二级选择流程')
assert.ok(!modal.includes('ConsignmentPriceWithDiff'), '简单看板不展示付款差价')
assert.ok(
panel.includes('canMatch={canFulfillConsignment}'),
'仓库面板必须按 consignment.fulfill 权限传入 canMatch',
panel.includes('<ConsignmentPendingMatchModal\n open={pendingMatchOpen}'),
'仓库面板只传入开关状态',
)
assert.ok(
panel.includes('onMatched={() => void inventoriesQuery.refetch()}'),
'仓库面板必须刷新库存列表',
!panel.includes('categoryId={categoryId}\n categoryName='),
'不得隐式继承库存分类',
)
})
test('一键查询待匹配订单:说明文案不再声称「不直接改单」', () => {
test('一键查询待匹配订单:默认隐藏冲突,可显式查看', () => {
const source = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
assert.ok(!source.includes('不直接改单'), '新增选择匹配后必须去掉只读文案')
assert.ok(source.includes('「手动匹配方式」') || source.includes('手动匹配'))
assert.ok(source.includes('useState(false)'), '冲突项默认关闭')
assert.ok(source.includes('includeConflicts,'), '查询必须透传冲突开关')
assert.ok(source.includes('显示 0 分不匹配项'), '必须保留冲突查看开关')
assert.ok(source.includes('系统 20 / 区服 20 / 系列 20 / 钻级 25 / 璀璨 15'), '必须说明固定权重')
assert.ok(source.includes('同分时录单更早的订单优先'), '积压订单必须优先')
})
test('一键查询待匹配订单:默认展示全部配对并按枪型/钻石/璀璨排序', () => {
const source = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
assert.ok(source.includes('includeConflicts: true'), '默认必须包含冲突(0 分)配对')
assert.ok(!source.includes('显示 0 分不匹配项'), '旧的勾选框必须删除')
assert.ok(
!source.includes('right.score - left.score'),
'不得在前端只按分数重排,否则会覆盖后端的「枪型/钻石/璀璨」优先级',
test('一键查询待匹配订单:后端读取全部 open 工单并按剩余数量统计库存', () => {
const source = readSource(
'../../backend/src/services/worker-platform/consignment-pending-match-service.ts',
)
assert.ok(source.includes('不匹配 {data?.conflictCount ?? 0}'), '必须展示不匹配数量')
assert.ok(source.includes('默认展示全部配对,按 枪型 → 钻石 → 璀璨 排序'), '界面必须说明默认口径')
})
test('一键查询 / 手动匹配:展示工单用户付款金额与售价差价', () => {
const pending = readSource('../src/components/admin/ConsignmentPendingMatchModal.tsx')
const manual = readSource('../src/components/admin/ConsignmentWorkOrderMatchModal.tsx')
for (const source of [pending, manual]) {
assert.ok(source.includes("title: '工单用户付款金额'"), '两个弹窗都必须有用户付款金额列')
assert.ok(source.includes('ConsignmentPriceWithDiff'), '售价列必须带差价展示')
}
assert.ok(pending.includes('sharingEnabled={record.sharingEnabled}'), '拼单不展示差价')
assert.ok(source.includes('listAllOpenWorkOrdersForPistolBoard'), '必须提供简单手枪查询入口')
assert.ok(source.includes('while (items.length < total)'), '不得只读取最近 500 单')
assert.ok(
manual.includes('sharingEnabled={sharingEnabled && totalQuantity > 1}'),
'拼单不展示差价',
source.includes('sum + Math.max(0, Number(inventory.remaining_quantity ?? 1))'),
'在库件数必须按 remaining_quantity 汇总',
)
assert.ok(source.includes('listPendingSuernanPistolMatches'), '必须导出简单手枪查询服务')
})
test('一键查询待匹配订单:不得影响库存侧完整匹配引擎', () => {
const service = readSource('../src/services/admin/consignment.ts')
const inventoryModal = readSource('../src/components/admin/ConsignmentInventoryMatchModal.tsx')
assert.ok(service.includes('fetchPendingPistolMatches'), '库存侧完整匹配接口必须保留')
assert.ok(service.includes('/consignment/pending-pistol-matches'), '库存侧继续使用原完整匹配接口')
assert.ok(inventoryModal.includes('fetchPendingPistolMatches'), '库存侧弹窗不得改用简单看板接口')
})