diff --git a/server/scripts/split-multi-customer-quote-sheets.ts b/server/scripts/split-multi-customer-quote-sheets.ts index 5e9fb18..de3f35c 100644 --- a/server/scripts/split-multi-customer-quote-sheets.ts +++ b/server/scripts/split-multi-customer-quote-sheets.ts @@ -14,8 +14,8 @@ * ⚠️ 本库业务表启用 **RLS**:不带 `app.branch_code` 时查询恒为 0 行(2026-10-18 实测)。 * 所以所有查询/写入都必须在 `withTenant()` 内执行。 */ -import { pool } from '../src/db'; -import { newSheetCode } from '../src/services/quoteSheetService'; +import { pool } from '../dist/db'; +import { newSheetCode } from '../dist/services/quoteSheetService'; const argv = process.argv.slice(2); const execute = argv.includes('--execute'); @@ -209,11 +209,11 @@ async function main() { ); await client.query( `UPDATE ${schema}.customer_quote_sheets SET status = 3, updated_at = NOW() - WHERE status = 1 AND quote_sheet_code <> $1 + WHERE status = 1 AND quote_sheet_code <> $1 AND quote_sheet_code <> $3 AND quote_sheet_code IN ( SELECT quote_sheet_code FROM ${schema}.customer_quote_sheet_customers WHERE customer_code = $2 )`, - [nextCode, extra] + [nextCode, extra, row.code] ); createdCodes.push(`${extra}=${nextCode}`); }