## 처방 관리 (조제) 기능 - compounds API 추가 (목록/상세/환자별 조회) - 조제 시 자동 재고 차감 (FIFO) - 조제 내역 UI (EMR 스타일) - 조제 상세보기 모달 (처방구성, 재고소비내역) - 오늘/이번달 조제 통계 표시 ## 재고 원장 시스템 - stock-ledger API 구현 - 입출고 내역 실시간 추적 - 재고 현황 페이지 개선 (통계 카드 추가) - 입출고 원장 모달 UI - 약재별/전체 입출고 내역 조회 ## 확인된 동작 - 박주호 환자 오미자 200g 조제 - 재고 2000g → 1800g 정확히 차감 - 모든 입출고 stock_ledger에 기록 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
2.7 KiB
Python
78 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
Playwright로 프론트엔드 확인
|
|
"""
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
import time
|
|
import json
|
|
|
|
def test_purchase_receipts():
|
|
with sync_playwright() as p:
|
|
# 브라우저 시작
|
|
browser = p.chromium.launch(headless=True)
|
|
page = browser.new_page()
|
|
|
|
# 페이지 이동
|
|
print("1. 페이지 로드 중...")
|
|
page.goto("http://localhost:5001")
|
|
page.wait_for_load_state("networkidle")
|
|
|
|
# 입고 관리 탭 클릭
|
|
print("2. 입고 관리 탭으로 이동...")
|
|
try:
|
|
page.click('a[href="#purchase"]', timeout=5000)
|
|
except:
|
|
# 다른 방법으로 시도
|
|
page.evaluate("document.querySelector('a[href=\"#purchase\"]').click()")
|
|
time.sleep(1)
|
|
|
|
# API 호출 직접 확인
|
|
print("3. API 직접 호출 확인...")
|
|
api_response = page.evaluate("""
|
|
async () => {
|
|
const response = await fetch('/api/purchase-receipts');
|
|
const data = await response.json();
|
|
return data;
|
|
}
|
|
""")
|
|
|
|
print("\n=== API 응답 데이터 ===")
|
|
print(json.dumps(api_response, indent=2, ensure_ascii=False))
|
|
|
|
# 테이블 내용 확인
|
|
print("\n4. 테이블 렌더링 확인...")
|
|
table_rows = page.query_selector_all('#purchaseReceiptsList tr')
|
|
|
|
if len(table_rows) == 0:
|
|
print(" 테이블에 행이 없습니다.")
|
|
# "입고장이 없습니다." 메시지 확인
|
|
empty_message = page.query_selector('#purchaseReceiptsList td')
|
|
if empty_message:
|
|
print(f" 메시지: {empty_message.text_content()}")
|
|
else:
|
|
print(f" 테이블 행 수: {len(table_rows)}")
|
|
|
|
# 첫 번째 행 상세 확인
|
|
if len(table_rows) > 0:
|
|
first_row = table_rows[0]
|
|
cells = first_row.query_selector_all('td')
|
|
|
|
print("\n 첫 번째 행 내용:")
|
|
headers = ['입고일', '공급업체', '품목 수', '총 금액', '총 수량', '파일명', '작업']
|
|
for i, cell in enumerate(cells[:-1]): # 마지막 '작업' 열 제외
|
|
print(f" {headers[i]}: {cell.text_content()}")
|
|
|
|
# JavaScript 콘솔 에러 확인
|
|
page.on("console", lambda msg: print(f"콘솔: {msg.text}") if msg.type == "error" else None)
|
|
|
|
# 스크린샷 저장
|
|
print("\n5. 스크린샷 저장...")
|
|
page.screenshot(path="/root/kdrug/purchase_screenshot.png")
|
|
print(" /root/kdrug/purchase_screenshot.png 저장 완료")
|
|
|
|
browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
test_purchase_receipts() |