公交查询系统的设计与实现_第1页
公交查询系统的设计与实现_第2页
公交查询系统的设计与实现_第3页
公交查询系统的设计与实现_第4页
公交查询系统的设计与实现_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、装订线毕业设计(论文)报告纸公交查询系统设计毕业论文信息工程系毕业设计(论文)诚信承诺我谨在此承诺:本人所写的毕业论文 公交查询系统制作 ,系本人独自完成,凡涉及其他作者的观点和材料,均作了注释与说明,若有不实,后果本人承担。承诺人(签名):2010年6 月1 日摘 要为推进地名信息服务工作,开发的“南京市公交查询系统”软件(以下简称“本软件”),用于提供快速的、简便的城市公交站点、线路查询服务,也可以用于制作地铁、公路等交通信息查询系统。本软件的核心是对选择好的车次进行路线的查询,或者输入所要查询的车站名,点击“查询”按钮,查询所有含有该站的车次及相应的停靠站。此处既可以“精确查询”也可以是

2、“模糊查询”,“模糊查询”主要方便那些对站名不是很清楚,但知道其中的一部分的乘客,系统可以帮助他们快速的查出。本软件用JSP作为开发语言并结合SQL数据库,只要将公交站点等信息输入数据库,就可以很快构建成一个简单、实用的本地公交查询系统。关键词: JSP、 SQL数据库、 车次管理, 公交查询系统。English AbstractTo promote the geographical names information service work, I developed the "Nanjing Public Transport Query System" (hereina

3、fter referred to as the "Software"), used to provide fast, convenient city bus stops, in line inquiry service can also be used to make subway , highway and other transportation information inquiry system. The core of this software is a good choice of trips to routes of inquiry, o

4、r enter the station name to the query, click the "Search" button, check all the trips with the station and the corresponding stops. Here both "Exact" can be "fuzzy query," "Fuzzy query," the main benefit of those on the station were not clear, but that on

5、e part of the passenger, the system can help them quickly find out. This software is developed using JSP as a language and SQL database integration, as long as the bus stops and other information entered into the database, you can quickly build into a simple, practical system of local public tr

6、ansport inquiry。Keywords: JSP, SQL databases, sell management, transit system.目  录1 绪论511 研发的背景512 可行性分析62 需求分析621 用户功能需求分析62.1.1 所有乘客可以使用该系统进行车次及路线的查询。72.1.2 本系统应具有简单易用功能强大特点,有较强的纠错能力(随着软件的版本升级功能和纠错能力也可以不断得到提高)。如果在网络上运行,应有数据在线更新的能力以及在线查询的能力。由于毕业设计时间有限,本系统没有设计

7、成网络运行版的,在以后的时间会进一步完善该系统。72.1.3由于车次经常会变化所以需要一个管理员身份去管理这个公交查询系统方便更改车次的信息以及车辆的出行线路。722 系统功能分析73 系统总体结构设计731 模块结构设计732 数据库设计74 系统详细设计84.1 代码设计84.2 人机界面设计84.3 本系统的界面和源代码104.31 管 理 员 登 陆 成 功 界 面104.3.2 公 交 信 息 修 改 界 面134.3.3 公 交 查 询 信 息 界 面144.3.4 公 交 职 员 管 理 界 面165

8、 系 统 难 点 分 析196结 论207致 谢208 参考文献211 绪论随着我国经济的高速发展,人们生活水平的提高,越来越多的人开始热衷于到外地旅游。那么对于这些外来旅游者,首先搞清这个城市的公交路线显的很重要!南京,作为一个六朝古都,每年都要吸引大量的游客,为了方便广大游客,我的毕业设计就以公交查询系统做为设计课题。我认为这样的系统应该具有很好的实用性!乘客只需选择车次或输入要查询的站点,系统会快速的给出结果,同时管理员也可以很容易的修改车次。正是基于这样的目的我开发了公交查询系统。下面就根据软件工程理论的规范要求对软件的开发背景、意义、需求分析等方面进行分析:11 

