feat: 제품 검색 페이지에 재고 컬럼 추가 (초록/빨강 표시)
This commit is contained in:
34
backend/scripts/debug_gesidin_match.py
Normal file
34
backend/scripts/debug_gesidin_match.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
|
||||
# 테스트 AI 응답
|
||||
ai_response = "개시딘은 피부염 치료에 사용하는 겔 형태의 외용약입니다."
|
||||
|
||||
drug_name = "(판)복합개시딘"
|
||||
|
||||
# 현재 매칭 로직
|
||||
base_name = drug_name.split('(')[0].split('/')[0].strip()
|
||||
print(f'제품명: {drug_name}')
|
||||
print(f'괄호 앞: "{base_name}"')
|
||||
|
||||
# suffix 제거
|
||||
for suffix in ['정', '액', 'L', 'M', 'S', 'XL', 'XS', 'SS', 'mini']:
|
||||
if base_name.endswith(suffix):
|
||||
base_name = base_name[:-len(suffix)]
|
||||
base_name = base_name.strip()
|
||||
print(f'suffix 제거 후: "{base_name}"')
|
||||
|
||||
# 매칭 테스트
|
||||
ai_lower = ai_response.lower()
|
||||
ai_nospace = ai_lower.replace(' ', '')
|
||||
base_lower = base_name.lower()
|
||||
base_nospace = base_lower.replace(' ', '')
|
||||
|
||||
print(f'\n매칭 테스트:')
|
||||
print(f' "{base_lower}" in ai_response? {base_lower in ai_lower}')
|
||||
print(f' "{base_nospace}" in ai_nospace? {base_nospace in ai_nospace}')
|
||||
|
||||
# 문제: (판)이 먼저 잘려서 빈 문자열이 됨!
|
||||
print(f'\n문제: split("(")[0] = "{drug_name.split("(")[0]}"')
|
||||
print('→ "(판)"에서 "("로 시작하니까 빈 문자열!')
|
||||
23
backend/scripts/fix_gesidin_boon.py
Normal file
23
backend/scripts/fix_gesidin_boon.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||
|
||||
from db.dbsetup import get_db_session
|
||||
from sqlalchemy import text
|
||||
|
||||
session = get_db_session('PM_DRUG')
|
||||
|
||||
print('업데이트 전:')
|
||||
r = session.execute(text("SELECT GoodsName, POS_BOON FROM CD_GOODS WHERE DrugCode = 'LB000003140'")).fetchone()
|
||||
print(f' {r.GoodsName}: POS_BOON = {r.POS_BOON}')
|
||||
|
||||
session.execute(text("UPDATE CD_GOODS SET POS_BOON = '010103' WHERE DrugCode = 'LB000003140'"))
|
||||
session.commit()
|
||||
|
||||
print('\n업데이트 후:')
|
||||
r2 = session.execute(text("SELECT GoodsName, POS_BOON FROM CD_GOODS WHERE DrugCode = 'LB000003140'")).fetchone()
|
||||
print(f' {r2.GoodsName}: POS_BOON = {r2.POS_BOON}')
|
||||
print(' ✅ 완료!')
|
||||
|
||||
session.close()
|
||||
36
backend/scripts/list_petfarm.py
Normal file
36
backend/scripts/list_petfarm.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||
|
||||
from db.dbsetup import get_db_session
|
||||
from sqlalchemy import text
|
||||
|
||||
session = get_db_session('PM_DRUG')
|
||||
|
||||
print('=== 펫팜 공급 동물약 ===\n')
|
||||
result = session.execute(text("""
|
||||
SELECT
|
||||
G.DrugCode,
|
||||
G.GoodsName,
|
||||
G.POS_BOON,
|
||||
S.SplName,
|
||||
(
|
||||
SELECT TOP 1 U.CD_CD_BARCODE
|
||||
FROM CD_ITEM_UNIT_MEMBER U
|
||||
WHERE U.DRUGCODE = G.DrugCode
|
||||
AND U.CD_CD_BARCODE LIKE '023%'
|
||||
) AS APC_CODE
|
||||
FROM CD_GOODS G
|
||||
LEFT JOIN CD_SALEGOODS S ON G.DrugCode = S.DrugCode
|
||||
WHERE S.SplName LIKE N'%펫팜%'
|
||||
ORDER BY G.GoodsName
|
||||
"""))
|
||||
|
||||
for row in result:
|
||||
apc_status = f'✅ {row.APC_CODE}' if row.APC_CODE else '❌ 없음'
|
||||
boon_status = '🐾' if row.POS_BOON == '010103' else ' '
|
||||
print(f'{boon_status} {row.GoodsName}')
|
||||
print(f' APC: {apc_status}')
|
||||
|
||||
session.close()
|
||||
16
backend/scripts/test_gestage_api.py
Normal file
16
backend/scripts/test_gestage_api.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys, io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||
|
||||
from app import _get_animal_drugs
|
||||
|
||||
drugs = _get_animal_drugs()
|
||||
gestage = [d for d in drugs if '제스타제' in d['name']]
|
||||
|
||||
print('=== 제스타제 API 결과 ===\n')
|
||||
for d in gestage:
|
||||
print(f"name: {d['name']}")
|
||||
print(f"barcode: {d['barcode']}")
|
||||
print(f"apc: {d['apc']}")
|
||||
print(f"image_url: {d['image_url']}")
|
||||
Reference in New Issue
Block a user