From 9d96d774eded20061cee89f7bfa204b7b87fb22d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 27 Oct 2026 12:39:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=9C=AC=E5=9C=B0=E5=90=AF=E5=8A=A8):=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=BA=A0=E5=81=8F=E5=9B=9E=E5=86=99=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=AF=BC=E5=85=A5=E9=81=BF=E5=85=8D=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/services/pickingConfigService.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/src/services/pickingConfigService.ts b/server/src/services/pickingConfigService.ts index c907267..efa66eb 100644 --- a/server/src/services/pickingConfigService.ts +++ b/server/src/services/pickingConfigService.ts @@ -1,6 +1,5 @@ import type { Pool, PoolClient } from 'pg'; import { pool } from '../db'; -import { enqueueMainSystemWritebackForReadyOrder } from './mainSystemWriteback'; import * as dbModule from '../db'; import { runWithTenantDbContext } from './tenantDbContext'; import { supplierSkipInboundExistsSql } from './supplierSkipInbound'; @@ -267,9 +266,14 @@ export async function setPickingWorkflowEnabled( [branch] ); healed = healedRows.rowCount || 0; - for (const row of healedRows.rows as Array<{ order_code?: unknown }>) { - const orderCode = String(row.order_code || '').trim(); - if (orderCode) enqueueMainSystemWritebackForReadyOrder({ branchCode: branch, orderCode }); + // 动态 import:避免 pickingConfigService ←→ mainSystemWriteback 循环依赖导致启动期 + // UNCATEGORIZED_SCOPE_KEY 未初始化(本地实机已撞到)。 + if (healedRows.rowCount) { + const { enqueueMainSystemWritebackForReadyOrder } = await import('./mainSystemWriteback'); + for (const row of healedRows.rows as Array<{ order_code?: unknown }>) { + const orderCode = String(row.order_code || '').trim(); + if (orderCode) enqueueMainSystemWritebackForReadyOrder({ branchCode: branch, orderCode }); + } } }