Files
sam-react-prod/src/types/process.ts
kent fde8726e14 feat(WEB): 수주관리 Phase 2 타입 정의 확장 및 공정관리 개별 품목 표시 수정
- Order, OrderItem 인터페이스에 상세 페이지용 필드 추가
- OrderFormData, OrderItemFormData에 수정 페이지용 필드 추가
- 변환 함수에서 새 필드 매핑 처리
- 공정관리 개별 품목을 ID 대신 품목명으로 표시
2026-01-08 20:57:49 +09:00

122 lines
3.2 KiB
TypeScript

/**
* 공정관리 타입 정의
*/
// 공정 구분
export type ProcessType = '생산' | '검사' | '포장' | '조립';
// 공정 상태
export type ProcessStatus = '사용중' | '미사용';
// 자동 분류 규칙 등록 방식
export type RuleRegistrationType = 'pattern' | 'individual';
// 규칙 유형
export type RuleType = '품목코드' | '품목명' | '품목구분';
// 매칭 방식
export type MatchingType = 'startsWith' | 'endsWith' | 'contains' | 'equals';
// 개별 품목 정보
export interface IndividualItem {
id: string;
code: string;
name: string;
}
// 자동 분류 규칙
export interface ClassificationRule {
id: string;
registrationType: RuleRegistrationType; // 패턴 규칙 or 개별 품목
ruleType: RuleType;
matchingType: MatchingType;
conditionValue: string;
priority: number;
description?: string;
isActive: boolean;
createdAt: string;
items?: IndividualItem[]; // 개별 품목인 경우 품목 정보
}
// 자동 분류 규칙 입력용 (id, createdAt 제외)
export interface ClassificationRuleInput {
registrationType: RuleRegistrationType;
ruleType: RuleType;
matchingType: MatchingType;
conditionValue: string;
priority: number;
description?: string;
isActive: boolean;
}
// 공정 기본 정보
export interface Process {
id: string;
processCode: string; // P-001, P-002 등
processName: string;
description?: string; // 공정 설명 (테이블에 표시)
processType: ProcessType; // 생산, 검사 등
department: string; // 담당부서
workLogTemplate?: string; // 작업일지 양식
// 자동 분류 규칙
classificationRules: ClassificationRule[];
// 작업 정보
requiredWorkers: number; // 필요인원
equipmentInfo?: string; // 설비정보
workSteps: string[]; // 세부 작업단계 (포밍, 검사, 포장 등)
// 설명
note?: string;
// 상태
status: ProcessStatus;
// 메타 정보
createdAt: string;
updatedAt: string;
}
// 공정 등록/수정 폼 데이터
export interface ProcessFormData {
processName: string;
processType: ProcessType;
department: string;
workLogTemplate?: string;
classificationRules: ClassificationRuleInput[];
requiredWorkers: number;
equipmentInfo?: string;
workSteps: string; // 쉼표로 구분된 문자열
note?: string;
isActive: boolean;
}
// 공정 목록 필터
export interface ProcessFilter {
status: 'all' | '사용중' | '미사용';
search: string;
}
// 매칭 방식 옵션
export const MATCHING_TYPE_OPTIONS: { value: MatchingType; label: string }[] = [
{ value: 'startsWith', label: '~로 시작' },
{ value: 'endsWith', label: '~로 끝남' },
{ value: 'contains', label: '~를 포함' },
{ value: 'equals', label: '정확히 일치' },
];
// 규칙 유형 옵션
export const RULE_TYPE_OPTIONS: { value: RuleType; label: string }[] = [
{ value: '품목코드', label: '품목코드' },
{ value: '품목명', label: '품목명' },
{ value: '품목구분', label: '품목구분' },
];
// 공정 구분 옵션
export const PROCESS_TYPE_OPTIONS: { value: ProcessType; label: string }[] = [
{ value: '생산', label: '생산' },
{ value: '검사', label: '검사' },
{ value: '포장', label: '포장' },
{ value: '조립', label: '조립' },
];