refactor(shipping-notice): 统一料号字段,移除过时的 SKU 相关字段,更新相关逻辑以支持新字段命名

This commit is contained in:
hugo committed 2026-07-16 20:02:33 +08:00
1 parent dde25344ca
commit 46eb63f5bb
111 files changed
+3116 -1250

No files matched your search

@@ -39,7 +39,7 @@ const createContext = (
getActiveShippingTaskId: () => '',
lastAssistantMessageContent: () => '',
lastAssistantShippingActions: () => [],
sendMessage: vi.fn(async () => true),
sendMessage: vi.fn(async () => ({ accepted: true, completed: true })),
buildFileSpecsForSend: vi.fn(async () => []),
loadHistory: vi.fn(async () => undefined),
sendShippingMenuMessage: vi.fn(async () => undefined),
@@ -263,7 +263,7 @@ describe('useChatShippingSendHandler', () => {
intakeNo: 'SNI-HANDLED-FAILURE',
}]),
getParsedIntakeNos: () => ['SNI-HANDLED-FAILURE'],
sendMessage: vi.fn(async () => false),
sendMessage: vi.fn(async () => ({ accepted: false, completed: false })),
rollbackOrderExtractionStarted: rollback,
});
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
@@ -274,4 +274,37 @@ describe('useChatShippingSendHandler', () => {
expect(rollback).toHaveBeenCalledWith(['SNI-HANDLED-FAILURE']);
expect(ctx.loadHistory).not.toHaveBeenCalled();
});
it('removes submitted notice attachments after acceptance even when the assistant stream fails', async () => {
const submitted = {
id: 'notice-accepted-error',
kind: 'shipping_notice' as const,
type: 'document' as const,
uploadStatus: 'uploaded' as const,
parseStatus: 'parsed' as const,
uploadProgress: 100,
originalFilename: 'orders.eml',
fileSize: 100,
intakeNo: 'SNI-ACCEPTED-ERROR',
};
const retained = {
...submitted,
id: 'notice-retained',
originalFilename: 'other.eml',
intakeNo: 'SNI-RETAINED',
};
const ctx = createContext({
attachments: ref([submitted, retained]),
getParsedIntakeNos: () => ['SNI-ACCEPTED-ERROR'],
sendMessage: vi.fn(async () => ({ accepted: true, completed: false, chatLogId: 42 })),
});
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
expect(consumed).toBe(true);
expect(ctx.rollbackOrderExtractionStarted).not.toHaveBeenCalled();
expect(ctx.attachments.value).toEqual([retained]);
expect(ctx.loadHistory).toHaveBeenCalledOnce();
});
});