feat: 동물약 APC 일괄 매핑 (7개 완료)
This commit is contained in:
43
backend/scripts/debug_prompt.py
Normal file
43
backend/scripts/debug_prompt.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
import io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
||||
sys.path.insert(0, 'c:\\Users\\청춘약국\\source\\pharmacy-pos-qr-system\\backend')
|
||||
|
||||
from db.dbsetup import get_db_session
|
||||
from sqlalchemy import text
|
||||
|
||||
# _get_animal_drugs 로직 복제
|
||||
drug_session = get_db_session('PM_DRUG')
|
||||
query = text("""
|
||||
SELECT
|
||||
G.DrugCode,
|
||||
G.GoodsName,
|
||||
G.Saleprice,
|
||||
(
|
||||
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%'
|
||||
ORDER BY U.CHANGE_DATE DESC
|
||||
) AS APC_CODE
|
||||
FROM CD_GOODS G
|
||||
WHERE G.POS_BOON = '010103'
|
||||
AND G.GoodsSelCode = 'B'
|
||||
ORDER BY G.GoodsName
|
||||
""")
|
||||
rows = drug_session.execute(query).fetchall()
|
||||
|
||||
print('=== AI에 전달되는 보유 제품 목록 ===\n')
|
||||
for r in rows:
|
||||
apc = r.APC_CODE
|
||||
rag_info = ""
|
||||
if apc:
|
||||
rag_info = f" [대상: 개, 고양이]" # RAG 정보 시뮬레이션
|
||||
|
||||
print(f"- {r.GoodsName} ({r.Saleprice:,.0f}원){rag_info}")
|
||||
|
||||
print('\n=== 안텔민 관련 제품만 ===')
|
||||
for r in rows:
|
||||
if '안텔민' in r.GoodsName:
|
||||
print(f" {r.GoodsName} - APC: {r.APC_CODE}")
|
||||
Reference in New Issue
Block a user