python+pyqt5实现KFC点餐收银系统

本文实例为大家分享了python实现KFC点餐收银系统的具体代码,供大家参考,具体内容如下

这个kfc收银系统我实现了的以下功能:

1.正常餐品结算和找零。
2.基本套餐结算和找零。
3.使用优惠劵购买餐品结算和找零。
4.可在一定时间段参与店内活动
5.模拟打印小票的功能(写到文件中)。

工程文件:

肯德基.py文件实现各功能、kfctip.txt文件用于打印小票、picture文件里存放界面所需的图片、其他四个文件为各界面布局。

主界面:

正常餐品点餐界面:

套餐点餐界面:

活动套餐点餐界面:

当点击第二个活动套餐时:

加入订单点击返回后主界面会生成订单信息:

点击结算:



打印小票到文件:

以下是代码实现:

界面布局均使用pyqt5

主界面布局:

from PyQt5 import QtCore, QtWidgets

class Ui_MainWindow(object):
 def setupUi(self, MainWindow):
 MainWindow.setObjectName("MainWindow")
 MainWindow.resize(893, 489)
 self.centralwidget = QtWidgets.QWidget(MainWindow)
 self.centralwidget.setObjectName("centralwidget")
 self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_2.setGeometry(QtCore.QRect(510, 20, 101, 41))
 self.pushButton_2.setObjectName("pushButton_2")
 self.pushButton_3 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_3.setGeometry(QtCore.QRect(510, 80, 101, 41))
 self.pushButton_3.setObjectName("pushButton_3")
 self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_4.setGeometry(QtCore.QRect(510, 140, 101, 41))
 self.pushButton_4.setObjectName("pushButton_4")
 self.label = QtWidgets.QLabel(self.centralwidget)
 self.label.setGeometry(QtCore.QRect(510, 200, 111, 21))
 self.label.setObjectName("label")
 self.label_2 = QtWidgets.QLabel(self.centralwidget)
 self.label_2.setGeometry(QtCore.QRect(510, 230, 72, 15))
 self.label_2.setObjectName("label_2")
 self.label_3 = QtWidgets.QLabel(self.centralwidget)
 self.label_3.setGeometry(QtCore.QRect(590, 230, 21, 16))
 self.label_3.setObjectName("label_3")
 self.label_4 = QtWidgets.QLabel(self.centralwidget)
 self.label_4.setGeometry(QtCore.QRect(510, 260, 81, 21))
 self.label_4.setObjectName("label_4")
 self.label_5 = QtWidgets.QLabel(self.centralwidget)
 self.label_5.setGeometry(QtCore.QRect(510, 290, 72, 15))
 self.label_5.setObjectName("label_5")
 self.label_6 = QtWidgets.QLabel(self.centralwidget)
 self.label_6.setGeometry(QtCore.QRect(590, 290, 21, 16))
 self.label_6.setObjectName("label_6")
 self.label_7 = QtWidgets.QLabel(self.centralwidget)
 self.label_7.setGeometry(QtCore.QRect(640, 20, 61, 21))
 self.label_7.setObjectName("label_7")
 self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
 self.tableWidget.setGeometry(QtCore.QRect(640, 40, 241, 231))
 self.tableWidget.setObjectName("tableWidget")
 self.tableWidget.setColumnCount(3)
 self.tableWidget.setRowCount(0)
 item = QtWidgets.QTableWidgetItem()
 self.tableWidget.setHorizontalHeaderItem(0, item)
 item = QtWidgets.QTableWidgetItem()
 self.tableWidget.setHorizontalHeaderItem(1, item)
 item = QtWidgets.QTableWidgetItem()
 self.tableWidget.setHorizontalHeaderItem(2, item)
 self.tableWidget.horizontalHeader().setDefaultSectionSize(70)
 self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_5.setGeometry(QtCore.QRect(640, 290, 71, 31))
 self.pushButton_5.setObjectName("pushButton_5")
 self.pushButton_6 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_6.setGeometry(QtCore.QRect(640, 350, 91, 31))
 self.pushButton_6.setObjectName("pushButton_6")
 self.pushButton_7 = QtWidgets.QPushButton(self.centralwidget)
 self.pushButton_7.setGeometry(QtCore.QRect(750, 350, 91, 31))
 self.pushButton_7.setObjectName("pushButton_7")
 self.label_8 = QtWidgets.QLabel(self.centralwidget)
 self.label_8.setGeometry(QtCore.QRect(10, 10, 481, 431))
 self.label_8.setObjectName("label_8")
 MainWindow.setCentralWidget(self.centralwidget)
 self.menubar = QtWidgets.QMenuBar(MainWindow)
 self.menubar.setGeometry(QtCore.QRect(0, 0, 893, 26))
 self.menubar.setObjectName("menubar")
 MainWindow.setMenuBar(self.menubar)
 self.statusbar = QtWidgets.QStatusBar(MainWindow)
 self.statusbar.setObjectName("statusbar")
 MainWindow.setStatusBar(self.statusbar)

 self.retranslateUi(MainWindow)
 QtCore.QMetaObject.connectSlotsByName(MainWindow)

 def retranslateUi(self, MainWindow):
 _translate = QtCore.QCoreApplication.translate
 MainWindow.setWindowTitle(_translate("MainWindow", "肯德基"))
 self.pushButton_2.setText(_translate("MainWindow", "基本餐"))
 self.pushButton_3.setText(_translate("MainWindow", "套餐"))
 self.pushButton_4.setText(_translate("MainWindow", "活动"))
 self.label.setText(_translate("MainWindow", "会员储值卡余额"))
 self.label_2.setText(_translate("MainWindow", "钱"))
 self.label_3.setText(_translate("MainWindow", "元"))
 self.label_4.setText(_translate("MainWindow", "您的优惠券"))
 self.label_5.setText(_translate("MainWindow", "券"))
 self.label_6.setText(_translate("MainWindow", "张"))
 self.label_7.setText(_translate("MainWindow", "您的订单"))
 item = self.tableWidget.horizontalHeaderItem(0)
 item.setText(_translate("MainWindow", "名称"))
 item = self.tableWidget.horizontalHeaderItem(1)
 item.setText(_translate("MainWindow", "数量"))
 item = self.tableWidget.horizontalHeaderItem(2)
 item.setText(_translate("MainWindow", "价格/元"))
 self.pushButton_5.setText(_translate("MainWindow", "删除"))
 self.pushButton_6.setText(_translate("MainWindow", "结算"))
 self.pushButton_7.setText(_translate("MainWindow", "打印小票"))
 self.label_8.setText(_translate("MainWindow", "图"))

