feat: 자재 분류 시스템 개선 및 상세 테이블 추가

- 모든 자재 카테고리별 상세 테이블 생성 (fitting, valve, flange, bolt, gasket, instrument)
- PIPE, FITTING, VALVE 분류 결과를 각 상세 테이블에 저장하는 로직 구현
- 프론트엔드 라우팅 정리 및 BOM 현황 페이지 기능 개선
- 자재확인 페이지 에러 처리 개선

TODO: FLANGE, BOLT, GASKET, INSTRUMENT 저장 로직 추가 필요
This commit is contained in:
Hyungi Ahn
2025-07-17 10:44:19 +09:00
parent ea111433e4
commit 5f7a6f0b3a
30 changed files with 3963 additions and 923 deletions

View File

@@ -10,8 +10,8 @@ from .material_classifier import classify_material, get_manufacturing_method_fro
# ========== SPECIAL FLANGE 타입 ==========
SPECIAL_FLANGE_TYPES = {
"ORIFICE": {
"dat_file_patterns": ["FLG_ORI_", "ORI_"],
"description_keywords": ["ORIFICE", "오리피스", "유량측정"],
"dat_file_patterns": ["FLG_ORI_", "ORI_", "ORIFICE_"],
"description_keywords": ["ORIFICE", "오리피스", "유량측정", "구멍"],
"characteristics": "유량 측정용 구멍",
"special_features": ["BORE_SIZE", "FLOW_MEASUREMENT"]
},
@@ -164,7 +164,7 @@ FLANGE_PRESSURE_RATINGS = {
}
def classify_flange(dat_file: str, description: str, main_nom: str,
red_nom: str = None) -> Dict:
red_nom: str = None, length: float = None) -> Dict:
"""
완전한 FLANGE 분류
@@ -178,7 +178,21 @@ def classify_flange(dat_file: str, description: str, main_nom: str,
완전한 플랜지 분류 결과
"""
# 1. 재질 분류 (공통 모듈 사용)
desc_upper = description.upper()
dat_upper = dat_file.upper()
# 1. 명칭 우선 확인 (플랜지 키워드가 있으면 플랜지)
flange_keywords = ['FLG', 'FLANGE', '플랜지']
is_flange = any(keyword in desc_upper or keyword in dat_upper for keyword in flange_keywords)
if not is_flange:
return {
"category": "UNKNOWN",
"overall_confidence": 0.0,
"reason": "플랜지 키워드 없음"
}
# 2. 재질 분류 (공통 모듈 사용)
material_result = classify_material(description)
# 2. SPECIAL vs STANDARD 분류
@@ -490,11 +504,12 @@ def determine_flange_manufacturing(material_result: Dict, flange_type_result: Di
def format_flange_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_flange_confidence(confidence_scores: Dict) -> float:
"""플랜지 분류 전체 신뢰도 계산"""