fix(pmr): 라벨 인쇄 개선

- 가로/세로 모드 분기 추가 (orientation 파라미터)
- 기본값 portrait (세로 모드, QR 라벨과 동일 방향)
- 환자 이름 selector 수정 (#detailName)
This commit is contained in:
thug0bin 2026-03-12 14:19:59 +09:00
parent 17a29f05b8
commit 58408c9f5c
2 changed files with 16 additions and 6 deletions

View File

@ -640,6 +640,9 @@ def print_label():
- printer: 프린터 선택 (선택, 기본값 '168')
- '121': QL-710W (192.168.0.121)
- '168': QL-810W (192.168.0.168)
- orientation: 출력 방향 (선택, 기본값 'portrait')
- 'portrait': 세로 모드 (QR 라벨과 동일, 회전 없음)
- 'landscape': 가로 모드 (90 회전)
"""
try:
from brother_ql.raster import BrotherQLRaster
@ -657,6 +660,7 @@ def print_label():
unit = data.get('unit', '')
sung_code = data.get('sung_code', '')
printer = data.get('printer', '168') # 기본값: QL-810W
orientation = data.get('orientation', 'portrait') # 기본값: 세로 모드
# 프린터 설정
if printer == '121':
@ -688,14 +692,19 @@ def print_label():
conversion_factor=conversion_factor
)
# 2. 이미지 90도 회전 (Brother QL이 세로 방향 기준이므로)
label_rotated = label_image.rotate(90, expand=True)
# 2. 방향 설정 (portrait: 회전 없음, landscape: 90도 회전)
if orientation == 'landscape':
# 가로 모드: 90도 회전 (기존 방식)
label_final = label_image.rotate(90, expand=True)
else:
# 세로 모드: 회전 없음 (QR 라벨과 동일)
label_final = label_image
# 3. Brother QL 프린터로 전송
qlr = BrotherQLRaster(printer_model)
instructions = convert(
qlr=qlr,
images=[label_rotated],
images=[label_final],
label='29',
rotate='0',
threshold=70.0,
@ -708,11 +717,12 @@ def print_label():
)
send(instructions, printer_identifier=f"tcp://{printer_ip}:9100")
logging.info(f"[SUCCESS] PMR 라벨 인쇄 성공: {med_name}{printer_model}")
logging.info(f"[SUCCESS] PMR 라벨 인쇄 성공: {med_name}{printer_model} ({orientation})")
return jsonify({
'success': True,
'message': f'{med_name} 라벨 인쇄 완료 ({printer_model})',
'printer': printer_model
'printer': printer_model,
'orientation': orientation
})
except ImportError as e:

View File

@ -2993,7 +2993,7 @@
return;
}
const patientName = document.querySelector('.patient-info h2')?.textContent?.trim() || '';
const patientName = document.getElementById('detailName')?.textContent?.trim() || '';
let printedCount = 0;
let failedCount = 0;