正常套餐界面:

from PyQt5 import QtCore, QtWidgets

class Ui_Normal(object):
 def setupUi(self, Form):
 Form.setObjectName("Form")
 Form.resize(728, 459)
 self.pushButton = QtWidgets.QPushButton(Form)
 self.pushButton.setGeometry(QtCore.QRect(40, 190, 93, 41))
 self.pushButton.setObjectName("pushButton")
 self.pushButton_2 = QtWidgets.QPushButton(Form)
 self.pushButton_2.setGeometry(QtCore.QRect(260, 190, 93, 41))
 self.pushButton_2.setObjectName("pushButton_2")
 self.pushButton_3 = QtWidgets.QPushButton(Form)
 self.pushButton_3.setGeometry(QtCore.QRect(480, 190, 93, 41))
 self.pushButton_3.setObjectName("pushButton_3")
 self.pushButton_4 = QtWidgets.QPushButton(Form)
 self.pushButton_4.setGeometry(QtCore.QRect(40, 400, 93, 41))
 self.pushButton_4.setObjectName("pushButton_4")
 self.pushButton_5 = QtWidgets.QPushButton(Form)
 self.pushButton_5.setGeometry(QtCore.QRect(620, 400, 93, 41))
 self.pushButton_5.setObjectName("pushButton_5")
 self.pushButton_6 = QtWidgets.QPushButton(Form)
 self.pushButton_6.setGeometry(QtCore.QRect(260, 400, 93, 41))
 self.pushButton_6.setObjectName("pushButton_6")
 self.label = QtWidgets.QLabel(Form)
 self.label.setGeometry(QtCore.QRect(50, 170, 72, 15))
 self.label.setObjectName("label")
 self.label_2 = QtWidgets.QLabel(Form)
 self.label_2.setGeometry(QtCore.QRect(30, 140, 121, 21))
 self.label_2.setObjectName("label_2")
 self.label_3 = QtWidgets.QLabel(Form)
 self.label_3.setGeometry(QtCore.QRect(30, 10, 121, 111))
 self.label_3.setObjectName("label_3")
 self.label_4 = QtWidgets.QLabel(Form)
 self.label_4.setGeometry(QtCore.QRect(270, 170, 72, 15))
 self.label_4.setObjectName("label_4")
 self.label_5 = QtWidgets.QLabel(Form)
 self.label_5.setGeometry(QtCore.QRect(270, 140, 72, 15))
 self.label_5.setObjectName("label_5")
 self.label_6 = QtWidgets.QLabel(Form)
 self.label_6.setGeometry(QtCore.QRect(240, 10, 131, 111))
 self.label_6.setObjectName("label_6")
 self.label_7 = QtWidgets.QLabel(Form)
 self.label_7.setGeometry(QtCore.QRect(490, 170, 72, 15))
 self.label_7.setObjectName("label_7")
 self.label_8 = QtWidgets.QLabel(Form)
 self.label_8.setGeometry(QtCore.QRect(480, 140, 91, 16))
 self.label_8.setObjectName("label_8")
 self.label_9 = QtWidgets.QLabel(Form)
 self.label_9.setGeometry(QtCore.QRect(460, 10, 131, 111))
 self.label_9.setObjectName("label_9")
 self.label_10 = QtWidgets.QLabel(Form)
 self.label_10.setGeometry(QtCore.QRect(50, 380, 72, 15))
 self.label_10.setObjectName("label_10")
 self.label_11 = QtWidgets.QLabel(Form)
 self.label_11.setGeometry(QtCore.QRect(60, 360, 51, 16))
 self.label_11.setObjectName("label_11")
 self.label_12 = QtWidgets.QLabel(Form)
 self.label_12.setGeometry(QtCore.QRect(30, 250, 121, 101))
 self.label_12.setObjectName("label_12")
 self.label_13 = QtWidgets.QLabel(Form)
 self.label_13.setGeometry(QtCore.QRect(270, 380, 72, 15))
 self.label_13.setObjectName("label_13")
 self.label_14 = QtWidgets.QLabel(Form)
 self.label_14.setGeometry(QtCore.QRect(250, 360, 131, 16))
 self.label_14.setObjectName("label_14")
 self.label_15 = QtWidgets.QLabel(Form)
 self.label_15.setGeometry(QtCore.QRect(240, 250, 131, 101))
 self.label_15.setObjectName("label_15")

 self.retranslateUi(Form)
 QtCore.QMetaObject.connectSlotsByName(Form)

 def retranslateUi(self, Form):
 _translate = QtCore.QCoreApplication.translate
 Form.setWindowTitle(_translate("Form", "Form"))
 self.pushButton.setText(_translate("Form", "加入订单"))
 self.pushButton_2.setText(_translate("Form", "加入订单"))
 self.pushButton_3.setText(_translate("Form", "加入订单"))
 self.pushButton_4.setText(_translate("Form", "加入订单"))
 self.pushButton_5.setText(_translate("Form", "返回"))
 self.pushButton_6.setText(_translate("Form", "加入订单"))
 self.label.setText(_translate("Form", "钱1"))
 self.label_2.setText(_translate("Form", "新奥尔良烤鸡腿堡"))
 self.label_3.setText(_translate("Form", "TextLabel"))
 self.label_4.setText(_translate("Form", "钱2"))
 self.label_5.setText(_translate("Form", "香辣鸡翅"))
 self.label_6.setText(_translate("Form", "TextLabel"))
 self.label_7.setText(_translate("Form", "钱3"))
 self.label_8.setText(_translate("Form", "波纹霸王薯条"))
 self.label_9.setText(_translate("Form", "TextLabel"))
 self.label_10.setText(_translate("Form", "钱4"))
 self.label_11.setText(_translate("Form", "乌龙茶"))
 self.label_12.setText(_translate("Form", "TextLabel"))
 self.label_13.setText(_translate("Form", "钱5"))
 self.label_14.setText(_translate("Form", "原味圣代(草莓酱)"))
 self.label_15.setText(_translate("Form", "TextLabel"))

