精华内容
下载资源
问答
  • 大型在线机票预定网站系统源代码,部分需要修改,基本测试无误
  • 小型飞机票预定系统,可以对登陆的用户进行增删改查,也可以对机票进行管理,对飞机的起飞时间段进行查询,预定之际想要的时间段的飞机票
  • 机票预定系统

    2014-12-29 11:06:37
    关于机票预定系统的需求分析er设计和有关代码
  • 数据库课程设计-机票预定系统(文档中有代码),大学生课程设计,也可做毕业论文
  • 两种不同款同程网“机票、酒店预定”搜索代码
  • 飞机机票预定系统.zip

    2019-06-27 23:36:08
    飞机机票订购系统,C/C++课程设计,用户数据,航班数据保存到文件中(信息保存 txt文件 中)。 基础功能:订票,退票,用户录入(姓名,身份证,性别……),航班删除,航班修改,航班查询(按到达点,航班号……)...
  • 机票预定系统(java)

    2015-12-07 11:55:08
    代码比较简单,但能完美运行,适合初学者。
  • C#数据库应用系统(机票预定系统),方便初学者学习SQL语句,很使用的代码
  • 该资源分为三部分,一本分为实验报告,一部分为python代码,一部分为SqlServer的语句以及插入的数据。可以根据自己的需要进行修改和删除
  • 1 课题综述 1.1 预期目标 1.2 面对的问题 1.3 需解决的关键技术 2 系统分析 2.1 涉及的知识基础 2.2 总体方案 3 系统设计 3.1 制作要求 ...4 代码编写 5 程序调试 6 运行与测试 总 结 致 谢 参考文献
  • 很全的资料:软件工程的步骤下来的,文档资料很全!唯一的缺憾就是没有代码部分啦~
  • 详细设计主要包括系统数据库访问的实现,主要功能模块的具体实现,模块实现关键代码等。最后对系统进行功能测试,并对测试结果进行分析总结。 包括程序毕设程序源代码一份,数据库一份,完美运行。配置环境里面有...
  • 1、尺寸:210*200 (含话费+游戏+机票3个功能)     源代码: ... 2、尺寸:300*

    1、尺寸:210*200 (含话费+游戏+机票3个功能)

     

     

    源代码:

    <iframe frameborder="0"marginheight="0" marginwidth="0" border="0"scrolling="no" width="210" height="200"src="http://www.taobao.com/go/app/tbk_app/chongzhi_210_200.php?pid=mm_11487878_0_0&size_w=210&size_h=200&stru_phone=1&stru_game=1&stru_travel=1"></iframe>


     2、尺寸:300*170(含话费+游戏+机票3个功能)

     

     

    源代码:

    <iframe frameborder="0"marginheight="0" marginwidth="0" border="0"scrolling="no" width="300" height="170"src="http://www.taobao.com/go/app/tbk_app/chongzhi_300_170.php?pid=mm_11487878_0_0&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1"></iframe>


     3、尺寸:210*30(只有话费充值功能)

     

     

    源代码:

    <iframe frameborder="0"marginheight="0" marginwidth="0" border="0"scrolling="no" width="210" height="30"src="http://www.taobao.com/go/app/tbk_app/chongzhi_210_30.php?pid=mm_11487878_0_0&size_w=210&size_h=30&stru_phone=1&stru_game=1&stru_travel=1"></iframe>


     4、尺寸:950*30(含话费+游戏+机票3个功能)

     

     

    源代码:

    <iframe frameborder="0"marginheight="0" marginwidth="0" border="0"scrolling="no" width="950" height="30"src="http://www.taobao.com/go/app/tbk_app/chongzhi_950_30_nologo.php?pid=mm_11487878_0_0&size_w=950&size_h=30&stru_phone=1&stru_game=1&stru_travel=1"></iframe>

     
     
    代码参数:(以上通用)
    stru_phone=1 改为0去除手机充值
    stru_game=1  改为0去除游戏充值
    stru_travel=1  改为0去除旅游充值 

     

    展开全文
  • 【包含内容】【下载代码】 【功能介绍】 这是一个航空客运订票系统,此系统的目标是为了提高订购飞机票预定的效率达到方便客户的目的,具有对飞机票的订购、修改、需求、区域等信息进行管理及维护的功能。普通...

    【包含内容】【下载代码

    【功能介绍】

    这是一个航空客运订票系统,此系统的目标是为了提高订购飞机票预定的效率达到方便客户的目的,具有对飞机票的订购、修改、需求、区域等信息进行管理及维护的功能。普通注册用户可以通过此系统进行个人信息的修改,可以进行订票、退订、修改、查询及留言等基本操作。系统开发的总体任务是实现飞机订票的系统化、规范化和简洁化。

    该航空客运订票系统系统的功能需求描述如下:

    按每个用户的用户名和密码进行登录,以管理员身份登录后则可以对普通用户发布的订单,留言等进行管理;发布新航班信息。

    以普通用户身份登录后则可以进行用户操作,如个人资料修改,查询航班,订单等操作。

    3.1 管理员功能需求

    (1)管理员登录和身份验证。

    (2)查看站点的基本信息,包括已经注册会员的数量,管理员发布的新航班信息和注册用户

    订单、留言、订购机票的数量等。

    (3)管理订单源,主要是对注册用户提交的未结帐的订单进行删除操作。

    (4)管理航班信息,包括增加、修改和删除航班信息。

    (5)添加新航班信息,把要发布的新航班的一些相关信息录入到数据库。

    (6)管理新航班信息,查看管理员发布的航班信息信息和对新航班的信息进行删除操作。

    3.2 注册用户功能需求

    (1)新用户的注册。

    (2)用户的登录和身份验证。

    (3)查询航班信息。

    (4)预订机票,把用户预订机票的信息添加到数据库。

    (5)取消订单,用户可以取消自己之前的订单重新订购。

    (6)显示用户的订购信息。

    (7)留言,用户可以发表自己的意见和想法来跟管理员交流。

    (8)修改注册信息。

     

     

    在本网站中,用户进入网站,查看管理员设置好的相关航空客运订票系统信息机票信息查询等,也可以登录网站系统进行预订飞机票。有疑问,有对网站建议改进的还可以给管理员留言改进。

    机票查询:用户可以通过此模块查询机票航班的相关信息

    注册登录: 顾名思义,你要预定飞机票,这一步是必须的.

    网站留言:,有疑问,有对网站建议改进的还可以给管理员留言改进。

    个人中心:登录可以查看你预定过的飞机票的订单状态

    网站首页:首页就是网站的门面系统的大门

     

    【论文部分截图】

    image.png

    image.png

    image.png

    【运行效果】

    image.png

    image.png

    image.png

    image.png

    image.png

    image.png

     

    image.png

    image.png

    image.png

    image.png

    image.png

     

    展开全文
  • 飞机票订票系统C语言

    2013-05-30 20:41:26
    飞机票预定系统c语言源代码,帮助毕业设计开拓思维
  • python3+pyqt5实现简易机票预订系统

    千次阅读 热门讨论 2020-03-10 21:56:14
    一个简易的机票预订系统,填写信息、预定机票、获得取票码、取票/更改机票,还拥有机票查询系统。 以下是完成后的文件目录 首先创建数据库,可以用代码,也可以用可视化工具(Navicat等等),这里给出代码 import ...

    一个简易的机票预订系统,填写信息、预定机票、获得取票码、取票/更改机票,还拥有机票查询系统。
    以下是完成后的文件目录
    在这里插入图片描述
    首先创建数据库,可以用代码,也可以用可视化工具(Navicat等等),这里给出代码

    import pymysql
    
    conn = pymysql.connect(host='localhost', user='root', passwd='123456', db='bjx', charset='utf8')
    cur = conn.cursor()
    cur.execute("""CREATE TABLE IF NOT EXISTS informationmessage(
        real_name varchar(10) PRIMARY KEY,
        sex varchar(2),
        work_unit varchar(20),
        id varchar(20),
        travel_time varchar(11),
        start_place varchar(10),
        end_place varchar(10),
        class varchar(5),
        advance varchar(5),
        total_money varchar(5),
        code varchar(7))""")
    conn.commit()
    
    cur.execute("""CREATE TABLE IF NOT EXISTS flight(
        flight_number varchar(10) PRIMARY KEY,
        start_place varchar(10),
        end_place varchar(10),
        travel_time varchar(11),
        first_class varchar(4),
        business_class varchar(4),
        economy_class varchar(4),
        count_passenger varchar(4))""")
    conn.commit()
    

    完成后可以用可视化工具查看
    在这里插入图片描述
    在这里插入图片描述
    接下来编写界面

    1.预订机票主界面

    在这里插入图片描述
    界面的图片可自行寻找,放在目录中的picture里,设置在没有预定机票成功之前,预定金交付按钮无法点击,以下是代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_MainWindow1(object):
        def setupUi(self, MainWindow):
            MainWindow.setObjectName("MainWindow")
            MainWindow.resize(908, 474)
            self.centralwidget = QtWidgets.QWidget(MainWindow)
            self.centralwidget.setObjectName("centralwidget")
            self.pushButton = QtWidgets.QPushButton(self.centralwidget)
            self.pushButton.setGeometry(QtCore.QRect(720, 60, 121, 41))
            self.pushButton.setObjectName("pushButton")
            self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
            self.pushButton_2.setGeometry(QtCore.QRect(720, 170, 121, 41))
            self.pushButton_2.setObjectName("pushButton_2")
            self.label = QtWidgets.QLabel(self.centralwidget)
            self.label.setGeometry(QtCore.QRect(0, 0, 701, 441))
            self.label.setObjectName("label")
            MainWindow.setCentralWidget(self.centralwidget)
            self.menubar = QtWidgets.QMenuBar(MainWindow)
            self.menubar.setGeometry(QtCore.QRect(0, 0, 908, 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", "MainWindow"))
            self.pushButton.setText(_translate("MainWindow", "预定机票"))
            self.pushButton_2.setText(_translate("MainWindow", "预订金交付"))
            self.label.setText(_translate("MainWindow", "picture_1"))
    

    2.输入旅客信息界面

    在这里插入图片描述
    输入时间时必须与数据表中航班的时间相同,始发地、目的地也是如此,以下是代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_Form1(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(665, 381)
            self.pushButton = QtWidgets.QPushButton(Form)
            self.pushButton.setGeometry(QtCore.QRect(540, 310, 91, 41))
            self.pushButton.setObjectName("pushButton")
            self.lineEdit = QtWidgets.QLineEdit(Form)
            self.lineEdit.setGeometry(QtCore.QRect(100, 30, 131, 31))
            self.lineEdit.setObjectName("lineEdit")
            self.lineEdit_2 = QtWidgets.QLineEdit(Form)
            self.lineEdit_2.setGeometry(QtCore.QRect(100, 100, 51, 31))
            self.lineEdit_2.setObjectName("lineEdit_2")
            self.lineEdit_3 = QtWidgets.QLineEdit(Form)
            self.lineEdit_3.setGeometry(QtCore.QRect(100, 160, 191, 31))
            self.lineEdit_3.setObjectName("lineEdit_3")
            self.lineEdit_4 = QtWidgets.QLineEdit(Form)
            self.lineEdit_4.setGeometry(QtCore.QRect(100, 230, 161, 31))
            self.lineEdit_4.setText("")
            self.lineEdit_4.setObjectName("lineEdit_4")
            self.lineEdit_5 = QtWidgets.QLineEdit(Form)
            self.lineEdit_5.setGeometry(QtCore.QRect(430, 30, 41, 31))
            self.lineEdit_5.setText("")
            self.lineEdit_5.setObjectName("lineEdit_5")
            self.lineEdit_6 = QtWidgets.QLineEdit(Form)
            self.lineEdit_6.setGeometry(QtCore.QRect(510, 30, 31, 31))
            self.lineEdit_6.setText("")
            self.lineEdit_6.setObjectName("lineEdit_6")
            self.lineEdit_7 = QtWidgets.QLineEdit(Form)
            self.lineEdit_7.setGeometry(QtCore.QRect(580, 30, 31, 31))
            self.lineEdit_7.setText("")
            self.lineEdit_7.setObjectName("lineEdit_7")
            self.lineEdit_8 = QtWidgets.QLineEdit(Form)
            self.lineEdit_8.setGeometry(QtCore.QRect(430, 100, 121, 31))
            self.lineEdit_8.setObjectName("lineEdit_8")
            self.lineEdit_9 = QtWidgets.QLineEdit(Form)
            self.lineEdit_9.setGeometry(QtCore.QRect(430, 160, 121, 31))
            self.lineEdit_9.setObjectName("lineEdit_9")
            self.comboBox = QtWidgets.QComboBox(Form)
            self.comboBox.setGeometry(QtCore.QRect(430, 230, 101, 31))
            self.comboBox.setObjectName("comboBox")
            self.comboBox.addItem("")
            self.comboBox.addItem("")
            self.comboBox.addItem("")
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(20, 30, 41, 31))
            self.label.setObjectName("label")
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(20, 100, 41, 31))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(20, 160, 71, 31))
            self.label_3.setObjectName("label_3")
            self.label_4 = QtWidgets.QLabel(Form)
            self.label_4.setGeometry(QtCore.QRect(20, 230, 51, 31))
            self.label_4.setObjectName("label_4")
            self.label_5 = QtWidgets.QLabel(Form)
            self.label_5.setGeometry(QtCore.QRect(370, 30, 31, 31))
            self.label_5.setObjectName("label_5")
            self.label_6 = QtWidgets.QLabel(Form)
            self.label_6.setGeometry(QtCore.QRect(480, 30, 21, 31))
            self.label_6.setObjectName("label_6")
            self.label_7 = QtWidgets.QLabel(Form)
            self.label_7.setGeometry(QtCore.QRect(550, 35, 21, 21))
            self.label_7.setObjectName("label_7")
            self.label_8 = QtWidgets.QLabel(Form)
            self.label_8.setGeometry(QtCore.QRect(620, 35, 21, 21))
            self.label_8.setObjectName("label_8")
            self.label_9 = QtWidgets.QLabel(Form)
            self.label_9.setGeometry(QtCore.QRect(370, 100, 51, 31))
            self.label_9.setObjectName("label_9")
            self.label_10 = QtWidgets.QLabel(Form)
            self.label_10.setGeometry(QtCore.QRect(370, 160, 51, 31))
            self.label_10.setObjectName("label_10")
            self.label_11 = QtWidgets.QLabel(Form)
            self.label_11.setGeometry(QtCore.QRect(370, 230, 31, 31))
            self.label_11.setObjectName("label_11")
    
            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.comboBox.setItemText(0, _translate("Form", "头等舱"))
            self.comboBox.setItemText(1, _translate("Form", "商务舱"))
            self.comboBox.setItemText(2, _translate("Form", "经济舱"))
            self.label.setText(_translate("Form", "姓名"))
            self.label_2.setText(_translate("Form", "性别"))
            self.label_3.setText(_translate("Form", "工作单位"))
            self.label_4.setText(_translate("Form", "身份证"))
            self.label_5.setText(_translate("Form", "时间"))
            self.label_6.setText(_translate("Form", "年"))
            self.label_7.setText(_translate("Form", "月"))
            self.label_8.setText(_translate("Form", "日"))
            self.label_9.setText(_translate("Form", "始发地"))
            self.label_10.setText(_translate("Form", "目的地"))
            self.label_11.setText(_translate("Form", "舱位"))
    

    点击预订,成功后就会出现提示,其代码在后续系统代码中给出
    在这里插入图片描述

    3.定金支付界面

    在这里插入图片描述
    此时主界面的订金交付按钮可用,点击支付后,数据表中的advance属性更改为已交,以下是界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    
    class Ui_Form2(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(242, 164)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(30, 40, 81, 21))
            self.label.setObjectName("label")
            self.pushButton = QtWidgets.QPushButton(Form)
            self.pushButton.setGeometry(QtCore.QRect(120, 100, 71, 31))
            self.pushButton.setObjectName("pushButton")
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(110, 40, 51, 21))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(170, 40, 21, 21))
            self.label_3.setObjectName("label_3")
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "应交订金:"))
            self.pushButton.setText(_translate("Form", "支付"))
            self.label_2.setText(_translate("Form", "50"))
            self.label_3.setText(_translate("Form", "元"))
    

    4.取票通知和账单界面

    在这里插入图片描述
    定金交付后会给出取票通知和账单界面,取票码为随机6位数,并存入数据表以便之后取票时的匹配,取票时间设定为航班的前一天,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    from PyQt5.QtWidgets import *
    
    
    class Ui_Form3(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(296, 492)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(20, 20, 51, 21))
            self.label.setObjectName("label")
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(90, 20, 91, 21))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(20, 70, 41, 21))
            self.label_3.setObjectName("label_3")
            self.label_4 = QtWidgets.QLabel(Form)
            self.label_4.setGeometry(QtCore.QRect(90, 70, 51, 21))
            self.label_4.setObjectName("label_4")
            self.label_5 = QtWidgets.QLabel(Form)
            self.label_5.setGeometry(QtCore.QRect(20, 120, 71, 21))
            self.label_5.setObjectName("label_5")
            self.label_6 = QtWidgets.QLabel(Form)
            self.label_6.setGeometry(QtCore.QRect(90, 120, 151, 21))
            self.label_6.setObjectName("label_6")
            self.label_7 = QtWidgets.QLabel(Form)
            self.label_7.setGeometry(QtCore.QRect(20, 170, 61, 21))
            self.label_7.setObjectName("label_7")
            self.label_8 = QtWidgets.QLabel(Form)
            self.label_8.setGeometry(QtCore.QRect(90, 170, 91, 21))
            self.label_8.setObjectName("label_8")
            self.label_9 = QtWidgets.QLabel(Form)
            self.label_9.setGeometry(QtCore.QRect(20, 220, 61, 21))
            self.label_9.setObjectName("label_9")
            self.label_10 = QtWidgets.QLabel(Form)
            self.label_10.setGeometry(QtCore.QRect(90, 220, 91, 21))
            self.label_10.setObjectName("label_10")
            self.label_11 = QtWidgets.QLabel(Form)
            self.label_11.setGeometry(QtCore.QRect(20, 280, 71, 21))
            self.label_11.setObjectName("label_11")
            self.label_12 = QtWidgets.QLabel(Form)
            self.label_12.setGeometry(QtCore.QRect(100, 280, 91, 21))
            self.label_12.setObjectName("label_12")
            self.label_13 = QtWidgets.QLabel(Form)
            self.label_13.setGeometry(QtCore.QRect(20, 330, 41, 21))
            self.label_13.setObjectName("label_13")
            self.label_14 = QtWidgets.QLabel(Form)
            self.label_14.setGeometry(QtCore.QRect(90, 330, 91, 21))
            self.label_14.setObjectName("label_14")
            self.label_15 = QtWidgets.QLabel(Form)
            self.label_15.setGeometry(QtCore.QRect(20, 390, 71, 21))
            self.label_15.setObjectName("label_15")
            self.label_16 = QtWidgets.QLabel(Form)
            self.label_16.setGeometry(QtCore.QRect(100, 390, 151, 21))
            self.label_16.setObjectName("label_16")
            self.label_17 = QtWidgets.QLabel(Form)
            self.label_17.setGeometry(QtCore.QRect(20, 450, 61, 21))
            self.label_17.setObjectName("label_17")
            self.label_18 = QtWidgets.QLabel(Form)
            self.label_18.setGeometry(QtCore.QRect(90, 450, 91, 16))
            self.label_18.setObjectName("label_18")
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "姓名:"))
            self.label_2.setText(_translate("Form", "name"))
            self.label_3.setText(_translate("Form", "性别:"))
            self.label_4.setText(_translate("Form", "gender"))
            self.label_5.setText(_translate("Form", "身份证:"))
            self.label_6.setText(_translate("Form", "id"))
            self.label_7.setText(_translate("Form", "始发地:"))
            self.label_8.setText(_translate("Form", "startplace"))
            self.label_9.setText(_translate("Form", "目的地:"))
            self.label_10.setText(_translate("Form", "endplace"))
            self.label_11.setText(_translate("Form", "舱位要求:"))
            self.label_12.setText(_translate("Form", "roomlevel"))
            self.label_13.setText(_translate("Form", "金额:"))
            self.label_14.setText(_translate("Form", "aftermoney"))
            self.label_15.setText(_translate("Form", "取票时间:"))
            self.label_16.setText(_translate("Form", "time"))
            self.label_17.setText(_translate("Form", "取票码:"))
            self.label_18.setText(_translate("Form", "code"))
    
    
    class Inform_Bill(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.informui_bill = Ui_Form3()
            self.informui_bill.setupUi(self)
    

    5.旅客操作界面

    在这里插入图片描述
    与预订机票界面类似,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_MainWindow2(object):
        def setupUi(self, MainWindow):
            MainWindow.setObjectName("MainWindow")
            MainWindow.resize(1086, 464)
            self.centralwidget = QtWidgets.QWidget(MainWindow)
            self.centralwidget.setObjectName("centralwidget")
            self.pushButton = QtWidgets.QPushButton(self.centralwidget)
            self.pushButton.setGeometry(QtCore.QRect(840, 20, 121, 41))
            self.pushButton.setObjectName("pushButton")
            self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
            self.pushButton_2.setGeometry(QtCore.QRect(840, 130, 121, 41))
            self.pushButton_2.setObjectName("pushButton_2")
            self.label = QtWidgets.QLabel(self.centralwidget)
            self.label.setGeometry(QtCore.QRect(0, 0, 821, 411))
            self.label.setObjectName("label")
            MainWindow.setCentralWidget(self.centralwidget)
            self.menubar = QtWidgets.QMenuBar(MainWindow)
            self.menubar.setGeometry(QtCore.QRect(0, 0, 1086, 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", "MainWindow"))
            self.pushButton.setText(_translate("MainWindow", "取机票"))
            self.pushButton_2.setText(_translate("MainWindow", "更改航班"))
            self.label.setText(_translate("MainWindow", "picture_2"))
    

    6.取票界面

    在这里插入图片描述
    输入取票码,在数据表中进行匹配,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_Form4(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(410, 244)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(40, 70, 111, 31))
            self.label.setObjectName("label")
            self.lineEdit = QtWidgets.QLineEdit(Form)
            self.lineEdit.setGeometry(QtCore.QRect(160, 70, 181, 31))
            self.lineEdit.setObjectName("lineEdit")
            self.pushButton = QtWidgets.QPushButton(Form)
            self.pushButton.setGeometry(QtCore.QRect(250, 160, 91, 41))
            self.pushButton.setObjectName("pushButton")
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "请输入取票码:"))
            self.pushButton.setText(_translate("Form", "取票"))
    

    7.机票界面

    取票码匹配成功时,显示机票界面,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    class Ui_Form6(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(296, 492)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(20, 20, 51, 21))
            self.label.setObjectName("label")
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(90, 20, 91, 21))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(20, 70, 41, 21))
            self.label_3.setObjectName("label_3")
            self.label_4 = QtWidgets.QLabel(Form)
            self.label_4.setGeometry(QtCore.QRect(90, 70, 51, 21))
            self.label_4.setObjectName("label_4")
            self.label_5 = QtWidgets.QLabel(Form)
            self.label_5.setGeometry(QtCore.QRect(20, 120, 71, 21))
            self.label_5.setObjectName("label_5")
            self.label_6 = QtWidgets.QLabel(Form)
            self.label_6.setGeometry(QtCore.QRect(90, 120, 151, 21))
            self.label_6.setObjectName("label_6")
            self.label_7 = QtWidgets.QLabel(Form)
            self.label_7.setGeometry(QtCore.QRect(20, 170, 61, 21))
            self.label_7.setObjectName("label_7")
            self.label_8 = QtWidgets.QLabel(Form)
            self.label_8.setGeometry(QtCore.QRect(90, 170, 91, 21))
            self.label_8.setObjectName("label_8")
            self.label_9 = QtWidgets.QLabel(Form)
            self.label_9.setGeometry(QtCore.QRect(20, 220, 61, 21))
            self.label_9.setObjectName("label_9")
            self.label_10 = QtWidgets.QLabel(Form)
            self.label_10.setGeometry(QtCore.QRect(90, 220, 91, 21))
            self.label_10.setObjectName("label_10")
            self.label_11 = QtWidgets.QLabel(Form)
            self.label_11.setGeometry(QtCore.QRect(20, 280, 71, 21))
            self.label_11.setObjectName("label_11")
            self.label_12 = QtWidgets.QLabel(Form)
            self.label_12.setGeometry(QtCore.QRect(100, 280, 91, 21))
            self.label_12.setObjectName("label_12")
            self.label_13 = QtWidgets.QLabel(Form)
            self.label_13.setGeometry(QtCore.QRect(20, 330, 41, 21))
            self.label_13.setObjectName("label_13")
            self.label_14 = QtWidgets.QLabel(Form)
            self.label_14.setGeometry(QtCore.QRect(90, 330, 91, 21))
            self.label_14.setObjectName("label_14")
            self.label_15 = QtWidgets.QLabel(Form)
            self.label_15.setGeometry(QtCore.QRect(20, 390, 71, 21))
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "姓名:"))
            self.label_2.setText(_translate("Form", "name"))
            self.label_3.setText(_translate("Form", "性别:"))
            self.label_4.setText(_translate("Form", "gender"))
            self.label_5.setText(_translate("Form", "身份证:"))
            self.label_6.setText(_translate("Form", "id"))
            self.label_7.setText(_translate("Form", "始发地:"))
            self.label_8.setText(_translate("Form", "startplace"))
            self.label_9.setText(_translate("Form", "目的地:"))
            self.label_10.setText(_translate("Form", "endplace"))
            self.label_11.setText(_translate("Form", "舱位要求:"))
            self.label_12.setText(_translate("Form", "roomlevel"))
            self.label_13.setText(_translate("Form", "金额:"))
            self.label_14.setText(_translate("Form", "totalmoney"))
    

    如果当前时间不是取票时间,则会提示
    在这里插入图片描述

    8.更改航班界面

    在这里插入图片描述
    与订票时输入的信息类似,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    
    class Ui_Form8(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(442, 346)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(40, 40, 41, 31))
            self.label.setObjectName("label")
    
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(150, 40, 21, 31))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(220, 40, 21, 21))
            self.label_3.setObjectName("label_3")
            self.label_4 = QtWidgets.QLabel(Form)
            self.label_4.setGeometry(QtCore.QRect(300, 40, 21, 21))
            self.label_4.setObjectName("label_4")
    
            self.label_5 = QtWidgets.QLabel(Form)
            self.label_5.setGeometry(QtCore.QRect(30, 110, 61, 31))
            self.label_5.setObjectName("label_5")
            self.label_6 = QtWidgets.QLabel(Form)
            self.label_6.setGeometry(QtCore.QRect(30, 180, 61, 31))
            self.label_6.setObjectName("label_6")
            self.label_7 = QtWidgets.QLabel(Form)
            self.label_7.setGeometry(QtCore.QRect(10, 240, 71, 31))
            self.label_7.setObjectName("label_7")
            self.lineEdit = QtWidgets.QLineEdit(Form)
            self.lineEdit.setGeometry(QtCore.QRect(100, 40, 41, 31))
            self.lineEdit.setObjectName("lineEdit")
    
            self.lineEdit_2 = QtWidgets.QLineEdit(Form)
            self.lineEdit_2.setGeometry(QtCore.QRect(180, 40, 31, 31))
            self.lineEdit_2.setText("")
            self.lineEdit_2.setObjectName("lineEdit_2")
            self.lineEdit_3 = QtWidgets.QLineEdit(Form)
            self.lineEdit_3.setGeometry(QtCore.QRect(260, 40, 31, 31))
            self.lineEdit_3.setText("")
            self.lineEdit_3.setObjectName("lineEdit_3")
    
            self.lineEdit_4 = QtWidgets.QLineEdit(Form)
            self.lineEdit_4.setGeometry(QtCore.QRect(100, 110, 151, 31))
            self.lineEdit_4.setObjectName("lineEdit_4")
            self.lineEdit_5 = QtWidgets.QLineEdit(Form)
            self.lineEdit_5.setGeometry(QtCore.QRect(100, 180, 151, 31))
            self.lineEdit_5.setObjectName("lineEdit_5")
            self.pushButton = QtWidgets.QPushButton(Form)
            self.pushButton.setGeometry(QtCore.QRect(320, 290, 91, 41))
            self.pushButton.setObjectName("pushButton")
            self.comboBox = QtWidgets.QComboBox(Form)
            self.comboBox.setGeometry(QtCore.QRect(100, 240, 101, 31))
            self.comboBox.setObjectName("comboBox")
            self.comboBox.addItem("")
            self.comboBox.addItem("")
            self.comboBox.addItem("")
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "时间:"))
    
            self.label_2.setText(_translate("Form", "年"))
            self.label_3.setText(_translate("Form", "月"))
            self.label_4.setText(_translate("Form", "日"))
    
            self.label_5.setText(_translate("Form", "始发地:"))
            self.label_6.setText(_translate("Form", "目的地:"))
            self.label_7.setText(_translate("Form", "舱位要求:"))
            self.pushButton.setText(_translate("Form", "预定"))
            self.comboBox.setItemText(0, _translate("Form", "头等舱"))
            self.comboBox.setItemText(1, _translate("Form", "商务舱"))
            self.comboBox.setItemText(2, _translate("Form", "经济舱"))
    

    9.交款界面

    最后一切都准备完成后就进入交款界面,以下给出界面代码

    from PyQt5 import QtCore, QtGui, QtWidgets
    
    
    class Ui_Form5(object):
        def setupUi(self, Form):
            Form.setObjectName("Form")
            Form.resize(242, 164)
            self.label = QtWidgets.QLabel(Form)
            self.label.setGeometry(QtCore.QRect(30, 40, 81, 21))
            self.label.setObjectName("label")
            self.pushButton = QtWidgets.QPushButton(Form)
            self.pushButton.setGeometry(QtCore.QRect(120, 100, 71, 31))
            self.pushButton.setObjectName("pushButton")
            self.label_2 = QtWidgets.QLabel(Form)
            self.label_2.setGeometry(QtCore.QRect(110, 40, 51, 21))
            self.label_2.setObjectName("label_2")
            self.label_3 = QtWidgets.QLabel(Form)
            self.label_3.setGeometry(QtCore.QRect(170, 40, 21, 21))
            self.label_3.setObjectName("label_3")
    
            self.retranslateUi(Form)
            QtCore.QMetaObject.connectSlotsByName(Form)
    
        def retranslateUi(self, Form):
            _translate = QtCore.QCoreApplication.translate
            Form.setWindowTitle(_translate("Form", "Form"))
            self.label.setText(_translate("Form", "应交款:"))
            self.pushButton.setText(_translate("Form", "支付"))
            self.label_2.setText(_translate("Form", "money"))
            self.label_3.setText(_translate("Form", "元"))
    

    以下系统代码,代码注释较清楚,这里就不多解释了,直接上代码

    10.机票预定系统

    from 预订机票主界面 import *
    from 输入旅客信息界面 import *
    from 预订金支付界面 import *
    from 取票通知和账单界面 import *
    from 创建数据表 import *
    import sys
    import random
    import pandas as pd
    from PyQt5.QtWidgets import *
    from PyQt5.QtGui import QPixmap
    
    
    class BOOK_Planeticket(QMainWindow):
        def __init__(self):
            QMainWindow.__init__(self)
            self.mainui_agency = Ui_MainWindow1()
            self.mainui_agency.setupUi(self)
    
            # 给按钮绑定方法
            btn_book = self.mainui_agency.pushButton
            btn_book.clicked.connect(travelinfor.show)
            self.btn_paybook = self.mainui_agency.pushButton_2
            self.btn_paybook.clicked.connect(advance.show)
            # 设置按钮不可用
            self.btn_paybook.setEnabled(False)
    
        # 主界面显示
        def book(self):
            # 主界面图片
            self.mainui_agency.label.setPixmap(QPixmap('./picture/picture1.jpg'))
            # 完全填充
            self.mainui_agency.label.setScaledContents(True)
            mainbook.show()
    
    
    class Traveller_Information(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.inforui_travel = Ui_Form1()
            self.inforui_travel.setupUi(self)
    
            # 给按钮绑定方法
            btn_inforbook = self.inforui_travel.pushButton
            btn_inforbook.clicked.connect(self.save_information)
    
        def save_information(self):
            # 获取信息值
            self.name = self.inforui_travel.lineEdit.text()
            self.sex = self.inforui_travel.lineEdit_2.text()
            self.work_unit = self.inforui_travel.lineEdit_3.text()
            self.id = self.inforui_travel.lineEdit_4.text()
            self.year = self.inforui_travel.lineEdit_5.text()
            self.month = self.inforui_travel.lineEdit_6.text()
            self.day = self.inforui_travel.lineEdit_7.text()
            self.start_place = self.inforui_travel.lineEdit_8.text()
            self.end_place = self.inforui_travel.lineEdit_9.text()
            self.cabin = self.inforui_travel.comboBox.currentText()
            
            # 匹配航班
            self.match_information()
        
        def match_information(self):
            self.time = self.year + '-' + self.month + '-' + self.day
            sql = "select * from flight where travel_time='%s' and start_place='%s' and end_place='%s'" % (self.time, self.start_place, self.end_place)
            cur.execute(sql)
            if cur.execute(sql):
                QMessageBox.information(self, '恭喜您', '已成功安排航班,请交定金!', QMessageBox.Yes)
                travelinfor.hide()
                mainbook.btn_paybook.setEnabled(True)
            else:
                QMessageBox.information(self, '很遗憾', '没有合适的航班!', QMessageBox.Yes)
    
    
    class Pay_Advance(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.payui_advance = Ui_Form2()
            self.payui_advance.setupUi(self)
    
            # 给按钮绑定方法
            btn_payadvance = self.payui_advance.pushButton
            btn_payadvance.clicked.connect(self.pay_advance)
            # 定义取票码
            self.six_code = ''
            # 定义乘载人数
            self.count_passenger = 0
    
        def pay_advance(self):
            # 获取匹配航班的舱位价格
            sql = "select first_class, business_class, economy_class from flight where travel_time='%s' and start_place='%s' and end_place='%s'"\
                  % (travelinfor.time, travelinfor.start_place, travelinfor.end_place)
            cur.execute(sql)
            # 生成价格framedata表
            df = pd.read_sql(sql, conn)
            # 获取framedata单个元素
            first_price = df.iloc[0, 0]
            business_price = df.iloc[0, 1]
            economy_price = df.iloc[0, 2]
            button = QMessageBox.information(self, '恭喜您', '已成功预定航班!', QMessageBox.Yes)
            self.count_passenger += 1
    
            # 生成六位随机数的取票码
            for i in range(6):
                self.six_code += chr(random.randrange(ord('0'), ord('9') + 1))
    
            # 将乘客信息放进数据表
            sql1 = "insert into informationmessage(real_name, sex, work_unit, id, travel_time, start_place, end_place, class, advance, total_money, code)" \
                  " values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
            cur.execute(sql1, (travelinfor.name, travelinfor.sex, travelinfor.work_unit, travelinfor.id, travelinfor.time, travelinfor.start_place,
                               travelinfor.end_place, travelinfor.cabin, '已交', '未交', self.six_code))
            # 更新乘载人数
            sql2 = "update flight set count_passenger='%s' where travel_time='%s' and start_place='%s' and end_place='%s'" % \
                   (str(self.count_passenger), travelinfor.time, travelinfor.start_place, travelinfor.end_place)
            cur.execute(sql2)
            conn.commit()
    
            if button == QMessageBox.Yes:
                # 取票界面信息显示
                inbill.informui_bill.label_2.setText(travelinfor.name)
                inbill.informui_bill.label_4.setText(travelinfor.sex)
                inbill.informui_bill.label_6.setText(travelinfor.id)
                inbill.informui_bill.label_8.setText(travelinfor.start_place)
                inbill.informui_bill.label_10.setText(travelinfor.end_place)
                inbill.informui_bill.label_12.setText(travelinfor.cabin)
                if travelinfor.cabin == '头等舱':
                    price = first_price
                elif travelinfor.cabin == '商务舱':
                    price = business_price
                elif travelinfor.cabin == '经济舱':
                    price = economy_price
                afterprice = str(int(price) - 50)
                # 价格显示
                inbill.informui_bill.label_14.setText(afterprice)
                # 显示前一天时间
                inbill.informui_bill.label_16.setText(travelinfor.year + '-' + travelinfor.month + '-' + str(int(travelinfor.day) - 1))
                inbill.informui_bill.label_18.setText(self.six_code)
                advance.hide()
                inbill.show()
    
    
    if __name__ == "__main__":
        app = QApplication(sys.argv)
    
        inbill = Inform_Bill()
        advance = Pay_Advance()
        travelinfor = Traveller_Information()
        mainbook = BOOK_Planeticket()
        mainbook.book()
    
        sys.exit(app.exec_())
    

    11.机票旅客操作系统

    from 旅客操作主界面 import *
    from 取票界面 import *
    from 交款界面 import *
    from 机票界面 import *
    from 更改航班界面 import *
    from 创建数据表 import *
    from 取票通知和账单界面 import *
    import sys
    import pandas as pd
    import random
    import time
    from PyQt5.QtWidgets import *
    from PyQt5.QtGui import QPixmap
    
    
    class Passenger_Operate(QMainWindow):
        def __init__(self):
            QMainWindow.__init__(self)
            self.mainui_passenger = Ui_MainWindow2()
            self.mainui_passenger.setupUi(self)
    
            # 按钮绑定方法
            btn_getticket = self.mainui_passenger.pushButton
            btn_getticket.clicked.connect(gticket.show)
            btn_changeflight = self.mainui_passenger.pushButton_2
            btn_changeflight.clicked.connect(gticket.click)
    
        # 主界面显示
        def operate(self):
            self.mainui_passenger.label.setPixmap(QPixmap('./picture/picture2.jpg'))
            # 完全填充
            self.mainui_passenger.label.setScaledContents(True)
            pasoperate.show()
            # 是否已点击更改按钮
            self.i = 0
    
    
    class Get_Ticket(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.getui_ticket = Ui_Form4()
            self.getui_ticket.setupUi(self)
    
            btn_getticket = self.getui_ticket.pushButton
            btn_getticket.clicked.connect(self.gettic)
            # 是否已点击主界面上更改航班按钮
            self.n = 0
    
        def click(self):
            self.n = 1
            gticket.show()
    
        def gettic(self):
            # 获取输入的取票码并匹配
            code = self.getui_ticket.lineEdit.text()
            sql1 = "select * from informationmessage where code='%s'" % code
            cur.execute(sql1)
            if cur.execute(sql1):
                gticket.hide()
                QMessageBox.information(self, '提示', '取票码正确!', QMessageBox.Yes)
                df = pd.read_sql(sql1, conn)
                self.name = df.iloc[0, 0]
                self.sex = df.iloc[0, 1]
                self.id = df.iloc[0, 3]
                self.travel_time = df.iloc[0, 4]
                self.strat_place = df.iloc[0, 5]
                self.end_place = df.iloc[0, 6]
                self.cabin = df.iloc[0, 7]
                self.advance = df.iloc[0, 8]
                self.total_money = df.iloc[0, 9]
                self.code = df.iloc[0, 10]
                if self.n == 0:
                    self.getpri()
                    # 取票日期为航班日期前一天
                    spldate = self.travel_time.split('-')
                    getdate = spldate[0] + '-' + spldate[1] + '-' + str(int(spldate[2]) - 1)
                    spltime = time.strftime('%Y-%m-%d', time.localtime(time.time())).split('-')
                    gettime = spltime[0] + '-' + str(int(spltime[1])) + '-' + str(int(spltime[2]))
                    # 判断取票时间是否正确
                    if gettime == getdate:
                        payment.current_pay()
                    else:
                        QMessageBox.information(self, '对不起', '取票时间已过,请更改航班!', QMessageBox.Yes)
                elif self.n == 1:
                    chflight.show()
            else:
                QMessageBox.information(self, '对不起', '取票码错误,请重新输入!', QMessageBox.Yes)
    
        def getpri(self):
            # 获取航班价格和已乘载人数
            sql2 = "select first_class, business_class, economy_class, count_passenger from flight where travel_time='%s' and start_place='%s' and end_place='%s'" \
                   % (self.travel_time, self.strat_place, self.end_place)
            cur.execute(sql2)
            # 判断航班是否取消
            if cur.execute(sql2):
                df = pd.read_sql(sql2, conn)
                first_price = df.iloc[0, 0]
                business_price = df.iloc[0, 1]
                economy_price = df.iloc[0, 2]
                self.count_passenger = df.iloc[0, 3]
                if self.cabin == '头等舱':
                    self.price = first_price
                elif self.cabin == '商务舱':
                    self.price = business_price
                elif self.cabin == '经济舱':
                    self.price = economy_price
                self.afterprice = str(int(self.price) - 50)
            else:
                QMessageBox.information(self, '对不起', '该航班已取消,请更改航班!', QMessageBox.Yes)
    
    
    class Payment(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.payment_ui = Ui_Form5()
            self.payment_ui.setupUi(self)
    
            btn_payment = self.payment_ui.pushButton
            btn_payment.clicked.connect(ticket.plane_ticket)
    
        def current_pay(self):
            # 显示更改前或后的交款金额
            if pasoperate.i == 0:
                self.payment_ui.label_2.setText(gticket.afterprice)
            elif pasoperate.i == 1:
                self.payment_ui.label_2.setText(chflight.afterprice)
            payment.show()
    
    
    class Ticket(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.ticket_ui = Ui_Form6()
            self.ticket_ui.setupUi(self)
    
        def plane_ticket(self):
            self.ticket_ui.label_2.setText(gticket.name)
            self.ticket_ui.label_4.setText(gticket.sex)
            self.ticket_ui.label_6.setText(gticket.id)
            # 显示更改前或后的信息
            if pasoperate.i == 0:
                self.ticket_ui.label_8.setText(gticket.strat_place)
                self.ticket_ui.label_10.setText(gticket.end_place)
                self.ticket_ui.label_12.setText(gticket.cabin)
                self.ticket_ui.label_14.setText(gticket.price)
            elif pasoperate.i == 1:
                self.ticket_ui.label_8.setText(chflight.newstart_place)
                self.ticket_ui.label_10.setText(chflight.newend_place)
                self.ticket_ui.label_12.setText(chflight.newcabin)
                self.ticket_ui.label_14.setText(chflight.price)
            payment.hide()
            ticket.show()
            # 重置更改按钮是否点击
            pasoperate.i = 0
            # 更新信息表的全额为已交
            sql = "update informationmessage set total_money='%s' where code='%s'" % ('已交', gticket.code)
            cur.execute(sql)
            conn.commit()
    
    
    class Change_Fliht(QWidget):
        def __init__(self):
            QWidget.__init__(self)
            self.changeui_flight = Ui_Form8()
            self.changeui_flight.setupUi(self)
    
            btn_changeflight = self.changeui_flight.pushButton
            btn_changeflight.clicked.connect(self.changefli)
            # 定义取票码
            self.six_code = ''
    
        def changefli(self):
            # 更改按钮已点击
            pasoperate.i = 1
            newyear = self.changeui_flight.lineEdit.text()
            newmonth = self.changeui_flight.lineEdit_2.text()
            newday = self.changeui_flight.lineEdit_3.text()
            self.newstart_place = self.changeui_flight.lineEdit_4.text()
            self.newend_place = self.changeui_flight.lineEdit_5.text()
            self.newcabin = self.changeui_flight.comboBox.currentText()
            self.time = newyear + '-' + newmonth + '-' + newday
            # 获取航班价格、乘载人数、航班代码
            sql1 = "select first_class, business_class, economy_class, count_passenger, flight_number from flight where travel_time='%s' and start_place='%s' and end_place='%s'"\
                   % (self.time, self.newstart_place, self.newend_place)
            cur.execute(sql1)
            if cur.execute(sql1):
                df = pd.read_sql(sql1, conn)
                first_price = df.iloc[0, 0]
                business_price = df.iloc[0, 1]
                economy_price = df.iloc[0, 2]
                count_passenger = df.iloc[0, 3]
                number = df.iloc[0, 4]
                # 生成六位随机数的取票码
                for i in range(6):
                    self.six_code += chr(random.randrange(ord('0'), ord('9') + 1))
                # 更新乘客信息
                sql2 = "update informationmessage set travel_time='%s',start_place='%s',end_place='%s',class='%s',code='%s' where real_name='%s' and sex='%s'" \
                       " and id='%s'" % (self.time, self.newstart_place, self.newend_place, self.newcabin, self.six_code, gticket.name, gticket.sex, gticket.id)
                cur.execute(sql2)
                # 更新原航班乘载人数
                sql3 = "update flight set count_passenger='%s' where travel_time='%s' and start_place='%s' and end_place='%s'" \
                       % (str(int(gticket.count_passenger) - 1), gticket.travel_time, gticket.strat_place, gticket.end_place)
                cur.execute(sql3)
                # 更新新航班乘载人数
                sql4 = "update flight set count_passenger='%s' where flight_number='%s'" % (str(int(count_passenger) + 1), number)
                cur.execute(sql4)
                conn.commit()
                button = QMessageBox.information(self, '恭喜您', '已更改航班!', QMessageBox.Yes)
                if button == QMessageBox.Yes:
                    # 显示取票界面信息
                    inbill.informui_bill.label_2.setText(gticket.name)
                    inbill.informui_bill.label_4.setText(gticket.sex)
                    inbill.informui_bill.label_6.setText(gticket.id)
                    inbill.informui_bill.label_8.setText(self.newstart_place)
                    inbill.informui_bill.label_10.setText(self.newend_place)
                    inbill.informui_bill.label_12.setText(self.newcabin)
                    if self.newcabin == '头等舱':
                        self.price = first_price
                    elif self.newcabin == '商务舱':
                        self.price = business_price
                    elif self.newcabin == '经济舱':
                        self.price = economy_price
                    self.afterprice = str(int(self.price) - 50)
                    inbill.informui_bill.label_14.setText(self.afterprice)
                    inbill.informui_bill.label_16.setText(newyear + '-' + newmonth + '-' + str(int(newday) - 1))
                    inbill.informui_bill.label_18.setText(self.six_code)
                    chflight.hide()
                    inbill.show()
                    gticket.n = 0
            else:
                QMessageBox.information(self, '对不起', '没有合适的航班!', QMessageBox.Yes)
    
    
    if __name__ == "__main__":
        app = QApplication(sys.argv)
    
        inbill = Inform_Bill()
        gticket = Get_Ticket()
        ticket = Ticket()
        payment = Payment()
        chflight = Change_Fliht()
        pasoperate = Passenger_Operate()
        pasoperate.operate()
    
        sys.exit(app.exec_())
    

    12.航空公司查询系统

    在这里插入图片描述
    连接数据库、数据表成功后,点击浏览数据按钮,显示航班信息,可添加和删除航班,也可双击表格对航班某个值进行修改,以下给出代码

    from PyQt5 import QtWidgets, QtCore, QtSql
    from PyQt5.QtWidgets import *
    import sys
    
    
    class MainUi(QtWidgets.QMainWindow):
        def __init__(self):
            super().__init__()
            self.initUi()
    
        # 初始化界面
        def initUi(self):
            # 设置窗口标题
            self.setWindowTitle("数据库管理")
            # 设置窗口大小
            self.resize(1150, 500)
    
            # 创建一个窗口部件
            self.widget = QtWidgets.QWidget()
            # 创建一个网格布局
            self.grid_layout = QtWidgets.QGridLayout()
            # 设置窗口部件的布局为网格布局
            self.widget.setLayout(self.grid_layout)
    
            # 创建一个按钮组
            self.group_box = QtWidgets.QGroupBox('数据库按钮')
            self.group_box_layout = QtWidgets.QVBoxLayout()
            self.group_box.setLayout(self.group_box_layout)
            # 创建一个表格部件
            self.table_widget = QtWidgets.QTableView()
            # 将上述两个部件添加到网格布局中
            self.grid_layout.addWidget(self.group_box, 0, 0)
            self.grid_layout.addWidget(self.table_widget, 0, 1)
    
            # 创建按钮组的按钮
            self.b_connect_data = QtWidgets.QPushButton("连接数据库")
            self.b_connect_data.clicked.connect(self.connect_data)
            self.b_view_data = QtWidgets.QPushButton("浏览数据")
            self.b_view_data.clicked.connect(self.view_data)
            self.b_add_row = QtWidgets.QPushButton("添加一行")
            self.b_add_row.clicked.connect(self.add_row_data)
            self.b_delete_row = QtWidgets.QPushButton("删除一行")
            self.b_delete_row.clicked.connect(self.del_row_data)
            self.b_close = QtWidgets.QPushButton("退出")
            self.b_close.clicked.connect(self.close)
            # 添加按钮到按钮组中
            self.group_box_layout.addWidget(self.b_connect_data)
            self.group_box_layout.addWidget(self.b_view_data)
            self.group_box_layout.addWidget(self.b_add_row)
            self.group_box_layout.addWidget(self.b_delete_row)
            self.group_box_layout.addWidget(self.b_close)
    
            # 设置UI界面的核心部件
            self.setCentralWidget(self.widget)
    
            self.b_view_data.setDisabled(True)
            self.b_add_row.setDisabled(True)
            self.b_delete_row.setDisabled(True)
    
        # 连接数据库
        def connect_data(self):
    
            self.db = QtSql.QSqlDatabase.addDatabase('QMYSQL')
            self.db.setHostName("localhost")
            self.db.setDatabaseName("bjx")
            self.db.setUserName("root")
            self.db.setPassword("123456")
            if self.db.open():
                 QMessageBox.information(self, "恭喜你", "连接数据库成功", QMessageBox.Yes)
            else:
                 QMessageBox.information(self, "很遗憾", "连接数据库错误", QMessageBox.Yes)
    
            self.b_view_data.setDisabled(False)
    
        # 浏览数据
        def view_data(self):
    
            # 实例化一个可编辑数据模型
            self.model = QtSql.QSqlTableModel()
            self.table_widget.setModel(self.model)
    
            # 设置模型的数据表
            self.model.setTable('flight')
            # 允许字段更改
            self.model.setEditStrategy(QtSql.QSqlTableModel.OnFieldChange)
            # 查询所有数据
            self.model.select()
            # 设置表格头
            self.model.setHeaderData(0, QtCore.Qt.Horizontal, '航班代号')
            self.model.setHeaderData(1, QtCore.Qt.Horizontal, '始发地')
            self.model.setHeaderData(2, QtCore.Qt.Horizontal, '目的地')
            self.model.setHeaderData(3, QtCore.Qt.Horizontal, '航班时间')
            self.model.setHeaderData(4, QtCore.Qt.Horizontal, '头等舱价格')
            self.model.setHeaderData(5, QtCore.Qt.Horizontal, '商务舱价格')
            self.model.setHeaderData(6, QtCore.Qt.Horizontal, '经济舱价格')
            self.model.setHeaderData(7, QtCore.Qt.Horizontal, '乘载人数')
    
            self.b_add_row.setDisabled(False)
            self.b_delete_row.setDisabled(False)
    
        # 添加一行数据
        def add_row_data(self):
            # 如果存在实例化的数据模型对象
            if self.model:
                self.model.insertRows(self.model.rowCount(), 1)
            else:
                self.connect_data()
    
        # 删除一行数据
        def del_row_data(self):
            if self.model:
                self.model.removeRow(self.table_widget.currentIndex().row())
            else:
                self.connect_data()
    
    
    if __name__ == "__main__":
        app = QtWidgets.QApplication(sys.argv)
        myshow = MainUi()
        myshow.initUi()
        myshow.show()
        sys.exit(app.exec_())
    

    到这里就结束了,功能很简易,有什么问题欢迎留言

    展开全文
  • 早上重构一个机票预定页面,页面有个增加和删除乘机人的功能,所以就用JQuery 的 .remove() 属性和.append() 属性写了一个有增加、删除div层文本内容效果的JS代码,具体可运行下面的代码进行演示查看,这个代码总共...

    早上重构一个机票预定页面,页面有个增加和删除乘机人的功能,所以就用JQuery 的 .remove() 属性和.append() 属性写了一个有增加、删除div层文本内容效果的JS代码,具体可运行下面的代码进行演示查看,这个代码总共有两个JS效果:

    1、 增加、删除div层文本内容

    2、下拉框选择效果

    在线演示:http://mj.588cy.com/jquery/24.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>MJBlog(mj.588cy.com)</title>
    <style type="text/css">
    em{ font-style: normal; }
    * {margin:0;padding:0;font-size:12px;list-style:none;border:0;}
    body{ margin:0px; padding:0px; background-color:#f0f0f0; font-family:Arial, Helvetica, sans-serif;}
    a{ text-decoration:none;}
    .top{ width:970px; height:30px; border-bottom:1px solid #dbdbdb; margin:0px auto;}
    .logo{ width:300px; height:30px; line-height:30px; float:left; font-size:14px; margin:0px 5px;}
    .logo a{ color:#666666;}
    .denglu{ height:30px; line-height:30px; float:right; font-size:14px;}
    .denglu a{ color:#666666; margin:0px 10px;}
    .clear{ display:block; height:0px; line-height:0px; font-size:0px; clear:both;}
    
    .box{ width:950px; height:auto; margin:0px auto; border-top:1px solid #f9f9f9; padding:30px 10px;}
    .ck{ width:950px; height:auto; padding-top:10px;}
    .ck_list{ width:950px; height:22px; padding:10px 0px; color:#555555; font-size:12px; border-bottom:1px solid #dddddd;}
    .ck_list input{ color:#555555; overflow:hidden;}
    .ck_list_xm{ height:22px; display:block; padding:0px 7px 0px 14px; line-height:22px; float:left;}
    .ck_list_xm em{ color:#ff005b; font-family:"宋体"; margin-left:10px;}
    .ck_input_a{ width:100px; height:20px; float:left; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin-right:4px;}
    .ck_list_lb,.span_fd{width:98px;}
    .ck_list_zj,.span_fd_zj{ width:68px;}
    .ck_list_bx,.span_fd_bx{ width:58px;}
    .ck_list_fd{ height:20px; border:1px solid #bababa; display:block; float:left; background:url(http://mj.588cy.com/img/bg_mj.png) no-repeat right -620px;}
    .touming_jq{ position:relative; z-index:1;}
    .ck_input_b{width:70px;}
    .ck_input_c{width:40px;}
    .ck_input_e{width:30px;}
    .ck_input_b,.ck_input_c,.ck_input_e{ float:left; border:0px; height:20px;padding:0px 3px; _height:17px; _padding:3px 3px 0px 3px; cursor:pointer;}
    .span_lb{ width:22px; height:20px; float:left; cursor:pointer;}
    .span_fd,.span_fd_zj,.span_fd_bx{ height:auto; border-width:0px 1px 1px 1px; border-style:solid; border-color:#bababa; position:absolute; left:-1px; top:21px; z-index:999; display:none; background-color:#FFFFFF;}
    .span_fd span{width:92px;}
    .span_fd_zj span{ width:62px;}
    .span_fd_bx span{ width:52px;}
    .span_fd span,.span_fd_zj span,.span_fd_bx span{height:20px; line-height:20px; padding:2px 3px; display:block; cursor:pointer;}
    .ck_input_d{ width:165px; height:20px; float:left; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin:0px 36px 0px 6px;}
    .shanchu{ width:14px; height:14px; margin:3px 17px; display:block; float:right; background:url(http://mj.588cy.com/img/bg_mj.png) no-repeat 0px -661px; cursor:pointer;}
    
    .zj{ width:922px; height:22px; padding:10px 14px; font-size:12px;}
    .zj_an{ display:block; width:83px; height:22px; float:left; background:url(http://mj.588cy.com/img/bg_mj.png) no-repeat 0px -695px; cursor:pointer;}
    .zj_ts{display:block; height:22px; float:left; color:#ff075b; line-height:22px; padding-left:10px;}
    .zj_input_a{float:right; margin:5px 5px 0px 0px; _margin:1px 1px 0px 0px;}
    .zj_bc{display:block; height:22px; float:right; line-height:22px; color:#555555;}
    </style>
    <script type="text/javascript" src="http://mj.588cy.com/img/jquery-1.2.6.min.js"></script>
    <script type="text/javascript">
    	  $(document).ready(function(){	    			
    			$(".jq_ck,.jq_val").click(function(){
    				$(this).siblings(".jq_lb").slideToggle(100);
    				$(".ck_list_fd").removeClass("touming_jq");
    				$(this).parent(".ck_list_fd").addClass("touming_jq")
    			});
    			
    			$("*").click(function(){
    				$(".jq_lb").hide();
    			});
    			
    			$(".jq_lb span").hover(function(){
    			$(this).css({"background-color":"#0066CC","color":"#FFFFFF"})
    			},function(){
    			$(this).css({"background-color":"#ffffff","color":"#555555"})
    			});
    			
    			$(".jq_lb span").click(function(){
    			 $(this).parent().siblings(".jq_val").val($(this).html())
    			});
    
    			$(".shanchu").click(function(){
    			  if ($(".ck_list").size() > 1) { 
                  $(this).parent().remove(); 
                    } else {
                     $(".zj_ts").html("一个订单至少保留1位乘机人"); 
                    } 
    			});
    			
    			$(".zj_an").click(function(){
    			 $(".ck").append($(".ck_list:first").clone(true));
    			 $(".zj_ts").html("");
    			});			
    	  });
        </script>
    </head>
    
    <body>
    <div class="top">
    <div class="logo"><a href="http://mj.588cy.com">MJBlog</a></div>
    <div class="denglu"><a href="#">登录</a><a href="#">注册</a></div>
    <div class="clear"></div>
    </div>
    
    <div class="box">
    <div class="ck">
    <div class="ck_list">
    <span class="ck_list_xm">姓名<em>*</em></span>
    <input name="" type="text" class="ck_input_a" />
    <span class="ck_list_lb ck_list_fd">
    <input name="" type="text" class="ck_input_b jq_val" value="成人(>12岁)" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd jq_lb"><span>成人(>12岁)</span><span>儿童(2-12岁)</span></div>
    </span>
    
    <span class="ck_list_xm">证件号码<em>*</em></span>
    <span class="ck_list_zj ck_list_fd">
    <input name="" type="text" class="ck_input_c jq_val" value="身份证" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd_zj jq_lb"><span>身份证</span><span>护照</span><span>其它</span></div>
    </span>
    <input name="" type="text" class="ck_input_d" />
    
    <span class="ck_list_xm">保险</span>
    <span class="ck_list_bx ck_list_fd">
    <input name="" type="text" class="ck_input_e jq_val" value="0份" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd_bx jq_lb"><span>0份</span><span>1份</span><span>2份</span></div>
    </span>
    <span class="ck_list_xm">¥20/份</span>
    <span class="shanchu"></span>
    <span class="clear"></span></div>
    
    <div class="ck_list">
    <span class="ck_list_xm">姓名<em>*</em></span>
    <input name="" type="text" class="ck_input_a" />
    <span class="ck_list_lb ck_list_fd">
    <input name="" type="text" class="ck_input_b jq_val" value="成人(>12岁)" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd jq_lb"><span>成人(>12岁)</span><span>儿童(2-12岁)</span></div>
    </span>
    
    <span class="ck_list_xm">证件号码<em>*</em></span>
    <span class="ck_list_zj ck_list_fd">
    <input name="" type="text" class="ck_input_c jq_val" value="身份证" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd_zj jq_lb"><span>身份证</span><span>护照</span><span>其它</span></div>
    </span>
    <input name="" type="text" class="ck_input_d" />
    
    <span class="ck_list_xm">保险</span>
    <span class="ck_list_bx ck_list_fd">
    <input name="" type="text" class="ck_input_e jq_val" value="0份" οnmοusedοwn="return false" />
    <div class="span_lb jq_ck"></div>
    <div class="clear"></div>
    <div class="span_fd_bx jq_lb"><span>0份</span><span>1份</span><span>2份</span></div>
    </span>
    <span class="ck_list_xm">¥20/份</span>
    <span class="shanchu"></span>
    <span class="clear"></span></div>
    </div>
    
    <div class="zj">
    <span class="zj_an"></span>
    <span class="zj_ts"></span>
    <span class="zj_bc">保存至常用联系人</span>
    <input name="" type="checkbox" value="" class="zj_input_a" />
    <span class="clear"></span>
    </div>
    </div>
    </body>
    </html>


    展开全文
  • 看题点这里哦 这题是线段树(点这里,大佬...其实只需要开辟一个数组统计每次预定的航班区间和机票数量,最有一次遍历数组将结果添加进容器中返回即可。 来人上代码 class Solution { private: const int M...
  • 识别区分为:机票代码,票务号码,开票日期,补码,税后金额等 环境 python3.5 / 3.6 依赖项安装:pip install -r requirements.txt -i 有GPU环境的可修改安装requirements.txt对应版本的tensorflow-gpu,config.py...
  • jquery text点击文本框预定机票火车票城市选择 jquery表单提交衣服尺寸选择勾选获取value值 jquery input文本框模拟select选择框获取选定的value值 jquery text文本框限制字数或文本框提示字数...
  • 控制台控件

    2013-04-25 12:57:31
    航空公司机票预定系统c#源代码
  • void Passenger::PreTicket()//预定机票 { Node* s = new Node; Node* p; this->head = s; this->tail = s; this->tail->link = NULL; cout 输入以 0 为结束" ; int sit; string n; cout请...
  • 一.机票预定 机票预定页面,具体如下: 二.代码详解 //全部代码 <form action="###"> <h2>机票预定</h2> <div class="type"> ...
  • 给大家介绍利用C#完成航班机票信息查询,航班机票预定等功能。代码简单易懂,非常不错,具有参考借鉴价值,需要的朋友参考下吧
  • 4、机票预定功能。详细的查询。 6、导游推荐功能,导游信息,照片。 7、美图欣赏功能,支持分类。 9、进行在线报价和订单功能,意见反馈功能 10、可以根据自己情况预订所有列出的旅游线路。 11、编辑、修改、...
  • js 级联下拉框的生成

    2008-09-17 17:57:23
    最近做页面时,碰到js级联下拉框显示的问题。先用下拉框选择大类,小类...{'100':'旅游度假','subList':{'100001':'旅游资讯','100002':'旅行预定','100003':'旅行线路','100004':'机票预定','100005':'酒店预订',...
  • 机票预定的业务场景中,jsp页面需要记录航班相关信息和联系人相关信息还要记录多个乘客的相关信息。这就需要在向后端传值时某乘客属性为多个对象。 实现 所有的数据封装成一个Moel类,其中航班信息和联系人信息...
  • 现在的航空公司都有自己的订票系统相比大家都看过或用过...该程序显示一个带有下列选项的菜单:预订机票、取消预订、查看某人是否预定机票,以及显示预订乘客。这些信息保存在一个按照字母排列的名字链表中。在程...

空空如也

空空如也

1 2 3
收藏数 52
精华内容 20
关键字:

机票预定代码