71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
/**
|
|
* popInventoryAdjust - 신 POP 재고조정 API 클라이언트 (v2)
|
|
*
|
|
* 백엔드: backend-node/src/controllers/popInventoryAdjustController.ts
|
|
* 사용처: frontend/app/(main)/COMPANY_X/pop/inventory/adjust/page.tsx
|
|
*/
|
|
|
|
import { apiClient } from "./client";
|
|
|
|
// ===== 타입 =====
|
|
|
|
export interface AdjustStock {
|
|
id: string;
|
|
item_code: string;
|
|
item_name: string;
|
|
item_number: string;
|
|
spec: string;
|
|
unit: string;
|
|
warehouse_code: string;
|
|
warehouse_name: string;
|
|
location_code: string;
|
|
current_qty: string;
|
|
}
|
|
|
|
export interface CommitItem {
|
|
stock_id: string;
|
|
actual_qty: number;
|
|
reason: string;
|
|
memo?: string;
|
|
new_warehouse?: string;
|
|
new_location?: string;
|
|
}
|
|
|
|
export interface CommitResponse {
|
|
success: boolean;
|
|
message?: string;
|
|
data?: { adjustCount: number; results: Array<{ stock_id: string; status: string }> };
|
|
}
|
|
|
|
export interface TempCartRow {
|
|
id: string;
|
|
row_data: string;
|
|
row_key: string;
|
|
created_date: string;
|
|
}
|
|
|
|
// ===== 함수 =====
|
|
|
|
export async function getAdjustStockList(params: {
|
|
warehouse_code?: string;
|
|
keyword?: string;
|
|
}): Promise<{ success: boolean; data: AdjustStock[] }> {
|
|
const res = await apiClient.get("/pop/inventory/adjust/stock-list", { params });
|
|
return res.data;
|
|
}
|
|
|
|
export async function commitAdjust(items: CommitItem[]): Promise<CommitResponse> {
|
|
const res = await apiClient.post("/pop/inventory/adjust/commit", { items });
|
|
return res.data;
|
|
}
|
|
|
|
export async function loadTempAdjust(): Promise<{ success: boolean; data: TempCartRow[] }> {
|
|
const res = await apiClient.get("/pop/inventory/adjust/temp-load");
|
|
return res.data;
|
|
}
|
|
|
|
export async function saveTempAdjust(items: any[]): Promise<{ success: boolean; message?: string }> {
|
|
const res = await apiClient.post("/pop/inventory/adjust/temp-save", { items });
|
|
return res.data;
|
|
}
|