feat(shipping-notice): 新增发货通知自动上传功能与候选资格评估

- 在环境配置中新增 SHIPPING_NOTICE_AUTO_UPLOAD_ENABLED 选项,默认关闭,需显式开启以支持自动上传。
- 引入新的 pytest.ini 文件,增加测试标记以支持自动化测试。
- 删除不再使用的 seed_shipping_notice_agents.py 文件,简化代码库。
- 更新相关 API,增强发货通知与候选资格评估功能,支持多种筛选条件。
- 增强文档与代码注释,反映新的业务逻辑与功能要求。
This commit is contained in:
hugo committed 2026-08-02 19:26:35 +08:00
1 parent cef3d5b26a
commit 3a9fbac2fc
226 files changed
+25010 -2098

No files matched your search

@@ -1024,6 +1024,8 @@ const save = async (automatic = false) => {
display_name: form.displayName,
schema_version_id: form.schemaId,
definition: definition(),
sample_document_id: form.documentId,
sample_table_id: form.tableId,
change_note: form.changeNote,
};
if (!existingProfile) throw new Error('A draft must be created by the wizard before editing.');
@@ -1751,9 +1753,16 @@ const edit = async (profile: ShippingOrderDocumentProfile) => {
}
try {
boundSamples.value = await listOrderProfileBoundSamples(profile.id);
form.documentId =
boundSamples.value.find((item) => item.sample_role === "annotation")?.document_id || 0;
const annotationSample = boundSamples.value.find((item) => item.sample_role === "annotation") || null;
form.documentId = annotationSample?.document_id || 0;
await loadSampleTables();
// Restore the exact bound physical table instead of defaulting to the
// first parsed table; otherwise detail recognition may target the wrong
// page after returning from validation.
if (annotationSample?.table_id && sampleTables.value.some((item) => item.table_id === annotationSample.table_id)) {
form.tableId = annotationSample.table_id;
pageNo.value = sampleTables.value.find((item) => item.table_id === annotationSample.table_id)?.page_no || pageNo.value;
}
await loadPages();
} catch (error) {
fail(error);
@@ -1762,10 +1771,26 @@ const edit = async (profile: ShippingOrderDocumentProfile) => {
// Page preview grants are independent from coordinate extraction. A grant
// failure must not leave the right-hand recognition panel at "waiting".
await refreshOrderFieldSuggestionValues();
// Restoring a draft suppresses the table watcher; explicitly re-read the
// current table so detail rows are visible immediately after returning.
schedulePreview();
}
};
/** 跳转到独立验证页;页面仍需当前标签持有租约,不能绕过草稿单写者保护。 */
const validateProfile = async (profile: ShippingOrderDocumentProfile) => {
// Flush pending autosave/local edits before validation; otherwise the
// validation page may validate the previous immutable draft revision.
if (autosaveTimer) {
window.clearTimeout(autosaveTimer);
autosaveTimer = null;
}
if (saving.value) {
for (let attempt = 0; attempt < 100 && saving.value; attempt += 1) {
await new Promise<void>((resolve) => window.setTimeout(resolve, 50));
}
}
if (dirty.value) await save();
if (dirty.value || saving.value || saveState.value === 'failed' || saveState.value === 'readonly') return;
await router.push({
name: "AdminShippingOrderDocumentProfileValidate",
params: { profileCode: profile.profile_code, profileId: String(profile.id) },
@@ -143,12 +143,19 @@ async function ensureLease(): Promise<boolean> {
/** 依次执行配置结构和当前样本试读;任一步失败均不允许进入发布检查。 */
async function validateCurrentDraft(): Promise<void> {
if (!(await ensureLease())) return;
if (!sample.value?.id) {
message.error(t('admin.orderProfileValidation.noTrainingSample'));
return;
}
executing.value = true;
try {
const payload = () => ({ browser_session_id: sessionId, lease_token: leaseToken.value, operation_id: crypto.randomUUID() });
await runOrderProfileInstantCheck(profileId, payload());
await runOrderProfileCurrentSample(profileId, payload());
await runOrderProfileCurrentSample(profileId, { ...payload(), sample_binding_id: sample.value.id });
await loadRuns();
// Refresh the draft/sample context after validation so the result preview
// uses the same binding and definition that the server just validated.
await loadContext();
await loadBlindTestSuite();
await loadReadResults();
message.success(t('admin.orderProfileValidation.completed'));