feat(tkeg): tkeg BOM 자재관리 서비스 초기 세팅 (api + web + docker-compose)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
130
tkeg/api/app/services/test_valve_classifier.py
Normal file
130
tkeg/api/app/services/test_valve_classifier.py
Normal file
@@ -0,0 +1,130 @@
|
||||
"""
|
||||
VALVE 분류 테스트
|
||||
"""
|
||||
|
||||
from .valve_classifier import classify_valve, get_valve_purchase_info, is_forged_valve
|
||||
|
||||
def test_valve_classification():
|
||||
"""VALVE 분류 테스트"""
|
||||
|
||||
test_cases = [
|
||||
{
|
||||
"name": "게이트 밸브 (주조)",
|
||||
"dat_file": "GATE_FL_150",
|
||||
"description": "GATE VALVE, FLANGED, 150LB, WCB, OS&Y",
|
||||
"main_nom": "6\""
|
||||
},
|
||||
{
|
||||
"name": "볼 밸브 (주조)",
|
||||
"dat_file": "BALL_FL_300",
|
||||
"description": "BALL VALVE, FULL PORT, FLANGED, 300LB, WCB",
|
||||
"main_nom": "4\""
|
||||
},
|
||||
{
|
||||
"name": "볼 밸브 (단조)",
|
||||
"dat_file": "BALL_SW_1500",
|
||||
"description": "BALL VALVE, FORGED, SW, 1500LB, A105",
|
||||
"main_nom": "1\""
|
||||
},
|
||||
{
|
||||
"name": "글로브 밸브 (단조)",
|
||||
"dat_file": "GLOBE_SW_800",
|
||||
"description": "GLOBE VALVE, FORGED, SW, 800LB, A182 F316",
|
||||
"main_nom": "2\""
|
||||
},
|
||||
{
|
||||
"name": "체크 밸브 (주조)",
|
||||
"dat_file": "CHK_FL_150",
|
||||
"description": "CHECK VALVE, SWING TYPE, FLANGED, 150LB, WCB",
|
||||
"main_nom": "8\""
|
||||
},
|
||||
{
|
||||
"name": "체크 밸브 (단조)",
|
||||
"dat_file": "CHK_SW_3000",
|
||||
"description": "CHECK VALVE, LIFT TYPE, SW, 3000LB, A105",
|
||||
"main_nom": "1\""
|
||||
},
|
||||
{
|
||||
"name": "니들 밸브 (단조)",
|
||||
"dat_file": "NEEDLE_THD_6000",
|
||||
"description": "NEEDLE VALVE, FORGED, THD, 6000LB, SS316",
|
||||
"main_nom": "1/2\""
|
||||
},
|
||||
{
|
||||
"name": "버터플라이 밸브",
|
||||
"dat_file": "BUTTERFLY_WAF_150",
|
||||
"description": "BUTTERFLY VALVE, WAFER TYPE, 150LB, GEAR OPERATED",
|
||||
"main_nom": "12\""
|
||||
},
|
||||
{
|
||||
"name": "릴리프 밸브",
|
||||
"dat_file": "RELIEF_FL_150",
|
||||
"description": "RELIEF VALVE, SET PRESSURE 150 PSI, FLANGED, 150LB",
|
||||
"main_nom": "3\""
|
||||
},
|
||||
{
|
||||
"name": "솔레노이드 밸브",
|
||||
"dat_file": "SOLENOID_THD",
|
||||
"description": "SOLENOID VALVE, 2-WAY, 24VDC, 1/4 NPT",
|
||||
"main_nom": "1/4\""
|
||||
}
|
||||
]
|
||||
|
||||
print("🔧 VALVE 분류 테스트 시작\n")
|
||||
print("=" * 80)
|
||||
|
||||
for i, test in enumerate(test_cases, 1):
|
||||
print(f"\n테스트 {i}: {test['name']}")
|
||||
print("-" * 60)
|
||||
|
||||
result = classify_valve(
|
||||
test["dat_file"],
|
||||
test["description"],
|
||||
test["main_nom"]
|
||||
)
|
||||
|
||||
purchase_info = get_valve_purchase_info(result)
|
||||
|
||||
print(f"📋 입력:")
|
||||
print(f" DAT_FILE: {test['dat_file']}")
|
||||
print(f" DESCRIPTION: {test['description']}")
|
||||
print(f" SIZE: {result['size_info']['size_description']}")
|
||||
|
||||
print(f"\n🔧 분류 결과:")
|
||||
print(f" 재질: {result['material']['standard']} | {result['material']['grade']}")
|
||||
print(f" 밸브타입: {result['valve_type']['type']}")
|
||||
print(f" 특성: {result['valve_type']['characteristics']}")
|
||||
print(f" 연결방식: {result['connection_method']['method']}")
|
||||
print(f" 압력등급: {result['pressure_rating']['rating']}")
|
||||
print(f" 작동방식: {result['actuation']['method']}")
|
||||
print(f" 제작방법: {result['manufacturing']['method']} ({'🔨 단조' if is_forged_valve(result) else '🏭 주조'})")
|
||||
|
||||
if result['special_features']:
|
||||
print(f" 특수기능: {', '.join(result['special_features'])}")
|
||||
|
||||
print(f"\n📊 신뢰도:")
|
||||
print(f" 전체신뢰도: {result['overall_confidence']}")
|
||||
print(f" 재질: {result['material']['confidence']}")
|
||||
print(f" 밸브타입: {result['valve_type']['confidence']}")
|
||||
print(f" 연결방식: {result['connection_method']['confidence']}")
|
||||
print(f" 압력등급: {result['pressure_rating']['confidence']}")
|
||||
|
||||
print(f"\n🛒 구매 정보:")
|
||||
print(f" 공급업체: {purchase_info['supplier_type']}")
|
||||
print(f" 예상납기: {purchase_info['lead_time_estimate']}")
|
||||
print(f" 구매카테고리: {purchase_info['purchase_category']}")
|
||||
if purchase_info['special_requirements']:
|
||||
print(f" 특수요구사항: {', '.join(purchase_info['special_requirements'])}")
|
||||
|
||||
print(f"\n💾 저장될 데이터:")
|
||||
print(f" VALVE_TYPE: {result['valve_type']['type']}")
|
||||
print(f" CONNECTION: {result['connection_method']['method']}")
|
||||
print(f" PRESSURE_RATING: {result['pressure_rating']['rating']}")
|
||||
print(f" MANUFACTURING: {result['manufacturing']['method']}")
|
||||
print(f" ACTUATION: {result['actuation']['method']}")
|
||||
|
||||
if i < len(test_cases):
|
||||
print("\n" + "=" * 80)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_valve_classification()
|
||||
Reference in New Issue
Block a user