import { apiClient } from "./client"; // --- 타입 정의 --- export type InOutSource = "inbound" | "outbound" | "history"; export type InOutDirection = "inbound" | "outbound" | "transfer"; export type InOutDocTable = | "inbound_mng" | "outbound_mng" | "inventory_history"; export interface InOutRow { source: InOutSource; doc_table: InOutDocTable; doc_id: string; detail_id: string | null; doc_number: string | null; type: string; direction: InOutDirection; item_code: string | null; item_name: string | null; qty: number; unit: string; warehouse_code: string | null; warehouse_name: string | null; location_code: string | null; status: string | null; created_date: string; company_code: string; remark: string | null; } export interface InOutKpi { inbound: number; outbound: number; transfer: number; total: number; } export interface InOutHistoryData { rows: InOutRow[]; kpi: InOutKpi; totalPages: number; currentPage: number; } export interface InOutHistoryParams { date_from?: string; date_to?: string; keyword?: string; direction?: InOutDirection | "all"; warehouse_code?: string; page?: number; page_size?: number; } // --- API 호출 --- export async function getInOutHistory(params?: InOutHistoryParams) { const res = await apiClient.get("/pop/inventory/inout-history", { params }); return res.data as { success: boolean; data: InOutHistoryData }; }