diff --git a/backend/check_raninex.py b/backend/check_raninex.py new file mode 100644 index 0000000..e1442af --- /dev/null +++ b/backend/check_raninex.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +import requests + +# 지오영 확인 +geo = requests.get('http://localhost:7001/api/geoyoung/orders/summary-by-kd?start_date=2026-03-07&end_date=2026-03-07', timeout=120).json() +print("=== 지오영 ===") +for kd, info in geo.get('by_kd_code', {}).items(): + if '라니넥스' in info['product_name'] or '나잘' in info['product_name']: + print(f" KD: {kd}") + print(f" product_name: {info['product_name']}") + print(f" spec: {info['spec']}") + print(f" boxes: {info['boxes']}") + print(f" units: {info['units']}") + print() + +# 수인 확인 +sooin = requests.get('http://localhost:7001/api/sooin/orders/summary-by-kd?start_date=2026-03-07&end_date=2026-03-07', timeout=120).json() +print("=== 수인약품 ===") +found = False +for kd, info in sooin.get('by_kd_code', {}).items(): + if '라니넥스' in info['product_name'] or '나잘' in info['product_name']: + print(f" KD: {kd}") + print(f" product_name: {info['product_name']}") + print(f" spec: {info['spec']}") + print(f" boxes: {info['boxes']}") + print(f" units: {info['units']}") + found = True + print() + +if not found: + print(" (없음)") diff --git a/backend/check_search_spec.py b/backend/check_search_spec.py new file mode 100644 index 0000000..d6c980c --- /dev/null +++ b/backend/check_search_spec.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +import requests + +# 스틸녹스 검색해서 spec 필드 확인 +res = requests.get('http://localhost:7001/api/geoyoung/stock?keyword=스틸녹스', timeout=30) +data = res.json() + +print("=== 지오영 제품 검색 결과 ===") +for item in data.get('items', [])[:3]: + print(f" product_name: {item.get('product_name')}") + print(f" specification: {item.get('specification')}") + print(f" stock: {item.get('stock')}") + print() + +# 수인도 확인 +res2 = requests.get('http://localhost:7001/api/sooin/stock?keyword=스틸녹스', timeout=30) +data2 = res2.json() + +print("=== 수인 제품 검색 결과 ===") +for item in data2.get('items', [])[:3]: + print(f" name: {item.get('name')}") + print(f" spec: {item.get('spec')}") + print(f" stock: {item.get('stock')}") + print() diff --git a/backend/geoyoung_api.py b/backend/geoyoung_api.py index a9df943..5466239 100644 --- a/backend/geoyoung_api.py +++ b/backend/geoyoung_api.py @@ -600,15 +600,19 @@ def api_geoyoung_orders_by_kd(): """ 규격에서 수량 추출 (30T → 30, 100C → 100) - 우선순위: - 1. spec에서 T/C/P/D 단위 숫자 (예: 14T → 14) - 2. product_name에서 T/C/P/D 단위 숫자 - 3. spec의 첫 번째 숫자 (fallback) + 단위 처리: + - T/C/P: 정/캡슐/포 → 숫자 그대로 (30T → 30) + - D: 도즈/분사 → 1로 처리 (140D → 1, 박스 단위) + - mg/ml/g: 용량 → 1로 처리 """ combined = f"{spec} {product_name}" - # T/C/P/D 단위가 붙은 숫자 우선 추출 (예: 14T, 100C, 30P, 140D) - qty_match = re.search(r'(\d+)\s*[TCPD]\b', combined, re.IGNORECASE) + # D(도즈) 단위는 박스 단위로 계산 (140D → 1) + if re.search(r'\d+\s*D\b', combined, re.IGNORECASE): + return 1 + + # T/C/P 단위가 붙은 숫자 추출 (예: 14T, 100C, 30P) + qty_match = re.search(r'(\d+)\s*[TCP]\b', combined, re.IGNORECASE) if qty_match: return int(qty_match.group(1))