数据库课程设计工厂信息管理系统物资管理子系统.doc

上传人:仙人指路1688 文档编号:2395657 上传时间:2023-02-17 格式:DOC 页数:27 大小:158KB
返回 下载 相关 举报
数据库课程设计工厂信息管理系统物资管理子系统.doc_第1页
第1页 / 共27页
数据库课程设计工厂信息管理系统物资管理子系统.doc_第2页
第2页 / 共27页
数据库课程设计工厂信息管理系统物资管理子系统.doc_第3页
第3页 / 共27页
数据库课程设计工厂信息管理系统物资管理子系统.doc_第4页
第4页 / 共27页
数据库课程设计工厂信息管理系统物资管理子系统.doc_第5页
第5页 / 共27页
点击查看更多>>
资源描述

《数据库课程设计工厂信息管理系统物资管理子系统.doc》由会员分享,可在线阅读,更多相关《数据库课程设计工厂信息管理系统物资管理子系统.doc(27页珍藏版)》请在三一办公上搜索。

1、工厂信息管理系统-物资管理子系统【摘要】物资管理系统为工厂等事业单位管理人员日常工作的调度、安排、计划。分为计划管理、物资管理、资金管理等各部门提供充足的信息和快捷的查询手段.其开发内容主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。利用vs2008软件及其提供的各种面向对象的开发工具,建立完整性强、安全性好的数据库,开发出功能完备,易使用的应用程序。经过调试、编译与实现,该程序界面友好、程序设计风格朴素,使用起来美观大方、方便易用。尤其是系统的“零件使用记录管理”功能和“零件存储记录管理”极大的减轻工作人员的工作量,并以快速、准确等优点取代人工操作,提高了管理工作效率。关键词:

2、物资管理系统 数据库 数据库系统 vs2008 三层架构一 引言随着经济的发展,社会的进步,计算机越来越深入到我们日常的工作学习及生活中,成为我们日常生活中不可缺少的辅助工具。利用数据库管理系统完成各领域的信息管理已成为现当今社会信息管理最常用的技术与手段,相较于过去人工操作信息管理,数据库管理系统更易操作,定期的数据库维护更易保证数据的完整性及安全性,并且有效提高了数据更新的及时性和有效性,功能强大,这都是人工操作信息管理所不能比拟的。因此,通过对经济可行性、时间可行性、社会可行性、技术可行性等全方位的研究,我们组最终选择了一个简单可行的数据库管理系统的开发作为本次科研训练的研究课题,选择我

3、们最熟悉的vs2008完成应用界面的设计和程序代码的编写,利用数据库进行整体数据的管理,并确定工厂信息管理系统-物资管理系统作为本次数据库管理系统的题目。 二 技术路线本系统采用vs2008中最常见的三层架构模式,即上层界面层中间逻辑层底层数据连接层。界面层,完成对各应用界面的设计以及各控件功能的实现;逻辑层,接受界面层发来的请求,根据编码的业务规则处理请求,从底层数据连接层获取数据或将数据发送到数据连接层,处理结果返回界面层;数据连接层,连接数据库,执行从数据库获取数据或向数据库发送数据的功能。本系统采用数据库系统完成对数据的管理。数据库系统是一个实际可运行的存储、维护和应用系统提供数据的软

4、件系统,是存储介质、处理对象和管理系统的集合体。数据库由数据库管理系统统一管理,数据的插入、修改和检索均要通过数据库管理系统进行。数据库管理系统是一种系统软件,它的主要功能是维护数据库并有效地访问数据库中任意部分数据。对数据库的维护包括保持数据的完整性、一致性和安全性。三 总体设计1. 需求分析已知技术参数或设计前提1、工厂物资管理设计多种零件的存放。2、每件零件需要记录零件号码、条形码、类别、价格、出厂日期等基本信息。3、除此之外,还需要记录零件的其他相关信息,如零件供应商的信息,存放的仓库信息、何种项目需要使用何种零件等。4、同时需要提供对信息的添加、编辑、删除等操作。2. 系统功能设计系

