feat: 자재 분류 시스템 개선 및 상세 테이블 추가
- 모든 자재 카테고리별 상세 테이블 생성 (fitting, valve, flange, bolt, gasket, instrument) - PIPE, FITTING, VALVE 분류 결과를 각 상세 테이블에 저장하는 로직 구현 - 프론트엔드 라우팅 정리 및 BOM 현황 페이지 기능 개선 - 자재확인 페이지 에러 처리 개선 TODO: FLANGE, BOLT, GASKET, INSTRUMENT 저장 로직 추가 필요
This commit is contained in:
@@ -86,11 +86,11 @@ FITTING_TYPES = {
|
||||
},
|
||||
|
||||
"OLET": {
|
||||
"dat_file_patterns": ["SOL_", "WOL_", "TOL_", "OLET_"],
|
||||
"description_keywords": ["OLET", "올렛", "O-LET"],
|
||||
"dat_file_patterns": ["SOL_", "WOL_", "TOL_", "OLET_", "SOCK-O-LET", "WELD-O-LET"],
|
||||
"description_keywords": ["OLET", "올렛", "O-LET", "SOCK-O-LET", "WELD-O-LET", "SOCKOLET", "WELDOLET"],
|
||||
"subtypes": {
|
||||
"SOCKOLET": ["SOCK-O-LET", "SOCKOLET", "SOL"],
|
||||
"WELDOLET": ["WELD-O-LET", "WELDOLET", "WOL"],
|
||||
"SOCKOLET": ["SOCK-O-LET", "SOCKOLET", "SOL", "SOCK O-LET"],
|
||||
"WELDOLET": ["WELD-O-LET", "WELDOLET", "WOL", "WELD O-LET"],
|
||||
"THREADOLET": ["THREAD-O-LET", "THREADOLET", "TOL"],
|
||||
"ELBOLET": ["ELB-O-LET", "ELBOLET", "EOL"]
|
||||
},
|
||||
@@ -171,7 +171,7 @@ PRESSURE_RATINGS = {
|
||||
}
|
||||
|
||||
def classify_fitting(dat_file: str, description: str, main_nom: str,
|
||||
red_nom: str = None) -> Dict:
|
||||
red_nom: str = None, length: float = None) -> Dict:
|
||||
"""
|
||||
완전한 FITTING 분류
|
||||
|
||||
@@ -185,7 +185,21 @@ def classify_fitting(dat_file: str, description: str, main_nom: str,
|
||||
완전한 피팅 분류 결과
|
||||
"""
|
||||
|
||||
# 1. 재질 분류 (공통 모듈 사용)
|
||||
desc_upper = description.upper()
|
||||
dat_upper = dat_file.upper()
|
||||
|
||||
# 1. 명칭 우선 확인 (피팅 키워드가 있으면 피팅)
|
||||
fitting_keywords = ['ELBOW', 'TEE', 'REDUCER', 'CAP', 'NIPPLE', 'SWAGE', 'OLET', 'COUPLING', '엘보', '티', '리듀서', '캡', '니플', '스웨지', '올렛', '커플링', 'SOCK-O-LET', 'WELD-O-LET', 'SOCKOLET', 'WELDOLET']
|
||||
is_fitting = any(keyword in desc_upper or keyword in dat_upper for keyword in fitting_keywords)
|
||||
|
||||
if not is_fitting:
|
||||
return {
|
||||
"category": "UNKNOWN",
|
||||
"overall_confidence": 0.0,
|
||||
"reason": "피팅 키워드 없음"
|
||||
}
|
||||
|
||||
# 2. 재질 분류 (공통 모듈 사용)
|
||||
material_result = classify_material(description)
|
||||
|
||||
# 2. 피팅 타입 분류
|
||||
@@ -328,7 +342,7 @@ def classify_fitting_subtype(fitting_type: str, description: str,
|
||||
|
||||
# 2. 사이즈 분석이 필요한 경우 (TEE, REDUCER 등)
|
||||
if type_data.get("size_analysis"):
|
||||
if red_nom and red_nom.strip() and red_nom != main_nom:
|
||||
if red_nom and str(red_nom).strip() and red_nom != main_nom:
|
||||
return {
|
||||
"subtype": "REDUCING",
|
||||
"confidence": 0.85,
|
||||
@@ -343,7 +357,7 @@ def classify_fitting_subtype(fitting_type: str, description: str,
|
||||
|
||||
# 3. 두 사이즈가 필요한 경우 확인
|
||||
if type_data.get("requires_two_sizes"):
|
||||
if red_nom and red_nom.strip():
|
||||
if red_nom and str(red_nom).strip():
|
||||
confidence = 0.8
|
||||
evidence = [f"TWO_SIZES_PROVIDED: {main_nom} x {red_nom}"]
|
||||
else:
|
||||
@@ -511,11 +525,12 @@ def determine_fitting_manufacturing(material_result: Dict, connection_result: Di
|
||||
|
||||
def format_fitting_size(main_nom: str, red_nom: str = None) -> str:
|
||||
"""피팅 사이즈 표기 포맷팅"""
|
||||
|
||||
if red_nom and red_nom.strip() and red_nom != main_nom:
|
||||
return f"{main_nom} x {red_nom}"
|
||||
main_nom_str = str(main_nom) if main_nom is not None else ""
|
||||
red_nom_str = str(red_nom) if red_nom is not None else ""
|
||||
if red_nom_str.strip() and red_nom_str != main_nom_str:
|
||||
return f"{main_nom_str} x {red_nom_str}"
|
||||
else:
|
||||
return main_nom
|
||||
return main_nom_str
|
||||
|
||||
def calculate_fitting_confidence(confidence_scores: Dict) -> float:
|
||||
"""피팅 분류 전체 신뢰도 계산"""
|
||||
|
||||
Reference in New Issue
Block a user