feat(shipping-notice): 升级货代发货流程为五阶段,完善业务校验
将货代发货流程从四阶段扩展为五阶段,拆分上传相关逻辑至独立的货代上传阶段; 统一多语言文案修正客户状态语义,将"客户尚未识别"调整为符合业务的"客户尚未确认"; 新增严格的上传成功验证谓词,需同时满足任务状态、全部预约单上传成功、存在有效成功上传尝试三个条件方可标记为完成; 新增坐标取值模型配置,支持Legacy冻结绝对坐标和锚点框架受限平移两种模式; 更新全链路相关文档、前端组件、后端服务与测试用例,确保业务逻辑对齐新业务规则。
This commit is contained in:
1 parent
1b6483a4ea
commit
935bf26fa6
86 files changed
+2743
-311
No files matched your search
+97
-3
@@ -47,6 +47,8 @@ import type {
|
||||
OrderFieldValuePreview,
|
||||
OrderProfileCanvasRegion,
|
||||
OrderProfileDocumentMatchAnchor,
|
||||
OrderProfileAnchorRule,
|
||||
OrderCoordinateProfileDefinition,
|
||||
OrderProfileFieldRegion,
|
||||
OrderProfileRelativeRegion,
|
||||
OrderProfileBoundSample,
|
||||
@@ -384,6 +386,44 @@ const documentMatch = reactive({
|
||||
minimumMargin: 0.15,
|
||||
});
|
||||
const documentMatchDirty = ref(false);
|
||||
/** 坐标框架默认关闭;仅管理员显式启用后才写入 anchor_frame 声明。 */
|
||||
const coordinateModel = reactive({
|
||||
type: 'legacy' as 'legacy' | 'anchor_frame',
|
||||
anchors: [] as OrderProfileAnchorRule[],
|
||||
maxTranslateX: 0.03,
|
||||
maxTranslateY: 0.06,
|
||||
});
|
||||
const coordinateModelDirty = ref(false);
|
||||
const coordinateModelValid = computed(() => (
|
||||
coordinateModel.type === 'legacy'
|
||||
|| (coordinateModel.anchors.length > 0
|
||||
&& coordinateModel.anchors.length <= 4
|
||||
&& coordinateModel.anchors.every((anchor) => Boolean(anchor.text?.trim() && anchor.region))
|
||||
&& Number.isFinite(coordinateModel.maxTranslateX)
|
||||
&& Number.isFinite(coordinateModel.maxTranslateY)
|
||||
&& coordinateModel.maxTranslateX >= 0 && coordinateModel.maxTranslateX <= 0.15
|
||||
&& coordinateModel.maxTranslateY >= 0 && coordinateModel.maxTranslateY <= 0.2)
|
||||
));
|
||||
const enableAnchorFrameFromDocumentAnchor = () => {
|
||||
const source = documentMatch.requiredAnchors[0];
|
||||
if (!source?.label_region) return;
|
||||
coordinateModel.type = 'anchor_frame';
|
||||
coordinateModel.anchors = [{
|
||||
anchor_id: `frame_${source.anchor_id}`.replace(/[^a-zA-Z0-9_]/g, '_').toLowerCase(),
|
||||
text: source.label,
|
||||
aliases: [],
|
||||
match_mode: 'exact',
|
||||
region: source.label_region,
|
||||
position_locked: true,
|
||||
minimum_evidence_level: 'coordinate',
|
||||
}];
|
||||
coordinateModelDirty.value = true;
|
||||
};
|
||||
const setCoordinateModelType = (type: 'legacy' | 'anchor_frame') => {
|
||||
coordinateModel.type = type;
|
||||
if (type === 'legacy') coordinateModel.anchors = [];
|
||||
coordinateModelDirty.value = true;
|
||||
};
|
||||
/**
|
||||
* 共同画布的字段选项只决定视觉定位;coordinate 末端值源仍必须由 Schema 显式授权
|
||||
* pdf_coordinate。XFA 的正式取值来自 datasets,不能因未授权 PDF 文本而在画布中消失。
|
||||
@@ -521,7 +561,7 @@ const draftSaveAdapter = computed<OrderProfileDraftSaveAdapter>(() => (
|
||||
adapterKey: valueAdapterKey.value,
|
||||
adapters: {
|
||||
xfa_dataset: {
|
||||
hasUnsavedChanges: history.value.length > 0 || documentMatchDirty.value || xfaDirty.value,
|
||||
hasUnsavedChanges: history.value.length > 0 || documentMatchDirty.value || coordinateModelDirty.value || xfaDirty.value,
|
||||
skipUnchangedManualSave: true,
|
||||
canSave: !xfaValidateBlocked.value,
|
||||
canValidate: !xfaDirty.value && !xfaValidateBlocked.value,
|
||||
@@ -538,7 +578,7 @@ const draftSaveAdapter = computed<OrderProfileDraftSaveAdapter>(() => (
|
||||
applySavedDraft: async (saved) => valueAdapterDesk.applySavedDraft(saved as ShippingOrderDocumentProfile),
|
||||
},
|
||||
coordinate_ocr: {
|
||||
hasUnsavedChanges: history.value.length > 0 || documentMatchDirty.value,
|
||||
hasUnsavedChanges: history.value.length > 0 || documentMatchDirty.value || coordinateModelDirty.value,
|
||||
skipUnchangedManualSave: false,
|
||||
canSave: issues.value.length === 0,
|
||||
canValidate: issues.value.length === 0,
|
||||
@@ -770,6 +810,7 @@ const issues = computed(() => {
|
||||
if (regions.value.some(
|
||||
(item) => item.kind === "order_field" && item.valueMode === "multi_line" && !item.stopAnchorText?.trim(),
|
||||
)) result.push("多行订单字段必须填写结束标签。");
|
||||
if (!coordinateModelValid.value) result.push(t('admin.shippingOrderProfiles.workbench.coordinateModelInvalid'));
|
||||
if (regions.value.some((item) => !normalizedCanvasRegion(item.region))) {
|
||||
result.push("存在无效的页面坐标框,请重新绘制该标注。");
|
||||
}
|
||||
@@ -1377,7 +1418,7 @@ const definition = () => {
|
||||
})),
|
||||
};
|
||||
});
|
||||
return {
|
||||
const visualDefinition: OrderCoordinateProfileDefinition = {
|
||||
document_match: {
|
||||
document_type: "purchase_order" as const,
|
||||
page_pattern: "one_or_more" as const,
|
||||
@@ -1481,6 +1522,15 @@ const definition = () => {
|
||||
};
|
||||
}),
|
||||
};
|
||||
if (coordinateModel.type === 'anchor_frame') {
|
||||
visualDefinition.coordinate_model = {
|
||||
type: 'anchor_frame',
|
||||
anchors: coordinateModel.anchors.map((anchor) => ({ ...anchor })),
|
||||
max_translate_x: coordinateModel.maxTranslateX,
|
||||
max_translate_y: coordinateModel.maxTranslateY,
|
||||
};
|
||||
}
|
||||
return visualDefinition;
|
||||
};
|
||||
/**
|
||||
* 保存当前草稿定义并附带当前标签租约。
|
||||
@@ -2344,6 +2394,19 @@ const edit = async (profile: ShippingOrderDocumentProfile) => {
|
||||
documentMatch.minimumScore = definition.document_match.minimum_score;
|
||||
documentMatch.minimumMargin = definition.document_match.minimum_margin;
|
||||
documentMatchDirty.value = false;
|
||||
const configuredModel = definition.coordinate_model;
|
||||
if (configuredModel?.type === 'anchor_frame') {
|
||||
coordinateModel.type = 'anchor_frame';
|
||||
coordinateModel.anchors = (configuredModel.anchors || []).map((anchor) => ({ ...anchor }));
|
||||
coordinateModel.maxTranslateX = Number(configuredModel.max_translate_x ?? 0.03);
|
||||
coordinateModel.maxTranslateY = Number(configuredModel.max_translate_y ?? 0.06);
|
||||
} else {
|
||||
coordinateModel.type = 'legacy';
|
||||
coordinateModel.anchors = [];
|
||||
coordinateModel.maxTranslateX = 0.03;
|
||||
coordinateModel.maxTranslateY = 0.06;
|
||||
}
|
||||
coordinateModelDirty.value = false;
|
||||
regions.value = restoreRegions(profile);
|
||||
history.value = [];
|
||||
future.value = [];
|
||||
@@ -2781,6 +2844,37 @@ onBeforeUnmount(() => {
|
||||
<p v-if="documentAnchorNotice" class="document-match-editor__warning">{{ documentAnchorNotice }}</p>
|
||||
</section>
|
||||
|
||||
<section class="coordinate-model-editor">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.workbench.coordinateModelTitle') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.workbench.coordinateModelHint') }}</p>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.coordinateModelType') }}
|
||||
<select
|
||||
:value="coordinateModel.type"
|
||||
class="select-field"
|
||||
:disabled="deskTableConfigReadonly"
|
||||
@change="(event) => setCoordinateModelType((event.target as HTMLSelectElement).value as 'legacy' | 'anchor_frame')"
|
||||
>
|
||||
<option value="legacy">{{ t('admin.shippingOrderProfiles.workbench.coordinateModelLegacy') }}</option>
|
||||
<option value="anchor_frame">{{ t('admin.shippingOrderProfiles.workbench.coordinateModelAnchorFrame') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<template v-if="coordinateModel.type === 'anchor_frame'">
|
||||
<button type="button" class="btn-secondary" :disabled="deskTableConfigReadonly || !documentMatch.requiredAnchors.length" @click="enableAnchorFrameFromDocumentAnchor">
|
||||
{{ t('admin.shippingOrderProfiles.workbench.coordinateModelUseDocumentAnchor') }}
|
||||
</button>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.coordinateModelMaxX') }}
|
||||
<input v-model.number="coordinateModel.maxTranslateX" type="number" min="0" max="0.15" step="0.001" class="input-field" :disabled="deskTableConfigReadonly" @change="coordinateModelDirty = true" />
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.coordinateModelMaxY') }}
|
||||
<input v-model.number="coordinateModel.maxTranslateY" type="number" min="0" max="0.2" step="0.001" class="input-field" :disabled="deskTableConfigReadonly" @change="coordinateModelDirty = true" />
|
||||
</label>
|
||||
<p v-if="!coordinateModelValid" class="document-match-editor__warning">{{ t('admin.shippingOrderProfiles.workbench.coordinateModelInvalid') }}</p>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section v-if="deskActivePageHasLines" class="table-region-editor">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.workbench.tableRegionSettings') }}</strong>
|
||||
<label>{{ t('admin.shippingOrderProfiles.workbench.rowReconstructionMode') }}
|
||||
|
||||
Reference in new issue
Block a user