feat: 키오스크 마일리지 적립 시스템 추가
- 키오스크 전체화면 웹 UI (/kiosk) - QR 표시 + 전화번호 숫자패드 입력 - 키오스크 API 4개 (trigger, current, claim, kiosk 페이지) - POS GUI에 "키오스크 적립" 버튼 추가 (Flask 서버로 HTTP 트리거) - NHN Cloud 알림톡 발송 모듈 (적립 완료 시 자동 발송) - Qt 플랫폼 플러그인 경로 자동 설정 (no Qt platform plugin 에러 해결) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,18 @@ import sys
|
||||
import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
# Qt 플랫폼 플러그인 경로 자동 설정 (PyQt5 import 전에 반드시 설정)
|
||||
if not os.environ.get('QT_QPA_PLATFORM_PLUGIN_PATH'):
|
||||
import importlib.util
|
||||
_spec = importlib.util.find_spec('PyQt5')
|
||||
if _spec and _spec.origin:
|
||||
_pyqt5_plugins = os.path.join(
|
||||
os.path.dirname(_spec.origin), 'Qt5', 'plugins', 'platforms'
|
||||
)
|
||||
if os.path.isdir(_pyqt5_plugins):
|
||||
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = _pyqt5_plugins
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
|
||||
QPushButton, QLabel, QGroupBox, QTableWidget, QTableWidgetItem,
|
||||
@@ -624,6 +636,14 @@ class POSSalesGUI(QMainWindow):
|
||||
self.qr_btn.clicked.connect(self.generate_qr_label) # 이벤트 연결
|
||||
settings_layout.addWidget(self.qr_btn)
|
||||
|
||||
# 키오스크 적립 버튼
|
||||
self.kiosk_btn = QPushButton('키오스크 적립')
|
||||
self.kiosk_btn.setStyleSheet(
|
||||
'background-color: #6366f1; color: white; padding: 8px; font-weight: bold;')
|
||||
self.kiosk_btn.setToolTip('선택된 거래를 키오스크 화면에 표시')
|
||||
self.kiosk_btn.clicked.connect(self.trigger_kiosk_claim)
|
||||
settings_layout.addWidget(self.kiosk_btn)
|
||||
|
||||
# 미리보기 모드 체크박스 추가
|
||||
self.preview_checkbox = QCheckBox('미리보기 모드')
|
||||
self.preview_checkbox.setChecked(True) # 기본값: 미리보기
|
||||
@@ -928,6 +948,35 @@ class POSSalesGUI(QMainWindow):
|
||||
except:
|
||||
return False
|
||||
|
||||
def trigger_kiosk_claim(self):
|
||||
"""선택된 판매 건을 키오스크에 표시"""
|
||||
current_row = self.sales_table.currentRow()
|
||||
if current_row < 0:
|
||||
QMessageBox.warning(self, '경고', '거래를 선택해주세요.')
|
||||
return
|
||||
|
||||
order_no = self.sales_table.item(current_row, 0).text()
|
||||
amount_text = self.sales_table.item(current_row, 2).text()
|
||||
amount = float(amount_text.replace(',', '').replace('원', ''))
|
||||
|
||||
try:
|
||||
import requests as req
|
||||
resp = req.post(
|
||||
'http://localhost:7001/api/kiosk/trigger',
|
||||
json={'transaction_id': order_no, 'amount': amount},
|
||||
timeout=5
|
||||
)
|
||||
result = resp.json()
|
||||
|
||||
if result.get('success'):
|
||||
self.status_label.setText(f'키오스크 적립 대기 중 ({result.get("points", 0)}P)')
|
||||
self.status_label.setStyleSheet(
|
||||
'color: #6366f1; font-size: 12px; padding: 5px; font-weight: bold;')
|
||||
else:
|
||||
QMessageBox.warning(self, '키오스크', result.get('message', '전송 실패'))
|
||||
except Exception as e:
|
||||
QMessageBox.critical(self, '오류', f'Flask 서버 연결 실패:\n{str(e)}')
|
||||
|
||||
def generate_qr_label(self):
|
||||
"""선택된 판매 건에 대해 QR 라벨 생성"""
|
||||
# 선택된 행 확인
|
||||
|
||||
Reference in New Issue
Block a user