9、研发的背景城市规模的逐步扩大,也使整个城市的交通干道越来越复杂,在这种情况下,公交查询系统显的非常的方便和高效,在这个背景下我开发了公交查询系统。本系统的开发有很大的社会意义,能给广大市民提供极大的方便。12 可行性分析可行性分析是对系统进行全面、概要的分析。它的任务是确定项目开发时是否必要和可行。它的主要目标是:进一步明确系统的目标、规模和功能,对系统开发背景、必要性和意义进行调查分析,并且提出系统的逻辑模型和各种可能的方案,从而为系统开发项目的决策提供科学依据。主要从三个方面进行研究:(1)技术可行性:以现有技术进行系统开发及系统实施,是完全可行的。首先,从自身来分析,经过2年多

10、的学习已经初步掌握了JSP控件、SQL数据库等方面的编程技巧,对该软件的设计并不存在技术上的难点。第二方面,在设计这个系统之前,我进行了一系列先期调研,查阅了有关使用JSP进行数据库开发方面的论著、教材和论文,更多是利用网络的便利条件,从网上查阅了北京、上海、广州、昆明等大型城市的公交查询系统,并认真地对其进行了分析研究,由于时间紧,任务重,我没有更多的时间来开发完整的系统,所以就以查询作为这个系统的核心。其次,从数据库方面来分析,也是可行的。系统所建立的数据库表中包含有五个字段:bus_number,bus_station1, bus_station2, bus_station3, bus_

11、station4。bus_number用来存放车次,bus_station1, bus_station2, bus_station3, bus_station4这四个字段用来存放站点。(2)经济可行性:从这方面来说,本系统的开发作为课题来说不需要什么经济投入,因此来说也是可行的。(3)营运可行性:国内很早就开始应用公交查询系统,我国大部分城市都有公交查询系统。那么从这方面来说是可行的。2 需求分析随着我国经济的高速发展,人们生活水平的提高,越来越多的人开始热衷于到外地旅游。那么对于这些外来旅游者,首先搞清这个城市的公交路线显的很重要!南京,作为一个六朝古都,每年都要吸引大量的游客,为

12、了满足这些游客熟悉公交路线的需求,特以公交查询系统为设计课题。本软件不仅能给游客带来方便,也能给广大市民提供方便。我认为这样的系统应该具有很好的实用性!开发本系统的目标就是立足广大乘客的实际,着眼于公交业的未来发展,规范公交管理,提高服务质量,方便乘客查询,并为此设计该系统。21 用户功能需求分析2.1.1 所有乘客可以使用该系统进行车次及路线的查询。2.1.2 本系统应具有简单易用功能强大特点,有较强的纠错能力(随着软件的版本升级功能和纠错能力也可以不断得到提高)。如果在网络上运行,应有数据在线更新的能力以及在线查询的能力。由于毕业设计时间有限,本系统没有设计成

13、网络运行版的,在以后的时间会进一步完善该系统。2.1.3由于车次经常会变化所以需要一个管理员身份去管理这个公交查询系统方便更改车次的信息以及车辆的出行线路。22 系统功能分析本系统提供了的车次查询功能、路线查询功能。乘客可以方便的进行查询,以防乘错车次。同时管理员身份方便管理车辆的车次和出行线路。当然有些功能的智能化不是很强,系统有待进一步来完善。也希望老师及朋友给予指导,提出您们的建议!在此,先向您们表示感谢!3 系统总体结构设计本系统采用结构化设计的方法来实现系统总体功能,提高系统的各项指标,即将整个系统合理的划分成各个功能模块,正确地处理模块之间和模块内部的联系以及和

14、数据库的联系,定义各模块的内部结构,通过对模块的设计和模块之间关系的系统来实现整个系统的功能31 模块结构设计本系统共分两个模块:(1)车次查询模块:车次查询模块主要实现选择好车次后,得到相应车次的路线的功能;(2)路线查询模块:路线查询模块中,既可以进行精确查询,也可以进行模糊查询,当乘客不知道确切的站名时,只要输入其中的一个或多个字就可以进行查询。32 数据库设计本系统的数据库设计,采用了SQL进行数据库设计。通过对市场的调查,建立一个bus数据库已能满足要求,本数据库中的bus表中,建立了五个字段:bus_number,bus_station1, bus_statio