5、统开发的总体任务是实现物资管理系统的系统化、规范化和自动化。系统功能分析是在系统开发的总体任务的基础上完成的。物资管理系统需要完成的功能主要有: 1 、 系统管理功能:添加用户、修改密码、退出系统。2 、 零件信息管理功能:添加零件信息、修改零件信息、删除零件信息、查询零件信息(精确查询、模糊查询、按时间段查询)。3 、 供应商管理功能:添加信息、修改信息、删除信息。4 、 项目信息管理功能:添加信息、修改信息、删除信息。5 、 仓库信息管理功能:添加信息、修改信息、删除信息。6 、 零件使用记录管理功能:零件使用记录浏览(包括添加信息、修改信息、删除信息)。7 、 零件存储记录管理功能:零件

6、存储记录浏览(包括添加信息、修改信息、删除信息)。且设计如下面所示的物资管理管理系统功能模块图。系统管理供应商管理项目管理零件管理仓库管理使用记录存储记录物资管理系统添加信息查找信息添加信息删除信息添加信息删除信息修改信息修改信息添加用户退出系统修改密码修改信息修改信息添加信息删除信息修改信息删除信息添加信息删除信息修改信息添加信息精确查询模糊查询时间查询删除信息图1 系统功能模块图四 详细设计由于我在本次系统开发中主要承担的是数据库设计,这里的详细设计就主要介绍数据库设计。1. 数据库概念结构设计物资管理系统,总共含有四个实体,分别是零件、供应商、项目、仓库,他们的实体E-R图分别如下所示:

7、零件条形码零件号类别零件实体E-R图供应商供应商编号名称地址电话供应商实体E-R图项目项目编号启动时间金额终止时间项目名称项目实体E-R图仓库仓库名仓库号已用容量地址容量仓库实体E-R图合成后,全局E-R图如下:供应商供应供应量名称地址电话编号项目项目名称项目编号终止时间金额启动时间零件零件号条形码类别存储价格日期仓库仓库号仓库名地址容量易用容量存储量完整的实体E-R图2. 数据库逻辑结构设计根据以上的实体图即可在数据库中建立表格,为了系统的安全,有必要建立一个登录窗体,所以在数据库中还应建立一个密码表。此数据库包括以下几张关系表。密码表字段类型长度允许空格用户名nvarchar20NOT N

8、ULL密码intNOT NULL仓库信息表字段类型长度允许空值仓库编号intNOT NULL仓库名nvarchar20NULL地址nvarchar100NULL容量intNULL已用容量intNULL供应商信息表字段类型长度允许空值供应商编号intNOT NULL名称nvarchar50NULL地址nvarchar100NULL电话nvarchar20NULL零件信息表字段类型长度允许空格零件号intNOT NULL条形码nvarchar50NULL类别nvarchar50NULL供应记录表字段类型长度允许空值供应商编号intNULL零件号intNULL供应数量intNULL编号intNOT

9、NULL 价格nvarchar50NULL出厂日期 datetimeNULL存储记录表字段类型长度允许空值零件号intNOT NULL仓库编号intNOT NULL存储数量intNOT NULL编号intNOT NULL零件使用记录字段类型长度允许空值零件号intNOT NULL项目编号intNOT NULL使用数量intNOT NULL编号intNOT NULL项目信息表字段类型长度允许空值项目编号intNOT NUL项目名称nvarchar50NULL金额nvarchar50NULL起始时间datetimeNOT NULL 终止时间datetimeNULL3. 数据库物理结构设计本着提高数

10、据库的安全性和数据库的查询效率,在存储位置的选择上采用RAID0+1方式。即,将整个数据库系统的数据分成两份,每一份占整体的50%,分别存放在两块硬盘中,作为该系统的主盘。再用同样的两块硬盘用同样的方法存储数据库数据,这两块盘作为从盘,用数据的备份,一旦主盘出现问题,将主从盘对调,这样便可大大降低损失!该存储方式的示意图如下图所示:4. SQL语句脚本代码(1)建表CREATE TABLE dbo.仓库信息 (编号 int IDENTITY (1, 1) NOT NULL ,名称 nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ,地址 nvarchar

11、 (100) COLLATE Chinese_PRC_CI_AS NULL ,容量 int NULL ,已用容量 int NULL ) ON PRIMARYGOCREATE TABLE dbo.供应商信息 (编号 int IDENTITY (1, 1) NOT NULL ,名称 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,地址 nvarchar (100) COLLATE Chinese_PRC_CI_AS NULL ,电话 nvarchar (20) COLLATE Chinese_PRC_CI_AS NULL ) ON PRIMARYGOCR

