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 WaveStrategyListParams = { pagination?: { page?: number pageSize?: number currentPage?: number page_size?: number size?: number } } export type WaveStrategyCreateParams = { strategy_name: string strategy_type: number batch_mode: number status?: number order_min_sku?: number order_max_sku?: number order_min_qty?: number order_max_qty?: number min_same_structure?: number max_same_structure?: number batch_max_orders?: number batch_max_skus?: number group_batch_max_orders?: number require_same_express?: boolean allow_cross_owner?: boolean description?: string allowed_provinces?: Array allowed_platforms?: Array allowed_owners?: Array allowed_expresses?: Array } export type WaveStrategyUpdateParams = { id?: number strategy_id?: number strategyId?: number strategy_name?: string strategy_type?: number batch_mode?: number status?: number order_min_sku?: number order_max_sku?: number order_min_qty?: number order_max_qty?: number min_same_structure?: number max_same_structure?: number batch_max_orders?: number batch_max_skus?: number group_batch_max_orders?: number require_same_express?: boolean allow_cross_owner?: boolean description?: string allowed_provinces?: Array allowed_platforms?: Array allowed_owners?: Array allowed_expresses?: Array } export type WaveStrategyQuickScanParams = { } export type WaveStrategyQuickScanResponse = { status: string task_id: string warehouse_id: number state: string message?: string accepted_at: string } export type WaveStrategyQuickScanTaskProgressParams = { task_id?: string taskId?: string } export type WaveStrategyQuickScanTaskProgressResponse = { task_id: string state: 'submitted' | 'running' | 'success' | 'failed' | 'not_found' | string warehouse_id?: number total_order_count?: number processed_order_count?: number matched_order_count?: number unmatched_order_count?: number progress_percent?: number submitted_at?: string start_time?: string end_time?: string error_message?: string error_code?: string duration_ms?: number } export type WaveStrategyFallbackOrderListParams = { pagination?: { page?: number pageSize?: number currentPage?: number page_size?: number size?: number } where?: Record sort?: { sortField?: string sortOrder?: 'ASC' | 'DESC' | string } } /** 不符合波次策略订单行;含接口新增的 item_snapshot(商品名称*数量|…) */ export type WaveStrategyFallbackOrderListRow = Record & { item_snapshot?: string } export type WaveStrategyFallbackOrderListPagination = { page?: number pageSize?: number total?: number totalPages?: number hasPrevious?: boolean hasNext?: boolean } export type WaveStrategyFallbackOrderListResponse = { list: WaveStrategyFallbackOrderListRow[] pagination: WaveStrategyFallbackOrderListPagination } 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 orderWaveWaveStrategyList(data: WaveStrategyListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyList', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveWaveStrategyCreate(data: WaveStrategyCreateParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyCreate', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveWaveStrategyUpdate(data: WaveStrategyUpdateParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyUpdate', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveWaveStrategyQuickScan( data: WaveStrategyQuickScanParams = {} ): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyQuickScan', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveWaveStrategyQuickScanTaskProgress( data: WaveStrategyQuickScanTaskProgressParams ): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyQuickScanTaskProgress', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export function orderWaveWaveStrategyFallbackOrderList( data: WaveStrategyFallbackOrderListParams = {} ): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.waveStrategyFallbackOrderList', v, timestamp: new Date().getTime() }, data, isSystemApi: true } as any) } export type WaveSingleFetchByIdsParams = { ids?: Array | string | number order_ids?: Array | string | number orderIds?: Array | string | number } export type WaveSingleFetchByIdsResponse = { ids: Array wave_id: number wave_no: string fetched_order_ids: Array fetched_order_count: number excluded_existing_wave_order_ids?: Array skipped_order_ids?: Array not_found_order_ids?: Array } export function orderWaveSingleFetchByIds( data: WaveSingleFetchByIdsParams ): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.singleFetchByIds', 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 orderWaveGroupFetch(data: WaveFetchParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.wave.groupFetch', 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, waveStrategyList: orderWaveWaveStrategyList, waveStrategyCreate: orderWaveWaveStrategyCreate, waveStrategyUpdate: orderWaveWaveStrategyUpdate, waveStrategyQuickScan: orderWaveWaveStrategyQuickScan, waveStrategyQuickScanTaskProgress: orderWaveWaveStrategyQuickScanTaskProgress, waveStrategyFallbackOrderList: orderWaveWaveStrategyFallbackOrderList, singleFetchByIds: orderWaveSingleFetchByIds, groupFetch: orderWaveGroupFetch, 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 }