套餐界面:

from PyQt5 import QtCore, QtWidgets

class Ui_Package(object):
 def setupUi(self, Form):
 Form.setObjectName("Form")
 Form.resize(728, 393)
 self.pushButton = QtWidgets.QPushButton(Form)
 self.pushButton.setGeometry(QtCore.QRect(90, 280, 91, 31))
 self.pushButton.setObjectName("pushButton")
 self.pushButton_2 = QtWidgets.QPushButton(Form)
 self.pushButton_2.setGeometry(QtCore.QRect(340, 280, 93, 31))
 self.pushButton_2.setObjectName("pushButton_2")
 self.label = QtWidgets.QLabel(Form)
 self.label.setGeometry(QtCore.QRect(100, 250, 72, 15))
 self.label.setObjectName("label")
 self.label_2 = QtWidgets.QLabel(Form)
 self.label_2.setGeometry(QtCore.QRect(350, 250, 72, 15))
 self.label_2.setObjectName("label_2")
 self.label_3 = QtWidgets.QLabel(Form)
 self.label_3.setGeometry(QtCore.QRect(80, 220, 131, 21))
 self.label_3.setObjectName("label_3")
 self.label_4 = QtWidgets.QLabel(Form)
 self.label_4.setGeometry(QtCore.QRect(330, 220, 111, 21))
 self.label_4.setObjectName("label_4")
 self.label_5 = QtWidgets.QLabel(Form)
 self.label_5.setGeometry(QtCore.QRect(60, 20, 161, 171))
 self.label_5.setObjectName("label_5")
 self.label_6 = QtWidgets.QLabel(Form)
 self.label_6.setGeometry(QtCore.QRect(300, 20, 171, 171))
 self.label_6.setObjectName("label_6")
 self.pushButton_3 = QtWidgets.QPushButton(Form)
 self.pushButton_3.setGeometry(QtCore.QRect(560, 280, 101, 41))
 self.pushButton_3.setObjectName("pushButton_3")

 self.retranslateUi(Form)
 QtCore.QMetaObject.connectSlotsByName(Form)

 def retranslateUi(self, Form):
 _translate = QtCore.QCoreApplication.translate
 Form.setWindowTitle(_translate("Form", "Form"))
 self.pushButton.setText(_translate("Form", "加入订单"))
 self.pushButton_2.setText(_translate("Form", "加入订单"))
 self.label.setText(_translate("Form", "钱1"))
 self.label_2.setText(_translate("Form", "钱2"))
 self.label_3.setText(_translate("Form", "翅桶辣堡奥堡套餐"))
 self.label_4.setText(_translate("Form", "万圣节日劲堡桶"))
 self.label_5.setText(_translate("Form", "TextLabel"))
 self.label_6.setText(_translate("Form", "TextLabel"))
 self.pushButton_3.setText(_translate("Form", "返回"))

活动界面:

from PyQt5 import QtCore, QtWidgets

