1
This commit is contained in:
parent
dba7bbc8d7
commit
fb118d96b6
@ -58,10 +58,132 @@ export type WaveFetchTaskProgressResponse = {
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateExpressParams = {
|
||||
wave_ids: Array<string | number> | string | number
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateExpressResponse = {
|
||||
task_id: string
|
||||
status?: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateExpressTaskProgressParams = {
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateExpressTaskProgressResponse = {
|
||||
task_id: string
|
||||
status: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
progress_percent?: number
|
||||
total_count?: number
|
||||
success_count?: number
|
||||
failed_count?: number
|
||||
total_order_count?: number
|
||||
allocated_order_count?: number
|
||||
failed_order_count?: number
|
||||
duration_ms?: number
|
||||
update_time?: string
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateStorageParams = {
|
||||
wave_ids: Array<string | number> | string | number
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateStorageResponse = {
|
||||
task_id: string
|
||||
status?: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateStorageTaskProgressParams = {
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAllocateStorageTaskProgressResponse = {
|
||||
task_id: string
|
||||
status: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
progress_percent?: number
|
||||
total_count?: number
|
||||
success_count?: number
|
||||
failed_count?: number
|
||||
total_order_count?: number
|
||||
allocated_order_count?: number
|
||||
failed_order_count?: number
|
||||
duration_ms?: number
|
||||
update_time?: string
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchRemoveExceptionOrdersParams = {
|
||||
wave_ids: Array<string | number> | string | number
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchRemoveExceptionOrdersResponse = {
|
||||
task_id: string
|
||||
status?: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchRemoveExceptionOrdersTaskProgressParams = {
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchRemoveExceptionOrdersTaskProgressResponse = {
|
||||
task_id: string
|
||||
status: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
progress_percent?: number
|
||||
total_count?: number
|
||||
success_count?: number
|
||||
failed_count?: number
|
||||
total_order_count?: number
|
||||
removed_order_count?: number
|
||||
failed_order_count?: number
|
||||
duration_ms?: number
|
||||
update_time?: string
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchCancelParams = {
|
||||
ids: Array<string | number> | string | number
|
||||
}
|
||||
|
||||
export type WaveBatchCancelTaskProgressParams = {
|
||||
task_id?: string
|
||||
taskId?: string
|
||||
}
|
||||
|
||||
export type WaveBatchCancelTaskProgressResponse = {
|
||||
task_id: string
|
||||
status?: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
state?: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string
|
||||
progress_percent?: number
|
||||
total_count?: number
|
||||
success_count?: number
|
||||
failed_count?: number
|
||||
total_wave_count?: number
|
||||
processed_wave_count?: number
|
||||
total_order_count?: number
|
||||
processed_order_count?: number
|
||||
duration_ms?: number
|
||||
update_time?: string
|
||||
error?: string
|
||||
message?: string
|
||||
}
|
||||
|
||||
export type WaveBatchAutoGroupingParams = {
|
||||
ids: Array<string | number> | string | number
|
||||
}
|
||||
@ -144,6 +266,90 @@ export function orderWaveFetchTaskProgress(data: WaveFetchTaskProgressParams): P
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchAllocateExpress(data: WaveBatchAllocateExpressParams): Promise<WaveBatchAllocateExpressResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchAllocateExpress',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchAllocateExpressTaskProgress(data: WaveBatchAllocateExpressTaskProgressParams): Promise<WaveBatchAllocateExpressTaskProgressResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchAllocateExpressTaskProgress',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchAllocateStorage(data: WaveBatchAllocateStorageParams): Promise<WaveBatchAllocateStorageResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchAllocateStorage',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchAllocateStorageTaskProgress(data: WaveBatchAllocateStorageTaskProgressParams): Promise<WaveBatchAllocateStorageTaskProgressResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchAllocateStorageTaskProgress',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchRemoveExceptionOrders(data: WaveBatchRemoveExceptionOrdersParams): Promise<WaveBatchRemoveExceptionOrdersResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchRemoveExceptionOrders',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchRemoveExceptionOrdersTaskProgress(data: WaveBatchRemoveExceptionOrdersTaskProgressParams): Promise<WaveBatchRemoveExceptionOrdersTaskProgressResponse & { code?: number; message?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchRemoveExceptionOrdersTaskProgress',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchCancel(data: WaveBatchCancelParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
@ -158,6 +364,20 @@ export function orderWaveBatchCancel(data: WaveBatchCancelParams): Promise<any>
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchCancelTaskProgress(data: WaveBatchCancelTaskProgressParams): Promise<WaveBatchCancelTaskProgressResponse & { code?: number; message?: string; flag?: string }> {
|
||||
return request({
|
||||
url: '/system',
|
||||
method: 'post',
|
||||
params: {
|
||||
method: 'order.wave.batchCancelTaskProgress',
|
||||
v,
|
||||
timestamp: new Date().getTime()
|
||||
},
|
||||
data,
|
||||
isSystemApi: true
|
||||
} as any)
|
||||
}
|
||||
|
||||
export function orderWaveBatchAutoGrouping(data: WaveBatchAutoGroupingParams): Promise<any> {
|
||||
return request({
|
||||
url: '/system',
|
||||
@ -206,7 +426,14 @@ export const orderWave = {
|
||||
singleOrderFetchList: orderWaveSingleOrderFetchList,
|
||||
fetch: orderWaveFetch,
|
||||
fetchTaskProgress: orderWaveFetchTaskProgress,
|
||||
batchAllocateExpress: orderWaveBatchAllocateExpress,
|
||||
batchAllocateExpressTaskProgress: orderWaveBatchAllocateExpressTaskProgress,
|
||||
batchAllocateStorage: orderWaveBatchAllocateStorage,
|
||||
batchAllocateStorageTaskProgress: orderWaveBatchAllocateStorageTaskProgress,
|
||||
batchRemoveExceptionOrders: orderWaveBatchRemoveExceptionOrders,
|
||||
batchRemoveExceptionOrdersTaskProgress: orderWaveBatchRemoveExceptionOrdersTaskProgress,
|
||||
batchCancel: orderWaveBatchCancel,
|
||||
batchCancelTaskProgress: orderWaveBatchCancelTaskProgress,
|
||||
batchAutoGrouping: orderWaveBatchAutoGrouping,
|
||||
batchFinishAutoGrouping: orderWaveBatchFinishAutoGrouping,
|
||||
batchRemoveOrders: orderWaveBatchRemoveOrders
|
||||
|
||||
@ -56,6 +56,74 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchAllocateExpressTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
<div class="task-progress-panel__header">
|
||||
<span class="task-progress-panel__title">快递号分配任务进度</span>
|
||||
<span class="task-progress-panel__meta">任务ID:{{ batchAllocateExpressTaskProgress.taskId }}</span>
|
||||
</div>
|
||||
<el-progress :percentage="batchAllocateExpressTaskPercent" :status="batchAllocateExpressTaskProgressBarStatus" :stroke-width="16" />
|
||||
<div class="task-progress-panel__info">
|
||||
<span>状态:{{ getFetchTaskStatusText(batchAllocateExpressTaskProgress.status) }}</span>
|
||||
<span>已完成订单:{{ batchAllocateExpressTaskProgress.successCount }} / {{ batchAllocateExpressTaskProgress.totalCount }}</span>
|
||||
<span>失败订单:{{ batchAllocateExpressTaskProgress.failedCount }}</span>
|
||||
<span v-if="batchAllocateExpressTaskProgress.updateTime">更新时间:{{ formatDateTime(batchAllocateExpressTaskProgress.updateTime) }}</span>
|
||||
</div>
|
||||
<div v-if="batchAllocateExpressTaskProgress.message || batchAllocateExpressTaskProgress.error" class="task-progress-panel__message">
|
||||
{{ batchAllocateExpressTaskProgress.error || batchAllocateExpressTaskProgress.message }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchAllocateStorageTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
<div class="task-progress-panel__header">
|
||||
<span class="task-progress-panel__title">储位分配任务进度</span>
|
||||
<span class="task-progress-panel__meta">任务ID:{{ batchAllocateStorageTaskProgress.taskId }}</span>
|
||||
</div>
|
||||
<el-progress :percentage="batchAllocateStorageTaskPercent" :status="batchAllocateStorageTaskProgressBarStatus" :stroke-width="16" />
|
||||
<div class="task-progress-panel__info">
|
||||
<span>状态:{{ getFetchTaskStatusText(batchAllocateStorageTaskProgress.status) }}</span>
|
||||
<span>已完成订单:{{ batchAllocateStorageTaskProgress.successCount }} / {{ batchAllocateStorageTaskProgress.totalCount }}</span>
|
||||
<span>失败订单:{{ batchAllocateStorageTaskProgress.failedCount }}</span>
|
||||
<span v-if="batchAllocateStorageTaskProgress.updateTime">更新时间:{{ formatDateTime(batchAllocateStorageTaskProgress.updateTime) }}</span>
|
||||
</div>
|
||||
<div v-if="batchAllocateStorageTaskProgress.message || batchAllocateStorageTaskProgress.error" class="task-progress-panel__message">
|
||||
{{ batchAllocateStorageTaskProgress.error || batchAllocateStorageTaskProgress.message }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchRemoveExceptionOrdersTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
<div class="task-progress-panel__header">
|
||||
<span class="task-progress-panel__title">移除异常订单任务进度</span>
|
||||
<span class="task-progress-panel__meta">任务ID:{{ batchRemoveExceptionOrdersTaskProgress.taskId }}</span>
|
||||
</div>
|
||||
<el-progress :percentage="batchRemoveExceptionOrdersTaskPercent" :status="batchRemoveExceptionOrdersTaskProgressBarStatus" :stroke-width="16" />
|
||||
<div class="task-progress-panel__info">
|
||||
<span>状态:{{ getFetchTaskStatusText(batchRemoveExceptionOrdersTaskProgress.status) }}</span>
|
||||
<span>已移除订单:{{ batchRemoveExceptionOrdersTaskProgress.successCount }} / {{ batchRemoveExceptionOrdersTaskProgress.totalCount }}</span>
|
||||
<span>失败订单:{{ batchRemoveExceptionOrdersTaskProgress.failedCount }}</span>
|
||||
<span v-if="batchRemoveExceptionOrdersTaskProgress.updateTime">更新时间:{{ formatDateTime(batchRemoveExceptionOrdersTaskProgress.updateTime) }}</span>
|
||||
</div>
|
||||
<div v-if="batchRemoveExceptionOrdersTaskProgress.message || batchRemoveExceptionOrdersTaskProgress.error" class="task-progress-panel__message">
|
||||
{{ batchRemoveExceptionOrdersTaskProgress.error || batchRemoveExceptionOrdersTaskProgress.message }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="batchCancelTaskProgress.taskId" class="task-progress-panel task-progress-panel--toolbar">
|
||||
<div class="task-progress-panel__header">
|
||||
<span class="task-progress-panel__title">批量取消波次任务进度</span>
|
||||
<span class="task-progress-panel__meta">任务ID:{{ batchCancelTaskProgress.taskId }}</span>
|
||||
</div>
|
||||
<el-progress :percentage="batchCancelTaskPercent" :status="batchCancelTaskProgressBarStatus" :stroke-width="16" />
|
||||
<div class="task-progress-panel__info">
|
||||
<span>状态:{{ getFetchTaskStatusText(batchCancelTaskProgress.status) }}</span>
|
||||
<span>已处理波次:{{ batchCancelTaskProgress.successCount }} / {{ batchCancelTaskProgress.totalCount }}</span>
|
||||
<span>失败波次:{{ batchCancelTaskProgress.failedCount }}</span>
|
||||
<span v-if="batchCancelTaskProgress.updateTime">更新时间:{{ formatDateTime(batchCancelTaskProgress.updateTime) }}</span>
|
||||
</div>
|
||||
<div v-if="batchCancelTaskProgress.message || batchCancelTaskProgress.error" class="task-progress-panel__message">
|
||||
{{ batchCancelTaskProgress.error || batchCancelTaskProgress.message }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="split-stack" ref="splitStackRef">
|
||||
<div class="upper-wrapper" :style="detailVisible ? upperPaneStyle : upperPaneFullStyle">
|
||||
<upper-table
|
||||
@ -582,16 +650,31 @@ import PendingOrderListPanel from './component/PendingOrderListPanel.vue'
|
||||
import * as indexApi from '@/api/index/index'
|
||||
import { settingWarehouseGetSettings as getWarehouseSettings } from '@/api/setting.warehouse/settingwarehouse'
|
||||
import {
|
||||
orderWaveBatchAllocateExpress,
|
||||
orderWaveBatchAllocateExpressTaskProgress,
|
||||
orderWaveBatchAllocateStorage,
|
||||
orderWaveBatchAllocateStorageTaskProgress,
|
||||
orderWaveBatchAutoGrouping,
|
||||
orderWaveBatchCancel,
|
||||
orderWaveBatchCancelTaskProgress,
|
||||
orderWaveBatchFinishAutoGrouping,
|
||||
orderWaveBatchRemoveExceptionOrders,
|
||||
orderWaveBatchRemoveExceptionOrdersTaskProgress,
|
||||
orderWaveBatchList,
|
||||
orderWaveFetch,
|
||||
orderWaveFetchTaskProgress,
|
||||
orderWaveGroupOrderFetchList,
|
||||
orderWaveSingleOrderFetchList
|
||||
} from '@/api/order.wave/orderwave'
|
||||
import type { WaveFetchParams, WaveFetchResponse, WaveFetchTaskProgressResponse } from '@/api/order.wave/orderwave'
|
||||
import type {
|
||||
WaveBatchAllocateExpressTaskProgressResponse,
|
||||
WaveBatchAllocateStorageTaskProgressResponse,
|
||||
WaveBatchCancelTaskProgressResponse,
|
||||
WaveBatchRemoveExceptionOrdersTaskProgressResponse,
|
||||
WaveFetchParams,
|
||||
WaveFetchResponse,
|
||||
WaveFetchTaskProgressResponse
|
||||
} from '@/api/order.wave/orderwave'
|
||||
import { useUserStore } from '@/stores/modules/user'
|
||||
import { getWavePrintData } from '@/api/order.print/orderprint'
|
||||
import type { WavePrintDataPayload } from '@/api/order.print/orderprint'
|
||||
@ -611,6 +694,9 @@ const batchAutoGroupingLoading = ref(false)
|
||||
const batchFinishAutoGroupingLoading = ref(false)
|
||||
const batchCancelLoading = ref(false)
|
||||
const batchPrintLoading = ref(false)
|
||||
const batchAllocateExpressLoading = ref(false)
|
||||
const batchAllocateStorageLoading = ref(false)
|
||||
const batchRemoveExceptionOrdersLoading = ref(false)
|
||||
const userStore = useUserStore()
|
||||
const wavePrintDialogVisible = ref(false)
|
||||
const wavePrintDialogLoading = ref(false)
|
||||
@ -631,6 +717,10 @@ const groupOrderSelectionRows = ref<any[]>([])
|
||||
const groupOrderStoreOptions = ref<Array<{ label: string; value: number | string }>>([])
|
||||
const waveMaxOrderLimit = ref<number | null>(null)
|
||||
const fetchTaskPollTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const batchAllocateExpressTaskPollTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const batchAllocateStorageTaskPollTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const batchRemoveExceptionOrdersTaskPollTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const batchCancelTaskPollTimer = ref<ReturnType<typeof setTimeout> | null>(null)
|
||||
const pendingOrderDialogVisible = ref(false)
|
||||
const pendingOrderDialogWaveNo = ref('')
|
||||
const fetchTaskProgress = reactive({
|
||||
@ -646,6 +736,54 @@ const fetchTaskProgress = reactive({
|
||||
updateTime: '',
|
||||
message: ''
|
||||
})
|
||||
const batchAllocateExpressTaskProgress = reactive({
|
||||
taskId: '',
|
||||
status: 'submitted',
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
failedCount: 0,
|
||||
progressPercent: 0,
|
||||
durationMs: 0,
|
||||
updateTime: '',
|
||||
error: '',
|
||||
message: ''
|
||||
})
|
||||
const batchAllocateStorageTaskProgress = reactive({
|
||||
taskId: '',
|
||||
status: 'submitted',
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
failedCount: 0,
|
||||
progressPercent: 0,
|
||||
durationMs: 0,
|
||||
updateTime: '',
|
||||
error: '',
|
||||
message: ''
|
||||
})
|
||||
const batchRemoveExceptionOrdersTaskProgress = reactive({
|
||||
taskId: '',
|
||||
status: 'submitted',
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
failedCount: 0,
|
||||
progressPercent: 0,
|
||||
durationMs: 0,
|
||||
updateTime: '',
|
||||
error: '',
|
||||
message: ''
|
||||
})
|
||||
const batchCancelTaskProgress = reactive({
|
||||
taskId: '',
|
||||
status: 'submitted',
|
||||
totalCount: 0,
|
||||
successCount: 0,
|
||||
failedCount: 0,
|
||||
progressPercent: 0,
|
||||
durationMs: 0,
|
||||
updateTime: '',
|
||||
error: '',
|
||||
message: ''
|
||||
})
|
||||
|
||||
const pagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
const groupOrderPagination = reactive({ currentPage: 1, pageSize: 20, total: 0 })
|
||||
@ -710,7 +848,10 @@ const buttonLoadingMap = computed(() => ({
|
||||
batchAutoGroupingLoading: batchAutoGroupingLoading.value,
|
||||
batchFinishAutoGroupingLoading: batchFinishAutoGroupingLoading.value,
|
||||
batchCancelLoading: batchCancelLoading.value,
|
||||
batchPrintLoading: batchPrintLoading.value
|
||||
batchPrintLoading: batchPrintLoading.value,
|
||||
batchAllocateExpressLoading: batchAllocateExpressLoading.value,
|
||||
batchAllocateStorageLoading: batchAllocateStorageLoading.value,
|
||||
batchRemoveExceptionOrdersLoading: batchRemoveExceptionOrdersLoading.value
|
||||
}))
|
||||
|
||||
const buttonDisabledMap = computed(() => ({
|
||||
@ -754,6 +895,15 @@ const toolbarActionMap: Record<string, () => void> = {
|
||||
handleBatchCancel: () => {
|
||||
void handleBatchCancel()
|
||||
},
|
||||
handleBatchAllocateExpress: () => {
|
||||
void handleBatchAllocateExpress()
|
||||
},
|
||||
handleBatchAllocateStorage: () => {
|
||||
void handleBatchAllocateStorage()
|
||||
},
|
||||
handleBatchRemoveExceptionOrders: () => {
|
||||
void handleBatchRemoveExceptionOrders()
|
||||
},
|
||||
openGroupOrderDialog: () => openGroupOrderDialog(),
|
||||
openSingleOrderDialog: () => openSingleOrderDialog()
|
||||
}
|
||||
@ -805,6 +955,46 @@ const fetchTaskProgressBarStatus = computed(() => {
|
||||
if (fetchTaskProgress.status === 'success' || fetchTaskPercent.value >= 100) return 'success'
|
||||
return undefined
|
||||
})
|
||||
const batchAllocateExpressTaskPercent = computed(() => {
|
||||
const value = Number(batchAllocateExpressTaskProgress.progressPercent || 0)
|
||||
if (!Number.isFinite(value)) return 0
|
||||
return Math.min(100, Math.max(0, value))
|
||||
})
|
||||
const batchAllocateExpressTaskProgressBarStatus = computed(() => {
|
||||
if (batchAllocateExpressTaskProgress.status === 'failed' || batchAllocateExpressTaskProgress.status === 'not_found') return 'exception'
|
||||
if (batchAllocateExpressTaskProgress.status === 'success' || batchAllocateExpressTaskPercent.value >= 100) return 'success'
|
||||
return undefined
|
||||
})
|
||||
const batchAllocateStorageTaskPercent = computed(() => {
|
||||
const value = Number(batchAllocateStorageTaskProgress.progressPercent || 0)
|
||||
if (!Number.isFinite(value)) return 0
|
||||
return Math.min(100, Math.max(0, value))
|
||||
})
|
||||
const batchAllocateStorageTaskProgressBarStatus = computed(() => {
|
||||
if (batchAllocateStorageTaskProgress.status === 'failed' || batchAllocateStorageTaskProgress.status === 'not_found') return 'exception'
|
||||
if (batchAllocateStorageTaskProgress.status === 'success' || batchAllocateStorageTaskPercent.value >= 100) return 'success'
|
||||
return undefined
|
||||
})
|
||||
const batchRemoveExceptionOrdersTaskPercent = computed(() => {
|
||||
const value = Number(batchRemoveExceptionOrdersTaskProgress.progressPercent || 0)
|
||||
if (!Number.isFinite(value)) return 0
|
||||
return Math.min(100, Math.max(0, value))
|
||||
})
|
||||
const batchRemoveExceptionOrdersTaskProgressBarStatus = computed(() => {
|
||||
if (batchRemoveExceptionOrdersTaskProgress.status === 'failed' || batchRemoveExceptionOrdersTaskProgress.status === 'not_found') return 'exception'
|
||||
if (batchRemoveExceptionOrdersTaskProgress.status === 'success' || batchRemoveExceptionOrdersTaskPercent.value >= 100) return 'success'
|
||||
return undefined
|
||||
})
|
||||
const batchCancelTaskPercent = computed(() => {
|
||||
const value = Number(batchCancelTaskProgress.progressPercent || 0)
|
||||
if (!Number.isFinite(value)) return 0
|
||||
return Math.min(100, Math.max(0, value))
|
||||
})
|
||||
const batchCancelTaskProgressBarStatus = computed(() => {
|
||||
if (batchCancelTaskProgress.status === 'failed' || batchCancelTaskProgress.status === 'not_found') return 'exception'
|
||||
if (batchCancelTaskProgress.status === 'success' || batchCancelTaskPercent.value >= 100) return 'success'
|
||||
return undefined
|
||||
})
|
||||
const pendingOrderDialogTitle = computed(() => pendingOrderDialogWaveNo.value ? `待处理订单 - ${pendingOrderDialogWaveNo.value}` : '待处理订单')
|
||||
|
||||
onMounted(() => {
|
||||
@ -813,6 +1003,10 @@ onMounted(() => {
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
stopFetchTaskPolling()
|
||||
stopBatchAllocateExpressTaskPolling()
|
||||
stopBatchAllocateStorageTaskPolling()
|
||||
stopBatchRemoveExceptionOrdersTaskPolling()
|
||||
stopBatchCancelTaskPolling()
|
||||
})
|
||||
|
||||
async function initializePage() {
|
||||
@ -1422,7 +1616,7 @@ function scheduleFetchTaskPolling(delay = 2000) {
|
||||
|
||||
function applyFetchTaskProgress(progress: Partial<WaveFetchTaskProgressResponse>) {
|
||||
fetchTaskProgress.taskId = String(progress.task_id || fetchTaskProgress.taskId || '')
|
||||
fetchTaskProgress.status = String(progress.status || fetchTaskProgress.status || 'submitted')
|
||||
fetchTaskProgress.status = resolveAsyncTaskStatus(progress as Record<string, any>, fetchTaskProgress.status || 'submitted')
|
||||
fetchTaskProgress.warehouseId = progress.warehouse_id
|
||||
fetchTaskProgress.structureCount = Number(progress.structure_count ?? fetchTaskProgress.structureCount ?? 0)
|
||||
fetchTaskProgress.finishedStructureCount = Number(progress.finished_structure_count ?? fetchTaskProgress.finishedStructureCount ?? 0)
|
||||
@ -1434,6 +1628,20 @@ function applyFetchTaskProgress(progress: Partial<WaveFetchTaskProgressResponse>
|
||||
fetchTaskProgress.message = String(progress.message || '')
|
||||
}
|
||||
|
||||
function resetFetchTaskProgress() {
|
||||
fetchTaskProgress.taskId = ''
|
||||
fetchTaskProgress.status = 'submitted'
|
||||
fetchTaskProgress.warehouseId = undefined
|
||||
fetchTaskProgress.structureCount = 0
|
||||
fetchTaskProgress.finishedStructureCount = 0
|
||||
fetchTaskProgress.progressPercent = 0
|
||||
fetchTaskProgress.totalFetchedQuantity = 0
|
||||
fetchTaskProgress.durationMs = 0
|
||||
fetchTaskProgress.error = ''
|
||||
fetchTaskProgress.updateTime = ''
|
||||
fetchTaskProgress.message = ''
|
||||
}
|
||||
|
||||
async function pollFetchTaskProgress() {
|
||||
if (!fetchTaskProgress.taskId) return
|
||||
try {
|
||||
@ -1446,12 +1654,15 @@ async function pollFetchTaskProgress() {
|
||||
|
||||
if (fetchTaskProgress.status === 'failed' || fetchTaskProgress.status === 'not_found') {
|
||||
stopFetchTaskPolling()
|
||||
await loadData()
|
||||
resetFetchTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
if (fetchTaskProgress.status === 'success' || fetchTaskPercent.value >= 100) {
|
||||
if (fetchTaskProgress.status === 'success' || Number(fetchTaskProgress.progressPercent || 0) >= 100) {
|
||||
stopFetchTaskPolling()
|
||||
await loadData()
|
||||
resetFetchTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
@ -1462,6 +1673,555 @@ async function pollFetchTaskProgress() {
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeAsyncTaskStatus(value: unknown) {
|
||||
return String(value ?? '').trim().toLowerCase()
|
||||
}
|
||||
|
||||
function resolveAsyncTaskStatus(progress: Record<string, any>, fallback = 'submitted') {
|
||||
return String(progress.status ?? progress.state ?? progress.task_status ?? fallback)
|
||||
}
|
||||
|
||||
function isAsyncTaskSuccessStatus(status: string) {
|
||||
return ['success', 'succeeded', 'finished', 'fin', 'done', 'completed', 'complete'].includes(status)
|
||||
}
|
||||
|
||||
function isAsyncTaskFailureStatus(status: string) {
|
||||
return ['failed', 'failure', 'error', 'exception', 'cancel', 'cancelled', 'canceled', 'timeout', 'not_found'].includes(status)
|
||||
}
|
||||
|
||||
function stopBatchAllocateExpressTaskPolling() {
|
||||
if (batchAllocateExpressTaskPollTimer.value) {
|
||||
clearTimeout(batchAllocateExpressTaskPollTimer.value)
|
||||
batchAllocateExpressTaskPollTimer.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleBatchAllocateExpressTaskPolling(delay = 2000) {
|
||||
stopBatchAllocateExpressTaskPolling()
|
||||
if (!batchAllocateExpressTaskProgress.taskId) return
|
||||
batchAllocateExpressTaskPollTimer.value = setTimeout(() => {
|
||||
void pollBatchAllocateExpressTaskProgress()
|
||||
}, delay)
|
||||
}
|
||||
|
||||
function applyBatchAllocateExpressTaskProgress(progress: Partial<WaveBatchAllocateExpressTaskProgressResponse> & Record<string, any>) {
|
||||
batchAllocateExpressTaskProgress.taskId = String(progress.task_id || batchAllocateExpressTaskProgress.taskId || '')
|
||||
batchAllocateExpressTaskProgress.status = resolveAsyncTaskStatus(progress, batchAllocateExpressTaskProgress.status || 'submitted')
|
||||
batchAllocateExpressTaskProgress.totalCount = Number(
|
||||
progress.total_count
|
||||
?? progress.total_order_count
|
||||
?? batchAllocateExpressTaskProgress.totalCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateExpressTaskProgress.successCount = Number(
|
||||
progress.success_count
|
||||
?? progress.allocated_order_count
|
||||
?? progress.updated_count
|
||||
?? batchAllocateExpressTaskProgress.successCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateExpressTaskProgress.failedCount = Number(
|
||||
progress.failed_count
|
||||
?? progress.failed_order_count
|
||||
?? batchAllocateExpressTaskProgress.failedCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateExpressTaskProgress.progressPercent = Number(progress.progress_percent ?? batchAllocateExpressTaskProgress.progressPercent ?? 0)
|
||||
batchAllocateExpressTaskProgress.durationMs = Number(progress.duration_ms ?? batchAllocateExpressTaskProgress.durationMs ?? 0)
|
||||
batchAllocateExpressTaskProgress.updateTime = String(progress.update_time || '')
|
||||
batchAllocateExpressTaskProgress.error = String(progress.error || '')
|
||||
batchAllocateExpressTaskProgress.message = String(progress.message || '')
|
||||
}
|
||||
|
||||
function resetBatchAllocateExpressTaskProgress() {
|
||||
batchAllocateExpressTaskProgress.taskId = ''
|
||||
batchAllocateExpressTaskProgress.status = 'submitted'
|
||||
batchAllocateExpressTaskProgress.totalCount = 0
|
||||
batchAllocateExpressTaskProgress.successCount = 0
|
||||
batchAllocateExpressTaskProgress.failedCount = 0
|
||||
batchAllocateExpressTaskProgress.progressPercent = 0
|
||||
batchAllocateExpressTaskProgress.durationMs = 0
|
||||
batchAllocateExpressTaskProgress.updateTime = ''
|
||||
batchAllocateExpressTaskProgress.error = ''
|
||||
batchAllocateExpressTaskProgress.message = ''
|
||||
}
|
||||
|
||||
function stopBatchAllocateStorageTaskPolling() {
|
||||
if (batchAllocateStorageTaskPollTimer.value) {
|
||||
clearTimeout(batchAllocateStorageTaskPollTimer.value)
|
||||
batchAllocateStorageTaskPollTimer.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleBatchAllocateStorageTaskPolling(delay = 2000) {
|
||||
stopBatchAllocateStorageTaskPolling()
|
||||
if (!batchAllocateStorageTaskProgress.taskId) return
|
||||
batchAllocateStorageTaskPollTimer.value = setTimeout(() => {
|
||||
void pollBatchAllocateStorageTaskProgress()
|
||||
}, delay)
|
||||
}
|
||||
|
||||
function applyBatchAllocateStorageTaskProgress(progress: Partial<WaveBatchAllocateStorageTaskProgressResponse> & Record<string, any>) {
|
||||
batchAllocateStorageTaskProgress.taskId = String(progress.task_id || batchAllocateStorageTaskProgress.taskId || '')
|
||||
batchAllocateStorageTaskProgress.status = resolveAsyncTaskStatus(progress, batchAllocateStorageTaskProgress.status || 'submitted')
|
||||
batchAllocateStorageTaskProgress.totalCount = Number(
|
||||
progress.total_count
|
||||
?? progress.total_order_count
|
||||
?? progress.total_wave_count
|
||||
?? batchAllocateStorageTaskProgress.totalCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateStorageTaskProgress.successCount = Number(
|
||||
progress.success_count
|
||||
?? progress.processed_order_count
|
||||
?? progress.allocated_order_count
|
||||
?? progress.updated_count
|
||||
?? batchAllocateStorageTaskProgress.successCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateStorageTaskProgress.failedCount = Number(
|
||||
progress.failed_count
|
||||
?? progress.failed_order_count
|
||||
?? batchAllocateStorageTaskProgress.failedCount
|
||||
?? 0
|
||||
)
|
||||
batchAllocateStorageTaskProgress.progressPercent = Number(progress.progress_percent ?? batchAllocateStorageTaskProgress.progressPercent ?? 0)
|
||||
batchAllocateStorageTaskProgress.durationMs = Number(progress.duration_ms ?? batchAllocateStorageTaskProgress.durationMs ?? 0)
|
||||
batchAllocateStorageTaskProgress.updateTime = String(progress.update_time || '')
|
||||
batchAllocateStorageTaskProgress.error = String(progress.error || '')
|
||||
batchAllocateStorageTaskProgress.message = String(progress.message || '')
|
||||
}
|
||||
|
||||
function resetBatchAllocateStorageTaskProgress() {
|
||||
batchAllocateStorageTaskProgress.taskId = ''
|
||||
batchAllocateStorageTaskProgress.status = 'submitted'
|
||||
batchAllocateStorageTaskProgress.totalCount = 0
|
||||
batchAllocateStorageTaskProgress.successCount = 0
|
||||
batchAllocateStorageTaskProgress.failedCount = 0
|
||||
batchAllocateStorageTaskProgress.progressPercent = 0
|
||||
batchAllocateStorageTaskProgress.durationMs = 0
|
||||
batchAllocateStorageTaskProgress.updateTime = ''
|
||||
batchAllocateStorageTaskProgress.error = ''
|
||||
batchAllocateStorageTaskProgress.message = ''
|
||||
}
|
||||
|
||||
function stopBatchRemoveExceptionOrdersTaskPolling() {
|
||||
if (batchRemoveExceptionOrdersTaskPollTimer.value) {
|
||||
clearTimeout(batchRemoveExceptionOrdersTaskPollTimer.value)
|
||||
batchRemoveExceptionOrdersTaskPollTimer.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleBatchRemoveExceptionOrdersTaskPolling(delay = 2000) {
|
||||
stopBatchRemoveExceptionOrdersTaskPolling()
|
||||
if (!batchRemoveExceptionOrdersTaskProgress.taskId) return
|
||||
batchRemoveExceptionOrdersTaskPollTimer.value = setTimeout(() => {
|
||||
void pollBatchRemoveExceptionOrdersTaskProgress()
|
||||
}, delay)
|
||||
}
|
||||
|
||||
function applyBatchRemoveExceptionOrdersTaskProgress(progress: Partial<WaveBatchRemoveExceptionOrdersTaskProgressResponse> & Record<string, any>) {
|
||||
batchRemoveExceptionOrdersTaskProgress.taskId = String(progress.task_id || batchRemoveExceptionOrdersTaskProgress.taskId || '')
|
||||
batchRemoveExceptionOrdersTaskProgress.status = resolveAsyncTaskStatus(progress, batchRemoveExceptionOrdersTaskProgress.status || 'submitted')
|
||||
batchRemoveExceptionOrdersTaskProgress.totalCount = Number(
|
||||
progress.total_count
|
||||
?? progress.total_order_count
|
||||
?? batchRemoveExceptionOrdersTaskProgress.totalCount
|
||||
?? 0
|
||||
)
|
||||
batchRemoveExceptionOrdersTaskProgress.successCount = Number(
|
||||
progress.success_count
|
||||
?? progress.removed_order_count
|
||||
?? progress.updated_count
|
||||
?? batchRemoveExceptionOrdersTaskProgress.successCount
|
||||
?? 0
|
||||
)
|
||||
batchRemoveExceptionOrdersTaskProgress.failedCount = Number(
|
||||
progress.failed_count
|
||||
?? progress.failed_order_count
|
||||
?? batchRemoveExceptionOrdersTaskProgress.failedCount
|
||||
?? 0
|
||||
)
|
||||
batchRemoveExceptionOrdersTaskProgress.progressPercent = Number(progress.progress_percent ?? batchRemoveExceptionOrdersTaskProgress.progressPercent ?? 0)
|
||||
batchRemoveExceptionOrdersTaskProgress.durationMs = Number(progress.duration_ms ?? batchRemoveExceptionOrdersTaskProgress.durationMs ?? 0)
|
||||
batchRemoveExceptionOrdersTaskProgress.updateTime = String(progress.update_time || '')
|
||||
batchRemoveExceptionOrdersTaskProgress.error = String(progress.error || '')
|
||||
batchRemoveExceptionOrdersTaskProgress.message = String(progress.message || '')
|
||||
}
|
||||
|
||||
function resetBatchRemoveExceptionOrdersTaskProgress() {
|
||||
batchRemoveExceptionOrdersTaskProgress.taskId = ''
|
||||
batchRemoveExceptionOrdersTaskProgress.status = 'submitted'
|
||||
batchRemoveExceptionOrdersTaskProgress.totalCount = 0
|
||||
batchRemoveExceptionOrdersTaskProgress.successCount = 0
|
||||
batchRemoveExceptionOrdersTaskProgress.failedCount = 0
|
||||
batchRemoveExceptionOrdersTaskProgress.progressPercent = 0
|
||||
batchRemoveExceptionOrdersTaskProgress.durationMs = 0
|
||||
batchRemoveExceptionOrdersTaskProgress.updateTime = ''
|
||||
batchRemoveExceptionOrdersTaskProgress.error = ''
|
||||
batchRemoveExceptionOrdersTaskProgress.message = ''
|
||||
}
|
||||
|
||||
function stopBatchCancelTaskPolling() {
|
||||
if (batchCancelTaskPollTimer.value) {
|
||||
clearTimeout(batchCancelTaskPollTimer.value)
|
||||
batchCancelTaskPollTimer.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleBatchCancelTaskPolling(delay = 2000) {
|
||||
stopBatchCancelTaskPolling()
|
||||
if (!batchCancelTaskProgress.taskId) return
|
||||
batchCancelTaskPollTimer.value = setTimeout(() => {
|
||||
void pollBatchCancelTaskProgress()
|
||||
}, delay)
|
||||
}
|
||||
|
||||
function applyBatchCancelTaskProgress(progress: Partial<WaveBatchCancelTaskProgressResponse> & Record<string, any>) {
|
||||
batchCancelTaskProgress.taskId = String(progress.task_id || batchCancelTaskProgress.taskId || '')
|
||||
batchCancelTaskProgress.status = resolveAsyncTaskStatus(progress, batchCancelTaskProgress.status || 'submitted')
|
||||
batchCancelTaskProgress.totalCount = Number(
|
||||
progress.total_count
|
||||
?? progress.total_wave_count
|
||||
?? batchCancelTaskProgress.totalCount
|
||||
?? 0
|
||||
)
|
||||
batchCancelTaskProgress.successCount = Number(
|
||||
progress.success_count
|
||||
?? progress.processed_wave_count
|
||||
?? batchCancelTaskProgress.successCount
|
||||
?? 0
|
||||
)
|
||||
batchCancelTaskProgress.failedCount = Number(
|
||||
progress.failed_count
|
||||
?? batchCancelTaskProgress.failedCount
|
||||
?? 0
|
||||
)
|
||||
batchCancelTaskProgress.progressPercent = Number(progress.progress_percent ?? batchCancelTaskProgress.progressPercent ?? 0)
|
||||
batchCancelTaskProgress.durationMs = Number(progress.duration_ms ?? batchCancelTaskProgress.durationMs ?? 0)
|
||||
batchCancelTaskProgress.updateTime = String(progress.update_time || '')
|
||||
batchCancelTaskProgress.error = String(progress.error || '')
|
||||
batchCancelTaskProgress.message = String(progress.message || '')
|
||||
}
|
||||
|
||||
function resetBatchCancelTaskProgress() {
|
||||
batchCancelTaskProgress.taskId = ''
|
||||
batchCancelTaskProgress.status = 'submitted'
|
||||
batchCancelTaskProgress.totalCount = 0
|
||||
batchCancelTaskProgress.successCount = 0
|
||||
batchCancelTaskProgress.failedCount = 0
|
||||
batchCancelTaskProgress.progressPercent = 0
|
||||
batchCancelTaskProgress.durationMs = 0
|
||||
batchCancelTaskProgress.updateTime = ''
|
||||
batchCancelTaskProgress.error = ''
|
||||
batchCancelTaskProgress.message = ''
|
||||
}
|
||||
|
||||
async function pollBatchCancelTaskProgress() {
|
||||
if (!batchCancelTaskProgress.taskId) return
|
||||
try {
|
||||
const res = await orderWaveBatchCancelTaskProgress({ task_id: batchCancelTaskProgress.taskId }) as WaveBatchCancelTaskProgressResponse & { code?: number; message?: string; flag?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '查询批量取消波次任务进度失败')
|
||||
}
|
||||
|
||||
applyBatchCancelTaskProgress(res)
|
||||
const normalizedStatus = normalizeAsyncTaskStatus(batchCancelTaskProgress.status)
|
||||
|
||||
if (isAsyncTaskFailureStatus(normalizedStatus)) {
|
||||
stopBatchCancelTaskPolling()
|
||||
await loadData()
|
||||
resetBatchCancelTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
if (isAsyncTaskSuccessStatus(normalizedStatus) || Number(batchCancelTaskProgress.progressPercent || 0) >= 100) {
|
||||
stopBatchCancelTaskPolling()
|
||||
await loadData()
|
||||
resetBatchCancelTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
scheduleBatchCancelTaskPolling()
|
||||
} catch (error) {
|
||||
console.error('poll batch cancel task progress failed:', error)
|
||||
scheduleBatchCancelTaskPolling(4000)
|
||||
}
|
||||
}
|
||||
|
||||
async function pollBatchRemoveExceptionOrdersTaskProgress() {
|
||||
if (!batchRemoveExceptionOrdersTaskProgress.taskId) return
|
||||
try {
|
||||
const res = await orderWaveBatchRemoveExceptionOrdersTaskProgress({ task_id: batchRemoveExceptionOrdersTaskProgress.taskId }) as WaveBatchRemoveExceptionOrdersTaskProgressResponse & { code?: number; message?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '查询移除异常订单任务进度失败')
|
||||
}
|
||||
|
||||
applyBatchRemoveExceptionOrdersTaskProgress(res)
|
||||
const normalizedStatus = normalizeAsyncTaskStatus(batchRemoveExceptionOrdersTaskProgress.status)
|
||||
|
||||
if (isAsyncTaskFailureStatus(normalizedStatus)) {
|
||||
stopBatchRemoveExceptionOrdersTaskPolling()
|
||||
await loadData()
|
||||
resetBatchRemoveExceptionOrdersTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
if (isAsyncTaskSuccessStatus(normalizedStatus) || Number(batchRemoveExceptionOrdersTaskProgress.progressPercent || 0) >= 100) {
|
||||
stopBatchRemoveExceptionOrdersTaskPolling()
|
||||
await loadData()
|
||||
resetBatchRemoveExceptionOrdersTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
scheduleBatchRemoveExceptionOrdersTaskPolling()
|
||||
} catch (error) {
|
||||
console.error('poll batch remove exception orders task progress failed:', error)
|
||||
scheduleBatchRemoveExceptionOrdersTaskPolling(4000)
|
||||
}
|
||||
}
|
||||
|
||||
async function pollBatchAllocateStorageTaskProgress() {
|
||||
if (!batchAllocateStorageTaskProgress.taskId) return
|
||||
try {
|
||||
const res = await orderWaveBatchAllocateStorageTaskProgress({ task_id: batchAllocateStorageTaskProgress.taskId }) as WaveBatchAllocateStorageTaskProgressResponse & { code?: number; message?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '查询储位分配任务进度失败')
|
||||
}
|
||||
|
||||
applyBatchAllocateStorageTaskProgress(res)
|
||||
const normalizedStatus = normalizeAsyncTaskStatus(batchAllocateStorageTaskProgress.status)
|
||||
|
||||
if (isAsyncTaskFailureStatus(normalizedStatus)) {
|
||||
stopBatchAllocateStorageTaskPolling()
|
||||
await loadData()
|
||||
resetBatchAllocateStorageTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
if (isAsyncTaskSuccessStatus(normalizedStatus) || Number(batchAllocateStorageTaskProgress.progressPercent || 0) >= 100) {
|
||||
stopBatchAllocateStorageTaskPolling()
|
||||
await loadData()
|
||||
resetBatchAllocateStorageTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
scheduleBatchAllocateStorageTaskPolling()
|
||||
} catch (error) {
|
||||
console.error('poll batch allocate storage task progress failed:', error)
|
||||
scheduleBatchAllocateStorageTaskPolling(4000)
|
||||
}
|
||||
}
|
||||
|
||||
async function pollBatchAllocateExpressTaskProgress() {
|
||||
if (!batchAllocateExpressTaskProgress.taskId) return
|
||||
try {
|
||||
const res = await orderWaveBatchAllocateExpressTaskProgress({ task_id: batchAllocateExpressTaskProgress.taskId }) as WaveBatchAllocateExpressTaskProgressResponse & { code?: number; message?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '查询快递号分配任务进度失败')
|
||||
}
|
||||
|
||||
applyBatchAllocateExpressTaskProgress(res)
|
||||
const normalizedStatus = normalizeAsyncTaskStatus(batchAllocateExpressTaskProgress.status)
|
||||
|
||||
if (isAsyncTaskFailureStatus(normalizedStatus)) {
|
||||
stopBatchAllocateExpressTaskPolling()
|
||||
await loadData()
|
||||
resetBatchAllocateExpressTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
if (isAsyncTaskSuccessStatus(normalizedStatus) || Number(batchAllocateExpressTaskProgress.progressPercent || 0) >= 100) {
|
||||
stopBatchAllocateExpressTaskPolling()
|
||||
await loadData()
|
||||
resetBatchAllocateExpressTaskProgress()
|
||||
return
|
||||
}
|
||||
|
||||
scheduleBatchAllocateExpressTaskPolling()
|
||||
} catch (error) {
|
||||
console.error('poll batch allocate express task progress failed:', error)
|
||||
scheduleBatchAllocateExpressTaskPolling(4000)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBatchAllocateExpress() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选要分配快递号的波次')
|
||||
return
|
||||
}
|
||||
|
||||
const wave_ids = getSelectedWaveIds()
|
||||
if (!wave_ids.length) {
|
||||
ElMessage.warning('当前勾选记录缺少可用的波次 ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交快递号分配任务吗?`,
|
||||
'批次分配快递号',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
batchAllocateExpressLoading.value = true
|
||||
try {
|
||||
const res = await orderWaveBatchAllocateExpress({ wave_ids }) as { code?: number; message?: string; task_id?: string; status?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '提交批次分配快递号任务失败')
|
||||
}
|
||||
|
||||
const taskId = String(res?.task_id || '').trim()
|
||||
if (!taskId) {
|
||||
resetBatchAllocateExpressTaskProgress()
|
||||
ElMessage.success(res?.message || '快递号分配任务已提交')
|
||||
await loadData()
|
||||
return
|
||||
}
|
||||
|
||||
applyBatchAllocateExpressTaskProgress({
|
||||
task_id: taskId,
|
||||
status: 'submitted',
|
||||
total_count: wave_ids.length,
|
||||
success_count: 0,
|
||||
failed_count: 0,
|
||||
progress_percent: 0,
|
||||
message: res?.message || '快递号分配任务已受理'
|
||||
})
|
||||
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
ElMessage.success((res?.message || '快递号分配任务已受理') + `(任务ID:${taskId})`)
|
||||
scheduleBatchAllocateExpressTaskPolling(1000)
|
||||
} catch (error: any) {
|
||||
console.error('submit batch allocate express task failed:', error)
|
||||
ElMessage.error(error?.message || '提交批次分配快递号任务失败')
|
||||
} finally {
|
||||
batchAllocateExpressLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBatchAllocateStorage() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选要分配储位的波次')
|
||||
return
|
||||
}
|
||||
|
||||
const wave_ids = getSelectedWaveIds()
|
||||
if (!wave_ids.length) {
|
||||
ElMessage.warning('当前勾选记录缺少可用的波次 ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交储位分配任务吗?`,
|
||||
'批量分配储位',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
batchAllocateStorageLoading.value = true
|
||||
try {
|
||||
const res = await orderWaveBatchAllocateStorage({ wave_ids }) as { code?: number; message?: string; task_id?: string; status?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '提交批量分配储位任务失败')
|
||||
}
|
||||
|
||||
const taskId = String(res?.task_id || '').trim()
|
||||
if (!taskId) {
|
||||
resetBatchAllocateStorageTaskProgress()
|
||||
ElMessage.success(res?.message || '储位分配任务已提交')
|
||||
await loadData()
|
||||
return
|
||||
}
|
||||
|
||||
applyBatchAllocateStorageTaskProgress({
|
||||
task_id: taskId,
|
||||
status: 'submitted',
|
||||
total_count: wave_ids.length,
|
||||
success_count: 0,
|
||||
failed_count: 0,
|
||||
progress_percent: 0,
|
||||
message: res?.message || '储位分配任务已受理'
|
||||
})
|
||||
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
ElMessage.success((res?.message || '储位分配任务已受理') + `(任务ID:${taskId})`)
|
||||
scheduleBatchAllocateStorageTaskPolling(1000)
|
||||
} catch (error: any) {
|
||||
console.error('submit batch allocate storage task failed:', error)
|
||||
ElMessage.error(error?.message || '提交批量分配储位任务失败')
|
||||
} finally {
|
||||
batchAllocateStorageLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBatchRemoveExceptionOrders() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选要移除异常订单的波次')
|
||||
return
|
||||
}
|
||||
|
||||
const wave_ids = getSelectedWaveIds()
|
||||
if (!wave_ids.length) {
|
||||
ElMessage.warning('当前勾选记录缺少可用的波次 ID')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确定要为选中的 ${wave_ids.length} 个波次提交移除异常订单任务吗?`,
|
||||
'批量移除异常订单',
|
||||
{ type: 'warning', confirmButtonText: '确认提交', cancelButtonText: '取消' }
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
|
||||
batchRemoveExceptionOrdersLoading.value = true
|
||||
try {
|
||||
const res = await orderWaveBatchRemoveExceptionOrders({ wave_ids }) as { code?: number; message?: string; task_id?: string; status?: string }
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '提交批量移除异常订单任务失败')
|
||||
}
|
||||
|
||||
const taskId = String(res?.task_id || '').trim()
|
||||
if (!taskId) {
|
||||
resetBatchRemoveExceptionOrdersTaskProgress()
|
||||
ElMessage.success(res?.message || '移除异常订单任务已提交')
|
||||
await loadData()
|
||||
return
|
||||
}
|
||||
|
||||
applyBatchRemoveExceptionOrdersTaskProgress({
|
||||
task_id: taskId,
|
||||
status: 'submitted',
|
||||
total_count: wave_ids.length,
|
||||
success_count: 0,
|
||||
failed_count: 0,
|
||||
progress_percent: 0,
|
||||
message: res?.message || '移除异常订单任务已受理'
|
||||
})
|
||||
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
ElMessage.success((res?.message || '移除异常订单任务已受理') + `(任务ID:${taskId})`)
|
||||
scheduleBatchRemoveExceptionOrdersTaskPolling(1000)
|
||||
} catch (error: any) {
|
||||
console.error('submit batch remove exception orders task failed:', error)
|
||||
ElMessage.error(error?.message || '提交批量移除异常订单任务失败')
|
||||
} finally {
|
||||
batchRemoveExceptionOrdersLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleBatchCancel() {
|
||||
if (!selectionRows.value.length) {
|
||||
ElMessage.warning('请先勾选要取消的波次')
|
||||
@ -1491,10 +2251,31 @@ async function handleBatchCancel() {
|
||||
if (!res || !okCode(res.code)) {
|
||||
throw new Error(res?.message || '批量取消波次失败')
|
||||
}
|
||||
ElMessage.success(res?.message || '批量取消波次成功')
|
||||
|
||||
const taskId = String(res?.task_id || '').trim()
|
||||
if (!taskId) {
|
||||
resetBatchCancelTaskProgress()
|
||||
ElMessage.success(res?.message || '批量取消波次成功')
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
await loadData()
|
||||
return
|
||||
}
|
||||
|
||||
applyBatchCancelTaskProgress({
|
||||
task_id: taskId,
|
||||
status: 'submitted',
|
||||
total_count: ids.length,
|
||||
success_count: 0,
|
||||
failed_count: 0,
|
||||
progress_percent: 0,
|
||||
message: res?.message || '批量取消波次任务已受理'
|
||||
})
|
||||
|
||||
selectionRows.value = []
|
||||
hasSelection.value = false
|
||||
await loadData()
|
||||
ElMessage.success((res?.message || '批量取消波次任务已受理') + `(任务ID:${taskId})`)
|
||||
scheduleBatchCancelTaskPolling(1000)
|
||||
} catch (error: any) {
|
||||
console.error('batch cancel wave failed:', error)
|
||||
ElMessage.error(error?.message || '批量取消波次失败')
|
||||
|
||||
@ -29,6 +29,15 @@ export const waveUpperTableDefaults = {
|
||||
export const waveAvailableFields = [
|
||||
// { label: '波次ID', value: 'wave_id', type: 'number' },
|
||||
{ label: '波次号', value: 'wave_no', type: 'text' },
|
||||
{
|
||||
label: '波次类型',
|
||||
value: 'wave_type',
|
||||
type: 'select',
|
||||
options: [
|
||||
{ label: '团购', value: 1 },
|
||||
{ label: '散单', value: 2 }
|
||||
]
|
||||
},
|
||||
{
|
||||
label: '波次状态',
|
||||
value: 'wave_status',
|
||||
@ -40,10 +49,10 @@ export const waveAvailableFields = [
|
||||
},
|
||||
{ label: '创建人', value: 'creator', type: 'text' },
|
||||
{ label: '快递', value: 'logistics_name', type: 'text' },
|
||||
// { label: '商品类型', value: 'item_part_type', type: 'text' },
|
||||
// { label: '商品部位', value: 'item_part', type: 'text' },
|
||||
{ label: '商品类型', value: 'item_part_type', type: 'text' },
|
||||
{ label: '商品部位', value: 'item_part', type: 'text' },
|
||||
{ label: '商品快照键', value: 'item_snapshot_key', type: 'text' },
|
||||
// { label: '商品结构', value: 'item_detail_machine', type: 'text' },
|
||||
{ label: '商品结构', value: 'item_detail_machine', type: 'text' },
|
||||
{
|
||||
label: '区分快递',
|
||||
value: 'distinguish_express',
|
||||
@ -54,9 +63,9 @@ export const waveAvailableFields = [
|
||||
]
|
||||
},
|
||||
{label:'库位分配', value: 'storage_assignment_status', type: 'select', options: [
|
||||
{ label: '未分配', value: 'none' },
|
||||
{ label: '分配中', value: 'padding' },
|
||||
{ label: '已完成', value: 'fin' }
|
||||
{ label: '未分配', value: '未分配' },
|
||||
{ label: '部分分配', value: '部分分配' },
|
||||
{ label: '已分配', value: '已分配' }
|
||||
]},
|
||||
{label:'快递分配', value: 'express_assignment_status', type: 'select', options: [
|
||||
{ label: '未分配', value: 'none' },
|
||||
@ -103,14 +112,16 @@ export const waveBatchColumns = [
|
||||
export const waveWhereAllowedFieldList = [
|
||||
'wave_id',
|
||||
'wave_no',
|
||||
'wave_type',
|
||||
'wave_status',
|
||||
'creator',
|
||||
'logistics_name',
|
||||
// 'item_part_type',
|
||||
// 'item_part',
|
||||
'item_part_type',
|
||||
'item_part',
|
||||
'item_snapshot_key',
|
||||
// 'item_detail_machine',
|
||||
'item_detail_machine',
|
||||
'distinguish_express',
|
||||
'storage_assignment_status',
|
||||
'total_orders_min',
|
||||
'total_orders_max',
|
||||
'processed_orders_min',
|
||||
@ -170,6 +181,35 @@ export const waveToolbarButtons: WaveToolbarButtonConfig[] = [
|
||||
loadingKey: 'batchCancelLoading',
|
||||
action: 'handleBatchCancel'
|
||||
},
|
||||
{
|
||||
key: 'batchAllocateExpress',
|
||||
label: '快速分配快递号',
|
||||
type: 'success',
|
||||
size: 'small',
|
||||
disabledKey: 'noSelection',
|
||||
loadingKey: 'batchAllocateExpressLoading',
|
||||
action: 'handleBatchAllocateExpress'
|
||||
},
|
||||
{
|
||||
key: 'batchAllocateStorage',
|
||||
label: '批量分配储位',
|
||||
type: 'primary',
|
||||
plain: true,
|
||||
size: 'small',
|
||||
disabledKey: 'noSelection',
|
||||
loadingKey: 'batchAllocateStorageLoading',
|
||||
action: 'handleBatchAllocateStorage'
|
||||
},
|
||||
{
|
||||
key: 'batchRemoveExceptionOrders',
|
||||
label: '批量移除异常订单',
|
||||
type: 'danger',
|
||||
plain: true,
|
||||
size: 'small',
|
||||
disabledKey: 'noSelection',
|
||||
loadingKey: 'batchRemoveExceptionOrdersLoading',
|
||||
action: 'handleBatchRemoveExceptionOrders'
|
||||
},
|
||||
{
|
||||
key: 'fetchGroupOrder',
|
||||
label: '抓取团购单',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user