12、EATE TABLE dbo.供应记录 (供应商编号 int NULL ,零件编号 int NULL ,供应数量 int NULL ,编号 int IDENTITY (1, 1) NOT NULL ,价格 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,出厂日期 datetime NULL ) ON PRIMARYGOCREATE TABLE dbo.存储记录 (零件编号 int NOT NULL ,仓库编号 int NOT NULL ,存储数量 int NOT NULL ,编号 int IDENTITY (1, 1) NOT NULL ) ON P

13、RIMARYGOCREATE TABLE dbo.零件使用记录 (零件编号 int NULL ,项目编号 int NULL ,使用数量 int NULL ,编号 int IDENTITY (1, 1) NOT NULL ) ON PRIMARYGOCREATE TABLE dbo.零件信息 (编号 int IDENTITY (1, 1) NOT NULL ,条形码 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,类别 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ) ON PRIMARYGOCREATE T

14、ABLE dbo.项目信息 (编号 int IDENTITY (1, 1) NOT NULL ,名称 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,金额 nvarchar (50) COLLATE Chinese_PRC_CI_AS NULL ,启动时间 datetime NULL ,终止时间 datetime NULL ) ON PRIMARYGO(2)存储过程create PROCEDURE dbo.PartsFunctionName nvarchar(20) =null,编号 int =null,条形码 nvarchar(50) = null

15、,类别 nvarchar(20) =null,价格 nvarchar(20) =null,出厂日期 datetime=null,供应商编号int= null,数量int= null,原供应商编号int= null,起始时间datetime =null,结束时间datetime =nullASif(FunctionName=search)beginselect 零件信息.编号 AS 零件编号,类别,条形码,供应数量,价格,供应商编号 ,供应商信息.名称,出厂日期 from 零件信息left join 供应记录on 零件信息.编号=供应记录.零件编号left join 供应商信息on 供应商信息.

16、编号=供应记录.供应商编号endif(FunctionName=add)begininsert into 零件信息 (条形码,类别) values(条形码,类别)set 编号=(select top 1 编号 from 零件信息 order by 编号 desc)insert into 供应记录 (零件编号,供应数量,供应商编号,价格,出厂日期) values (编号,数量,供应商编号,价格,出厂日期)endif(FunctionName=update)beginupdate 零件信息 set 条形码=条形码,类别=类别 where 编号=编号update 供应记录 set 供应商编号=供应商

17、编号,价格=价格,供应数量=数量,出厂日期=出厂日期 where 零件编号=编号 and 供应商编号=原供应商编号endif(FunctionName=del)begindelete from 零件使用记录 where 零件编号=编号delete from 存储记录 where 零件编号=编号delete from 供应记录 where 零件编号=编号delete from 零件信息 where 编号=编号endif(FunctionName=getRetCode)beginselect distinct 条形码 from 零件信息endif(FunctionName=getSupply)be

18、ginselect 编号,名称 from 供应商信息 endif(FunctionName=getInfo)beginselect 零件信息.编号 AS 零件编号,类别,条形码,供应数量,价格,供应商编号 ,供应商信息.名称,出厂日期 from 零件信息left join 供应记录on 零件信息.编号=供应记录.零件编号left join 供应商信息on 供应商信息.编号=供应记录.供应商编号where (条形码=条形码 and 供应商信息.编号=供应商编号 ) or(条形码=条形码 and 供应商编号 is null) or(条形码 is null and 供应商信息.编号=供应商编号 )

19、or (条形码 is null and 供应商编号 is null ) endif(FunctionName=darkSearch)beginselect 零件信息.编号 AS 零件编号,类别,条形码,供应数量,价格,供应商编号 ,供应商信息.名称,出厂日期 from 零件信息left join 供应记录on 零件信息.编号=供应记录.零件编号left join 供应商信息on 供应商信息.编号=供应记录.供应商编号where 条形码 like 条形码endif(FunctionName=dateSearch)beginselect 零件信息.编号 AS 零件编号,类别,条形码,供应数量,价格