class Ui_Activity(object):
 def setupUi(self, Form):
 Form.setObjectName("Form")
 Form.resize(639, 335)
 self.pushButton = QtWidgets.QPushButton(Form)
 self.pushButton.setGeometry(QtCore.QRect(50, 240, 93, 31))
 self.pushButton.setObjectName("pushButton")
 self.pushButton_2 = QtWidgets.QPushButton(Form)
 self.pushButton_2.setGeometry(QtCore.QRect(300, 240, 93, 31))
 self.pushButton_2.setObjectName("pushButton_2")
 self.label = QtWidgets.QLabel(Form)
 self.label.setGeometry(QtCore.QRect(11, 220, 201, 20))
 self.label.setObjectName("label")
 self.label_2 = QtWidgets.QLabel(Form)
 self.label_2.setGeometry(QtCore.QRect(20, 200, 161, 16))
 self.label_2.setObjectName("label_2")
 self.label_3 = QtWidgets.QLabel(Form)
 self.label_3.setGeometry(QtCore.QRect(50, 180, 91, 16))
 self.label_3.setObjectName("label_3")
 self.label_4 = QtWidgets.QLabel(Form)
 self.label_4.setGeometry(QtCore.QRect(30, 30, 141, 141))
 self.label_4.setObjectName("label_4")
 self.label_5 = QtWidgets.QLabel(Form)
 self.label_5.setGeometry(QtCore.QRect(261, 220, 201, 20))
 self.label_5.setObjectName("label_5")
 self.label_6 = QtWidgets.QLabel(Form)
 self.label_6.setGeometry(QtCore.QRect(270, 200, 161, 16))
 self.label_6.setObjectName("label_6")
 self.label_7 = QtWidgets.QLabel(Form)
 self.label_7.setGeometry(QtCore.QRect(310, 180, 61, 16))
 self.label_7.setObjectName("label_7")
 self.label_8 = QtWidgets.QLabel(Form)
 self.label_8.setGeometry(QtCore.QRect(280, 30, 151, 141))
 self.label_8.setObjectName("label_8")
 self.pushButton_3 = QtWidgets.QPushButton(Form)
 self.pushButton_3.setGeometry(QtCore.QRect(490, 250, 101, 31))
 self.pushButton_3.setObjectName("pushButton_3")

 self.retranslateUi(Form)
 QtCore.QMetaObject.connectSlotsByName(Form)

 def retranslateUi(self, Form):
 _translate = QtCore.QCoreApplication.translate
 Form.setWindowTitle(_translate("Form", "Form"))
 self.pushButton.setText(_translate("Form", "加入订单"))
 self.pushButton_2.setText(_translate("Form", "加入订单"))
 self.label.setText(_translate("Form", "钱1"))
 self.label_2.setText(_translate("Form", "2018.10.1-2018.10.31"))
 self.label_3.setText(_translate("Form", "葡式蛋挞5只"))
 self.label_4.setText(_translate("Form", "TextLabel"))
 self.label_5.setText(_translate("Form", "钱2"))
 self.label_6.setText(_translate("Form", "2018.11.1-2018.11.11"))
 self.label_7.setText(_translate("Form", "超级翅桶"))
 self.label_8.setText(_translate("Form", "TextLabel"))
 self.pushButton_3.setText(_translate("Form", "返回"))

以下为实现各界面互联和各功能的实现(注释比较详细这里就不多说了):

# -*- coding: utf-8 -*-
# 作者:dcjmessi
# 日期:2018/10/19

from kfcmain import *
from normal import *
from package import *
from activity import *
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QPixmap

class KFC_Main(QMainWindow):
 def __init__(self):
 QMainWindow.__init__(self)
 self.main_ui = Ui_MainWindow()
 self.main_ui.setupUi(self)

 # 给按钮绑定方法
 btn_del = self.main_ui.pushButton_5
 btn_del.clicked.connect(self.order_del)
 btn_num = self.main_ui.pushButton_6
 btn_num.clicked.connect(self.order_num)
 self.btn_tip = self.main_ui.pushButton_7
 self.btn_tip.clicked.connect(self.order_tip)
 # 设置按钮为当前不可用
 self.btn_tip.setEnabled(False)
 # 定义列表
 self.num = []
 self.new_num = []

 # 主界面显示
 def person(self):
 # 主界面贴图
 self.main_ui.label_8.setPixmap(QPixmap('./picture/主界图.png'))
 # 将图片完全填充
 self.main_ui.label_8.setScaledContents(True)
 # 初始化会员储值余额
 self.balance = 200
 # 初始化优惠券数量
 self.coupons = 1
 # 显示余额和券数量
 self.main_ui.label_2.setText(str(self.balance))
 self.main_ui.label_5.setText(str(self.coupons))
 # 显示主界面
 kfcmain.show()

 # 删除tableWidget所选行
 def order_del(self):
 # 获取所选行索引
 row_index = kfcmain.main_ui.tableWidget.currentRow()
 if row_index != -1:
  # 删除
  kfcmain.main_ui.tableWidget.removeRow(row_index)

 # 结算
 def order_num(self):
 # 设置按钮为可用
 self.btn_tip.setEnabled(True)
 # 遍历所有行
 for row_index in range(kfcmain.main_ui.tableWidget.rowCount()):
  # 将每一行的第三项值添加到num列表里
  self.num.append(kfcmain.main_ui.tableWidget.item(row_index, 2).text())

 # 将num中的字符转换成int型
 self.new_num = eval('[' + (','.join(self.num)) + ']')
 # 将new_num列表值求和
 self.money = sum(self.new_num)

 # 有优惠券时
 if self.coupons >= 1:
  # 消息提示框
  button = QMessageBox.information(self, "温馨提示", "是否使用优惠券", QMessageBox.Yes | QMessageBox.No)
  # 使用优惠券
  if button == QMessageBox.Yes:
  # 当前优惠券数量减一
  self.coupons = self.coupons -1
  self.main_ui.label_5.setText(str(self.coupons))

  # 余额足够
  if self.balance >= (self.money - self.coupons * 20):
   QMessageBox.information(self, "恭喜您", "付款成功!", QMessageBox.Yes)
   self.balance = self.balance - self.money - self.coupons * 20
   self.main_ui.label_2.setText(str(self.balance))
  else:
   QMessageBox.information(self, "对不起", "您的会员储值卡余额不足!", QMessageBox.Yes)
  # 不使用优惠券
  else:
  if self.balance >= self.money:
   QMessageBox.information(self, "恭喜您", "付款成功!", QMessageBox.Yes)
   self.balance = self.balance - self.money
   self.main_ui.label_2.setText(str(self.balance))
  else:
   QMessageBox.information(self, "对不起", "您的会员储值卡余额不足!", QMessageBox.Yes)
 # 没有优惠券时
 else:
  if self.balance >= self.money:
  QMessageBox.information(self, "恭喜您", "付款成功!", QMessageBox.Yes)
  self.balance = self.balance - self.money
  self.main_ui.label_2.setText(str(self.balance))
  else:
  QMessageBox.information(self, "对不起", "您的会员储值卡余额不足!", QMessageBox.Yes)

 # 打印小票
 def order_tip(self):
 # 打开本地txt文件
 with open("kfctip.txt", "w") as f:
  # 遍历行
  for row_index in range(kfcmain.main_ui.tableWidget.rowCount()):
  # 遍历列
  for column_index in range(kfcmain.main_ui.tableWidget.columnCount()):
   # 将tableWidget数据写入文件
   f.write(kfcmain.main_ui.tableWidget.item(row_index, column_index).text() + "\n")
  f.write("合计:" + str(self.money) + "元")
 f.close()

