前言
之前数据库老师布置了一个项目,让分组完成, 昨天晚上刚好有时间,就写了一下,今天又优化了一下,算是完成了大体要求,主要的工作在于E-R图的绘制,要各个层次的E-R图都要有,大概绘制了10来张E-R图吧,然后就是数据库建模,逻辑和物理的建模都要做,再就是清单文件的生成和属性列表的撰写,最后就是编前面的文档了。
接下来,上文档。
| 学 号: |
《数据库原理与应用》
课程设计
| 教 学 院 | 计算机 |
| 课程名称 | 数据库原理与应用理论 |
| 题 目 | 工厂综合信息管理系统 |
| 班 级 | 21计科专升本 三班 |
| 组 长 | 张稚琦 |
| 同组人员 | 彭雪焕,陈菲,陈安宁,赵晓蓉,吴梓莹 |
| 指导教师 | 高 超 |
| 2021 | 年 | 12 | 月 | 28 | 日 |
引 言
改革开放已然过去43周年,回顾改革开放的历程,一堆大中小型企业拔地而起,为社会经济活动增添了无限活力,而这其中,工厂,作为最关键的一环,随着改革开放的脚步,也必然走进工业4.0,利用信息化的技术与手段,促进其良性发展。
工厂综合信息管理系统是将传统的人员管理,库存管理,生产管理,销售管理由人工操作转为由专业的数据库系统来进行管理,它能整合工厂内部信息,消除信息孤岛,解决各种难题,提高生产效率,降低仓库成本,还能使工厂的管理者对仓库、人员、生产等情况做好把控,为其决策提供必要的材料支撑与科学依据。
本次课程设计的题目是“工厂综合信息管理系统”,其主要的目的是:通过开发本管理系统,能够消除传统人工工作流程中所产生的随意性大、责任不清、库存不清等弊端,通过信息化的手段,为工厂企业赋能。根据本信息系统开发难度评判,遂决定以macOS Big Sur 11.4为开发平台,采用装载在Docker容器中的SQL Server 2019 (RTM-CU13),E-R图绘制采用微软的Microsoft Visio 2016, 数据库概念模型与物理模型的设计,我们采用Sybase的PowerDesigner15.1,利用软件工程相关的思想和方法,开发本信息系统。本系统由仓库库存管理模块,产品销售管理模块,车间管理模块,工人管理模块等组成。
目录
一、 人员分配
| 工厂综合信息管理系统设计人员分工 | |||
| 开发小组 | 整体分工 | 承担设计具体工作 | |
| 组长 | 张稚琦 | 整体架构设计 | 确定课题,设计E-R图,代码优化,代码调试。 |
| 组 员 | 彭雪焕 | 逻辑与物理建模 | 设计CDM逻辑图与PDM物理图。 |
| 吴梓莹 | 编码 | 数据库表,视图,索引,触发器等的建立。 | |
| 陈菲 | 数据库设计 | 表格部分的设计与建立。 | |
| 赵晓蓉 | 编码 | 数据库清单文件的完成。 | |
| 陈安宁 | 需求分析 | 调查业务需求,优化业务流程。 | |
二、 课程设计目的和要求
课程设计是为了提高学生的实际动手能力与团队合作能力,能够综合应用所学知识,通过团队合作,设计与制造出较复杂的数据库系统。
本课程设计是实现工厂综合信息管理系统,使用SQL SQL Server 2019 (RTM-CU13)进行后台数据库的管理。
通过本课程设计可以达成如下目标:
1、能够实现高效的团队合作;
2、熟练使用PowerDesigner15.1进行数据库建模;
3、熟练使用Microsoft Visio 2016进行E-R图的绘制;
3、掌握编写信息系统软件设计文档能力;
4、进一步提高独立分析问题、解决问题的能力;
5、掌握SQL SQL Server 2019 (RTM-CU13)在信息系统开发过程中的应用。
三、 课程设计过程
1、需求分析
2、概念结构设计
3、数据库逻辑设计
4、数据库物理设计
5、数据库实施
6、数据库优化和实现
四、需求分析阶段
1.应用背景
传统的工厂管理系统主要就是写在纸上,耗费人力资源大,管理起来更是难上加难,而通过数据库系统去管理,可以实现财务、仓库、工人、生产的自动化管理,提高工厂业务效率,降低经营成本。
2.需求分析目标
1.明确用户需求,复刻业务流程;
2.提高处理速度;
3.控制精度以及日常业务处理能力的提高;
4.管理信息服务的改进;
5.人员工作效率的提高。
3.系统设计概要
(1)各个实体的编号不能重复。
(2)一个工人只能在一个车间内工作,一个车间内可以有多个工人。
(3)一个工厂可以多个仓库,一个仓库只能属于一个工厂
(4)一个仓库可以存放多种产品,一种产品可以存放在多个仓库内。
(5)一个客户可以购买多个产品,一个产品可以被多个客户购买。
(6)一个零件可以参与组装多个产品,一个产品可以被多个零件组装。
(7)一个车间能生产多种零件,一种零件可以被多个车间生产。
(8)一个仓库可以存放多种零件,一种零件可以存放在多个仓库
4.软件处理对象:
涉及哪些方面的数据,数据之间的关系(计算格式转换等);
1.工厂:工厂编号、工厂名、工厂地址、厂长名
2.仓库:仓库编号、仓库管理员姓名、仓库电话
3.客户: 客户编号、客户姓名、客户性别、客户地址
4.车间:车间编号、车间名、车间管理员姓名、车间电话、车间地址
5.零件:零件编号、零件名称、零件价格、零件类别、零件重量
6.工人:职工号、工人姓名、工人性别、工人工种
7.产品:产品编号、产品名称、产品价格、产品规格、产品类别
5.系统可行性分析
本“工厂综合信息管理系统”设计的总体任务是实现工厂仓库、产品、零件、客户、工人的综合信息管理,鉴于小组成员都有较为扎实的编码能力以及数据库理论基础,加之本系统的开发周期较为充裕,完成本系统的开发任务,不成问题。
6.系统的设计目标及其意义
该系统由库存管理模块、人员管理模块、生产管理模块、销售管理模块等组成,
该系统由商品信息管理模块,员工信息管理模块,供应商信息管理模块,仓库信息管理模块等可以完成商品的进销存和查询,更改等的基本操作。并根据客户的要求完善系统的功能需求。系统功能有:
(1)生产管理模块
生产管理是企业生产经营活动中及其重要的一环,它关系到产品质量能否得到保证,生产是否能够顺利进行等功能。
(2)库存管理模块:
库存管理是指在上产经营中为销售和耗用而存储的各种资产。企业存货不当都会增加不必要的费用:存货过多将导致物资的积压、存储费用增加、流动资金周转不利,并且过量的库存会掩盖管理不善的问题。存货不足则影响企业的正常销售活动。库存管理的目标是需求最佳存货数量,使库存的成本总额最小化。其主要业务如下:
产品入库、出库、盘库等日常处理。
科学合理地确定某库存物资的库存控制参数。如:最佳订货批量、最大库存量、最佳缺货量、最佳订购周期等,进行严格的库存控制工作。
汇总统计各类库存数据,反应和监督储备资金占用及采购资金使用情况。
(3)销售管理模块
销售对一个企业的生存和发展是至关重要的,它不再是传统意义上的“卖东西”,它对外关系到企业产品、服务和企业形象等多方面因素,对内涉及到销售、库存、财务等信息。此外信息化的高速发展为企业的销售工作提出了新的挑战,封闭意味着落后,超市要抓住时机,引入现代化的销售管理模式,实施企业的信息化、智能化销售管理,才能使超市在激烈的市场竞争中立于不败之地。
(4)人员管理模块
人员是一个企业的基本组成,是不可或缺的,良好的人员结构能够极大的提高企业的工作效率与盈利水平。
五、概念设计(关系图)
7.经分析,本系统的E-R图如下:
图 1工厂实体E-R图
图 2仓库实体E-R图
图 3产品实体E-R图
图 4客户实体E-R图
图 5车间实体E-R图
图 6 零件实体E-R图
图 7工人实体E-R图
8.各实体间关系E-R图如下:
图 8完整的E-R图
六、逻辑结构图CDM
图 9逻辑结构图CDM
七、物理结构图PDM
图 10物理结构图PDM
八、数据库设计
9.逻辑结构设计
①Factory表结构
| 数据表名 | Factory | ||||||
| 数据表中文含义 | 工厂 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| FactoryID | 工厂编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| FactoryName | 工厂名 | nVarchar(20) | TRUE | FALSE | FALSE | ||
| FactoryAddress | 工厂地址 | nVarchar(50) | FALSE | FALSE | FALSE | ||
| FactoryDirectorName | 厂长名 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 11 Factory表结构
②Storage表结构
| 数据表名 | Storage | ||||||
| 数据表中文含义 | 仓库 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| StorageID | 仓库编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| FactoryID | 工厂编号 | nVarchar(4) | FALSE | FALSE | TRUE | ||
| StorageAdminName | 仓库管理员姓名 | nVarchar(20) | TRUE | FALSE | FALSE | ||
| StoragePhone | 仓库电话 | nVarchar(11) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 12 Storage表结构
③Product表结构
| 数据表名 | Product | ||||||
| 数据表中文含义 | 产品 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| ProductID | 产品编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| ProductName | 产品名称 | nVarchar(20) | TRUE | FALSE | FALSE | ||
| ProductPrice | 产品价格 | nDecimal(8,2) | FALSE | FALSE | FALSE | ||
| ProductSize | 产品规格 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| ProductClass | 产品类别 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 13 Product表结构
④Client表结构
| 数据表名 | Client | ||||||
| 数据表中文含义 | 客户 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| ClientID | 客户编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| ClientName | 客户姓名 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| ClientGender | 客户性别 | nVarchar(2) | FALSE | FALSE | FALSE | ||
| ClientAddress | 客户地址 | nVarchar(50) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 14 Client表结构
⑤WorkShop表结构
| 数据表名 | WorkShop | ||||||
| 数据表中文含义 | 车间 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| WorkShopID | 车间编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| WorkShopName | 车间名 | nVarchar(20) | TRUE | FALSE | FALSE | ||
| FactoryID | 工厂编号 | nVarchar(4) | FALSE | FALSE | FALSE | ||
| WorkShopAdminName | 车间管理员姓名 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| WorkShopAddress | 车间地址 | nVarchar(50) | FALSE | FALSE | FALSE | ||
| WorkShopPhone | 车间电话 | nVarchar(11) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 15 WorkShop表结构
6Spare表结构
| 数据表名 | Spare | ||||||
| 数据表中文含义 | 零件 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| SpareId | 零件编号 | nVarchar(4) | TRUE | TRUE | FALSE | ||
| SpareName | 零件名称 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| SpareWeight | 零件重量 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| SparePrice | 零件价格 | Decimal(8,2) | FALSE | FALSE | FALSE | ||
| SpareClass | 零件类别 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 16 Spare表结构
7Worker表结构
| 数据表名 | Worker | ||||||
| 数据表中文含义 | 工人 | ||||||
| 字段名称 | 中文含义 | 字段类型及长度 | 非空约束 | 主键约束 | 外键约束 | ||
| WorkerID | 职工号 | nVarchar (4) | TRUE | TRUE | FALSE | ||
| WorkShopID | 车间编号 | nVarchar(4) | FALSE | FALSE | TRUE | ||
| WorkShopName | 工人姓名 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| WorkerGender | 工人性别 | nVarchar(2) | FALSE | FALSE | FALSE | ||
| WorkerClass | 工种 | nVarchar(20) | FALSE | FALSE | FALSE | ||
| 注释 | 无 | ||||||
图 17Worker表结构
九、数据库清单文件
/*==============================================================*/
/* DBMS name: Microsoft SQL Server 2008 */
/* Created on: 2021/12/4 11:05:52 */
/*==============================================================*/
if exists (select 1
from sysobjects
where id = object_id('Client')
and type = 'U')
drop table Client
go
if exists (select 1
from sysobjects
where id = object_id('Factory')
and type = 'U')
drop table Factory
go
if exists (select 1
from sysindexes
where id = object_id('Manufacture')
and name = 'Manufacture2_FK'
and indid > 0
and indid < 255)
drop index Manufacture.Manufacture2_FK
go
if exists (select 1
from sysindexes
where id = object_id('Manufacture')
and name = 'Manufacture_FK'
and indid > 0
and indid < 255)
drop index Manufacture.Manufacture_FK
go
if exists (select 1
from sysobjects
where id = object_id('Manufacture')
and type = 'U')
drop table Manufacture
go
if exists (select 1
from sysindexes
where id = object_id('Package')
and name = 'Package2_FK'
and indid > 0
and indid < 255)
drop index Package.Package2_FK
go
if exists (select 1
from sysindexes
where id = object_id('Package')
and name = 'Package_FK'
and indid > 0
and indid < 255)
drop index Package.Package_FK
go
if exists (select 1
from sysobjects
where id = object_id('Package')
and type = 'U')
drop table Package
go
if exists (select 1
from sysobjects
where id = object_id('Product')
and type = 'U')
drop table Product
go
if exists (select 1
from sysindexes
where id = object_id('ProductStorage')
and name = 'ProductStorage2_FK'
and indid > 0
and indid < 255)
drop index ProductStorage.ProductStorage2_FK
go
if exists (select 1
from sysindexes
where id = object_id('ProductStorage')
and name = 'ProductStorage_FK'
and indid > 0
and indid < 255)
drop index ProductStorage.ProductStorage_FK
go
if exists (select 1
from sysobjects
where id = object_id('ProductStorage')
and type = 'U')
drop table ProductStorage
go
if exists (select 1
from sysindexes
where id = object_id('Sel')
and name = 'Sel2_FK'
and indid > 0
and indid < 255)
drop index Sel.Sel2_FK
go
if exists (select 1
from sysindexes
where id = object_id('Sel')
and name = 'Sel_FK'
and indid > 0
and indid < 255)
drop index Sel.Sel_FK
go
if exists (select 1
from sysobjects
where id = object_id('Sel')
and type = 'U')
drop table Sel
go
if exists (select 1
from sysobjects
where id = object_id('Spare')
and type = 'U')
drop table Spare
go
if exists (select 1
from sysindexes
where id = object_id('SpareStorage')
and name = 'SpareStorage2_FK'
and indid > 0
and indid < 255)
drop index SpareStorage.SpareStorage2_FK
go
if exists (select 1
from sysindexes
where id = object_id('SpareStorage')
and name = 'SpareStorage_FK'
and indid > 0
and indid < 255)
drop index SpareStorage.SpareStorage_FK
go
if exists (select 1
from sysobjects
where id = object_id('SpareStorage')
and type = 'U')
drop table SpareStorage
go
if exists (select 1
from sysindexes
where id = object_id('Storage')
and name = 'manageStorage_FK'
and indid > 0
and indid < 255)
drop index Storage.manageStorage_FK
go
if exists (select 1
from sysobjects
where id = object_id('Storage')
and type = 'U')
drop table Storage
go
if exists (select 1
from sysindexes
where id = object_id('WorkShop')
and name = 'manageWorkShop_FK'
and indid > 0
and indid < 255)
drop index WorkShop.manageWorkShop_FK
go
if exists (select 1
from sysobjects
where id = object_id('WorkShop')
and type = 'U')
drop table WorkShop
go
if exists (select 1
from sysindexes
where id = object_id('Worker')
and name = 'engageWorker_FK'
and indid > 0
and indid < 255)
drop index Worker.engageWorker_FK
go
if exists (select 1
from sysobjects
where id = object_id('Worker')
and type = 'U')
drop table Worker
go
/*==============================================================*/
/* Table: Client */
/*==============================================================*/
create table Client (
ClientID nvarchar(4) not null,
ClientName nvarchar(20) null,
ClientGender nvarchar(2) null,
ClientAddress nvarchar(50) null,
constraint PK_CLIENT primary key nonclustered (ClientID)
)
go
/*==============================================================*/
/* Table: Factory */
/*==============================================================*/
create table Factory (
FactoryID nvarchar(4) not null,
FactoryName nvarchar(20) not null,
FactoryAddress nvarchar(50) null,
FactoryDirectorName nvarchar(20) null,
constraint PK_FACTORY primary key nonclustered (FactoryID)
)
go
/*==============================================================*/
/* Table: Manufacture */
/*==============================================================*/
create table Manufacture (
WorkShopID nvarchar(4) not null,
WorkShopName nvarchar(20) not null,
SpareID nvarchar(4) not null,
ProduceDate datetime null,
constraint PK_MANUFACTURE primary key (WorkShopID, WorkShopName, SpareID)
)
go
/*==============================================================*/
/* Index: Manufacture_FK */
/*==============================================================*/
create index Manufacture_FK on Manufacture (
WorkShopID ASC,
WorkShopName ASC
)
go
/*==============================================================*/
/* Index: Manufacture2_FK */
/*==============================================================*/
create index Manufacture2_FK on Manufacture (
SpareID ASC
)
go
/*==============================================================*/
/* Table: Package */
/*==============================================================*/
create table Package (
SpareID nvarchar(4) not null,
ProductID nvarchar(4) not null,
PackageDate datetime null,
constraint PK_PACKAGE primary key (SpareID, ProductID)
)
go
/*==============================================================*/
/* Index: Package_FK */
/*==============================================================*/
create index Package_FK on Package (
SpareID ASC
)
go
/*==============================================================*/
/* Index: Package2_FK */
/*==============================================================*/
create index Package2_FK on Package (
ProductID ASC
)
go
/*==============================================================*/
/* Table: Product */
/*==============================================================*/
create table Product (
ProductID nvarchar(4) not null,
ProductName nvarchar(20) not null,
ProductPrice decimal(8,2) null,
ProductSize nvarchar(20) null,
ProductClass nvarchar(20) null,
constraint PK_PRODUCT primary key nonclustered (ProductID)
)
go
/*==============================================================*/
/* Table: ProductStorage */
/*==============================================================*/
create table ProductStorage (
StorageID nvarchar(4) not null,
ProductID nvarchar(4) not null,
ProductBePutInDate datetime null,
ProducBePutIntAmount nvarchar(20) null,
constraint PK_PRODUCTSTORAGE primary key (StorageID, ProductID)
)
go
/*==============================================================*/
/* Index: ProductStorage_FK */
/*==============================================================*/
create index ProductStorage_FK on ProductStorage (
StorageID ASC
)
go
/*==============================================================*/
/* Index: ProductStorage2_FK */
/*==============================================================*/
create index ProductStorage2_FK on ProductStorage (
ProductID ASC
)
go
/*==============================================================*/
/* Table: Sel */
/*==============================================================*/
create table Sel (
ProductID nvarchar(4) not null,
ClientID nvarchar(4) not null,
SellDate datetime null,
SellAmount nvarchar(20) null,
constraint PK_SEL primary key (ProductID, ClientID)
)
go
/*==============================================================*/
/* Index: Sel_FK */
/*==============================================================*/
create index Sel_FK on Sel (
ProductID ASC
)
go
/*==============================================================*/
/* Index: Sel2_FK */
/*==============================================================*/
create index Sel2_FK on Sel (
ClientID ASC
)
go
/*==============================================================*/
/* Table: Spare */
/*==============================================================*/
create table Spare (
SpareID nvarchar(4) not null,
SpareName nvarchar(20) null,
SpareWeight nvarchar(20) null,
SparePrice decimal(8,2) null,
SpareClass nvarchar(20) null,
constraint PK_SPARE primary key nonclustered (SpareID)
)
go
/*==============================================================*/
/* Table: SpareStorage */
/*==============================================================*/
create table SpareStorage (
StorageID nvarchar(4) not null,
SpareID nvarchar(4) not null,
SpareBePutInDate datetime null,
SpareBePutInAmount nvarchar(20) null,
constraint PK_SPARESTORAGE primary key (StorageID, SpareID)
)
go
/*==============================================================*/
/* Index: SpareStorage_FK */
/*==============================================================*/
create index SpareStorage_FK on SpareStorage (
StorageID ASC
)
go
/*==============================================================*/
/* Index: SpareStorage2_FK */
/*==============================================================*/
create index SpareStorage2_FK on SpareStorage (
SpareID ASC
)
go
/*==============================================================*/
/* Table: Storage */
/*==============================================================*/
create table Storage (
StorageID nvarchar(4) not null,
FactoryID nvarchar(4) null,
StorageAdminName nvarchar(20) not null,
StoragePhone nvarchar(11) null,
constraint PK_STORAGE primary key nonclustered (StorageID)
)
go
/*==============================================================*/
/* Index: manageStorage_FK */
/*==============================================================*/
create index manageStorage_FK on Storage (
FactoryID ASC
)
go
/*==============================================================*/
/* Table: WorkShop */
/*==============================================================*/
create table WorkShop (
WorkShopID nvarchar(4) not null,
WorkShopName nvarchar(20) not null,
FactoryID nvarchar(4) null,
WorkShopAdminName nvarchar(20) null,
WorkShopAddress nvarchar(50) null,
WorkShopPhone nvarchar(11) null,
constraint PK_WORKSHOP primary key nonclustered (WorkShopID)
)
go
/*==============================================================*/
/* Index: manageWorkShop_FK */
/*==============================================================*/
create index manageWorkShop_FK on WorkShop (
FactoryID ASC
)
go
/*==============================================================*/
/* Table: Worker */
/*==============================================================*/
create table Worker (
WorkerID nvarchar(4) not null,
WorkShopID nvarchar(4) null,
WorkerName nvarchar(20) null,
WorkerGender nvarchar(2) null,
WorkerClass nvarchar(20) null,
constraint PK_WORKER primary key nonclustered (WorkerID)
)
go
/*==============================================================*/
/* Index: engageWorker_FK */
/*==============================================================*/
create index engageWorker_FK on Worker (
WorkShopID ASC
)
go
十、文件在SQL中执行(截图)
十一、数据结构化与实现
数据库原理与应用成绩评定表
| 1、课程答辩或质疑记录
1)
2)
3)
指导教师签字:
年 月 日 |






