feat(consignment): 优化寄售仓库与接单工单双向手动匹配,支持工单号与提报单号检索与强制匹配
1. 寄售仓库手动匹配订单扩充支持 open 状态工单,增强 WO 工单号与纯数字的模糊/前缀搜索,修复工单搜不到的问题并在卡片高亮展示内部工单号与状态; 2. 接单工单操作列全面支持【手动匹配寄售】,允许从接单工单主动调起寄售匹配弹窗; 3. 寄售现货筛选支持通过 SUB 提报单号、INV 仓库号、供货打手等快速搜索; 4. 完善规格冲突下的强制匹配确认与必填原因提交机制,确保履约全流程留痕合规。
This commit is contained in:
@@ -846,13 +846,13 @@ export function buildWorkOrderWhere({
|
||||
params.push(normalizedKeyword)
|
||||
const paramIndex = `$${params.length}`
|
||||
filters.push(
|
||||
`(wo.platform_order_id = ${paramIndex} OR wo.platform_order_id LIKE ${paramIndex} || '%')`,
|
||||
`(wo.platform_order_id = ${paramIndex} OR wo.platform_order_id LIKE ${paramIndex} || '%' OR wo.work_order_no ILIKE '%' || ${paramIndex} || '%')`,
|
||||
)
|
||||
} else if (isWorkOrderNoLookupKeyword(normalizedKeyword)) {
|
||||
params.push(normalizedKeyword)
|
||||
const paramIndex = `$${params.length}`
|
||||
filters.push(
|
||||
`(wo.work_order_no = ${paramIndex} OR wo.work_order_no ILIKE ${paramIndex} || '%' OR LOWER(wo.work_order_no) = LOWER(${paramIndex}))`,
|
||||
`(wo.work_order_no = ${paramIndex} OR wo.work_order_no ILIKE ${paramIndex} || '%' OR wo.work_order_no ILIKE '%' || ${paramIndex} || '%' OR LOWER(wo.work_order_no) = LOWER(${paramIndex}))`,
|
||||
)
|
||||
} else {
|
||||
params.push(`%${normalizedKeyword}%`)
|
||||
|
||||
@@ -250,7 +250,11 @@ export async function listInventoryMatchableOrders(
|
||||
}
|
||||
|
||||
const { items } = await listWorkOrders({
|
||||
statuses: [WORK_ORDER_STATUS.UNASSIGNED, WORK_ORDER_STATUS.PENDING_MATERIAL],
|
||||
statuses: [
|
||||
WORK_ORDER_STATUS.UNASSIGNED,
|
||||
WORK_ORDER_STATUS.PENDING_MATERIAL,
|
||||
WORK_ORDER_STATUS.OPEN,
|
||||
],
|
||||
keyword: String(input.keyword || '').trim(),
|
||||
pageSize: Math.min(Math.max(Number(input.pageSize || 50), 1), 100),
|
||||
sort: 'id_desc',
|
||||
@@ -358,11 +362,13 @@ export async function fulfillWorkOrderWithConsignment(input: {
|
||||
throw createHttpError('工单不存在', { statusCode: 404, errorCode: 'work_order_not_found' })
|
||||
}
|
||||
|
||||
// 仅未分配或待补资料工单支持选用库存履约
|
||||
// 未分配、待补资料或大厅待接单工单支持选用库存履约
|
||||
if (
|
||||
![WORK_ORDER_STATUS.UNASSIGNED, WORK_ORDER_STATUS.PENDING_MATERIAL].includes(
|
||||
workOrder.status as any,
|
||||
)
|
||||
![
|
||||
WORK_ORDER_STATUS.UNASSIGNED,
|
||||
WORK_ORDER_STATUS.PENDING_MATERIAL,
|
||||
WORK_ORDER_STATUS.OPEN,
|
||||
].includes(workOrder.status as any)
|
||||
) {
|
||||
throw createHttpError('当前工单状态不允许直接使用内部库存履约', {
|
||||
statusCode: 409,
|
||||
|
||||
Reference in New Issue
Block a user