- Update logistics/inbound-outbound pages across 9 companies - Update production/result and production/work-instruction admin pages - Add inventoryTransfer API client and enhance packaging/popInventoryAdjust/popInventoryMove clients - Add transaction-packaging-loading-plan docs - Add AdjustHistoryModal for COMPANY_9 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
102 lines
2.7 KiB
TypeScript
102 lines
2.7 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;
|
|
// 'confirm' = 이상없음 (수량 변화 없음), 'adjust' = 일반 조정. 미지정 시 'adjust'
|
|
type?: "confirm" | "adjust";
|
|
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;
|
|
}
|
|
|
|
// ===== 이력 조회 =====
|
|
|
|
export interface AdjustHistoryItem {
|
|
id: string;
|
|
item_code: string;
|
|
item_name: string;
|
|
item_number: string;
|
|
spec: string;
|
|
unit: string;
|
|
warehouse_code: string;
|
|
warehouse_name: string;
|
|
location_code: string;
|
|
quantity: string; // 부호 있는 변동량 (예: "-20", "12")
|
|
balance_qty: string; // 조정 후 잔량
|
|
reason: string; // 사유 valueCode
|
|
remark: string; // 메모
|
|
manager_name: string;
|
|
transaction_date: string;
|
|
}
|
|
|
|
export async function getAdjustHistory(params: {
|
|
date: string; // YYYY-MM-DD
|
|
reason?: string;
|
|
keyword?: string;
|
|
}): Promise<{ success: boolean; data: AdjustHistoryItem[] }> {
|
|
const res = await apiClient.get("/pop/inventory/adjust/history", { params });
|
|
return res.data;
|
|
}
|