1、 计算机应用基础课程设计 目 录摘要 21 引言 32 本程序主要功能 33 本程序结构设计 44 程序设计界面 45 程序代码 10结论30致谢31参考文献32 摘 要 随着计算机的普及程序的应用也越来越受到重视,本次课程设计使用 Visual Basic 作为开发工具,进行了汽车零部件查询系统设计的程序设计,本系统主要完成对汽车零部件的管理,包括库存的添加、删除等。系统可以完成对各类信息的追加、浏览、修改、查询和计算等功能。汽车零部件查询系统广泛应用于4S店汽车零部件的库存与销售管理工作中,要求其具有实用性强、使用方便、效率高和安全可靠等特点。本管理系统正是围绕以上几个方面进行开发的,在开
2、发过程中充分考虑到本系统的应用特点,并进行了大量的检验,证明其的确达到了设计的要求,是一个已具备了实际应用能力的软件。关键词: 汽车零部件 销售 库存 销售1 引 言 1.1 问题的提出 为适合现代企业发展的需要,汽车零部件管理已经成为困扰销售的一个难题,由于其费时和繁琐性,企业迫切需要一种专门为零部件管理而服务的工具。为此,简单的汽车零部件管理系统为此而制造出来。本简单程序是为汽车零部件管理而设计的,内容简单,使用方便。程序稍加变更可以适合对资源分配方面的杂事加以处理。作为当代大学生,熟练的操作计算机是一种必备的素质。本次设计会让我们更加熟悉VB编程,把以前学过的一些东西又重新复习了一遍,并
3、与实际结合起来,对我们能力的提升有了很大的帮助,还能促使我们在以后的实际应用中更好的应用VB编程来设计一些数据库管理系统。2 本程序主要功能 汽车零部件管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点.本系统主要完成对汽车零部件信息的管理,包括数据库中零件的入库和出库等。系统可以完成对各类信息的浏览、修改、查询对零件销售价格进行计算等功能。系统的核心是数据库中零件的余量,每一个零件的修改都将联动的影响其它的各项信息,当完成对数据的操作时系统会
4、自动地完成数据库的修改。查询功能也是系统的核心之一,在系统中即有单条件查询和多条件查询,也有精确查询和模糊查询,系统不仅有静态的条件查询,也有动态生成的条件查询,其目的都是为了方便用户使用。本系统有完整的报价查询,库存剩余量,零件名称,销售型号,匹配车型查询等等。3 本程序结构设计 汽车零部件管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于前者要求建立起数据一致性和完整性强、数据安全性好的库。而对于后者则要求应用程序功能完备,易使用等特点.其中利用函数调用,查询功能,库存检索等完成此次设计。4 程序设计界面Form1: Form2:Form
5、3:Form4:Form5:Form6:Form7:Form8:Form9:Form10:Form11:Form12:5 程序代码(1)Form1:Private 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(pe
6、rs.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)Form3:Dim ca
7、rs As qicheDim a(5)Private Sub bz_Click()Form9.ShowEnd 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 Tex
8、t2 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 =
9、 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) & Lis
10、t3(4).List(k) & List3(5).List(k)End IfNext kFrame1.Visible = FalseList2.Visible = 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.ShowFo
11、rm10.Frame1.Visible = TrueEnd SubPrivate Sub kp_Click()Form10.ShowForm10.Frame2.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).L
12、istCount - 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 ,
13、 iEnd IfNext iEnd SubPrivate Sub tc_Click()EndEnd Sub(4) Form4:Dim pers As managerPrivate Sub Command1_Click()Form5.ShowEnd SubPrivate Sub Command2_Click()List1.RemoveItem List1.ListIndexList2.RemoveItem List2.ListIndexList3.RemoveItem List3.ListIndexList4.RemoveItem List4.ListIndexCall saveEnd SubP
14、rivate 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 SubPrivat
15、e Sub Command4_Click()Form3.ShowUnload MeEnd SubPrivate 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 L
16、ist1_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.Li
17、stIndexList2.ListIndex = List3.ListIndexList4.ListIndex = List3.ListIndexEnd 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 =
18、 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.ShowU
19、nload MeEnd SubPrivate Sub Form_Load()Text3 = End Sub(6) Form6:Private Sub Command1_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 Comm
20、and1_Click()Form12.List1(0).AddItem Text1, 0Form12.List1(1).AddItem Text2, 0Form12.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
21、(1).AddItem Text2, 0Form3.List1(2).AddItem Text3, 0Form3.List1(3).AddItem Text4, 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).T
22、ext And Combo1(3).Text And Combo1(4).Text And Text1 ThenForm12.List1(0).AddItem 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 MeElseMs
23、gBox 请写入完整的信息!End IfEnd SubPrivate Sub Command2_Click()Form3.ShowUnload MeEnd 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
24、 = -1 Then q = List2.ListCount - 1p = Val(List2.List(q)Call xishi(p)q = q - 1End 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
25、 Sub Command4_Click()p = Val(List2.List(0)Call xishi(p)End SubPrivate Sub Command5_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) =
26、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
27、) = Text5(1) = Text5(2) = Text5(3) = Text5(4) = Text5(5) = End IfIf List2.ListCount 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
28、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) =
29、 End IfIf List2.ListCount 1 Then Command2.Enabled = TrueEnd SubPrivate 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) ThenList
30、1.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
31、.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 SubPrivate Sub Text2_Change()List1.ClearList1.AddItem 配件 & & & 零件型号 & & & 适用车型 & & & & & 发布日期 & & & & 单位 & & & & & &
32、 价格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 IfI
33、f 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 IfNe
34、xt iEnd Sub(11) Form11:Dim cars As qicheDim a(5)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.
35、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).ListInd
36、ex = 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).ListInd
37、exList1(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).List
38、Index = 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).List
39、IndexList1(2).ListIndex = List1(5).ListIndexList1(1).ListIndex = List1(5).ListIndexEnd 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).TextF
40、orm7.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).L
41、istIndexEnd IfEnd SubPrivate Sub Command2_Click()Form8.ShowEnd SubPrivate 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).RemoveI
42、tem List1(5).ListIndexEnd SubPrivate Sub Command4_Click()Form3.ShowUnload MeEnd SubPrivate 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).ListIndexL
版权声明:以上文章中所选用的图片及文字来源于网络以及用户投稿,由于未联系到知识产权人或未发现有关知识产权的登记,如有知识产权人并不愿意我们使用,如有侵权请立即联系:2622162128@qq.com ,我们立即下架或删除。
Copyright© 2022-2024 www.wodocx.com ,All Rights Reserved |陕ICP备19002583号-1
陕公网安备 61072602000132号 违法和不良信息举报:0916-4228922