kdrug-inventory-system/test_improved_import.py
시골약사 ae0d093044 test: 입고 프로세스 테스트 및 유틸리티 추가
추가된 파일:
1. reset_purchase_data.py
   - 입고 및 관련 데이터 초기화 스크립트
   - 조제, 재고, 입고장 데이터 완전 초기화
   - 잘못된 herb_items 정리 기능

2. test_improved_import.py
   - Excel 보험코드 9자리 패딩 테스트
   - 한의사랑/한의정보 형식 처리 확인

3. test_upload_api.py
   - API를 통한 Excel 업로드 테스트
   - 도매상 생성 및 입고 처리 검증
   - 재고 현황 확인

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-16 14:39:44 +00:00

54 lines
1.7 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
개선된 Excel 입고 처리 테스트
"""
import sys
sys.path.append('/root/kdrug')
from excel_processor import ExcelProcessor
import pandas as pd
def test_excel_processing():
"""Excel 처리 테스트"""
processor = ExcelProcessor()
# 한의정보 샘플 파일 테스트
print("=== 한의정보 샘플 파일 처리 테스트 ===\n")
if processor.read_excel('sample/한의정보.xlsx'):
print(f"✓ 파일 읽기 성공")
print(f"✓ 형식 감지: {processor.format_type}")
# 처리
df = processor.process()
print(f"✓ 데이터 처리 완료: {len(df)}")
# 보험코드 확인
if 'insurance_code' in df.columns:
print("\n보험코드 샘플 (처리 후):")
for idx, code in enumerate(df['insurance_code'].head(5)):
herb_name = df.iloc[idx]['herb_name']
print(f" {herb_name}: {code} (길이: {len(str(code))})")
print("\n=== 한의사랑 샘플 파일 처리 테스트 ===\n")
processor2 = ExcelProcessor()
if processor2.read_excel('sample/한의사랑.xlsx'):
print(f"✓ 파일 읽기 성공")
print(f"✓ 형식 감지: {processor2.format_type}")
# 처리
df2 = processor2.process()
print(f"✓ 데이터 처리 완료: {len(df2)}")
# 보험코드 확인
if 'insurance_code' in df2.columns:
print("\n보험코드 샘플 (처리 후):")
for idx, code in enumerate(df2['insurance_code'].head(5)):
herb_name = df2.iloc[idx]['herb_name']
print(f" {herb_name}: {code} (길이: {len(str(code))})")
if __name__ == "__main__":
test_excel_processing()