20、,供应商编号 ,供应商信息.名称,出厂日期 from 零件信息left join 供应记录on 零件信息.编号=供应记录.零件编号left join 供应商信息on 供应商信息.编号=供应记录.供应商编号where 出厂日期起始时间 and 出厂日期结束时间endRETURNGOcreate PROCEDURE ProjectsFunctionName nvarchar(20) =null,编号 int =null,金额 nvarchar(20) =null,名称 nvarchar(20)=null,启动时间datetime =null,终止时间datetime =null,零件编号 int

21、= null,项目编号 int =null,数量int =nullASif(FunctionName=search)beginselect * from 项目信息endif(FunctionName=add)begininsert into 项目信息 (名称,金额,启动时间,终止时间) values (名称,金额,启动时间,终止时间)endif(FunctionName=update)beginupdate 项目信息 set 名称=名称,金额=金额,启动时间=启动时间,终止时间=终止时间 where 编号=编号endif(FunctionName=del)begindelete from 项目

22、信息 where 编号=编号endif(FunctionName=searchRecord)beginselect 项目信息.名称 AS 项目名称,项目信息.编号 as 项目编号, 零件使用记录.编号,使用数量 ,零件信息.编号 as 零件编号,零件信息.条形码,零件信息.类别from 零件信息inner join 零件使用记录on 零件使用记录.零件编号=零件信息.编号inner join 项目信息on 零件使用记录.项目编号=项目信息.编号endif(FunctionName=updateRecord)beginupdate 零件使用记录 set 零件编号=零件编号 ,项目编号=项目编号,

23、使用数量=数量 where 编号=编号endif(FunctionName=delRecord)begindelete from 零件使用记录 where 编号 =编号endif(FunctionName=addRecord)begininsert into 零件使用记录(零件编号,项目编号,使用数量) values (零件编号,项目编号,数量)endRETURNGOCREATE PROCEDURE ShopManageFunctionName nvarchar(20) =null,编号 int =null,地址 nvarchar(50) = null,电话 nvarchar(20) =nul

24、l,名称 nvarchar(20) =nullASif(FunctionName=Search)beginselect 编号,名称,地址,电话 from 供应商信息 endif(FunctionName=add)begininsert into 供应商信息 (名称,地址,电话) values ( 名称, 地址,电话)endif(FunctionName=add)beginupdate 供应商信息 set 名称=名称,地址=地址,电话=电话 where 编号=编号endif(FunctionName=del)begindelete from 供应记录 where 供应商编号=编号delete f

25、rom 供应商信息 where 编号=编号endRETURNGOCREATE PROCEDURE WarehouseFunctionName nvarchar(20) =null,编号 int =null,地址 nvarchar(50) = null,名称 nvarchar(20) =null,仓库编号 int =null,存储数量 int =null,零件编号 int = nullASif(FunctionName=search)beginselect 编号,名称,地址 from 仓库信息 endif(FunctionName=add)begininsert into 仓库信息(名称,地址)

26、 values (名称,地址)endif(FunctionName=update)beginupdate 仓库信息 set 名称=名称,地址=地址 where 编号=编号endif(FunctionName=del)begindelete from 存储记录 where 仓库编号=编号delete from 仓库信息 where 编号=编号endif(FunctionName=searchRecord)beginselect 存储记录.编号, 零件信息.编号 as 零件编号,条形码,类别 as 零件类别,仓库信息.编号 as 仓库编号,仓库信息.名称 as 仓库名称,仓库信息.地址 as 仓库

27、地址,存储数量from 零件信息 inner join 存储记录on 零件信息.编号=存储记录.零件编号inner join 仓库信息on 存储记录.仓库编号=仓库信息.编号endif(FunctionName=updateRecord)beginupdate 存储记录 set 仓库编号=仓库编号 ,存储数量=存储数量 where 编号=编号endif(FunctionName=addRecord)begininsert into 存储记录(零件编号,存储数量,仓库编号) values (零件编号,存储数量,仓库编号)endif(FunctionName=delRecord)begindele

