feat: 제품 검색 페이지에 재고 컬럼 추가 (초록/빨강 표시)
This commit is contained in:
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()
|
||||
Reference in New Issue
Block a user