15、n2, bus_station3, bus_station4。结构如下:表中bus_number用来保存车次,数据类型定义为数字;bus_station1, bus_station2, bus_station3, bus_station4用来保存站点,类型定义为文本,但对于文本属性来说每个字段的最大长度为 255,超过这个长度系统不予显示,因此设四个字段来控制,便于以后数据的扩充。这里如果用一个字段来放站点,当向字段录入数据时,系统不会提示数据已满,但程序执行后,显示“数据源被截断”,而用四个字段来放站点,只要每个字段录入数据不超过规定的最大值就避免了以上错误的发生。数据库结构如何设计无疑在整

16、个系统设计中占有重要的地位,所以我们在开发一个系统之前,一定要考虑好数据库该怎么设计,怎么样设计方便接口实现和界面显示。当然也可以采用另外的组织方式,只要满足一定的规则,符合条件并且有利于编程的实现,都可以采用。4 系统详细设计4.1 代码设计采用dreamweaver工具开发客户端用户体验,制作JSP网页然后使用Tomcat作为服务器连接SQL数据库4.2 人机界面设计、Imports System.Data.SqlClientImports System.IOPublic Class Login Private sqlobject As SQL_Conn Pr

17、ivate cmdstr As String Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click cmdstr = "select * from user where us

18、er_id ='" + TextBox1.Text + "' and pwd= '" + TextBox2.Text + "' and style= '" + ComboBox1.Text + "'" Try If sqlobject.Is_SQL_Cmd(cmdstr) Then main.m_Login = True main.m_style = ComboBox1.Text main.main_Load(sender, e) zhiyuanguanli.userid =

19、TextBox1.Text MsgBox(ComboBox1.Text + "成功登陆") main.ToolStripStatusLabel1.Text = "就绪" Me.Close() Else MsgBox("请填写正确的用户名、密码和用户类型!") End If Catch ex As Exception main.OPErr.WriteErr(ex) End Try End Sub Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System

20、.EventArgs) Handles MyBase.Load ComboBox1.SelectedIndex = 0 sqlobject = New SQL_Conn Me.MdiParent = main End SubEnd Class4.3 本系统的界面和源代码4.31 管 理 员 登 陆 成 功 界 面Imports System.Windows.FormsPublic Class main Public m_Login As Boolean = False Public m_style As String Public OPErr As New OutputErr Pri

21、vate sqlobject As SQL_Conn Private CmdStr As String Public Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If m_Login = False Then Me.公交信息ToolStripMenuItem.Enabled = False Me.条件查询ToolStripMenuItem.Enabled = False Me.职员管理ToolStripMenuItem.Enabled = False

22、Me.登录ToolStripMenuItem.Enabled = True Me.注销ToolStripMenuItem.Enabled = False Me.ToolStripButton6.Enabled = True Me.ToolStripButton7.Enabled = False Me.ToolStripButton1.Enabled = False Me.ToolStripButton5.Enabled = False Me.ToolStripButton8.Enabled = False login.MdiParent = Me login.Show() Else Me.公交

23、信息ToolStripMenuItem.Enabled = True Me.条件查询ToolStripMenuItem.Enabled = True Me.登录ToolStripMenuItem.Enabled = False Me.注销ToolStripMenuItem.Enabled = True Me.ToolStripButton6.Enabled = False Me.ToolStripButton7.Enabled = True Me.ToolStripButton1.Enabled = True Me.ToolStripButton5.Enabled = True Me.Tool

24、StripButton8.Enabled = True If m_style = "管理员" Then Me.公交信息ToolStripMenuItem.Enabled = True Me.条件查询ToolStripMenuItem.Enabled = True Me.职员管理ToolStripMenuItem.Enabled = True ElseIf m_style = "职员" Then Me.公交信息ToolStripMenuItem.Enabled = True Me.条件查询ToolStripMenuItem.Enabled = True M

25、e.职员管理ToolStripMenuItem.Enabled = False End If End If End Sub Private Sub 退出ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出ToolStripMenuItem.Click Me.Close() End Sub Private Sub 注销ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.

