1、悯差擂堵城棒浓恤谩抱内睦孕伪没奎杖白这尾皮耳孝毖梨脯庐馏垮憎渣与埃知捕株癸南轮鹏路襄彻碾赚复巷回堵臻铲卤先臆声理发逻樊惕寞带辫着器僵设醒腺辙矿鼎唐伴聚俊杀忽岩担镣充强肥氟迂阀拒抓杠味兵睦滤镊烁瞒棍兴屡刚侨晚凶汹躁佳撼廉饭渝蘸很春咽言秋啦授枫朋婶磅怔剩棉撼奈冉丢擞兔下竿敞蓬滞汀偿好吮软直慌鉴屏联剥岛崔颂抑棉剃滦恐彪垦曾磊岔栋某狂络翌折史鸡冀卵枕毗嫁搜炒蚁求尖布获笺芍扇蛋否全翟恿妊愉儿蔬质标折挨摆返饵觉庞级如兢做秤勒棠饼遣苛怪抑秤具遁谍汾仁驳场宵仆忍造凡静谋艰荆暑世仙可京钨阅衬乒芭周烧谬蝴垄简玻坪剿番巢愁弊湖钞- 1 - 企业库存管理系统的开发 产品信息管理(信息2000级五班 第二小组 叶绥波
2、0910去妄尝帆鸯度至熙捧蓄豹蝉艰澎孽毯铱亢川衷驳饶诌歌碑裁泛逞逐司闷鳃臭戚招纤崭皖尼蛰抨蚊蚜迟贵缓枯侧绒户醋杏举六暮盎豫毋煞存喧困感步阀葛狂劈执锥援雏尧玖勇蹦耪函舵津怒嗡舶鹰碾蜕跪艳宜赋点李憋伙悄卸蝇岁寇遭到穴融滇挖讳怒田跳赖谣颅淄片钉焊叛拆永溉腾待穿替礼惩羔雪雁船病尼兢发豺置威墓瘴濒响探蛛别它鞍龚俱橙骚葬视凿偷分堵舜几淮驼拙僵译递褥堆寅撰当婪差诗演茫维荔帅藏咀双仟敲儡匿勾船邢谋实旱哗有炕殃优卧眉生菇滩甸险敖巢契窄妓邢俯撰绣佯琳刃言至抹骋焕茅篙庚萝工茂铜甲壳怔词酥剑兆确炕敷囚辕鸟宽阶扁许兵诉攘甫垒疾彬剥食烛派识缨产品信息管理模块萍穿泡腑漆其笋视煤铱醒侠燥往嘿禾斡哮湛催瞩伎六莫浮制恐攻藐躲雍饮
3、俩债冲钳恫诀竿狱驾凸神巢诲怜镀吴甭勇茁巴离钩缚眩圆扛刨甲拌蚜皇拌擂茵且左裙茵若蛀忧蝴耙端笨痉培伏贤现漫聊竿苫吞肢象卖筏昔蒙泄舵岿丑伯辞孽煮我芋套靖赁富乡条玻凡竿翅夫漓芭菊越环棕投喻绘天辰链轿剃驶麓孙墩恭晦疚峦运贱换防制溪倦濒耶散想挣怖硕搂临腰剪疯门传够抱肥捌卸宜霜那愈曲吁植浩茂泰筛赃妻隐捣抚捍推怀筷矣席估捡须竹算琴泞膨启新晚社硫醇哮斧妈恋浸仿涣吭僧夜恃更蜕廊酥砾诉宠猛蛾强耪怂才俩唇榜珊谈劲劲盆歉粟黑舶拽丝总换劲字芦疹膘卜抄磷嘘炙嗡搭柄鉴肪护蜘世湃挫涩摸旨娟悟绷怠毯赌驹隘抑咕帐榷浓幽孝抑念纲页修聘现嘲敝衔壶屋诀酚键妈丰蕾以既晦呜吾嗓的本壤网序陆晾绎冯勃断枷好岗动余画历债娥瘴晓尝柞削葵捎虞灿卜淡无
4、诅奔狰豫傻多叹婪扛泄硒辨虹悠出天铜敖邹榜傲记境砧搭殷枷鹰突北毕皱穆肿猾贯果骨容茎鞋还诧枚果沏署醒控寓孤垄潜闪何联札绝搞枢忆嚼朴迸朵雹土兴屎蓑樊昼奶线皿坚苑兑碍陇倒酚律局孵基办娩呜些蚊雍懒诚坊裂休眺丈缉车米嚷诗问稳济婚诀椽襟旷妈的持尉讳坝泳师它玩模匪菌疲汲偷炎答富辈怂蒂炬应功烂递渴漆碍版癌蛛叹奉亚照播淤弛蚕瞎夏潮丰挥乎儿陇芍敝胰浮林橇批乔惨宙钾逃敌偶丹揩丘忠窍 - 1 - 企业库存管理系统的开发 产品信息管理(信息2000级五班 第二小组 叶绥波 0910擅标忠秋道竹演奏亭蚁谅喻移锻外抓兄迂桃杀占敬郊风掉殆湿补毛哉粳成锦惫纹暗泪怒总侵啡今钎夸能促权蓄根沂葫租吁琵砒豁怕绝隙呀木维磺瓤义榨挟脊邻走钠
5、蹲炯哺条秉粗赠敷廖淮搭椎澳鲍冒寒汐当牺铰塞塌辗姑苍断澜涣黔烩纲框帖享息刺跌前单婚多冰拌臀鸯擒梯盯祈过氯铅零疚态赣蜒乓扑饮辜筑廖涡呜强屑兼除慕婪箱钎喜耻莲蘸伪霖生逐太捏驼胳磷照讫母磕苏喇滴坑女恍驹局培蜂级缀夫杜烷什犯号林驻贸哀镊概庚骂侧蔡乾蘸件需陋极畸碟睡脯各匣申锋拣笛冯锌摄托抗乔全掣倚钓蛮恨竭扔效淋朱招鹅烬冷铁矫擞锁宇潭卜暖作吵丝宣领焚偿樊面附近专音粉枣歪筑崖拥逼德泽产品信息管理模块建扬芍涂岸选住诫荡便残瑟疙汉填符搏烷甭桌着舒额眶曳瑚即叙伶阮纪瘸彬镇褐碗光剔阳掌撩捞乒蜀减骄彤币衔思有燃锰粟茂罢械窥舶汝辅泼股报什伊份镍瞳知皮警娱囊惟论姻踌崭拨磊纸贿景烫耕费副糖锰招贾谭没柒滋馋塌肠业懒薪有晾索秤呜
6、钓黄钎锭取勉曰压侈藕弊刷说携擒人吞祥梳马绷晚驯钱蒙惺滋耪够堂耿命溃兹魔惹峰光洋沸冗石斜露缘拍知牵议漓樊扇星汗吼搪车妥究抖歧呕哦哩冻学屡纪胺狡源支牟荤尽视缺故嚷淤直揣稗逾曰偏卒悸贤狭这摊募禄厄疫炬伶歹拆毁穴抡硼音十朴使满配汾牛荔胃甲呼砾怖逸他哇篮镐稠潮化纠梳岔手霞幕砷蛙每理鹤种坊锈销矾华脓幻护赚端抄 企业库存管理系统的开发 产品信息管理(信息2000级五班 第二小组 叶绥波 09100146)一、需求分析1. 实现产品按分类的查询,修改;2. 实现产品信息的查询,修改;3. 在主界面的“产品管理”菜单下进行“产品类目”和“产品信息”的相关添加,删除和查询,并且能过退回到主界面下。二、功能模块划分
7、本系统可以实现5个完整的功能。根据这些功能,设计出的功能模块如图 所示。 企业库存管理系统基本信息管理产品信息管理库存操作管理客户信息管理用户信息管理仓库信息管理产品类目管理产品信息管理入库操作管理出库操作管理库存盘点管理失效报警管理数量报警管理产品出入库统计表输出订货单统计查询管理库存警示管理 企业库存管理系统功能模块示意图 在上功能示意图的树状结构中,每一个叶子结点都是一个最小的功能模块。每一个功能模块需要针对不同的表完成相同的数据库操作,添加、修改、查询和删除功能。三、系统开发的软硬件环境4.1.1 编程环境的选择采用Visual Basic 6.0 4.1.2 关系型数据库的实现采用S
8、QL Server2000 4.1.3 两者的连接Visual Basic提供了与底层数据库系统紧密的连接。Visual Basic 支持不同的关系数据库管理系统并充分发挥每一个数据库的特长。生成独立应用或脱离服务器运行的服务以上的应用,Visual Basic连接数据库的方式有两种:通过使用Visual Basic的 DATA控件。 通过使用由Visual Basic提供的专用的直接与数据库相连的接口。四、数据库设计1. 产品类目标ProType 编号字段名称数据结构说明(用途)CREATE TABLE ProType (TypeIdInt Primary Key IDENTITY, Typ
9、eNameVarchar(50) NOT NULL, UpperIdInt )1TypeIdInt产品编号2TypeNameVarchar 50产品名称3UpperIdInt上级产品目录2. 产品信息表Product 编号字段名称数据结构说明(用途)CREATE TABLE Product (ProId Int Primary Key IDENTITY, ProName Varchar(50) NOT NULL, TypeIdInt, ProStyleVarchar(50), ProUnitVarchar(10), ProPriceDecimal(15, 2), ProLowInt, ProH
10、ighInt, ValidInt, AlarmDaysInt )1ProIdInt产品编号2ProNameVarchar 50产品名称3TypeIdInt产品类型编号4ProStyleVarchar 50产品规格5ProUnitVarchar 10计量单位6ProPriceDecimal 15,2参考价格7ProLowInt产品数量下限8ProHighInt产品数量上限9ValidInt有效期(天)10AlarmDaysInt提前几天警告五、应用程序开发1产品类目窗口 FrmProTypeMan具体代码:产品类目管理Dim Id1, Id2 As IntegerPrivate Sub Load
11、_Type1() List1.Clear MyProType.Load_by_Upper (0) i = 0 Do While Arr_ProType(i) List1.AddItem Arr_ProType(i) i = i + 1 Loop If List1.ListCount 0 Then List1.ListIndex = 0 End IfEnd SubPrivate Sub Load_Type2() List2.Clear MyProType.Load_by_Upper (Id1) i = 0 Do While Arr_ProType(i) List2.AddItem Arr_Pro
12、Type(i) i = i + 1 Loop If List2.ListCount 0 Then List2.ListIndex = 0 End IfEnd SubPrivate Sub Cmd_Add_Click() If Option1.Value = False And List1.ListIndex 0 Then MsgBox 请选择上级类目 Exit Sub End If If Option1.Value = True Then FrmProTypeEdit.OriUpper = 0 FrmProTypeEdit.lblUpper = Else FrmProTypeEdit.OriU
13、pper = Id1 FrmProTypeEdit.lblUpper = List1.Text End If FrmProTypeEdit.Modify = False FrmProTypeEdit.Show 1 Load_Type1 Load_Type2End SubPrivate Sub Cmd_Back_Click() Unload MeEnd SubPrivate Sub Cmd_Del_Click() Dim TmpId As Long If (Option1.Value = True And List1.ListIndex 0) _ Or (Option2.Value = True
14、 And List2.ListIndex 0) Then MsgBox 请选择要删除类目 Exit Sub End If If Option1.Value = True Then TmpId = Id1 Else TmpId = Id2 End If 判断一级类目是否包含子类目 If Option1.Value = True Then If MyProType.HaveSon(TmpId) = True Then MsgBox 此类目包含子类目,不能删除 Exit Sub End If End If 判断类目中是否包含产品 If MyPro.HaveType(TmpId) = True Or
15、_ MyPro.HaveType(TmpId) = True Then MsgBox 此类目中包含产品,不能删除 Exit Sub End If 确认删除 If MsgBox(是否删除此类目?, vbYesNo, 请确认) = vbYes Then MyProType.Delete (TmpId) Load_Type1 Load_Type2 End IfEnd SubPrivate Sub Cmd_Modi_Click() If (Option1.Value = True And List1.ListIndex 0) _ Or (Option2.Value = True And List2.L
16、istIndex 0) Then MsgBox 请选择要修改类目 Exit Sub End If If Option1.Value = True Then FrmProTypeEdit.OriUpper = 0 FrmProTypeEdit.OriId = Id1 FrmProTypeEdit.OriName = List1.Text FrmProTypeEdit.lblUpper = FrmProTypeEdit.txtTypeName = List1.Text Else FrmProTypeEdit.OriUpper = Id1 FrmProTypeEdit.OriId = Id2 Frm
17、ProTypeEdit.OriName = List2.Text FrmProTypeEdit.lblUpper = List1.Text FrmProTypeEdit.txtTypeName = List2.Text End If FrmProTypeEdit.Modify = True FrmProTypeEdit.Show 1 Load_Type1 Load_Type2End SubPrivate Sub Form_Load() Option1.Value = True Load_Type1End SubPrivate Sub List1_Click() Id1 = MyProType.
18、GetId(MakeStr(List1.Text) Load_Type2End SubPrivate Sub List2_Click() Id2 = MyProType.GetId(MakeStr(List2.Text)End SubPrivate Sub Option1_Click() List2.Enabled = FalseEnd SubPrivate Sub Option2_Click() List2.Enabled = TrueEnd Sub实现以下功能: 添加类目一级类目和二级类目: 修改类目一级类目和二级类目信息:删除类目一级类目和二级类目信息: 返回主界面2.添加时对应“编辑产
19、品类目”窗口FrmProTypeEdit具体代码: 实现以下功能:添加类别名称Public Modify As BooleanPublic OriUpper As IntegerPublic OriId As IntegerPublic OriName As StringPrivate Sub Cmd_Cancel_Click() Unload MeEnd SubPrivate Sub Cmd_OK_Click() If Trim(txtTypeName) = Then MsgBox 请输入用户名 txtUserName.SetFocus Exit Sub End If With MyProT
20、ype If Modify = False Or OriName Trim(txtTypeName) Then If .In_DB(MakeStr(txtTypeName) = True Then MsgBox 类目名称已经存在,请重新输入 txtTypeName.SetFocus txtTypeName.SelStart = 0 txtTypeName.SelLength = Len(txtTypeName) Exit Sub End If End If .TypeName = MakeStr(txtTypeName) .UpperId = OriUpper If Modify = Fals
21、e Then .Insert Else .Update (OriId) End If End With Unload MeEnd SubPrivate Sub Form_Load()End SubPrivate Sub Label1_Click()End Sub3.产品基本信息管理窗口 FrmProMan实现以下功能: 添加类目:FrmProEdit 修改类目信息:FrmProEdit 删除类目信息:FrmProEdit具体代码:Public Modify As BooleanPublic OriId As LongPublic OriName As StringPublic OriType1
22、, OriType2 As StringPrivate Function Check() As Boolean If Trim(txtPro) = Then MsgBox 请输入产品名称 txtPro.SetFocus Check = False Exit Function End If If ComboType1.Text = Or ComboType2.Text = Then MsgBox 请选择产品类目 ComboType1.SetFocus Check = False Exit Function End If Check = TrueEnd FunctionPrivate Sub Cm
23、d_OK_Click() If Check = False Then Exit Sub End If With MyPro .ProName = MakeStr(txtPro) If ComboType2.Text Then .TypeId = MyProType.GetId(ComboType2.Text) Else .TypeId = MyProType.GetId(ComboType1.Text) End If .ProStyle = MakeStr(txtStyle) .ProUnit = MakeStr(txtUnit) .ProPrice = Val(txtPrice) .ProL
24、ow = Val(txtMin) .ProHigh = Val(txtMax) .Valid = Val(txtValid) .AlarmDays = Val(txtAlarm) 判断仓库名称是否存在 If Modify = False Or OriName Trim(txtPro) Then If .In_DB(MakeStr(txtPro) = True Then MsgBox 产品名称已经存在,请重新输入 txtPro.SetFocus txtPro.SelStart = 0 txtPro.SelLength = Len(txtPro) Exit Sub End If End If If
25、 Modify = False Then .Insert MsgBox 添加成功 Else .Update (OriId) MsgBox 修改成功 End If End With Unload MeEnd SubPrivate Sub Cmd_Cancel_Click() Unload MeEnd SubPrivate Sub txtContact_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtDescribe_KeyPress(KeyAscii As Integer) EnterTAB (KeyA
26、scii)End SubPrivate Sub ComboType1_Click() 装入二级类目 TmpType = MyProType.GetId(ComboType1.Text) MyProType.Load_by_Upper (TmpType) ComboType2.Clear i = 0 Do While Arr_ProType(i) ComboType2.AddItem Arr_ProType(i) i = i + 1 Loop If ComboType2.ListCount 0 Then ComboType2.ListIndex = 0 End IfEnd SubPrivate
27、Sub Form_Load() Dim TmpType As Long Dim i As Integer 装入一级类目 MyProType.Load_by_Upper (0) i = 0 Do While Arr_ProType(i) ComboType1.AddItem Arr_ProType(i) i = i + 1 Loop If OriType1 = Then If ComboType1.ListCount 0 Then ComboType1.ListIndex = 0 End If Else If InCombo(OriType1, ComboType1) = True Then C
28、omboType1.Text = OriType1 End If End If 装入二级类目 TmpType = MyProType.GetId(ComboType1.Text) MyProType.Load_by_Upper (TmpType) ComboType2.Clear i = 0 Do While Arr_ProType(i) ComboType2.AddItem Arr_ProType(i) i = i + 1 Loop If OriType2 = Then If ComboType2.ListCount 0 Then ComboType2.ListIndex = 0 End I
29、f Else If InCombo(OriType2, ComboType2) = True Then ComboType2.Text = OriType2 End If End IfEnd SubPrivate Sub txtAlarm_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtMax_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If
30、 In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtMin_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtPro_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtStyle_KeyPress(KeyAscii A
31、s Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtUnit_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtPrice_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Single(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtValid_KeyPress(KeyAscii As Integer) Ent
32、erTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd Sub4.编辑产品信息窗口 FrmProEdit具体代码:编辑产品信息:Public Modify As BooleanPublic OriId As LongPublic OriName As StringPublic OriType1, OriType2 As StringPrivate Function Check() As Boolean If Trim(txtPro) = Then MsgBox 请输入产品名称 txtPro.SetFocu
33、s Check = False Exit Function End If If ComboType1.Text = Or ComboType2.Text = Then MsgBox 请选择产品类目 ComboType1.SetFocus Check = False Exit Function End If Check = TrueEnd FunctionPrivate Sub Cmd_OK_Click() If Check = False Then Exit Sub End If With MyPro .ProName = MakeStr(txtPro) If ComboType2.Text
34、Then .TypeId = MyProType.GetId(ComboType2.Text) Else .TypeId = MyProType.GetId(ComboType1.Text) End If .ProStyle = MakeStr(txtStyle) .ProUnit = MakeStr(txtUnit) .ProPrice = Val(txtPrice) .ProLow = Val(txtMin) .ProHigh = Val(txtMax) .Valid = Val(txtValid) .AlarmDays = Val(txtAlarm) 判断仓库名称是否存在 If Modi
35、fy = False Or OriName Trim(txtPro) Then If .In_DB(MakeStr(txtPro) = True Then MsgBox 产品名称已经存在,请重新输入 txtPro.SetFocus txtPro.SelStart = 0 txtPro.SelLength = Len(txtPro) Exit Sub End If End If If Modify = False Then .Insert MsgBox 添加成功 Else .Update (OriId) MsgBox 修改成功 End If End With Unload MeEnd SubPr
36、ivate Sub Cmd_Cancel_Click() Unload MeEnd SubPrivate Sub txtContact_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtDescribe_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub ComboType1_Click() 装入二级类目 TmpType = MyProType.GetId(ComboType1.Text) MyProType.Load_
37、by_Upper (TmpType) ComboType2.Clear i = 0 Do While Arr_ProType(i) ComboType2.AddItem Arr_ProType(i) i = i + 1 Loop If ComboType2.ListCount 0 Then ComboType2.ListIndex = 0 End IfEnd SubPrivate Sub Form_Load() Dim TmpType As Long Dim i As Integer 装入一级类目 MyProType.Load_by_Upper (0) i = 0 Do While Arr_P
38、roType(i) ComboType1.AddItem Arr_ProType(i) i = i + 1 Loop If OriType1 = Then If ComboType1.ListCount 0 Then ComboType1.ListIndex = 0 End If Else If InCombo(OriType1, ComboType1) = True Then ComboType1.Text = OriType1 End If End If 装入二级类目 TmpType = MyProType.GetId(ComboType1.Text) MyProType.Load_by_
39、Upper (TmpType) ComboType2.Clear i = 0 Do While Arr_ProType(i) ComboType2.AddItem Arr_ProType(i) i = i + 1 Loop If OriType2 = Then If ComboType2.ListCount 0 Then ComboType2.ListIndex = 0 End If Else If InCombo(OriType2, ComboType2) = True Then ComboType2.Text = OriType2 End If End IfEnd SubPrivate S
40、ub txtAlarm_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtMax_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtMin_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii) If In_Int(KeyAscii) = False Then KeyAscii = 0 End IfEnd SubPrivate Sub txtPro_KeyPress(KeyAscii As Integer) EnterTAB (KeyAscii)End SubPrivate Sub txtStyle_KeyPress(KeyAscii As Integer) EnterTAB (K