fix(报价单): 去掉已删除的内部改价审核前置检查(否则 A 发起会 42P01)
This commit is contained in:
@@ -35,7 +35,7 @@ import { getMappingByDeliverySku, getSheetMappingStats } from './skuMappingServi
|
||||
* 纪律(前几轮踩过):
|
||||
* · 出站 HTTP **永远在事务之外**;B 审批路径**不调** `triggerQuoteCostSync`(由配送侧按 D3 落地);
|
||||
* · 台账 `main_system_quote_cost_pushes` 的唯一键/rearm 已存在 —— 本层**不重造推送、不直接写台账**;
|
||||
* · `quote_sheet_change_requests`(内部改价审核)与 `quote_price_proposals`(对外传递)是**两层**,不合并;
|
||||
* · 内部改价审核已删除(2026-10-18 用户裁定):改价一律走 `quote_price_proposals` 由对方审核;
|
||||
* A 发起只检查"内部是否有在途 pending";
|
||||
* · 开关 `MAIN_SYSTEM_QUOTE_PRICE_PROPOSAL` 默认关 ⇒ 零出站、零写库(路由 503)。
|
||||
*
|
||||
@@ -208,21 +208,6 @@ async function loadSheetItemRows(quoteSheetCode: string): Promise<LocalRow[]> {
|
||||
return result.rows;
|
||||
}
|
||||
|
||||
/** 内部改价审核是否仍有在途 pending(A 发起的前置条件) */
|
||||
async function hasInternalReviewPending(branchCode: string, quoteSheetCode: string): Promise<boolean> {
|
||||
const result = await pool.query<{ status: string }>(
|
||||
`SELECT status FROM quote_sheet_change_requests
|
||||
WHERE branch_code = $1 AND quote_sheet_code = $2
|
||||
ORDER BY requested_at DESC
|
||||
LIMIT 1`,
|
||||
[branchCode, quoteSheetCode]
|
||||
);
|
||||
const latest = result.rows[0];
|
||||
if (!latest) return false;
|
||||
// 有在途 ⇒ 必须等内部审完;历史上只有被覆盖(superseded)而没有后继的行也视为未收口
|
||||
return latest.status === 'pending' || latest.status === 'superseded';
|
||||
}
|
||||
|
||||
async function findLocalByRemoteId(
|
||||
remoteProposalId: string
|
||||
): Promise<LocalRow | null> {
|
||||
@@ -322,9 +307,6 @@ export async function submitPriceProposal(input: {
|
||||
const sheet = await loadQuoteSheetForUpdate(input.quoteSheetCode, input.ctx, input.operatingBranchCode);
|
||||
const quoteSheetCode = String(sheet.quote_sheet_code);
|
||||
|
||||
if (await hasInternalReviewPending(branchCode, quoteSheetCode)) {
|
||||
throw httpError(409, 'internal_review_pending', '该报价单还有未完成的内部改价审核,请先审完再提交配送商审核');
|
||||
}
|
||||
const existingPending = await findPendingLocal(branchCode, quoteSheetCode, 'to_delivery');
|
||||
|
||||
const customerRows = await pool.query<{ customer_code: string }>(
|
||||
|
||||
Reference in New Issue
Block a user