class Normal(QWidget):
 def __init__(self):
 QWidget.__init__(self)
 self.normal_ui = Ui_Normal()
 self.normal_ui.setupUi(self)

 # 初始化各基本餐加入订单按钮点击次数
 self.bt1 = 0
 self.bt2 = 0
 self.bt3 = 0
 self.bt4 = 0
 self.bt6 = 0
 # 初始化返回按钮点击次数
 self.bt5 = 0
 # 按钮绑定方法
 btn_hamburg = self.normal_ui.pushButton
 btn_hamburg.clicked.connect(self.order_hamburg)
 btn_chicken = self.normal_ui.pushButton_2
 btn_chicken.clicked.connect(self.order_chicken)
 btn_fries = self.normal_ui.pushButton_3
 btn_fries.clicked.connect(self.order_fries)
 btn_tea = self.normal_ui.pushButton_4
 btn_tea.clicked.connect(self.order_tea)
 btn_ice = self.normal_ui.pushButton_6
 btn_ice.clicked.connect(self.order_ice)
 btn_return = self.normal_ui.pushButton_5
 btn_return.clicked.connect(self.nor_show)

 # 显示基本餐界面
 def nor_order(self):
 self.normal_ui.label_3.setPixmap(QPixmap('./picture/新奥尔良.png'))
 self.normal_ui.label_3.setScaledContents(True)
 self.normal_ui.label_6.setPixmap(QPixmap('./picture/鸡翅.png'))
 self.normal_ui.label_6.setScaledContents(True)
 self.normal_ui.label_9.setPixmap(QPixmap('./picture/薯条.png'))
 self.normal_ui.label_9.setScaledContents(True)
 self.normal_ui.label_12.setPixmap(QPixmap('./picture/乌龙茶.png'))
 self.normal_ui.label_12.setScaledContents(True)
 self.normal_ui.label_15.setPixmap(QPixmap('./picture/冰淇淋.png'))
 self.normal_ui.label_15.setScaledContents(True)
 # 基本餐价格
 self.price_hamburg = 18.5
 self.price_chicken = 11.0
 self.price_fries = 13.0
 self.price_tea = 13.5
 self.price_ice = 10.0
 # 显示价格
 self.normal_ui.label.setText(str(self.price_hamburg)+"元/份")
 self.normal_ui.label_4.setText(str(self.price_chicken)+"元/份")
 self.normal_ui.label_7.setText(str(self.price_fries)+"元/份")
 self.normal_ui.label_10.setText(str(self.price_tea)+"元/份")
 self.normal_ui.label_13.setText(str(self.price_ice)+"元/份")
 normal.show()

 # 计算点击次数
 def order_hamburg(self):
 self.bt1 += 1

 def order_chicken(self):
 self.bt2 += 1

 def order_fries(self):
 self.bt3 += 1

 def order_tea(self):
 self.bt4 += 1

 def order_ice(self):
 self.bt6 += 1

 def nor_show(self):
 self.bt5 += 1

 # 隐藏界面
 normal.hide()

 # 获取所选各基本餐的数量对应的价格
 self.num_hamburg = self.price_hamburg * self.bt1
 self.num_chicken = self.price_chicken * self.bt2
 self.num_fries = self.price_fries * self.bt3
 self.num_tea = self.price_tea * self.bt4
 self.num_ice = self.price_ice * self.bt6

 # 不是第一次进入该界面
 if self.bt5 > 1:
  for row_index in range(kfcmain.main_ui.tableWidget.rowCount()):
  # 获取tableWidget的所有名称,并放入name列表
  name.append(kfcmain.main_ui.tableWidget.item(row_index, 0).text())
  if '新奥尔良烤鸡腿堡' in name:
  # 重新设置该行的数量和价格
  kfcmain.main_ui.tableWidget.setItem(name.index('新奥尔良烤鸡腿堡'), 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(name.index('新奥尔良烤鸡腿堡'), 2, QTableWidgetItem(str(self.num_hamburg)))
  if '新奥尔良烤鸡腿堡' not in name:
  # 已选择
  if self.bt1 != 0:
   # 添加一行数据
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_2.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_hamburg)))
  if '香辣鸡翅' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('香辣鸡翅'), 1, QTableWidgetItem("×" + str(self.bt2)))
  kfcmain.main_ui.tableWidget.setItem(name.index('香辣鸡翅'), 2, QTableWidgetItem(str(self.num_chicken)))
  if '香辣鸡翅' not in name:
  if self.bt2 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_5.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt2)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_chicken)))
  if '波纹霸王薯条' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('波纹霸王薯条'), 1, QTableWidgetItem("×" + str(self.bt3)))
  kfcmain.main_ui.tableWidget.setItem(name.index('波纹霸王薯条'), 2, QTableWidgetItem(str(self.num_fries)))
  if '波纹霸王薯条' not in name:
  if self.bt3 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_8.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt3)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_fries)))
  if '乌龙茶'in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('乌龙茶'), 1, QTableWidgetItem("×" + str(self.bt4)))
  kfcmain.main_ui.tableWidget.setItem(name.index('乌龙茶'), 2, QTableWidgetItem(str(self.num_tea)))
  if '乌龙茶' not in name:
  if self.bt4 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_11.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt4)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_tea)))
  if '原味圣代(草莓酱)' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('原味圣代(草莓酱)'), 1, QTableWidgetItem("×" + str(self.bt6)))
  kfcmain.main_ui.tableWidget.setItem(name.index('原味圣代(草莓酱)'), 2, QTableWidgetItem(str(self.num_ice)))
  if '原味圣代(草莓酱)' not in name:
  if self.bt6 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_14.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt6)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_ice)))
 # 第一次进入该界面
 else:
  if self.bt1 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_2.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_hamburg)))
  if self.bt2 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_5.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt2)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_chicken)))
  if self.bt3 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_8.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt3)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_fries)))
  if self.bt4 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_11.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt4)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_tea)))
  if self.bt6 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(normal.normal_ui.label_14.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt6)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_ice)))

