汽车零部件查询系统设计说明书

上传人:沈*** 文档编号:164005144 上传时间:2022-10-24 格式:DOC 页数:45 大小:7.66MB
返回 下载 相关 举报
汽车零部件查询系统设计说明书_第1页
第1页 / 共45页
汽车零部件查询系统设计说明书_第2页
第2页 / 共45页
汽车零部件查询系统设计说明书_第3页
第3页 / 共45页
点击查看更多>>
资源描述
计算机应用基础课程设计交通与汽车工程学院课程设计说明书课 程 名 称: 计算机应用基础课程设计 课 程 代 码: 6011339 题 目: 汽车零部件查询系统设计 年级/专业/班: 学 生 姓 名: 学 号: 开 始 时 间: 2012 年 4 月 1 日完 成 时 间: 2012 年 4 月 12 日课程设计成绩:学习态度及平时成绩(30)技术水平与实际能力(20)创新(5)说明书(计算书、图纸、分析报告)撰写质量(45)总 分(100)指导教师签名: 年 月 日目 录 摘要11 引言2 方案设计2.汽车零部件查询模拟系统方案设计52.1.1系统功能描述52.1.2系统结构分析52.1.3系统流程分析52.2程序界面和代码设计62.2.1系统工程设计框架62.2.2系统各界面设计及代码设计83 结果分析 33结论 45致谢 46参考文献 47摘 要随着计算机的普及,计算机高级语言已经运用到生活中的各个方面,本次课程设计使用VB语言作为开发工具,进行了汽车零部件查询系统的程序设计,该程序能实现汽车零部件查询模拟功能,进行汽车零部件的查询,修改,添加等操作,查询结果简便明了,运行界面清晰实用,操作方便,易于实际处理。关键词:网络化 计算机 对策 VB语言 汽车零部件 查询 程序 1 引 言 1.1 问题的提出随着计算机的普及,网络进入大众的家庭。VB一种可视化的、面向对象和采用事件驱动方式的高级程序设计语言,可用于开发Windows环境下的各类应用程序。本次课程设计主要内容就是使用VB编制简单、实用的小程序,以巩固我们所学的计算机VB语言知识,提高分析问题和解决问题的能力,锻炼我们独立动手的能力。1.2任务与分析 本课题主要的目的是为了检测步进电机步距角误差,并把误差进行分析计算,最终得到一份误差数据,用误差曲线的方式在坐标上面把误差和步数结果表现出来,方便日后对误差的分析、误差的减少讨论出相应的方案2 设计方案首先根据题目要求设计合理界面,确定哪些控件会用到,要考虑到操作的方便性和美观性。再按题目的功能要求编写对象的事件代码,并其逐一进行调试和修改。2.1系统总体方案的设计 2.1.1系统的驱动控制方案设计 根据设计要求,程序要达到的功能如下: (1)、用随机文件建立汽车零部件和管理员的信息档案; (2)、读出汽车零部件的信息,显示在列表框中; (3)、能实现汽车零部件及管理员的信息的查询,修改,添加,删除等操作; (4)、对汽车零部件搜索。2.1.2系统结构分析根据上面对系统功能的描述,构建出系统的总体功能结构图,如图1所示 汽车零部件查询系统对管理员信息的维护对汽车零部件信息的维护对汽车零部件搜索对汽车零部件的查询使用说明 图1 系统的总体功能结构图2.1.3系统流程分析本系统运行后从欢迎(登录)界面进入主界面。程序的主要工作流程图如图2所示。 用户登录读取用户数据并登录开始失败重试3次操作主界面(1).卡片式(2).列表框式查询零件精确或粗略搜索搜索零件1.添加数据2.删除数据3.修改数据管理员数据1.添加数据2.删除数据3.修改数据零件管理 图2系统主要流程图2.2程序界面和代码设计 2.2.1系统工程设计框架在设计程序之前,应先布局整个工程。本系统可设立一个工程文件,取名汽车零部件查询系统.vbp,该工程中包括1个模块文件,11个窗体文件,如图3所示。图3工程内容 模块代码如下: Dim hType qichepj As String * 10ljxh As String * 10sych As String * 10jg As String * 10fb As String * 10rq As String * 10dw As String * 10End TypeDim cars As qicheType managerbh As String * 10xb As Variantxm As Variantmm As String * 10End TypeDim pers As managerSub save()Kill App.Path + mag.datOpen App.Path + mag.dat For Random As #1For i = 0 To Form4.List1.ListCount - 1pers.bh = Form4.List1.List(i)pers.xb = Form4.List2.List(i)pers.xm = Form4.List3.List(i)pers.mm = Form4.List4.List(i)Put #1, i + 1, persNext iCloseEnd SubSub xishi(p)Form10.Text5(0) = Form10.Text5(1) = Form10.Text5(2) = Form10.Text5(3) = Form10.Text5(4) = Form10.Text5(5) = Form10.Text5(0) = Form12.List1(0).List(p)Form10.Text5(1) = Form12.List1(1).List(p)Form10.Text5(2) = Form12.List1(2).List(p)Form10.Text5(3) = Form12.List1(3).List(p)Form10.Text5(4) = Form12.List1(4).List(p)Form10.Text5(5) = Form12.List1(5).List(p)End Sub2.2.2 系统各界面设计根据功能不同,在本系统中设计了11个窗体。(1) 欢迎界面欢迎界面的主要功能是让用户了解程序软件的用途(2)用户登录界面用户登录界面的功能是让管理员进入系统,防止非工作人员进入。用户登录主界面如图5所示图5登录界面登录页面主要代码如下:Dim pers As managerPrivate Sub Command1_Click() 登录系统按钮Static t As Integerf = FalseIf Text2.Text = Or Text1 = ThenMsgBox 请填写完整的个人信息End IfIf Text2.Text ThenOpen App.Path + mag.dat For Random As #1n = LOF(1) / Len(pers)Do While Not EOF(1)Get #1, , persIf Trim(Text2.Text) = Trim(pers.bh) Thenf = TrueForm3.ShowUnload Form2Exit DoEnd IfLoopCloseIf f = False Thent = t + 1If t 3 ThenMsgBox 用户不存在,请重新输入!, vbOKOnly + vbInformation, 用户名错误ElseMsgBox 重试次数已到,即将退出本系统!, vbOKOnly + vbExclamation, 用户名错误EndExit SubEnd IfEnd IfEnd IfEnd SubPrivate Sub Command2_Click() 结束按钮EndEnd Sub(3)主界面一如图6所示主界面的功能是展示出系统软件的功能,使用户一目了然。 图6 主界面主要代码如下:Dim cars As qiche 通用定义代码Dim a(5)Private Sub Form_Load() Frame1.Visible = FalseList2.Visible = FalseEnd SubPrivate Sub bz_Click() 查看系统帮助Form9.ShowEnd SubPrivate Sub ss_Click() 搜索零件List2.Visible = TrueFrame1.Visible = TrueList2.Visible = Not List2.VisibleList2.ClearEnd SubPrivate Sub Command1_Click() 依照零件信息对零件搜索For i = 0 To 4If Combo1(i).Text = ThenFor j = 0 To Form12.List1(i).ListCount - 1List3(i).AddItem Form12.List1(i).List(j)Next jElset = iCall hunt(t)End IfNext iIf Text1 And Text2 ThenCall hunt2ElseIf Text1 = And Text2 Then Text1 = 0: Call hunt2ElseIf Text1 And Text2 = Then Text2 = 10 10: Call hunt2ElseFor j = 0 To Form12.List1(5).ListCount - 1List3(5).AddItem Form12.List1(5).List(j)Next jEnd IfFor k = 0 To 5 m = List3(k).ListCount For j = 0 To m If List3(k).List(j) Then a(k) = a(k) + 1 End If Next jNext kMax = a(0)For i = 1 To 5If a(i) Max ThenMax = a(i)End IfNext iFor k = 0 To Val(Max)If List3(0).List(k) And List3(1).List(k) And List3(2).List(k) And List3(3).List(k) And List3(4).List(k) And List3(5).List(k) ThenList2.AddItem List3(0).List(k) & List3(1).List(k) & List3(2).List(k) & List3(3).List(k) & List3(4).List(k) & List3(5).List(k)End IfNext kFrame1.Visible = FalseList2.Visible = TrueEnd SubSub hunt(t)For i = 0 To Form12.List1(t).ListCount - 1If Trim(Combo1(t).Text) = Trim(Form12.List1(t).List(i) ThenList3(t).AddItem Form12.List1(t).List(i), iElseList3(t).AddItem , iEnd IfNext iEnd SubSub hunt2()For i = 0 To List1(5).ListCount - 1If Val(Text1) Val(List1(5).List(i) ThenList3(5).AddItem List1(5).List(i), iElseList3(5).AddItem , iEnd IfNext iEnd SubPrivate Sub Command2_Click() 退出搜索零部件Frame1.Visible = FalseEnd SubPrivate Sub glsj_Click() 打开管理员数据管理功能Form4.ShowEnd SubPrivate Sub bk_Click() 表框式查询零部件Form10.ShowForm10.Frame1.Visible = TrueEnd SubPrivate Sub kp_Click() 卡片式查询零部件Form10.ShowForm10.Frame2.Visible = TrueEnd SubPrivate Sub ljgl_Click() 打开零部件数据管理功能Form12.ShowEnd SubPrivate Sub tc_Click() 退出系统EndEnd Sub(4)主界面二如图7所示 图7 主界面主要代码如下:1卡片式零件查询:Dim q(1).查看上一个零件的代码如下:Private Sub Command1_Click()Static q As IntegerIf q = -1 Then q = List2.ListCount - 1p = Val(List2.List(q)Call xishi(p)q = q - 1End Sub(2)查看下一个零件代码如下:Private Sub Command2_Click()Static q As IntegerIf q List2.ListCount - 1 Then q = 0p = Val(List2.List(q)Call xishi(p)q = q + 1Command1.Enabled = TrueEnd Sub(3)退出卡片式查询代码如下:Private Sub Command3_Click()Form3.ShowUnload MeEnd Sub(4)查看第一个零件代码如下:Private Sub Command4_Click()p = Val(List2.List(0)Call xishi(p)End Sub(5)查看最后一个零件代码如下:Private Sub Command5_Click()p = Val(List2.List(List2.ListCount - 1)Call xishi(p)End Sub(6)卡片式配件框发生改变代码如下:Private Sub Text3_Change()List2.ClearFor i = 0 To Form12.List1(0).ListCount - 1If Text3 And Text4 = ThenIf Trim(Text3) = Trim(Form12.List1(0).List(i) ThenList2.AddItem iEnd IfEnd IfIf Text3 And Text4 ThenIf Trim(Form12.List1(0).List(i) = Trim(Text3) And Trim(Form12.List1(1).List(i) = Trim(Text4) ThenList2.AddItem iEnd IfEnd IfNext iIf List2.ListCount 0 ThenList2.ListIndex = 0p = Val(List2.Text)Call xishi(p)ElseText5(0) = Text5(1) = Text5(2) = Text5(3) = Text5(4) = Text5(5) = End IfIf List2.ListCount 1 Then Command2.Enabled = TrueEnd Sub(7)卡片式零件型号框发生改变代码如下:Private Sub Text4_Change()List2.ClearFor i = 0 To Form12.List1(0).ListCount - 1If Text4 And Text3 = ThenIf Trim(Text4) = Trim(Form12.List1(1).List(i) ThenList2.AddItem iEnd IfEnd IfIf Text3 And Text4 ThenIf Trim(Form12.List1(0).List(i) = Trim(Text3) And Trim(Form12.List1(1).List(i) = Trim(Text4) ThenList2.AddItem iEnd IfEnd IfNext iIf List2.ListCount 0 ThenList2.ListIndex = 0p = Val(List2.Text)Call xishi(p)ElseText5(0) = Text5(1) = Text5(2) = Text5(3) = Text5(4) = Text5(5) = End IfIf List2.ListCount 1 Then Command2.Enabled = TrueEnd Sub2.列表框式零件查询: (1)列表框式配件框发生改变代码如下:Private Sub Text1_Change()List1.ClearList1.AddItem 配件 & & & 零件型号 & & & 适用车型 & & & & & 发布日期 & & & & 单位 & & & & & & 价格For i = 0 To Form12.List1(0).ListCount - 1If Text1 And Text2 = ThenIf Trim(Form12.List1(0).List(i) = Trim(Text1) ThenList1.AddItem Form12.List1(0).List(i) & Form12.List1(1).List(i) & Form12.List1(2).List(i) & Form12.List1(3).List(i) & Form12.List1(4).List(i) & Form12.List1(5).List(i)End IfEnd IfIf Text1 And Text2 ThenIf Trim(Form12.List1(0).List(i) = Trim(Text1) And Trim(Form12.List1(1).List(i) = Trim(Text2) ThenList1.AddItem Form12.List1(0).List(i) & Form12.List1(1).List(i) & Form12.List1(2).List(i) & Form12.List1(3).List(i) & Form12.List1(4).List(i) & Form12.List1(5).List(i)End IfEnd IfNext iEnd Sub(2)列表框式零件型号框发生改变代码如下:Private Sub Text2_Change()List1.ClearList1.AddItem 配件 & & & 零件型号 & & & 适用车型 & & & & & 发布日期 & & & & 单位 & & & & & & 价格For i = 0 To Form12.List1(0).ListCount - 1If Text1 = And Text2 ThenIf Trim(Form12.List1(1).List(i) = Trim(Text2) ThenList1.AddItem Form12.List1(0).List(i) & Form12.List1(1).List(i) & Form12.List1(2).List(i) & Form12.List1(3).List(i) & Form12.List1(4).List(i) & Form12.List1(5).List(i)End IfEnd IfIf Text1 And Text2 ThenIf Trim(Form12.List1(0).List(i) = Trim(Text1) And Trim(Form12.List1(1).List(i) = Trim(Text2) ThenList1.AddItem Form12.List1(0).List(i) & Form12.List1(1).List(i) & Form12.List1(2).List(i) & Form12.List1(3).List(i) & Form12.List1(4).List(i) & Form12.List1(5).List(i)End IfEnd IfNext iEnd Sub(5)主界面三如图8所示 图8 主界面 主要代码如下:Dim cars As qiche 通用代码Dim a(5)(1)修改零件代码如下:Private Sub Command1_Click()If List1(0).Text = ThenMsgBox 请选择要修改的零件ElseForm7.ShowForm7.Text1 = List1(0).TextForm7.Text2 = List1(1).TextForm7.Text3 = List1(2).TextForm7.Text4 = List1(3).TextForm7.Text5 = List1(4).TextForm7.Text6 = List1(5).TextList1(0).RemoveItem List1(0).ListIndexList1(1).RemoveItem List1(1).ListIndexList1(2).RemoveItem List1(2).ListIndexList1(3).RemoveItem List1(3).ListIndexList1(4).RemoveItem List1(4).ListIndexList1(5).RemoveItem List1(5).ListIndexEnd IfEnd Sub(2)添加零部件代码如下:Private Sub Command2_Click()Form8.ShowEnd Sub(3)删除零部件代码如下:Private Sub Command3_Click()List1(0).RemoveItem List1(0).ListIndexList1(1).RemoveItem List1(1).ListIndexList1(2).RemoveItem List1(2).ListIndexList1(3).RemoveItem List1(3).ListIndexList1(4).RemoveItem List1(4).ListIndexList1(5).RemoveItem List1(5).ListIndexEnd Sub(3)退出零部件查询系统代码如下:Private Sub Command4_Click()Form3.ShowUnload MeEnd Sub(4)打开窗体运行代码如下:Private Sub Form_Load()Open App.Path + car.dat For Random As #2Do While Not EOF(2)i = i + 1Get #2, i, carsList1(0).AddItem cars.pjList1(1).AddItem cars.ljxhList1(2).AddItem cars.sychList1(3).AddItem cars.fbList1(4).AddItem cars.dwList1(5).AddItem cars.jgLoopCloseEnd SubPrivate Sub List1_Click(Index As Integer) 点击零部件显示属性Select Case Index Case 0List1(5).ListIndex = List1(0).ListIndexList1(4).ListIndex = List1(0).ListIndexList1(3).ListIndex = List1(0).ListIndexList1(2).ListIndex = List1(0).ListIndexList1(1).ListIndex = List1(0).ListIndexCase 1List1(5).ListIndex = List1(1).ListIndexList1(4).ListIndex = List1(1).ListIndexList1(3).ListIndex = List1(1).ListIndexList1(2).ListIndex = List1(1).ListIndexList1(0).ListIndex = List1(1).ListIndexCase 2List1(5).ListIndex = List1(2).ListIndexList1(4).ListIndex = List1(2).ListIndexList1(3).ListIndex = List1(2).ListIndexList1(0).ListIndex = List1(2).ListIndexList1(1).ListIndex = List1(2).ListIndexCase 3List1(5).ListIndex = List1(3).ListIndexList1(4).ListIndex = List1(3).ListIndexList1(0).ListIndex = List1(3).ListIndexList1(2).ListIndex = List1(3).ListIndexList1(1).ListIndex = List1(3).ListIndexCase 4List1(5).ListIndex = List1(4).ListIndexList1(0).ListIndex = List1(4).ListIndexList1(3).ListIndex = List1(4).ListIndexList1(2).ListIndex = List1(4).ListIndexList1(1).ListIndex = List1(4).ListIndexCase 5List1(0).ListIndex = List1(5).ListIndexList1(4).ListIndex = List1(5).ListIndexList1(3).ListIndex = List1(5).ListIndexList1(2).ListIndex = List1(5).ListIndexList1(1).ListIndex = List1(5).ListIndexEnd SelectEnd Sub(6)主界面四如图9所示 图9 主界面主要代码如下:(1)添加零部件代码如下:Private Sub Command1_Click()If Combo1(0).Text And Combo1(1).Text And Combo1(2).Text And Combo1(3).Text And Combo1(4).Text And Text1 ThenForm3.List1(0).AddItem Combo1(0).TextForm3.List1(1).AddItem Combo1(1).TextForm3.List1(2).AddItem Combo1(2).TextForm3.List1(3).AddItem Combo1(3).TextForm3.List1(4).AddItem Combo1(4).TextForm3.List1(5).AddItem Text1Call save2Form3.ShowUnload MeElseMsgBox 请写入完整的信息!End IfEnd Sub(2)退出添加零部件页面代码如下:Private Sub Command2_Click()Form3.ShowUnload MeEnd Sub(7)主界面五如图10所示 图10 主界面主要代码如下:(1)添加个人信息代码如下:Private Sub Command1_Click()Form5.ShowEnd Sub(2)删除个人信息代码如下:Private Sub Command2_Click()List1.RemoveItem List1.ListIndexList2.RemoveItem List2.ListIndexList3.RemoveItem List3.ListIndexList4.RemoveItem List4.ListIndexCall saveEnd Sub(1)修改个人信息代码如下:Private Sub Command3_Click()If List1.Text = ThenMsgBox 请选择修改对象ElseForm6.ShowForm6.Text1 = List1.TextForm6.Text2 = List3.TextForm6.Combo1.Text = List2.TextList1.RemoveItem List1.ListIndexList2.RemoveItem List2.ListIndexList3.RemoveItem List3.ListIndexList4.RemoveItem List4.ListIndexEnd IfEnd Sub(4)退出个人信息窗口代码如下:Private Sub Command4_Click()Form3.ShowUnload MeEnd Sub(5)打开个人信息窗口运行代码如下:Private Sub Form_Load()i = 0Open App.Path + mag.dat For Random As #1Do While Not EOF(1)i = i + 1Get #1, i, persList1.AddItem pers.bh, i - 1List2.AddItem pers.xb, i - 1List3.AddItem pers.xm, i - 1List4.AddItem pers.mm, i - 1LoopCloseEnd SubPrivate Sub List1_Click()List2.ListIndex = List1.ListIndexList3.ListIndex = List1.ListIndexList4.ListIndex = List1.ListIndexEnd SubPrivate Sub List2_Click()List1.ListIndex = List2.ListIndexList3.ListIndex = List2.ListIndexList4.ListIndex = List2.ListIndexEnd SubPrivate Sub List3_Click()List1.ListIndex = List3.ListIndexList2.ListIndex = List3.ListIndexList4.ListIndex = List3.ListIndexEnd SubPrivate Sub List4_Click()List1.ListIndex = List4.ListIndexList2.ListIndex = List4.ListIndexList3.ListIndex = List4.ListIndexEnd Sub(8)主界面六如图11所示 图11 主界面主要代码如下:Dim pers As managerPrivate Sub Form_Load()Text3 = End SubPrivate Sub Command1_Click() 确定添加按钮If Text1 = Or Text2 = Or Text3 = Or Combo1.Text = ThenMsgBox 请输入完整的信息Text1.SetFocusExit SubEnd IfIf Text1 And Text2 And Text3 And Combo1.Text ThenForm4.List1.AddItem Text1Form4.List2.AddItem Combo1.TextForm4.List3.AddItem Text2Form4.List4.AddItem Text3Call saveEnd IfForm4.ShowUnload MeEnd SubPrivate Sub Command2_Click() 退出按钮Form4.ShowUnload MeEnd Sub(9)主界面七如图12所示 图12 主界面3 结果分析 单击“确定”按钮,运行结果见图1所示 图1用户登录单击“搜索”按钮,运行结果见图2所示。 图2搜索单击“零件查询卡片式”按钮,运行结果见图3所示。 图3卡片式单击“零件查询列表框式”按钮,运行结果见图4所示。 图4列表框式单击“零件数据维护”按钮,运行结果见图5所示。 图5零件数据维护 点击任一零部件后显示如图6 图6 单击“修改”按钮,运行结果见图7所示。 图7修改零件点击确定后显示如图8所示 图8点击任一零部件后显示如图9所示 图9点击删除按钮后显示如图10所示 图10点击添加按钮后显示如图11所示 图11 点击确定后显示如图12所示 图12单击“管理员数据维护”按钮,运行结果见图13所示。 图13管理员数据 点击任一管理员信息后显示如图14所示 图14点击删除后显示如图15所示 图15点击任一管理员信息后显示如图16所示 图16 点击修改按钮后显示如图17所示 图17单击“确定”按钮后显示如图18 图18单击“添加”按钮,运行结果见图19所示。 图19点击确定后显示如图20所示 图20点击帮助按钮后显示如图21所示 图21 结 论 在这个学生成绩查询、管理系统课设创作的过程中,让我亲身体会了制作软件的全过程,让我明白了制作软件是一件很复杂的事情。也深深的体会到了理论联系实践的重要性,光有理论知识不去亲自动手制作是不行的。只懂理论不会实践最多只是纸上谈兵,想要真正的学好VB,完全掌握VB就一定要理论联系实践。在设计中会遇到很多的困难,其主要的原因如下:(1)缺乏实践经验,不会理论联系实际;(2)思维不是很灵活;(3)知识面不够广;(4)对VB编程不是很熟练,有很多实践动手能力,让我更深刻的了解了VB的应用,给我在以后的学习工作带来更多的便利 致 谢 在本次课程设计中,我得到了很多帮助。尤其特别感谢指导老师:朱老师!还有许多热心的学长和室友们在这里一并表示感谢! 参考文献 1杨宝刚.开展企业管理信息化工作的步骤J.企业管理.2002.(11).12152Islamabad. Software tools for forgery detectionJ. Business line.2001. (5). 2932 3.杨明广.王秀华. Visual Baisc程序设计教程.中国科学技术出版社,2006.11,21世纪教材;4.王秀华.余建坤. Visual Baisc程序设计上机和级考实训教程.中国科学技术出版社,2006.11,21世纪教材;5龚沛曾. Visual Baisc程序设计简明教程(第二版).高等教育出版社,20036曾强聪.新编Visual Basic程序设计教程.清华大学出版社,2004- 44 -
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 管理文书 > 施工组织


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!