优化接单模板改价同步范围

This commit is contained in:
yml
2026-11-14 23:27:11 +08:00
parent ba6d5fb43b
commit 572c43ce0e
9 changed files with 98 additions and 28 deletions
@@ -132,14 +132,14 @@ export async function getWorkProductRuleById(
return result.rows[0] || null
}
/** 查询尚未形成不可变履约合同、需要跟随模板价格更新的工单。 */
/** 查询已经进入接单大厅、需要立即跟随模板价格更新的工单。 */
export async function listWorkOrdersForPriceSyncByProductRuleId(
ruleId: number | string,
client?: Pick<PoolClient, 'query'>,
): Promise<WorkOrderRow[]> {
const sql = `${WORK_ORDER_SELECT}
WHERE wo.product_rule_id = $1
AND wo.status IN ('pending_material', 'unassigned', 'open')
AND wo.status = 'open'
ORDER BY wo.id ASC`
const result = client
? await client.query<WorkOrderRow>(sql, [Number(ruleId)])