- 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>
117 lines
3.4 KiB
TypeScript
117 lines
3.4 KiB
TypeScript
/**
|
|
* popInventoryMove API client
|
|
* 신 POP 재고이동 (frontend/app/(main)/COMPANY_X/pop/inventory/move/)
|
|
*/
|
|
|
|
import { apiClient } from "./client";
|
|
|
|
export interface MoveStockItem {
|
|
id: string; // inventory_stock.id
|
|
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; // text 컬럼 (numeric 변환은 클라이언트가)
|
|
}
|
|
|
|
export interface MoveStockListParams {
|
|
warehouse_code?: string; // 'all' or 창고코드
|
|
keyword?: string;
|
|
}
|
|
|
|
export interface MoveCommitItem {
|
|
stock_id: string;
|
|
qty: number;
|
|
// Phase 2: 박스 매칭 잔여 처리 모드
|
|
// 'none' — 박스 없이 이동 (inventory_stock 만)
|
|
// 'new-box' — 잔여를 새 박스에 담아 이동 (직전 박스 정보 자동 복사)
|
|
spillover_mode?: "none" | "new-box";
|
|
}
|
|
|
|
export interface MoveCommitParams {
|
|
items: MoveCommitItem[];
|
|
to_warehouse_code: string;
|
|
to_location_code?: string;
|
|
}
|
|
|
|
export interface MoveCommitResult {
|
|
stock_id: string;
|
|
status: "ok" | "not_found" | "invalid_qty" | "exceeds_stock" | "same_position" | "no_rack";
|
|
reason?: string;
|
|
}
|
|
|
|
export interface MoveCommitData {
|
|
moveCount: number;
|
|
results: MoveCommitResult[];
|
|
}
|
|
|
|
export interface MoveProcessItem {
|
|
process_code: string;
|
|
process_name: string;
|
|
}
|
|
|
|
export interface MoveProcessStockItem {
|
|
id: string; // work_order_process_result.id
|
|
wop_id: string;
|
|
wo_id: string;
|
|
work_instruction_no: string;
|
|
process_code: string;
|
|
process_name: string;
|
|
seq_no: string;
|
|
item_code: string;
|
|
item_name: string;
|
|
item_number: string;
|
|
spec: string;
|
|
unit: string;
|
|
good_qty: string;
|
|
concession_qty: string;
|
|
remain_qty: string; // 잔여 가능 수량 (good+concession-received)
|
|
source_table: string;
|
|
}
|
|
|
|
export interface MoveProcessStockListParams {
|
|
process_code?: string; // 'all' 또는 미지정 시 전체
|
|
keyword?: string;
|
|
}
|
|
|
|
export interface TempLoadRow {
|
|
id: string;
|
|
row_data: string; // JSON 직렬화된 큐 row (서버는 그대로 저장한 string)
|
|
row_key: string;
|
|
created_date: string;
|
|
}
|
|
|
|
export async function getMoveStockList(params?: MoveStockListParams) {
|
|
const res = await apiClient.get("/pop/inventory/move/stock-list", { params: params || {} });
|
|
return res.data as { success: boolean; data: MoveStockItem[] };
|
|
}
|
|
|
|
export async function getMoveProcessList() {
|
|
const res = await apiClient.get("/pop/inventory/move/process-list");
|
|
return res.data as { success: boolean; data: MoveProcessItem[] };
|
|
}
|
|
|
|
export async function getMoveProcessStockList(params?: MoveProcessStockListParams) {
|
|
const res = await apiClient.get("/pop/inventory/move/process-stock-list", { params: params || {} });
|
|
return res.data as { success: boolean; data: MoveProcessStockItem[] };
|
|
}
|
|
|
|
export async function commitMove(body: MoveCommitParams) {
|
|
const res = await apiClient.post("/pop/inventory/move/commit", body);
|
|
return res.data as { success: boolean; message?: string; data?: MoveCommitData };
|
|
}
|
|
|
|
export async function loadTempMove() {
|
|
const res = await apiClient.get("/pop/inventory/move/temp-load");
|
|
return res.data as { success: boolean; data: TempLoadRow[] };
|
|
}
|
|
|
|
export async function saveTempMove(items: unknown[]) {
|
|
const res = await apiClient.post("/pop/inventory/move/temp-save", { items });
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|