class Package(QWidget):
 def __init__(self):
 QWidget.__init__(self)
 self.package_ui = Ui_Package()
 self.package_ui.setupUi(self)

 # 初始化各套餐加入订单按钮点击次数
 self.bt1 = 0
 self.bt2 = 0
 # 初始化返回按钮点击次数
 self.bt3 = 0
 # 按钮绑定方法
 btn_pack1 = self.package_ui.pushButton
 btn_pack1.clicked.connect(self.order_pack1)
 btn_pack2 = self.package_ui.pushButton_2
 btn_pack2.clicked.connect(self.order_pack2)
 btn_return = self.package_ui.pushButton_3
 btn_return.clicked.connect(self.pac_show)

 # 显示套餐界面
 def pac_order(self):
 self.package_ui.label_5.setPixmap(QPixmap('./picture/套餐2.png'))
 self.package_ui.label_5.setScaledContents(True)
 self.package_ui.label_6.setPixmap(QPixmap('./picture/套餐1.png'))
 self.package_ui.label_6.setScaledContents(True)
 # 套餐价格
 self.price_pack1 = 89.0
 self.price_pack2 = 67.0
 self.package_ui.label.setText(str(self.price_pack1)+"元/份")
 self.package_ui.label_2.setText(str(self.price_pack2)+"元/份")
 package.show()

 def order_pack1(self):
 self.bt1 += 1

 def order_pack2(self):
 self.bt2 += 1

 def pac_show(self):
 self.bt3 += 1

 package.hide()

 self.num_pack1 = self.price_pack1 * self.bt1
 self.num_pack2 = self.price_pack2 * self.bt2

 if self.bt3 > 1:
  for row_index in range(kfcmain.main_ui.tableWidget.rowCount()):
  name.append(kfcmain.main_ui.tableWidget.item(row_index, 0).text())
  if '翅桶辣堡奥堡套餐' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('翅桶辣堡奥堡套餐'), 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(name.index('翅桶辣堡奥堡套餐'), 2, QTableWidgetItem(str(self.num_pack1)))
  if '翅桶辣堡奥堡套餐' not in name:
  if self.bt1 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(package.package_ui.label_3.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_pack1)))
  if '万圣节日劲堡桶' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('万圣节日劲堡桶'), 1, QTableWidgetItem("×" + str(self.bt2)))
  kfcmain.main_ui.tableWidget.setItem(name.index('万圣节日劲堡桶'), 2, QTableWidgetItem(str(self.num_pack2)))
  if '万圣节日劲堡桶' not in name:
  if self.bt2 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(package.package_ui.label_4.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt2)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_pack2)))
 else:
  if self.bt1 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(package.package_ui.label_3.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_pack1)))
  if self.bt2 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(package.package_ui.label_4.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt2)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_pack2)))

