fix(pmr): 라벨 인쇄 개선
- 가로/세로 모드 분기 추가 (orientation 파라미터) - 기본값 portrait (세로 모드, QR 라벨과 동일 방향) - 환자 이름 selector 수정 (#detailName)
This commit is contained in:
parent
17a29f05b8
commit
58408c9f5c
@ -640,6 +640,9 @@ def print_label():
|
|||||||
- printer: 프린터 선택 (선택, 기본값 '168')
|
- printer: 프린터 선택 (선택, 기본값 '168')
|
||||||
- '121': QL-710W (192.168.0.121)
|
- '121': QL-710W (192.168.0.121)
|
||||||
- '168': QL-810W (192.168.0.168)
|
- '168': QL-810W (192.168.0.168)
|
||||||
|
- orientation: 출력 방향 (선택, 기본값 'portrait')
|
||||||
|
- 'portrait': 세로 모드 (QR 라벨과 동일, 회전 없음)
|
||||||
|
- 'landscape': 가로 모드 (90도 회전)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from brother_ql.raster import BrotherQLRaster
|
from brother_ql.raster import BrotherQLRaster
|
||||||
@ -657,6 +660,7 @@ def print_label():
|
|||||||
unit = data.get('unit', '정')
|
unit = data.get('unit', '정')
|
||||||
sung_code = data.get('sung_code', '')
|
sung_code = data.get('sung_code', '')
|
||||||
printer = data.get('printer', '168') # 기본값: QL-810W
|
printer = data.get('printer', '168') # 기본값: QL-810W
|
||||||
|
orientation = data.get('orientation', 'portrait') # 기본값: 세로 모드
|
||||||
|
|
||||||
# 프린터 설정
|
# 프린터 설정
|
||||||
if printer == '121':
|
if printer == '121':
|
||||||
@ -688,14 +692,19 @@ def print_label():
|
|||||||
conversion_factor=conversion_factor
|
conversion_factor=conversion_factor
|
||||||
)
|
)
|
||||||
|
|
||||||
# 2. 이미지 90도 회전 (Brother QL이 세로 방향 기준이므로)
|
# 2. 방향 설정 (portrait: 회전 없음, landscape: 90도 회전)
|
||||||
label_rotated = label_image.rotate(90, expand=True)
|
if orientation == 'landscape':
|
||||||
|
# 가로 모드: 90도 회전 (기존 방식)
|
||||||
|
label_final = label_image.rotate(90, expand=True)
|
||||||
|
else:
|
||||||
|
# 세로 모드: 회전 없음 (QR 라벨과 동일)
|
||||||
|
label_final = label_image
|
||||||
|
|
||||||
# 3. Brother QL 프린터로 전송
|
# 3. Brother QL 프린터로 전송
|
||||||
qlr = BrotherQLRaster(printer_model)
|
qlr = BrotherQLRaster(printer_model)
|
||||||
instructions = convert(
|
instructions = convert(
|
||||||
qlr=qlr,
|
qlr=qlr,
|
||||||
images=[label_rotated],
|
images=[label_final],
|
||||||
label='29',
|
label='29',
|
||||||
rotate='0',
|
rotate='0',
|
||||||
threshold=70.0,
|
threshold=70.0,
|
||||||
@ -708,11 +717,12 @@ def print_label():
|
|||||||
)
|
)
|
||||||
send(instructions, printer_identifier=f"tcp://{printer_ip}:9100")
|
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({
|
return jsonify({
|
||||||
'success': True,
|
'success': True,
|
||||||
'message': f'{med_name} 라벨 인쇄 완료 ({printer_model})',
|
'message': f'{med_name} 라벨 인쇄 완료 ({printer_model})',
|
||||||
'printer': printer_model
|
'printer': printer_model,
|
||||||
|
'orientation': orientation
|
||||||
})
|
})
|
||||||
|
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
|
|||||||
@ -2993,7 +2993,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const patientName = document.querySelector('.patient-info h2')?.textContent?.trim() || '';
|
const patientName = document.getElementById('detailName')?.textContent?.trim() || '';
|
||||||
let printedCount = 0;
|
let printedCount = 0;
|
||||||
let failedCount = 0;
|
let failedCount = 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user