feat(shipping-notice): 完成货代发货通知全门禁恢复MVP收口
完成全门禁恢复MVP版本交付:调整自动上传与重试配置,重构正式执行链路;修复多处代码bug,新增测试与审计工具;更新全流程文档与契约规范。
This commit is contained in:
1 parent
8e0bbf7a81
commit
c94d173f92
181 files changed
+12947
-1724
No files matched your search
@@ -98,6 +98,8 @@ function toItem(
|
||||
const chatOrRight = surface === 'chat' || surface === 'right';
|
||||
if (intent === 'open_order_review' && chatOrRight) {
|
||||
labelKey = 'chat.shippingProcessing.action.open_order_processing';
|
||||
} else if (normalized === 'retry_freight_upload_rpa' || normalized === 'retry_upload') {
|
||||
labelKey = 'chat.shippingNoticeRetryUploadAction';
|
||||
} else if (intent === 'retry' && chatOrRight) {
|
||||
labelKey = 'chat.shippingProcessing.action.retry_parse';
|
||||
} else if (normalized === 'focus_task' && chatOrRight) {
|
||||
@@ -183,6 +185,8 @@ export function resolveProcessingActionPresentation(
|
||||
const code = String(raw || '').trim();
|
||||
if (!code) return;
|
||||
const key = code.toLowerCase();
|
||||
// 仅用于管理员恢复缺失待办记录,不作为普通用户履约动作展示。
|
||||
if (key === 'regenerate_manual_upload_todo') return;
|
||||
if (seen.has(key)) return;
|
||||
seen.add(key);
|
||||
const intent = mapActionCodeToIntent(code);
|
||||
@@ -218,11 +222,31 @@ export function resolveProcessingActionPresentation(
|
||||
};
|
||||
|
||||
pushCode(projection.primaryAction?.code || projection.currentGate?.nextActionCode);
|
||||
// Gate 20 同时保留两条用户路径:主动重试 RPA 与人工上传登记。
|
||||
// 该动作由正式任务面板打开登记弹窗,不走 Gate API。
|
||||
if (
|
||||
String(projection.currentGate?.gateCode || '').trim().toLowerCase() === 'manual_upload_handoff'
|
||||
&& items.some((item) => String(item.actionCode).toLowerCase() === 'retry_freight_upload_rpa')
|
||||
) {
|
||||
pushCode('mark_manual_uploaded');
|
||||
}
|
||||
// [ORDER-STABLE] 对 availableActions 标准化(去重 + 字典序排序),确保后端返回顺序不影响前端按钮顺序。
|
||||
const normalizedAvailableActions = normalizeActionCodes(projection.availableActions || []);
|
||||
for (const action of normalizedAvailableActions) {
|
||||
pushCode(action);
|
||||
}
|
||||
// Gate 19 RPA 失败时,人工登记作为任务级替代路径展示,避免与 RPA 重试并列。
|
||||
if (
|
||||
String(projection.currentGate?.gateCode || '').trim().toLowerCase() === 'freight_upload_rpa'
|
||||
&& items.some((item) => String(item.actionCode).toLowerCase() === 'retry_freight_upload_rpa')
|
||||
) {
|
||||
for (let index = items.length - 1; index >= 0; index -= 1) {
|
||||
const code = String(items[index]?.actionCode || '').toLowerCase();
|
||||
if (code === 'mark_manual_uploaded' || code === 'open_manual_upload' || code === 'wait_manual_upload') {
|
||||
items.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items.length === 0 && (status === 'completed' || status === 'failed' || status === 'cancelled')) {
|
||||
pushCode('view_result');
|
||||
|
||||
@@ -24,6 +24,7 @@ const props = defineProps<{
|
||||
projection: ShippingProcessingProjection;
|
||||
/** 宿主轮询中提示(显示在标题行)。 */
|
||||
polling?: boolean;
|
||||
refreshing?: boolean;
|
||||
/** 正式 OT 已创建时保留 prop 兼容(进度条不再展示当前需要文案)。 */
|
||||
hasFormalOt?: boolean;
|
||||
}>();
|
||||
@@ -182,9 +183,10 @@ function nodeShortLabel(stage: string): string {
|
||||
type="button"
|
||||
class="rounded-lg border border-default bg-surface px-2.5 py-1 text-[11px] font-medium text-secondary hover:bg-surface-muted"
|
||||
data-testid="review-progress-refresh"
|
||||
:disabled="refreshing"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ t('chat.shippingProcessing.action.refresh') }}
|
||||
{{ refreshing ? t('chat.shippingOrderReview.workflowProgress.polling') : t('chat.shippingProcessing.action.refresh') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -124,6 +124,42 @@ describe('workbenchActionRegistry', () => {
|
||||
expect(result.secondary).toBeNull();
|
||||
});
|
||||
|
||||
it('shows RPA upload retry instead of manual upload entries when Gate 19 is blocked', () => {
|
||||
const result = resolveProcessingActionPresentation(projection({
|
||||
stage: 'freight_uploading',
|
||||
currentGate: {
|
||||
gateCode: 'freight_upload_rpa',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'retry_freight_upload_rpa',
|
||||
blockingReasonCode: 'upload_rpa_failed',
|
||||
attemptNo: 1,
|
||||
},
|
||||
availableActions: ['download_excel', 'mark_manual_uploaded'],
|
||||
}), { surface: 'review', actionsExecutable: true });
|
||||
|
||||
expect(result.primary?.actionCode).toBe('retry_freight_upload_rpa');
|
||||
expect(result.primary?.intent).toBe('retry');
|
||||
expect(result.secondary?.actionCode).toBe('download_excel');
|
||||
expect(result.overflow.map((item) => item.actionCode)).not.toContain('mark_manual_uploaded');
|
||||
});
|
||||
|
||||
it('does not turn the admin todo-regeneration recovery action into manual upload', () => {
|
||||
const result = resolveProcessingActionPresentation(projection({
|
||||
stage: 'freight_uploading',
|
||||
currentGate: {
|
||||
gateCode: 'manual_upload_handoff',
|
||||
status: 'blocked',
|
||||
nextActionCode: 'regenerate_manual_upload_todo',
|
||||
blockingReasonCode: 'manual_upload_todo_missing',
|
||||
attemptNo: 1,
|
||||
},
|
||||
availableActions: ['download_excel'],
|
||||
}), { surface: 'review', actionsExecutable: true });
|
||||
|
||||
expect(result.primary?.actionCode).toBe('download_excel');
|
||||
expect(result.overflow.map((item) => item.actionCode)).not.toContain('regenerate_manual_upload_todo');
|
||||
});
|
||||
|
||||
it('hides confirm_customer when customer panel unavailable', () => {
|
||||
const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined);
|
||||
expect(shouldRenderWorkbenchAction(WORKBENCH_ACTION_REGISTRY.confirm_customer, {
|
||||
|
||||
Reference in new issue
Block a user