- Updated the getItems function in receivingController to include a division filter, allowing for more refined item retrieval based on division. - Added state management for continuous input in EquipmentInfoPage, enabling users to clear forms after saving or keep them open for further entries. - Implemented deletion functionality for selected customer mappings in SalesItemPage, improving data management capabilities. - Enhanced ShippingOrderPage to visually indicate selected orders, improving user interaction and experience. These changes collectively improve the efficiency and usability of the receiving and sales management features.
188 lines
4.8 KiB
TypeScript
188 lines
4.8 KiB
TypeScript
import { apiClient } from "./client";
|
|
|
|
// --- 타입 정의 ---
|
|
|
|
export interface InboundItem {
|
|
id: string;
|
|
company_code: string;
|
|
inbound_number: string;
|
|
inbound_type: string;
|
|
inbound_date: string;
|
|
reference_number: string | null;
|
|
supplier_code: string | null;
|
|
supplier_name: string | null;
|
|
item_number: string | null;
|
|
item_name: string | null;
|
|
spec: string | null;
|
|
material: string | null;
|
|
unit: string | null;
|
|
inbound_qty: number;
|
|
unit_price: number;
|
|
total_amount: number;
|
|
lot_number: string | null;
|
|
warehouse_code: string | null;
|
|
warehouse_name?: string | null;
|
|
location_code: string | null;
|
|
inbound_status: string;
|
|
inspection_status: string | null;
|
|
inspector: string | null;
|
|
manager: string | null;
|
|
memo: string | null;
|
|
source_table: string | null;
|
|
source_id: string | null;
|
|
created_date: string;
|
|
created_by: string | null;
|
|
}
|
|
|
|
export interface PurchaseOrderSource {
|
|
id: string;
|
|
purchase_no: string;
|
|
order_date: string;
|
|
supplier_code: string;
|
|
supplier_name: string;
|
|
item_code: string;
|
|
item_name: string;
|
|
spec: string | null;
|
|
material: string | null;
|
|
order_qty: number;
|
|
received_qty: number;
|
|
remain_qty: number;
|
|
unit_price: number;
|
|
status: string;
|
|
due_date: string | null;
|
|
source_table: string;
|
|
}
|
|
|
|
export interface ShipmentSource {
|
|
detail_id: number;
|
|
instruction_id: number;
|
|
instruction_no: string;
|
|
instruction_date: string;
|
|
partner_id: string;
|
|
instruction_status: string;
|
|
item_code: string;
|
|
item_name: string;
|
|
spec: string | null;
|
|
material: string | null;
|
|
ship_qty: number;
|
|
order_qty: number;
|
|
source_type: string | null;
|
|
}
|
|
|
|
export interface ItemSource {
|
|
id: string;
|
|
item_number: string;
|
|
item_name: string;
|
|
spec: string | null;
|
|
material: string | null;
|
|
unit: string | null;
|
|
standard_price: number;
|
|
}
|
|
|
|
export interface WarehouseOption {
|
|
warehouse_code: string;
|
|
warehouse_name: string;
|
|
warehouse_type: string;
|
|
}
|
|
|
|
export interface CreateReceivingPayload {
|
|
inbound_number: string;
|
|
inbound_date: string;
|
|
warehouse_code?: string;
|
|
location_code?: string;
|
|
inspector?: string;
|
|
manager?: string;
|
|
memo?: string;
|
|
items: Array<{
|
|
inbound_type: string;
|
|
reference_number?: string;
|
|
supplier_code?: string;
|
|
supplier_name?: string;
|
|
item_number?: string;
|
|
item_name?: string;
|
|
spec?: string;
|
|
material?: string;
|
|
unit?: string;
|
|
inbound_qty: number;
|
|
unit_price?: number;
|
|
total_amount?: number;
|
|
lot_number?: string;
|
|
warehouse_code?: string;
|
|
location_code?: string;
|
|
inbound_status?: string;
|
|
inspection_status?: string;
|
|
inspector?: string;
|
|
manager?: string;
|
|
memo?: string;
|
|
source_table: string;
|
|
source_id: string;
|
|
}>;
|
|
}
|
|
|
|
// --- API 호출 ---
|
|
|
|
export async function getReceivingList(params?: {
|
|
inbound_type?: string;
|
|
inbound_status?: string;
|
|
search_keyword?: string;
|
|
date_from?: string;
|
|
date_to?: string;
|
|
}) {
|
|
const res = await apiClient.get("/receiving/list", { params });
|
|
return res.data as { success: boolean; data: InboundItem[] };
|
|
}
|
|
|
|
export async function createReceiving(payload: CreateReceivingPayload) {
|
|
const res = await apiClient.post("/receiving", payload);
|
|
return res.data as { success: boolean; data: InboundItem[]; message?: string };
|
|
}
|
|
|
|
export async function updateReceiving(id: string, payload: Partial<InboundItem>) {
|
|
const res = await apiClient.put(`/receiving/${id}`, payload);
|
|
return res.data as { success: boolean; data: InboundItem };
|
|
}
|
|
|
|
export async function deleteReceiving(id: string) {
|
|
const res = await apiClient.delete(`/receiving/${id}`);
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|
|
|
|
export async function generateReceivingNumber() {
|
|
const res = await apiClient.get("/receiving/generate-number");
|
|
return res.data as { success: boolean; data: string };
|
|
}
|
|
|
|
export async function getReceivingWarehouses() {
|
|
const res = await apiClient.get("/receiving/warehouses");
|
|
return res.data as { success: boolean; data: WarehouseOption[] };
|
|
}
|
|
|
|
// 소스 데이터 조회 (페이징)
|
|
interface SourceParams {
|
|
keyword?: string;
|
|
page?: number;
|
|
pageSize?: number;
|
|
division?: string;
|
|
}
|
|
|
|
export async function getPurchaseOrderSources(params?: SourceParams) {
|
|
const res = await apiClient.get("/receiving/source/purchase-orders", {
|
|
params: params || {},
|
|
});
|
|
return res.data as { success: boolean; data: PurchaseOrderSource[]; totalCount: number };
|
|
}
|
|
|
|
export async function getShipmentSources(params?: SourceParams) {
|
|
const res = await apiClient.get("/receiving/source/shipments", {
|
|
params: params || {},
|
|
});
|
|
return res.data as { success: boolean; data: ShipmentSource[]; totalCount: number };
|
|
}
|
|
|
|
export async function getItemSources(params?: SourceParams) {
|
|
const res = await apiClient.get("/receiving/source/items", {
|
|
params: params || {},
|
|
});
|
|
return res.data as { success: boolean; data: ItemSource[]; totalCount: number };
|
|
}
|