《汽车零部件查询系统设计gich.docx》由会员分享,可在线阅读,更多相关《汽车零部件查询系统设计gich.docx(33页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、 计算机应用基础课程设计交通与汽车工程学院课程设计说明书课 程 名 称: 计算机应用基础课程设计 课 程 代 码: 6011339 题 目: 汽车零部件查询系统设计 年级/专业/班: 学 生 姓 名: 学 号: 开 始 时 间: 2012 年 4 月 1 日完 成 时 间: 2012 年 4 月 12 日课程设计成绩:学习态度及平时成绩(30)技术水平与实际能力(20)创新(5)说明书(计算书、图纸、分析报告)撰写质量(45)总 分(100)指导教师签名: 年 月 日目 录摘要 21 引言 32 本程序主要功能 33 本程序结构设计 44 程序设计界面 45 程序代码 10结论30致谢31参考
2、文献32 摘 要 随着计算机的普及程序的应用也越来越受到重视,本次课程设计使用 Visual Basic 作为开发工具,进行了汽车零部件查询系统设计的程序设计,本系统主要完成对汽车零部件的管理,包括库存的添加、删除等。系统可以完成对各类信息的追加、浏览、修改、查询和计算等功能。汽车零部件查询系统广泛应用于4S店汽车零部件的库存与销售管理工作中,要求其具有实用性强、使用方便、效率高和安全可靠等特点。本管理系统正是围绕以上几个方面进行开发的,在开发过程中充分考虑到本系统的应用特点,并进行了大量的检验,证明其的确达到了设计的要求,是一个已具备了实际应用能力的软件。关键词: 汽车零部件 销售 库存 销
3、售1 引 言 1.1 问题的提出 为适合现代企业发展的需要,汽车零部件管理已经成为困扰销售的一个难题,由于其费时和繁琐性,企业迫切需要一种专门为零部件管理而服务的工具。为此,简单的汽车零部件管理系统为此而制造出来。本简单程序是为汽车零部件管理而设计的,内容简单,使用方便。程序稍加变更可以适合对资源分配方面的杂事加以处理。作为当代大学生,熟练的操作计算机是一种必备的素质。本次设计会让我们更加熟悉VB编程,把以前学过的一些东西又重新复习了一遍,并与实际结合起来,对我们能力的提升有了很大的帮助,还能促使我们在以后的实际应用中更好的应用VB编程来设计一些数据库管理系统。2 本程序主要功能 汽车零部件管
4、理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点.本系统主要完成对汽车零部件信息的管理,包括数据库中零件的入库和出库等。系统可以完成对各类信息的浏览、修改、查询对零件销售价格进行计算等功能。系统的核心是数据库中零件的余量,每一个零件的修改都将联动的影响其它的各项信息,当完成对数据的操作时系统会自动地完成数据库的修改。查询功能也是系统的核心之一,在系统中即有单条件查询和多条件查询,也有精确查询和模糊查询,系统不仅有静态的条件查询,也有动态生成的条
5、件查询,其目的都是为了方便用户使用。本系统有完整的报价查询,库存剩余量,零件名称,销售型号,匹配车型查询等等。3 本程序结构设计 汽车零部件管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点.其中利用函数调用,查询功能,库存检索等完成此次设计。4 程序设计界面Form1: Form2:Form3:Form4:Form5:Form6:Form7:Form8:Form9:Form10:Form11:Form12:5 程序代码(1)Form1:Pri
6、vate Sub Form_Click()Form2.ShowUnload MeEnd SubPrivate Sub Form_KeyPress(KeyAscii As Integer)Form2.ShowUnload MeEnd SubPrivate Sub Image1_Click()End Sub(2)Form2:Do While Not EOF(1)Get #1, , persIf Trim(Text2.Text) = Trim(pers.bh) Thenf = TrueForm3.ShowUnload Form2Exit DoEnd IfLoopCloseIf f = False T
7、hent = t + 1If t 3 ThenMsgBox 用户不存在,请重新输入!, vbOKOnly + vbInformation, 用户名错误ElseMsgBox 重试次数已到,即将退出本系统!, vbOKOnly + vbExclamation, 用户名错误EndExit SubEnd IfEnd IfEnd IfEnd SubPrivate Sub Command2_Click()EndEnd Sub(3)Form3:Dim cars As qicheDim a(5)Private Sub bz_Click()Form9.ShowEnd SubPrivate Sub Command
8、1_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: Cal
9、l 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
10、)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.Visib
11、le = TrueEnd SubPrivate Sub Command2_Click()Frame1.Visible = FalseEnd SubPrivate Sub Form_Load() Frame1.Visible = FalseList2.Visible = FalseEnd SubPrivate Sub glsj_Click()Form4.ShowEnd SubPrivate Sub bk_Click()Form10.ShowForm10.Frame1.Visible = TrueEnd SubPrivate Sub kp_Click()Form10.ShowForm10.Fram
12、e2.Visible = TrueEnd SubPrivate Sub ljgl_Click()Form12.ShowEnd SubPrivate Sub ss_Click() List2.Visible = TrueFrame1.Visible = True List2.Visible = Not List2.VisibleList2.ClearEnd SubSub hunt(t)For i = 0 To Form12.List1(t).ListCount - 1If Trim(Combo1(t).Text) = Trim(Form12.List1(t).List(i) ThenList3(
13、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 tc_Click()EndEnd Sub(4) Form4:Dim pers As ma
14、nagerPrivate Sub Command1_Click()Form5.ShowEnd SubPrivate Sub Command2_Click()List1.RemoveItem List1.ListIndexList2.RemoveItem List2.ListIndexList3.RemoveItem List3.ListIndexList4.RemoveItem List4.ListIndexCall saveEnd SubPrivate Sub Command3_Click()If List1.Text = ThenMsgBox 请选择修改对象ElseForm6.ShowFo
15、rm6.Text1 = List1.TextForm6.Text2 = List3.TextForm6.Combo1.Text = List2.TextList1.RemoveItem List1.ListIndexList2.RemoveItem List2.ListIndexList3.RemoveItem List3.ListIndexList4.RemoveItem List4.ListIndexEnd IfEnd SubPrivate Sub Command4_Click()Form3.ShowUnload MeEnd SubPrivate Sub Form_Load()i = 0O
16、pen 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.ListInde
17、xList4.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
18、SubPrivate Sub List4_Click()List1.ListIndex = List4.ListIndexList2.ListIndex = List4.ListIndexList3.ListIndex = List4.ListIndexEnd Sub(5) Form5:Dim pers As managerPrivate Sub Command1_Click()If Text1 = Or Text2 = Or Text3 = Or Combo1.Text = ThenMsgBox 请输入完整的信息Text1.SetFocusExit SubEnd IfIf Text1 And
19、 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 SubPrivate Sub Form_Load()Text3 = End Sub(6) Form6:Private Sub Co
20、mmand1_Click()Form4.List1.AddItem Text1, 0Form4.List2.AddItem Combo1.Text, 0Form4.List3.AddItem Text2, 0Form4.List4.AddItem Text4, 0Call saveForm3.ShowUnload MeEnd SubPrivate Sub Form_Load()End Sub(7) Form7:Private Sub Command1_Click()Form12.List1(0).AddItem Text1, 0Form12.List1(1).AddItem Text2, 0F
21、orm12.List1(2).AddItem Text3, 0Form12.List1(3).AddItem Text4, 0Form12.List1(4).AddItem Text5, 0Form12.List1(5).AddItem Text6, 0Form3.ShowUnload MeEnd SubPrivate Sub Command2_Click()Form3.List1(0).AddItem Text1, 0Form3.List1(1).AddItem Text2, 0Form3.List1(2).AddItem Text3, 0Form3.List1(3).AddItem Tex
22、t4, 0Form3.List1(4).AddItem Text5, 0Form3.List1(5).AddItem Text6, 0Call save2Form3.ShowUnload MeEnd SubPrivate Sub Form_Load()End Sub(8) Form8: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 ThenForm12.List1(0).AddIt
23、em Combo1(0).TextForm12.List1(1).AddItem Combo1(1).TextForm12.List1(2).AddItem Combo1(2).TextForm12.List1(3).AddItem Combo1(3).TextForm12.List1(4).AddItem Combo1(4).TextForm12.List1(5).AddItem Text1Form3.ShowUnload MeElseMsgBox 请写入完整的信息!End IfEnd SubPrivate Sub Command2_Click()Form3.ShowUnload MeEnd
24、 SubPrivate Sub Form_Load()End Sub(9) Form9:Private Sub Text2_Change()End SubPrivate Sub Text1_Change()End SubPrivate Sub Timer1_Timer()Text2 = TimeEnd Sub(10) Form10:Dim qPrivate Sub Command1_Click()Static q As IntegerIf q = -1 Then q = List2.ListCount - 1p = Val(List2.List(q)Call xishi(p)q = q - 1
25、End SubPrivate 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 SubPrivate Sub Command3_Click()Form3.ShowUnload MeEnd SubPrivate Sub Command4_Click()p = Val(List2.List(0)Call xishi(p)End SubPrivate Sub Com
26、mand5_Click()p = Val(List2.List(List2.ListCount - 1)Call xishi(p)End SubPrivate Sub Form_Load()End SubPrivate 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 Text
27、4 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.Lis
28、tCount 1 Then Command2.Enabled = TrueEnd SubPrivate 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 Tr
29、im(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 SubPrivate Sub Te
30、xt1_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)
31、.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).
32、List(i) & Form12.List1(3).List(i) & Form12.List1(4).List(i) & Form12.List1(5).List(i)End IfEnd IfNext iEnd SubPrivate Sub Text2_Change()List1.ClearList1.AddItem 配件 & & & 零件型号 & & & 适用车型 & & & & & 发布日期 & & & & 单位 & & & & & & 价格For i = 0 To Form12.List1(0).ListCount - 1If Text1 = And Text2 ThenIf Trim
33、(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(
34、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(11) Form11:Dim cars As qicheDim a(5)Private Sub Form_Load()Open A
35、pp.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
36、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).ListIn
37、dex = 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).ListIn
38、dexCase 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).Lis
39、tIndex = 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).Lis
40、tIndexEnd SelectEnd Sub(12) Form12:Dim cars As qicheDim a(5)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).T
41、extList1(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 SubPrivate Sub Command2_Click()Form8.ShowEnd SubPrivate Sub
42、 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 SubPrivate Sub Command4_Click()Form3.ShowUnload MeEnd SubPrivate Sub Form_Load()Open App.Path +