优化按件拼单自动计算

This commit is contained in:
yml2213
2026-08-18 14:37:13 +08:00
parent c2305d419e
commit 7ccf3a6cee
9 changed files with 193 additions and 38 deletions
@@ -150,6 +150,7 @@ export type WorkProductRuleRow = {
sharing_enabled: boolean
sharing_total_quantity: number
sharing_unit_reward: number
sharing_auto_from_order: boolean
timeout_minutes: number
timeout_policy: string
requirement_json: string | Record<string, unknown>
@@ -718,6 +718,7 @@ export async function upsertWorkProductRule(input: {
sharingEnabled?: boolean
sharingTotalQuantity?: number
sharingUnitReward?: number
sharingAutoFromOrder?: boolean
timeoutMinutes?: number
timeoutPolicy?: string
requirementJson: string
@@ -732,7 +733,7 @@ export async function upsertWorkProductRule(input: {
match_type, category_id, enabled, auto_create, reward_amount,
unit_price_fen,
required_deposit_amount, deposit_threshold_amount,
sharing_enabled, sharing_total_quantity, sharing_unit_reward,
sharing_enabled, sharing_total_quantity, sharing_unit_reward, sharing_auto_from_order,
timeout_minutes, timeout_policy,
requirement_json, match_json,
sort_order, created_at, updated_at
@@ -741,10 +742,10 @@ export async function upsertWorkProductRule(input: {
$7, $8, $9, $10, $11,
$12,
$13, $14,
$15, $16, $17,
$18, $19,
$20::jsonb, $21::jsonb,
$22, $23, $24
$15, $16, $17, $18,
$19, $20,
$21::jsonb, $22::jsonb,
$23, $24, $25
)
ON CONFLICT (rule_key) DO UPDATE
SET
@@ -764,6 +765,7 @@ export async function upsertWorkProductRule(input: {
sharing_enabled = EXCLUDED.sharing_enabled,
sharing_total_quantity = EXCLUDED.sharing_total_quantity,
sharing_unit_reward = EXCLUDED.sharing_unit_reward,
sharing_auto_from_order = EXCLUDED.sharing_auto_from_order,
timeout_minutes = EXCLUDED.timeout_minutes,
timeout_policy = EXCLUDED.timeout_policy,
requirement_json = EXCLUDED.requirement_json,
@@ -790,6 +792,7 @@ export async function upsertWorkProductRule(input: {
input.sharingEnabled === true,
toPositiveInteger(input.sharingTotalQuantity, 1),
toPositiveInteger(input.sharingUnitReward, 0),
input.sharingAutoFromOrder === true,
toPositiveInteger(input.timeoutMinutes, 0),
String(input.timeoutPolicy || 'reopen').trim(),
input.requirementJson,