feat(shipping_notice): 新增货代订单全流程业务模块及配套基建
本次提交新增货代订单处理全流程的完整业务能力、数据库迁移与测试用例: 1. 统一追加式审计事件体系,支持全链路不可篡改的业务追溯 2. 货代任务撤销、版本替代管控逻辑,规范已上传订单的合规版本更替 3. 订单抽取路由审计、模板自动冻结资格、路由计数等核心业务基建 4. EML订单补充表解析契约与合并逻辑,完善订单补全能力 5. Chatflow只读能力令牌校验机制,保障工具调用安全 6. 人工复核证据校验服务,规范人工审核的证据留存 所有变更均配套完整的单元测试与迁移契约测试,支持受控回退
This commit is contained in:
1 parent
90f77634d6
commit
1f3ecb87b7
128 files changed
+3635
-2074
No files matched your search
@@ -422,6 +422,11 @@ export async function submitWorkspaceShippingDecision(taskNo: string, decision:
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
/** 人工复核证据只允许已绑定文档单元格或具名人工输入。 */
|
||||
export type ShippingReviewEvidence =
|
||||
| { evidence_type: 'document_cell'; document_id: number; observation_id: number; page_no: number; table_id: string; cell_id: string }
|
||||
| { evidence_type: 'manual_input'; reason: string };
|
||||
|
||||
/**
|
||||
* 更新发货通知单头字段。
|
||||
* @param taskNo - 发货任务编号
|
||||
@@ -432,18 +437,18 @@ export async function submitWorkspaceShippingDecision(taskNo: string, decision:
|
||||
export async function updateWorkspaceShippingNoticeFields(
|
||||
taskNo: string,
|
||||
fields: Partial<ShippingNoticeHeader>,
|
||||
comment?: string,
|
||||
options?: { expectedOrderDataVersion?: number; idempotencyKey?: string },
|
||||
comment: string | undefined,
|
||||
options: { expectedOrderDataVersion: number; idempotencyKey?: string; evidence: ShippingReviewEvidence; reason: string },
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/update-notice-fields`,
|
||||
jsonPost({
|
||||
fields,
|
||||
...(comment ? { comment } : {}),
|
||||
...(options?.expectedOrderDataVersion != null
|
||||
? { expected_order_data_version: options.expectedOrderDataVersion }
|
||||
: {}),
|
||||
...(options?.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}),
|
||||
expected_order_data_version: options.expectedOrderDataVersion,
|
||||
evidence: options.evidence,
|
||||
reason: options.reason,
|
||||
...(options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}),
|
||||
}),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
@@ -479,8 +484,8 @@ export async function updateWorkspaceShippingNoticeLine(
|
||||
taskNo: string,
|
||||
lineIndex: number,
|
||||
patch: Partial<ShippingNoticeLine> & { quantity?: number },
|
||||
comment?: string,
|
||||
options?: { expectedOrderDataVersion?: number; idempotencyKey?: string },
|
||||
comment: string | undefined,
|
||||
options: { expectedOrderDataVersion: number; idempotencyKey?: string; evidence: ShippingReviewEvidence; reason: string },
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/update-notice-line`,
|
||||
@@ -488,10 +493,10 @@ export async function updateWorkspaceShippingNoticeLine(
|
||||
line_index: lineIndex,
|
||||
patch,
|
||||
...(comment ? { comment } : {}),
|
||||
...(options?.expectedOrderDataVersion != null
|
||||
? { expected_order_data_version: options.expectedOrderDataVersion }
|
||||
: {}),
|
||||
...(options?.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}),
|
||||
expected_order_data_version: options.expectedOrderDataVersion,
|
||||
evidence: options.evidence,
|
||||
reason: options.reason,
|
||||
...(options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}),
|
||||
}),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
@@ -522,6 +527,7 @@ export async function resolveWorkspaceShippingFieldConflict(
|
||||
expectedConflictVersion?: number;
|
||||
expectedOrderDataVersion?: number;
|
||||
reason?: string;
|
||||
evidence: ShippingReviewEvidence;
|
||||
idempotencyKey?: string;
|
||||
},
|
||||
) {
|
||||
@@ -542,6 +548,7 @@ export async function resolveWorkspaceShippingFieldConflict(
|
||||
? { expected_order_data_version: payload.expectedOrderDataVersion }
|
||||
: {}),
|
||||
...(payload.reason ? { reason: payload.reason } : {}),
|
||||
evidence: payload.evidence,
|
||||
...(payload.idempotencyKey ? { idempotency_key: payload.idempotencyKey } : {}),
|
||||
}),
|
||||
);
|
||||
@@ -557,11 +564,12 @@ export async function resolveWorkspaceShippingFieldConflict(
|
||||
export async function addWorkspaceShippingNoticeLine(
|
||||
taskNo: string,
|
||||
line: Partial<ShippingNoticeLine> & { quantity?: number },
|
||||
comment?: string,
|
||||
comment: string | undefined,
|
||||
options: { expectedOrderDataVersion: number; idempotencyKey?: string; evidence: ShippingReviewEvidence; reason: string },
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/add-notice-line`,
|
||||
jsonPost({ line, ...(comment ? { comment } : {}) }),
|
||||
jsonPost({ line, ...(comment ? { comment } : {}), expected_order_data_version: options.expectedOrderDataVersion, evidence: options.evidence, reason: options.reason, ...(options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}) }),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
@@ -576,11 +584,12 @@ export async function addWorkspaceShippingNoticeLine(
|
||||
export async function removeWorkspaceShippingNoticeLine(
|
||||
taskNo: string,
|
||||
lineIndex: number,
|
||||
comment?: string,
|
||||
comment: string | undefined,
|
||||
options: { expectedOrderDataVersion: number; idempotencyKey?: string; evidence: ShippingReviewEvidence; reason: string },
|
||||
) {
|
||||
const body = await requestJson<ShippingDecisionResponse & ShippingApiStatusPayload>(
|
||||
`/api/workspace/shipping-tasks/${encodeURIComponent(taskNo)}/remove-notice-line`,
|
||||
jsonPost({ line_index: lineIndex, ...(comment ? { comment } : {}) }),
|
||||
jsonPost({ line_index: lineIndex, ...(comment ? { comment } : {}), expected_order_data_version: options.expectedOrderDataVersion, evidence: options.evidence, reason: options.reason, ...(options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}) }),
|
||||
);
|
||||
return assertShippingOk(body);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user