77 lines
1.8 KiB
Python
77 lines
1.8 KiB
Python
# -*- 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
|
|
|
|
session = get_db_session('PM_DRUG')
|
|
|
|
print('=' * 60)
|
|
print('=== 1. CD_GOODS 테이블 확인 (안텔민뽀삐) ===')
|
|
print('=' * 60)
|
|
|
|
result = session.execute(text("""
|
|
SELECT DrugCode, GoodsName, BARCODE, BaseCode
|
|
FROM CD_GOODS
|
|
WHERE DrugCode = 'LB000003158'
|
|
"""))
|
|
|
|
for row in result:
|
|
print(f'DrugCode: {row.DrugCode}')
|
|
print(f'GoodsName: {row.GoodsName}')
|
|
print(f'BARCODE: {row.BARCODE or "(없음)"}')
|
|
print(f'BaseCode: {row.BaseCode or "(없음)"}')
|
|
|
|
print()
|
|
print('=' * 60)
|
|
print('=== 2. CD_BARCODE 테이블 확인 (DrugCode로 검색) ===')
|
|
print('=' * 60)
|
|
|
|
result2 = session.execute(text("""
|
|
SELECT *
|
|
FROM CD_BARCODE
|
|
WHERE DRUGCODE = 'LB000003158'
|
|
"""))
|
|
|
|
columns = result2.keys()
|
|
rows = list(result2)
|
|
|
|
if rows:
|
|
for row in rows:
|
|
print(f'\n--- 바코드 레코드 ---')
|
|
for col in columns:
|
|
val = getattr(row, col)
|
|
if val:
|
|
print(f' {col}: {val}')
|
|
else:
|
|
print('(CD_BARCODE에 레코드 없음)')
|
|
|
|
print()
|
|
print('=' * 60)
|
|
print('=== 3. CD_BARCODE에서 APC로 직접 검색 ===')
|
|
print('=' * 60)
|
|
|
|
result3 = session.execute(text("""
|
|
SELECT *
|
|
FROM CD_BARCODE
|
|
WHERE BARCODE = '0230237010107'
|
|
OR BASECODE = '0230237010107'
|
|
OR TITLECODE = '0230237010107'
|
|
"""))
|
|
|
|
rows3 = list(result3)
|
|
if rows3:
|
|
for row in rows3:
|
|
print(f'\n--- APC로 찾은 레코드 ---')
|
|
for col in columns:
|
|
val = getattr(row, col)
|
|
if val:
|
|
print(f' {col}: {val}')
|
|
else:
|
|
print('(APC로 검색된 레코드 없음)')
|
|
|
|
session.close()
|