From 0f69b50c49f809ea0ee2ae9eddea4fd405561847 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Sat, 7 Mar 2026 17:49:03 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20D(=EB=8F=84=EC=A6=88)=20=EB=8B=A8?= =?UTF-8?q?=EC=9C=84=EB=8A=94=20boxes=3Dunits=EB=A1=9C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(=EB=82=98=EC=9E=98=EC=8A=A4=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=20=EB=93=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/check_raninex.py | 31 +++++++++++++++++++++++++++++++ backend/check_search_spec.py | 24 ++++++++++++++++++++++++ backend/geoyoung_api.py | 16 ++++++++++------ 3 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 backend/check_raninex.py create mode 100644 backend/check_search_spec.py 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))