26、EventArgs) Handles 注销ToolStripMenuItem.Click Me.m_style = "" Me.m_Login = False For Each ChildForm As Form In Me.MdiChildren ChildForm.Close() Next main_Load(sender, e) Login.Show() Me.ToolStripStatusLabel1.Text = "登录" End Sub Private Sub ToolStripButton7_Click(ByVal sender As Sy

27、stem.Object, ByVal e As System.EventArgs) Handles ToolStripButton7.Click Me.m_style = "" Me.m_Login = False For Each ChildForm As Form In Me.MdiChildren ChildForm.Close() Next main_Load(sender, e) Login.Show() Me.ToolStripStatusLabel1.Text = "登录" End Sub Private Sub 登录ToolStripMe

28、nuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 登录ToolStripMenuItem.Click Login.Show() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = Now End Sub Private Sub ToolStripButton6_Click(ByVal s

29、ender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton6.Click Login.Show() End Sub Private Sub 添加ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加ToolStripMenuItem1.Click gongjiaoxinxixiugai.MdiParent = Me gongjiaoxinxixiugai.Show()

30、 End Sub Private Sub 查询ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 查询ToolStripMenuItem1.Click gongjiaoxinxichakan.MdiParent = Me gongjiaoxinxichakan.Show() End Sub Private Sub 预定查询ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As Syste

31、m.EventArgs) Handles 预定查询ToolStripMenuItem.Click shoumozhanchaxun.MdiParent = Me shoumozhanchaxun.Show() End Sub Private Sub 添加职员ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 添加职员ToolStripMenuItem.Click zhiyuanguanli.MdiParent = Me zhiyuanguanli.Show() E

32、nd Sub Private Sub ToolStripButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton5.Click gongjiaoxinxichakan.MdiParent = Me gongjiaoxinxichakan.Show() End Sub Private Sub ToolStripButton8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Ha

33、ndles ToolStripButton8.Click shoumozhanchaxun.MdiParent = Me shoumozhanchaxun.Show() End Sub Private Sub 使用方法ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) MsgBox("点击相应的图标选择需要的功能,选择菜单、客户等内容时,直接点击数据表") End Sub Private Sub ToolStripButton1_Click(ByVal sen

34、der As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click gongjiaoxinxixiugai.MdiParent = Me gongjiaoxinxixiugai.Show() End SubEnd Class4.3.2 公 交 信 息 修 改 界 面Imports 公交查询Imports System.IOPublic Class gongjiaoxinxichakan Private row As Integer = -1 Private CmdStr As String Priv

35、ate sqlobject As SQL_Conn Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick If row <> e.RowIndex And e.RowIndex >= 0 Then row = e.RowIndex Label6.Text = Me.DataGridView1.Item(0, row).Value.T

36、oString.Trim() Label7.Text = Me.DataGridView1.Item(1, row).Value.ToString.Trim() Label8.Text = Me.DataGridView1.Item(2, row).Value.ToString.Trim() Label9.Text = Me.DataGridView1.Item(3, row).Value.ToString.Trim() Label1.Text = Me.DataGridView1.Item(0, row).Value.ToString.Trim() If Label1.Text <&g

37、t; "" Then CmdStr = "select photo from gj where name='" + Label1.Text + "'" DisplayImg(CmdStr) Else : PictureBox1.Image = Nothing End If End If End Sub Private Sub kehuchaxun_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load sq

38、lobject = New SQL_Conn CmdStr = "SELECT name as '线路名称',price as '费用价格',efficacy as '首站地址',formula as '末站地址' FROM gj" Try Me.DataGridView1.DataSource = sqlobject.SQL_Ada(CmdStr) Catch ex As Exception main.OPErr.WriteErr(ex) End Try Me.DataGridView1.AutoSizeCo

39、lumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Call kehuchaxun_Load(sender, e) End Sub Private Sub DisplayImg(ByVal str As String) sqlobject.SQL_Ada(str) If sqlobject.SQL_Ada(str).Rows(0).Item(0

40、) Is DBNull.Value Then PictureBox1.Image = Nothing Else Dim imgbyte() As Byte = sqlobject.SQL_Ada(str).Rows(0).Item(0) Dim imgmemory As New MemoryStream(imgbyte) PictureBox1.Image = Image.FromStream(imgmemory) End If End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As Syste

41、m.EventArgs) Handles Button1.Click End SubEnd Class4.3.3 公 交 查 询 信 息 界 面Imports 公交查询Imports System.IOPublic Class gongjiaoxinxichakan Private row As Integer = -1 Private CmdStr As String Private sqlobject As SQL_Conn Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windo

