import request from '@/utils/request' const v = '1.0' export type { OrderWorkbenchListResponse, OrderListPagination } from '@/api/order.index/orderindex' export type OrderWhere = Record export type OrderSort = { sortField?: string sortOrder?: 'asc' | 'desc' | 'ASC' | 'DESC' field?: string order?: 'asc' | 'desc' | 'ASC' | 'DESC' } export type OrderPagination = { page?: number pageSize?: number } export type OutboundOrderListParams = { pagination?: OrderPagination /** * 统一 where 条件对象;禁止传入 warehouse_id / warehouseId(后端按登录仓库上下文注入)。 * create_channel 订单来源渠道筛选(按订单表 create_channel 列过滤;枚举:MANUAL=手工单、API=接口、QM=奇门、STOCKOUT=出库转单): * {"create_channel":"MANUAL"} 单值精确;{"create_channel":["QM","API"]} 裸数组按 in 多选; * {"create_channel":{"operator":"in","value":["QM","API"]}} 标准结构多选;{"create_channel":{"operator":"ne","value":"MANUAL"}} 排除指定渠道。 * 注意:列表响应中的 create_channel 已格式化为中文标签,查询条件须传英文枚举值。 * 默认排除 B2B 订单(is_b2b='Y',NULL 存量行视为非 B2B)——服务端固定条件,前端无法通过 where 覆盖; * 需要查询 B2B 订单请使用 order.pendingOrder2b.list / order.deliveryOrder2b.list。 */ where?: OrderWhere sort?: OrderSort } export type OutboundOrderDetailParams = { ids?: Array | string | number id?: number | string order_id?: number | string orderId?: number | string tableType?: string tablePosition?: string type?: string moduleName?: string } export type ManualOutboundParams = { warehouseId?: number warehouse_id?: number warehouseIds?: number[] queryTimeoutMs?: number executionTimeoutMs?: number } export function orderOutboundOrderList(data: OutboundOrderListParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.outboundOrder.list', v, timestamp: Date.now() }, data, isSystemApi: true } as any) } export function orderOutboundOrderManualOutboundOrder(data: ManualOutboundParams = {}): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.outboundOrder.manualOutboundOrder', v, timestamp: Date.now() }, data, isSystemApi: true } as any) } export function orderOutboundOrderDetail(data: OutboundOrderDetailParams): Promise { return request({ url: '/system', method: 'post', params: { method: 'order.outboundOrder.detail', v, timestamp: Date.now() }, data, isSystemApi: true } as any) } export const orderOutboundOrder = { list: orderOutboundOrderList, detail: orderOutboundOrderDetail, manualOutboundOrder: orderOutboundOrderManualOutboundOrder }