120 lines
3.2 KiB
TypeScript
120 lines
3.2 KiB
TypeScript
|
|
import { apiClient } from "./client";
|
||
|
|
|
||
|
|
// ===== 타입 정의 =====
|
||
|
|
//
|
||
|
|
// 모달 표시에 필요한 핵심 필드만 명시. 나머지 컬럼은 응답에 포함되더라도
|
||
|
|
// 모달에서 사용하지 않으므로 타입에는 노출하지 않는다.
|
||
|
|
|
||
|
|
export interface InboundHeader {
|
||
|
|
id: string;
|
||
|
|
inbound_number: string | null;
|
||
|
|
inbound_type: string | null;
|
||
|
|
inbound_date: string | null;
|
||
|
|
inbound_status: string | null;
|
||
|
|
warehouse_code: string | null;
|
||
|
|
warehouse_name: string | null;
|
||
|
|
location_code: string | null;
|
||
|
|
memo: string | null;
|
||
|
|
writer: string | null;
|
||
|
|
writer_name: string | null;
|
||
|
|
created_date: string | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface InboundDetailRow {
|
||
|
|
id: string;
|
||
|
|
inbound_id: string | null;
|
||
|
|
item_number: string | null;
|
||
|
|
item_name: string | null;
|
||
|
|
unit: string | null;
|
||
|
|
inbound_qty: string | number | null;
|
||
|
|
lot_number: string | null;
|
||
|
|
reference_number: string | null;
|
||
|
|
supplier_code: string | null;
|
||
|
|
supplier_name: string | null;
|
||
|
|
memo: string | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface OutboundRow {
|
||
|
|
id: string;
|
||
|
|
outbound_number: string | null;
|
||
|
|
outbound_type: string | null;
|
||
|
|
outbound_date: string | null;
|
||
|
|
outbound_status: string | null;
|
||
|
|
warehouse_code: string | null;
|
||
|
|
warehouse_name: string | null;
|
||
|
|
location_code: string | null;
|
||
|
|
item_code: string | null;
|
||
|
|
item_name: string | null;
|
||
|
|
unit: string | null;
|
||
|
|
outbound_qty: string | number | null;
|
||
|
|
lot_number: string | null;
|
||
|
|
customer_code: string | null;
|
||
|
|
customer_name: string | null;
|
||
|
|
reference_number: string | null;
|
||
|
|
memo: string | null;
|
||
|
|
writer: string | null;
|
||
|
|
writer_name: string | null;
|
||
|
|
created_date: string | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface HistoryRow {
|
||
|
|
id: string;
|
||
|
|
transaction_type: string | null;
|
||
|
|
transaction_date: string | null;
|
||
|
|
warehouse_code: string | null;
|
||
|
|
warehouse_name: string | null;
|
||
|
|
location_code: string | null;
|
||
|
|
item_code: string | null;
|
||
|
|
joined_item_name: string | null;
|
||
|
|
joined_unit: string | null;
|
||
|
|
quantity: string | number | null;
|
||
|
|
balance_qty: string | number | null;
|
||
|
|
remark: string | null;
|
||
|
|
writer: string | null;
|
||
|
|
manager_name: string | null;
|
||
|
|
created_date: string | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
// ===== 응답 타입 =====
|
||
|
|
|
||
|
|
export interface InboundDetailResponse {
|
||
|
|
success: boolean;
|
||
|
|
data: { header: InboundHeader; detail: InboundDetailRow | null };
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface OutboundDetailResponse {
|
||
|
|
success: boolean;
|
||
|
|
data: { row: OutboundRow };
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface HistoryDetailResponse {
|
||
|
|
success: boolean;
|
||
|
|
data: { row: HistoryRow };
|
||
|
|
}
|
||
|
|
|
||
|
|
// ===== API 호출 =====
|
||
|
|
|
||
|
|
export async function getInboundDetail(
|
||
|
|
id: string,
|
||
|
|
detailId?: string | null,
|
||
|
|
): Promise<InboundDetailResponse> {
|
||
|
|
const res = await apiClient.get(`/pop/inventory/inout-detail/inbound/${id}`, {
|
||
|
|
params: detailId ? { detail_id: detailId } : undefined,
|
||
|
|
});
|
||
|
|
return res.data as InboundDetailResponse;
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getOutboundDetail(
|
||
|
|
id: string,
|
||
|
|
): Promise<OutboundDetailResponse> {
|
||
|
|
const res = await apiClient.get(`/pop/inventory/inout-detail/outbound/${id}`);
|
||
|
|
return res.data as OutboundDetailResponse;
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getHistoryDetail(
|
||
|
|
id: string,
|
||
|
|
): Promise<HistoryDetailResponse> {
|
||
|
|
const res = await apiClient.get(`/pop/inventory/inout-detail/history/${id}`);
|
||
|
|
return res.data as HistoryDetailResponse;
|
||
|
|
}
|