349 lines
11 KiB
TypeScript
349 lines
11 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; // 작업일지 양식 (레거시 string)
|
|
|
|
// 검사/양식 FK
|
|
documentTemplateId?: number; // 중간검사 양식 ID
|
|
documentTemplateName?: string; // 중간검사 양식명 (표시용)
|
|
workLogTemplateId?: number; // 작업일지 양식 ID
|
|
workLogTemplateName?: string; // 작업일지 양식명 (표시용)
|
|
|
|
// 공정 설정 (options JSON)
|
|
needsInspection: boolean; // 중간검사 여부
|
|
needsWorkLog: boolean; // 작업일지 여부
|
|
|
|
// 자동 분류 규칙
|
|
classificationRules: ClassificationRule[];
|
|
|
|
// 작업 정보
|
|
requiredWorkers: number; // 필요인원
|
|
equipmentInfo?: string; // 설비정보
|
|
workSteps: string[]; // 세부 작업단계 (포밍, 검사, 포장 등)
|
|
|
|
// 설명
|
|
note?: string;
|
|
|
|
// 담당자
|
|
manager?: string;
|
|
|
|
// 생산일자 사용여부
|
|
useProductionDate?: boolean;
|
|
|
|
// 구분 (공정명에 따라 옵션 변경)
|
|
processCategory?: string;
|
|
|
|
// 단계 목록
|
|
steps?: ProcessStep[];
|
|
|
|
// 상태
|
|
status: ProcessStatus;
|
|
|
|
// 메타 정보
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
// 공정 등록/수정 폼 데이터
|
|
export interface ProcessFormData {
|
|
processName: string;
|
|
processType: ProcessType;
|
|
department: string;
|
|
manager?: string;
|
|
processCategory?: string;
|
|
useProductionDate?: boolean;
|
|
workLogTemplate?: string;
|
|
documentTemplateId?: number;
|
|
workLogTemplateId?: number;
|
|
needsInspection: boolean;
|
|
needsWorkLog: boolean;
|
|
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: '조립' },
|
|
];
|
|
|
|
// 공정명별 구분(카테고리) 옵션 매핑
|
|
export const PROCESS_CATEGORY_OPTIONS: Record<string, { value: string; label: string }[]> = {
|
|
'스크린': [
|
|
{ value: '없음', label: '없음' },
|
|
],
|
|
'슬릿': [
|
|
{ value: '슬릿', label: '슬릿' },
|
|
{ value: '조인트바', label: '조인트바' },
|
|
],
|
|
'절곡': [
|
|
{ value: '철판', label: '철판' },
|
|
{ value: '제곡풍', label: '제곡풍' },
|
|
],
|
|
};
|
|
|
|
// ============================================================================
|
|
// 공정 단계 (Process Step) 타입 정의
|
|
// ============================================================================
|
|
|
|
// 연결 유형
|
|
export type StepConnectionType = '팝업' | '없음';
|
|
|
|
// 완료 유형 (코드)
|
|
export type StepCompletionType = 'selection_complete' | 'click_complete' | 'inspection_complete';
|
|
|
|
// 공정 단계 엔티티
|
|
export interface ProcessStep {
|
|
id: string;
|
|
stepCode: string; // 단계코드 (예: 123123)
|
|
stepName: string; // 단계명 (예: 자재투입, 미싱 등)
|
|
isRequired: boolean; // 필수여부
|
|
needsApproval: boolean; // 승인여부
|
|
needsInspection: boolean; // 검사여부
|
|
isActive: boolean; // 사용여부
|
|
order: number; // 순서 (드래그&드롭)
|
|
// 연결 정보
|
|
connectionType: StepConnectionType;
|
|
connectionTarget?: string; // 도달 (입고완료 자재 목록 등)
|
|
// 완료 정보
|
|
completionType: StepCompletionType;
|
|
// 검사 설정 (검사여부가 true일 때)
|
|
inspectionSetting?: InspectionSetting;
|
|
// 검사 범위 (검사여부가 true일 때)
|
|
inspectionScope?: InspectionScope;
|
|
}
|
|
|
|
// 연결 유형 옵션
|
|
export const STEP_CONNECTION_TYPE_OPTIONS: { value: StepConnectionType; label: string }[] = [
|
|
{ value: '팝업', label: '팝업' },
|
|
{ value: '없음', label: '없음' },
|
|
];
|
|
|
|
// 완료 유형 옵션
|
|
export const STEP_COMPLETION_TYPE_OPTIONS: { value: StepCompletionType; label: string }[] = [
|
|
{ value: 'selection_complete', label: '선택 완료 시 완료' },
|
|
{ value: 'click_complete', label: '클릭 시 완료' },
|
|
{ value: 'inspection_complete', label: '검사완료 시 완료' },
|
|
];
|
|
|
|
// 완료 유형 라벨 맵
|
|
export const STEP_COMPLETION_TYPE_LABELS: Record<StepCompletionType, string> = {
|
|
selection_complete: '선택 완료 시 완료',
|
|
click_complete: '클릭 시 완료',
|
|
inspection_complete: '검사완료 시 완료',
|
|
};
|
|
|
|
// 연결 도달 옵션
|
|
export const STEP_CONNECTION_TARGET_OPTIONS: { value: string; label: string }[] = [
|
|
{ value: '입고완료 자재 목록', label: '입고완료 자재 목록' },
|
|
{ value: '출고 요청 목록', label: '출고 요청 목록' },
|
|
{ value: '검사 대기 목록', label: '검사 대기 목록' },
|
|
{ value: '작업 지시 목록', label: '작업 지시 목록' },
|
|
{ value: '중간검사', label: '중간검사' },
|
|
];
|
|
|
|
// ============================================================================
|
|
// 중간검사 설정 타입 정의
|
|
// ============================================================================
|
|
|
|
// 포인트 타입
|
|
export type InspectionPointType = '포인트 없음' | '포인트 1' | '포인트 2' | '포인트 3' | '포인트 4' | '포인트 5' | '포인트 6' | '포인트 7' | '포인트 8' | '포인트 9' | '포인트 10';
|
|
|
|
// 방법 타입
|
|
export type InspectionMethodType = '숫자' | '양자택일';
|
|
|
|
// 치수 검사 항목
|
|
export interface DimensionInspectionItem {
|
|
enabled: boolean;
|
|
point: InspectionPointType;
|
|
method: InspectionMethodType;
|
|
}
|
|
|
|
// 겉모양 검사 항목
|
|
export interface AppearanceInspectionItem {
|
|
enabled: boolean;
|
|
}
|
|
|
|
// 중간검사 설정 데이터
|
|
export interface InspectionSetting {
|
|
// 기본 정보
|
|
standardName: string; // 기준서명
|
|
schematicImage?: string; // 기준서 도해 이미지 URL
|
|
inspectionStandardImage?: string; // 검사기준 이미지 URL
|
|
|
|
// 겉모양 검사 항목
|
|
appearance: {
|
|
bendingStatus: AppearanceInspectionItem; // 절곡상태
|
|
processingStatus: AppearanceInspectionItem; // 가공상태
|
|
sewingStatus: AppearanceInspectionItem; // 재봉상태
|
|
assemblyStatus: AppearanceInspectionItem; // 조립상태
|
|
};
|
|
|
|
// 치수 검사 항목
|
|
dimension: {
|
|
length: DimensionInspectionItem; // 길이
|
|
width: DimensionInspectionItem; // 너비
|
|
height1: DimensionInspectionItem; // 1 높이
|
|
height2: DimensionInspectionItem; // 2 높이
|
|
gap: DimensionInspectionItem; // 간격
|
|
};
|
|
|
|
// 기타 항목
|
|
judgment: boolean; // 판정
|
|
nonConformingContent: boolean; // 부적합 내용
|
|
}
|
|
|
|
// 포인트 옵션
|
|
export const INSPECTION_POINT_OPTIONS: { value: InspectionPointType; label: string }[] = [
|
|
{ value: '포인트 없음', label: '포인트 없음' },
|
|
{ value: '포인트 1', label: '포인트 1' },
|
|
{ value: '포인트 2', label: '포인트 2' },
|
|
{ value: '포인트 3', label: '포인트 3' },
|
|
{ value: '포인트 4', label: '포인트 4' },
|
|
{ value: '포인트 5', label: '포인트 5' },
|
|
{ value: '포인트 6', label: '포인트 6' },
|
|
{ value: '포인트 7', label: '포인트 7' },
|
|
{ value: '포인트 8', label: '포인트 8' },
|
|
{ value: '포인트 9', label: '포인트 9' },
|
|
{ value: '포인트 10', label: '포인트 10' },
|
|
];
|
|
|
|
// 방법 옵션
|
|
export const INSPECTION_METHOD_OPTIONS: { value: InspectionMethodType; label: string }[] = [
|
|
{ value: '숫자', label: '숫자' },
|
|
{ value: '양자택일', label: '양자택일' },
|
|
];
|
|
|
|
// ============================================================================
|
|
// 검사 범위 (Inspection Scope) 타입 정의
|
|
// ============================================================================
|
|
|
|
// 검사 범위 유형
|
|
export type InspectionScopeType = 'all' | 'sampling' | 'group';
|
|
|
|
// 샘플 기준
|
|
export type InspectionSampleBase = 'order' | 'lot';
|
|
|
|
// 검사 범위 설정
|
|
export interface InspectionScope {
|
|
type: InspectionScopeType; // 전수검사 | 샘플링 | 그룹
|
|
sampleSize?: number; // 샘플 크기 (n값, sampling일 때만)
|
|
sampleBase?: InspectionSampleBase; // 샘플 기준 (order | lot)
|
|
}
|
|
|
|
// 검사 범위 유형 옵션
|
|
export const INSPECTION_SCOPE_TYPE_OPTIONS: { value: InspectionScopeType; label: string; description: string }[] = [
|
|
{ value: 'all', label: '전수검사', description: '모든 개소 검사' },
|
|
{ value: 'sampling', label: '샘플링', description: '마지막 N개 개소만 검사' },
|
|
{ value: 'group', label: '그룹', description: '그룹 마지막 개소만 검사' },
|
|
];
|
|
|
|
// 기본 검사 범위
|
|
export const DEFAULT_INSPECTION_SCOPE: InspectionScope = {
|
|
type: 'all',
|
|
};
|
|
|
|
// 기본 검사 설정값
|
|
export const DEFAULT_INSPECTION_SETTING: InspectionSetting = {
|
|
standardName: '',
|
|
schematicImage: undefined,
|
|
inspectionStandardImage: undefined,
|
|
appearance: {
|
|
bendingStatus: { enabled: false },
|
|
processingStatus: { enabled: false },
|
|
sewingStatus: { enabled: false },
|
|
assemblyStatus: { enabled: false },
|
|
},
|
|
dimension: {
|
|
length: { enabled: false, point: '포인트 없음', method: '숫자' },
|
|
width: { enabled: false, point: '포인트 없음', method: '숫자' },
|
|
height1: { enabled: false, point: '포인트 없음', method: '양자택일' },
|
|
height2: { enabled: false, point: '포인트 없음', method: '양자택일' },
|
|
gap: { enabled: false, point: '포인트 5', method: '숫자' },
|
|
},
|
|
judgment: false,
|
|
nonConformingContent: false,
|
|
}; |