From 007b37e6c6371afc87c9ad28e7d93674fc407913 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Mon, 2 Mar 2026 17:29:16 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=92=88=EB=AA=A9=20=EB=B0=94=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=A1=B0=ED=9A=8C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CD_GOODS.Barcode가 없으면 CD_ITEM_UNIT_MEMBER에서 조회 - 중복 제거 로직 추가 (drug_code 기준) --- backend/app.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/app.py b/backend/app.py index 70e0841..362563f 100644 --- a/backend/app.py +++ b/backend/app.py @@ -5070,7 +5070,7 @@ def api_admin_pos_live_detail(order_no): mssql_conn = mssql_engine.raw_connection() cursor = mssql_conn.cursor() - # 품목 상세 조회 (바코드 포함) + # 품목 상세 조회 (바코드 포함 - CD_GOODS 또는 CD_ITEM_UNIT_MEMBER에서) cursor.execute(""" SELECT S.DrugCode AS drug_code, @@ -5078,7 +5078,9 @@ def api_admin_pos_live_detail(order_no): S.SL_NM_item AS quantity, S.SL_NM_cost_a AS unit_price, S.SL_TOTAL_PRICE AS total_price, - G.Barcode AS barcode + COALESCE(NULLIF(G.Barcode, ''), + (SELECT TOP 1 CD_CD_BARCODE FROM PM_DRUG.dbo.CD_ITEM_UNIT_MEMBER WHERE DrugCode = S.DrugCode) + ) AS barcode FROM SALE_SUB S LEFT JOIN PM_DRUG.dbo.CD_GOODS G ON S.DrugCode = G.DrugCode WHERE S.SL_NO_order = ? @@ -5087,9 +5089,14 @@ def api_admin_pos_live_detail(order_no): rows = cursor.fetchall() items = [] + seen_drugs = set() # 중복 제거용 for row in rows: + drug_code = row[0] + if drug_code in seen_drugs: + continue + seen_drugs.add(drug_code) items.append({ - 'drug_code': row[0], + 'drug_code': drug_code, 'product_name': row[1], 'quantity': int(row[2]) if row[2] else 0, 'unit_price': float(row[3]) if row[3] else 0,