feat(shipping-notice): 增强发货通知与订单抽取功能,支持多进程处理与紧急停止

- 移除不再使用的 SHIPPING_NOTICE_LAYOUT_PARSER_REVISION 配置
- 在环境配置中新增 SHIPPING_NOTICE_WORKER_CONCURRENCY 和 SHIPPING_NOTICE_JOB_RUNNING_TIMEOUT_SECONDS
- 实现发货通知 worker 进程,支持并发处理订单抽取任务
- 引入紧急停止功能,允许管理员在运行中控制订单解析状态
- 更新相关 API,支持读取与设置紧急停止状态
- 增强文档与代码注释,反映新的业务逻辑与功能要求
This commit is contained in:
hugo committed 2026-07-31 18:00:49 +08:00
1 parent d0fe084999
commit b352c281d5
149 files changed
+12550 -1874

No files matched your search

@@ -187,6 +187,43 @@ describe('useChatShippingSendHandler', () => {
);
});
it('submits ready intakes from separate upload selections in one run', async () => {
const attachments = ref([
{
id: 'notice-first', kind: 'shipping_notice' as const, type: 'document' as const,
uploadStatus: 'uploaded' as const, parseStatus: 'parsed' as const,
orderExtractionStatus: 'not_started' as const, uploadProgress: 100,
originalFilename: 'first.eml', fileSize: 100, intakeNo: 'SNI-FIRST', uploadBatchId: 'batch-first',
},
{
id: 'notice-second', kind: 'shipping_notice' as const, type: 'document' as const,
uploadStatus: 'uploaded' as const, parseStatus: 'parsed' as const,
orderExtractionStatus: 'not_started' as const, uploadProgress: 100,
originalFilename: 'second.eml', fileSize: 120, intakeNo: 'SNI-SECOND', uploadBatchId: 'batch-second',
},
]);
const startOrderExtractionRun = vi.fn(async () => true);
const ctx = createContext({
attachments,
getParsedIntakeNos: () => ['SNI-FIRST', 'SNI-SECOND'],
startOrderExtractionRun,
});
const { tryHandleShippingAttachmentAutoFlow } = createShippingSendHandlers(ctx);
const consumed = await tryHandleShippingAttachmentAutoFlow(undefined, '', '');
expect(consumed).toBe(true);
expect(startOrderExtractionRun).toHaveBeenCalledWith(
'chat.shippingOrderExtractionDefaultUserMessage',
['SNI-FIRST', 'SNI-SECOND'],
[
{ name: 'first.eml', size: 100, extension: 'eml', type: 'document', source: 'shipping_notice' },
{ name: 'second.eml', size: 120, extension: 'eml', type: 'document', source: 'shipping_notice' },
],
);
expect(attachments.value).toEqual([]);
});
it('keeps attachments in the input when starting the run fails', async () => {
const attachment = {
id: 'notice-start-failed',