diff --git a/server/src/services/quoteSheetEditService.ts b/server/src/services/quoteSheetEditService.ts index 30fdea8..54b2b31 100644 --- a/server/src/services/quoteSheetEditService.ts +++ b/server/src/services/quoteSheetEditService.ts @@ -47,11 +47,26 @@ export async function requestDeliveryReviewForSheet(input: { const branchCode = input.branchCode || getEffectiveBranchCode(input.ctx || null, input.operatingBranchCode || null); if (!branchCode) return { ok: false, code: 'branch_required', message: '请选择当前操作分公司' }; + // 后台/系统触发没有请求上下文 ⇒ 造一个只带分公司的最小 ctx(非超管 ⇒ getEffectiveBranchCode 直接用 ctx.branchCode) + const ctx: TenantContext = + input.ctx ?? + ({ + userId: '', + roles: [], + permissions: ['customer_manage'], + branchCode, + supplierCode: null, + purchaserCode: null, + isSuperAdmin: false, + isBranchAdmin: false, + isInternalStaff: false, + isSupplierAccount: false, + } as TenantContext); try { const res = await submitPriceProposal({ quoteSheetCode: input.quoteSheetCode, note: null, - ctx: input.ctx ?? null, + ctx, operatingBranchCode: input.operatingBranchCode ?? branchCode, requestedBy: input.requestedBy ?? null, });