42、ws.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick If row <> e.RowIndex And e.RowIndex >= 0 Then row = e.RowIndex Label6.Text = Me.DataGridView1.Item(0, row).Value.ToString.Trim() Label7.Text = Me.DataGridView1.Item(1, row).Value.ToString.Trim() Label8.Text = Me.DataGridVie

43、w1.Item(2, row).Value.ToString.Trim() Label9.Text = Me.DataGridView1.Item(3, row).Value.ToString.Trim() Label1.Text = Me.DataGridView1.Item(0, row).Value.ToString.Trim() If Label1.Text <> "" Then CmdStr = "select photo from gj where name='" + Label1.Text + "'&q

44、uot; DisplayImg(CmdStr) Else : PictureBox1.Image = Nothing End If End If End Sub Private Sub kehuchaxun_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load sqlobject = New SQL_Conn CmdStr = "SELECT name as '线路名称',price as '费用价格',efficacy as '

45、首站地址',formula as '末站地址' FROM gj" Try Me.DataGridView1.DataSource = sqlobject.SQL_Ada(CmdStr) Catch ex As Exception main.OPErr.WriteErr(ex) End Try Me.DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells End Sub Private Sub Button1_Click(ByVal sender As

46、System.Object, ByVal e As System.EventArgs) Call kehuchaxun_Load(sender, e) End Sub Private Sub DisplayImg(ByVal str As String) sqlobject.SQL_Ada(str) If sqlobject.SQL_Ada(str).Rows(0).Item(0) Is DBNull.Value Then PictureBox1.Image = Nothing Else Dim imgbyte() As Byte = sqlobject.SQL_Ada(str).Rows(0

47、).Item(0) Dim imgmemory As New MemoryStream(imgbyte) PictureBox1.Image = Image.FromStream(imgmemory) End If End Sub Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End SubEnd Class4.3.4 公 交 职 员 管 理 界 面Imports 公交查询Imports System.IOPublic C

48、lass zhiyuanguanli Public userid As String Private row As Integer = -1 Private CmdStr As String Private Cmd As String Private sqlobject As SQL_Conn Private Sub zhiyuanguanli_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load sqlobject = New SQL_Conn CmdStr = "S

49、ELECT user_id as '登陆账号',style as '员工级别',id as '身份证号',name as '职工姓名',tel as '联系方式' FROM user" Try Me.DataGridView1.DataSource = sqlobject.SQL_Ada(CmdStr) Catch ex As Exception main.OPErr.WriteErr(ex) End Try Me.DataGridView1.AutoSizeColumnsMode = DataGridV

50、iewAutoSizeColumnsMode.DisplayedCells End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click CmdStr = "SELECT user_id FROM user where user_id='" + TextBox1.Text + "'" Cmd = "SELECT id FROM user where id=

51、9;" + TextBox4.Text + "'" If TextBox1.Text = "" Then MsgBox("请输入登陆账号") TextBox1.Focus() ElseIf sqlobject.Is_SQL_Cmd(CmdStr) Then MsgBox("该登陆账号已经存在") TextBox1.Focus() ElseIf TextBox2.Text = "" Then MsgBox("请输入密码") TextBox2.Focus() ElseIf TextBox2.Text <> TextBox3.Text Then MsgBox("两次密码不一致") TextBox2.Focus() TextBox3.Focus() ElseIf ComboBox1.Text = "请选择" Then MsgBox("请选择级别") TextBox1.Focus() ElseIf TextBox4.Text = "" Then MsgBox("请输入身份证号")

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论