156 lines
3.6 KiB
TypeScript
156 lines
3.6 KiB
TypeScript
// Digital Twin 관련 타입 정의
|
|
|
|
// 객체 타입
|
|
export type ObjectType =
|
|
| "area" // Area (A동, B동, C동, 겐트리)
|
|
| "location-bed" // BED (사각형, 파란색, 상자)
|
|
| "location-stp" // STP (원형, 회색, 주차)
|
|
| "location-temp" // 임시베드 (BED와 동일)
|
|
| "location-dest" // 지정착지 (BED와 동일)
|
|
| "crane-mobile" // 모바일 크레인 (참고용)
|
|
| "rack"; // 랙 (참고용)
|
|
|
|
// 3D 위치
|
|
export interface Position3D {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
}
|
|
|
|
// 3D 크기
|
|
export interface Size3D {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
}
|
|
|
|
// 자재 미리보기 정보
|
|
export interface MaterialPreview {
|
|
height: number; // 스택 높이 (LOLAYER 기반)
|
|
topMaterial?: MaterialData; // 최상단 자재 정보 (선택사항)
|
|
}
|
|
|
|
// 자재 데이터 (WSTKKY)
|
|
export interface MaterialData {
|
|
STKKEY: string; // 자재 키
|
|
LOCAKEY: string; // Location 키
|
|
AREAKEY: string; // Area 키
|
|
LOLAYER: number; // 층 (스택 순서)
|
|
STKWIDT?: number; // 폭
|
|
STKLENG?: number; // 길이
|
|
STKHEIG?: number; // 높이
|
|
STKWEIG?: number; // 무게
|
|
STKQTY?: number; // 수량
|
|
STKSTAT?: string; // 상태
|
|
STKREDT?: string; // 등록일
|
|
STKRMKS?: string; // 비고
|
|
}
|
|
|
|
// 배치된 객체
|
|
export interface PlacedObject {
|
|
id: number; // 로컬 ID (음수: 임시, 양수: DB 저장됨)
|
|
type: ObjectType;
|
|
name: string;
|
|
position: Position3D;
|
|
size: Size3D;
|
|
rotation?: number; // 회전 각도 (라디안)
|
|
color: string;
|
|
|
|
// 외부 DB 연동
|
|
areaKey?: string; // MAREMA.AREAKEY
|
|
locaKey?: string; // MLOCMA.LOCAKEY
|
|
locType?: string; // MLOCMA.LOCTYPE (BED, STP, TMP, DES)
|
|
|
|
// 자재 정보
|
|
materialCount?: number; // 자재 개수
|
|
materialPreview?: MaterialPreview; // 자재 미리보기
|
|
|
|
// 계층 구조
|
|
parentId?: number;
|
|
displayOrder?: number;
|
|
|
|
// 편집 제한
|
|
locked?: boolean; // true면 이동/크기조절 불가
|
|
visible?: boolean;
|
|
}
|
|
|
|
// 레이아웃
|
|
export interface DigitalTwinLayout {
|
|
id: number;
|
|
companyCode: string;
|
|
externalDbConnectionId: number;
|
|
warehouseKey: string; // WAREKEY (예: DY99)
|
|
layoutName: string;
|
|
description?: string;
|
|
isActive: boolean;
|
|
createdBy?: number;
|
|
updatedBy?: number;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
|
|
// 통계 (조회 시만)
|
|
objectCount?: number;
|
|
}
|
|
|
|
// 레이아웃 상세 (객체 포함)
|
|
export interface DigitalTwinLayoutDetail {
|
|
layout: DigitalTwinLayout;
|
|
objects: PlacedObject[];
|
|
}
|
|
|
|
// 창고 (MWAREMA)
|
|
export interface Warehouse {
|
|
WAREKEY: string;
|
|
WARENAME: string;
|
|
WARETYPE?: string;
|
|
WARESTAT?: string;
|
|
}
|
|
|
|
// Area (MAREMA)
|
|
export interface Area {
|
|
AREAKEY: string;
|
|
AREANAME: string;
|
|
AREATYP?: string; // 내부/외부
|
|
WAREKEY: string;
|
|
AREASTAT?: string;
|
|
}
|
|
|
|
// Location (MLOCMA)
|
|
export interface Location {
|
|
LOCAKEY: string;
|
|
LOCANAME: string;
|
|
LOCTYPE: string; // BED, STP, TMP, DES
|
|
AREAKEY: string;
|
|
LOCWIDT?: number; // 폭 (현재 데이터는 0)
|
|
LOCLENG?: number; // 길이 (현재 데이터는 0)
|
|
LOCHEIG?: number; // 높이 (현재 데이터는 0)
|
|
LOCCUBI?: number; // 용적 (현재 데이터는 0)
|
|
LOCSTAT?: string;
|
|
}
|
|
|
|
// 자재 개수 (배치 시 사용)
|
|
export interface MaterialCount {
|
|
LOCAKEY: string;
|
|
material_count: number;
|
|
max_layer: number;
|
|
}
|
|
|
|
// API 요청/응답 타입
|
|
export interface CreateLayoutRequest {
|
|
externalDbConnectionId: number;
|
|
warehouseKey: string;
|
|
layoutName: string;
|
|
description?: string;
|
|
objects: PlacedObject[];
|
|
}
|
|
|
|
export interface UpdateLayoutRequest {
|
|
layoutName: string;
|
|
description?: string;
|
|
objects: PlacedObject[];
|
|
}
|
|
|
|
// 도구 타입 (UI용)
|
|
export type ToolType = ObjectType;
|
|
|