28、te from 存储记录 where 编号=编号endRETURN五 总结本系统是一个典型的信息管理系统,其主要通过软件工程方面的选择课题、需求分析、系统功能设计、选用工具、详细设计、系统测试等几个步骤来实现。开发本系统的过程中,首先要对工厂物资管理进行系统调研,熟悉其中的零件的存储管理、零件的使用管理和供应记录管理流程、步骤;其次在系统需求分析过程中,要透过现象看本质,敏锐观察到工厂物资管理中存在的各种问题,并在总体设计把握好对问题的分析、理解,进而解决问题;选用开发工具要选用自己最熟悉、应用较多的开发工具,本系统开发选用vs2008,其具有语言简单、功能强大、组件众多的优点,界面设计简单,

29、尤其是三层构架的使用使整个系统功能分分工更加明确。程序模块的编制中,重点把握系统内部完整性、功能性、实用性、便捷性,使其能够协调统一、运行无误。六 英文参考资料及翻译 外文资料 Database Management Systems A database (sometimes spelled data base) is also called an electronic database , referring to any collection of data, or information, that is specially organized for rapid search and

30、retrieval by a computer. Databases are structured to facilitate the storage, retrieval , modification, and deletion of data in conjunction with various data-processing operations .Databases can be stored on magnetic disk or tape, optical disk, or some other secondary storage device. A database consi

31、sts of a file or a set of files. The information in these files may be broken down into records, each of which consists of one or more fields. Fields are the basic units of data storage , and each field typically contains information pertaining to one aspect or attribute of the entity described by t

32、he database . Using keywords and various sorting commands, users can rapidly search , rearrange, group, and select the fields in many records to retrieve or create reports on particular aggregate of data. Complex data relationships and linkages may be found in all but the simplest databases .The sys

33、tem software package that handles the difficult tasks associated with creating ,accessing, and maintaining database records is called a database management system(DBMS).The programs in a DBMS package establish an interface between the database itself and the users of the database. (These users may b

34、e applications programmers, managers and others with information needs, and various OS programs.) A DBMS can organize, process, and present selected data elements form the database. This capability enables decision makers to search, probe, and query database contents in order to extract answers to n

35、onrecurring and unplanned questions that arent available in regular reports. These questions might initially be vague and/or poorly defined ,but people can “browse” through the database until they have the needed information. In short, the DBMS will “manage” the stored data items and assemble the ne

36、eded items from the common database in response to the queries of those who arent programmers. A database management system (DBMS) is composed of three major parts:(1)a storage subsystem that stores and retrieves data in files;(2) a modeling and manipulation subsystem that provides the means with wh

37、ich to organize the data and to add , delete, maintain, and update the data;(3)and an interface between the DBMS and its users. Several major trends are emerging that enhance the value and usefulness of database management systems; Managers: who require more up-to-data information to make effective

38、decision Customers: who demand increasingly sophisticated information services and more current information about the status of their orders, invoices, and accounts. Users: who find that they can develop custom applications with database systems in a fraction of the time it takes to use traditional

39、programming languages. Organizations : that discover information has a strategic value; they utilize their database systems to gain an edge over their competitors. The Database Model A data model describes a way to structure and manipulate the data in a database. The structural part of the model spe

40、cifies how data should be represented(such as tree, tables, and so on ).The manipulative part of the model specifies the operation with which to add, delete, display, maintain, print, search, select, sort and update the data. Hierarchical Model The first database management systems used a hierarchic

41、al model-that is-they arranged records into a tree structure. Some records are root records and all others have unique parent records. The structure of the tree is designed to reflect the order in which the data will be used that is ,the record at the root of a tree will be accessed first, then reco

42、rds one level below the root ,and so on. The hierarchical model was developed because hierarchical relationships are commonly found in business applications. As you have known, an organization char often describes a hierarchical relationship: top management is at the highest level, middle management

43、 at lower levels, and operational employees at the lowest levels. Note that within a strict hierarchy, each level of management may have many employees or levels of employees beneath it, but each employee has only one manager. Hierarchical data are characterized by this one-to-many relationship among data. In the hierarchical approach

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号