60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
|
|
import { apiCall } from "./client";
|
||
|
|
|
||
|
|
// 야드 레이아웃 관리 API
|
||
|
|
export const yardLayoutApi = {
|
||
|
|
// 모든 야드 레이아웃 목록 조회
|
||
|
|
async getAllLayouts() {
|
||
|
|
return apiCall("GET", "/yard-layouts");
|
||
|
|
},
|
||
|
|
|
||
|
|
// 특정 야드 레이아웃 상세 조회
|
||
|
|
async getLayoutById(id: number) {
|
||
|
|
return apiCall("GET", `/yard-layouts/${id}`);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 새 야드 레이아웃 생성
|
||
|
|
async createLayout(data: { name: string; description?: string }) {
|
||
|
|
return apiCall("POST", "/yard-layouts", data);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 야드 레이아웃 수정
|
||
|
|
async updateLayout(id: number, data: { name?: string; description?: string }) {
|
||
|
|
return apiCall("PUT", `/yard-layouts/${id}`, data);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 야드 레이아웃 삭제
|
||
|
|
async deleteLayout(id: number) {
|
||
|
|
return apiCall("DELETE", `/yard-layouts/${id}`);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 야드 레이아웃 복제
|
||
|
|
async duplicateLayout(id: number, name: string) {
|
||
|
|
return apiCall("POST", `/yard-layouts/${id}/duplicate`, { name });
|
||
|
|
},
|
||
|
|
|
||
|
|
// 특정 야드의 배치 자재 목록 조회
|
||
|
|
async getPlacementsByLayoutId(layoutId: number) {
|
||
|
|
return apiCall("GET", `/yard-layouts/${layoutId}/placements`);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 야드에 자재 배치 추가
|
||
|
|
async addMaterialPlacement(layoutId: number, data: any) {
|
||
|
|
return apiCall("POST", `/yard-layouts/${layoutId}/placements`, data);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 배치 정보 수정
|
||
|
|
async updatePlacement(placementId: number, data: any) {
|
||
|
|
return apiCall("PUT", `/yard-layouts/placements/${placementId}`, data);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 배치 해제
|
||
|
|
async removePlacement(placementId: number) {
|
||
|
|
return apiCall("DELETE", `/yard-layouts/placements/${placementId}`);
|
||
|
|
},
|
||
|
|
|
||
|
|
// 여러 배치 일괄 업데이트
|
||
|
|
async batchUpdatePlacements(layoutId: number, placements: any[]) {
|
||
|
|
return apiCall("PUT", `/yard-layouts/${layoutId}/placements/batch`, { placements });
|
||
|
|
},
|
||
|
|
};
|