fix(本地启动): 配置纠偏回写改动态导入避免循环依赖
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user