feat(shipping-notice): 收敛订单处理状态与履约门禁
This commit is contained in:
1 parent
bffcd55b40
commit
70dd0051b8
153 files changed
+10916
-4296
No files matched your search
@@ -13,6 +13,7 @@ import { createRouter, createMemoryHistory } from 'vue-router';
|
||||
import ShippingOrderReviewView from './ShippingOrderReviewView.vue';
|
||||
import ReviewCurrentProcessingCard from '../components/shipping-review/ReviewCurrentProcessingCard.vue';
|
||||
import ReviewFieldConflictPanel from '../components/shipping-review/ReviewFieldConflictPanel.vue';
|
||||
import ManualUploadEvidenceDialog from '@/features/workspace/shipping-task-center/ManualUploadEvidenceDialog.vue';
|
||||
import { CHAT_PAGE_KEY } from '@/features/chat/composables/chat.context';
|
||||
import {
|
||||
auditWorkspaceShippingOrderReviewEligibilityDetails,
|
||||
@@ -54,10 +55,12 @@ vi.mock('@/features/workspace/api/shipping-tasks.api', () => ({
|
||||
const focusSuggestionField = vi.fn();
|
||||
const load = vi.fn().mockResolvedValue(undefined);
|
||||
const selectCase = vi.fn().mockResolvedValue(undefined);
|
||||
const beginCrossRunSwitch = vi.fn();
|
||||
const ensureIntakeParseContextLoaded = vi.fn().mockResolvedValue(true);
|
||||
/** 确认建单 mock:用例可改写返回值以断言 confirm_outcome / auto_progress 解析。 */
|
||||
const confirmMock = vi.fn();
|
||||
const reloadLatestDraftMock = vi.fn().mockResolvedValue(undefined);
|
||||
const refreshReviewQueueMock = vi.fn().mockResolvedValue(true);
|
||||
const refreshShippingProcessingMock = vi.fn().mockResolvedValue(undefined);
|
||||
const startWorkflowProgressPollingMock = vi.fn();
|
||||
const stopWorkflowProgressPollingMock = vi.fn();
|
||||
@@ -302,9 +305,11 @@ function createReviewComposableMock() {
|
||||
load,
|
||||
loadReviewCase: vi.fn().mockResolvedValue(undefined),
|
||||
selectCase,
|
||||
beginCrossRunSwitch,
|
||||
refreshWorkItemContext: vi.fn(),
|
||||
openCurrentVersion: vi.fn(),
|
||||
reloadLatestDraft: reloadLatestDraftMock,
|
||||
refreshReviewQueue: refreshReviewQueueMock,
|
||||
toggleConflictDiff: vi.fn(),
|
||||
patchHeader: vi.fn(),
|
||||
patchLine: patchLineMock,
|
||||
@@ -578,7 +583,7 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
autoProgress: {
|
||||
status: { unknown: '', needs_retry: '待重试', needs_human: '需要人工处理' },
|
||||
result: '{status}',
|
||||
checkpoint: '{checkpoint}',
|
||||
position: '{position}',
|
||||
viewTask: '返回对话查看进度',
|
||||
returnToChat: '返回对话查看进度',
|
||||
retry: '重试自动推进',
|
||||
@@ -1171,11 +1176,13 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
};
|
||||
const wrapper = await mountView();
|
||||
load.mockClear();
|
||||
beginCrossRunSwitch.mockClear();
|
||||
|
||||
await wrapper.get('[data-testid="review-doc-nav-CASE-RUN-2"]').trigger('click');
|
||||
await flushPromises();
|
||||
|
||||
// 路由变更是唯一加载所有者,不能在 select 中再次请求相同 Run/Case。
|
||||
// 跨 Run 先清旧 OT 投影权威,再只由路由 watcher 触发一次 load。
|
||||
expect(beginCrossRunSwitch).toHaveBeenCalledWith('CASE-RUN-2');
|
||||
expect(load).toHaveBeenCalledTimes(1);
|
||||
expect(load).toHaveBeenCalledWith('RUN-2', 'CASE-RUN-2', {
|
||||
conversationId: 'conv-1', itemNo: undefined,
|
||||
@@ -2511,12 +2518,14 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
|
||||
// 关键断言:订单基线列和库存事实合为唯一行级工作表,库存源不得退化为任务级 CRANE。
|
||||
const workspace = wrapper.get('[data-testid="review-fulfillment-prep-workspace"]');
|
||||
// 关键交互断言:明细在窄视口保持横向可读,行级操作列固定在右侧。
|
||||
// 关键交互断言:标题/选行条不滚动;仅表体横向可读,行级操作列固定在右侧。
|
||||
expect(workspace.classes()).toContain('review-fulfillment-prep-workspace');
|
||||
expect(workspace.classes()).toContain('overflow-x-auto');
|
||||
expect(workspace.get('table').classes()).toContain('review-fulfillment-prep-table');
|
||||
expect(workspace.get('thead th:last-child').classes()).toContain('review-fulfillment-sticky-action-head');
|
||||
expect(workspace.get('tbody tr:first-child td:last-child').classes()).toContain('review-fulfillment-sticky-action-cell');
|
||||
expect(workspace.classes()).not.toContain('overflow-x-auto');
|
||||
const tableScroll = workspace.get('[data-testid="review-fulfillment-prep-table-scroll"]');
|
||||
expect(tableScroll.classes()).toContain('overflow-x-auto');
|
||||
expect(tableScroll.get('table').classes()).toContain('review-fulfillment-prep-table');
|
||||
expect(tableScroll.get('thead th:last-child').classes()).toContain('review-fulfillment-sticky-action-head');
|
||||
expect(tableScroll.get('tbody tr:first-child td:last-child').classes()).toContain('review-fulfillment-sticky-action-cell');
|
||||
expect(workspace.text()).toContain('RSV-FROZEN');
|
||||
expect(workspace.text()).toContain('PN-FROZEN');
|
||||
expect(workspace.text()).toContain('DBS');
|
||||
@@ -3165,6 +3174,37 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="manual-upload-evidence-dialog"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('refreshes left-nav queue after manual upload confirmation success', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed', confirmed_task_no: 'SN-UPLOAD-QUEUE', confirmed_task_id: 21, has_formal_ot: true,
|
||||
};
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-UPLOAD-QUEUE', status: 'completed', business_no: 'WYC26082499',
|
||||
lines: [], events: [], export_artifacts: [{ id: 1 }],
|
||||
ui_state: { lifecycle_stage: 'upload_complete', actions: { primary: null, secondary: [] }, summary: {}, steps: [] },
|
||||
} as any);
|
||||
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
|
||||
po_number: 'PO-QUEUE',
|
||||
items: [{ business_no: 'WYC26082499', po_number: 'PO-QUEUE', lines: [] }],
|
||||
} as any);
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
|
||||
await flushPromises();
|
||||
reloadLatestDraftMock.mockClear();
|
||||
refreshReviewQueueMock.mockClear();
|
||||
refreshShippingProcessingMock.mockClear();
|
||||
|
||||
wrapper.findComponent(ManualUploadEvidenceDialog).vm.$emit('success');
|
||||
await flushPromises();
|
||||
|
||||
// 确认上传后五阶段会到「通知完成」;左侧本批队列必须同步重拉 lifecycle_stage。
|
||||
expect(reloadLatestDraftMock).toHaveBeenCalled();
|
||||
expect(refreshReviewQueueMock).toHaveBeenCalled();
|
||||
expect(refreshShippingProcessingMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('renders one Notice card and one business_no Excel download for freight upload', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
@@ -3475,7 +3515,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
summary: {}, steps: [],
|
||||
},
|
||||
} as any);
|
||||
// 完成面改版后按「已上传通知聚合」消费同一份 freight groups;仅 uploaded 通知进入完成面。
|
||||
// 完成面按「已上传通知聚合」消费同一份 freight groups。
|
||||
// 契约:聚合接口 upload_status 已经投影归一,成功终态为 uploaded。
|
||||
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
|
||||
po_number: 'PO-100',
|
||||
items: [
|
||||
@@ -3490,7 +3531,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
await flushPromises();
|
||||
|
||||
const evidence = wrapper.get('[data-testid="review-lifecycle-upload-complete"]');
|
||||
// 只展示已上传通知(uploaded),未上传(pending)不进入完成面。
|
||||
// 只展示已成功上传通知(uploaded),未上传(pending)不进入完成面。
|
||||
expect(wrapper.get('[data-testid="review-upload-complete-toolbar"]').text()).toContain('本批已上传 1 张发货通知');
|
||||
expect(evidence.text()).toContain('WYC26082401');
|
||||
expect(evidence.text()).not.toContain('WYC26082402');
|
||||
// 人工确认不再展示或依赖货代回执号,即使历史投影仍带有 freight_ref_no。
|
||||
@@ -3545,6 +3587,7 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.find('[data-testid="review-upload-complete-toolbar"]').exists()).toBe(false);
|
||||
|
||||
// 分组到达后:loading 让位,batchCount 工具栏与已上传列表恢复渲染。
|
||||
// 契约:后端 Notice 面 upload_status 已投影为 uploaded。
|
||||
resolveGroups({
|
||||
po_number: 'PO-UPCOMPLETE',
|
||||
items: [{
|
||||
@@ -3625,6 +3668,38 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(wrapper.findAll('[data-testid="review-freight-upload-download-SN-PO-WAVE-1"]')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('shows inline RPA and confirm actions when freight notice groups authorize them', async () => {
|
||||
activeCase.value = {
|
||||
...activeCase.value,
|
||||
status: 'confirmed', confirmed_task_no: 'SN-PO-ACTIONS', confirmed_task_id: 25, has_formal_ot: true,
|
||||
};
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
vi.mocked(taskApi.getWorkspaceShippingTask).mockResolvedValue({
|
||||
task_no: 'SN-PO-ACTIONS', business_no: 'WYC-ACTIONS', status: 'processing', lines: [], events: [],
|
||||
ui_state: { lifecycle_stage: 'freight_upload', lifecycle_entries: [], actions: { primary: null, secondary: [] }, stage_context: { upload: {} } },
|
||||
} as any);
|
||||
vi.mocked(taskApi.getWorkspaceShippingFreightNoticeGroups).mockResolvedValue({
|
||||
po_number: 'PO-ACTIONS',
|
||||
items: [{
|
||||
business_no: 'WYC-ACTIONS',
|
||||
po_number: 'PO-ACTIONS',
|
||||
upload_status: 'pending',
|
||||
export_file_name: 'WYC-ACTIONS.xlsx',
|
||||
available_actions: ['download_excel', 'retry_freight_upload_rpa', 'mark_manual_uploaded'],
|
||||
lines: [],
|
||||
}],
|
||||
} as any);
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'freight_upload' });
|
||||
await flushPromises();
|
||||
|
||||
// 关键断言:后端授权后的 RPA/确认必须作为行内主按钮出现,不能再藏进空白「更多」菜单。
|
||||
expect(wrapper.find('[data-testid="review-freight-upload-download"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-freight-upload-rpa"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="review-freight-upload-confirm"]').exists()).toBe(true);
|
||||
expect(wrapper.findAll('[data-testid="review-freight-upload-more"]')).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('sends selected business_nos for freight batch actions', async () => {
|
||||
activeCase.value = { ...activeCase.value, status: 'confirmed', confirmed_task_no: 'SN-PO-BATCH', confirmed_task_id: 23, has_formal_ot: true };
|
||||
const taskApi = await import('@/features/chat/api/shipping.api');
|
||||
|
||||
Reference in new issue
Block a user