import request from '@/utils/request' const v = '1.0' export type WaveBatchListParams = { pagination?: { page?: number pageSize?: number } where?: Record } export type WaveGroupOrderFetchListParams = { pagination?: { page?: number pageSize?: number } distinguish_express?: boolean store_id?: number same_order_quantity?: number shop_name?: string include_sku?: string return_order_ids?: boolean } export type WaveFetchParams = { structure_list: Array<{ item_detail_machine: string quantity?: number }> } export type WaveFetchResponse = { task_id: string warehouse_id: number structure_count: number default_quantity: number auto_fetch_disabled_marker: string message?: string } export type WaveFetchTaskProgressParams = { task_id?: string taskId?: string } export type WaveFetchTaskProgressResponse = { task_id: string status: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' warehouse_id?: number structure_count?: number finished_structure_count?: number progress_percent?: number total_fetched_quantity?: number duration_ms?: number error?: string update_time?: string message?: string } export type WaveBatchAllocateExpressParams = { wave_ids: Array | 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 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 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 } 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 } export type WaveBatchFinishAutoGroupingParams = { ids: Array | string | number } export type WaveBatchRemoveOrdersParams = { ids: Array | string | number } export function orderWaveBatchList(data: WaveBatchListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.batchList', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveGroupOrderFetchList(data: WaveGroupOrderFetchListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.groupOrderFetchList', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveSingleOrderFetchList(data: WaveGroupOrderFetchListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.singleOrderFetchList', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveFetch(data: WaveFetchParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.fetch', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveFetchTaskProgress(data: WaveFetchTaskProgressParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.fetchTaskProgress', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveBatchAllocateExpress(data: WaveBatchAllocateExpressParams): Promise { 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 { 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 { 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 { 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 { 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 { 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 { return request({ url: '/system', method: 'post', params: { method: 'order.wave.batchCancel', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveBatchCancelTaskProgress(data: WaveBatchCancelTaskProgressParams): Promise { 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 { return request({ url: '/system', method: 'post', params: { method: 'order.wave.batchAutoGrouping', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveBatchFinishAutoGrouping(data: WaveBatchFinishAutoGroupingParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.batchFinishAutoGrouping', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveBatchRemoveOrders(data: WaveBatchRemoveOrdersParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.batchRemoveOrders', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export const orderWave = { batchList: orderWaveBatchList, groupOrderFetchList: orderWaveGroupOrderFetchList, 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 }