feat(shipping, admin, workspace, docs): 迭代货代模块、补充文档并处理合并冲突问题
This commit is contained in:
1 parent
4587b56900
commit
3c0e08377c
94 files changed
+29222
-1218
No files matched your search
@@ -666,6 +666,39 @@ describe('useShippingOrderReview build eligibility writes', () => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('notifies the conversation workflow when auto progress reaches a retryable terminal state', async () => {
|
||||
vi.useFakeTimers();
|
||||
const onWorkflowRefresh = vi.fn();
|
||||
const readyCase: ShippingOrderReviewCase = {
|
||||
case_no: 'CASE-1', run_no: 'RUN-1', document: { id: 1, file_name: 'a.pdf' }, status: 'ready',
|
||||
schema: { schema_version_id: 1, fields: [] },
|
||||
draft: { draft_version: 2, header_values: { values: {} }, lines: [], issues: [], validation: {}, build_eligibility: { can_build: true, status: 'ready', line_projections: [] } },
|
||||
available_actions: ['edit_draft', 'confirm'],
|
||||
};
|
||||
api.getCase.mockResolvedValue(readyCase);
|
||||
api.getRun.mockResolvedValue({ run_no: 'RUN-1', summary: {}, items: [{ case_no: 'CASE-1', document_id: 1, status: 'ready', available_actions: ['confirm'] }] });
|
||||
api.getEvidence.mockResolvedValue({ items: [] });
|
||||
api.getPreview.mockResolvedValue({ preview_url: '' });
|
||||
api.getProcessingWorkItem
|
||||
.mockResolvedValueOnce({ work_item_no: 'OT-1', status: 'building_order' })
|
||||
.mockResolvedValueOnce({ work_item_no: 'OT-1', status: 'retryable', retryable: true });
|
||||
api.confirmCase.mockResolvedValue({
|
||||
task_no: 'SN-1', order_task_no: 'OT-1', shipping_notice_no: 'SN-1', idempotent_replay: false,
|
||||
workflow_id: 'WF-1', case: { ...readyCase, status: 'confirmed', order_task_no: 'OT-1' }, auto_progress_started: true,
|
||||
});
|
||||
|
||||
const review = useShippingOrderReview({ onWorkflowRefresh });
|
||||
await review.load('RUN-1', 'CASE-1', { conversationId: 'conv-1', itemNo: 'WFI-1' });
|
||||
await review.confirm();
|
||||
await vi.advanceTimersByTimeAsync(2600);
|
||||
await Promise.resolve();
|
||||
|
||||
expect(onWorkflowRefresh).toHaveBeenCalled();
|
||||
expect(review.workflowProgressPolling.value).toBe(false);
|
||||
review.stopWorkflowProgressPolling();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('does not fall back to extraction run root OT when case has candidate binding', async () => {
|
||||
api.getCase.mockResolvedValue(buildCase({
|
||||
candidate_id: 42,
|
||||
|
||||
@@ -327,7 +327,7 @@ function synthesizeWorkItemFromReviewContext(params: {
|
||||
};
|
||||
}
|
||||
|
||||
export function useShippingOrderReview() {
|
||||
export function useShippingOrderReview(options: { onWorkflowRefresh?: () => void } = {}) {
|
||||
const reviewRun = ref<ShippingOrderReviewRun | null>(null);
|
||||
const activeCase = ref<ShippingOrderReviewCase | null>(null);
|
||||
const caseProjectionVersion = ref<number | null>(null);
|
||||
@@ -612,13 +612,18 @@ export function useShippingOrderReview() {
|
||||
if (!authoritativeOrderTaskNo.value && !targetRunNo) return;
|
||||
showWorkflowProgress.value = true;
|
||||
workflowProgressPolling.value = true;
|
||||
const UNIFIED_TERMINAL = new Set(['completed', 'failed', 'cancelled']);
|
||||
const UNIFIED_TERMINAL = new Set(['completed', 'failed', 'cancelled', 'retryable', 'needs_review', 'waiting_human']);
|
||||
let lastUnifiedStatus = '';
|
||||
const RUN_TERMINAL = new Set(['completed', 'partially_completed', 'failed', 'cancelled']);
|
||||
const tick = async () => {
|
||||
try {
|
||||
if (authoritativeOrderTaskNo.value) {
|
||||
await refreshShippingProcessing();
|
||||
const unifiedStatus = String(shippingProcessingProjection.value?.status || '').trim().toLowerCase();
|
||||
if (unifiedStatus !== lastUnifiedStatus) {
|
||||
lastUnifiedStatus = unifiedStatus;
|
||||
options.onWorkflowRefresh?.();
|
||||
}
|
||||
if (UNIFIED_TERMINAL.has(unifiedStatus)) {
|
||||
stopWorkflowProgressPolling();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user