fix(worker-platform): 支持寄售筛选叠加接单人员
This commit is contained in:
@@ -1526,12 +1526,9 @@ export function buildWorkOrderWhere({
|
||||
if (acceptanceMode) {
|
||||
const rawMode = String(acceptanceMode).trim()
|
||||
if (rawMode === 'internal_consignment') {
|
||||
filters.push(`(
|
||||
wo.material_json->'consignment'->>'inventoryId' IS NOT NULL
|
||||
AND (wo.material_json->'consignment'->>'fulfillmentType' IS NULL OR wo.material_json->'consignment'->>'fulfillmentType' != 'worker_deposit')
|
||||
AND (wo.material_json->'consignment'->>'workerId' IS NULL OR wo.material_json->'consignment'->>'workerId' = '0')
|
||||
AND (wo.assigned_worker_id IS NULL OR wo.assigned_worker_id = 0)
|
||||
)`)
|
||||
// 「寄售来源」与是否已经匹配打手是两个正交条件。
|
||||
// 这里不能内置“必须未指派”,否则再接 workerId 筛选会恒为空。
|
||||
filters.push(`wo.material_json->'consignment'->>'inventoryId' IS NOT NULL`)
|
||||
} else if (rawMode === WORK_ORDER_ACCEPTANCE_MODE.FRIEND_GIFT) {
|
||||
filters.push(`(
|
||||
wo.acceptance_mode = 'friend_gift'
|
||||
|
||||
@@ -1970,15 +1970,22 @@ test('好友赠送待打手提交资料筛选排除待抢单订单', () => {
|
||||
assert.match(whereClause, /wo\.status IN \('in_progress', 'problem'\)/)
|
||||
})
|
||||
|
||||
test('工单筛选支持内部寄售匹配与打手好友赠送隔离,且赠送冷却中排除已验收已取消工单', () => {
|
||||
test('工单筛选支持内部寄售来源叠加人员条件,并保持好友赠送与冷却筛选', () => {
|
||||
const internalQuery = buildWorkOrderWhere({ acceptanceMode: 'internal_consignment' })
|
||||
assert.match(
|
||||
internalQuery.whereClause,
|
||||
/wo\.material_json->'consignment'->>'inventoryId' IS NOT NULL/,
|
||||
)
|
||||
assert.doesNotMatch(internalQuery.whereClause, /wo\.assigned_worker_id IS NULL/)
|
||||
|
||||
const workerScopedInternalQuery = buildWorkOrderWhere({
|
||||
acceptanceMode: 'internal_consignment',
|
||||
workerSharingId: 25,
|
||||
})
|
||||
assert.match(workerScopedInternalQuery.joins, /worker_visible\.work_order_id = wo\.id/)
|
||||
assert.match(
|
||||
internalQuery.whereClause,
|
||||
/wo\.assigned_worker_id IS NULL OR wo\.assigned_worker_id = 0/,
|
||||
workerScopedInternalQuery.whereClause,
|
||||
/wo\.material_json->'consignment'->>'inventoryId' IS NOT NULL/,
|
||||
)
|
||||
|
||||
const friendGiftQuery = buildWorkOrderWhere({ acceptanceMode: 'friend_gift' })
|
||||
|
||||
Reference in New Issue
Block a user