class Activity(QWidget):
 def __init__(self):
 QWidget.__init__(self)
 self.activity_ui = Ui_Activity()
 self.activity_ui.setupUi(self)

 # 初始化各活动加入订单按钮点击次数
 self.bt1 = 0
 # 初始化返回按钮点击次数
 self.bt3 = 0
 # 绑定方法
 btn_act1 = self.activity_ui.pushButton
 btn_act1.clicked.connect(self.order_act1)
 btn_act2 = self.activity_ui.pushButton_2
 btn_act2.clicked.connect(self.order_act2)
 btn_return = self.activity_ui.pushButton_3
 btn_return.clicked.connect(self.act_show)

 def act_order(self):
 self.activity_ui.label_4.setPixmap(QPixmap('./picture/活动1.png'))
 self.activity_ui.label_4.setScaledContents(True)
 self.activity_ui.label_8.setPixmap(QPixmap('./picture/活动2.png'))
 self.activity_ui.label_8.setScaledContents(True)
 # 活动价格
 self.price_act1 = 29.0
 self.price_act2 = 69.0
 self.activity_ui.label.setText(str(self.price_act1) + "元/份 原价:"+str(self.price_act1 + 7) + "元/份")
 self.activity_ui.label_5.setText(str(self.price_act2) + "元/份 原价:"+str(self.price_act2 + 10) + "元/份")
 activity.show()

 def order_act1(self):
 self.bt1 += 1

 def order_act2(self):
 QMessageBox.information(self, "对不起", "活动还没有开始,敬请期待!", QMessageBox.Yes)

 def act_show(self):
 self.bt3 += 1

 activity.hide()

 self.num_act1 = self.price_act1 * self.bt1

 if self.bt3 > 1:
  for row_index in range(kfcmain.main_ui.tableWidget.rowCount()):
  name.append(kfcmain.main_ui.tableWidget.item(row_index, 0).text())
  if '葡式蛋挞5只' in name:
  kfcmain.main_ui.tableWidget.setItem(name.index('葡式蛋挞5只'), 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(name.index('葡式蛋挞5只'), 2, QTableWidgetItem(str(self.num_act1)))
  if '葡式蛋挞5只' not in name:
  if self.bt1 != 0:
   row_count = kfcmain.main_ui.tableWidget.rowCount()
   kfcmain.main_ui.tableWidget.insertRow(row_count)
   kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(activity.activity_ui.label_3.text()))
   kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
   kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_act1)))
 else:
  if self.bt1 != 0:
  row_count = kfcmain.main_ui.tableWidget.rowCount()
  kfcmain.main_ui.tableWidget.insertRow(row_count)
  kfcmain.main_ui.tableWidget.setItem(row_count, 0, QTableWidgetItem(activity.activity_ui.label_3.text()))
  kfcmain.main_ui.tableWidget.setItem(row_count, 1, QTableWidgetItem("×" + str(self.bt1)))
  kfcmain.main_ui.tableWidget.setItem(row_count, 2, QTableWidgetItem(str(self.num_act1)))

if __name__=="__main__":
 app = QApplication(sys.argv)

 kfcmain = KFC_Main()
 normal = Normal()
 package = Package()
 activity = Activity()
 # 显示主界面
 kfcmain.person()
 # 绑定按钮
 btn_normal = kfcmain.main_ui.pushButton_2
 btn_normal.clicked.connect(normal.nor_order)
 btn_package = kfcmain.main_ui.pushButton_3
 btn_package.clicked.connect(package.pac_order)
 btn_activity = kfcmain.main_ui.pushButton_4
 btn_activity.clicked.connect(activity.act_order)
 # 初始化name列表
 name = []

 sys.exit(app.exec_())

删除只实现了同餐品在订单上的删除,没有实现数量的减少,可自行添加。

