fix: APC에 바코드 대체 표시 버그 수정
- apc_code는 02%로 시작하는 것만 표시 - 바코드를 APC로 대체하는 로직 제거 - PostgreSQL 조회용 _pg_apc 별도 유지
This commit is contained in:
parent
6bb86f8780
commit
1c2bfd473b
@ -3450,13 +3450,14 @@ def api_products():
|
||||
apc_row = apc_result.fetchone()
|
||||
if apc_row:
|
||||
apc = apc_row[0]
|
||||
elif row.barcode:
|
||||
apc = row.barcode # 바코드=APC 케이스
|
||||
except:
|
||||
pass
|
||||
|
||||
# APC 코드: 쿼리에서 조회한 것 또는 기존 로직에서 찾은 것
|
||||
apc_code = getattr(row, 'apc_code', None) or apc
|
||||
# APC 코드: 쿼리에서 02%로 조회한 것만 사용 (바코드 대체 X)
|
||||
apc_code = getattr(row, 'apc_code', None) or ''
|
||||
|
||||
# PostgreSQL 조회용 APC (분류/도매재고): apc 또는 apc_code 사용
|
||||
pg_apc = apc or apc_code
|
||||
|
||||
items.append({
|
||||
'drug_code': row.drug_code or '',
|
||||
@ -3469,14 +3470,15 @@ def api_products():
|
||||
'is_animal_drug': is_animal,
|
||||
'stock': int(row.stock) if row.stock else 0,
|
||||
'location': row.location or '', # 위치
|
||||
'apc': apc_code, # APC 코드 (02로 시작)
|
||||
'apc': apc_code, # UI용 APC 코드 (02로 시작하는 것만)
|
||||
'_pg_apc': pg_apc, # PostgreSQL 조회용 (내부용)
|
||||
'category': None, # PostgreSQL에서 lazy fetch
|
||||
'wholesaler_stock': None,
|
||||
'thumbnail': None # 아래에서 채움
|
||||
})
|
||||
|
||||
# 동물약 분류 Lazy Fetch (PostgreSQL) - 실패해도 무시
|
||||
animal_items = [i for i in items if i['is_animal_drug'] and i['apc']]
|
||||
animal_items = [i for i in items if i['is_animal_drug'] and i.get('_pg_apc')]
|
||||
if animal_items:
|
||||
try:
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
Loading…
Reference in New Issue
Block a user