feat(shipping-notice): 完善订单模板解析与库存 RPA 调度流程
- 新增行字段补充合并与订单模板匹配能力 - 优化运行时解析策略、签名校验及资料验证 - 完善库存 RPA 归档、收尾与 Worker 启动流程 - 补充前后端测试、多语言文案及功能文档
This commit is contained in:
1 parent
8f2f568f92
commit
dabf140e41
45 files changed
+2007
-151
No files matched your search
+1
-1
@@ -294,7 +294,7 @@ export function useScheduleAdminRuns(
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
const disposition = res.headers.get('content-disposition');
|
||||
a.download = disposition?.match(/filename\*?=(?:UTF-8'')?["']?([^;"'\n]+)/)?.[1] || 'inventory-rpa-raw.zip';
|
||||
a.download = disposition?.match(/filename\*?=(?:UTF-8'')?["']?([^;"'\n]+)/)?.[1] || '库存RPA-库存.zip';
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
|
||||
+81
-9
@@ -1115,6 +1115,19 @@ const nextOrderFieldSequence = (targetPageNo: number): number => {
|
||||
const beginFormEdit = () => {
|
||||
pendingFormEdit = snapshot();
|
||||
};
|
||||
/**
|
||||
* 将选中物理行标记为主明细或 LN 补料号补充表(如 COO)。
|
||||
* 核心逻辑:写入 tableRegionRole 后走同一 finishFormEdit,保存时按角色拆成两个 table_regions。
|
||||
*/
|
||||
const onSelectedLineTableRegionRoleChange = (event: Event): void => {
|
||||
const target = selectedRegion.value;
|
||||
if (!target || target.kind !== 'line') return;
|
||||
const value = (event.target as HTMLSelectElement).value;
|
||||
target.tableRegionRole = value === 'line_field_supplement'
|
||||
? 'line_field_supplement'
|
||||
: 'business_lines';
|
||||
finishFormEdit();
|
||||
};
|
||||
/**
|
||||
* 记录字段改绑前的共同视觉身份。
|
||||
*
|
||||
@@ -1549,12 +1562,51 @@ const definition = () => {
|
||||
.map((item) => item.pageNo),
|
||||
)]
|
||||
.sort((left, right) => left - right)
|
||||
.map((regionPageNo) => {
|
||||
.flatMap((regionPageNo) => {
|
||||
const regionSettings = ensureTableRegionSetting(regionPageNo);
|
||||
const pageItems = normalizedRegions.filter(
|
||||
(item) => item.pageNo === regionPageNo,
|
||||
);
|
||||
const lineRegions = pageItems.filter((item) => item.kind === "line");
|
||||
const roles: Array<'business_lines' | 'line_field_supplement'> = [
|
||||
'business_lines',
|
||||
'line_field_supplement',
|
||||
];
|
||||
return roles.flatMap((regionRole) => {
|
||||
const lineRegions = pageItems.filter(
|
||||
(item) =>
|
||||
item.kind === "line"
|
||||
&& (item.tableRegionRole || 'business_lines') === regionRole,
|
||||
);
|
||||
const supplementLineRegions = pageItems.filter(
|
||||
(item) =>
|
||||
item.kind === "line"
|
||||
&& (item.tableRegionRole || 'business_lines') === 'line_field_supplement',
|
||||
);
|
||||
/** 表头中心点是否落在补充表明细行并集内(含少量纵向余量)。 */
|
||||
const headerOverlapsSupplement = (header: typeof pageItems[number]): boolean => {
|
||||
if (!supplementLineRegions.length) return false;
|
||||
const cy = (header.region.y0 + header.region.y1) / 2;
|
||||
const cx = (header.region.x0 + header.region.x1) / 2;
|
||||
return supplementLineRegions.some((line) => {
|
||||
const pad = Math.max(0.01, (line.region.y1 - line.region.y0) * 0.5);
|
||||
return (
|
||||
cx >= line.region.x0
|
||||
&& cx <= line.region.x1
|
||||
&& cy >= line.region.y0 - pad
|
||||
&& cy <= line.region.y1 + pad
|
||||
);
|
||||
});
|
||||
};
|
||||
// 表头只挂在业务明细区;补充表(COO)不携带 header_layouts。
|
||||
// 落在补充行附近的表头不得并入 business,否则会污染版面签名 header_tokens。
|
||||
const pageHeaderItems = regionRole === 'business_lines'
|
||||
? pageItems.filter(
|
||||
(item) => item.kind === "header_field" && !headerOverlapsSupplement(item),
|
||||
)
|
||||
: [];
|
||||
if (!lineRegions.length && !pageHeaderItems.length) {
|
||||
return [];
|
||||
}
|
||||
const groupedLineFields = groupUniqueOrderProfileLineFields(
|
||||
pageItems,
|
||||
lineRegions.map((item) => item.id),
|
||||
@@ -1579,14 +1631,14 @@ const definition = () => {
|
||||
lineFields.value.map((field) => field.field_code),
|
||||
);
|
||||
};
|
||||
const headerLayouts = pageItems
|
||||
.filter((item) => item.kind === "header_field" && item.parentId)
|
||||
const headerLayouts = pageHeaderItems
|
||||
.filter((item) => item.parentId)
|
||||
.reduce<string[]>((layoutIds, item) => {
|
||||
if (!layoutIds.includes(item.parentId!)) layoutIds.push(item.parentId!);
|
||||
return layoutIds;
|
||||
}, [])
|
||||
.map((layoutId) => {
|
||||
const fields = pageItems.filter(
|
||||
const fields = pageHeaderItems.filter(
|
||||
(item) =>
|
||||
item.kind === "header_field" && item.parentId === layoutId,
|
||||
);
|
||||
@@ -1608,7 +1660,7 @@ const definition = () => {
|
||||
});
|
||||
const layoutRegions = [
|
||||
...lineRegions,
|
||||
...pageItems.filter((item) => item.kind === "header_field"),
|
||||
...pageHeaderItems,
|
||||
];
|
||||
const tableRegion = layoutRegions.length
|
||||
? {
|
||||
@@ -1624,12 +1676,15 @@ const definition = () => {
|
||||
? fieldRegionsFor(firstLineRegion.id).map((item) => item.field_code)
|
||||
: [],
|
||||
);
|
||||
return {
|
||||
region_id: `main_lines_page_${regionPageNo}`,
|
||||
return [{
|
||||
region_id: regionRole === 'line_field_supplement'
|
||||
? `line_supplement_page_${regionPageNo}`
|
||||
: `main_lines_page_${regionPageNo}`,
|
||||
// 仅为旧 schema 提供兼容形状;运行时会自动选择适用页范围。
|
||||
page_scope: 'exact_page' as const,
|
||||
page_no: regionPageNo,
|
||||
region: tableRegion,
|
||||
region_role: regionRole,
|
||||
line_start_field_code: resolveLineStartFieldCode(mainLineFieldCodes),
|
||||
// 仅为旧 schema 提供兼容形状;运行时固定/自适应策略并行评估。
|
||||
row_reconstruction_mode: 'fixed_subrows' as const,
|
||||
@@ -1661,6 +1716,7 @@ const definition = () => {
|
||||
(item) =>
|
||||
(item.kind === "field" || item.kind === "header_field") &&
|
||||
item.parentId &&
|
||||
lineRegions.some((line) => line.id === item.parentId) &&
|
||||
(!item.fieldCode ||
|
||||
(item.kind === "header_field" && !coordinateFieldScope(item.fieldCode)) ||
|
||||
(item.kind === "field" && !boundLineFieldRegionIds.has(item.id))),
|
||||
@@ -1671,7 +1727,8 @@ const definition = () => {
|
||||
label: item.label,
|
||||
region: item.region,
|
||||
})),
|
||||
};
|
||||
}];
|
||||
});
|
||||
});
|
||||
const visualDefinition: OrderCoordinateProfileDefinition = {
|
||||
// 主表身份由创建向导冻结;编辑器保存时随定义原样携带,不能退化为只存 sample.table_id。
|
||||
@@ -2727,6 +2784,7 @@ const restoreRegions = (profile: ShippingOrderDocumentProfile) => {
|
||||
label: item.layout_id,
|
||||
region: item.region,
|
||||
pageNo: regionPageNo,
|
||||
tableRegionRole: table.region_role || 'business_lines',
|
||||
})),
|
||||
...table.line_layouts.flatMap((line) =>
|
||||
line.field_regions.map((item, index) => ({
|
||||
@@ -3443,6 +3501,20 @@ onBeforeUnmount(() => {
|
||||
{{ line.label }}
|
||||
</option>
|
||||
</select></label
|
||||
><label v-if="selectedRegion.kind === 'line'"
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.tableRegionRole')
|
||||
}}<select
|
||||
:value="selectedRegion.tableRegionRole || 'business_lines'"
|
||||
class="select-field"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@focus="beginFormEdit"
|
||||
@change="onSelectedLineTableRegionRoleChange"
|
||||
>
|
||||
<option value="business_lines">{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoles.business_lines') }}</option>
|
||||
<option value="line_field_supplement">{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoles.line_field_supplement') }}</option>
|
||||
</select>
|
||||
<small>{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoleHint') }}</small>
|
||||
</label
|
||||
><label v-if="['header_field', 'field', 'order_field'].includes(selectedRegion.kind)"
|
||||
>{{ t("admin.shippingOrderProfiles.workbench.schemaField")
|
||||
}}<select
|
||||
|
||||
Reference in new issue
Block a user