- 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>
284 lines
8.2 KiB
TypeScript
284 lines
8.2 KiB
TypeScript
import { apiClient } from "./client";
|
|
|
|
// --- 타입 정의 ---
|
|
|
|
export interface PkgUnit {
|
|
id: string;
|
|
company_code: string;
|
|
pkg_code: string;
|
|
pkg_name: string;
|
|
pkg_type: string;
|
|
status: string;
|
|
width_mm: number | null;
|
|
length_mm: number | null;
|
|
height_mm: number | null;
|
|
self_weight_kg: number | null;
|
|
max_load_kg: number | null;
|
|
volume_l: number | null;
|
|
remarks: string | null;
|
|
created_date: string;
|
|
writer: string | null;
|
|
item_number?: string | null;
|
|
}
|
|
|
|
export interface PkgUnitItem {
|
|
id: string;
|
|
company_code: string;
|
|
pkg_code: string;
|
|
item_number: string;
|
|
pkg_qty: number;
|
|
// JOIN된 필드
|
|
item_name?: string;
|
|
spec?: string;
|
|
unit?: string;
|
|
inventory_unit?: string | null;
|
|
material?: string | null;
|
|
}
|
|
|
|
export interface LoadingUnit {
|
|
id: string;
|
|
company_code: string;
|
|
loading_code: string;
|
|
loading_name: string;
|
|
loading_type: string;
|
|
status: string;
|
|
width_mm: number | null;
|
|
length_mm: number | null;
|
|
height_mm: number | null;
|
|
self_weight_kg: number | null;
|
|
max_load_kg: number | null;
|
|
max_stack: number | null;
|
|
remarks: string | null;
|
|
created_date: string;
|
|
writer: string | null;
|
|
item_number?: string | null;
|
|
}
|
|
|
|
export interface LoadingUnitPkg {
|
|
id: string;
|
|
company_code: string;
|
|
loading_code: string;
|
|
pkg_code: string;
|
|
max_load_qty: number;
|
|
load_method: string | null;
|
|
// JOIN된 필드
|
|
pkg_name?: string;
|
|
pkg_type?: string;
|
|
}
|
|
|
|
export interface ItemInfoForPkg {
|
|
id: string;
|
|
item_number: string;
|
|
item_name: string;
|
|
size: string | null;
|
|
spec?: string | null;
|
|
material: string | null;
|
|
unit: string | null;
|
|
inventory_unit?: string | null;
|
|
division: string | null;
|
|
}
|
|
|
|
// --- 포장단위 API ---
|
|
|
|
export async function getPkgUnits() {
|
|
const res = await apiClient.get("/packaging/pkg-units");
|
|
return res.data as { success: boolean; data: PkgUnit[] };
|
|
}
|
|
|
|
export async function createPkgUnit(data: Partial<PkgUnit>) {
|
|
const res = await apiClient.post("/packaging/pkg-units", data);
|
|
return res.data as { success: boolean; data: PkgUnit; message?: string };
|
|
}
|
|
|
|
export async function updatePkgUnit(id: string, data: Partial<PkgUnit>) {
|
|
const res = await apiClient.put(`/packaging/pkg-units/${id}`, data);
|
|
return res.data as { success: boolean; data: PkgUnit };
|
|
}
|
|
|
|
export async function deletePkgUnit(id: string) {
|
|
const res = await apiClient.delete(`/packaging/pkg-units/${id}`);
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|
|
|
|
// --- 품목별 포장단위 조회 API ---
|
|
|
|
export interface PkgUnitByItem {
|
|
id: string;
|
|
pkg_code: string;
|
|
pkg_name: string;
|
|
pkg_type: string;
|
|
status: string;
|
|
width_mm: number | null;
|
|
length_mm: number | null;
|
|
height_mm: number | null;
|
|
self_weight_kg: number | null;
|
|
max_load_kg: number | null;
|
|
volume_l: number | null;
|
|
pkg_qty: number;
|
|
}
|
|
|
|
export async function getPkgUnitsByItem(itemNumber: string) {
|
|
const res = await apiClient.get(`/packaging/pkg-units-by-item/${encodeURIComponent(itemNumber)}`);
|
|
return res.data as { success: boolean; data: PkgUnitByItem[] };
|
|
}
|
|
|
|
// --- 포장단위 매칭품목 API ---
|
|
|
|
export async function getPkgUnitItems(pkgCode: string) {
|
|
const res = await apiClient.get(`/packaging/pkg-unit-items/${encodeURIComponent(pkgCode)}`);
|
|
return res.data as { success: boolean; data: PkgUnitItem[] };
|
|
}
|
|
|
|
export async function createPkgUnitItem(data: { pkg_code: string; item_number: string; pkg_qty: number }) {
|
|
const res = await apiClient.post("/packaging/pkg-unit-items", data);
|
|
return res.data as { success: boolean; data: PkgUnitItem; message?: string };
|
|
}
|
|
|
|
export async function deletePkgUnitItem(id: string) {
|
|
const res = await apiClient.delete(`/packaging/pkg-unit-items/${id}`);
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|
|
|
|
// --- 포장코드별 적재함 조회 API ---
|
|
|
|
export interface LoadingUnitByPkg {
|
|
id: string;
|
|
loading_code: string;
|
|
loading_name: string;
|
|
loading_type: string;
|
|
status: string;
|
|
width_mm: number | null;
|
|
length_mm: number | null;
|
|
height_mm: number | null;
|
|
self_weight_kg: number | null;
|
|
max_load_kg: number | null;
|
|
max_stack: number | null;
|
|
max_load_qty: number;
|
|
load_method: string | null;
|
|
}
|
|
|
|
export async function getLoadingUnitsByPkg(pkgCode: string) {
|
|
const res = await apiClient.get(`/packaging/loading-units-by-pkg/${encodeURIComponent(pkgCode)}`);
|
|
return res.data as { success: boolean; data: LoadingUnitByPkg[] };
|
|
}
|
|
|
|
// --- 적재함 API ---
|
|
|
|
export async function getLoadingUnits() {
|
|
const res = await apiClient.get("/packaging/loading-units");
|
|
return res.data as { success: boolean; data: LoadingUnit[] };
|
|
}
|
|
|
|
export async function createLoadingUnit(data: Partial<LoadingUnit>) {
|
|
const res = await apiClient.post("/packaging/loading-units", data);
|
|
return res.data as { success: boolean; data: LoadingUnit; message?: string };
|
|
}
|
|
|
|
export async function updateLoadingUnit(id: string, data: Partial<LoadingUnit>) {
|
|
const res = await apiClient.put(`/packaging/loading-units/${id}`, data);
|
|
return res.data as { success: boolean; data: LoadingUnit };
|
|
}
|
|
|
|
export async function deleteLoadingUnit(id: string) {
|
|
const res = await apiClient.delete(`/packaging/loading-units/${id}`);
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|
|
|
|
// --- 적재함 포장구성 API ---
|
|
|
|
export async function getLoadingUnitPkgs(loadingCode: string) {
|
|
const res = await apiClient.get(`/packaging/loading-unit-pkgs/${encodeURIComponent(loadingCode)}`);
|
|
return res.data as { success: boolean; data: LoadingUnitPkg[] };
|
|
}
|
|
|
|
export async function createLoadingUnitPkg(data: { loading_code: string; pkg_code: string; max_load_qty: number; load_method?: string }) {
|
|
const res = await apiClient.post("/packaging/loading-unit-pkgs", data);
|
|
return res.data as { success: boolean; data: LoadingUnitPkg; message?: string };
|
|
}
|
|
|
|
export async function deleteLoadingUnitPkg(id: string) {
|
|
const res = await apiClient.delete(`/packaging/loading-unit-pkgs/${id}`);
|
|
return res.data as { success: boolean; message?: string };
|
|
}
|
|
|
|
// --- 품목정보 연동 API ---
|
|
|
|
export async function getItemsByDivision(divisionLabel: string, keyword?: string) {
|
|
const res = await apiClient.get(`/packaging/items/${encodeURIComponent(divisionLabel)}`, {
|
|
params: keyword ? { keyword } : {},
|
|
});
|
|
return res.data as { success: boolean; data: ItemInfoForPkg[] };
|
|
}
|
|
|
|
export async function getGeneralItems(keyword?: string) {
|
|
const res = await apiClient.get("/packaging/items/general", {
|
|
params: keyword ? { keyword } : {},
|
|
});
|
|
return res.data as { success: boolean; data: ItemInfoForPkg[] };
|
|
}
|
|
|
|
// --- 거래 단위 포장재·적재함 추적 (transaction_loading / transaction_packaging) ---
|
|
|
|
export interface TransactionLoading {
|
|
id: string;
|
|
company_code: string;
|
|
source_type: string;
|
|
source_doc_id: string;
|
|
loading_code: string;
|
|
loading_seq: number | null;
|
|
loading_name: string | null;
|
|
memo: string | null;
|
|
status: string | null;
|
|
writer: string | null;
|
|
created_by: string | null;
|
|
created_date: string;
|
|
updated_date: string;
|
|
}
|
|
|
|
export interface TransactionPackaging {
|
|
id: string;
|
|
company_code: string;
|
|
source_type: string;
|
|
source_id: string;
|
|
package_label: string;
|
|
pkg_code: string;
|
|
quantity: number;
|
|
loading_id: string | null;
|
|
seq_no: number | null;
|
|
status: string;
|
|
lot_no: string | null;
|
|
expire_date: string | null;
|
|
warehouse_code: string | null;
|
|
location_code: string | null;
|
|
writer: string | null;
|
|
created_by: string | null;
|
|
created_date: string;
|
|
updated_date: string;
|
|
// JOIN 필드
|
|
tl_loading_code?: string | null;
|
|
tl_loading_seq?: number | null;
|
|
tl_loading_name?: string | null;
|
|
pkg_name?: string | null;
|
|
}
|
|
|
|
export async function getTransactionLoadings(params: {
|
|
source_type?: string;
|
|
source_doc_id?: string;
|
|
}) {
|
|
const res = await apiClient.get("/packaging/transaction-loadings", { params });
|
|
return res.data as { success: boolean; data: TransactionLoading[] };
|
|
}
|
|
|
|
export async function getTransactionPackagings(params: {
|
|
source_type?: string;
|
|
source_id?: string;
|
|
inbound_number?: string;
|
|
loading_id?: string;
|
|
status?: string;
|
|
pkg_code?: string;
|
|
keyword?: string;
|
|
}) {
|
|
const res = await apiClient.get("/packaging/transaction-packagings", { params });
|
|
return res.data as { success: boolean; data: TransactionPackaging[] };
|
|
}
|