更多学习资料请关注专题《管理系统开发》。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • java实现微信点餐申请微信退款

    应用场景: 当交易发生之后一段时间内,由于买家或者卖家的原因需要退款时,卖家可以通过退款接口将支付款退给买家,微信支付将在收到退款请求并且验证成功之后,按照退款规则将支付款按原路退到买家账号上. 注意事项: 1.交易时间超过一年的订单无法提交退款 2.微信支付退款支持单笔交易分多次退款,多次退款需要提交原支付订单的商户订单好和设置不同的退款单号.申请退款总金额不能超过订单金额.一笔退款失败后重新提交,请不要更换退款单号,请使用原商户退款单号. 3.请求频率限制,150qps,即每秒钟正常的申请退

  • java实现KFC点餐系统

    同学们应该都去麦当劳或肯德基吃过快餐吧?请同学们参考肯德基官网的信息模拟肯德基快餐店的收银系统,合理使用C++/python/Java,结合设计模式(2种以上)至少实现系统的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠劵购买餐品结算和找零. 4.可在一定时间段参与店内活动(自行设计或参考官网信息). 5.模拟打印小票的功能(写到文件中). 类图: 建立IFood接口实现各类食物信息的打印: public interface IFood { /** * 打印输出食物

  • Java点餐小程序之黑心商人

    很久以前,有一个女人,开了一家酒店,她的名字叫孙二娘.下面是她找人做的点餐小程序.代码如下: import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.ArrayList; import java.util.Scanner; import java.util.Set; public class MyDianCai { sta

  • java实现KFC点餐小程序

    本文实例为大家分享了java实现KFC点餐系统的具体代码,供大家参考,具体内容如下 package KFC点餐系统; //food 类 public class Kfcfood { private String fname ; private int fnumb=1; private float fPrice; public Kfcfood() { super(); } public Kfcfood(String fname, int fnumb, float fPrice) { super()

  • python3实现点餐系统

    本文实例为大家分享了python3实现点餐系统的具体代码,供大家参考,具体内容如下 题目: 某餐厅外卖每天更新菜品,但是搭配价格是不变的,具体如下: "今天菜单如下","1  宫保鸡丁","2  青椒鸡米粒" ,"3  白萝卜焖肉", "4  蒜薹腊肉", "5  豆腐包肉 ", "6  鲤鱼跃龙门", "7  凉拌莲藕", "8  红烧

  • Java使用抽象工厂模式实现的肯德基消费案例详解

    本文实例讲述了Java使用抽象工厂模式实现的肯德基消费案例.分享给大家供大家参考,具体如下: 一.模式定义 抽象工厂模式提供了一个接口,用于创建相关或者依赖对象的家族,而不需要指定具体实现类. 抽象工厂模式允许客户使用抽象接口来创建一组相关的产品,客户类和工厂类分开,客户需要任何产品的时候,只需要向工厂请求即可,客户无须修改就可以获得新产品. 二.模式举例 1 模式分析 我们借用爸爸和儿子到肯德基店消费这一场景来说明这一模式,进行抽象分析后的截图如下 2 抽象工厂模式的静态建模 3 代码示例 3

  • python+pyqt5实现KFC点餐收银系统

    本文实例为大家分享了python实现KFC点餐收银系统的具体代码,供大家参考,具体内容如下 这个kfc收银系统我实现了的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠劵购买餐品结算和找零. 4.可在一定时间段参与店内活动 5.模拟打印小票的功能(写到文件中). 工程文件: 肯德基.py文件实现各功能.kfctip.txt文件用于打印小票.picture文件里存放界面所需的图片.其他四个文件为各界面布局. 主界面: 正常餐品点餐界面: 套餐点餐界面: 活动套餐点餐界面

  • java Gui实现肯德基点餐收银系统

    大家应该都去麦当劳或肯德基吃过快餐,参考肯德基官网的信息模拟肯德基快餐店的收银系统,简单的java Gui模拟的肯德基收银系统. 1.系统介绍 同学们应该都去麦当劳或肯德基吃过快餐吧?请同学们参考肯德基官网的信息模拟肯德基快餐店的收银系统,合理使用C++/python/Java,结合设计模式(2种以上)至少实现系统的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠劵购买餐品结算和找零. 4.可在一定时间段参与店内活动(自行设计或参考官网信息). 5.模拟打印小票的功能

  • java实现肯德基收银系统

    参考肯德基官网的信息模拟肯德基快餐店的收银系统,合理使用C++或Java或Python结合设计模式(2种以上)至少实现系统的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠券购买餐品结算和找零. 4.可在一定时间段参与店内活动(自行设计或参考官网信息). 5.模拟打印小票的功能(写到文件中). 小票信息保存 class print{ String s=""; //存订单信息 } 食物工厂 interface FoodFactory{ public Hambu

  • 前端开发之便利店收银系统代码

    1+X前端初级JQ 社区便利店收银系统代码 <body> <input type="text" id="t" value="" disabled="disabled" /> <form id="main" action="" method=""> <span>4.5</span> <input type

  • C#实现简单超市收银系统

    本文实例为大家分享了C#实现简单超市收银系统的具体代码,供大家参考,具体内容如下 今天使用一直学习的抽象类等做了个简单的超市收银系统,不难,不过里面的逻辑要理清楚. 首先我们要知道我们要实现的功能. 超市一般有仓库,有收银台,有各种各样的商品,每一个商品都有Name,Price,Count等属性.我们可以写一个抽象父类,这样我们才能将每件商品属性设置一样.新建一个ProduckFather类作为商品的父类 并将属性和构造函数写好,每次新建商品时写好参数就会方便很多 abstract class

  • C++实现KFC点餐系统

    本文实例为大家分享了C++实现KFC点餐系统的具体代码,供大家参考,具体内容如下 一.题目名称:模拟肯德基收银系统 二.题目内容: 同学们应该都去麦当劳或肯德基吃过快餐吧?请同学们参考肯德基官网的信息模拟肯德基快餐店的收银系统,合理使用C++或Java或Python结合设计模式(2种以上)至少实现系统的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠劵购买餐品结算和找零. 4.可在一定时间段参与店内活动(自行设计或参考官网信息). 5.模拟打印小票的功能(写到文件中)

  • Java实现KFC点餐系统过程解析

    这篇文章主要为大家详细介绍了java实现KFC点餐系统,模拟肯德基快餐店的收银系统,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 同学们应该都去麦当劳或肯德基吃过快餐吧?请同学们参考肯德基官网的信息模拟肯德基快餐店的收银系统,合理使用C++/python/Java,结合设计模式(2种以上)至少实现系统的以下功能: 1.正常餐品结算和找零. 2.基本套餐结算和找零. 3.使用优惠劵购买餐品结算和找零. 4.可在一定时间段参与店内活动(自行设计或参考官网信息). 5.模拟打印小票的功能(写到文件

  • Java实战之超市收银管理系统的实现

    目录 一.项目简述 二.项目运行 三.效果图 四.核心代码 品类信息控制层 用户信息控制层 商品信息控制层 一.项目简述 本系统主要实现的功能有:收银.报表.用户管理.商品管理.销售管理.进货退货管理.仓库管 理等等功能. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Spring+ SpringMVC + MyBatis + ThymeLeaf

  • Python PyQt5实现的简易计算器功能示例

    本文实例讲述了Python PyQt5实现的简易计算器功能.分享给大家供大家参考,具体如下: 这里剩下计算函数(self.calculator)未实现,有兴趣的朋友可以实现它 [知识点] 1.利用循环添加按钮部件,及给每个按钮设置信号/槽 2.给按钮设置固定大小:button.setFixedSize(QtCore.QSize(60,30)) 3.取事件的的发送者(此例为各个按钮)的文本: self.sender().text() [效果图] [源代码] import sys from PyQt

随机推荐