feat(tkeg): tkeg BOM 자재관리 서비스 초기 세팅 (api + web + docker-compose)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
80
tkeg/api/app/services/exclude_classifier.py
Normal file
80
tkeg/api/app/services/exclude_classifier.py
Normal file
@@ -0,0 +1,80 @@
|
||||
"""
|
||||
EXCLUDE 분류 시스템
|
||||
실제 자재가 아닌 계산용/제외 항목들 분류
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
# ========== 제외 대상 타입 ==========
|
||||
EXCLUDE_TYPES = {
|
||||
"CUTTING_LOSS": {
|
||||
"description_keywords": ["CUTTING LOSS", "CUT LOSS", "절단로스", "컷팅로스"],
|
||||
"characteristics": "절단 시 손실 고려용 계산 항목",
|
||||
"reason": "실제 자재 아님 - 절단 로스 계산용"
|
||||
},
|
||||
"SPARE_ALLOWANCE": {
|
||||
"description_keywords": ["SPARE", "ALLOWANCE", "여유분", "스페어"],
|
||||
"characteristics": "예비품/여유분 계산 항목",
|
||||
"reason": "실제 자재 아님 - 여유분 계산용"
|
||||
},
|
||||
"THICKNESS_NOTE": {
|
||||
"description_keywords": ["THK", "THICK", "두께", "THICKNESS"],
|
||||
"characteristics": "두께 표기용 항목",
|
||||
"reason": "실제 자재 아님 - 두께 정보"
|
||||
},
|
||||
"CALCULATION_ITEM": {
|
||||
"description_keywords": ["CALC", "CALCULATION", "계산", "산정"],
|
||||
"characteristics": "기타 계산용 항목",
|
||||
"reason": "실제 자재 아님 - 계산 목적"
|
||||
}
|
||||
}
|
||||
|
||||
def classify_exclude(dat_file: str, description: str, main_nom: str = "") -> Dict:
|
||||
"""
|
||||
제외 대상 분류
|
||||
|
||||
Args:
|
||||
dat_file: DAT_FILE 필드
|
||||
description: DESCRIPTION 필드
|
||||
main_nom: MAIN_NOM 필드
|
||||
|
||||
Returns:
|
||||
제외 분류 결과
|
||||
"""
|
||||
|
||||
desc_upper = description.upper()
|
||||
|
||||
# 제외 대상 키워드 확인
|
||||
for exclude_type, type_data in EXCLUDE_TYPES.items():
|
||||
for keyword in type_data["description_keywords"]:
|
||||
if keyword in desc_upper:
|
||||
return {
|
||||
"category": "EXCLUDE",
|
||||
"exclude_type": exclude_type,
|
||||
"characteristics": type_data["characteristics"],
|
||||
"reason": type_data["reason"],
|
||||
"overall_confidence": 0.95,
|
||||
"evidence": [f"EXCLUDE_KEYWORD: {keyword}"],
|
||||
"recommendation": "BOM에서 제외 권장"
|
||||
}
|
||||
|
||||
# 제외 대상 아님
|
||||
return {
|
||||
"category": "UNKNOWN",
|
||||
"overall_confidence": 0.0,
|
||||
"reason": "제외 대상 키워드 없음"
|
||||
}
|
||||
|
||||
def is_exclude_item(description: str) -> bool:
|
||||
"""간단한 제외 대상 체크"""
|
||||
desc_upper = description.upper()
|
||||
|
||||
exclude_keywords = [
|
||||
"WELD GAP", "WELDING GAP", "GAP",
|
||||
"CUTTING LOSS", "CUT LOSS",
|
||||
"SPARE", "ALLOWANCE",
|
||||
"THK", "THICK"
|
||||
]
|
||||
|
||||
return any(keyword in desc_upper for keyword in exclude_keywords)
|
||||
Reference in New Issue
Block a user