当前位置:文档之家› 超市收银系统

超市收银系统

郑州轻工业学院本科数据库课程设计总结报告设计题目:超市收银系统系别:计算机与通信工程学院专业:计算机科学与技术班级:09-2学生姓名:易涛学号:************指导教师:苏晓珂、张保威2011 年12月22日郑州轻工业学院课程设计任务书题目:超市收银系统专业、班级:计算机科学与技术09-2学号:540907010244 姓名:易涛主要内容:系统数据初始化;员工登录;商品销售;商品入库;各种查询,商品存储,商品管理等。

基本要求:立足于超市收银实际,开发具有价值的工资管理专用软件,实现商品管理销售的各种数据存储自动化,提高工作效率,减少手工工作方式难以避免的数据错漏。

主要参考资料等:《数据库系统概论》作者:王珊萨师煊出版社:高等教育出版社《软件工程概论》,郑人杰,马素霞,殷人昆,机械工业出版社《数据库组成原理》,王珊,萨师煊,高等教育出版社《SQL Server数据库开发实例精粹》作者:徐国智汪孝宜等出版社:电子工业出版社。

完成期限:两周指导教师签名:课程负责人签名:年月日目录课程设计任务书 (2)一、需求分析 (4)1、系统任务概述 (4)2、需求规定 (4)3、运行环境规定 (4)2.客户端子系统运行要求: (5)4、业务流程分析图 (5)5数据流程,功能要求和设计 (6)6、系统的功能模块图 (7)二、数据库设计 (9)1、数据字典 (9)2、E-R图 (12)3、关系模型 (13)4、建表: (14)三、详细设计 (23)四、总结 (27)一、需求分析1、系统任务概述1.1系统功能实现功能如下:超市进货;售货;商品查询(不确定查询);会员管理;用户管理(含用户权限的设置)销售记录1.2权限收银员权限,仓库管理员权限1.3假定和约束收银员能够,办理会员,出售商品,能够查询商品仓库管理员,进货,能够管理收银员,能够查询销售情况,招收员工2、需求规定2.1软件功能规定满足用户需求2.2对性能的规定2.2.1精度能够满足用户需求2.2.2 时间特性要求能够长期运行2.2.3可靠性能够准确的实现用户的要求2.2.4 灵活性易维护,易扩充、3、运行环境规定1.服务器端子系统运行要求:数据库管理系统:SQL sever 2000 2.客户端子系统运行要求:Windows xp sql 20004、业务流程分析图5数据流程,功能要求和设计5.1顶层流程图功能要求如下:查询商品办理会员超市进货招收员工查询销售额查询供应商会员打折6、系统的功能模块图6.1整体模块6.2用户信息管理模块6.3商品入库信息管理模块6.4商品库存管理模块6.5商品销售管理模块本系统主要分成四个功能模块,每个模块都独立的完成了自己的功能,以下是对各功能模块的说明:(1) 用户信息管理功能。

该功能模块可以实现系统用户对自己基本信息的修改,不过只限于对登录密码的修改,因为用户帐号都是超市为了方便管理而事先分配好了的,是不能改变的。

出于对用户信息的安全性考虑,只能修改当前登录的用户的密码。

(2) 商品入库信息管理功能。

该功能模块是实现对即将入库的商品的统计,由于商品信息的庞大、复杂,在入库前需要对其进行详细地记录管理,为商品的库存管理打下良好的基础。

需要记录的内容有:入库商品的商品号、名称、类型、价格、同类商品的数量、采购员、验收员、生产厂商、产地、入库时间等。

同时能够实现对商品入库信息的添加、修改、删除和查询功能。

(3) 商品库存信息管理功能。

该功能模块是当入库的商品放入超市后,对库存商品进行统计管理,主要入库信息来源于(2)中的商品入库信息记录。

需要记录的内容有:库存商品的名称、类型、入库价格、销售价格、库存量、入库时间、有效期等,同时能够实现对商品库存信息的添加、修改、删除和查询功能。

在商品批量销售后,在表中能够同时删除相应的商品的数量。

(4) 商品销售信息管理功能。

该功能模块是把要销售的商品从超市中取出来,并对库存商品进行相应的记录管理,并且把顾客的购买信息打印下来给顾客做凭证。

需要记录的内容有:出售商品的名称、类型、销售价格、数量、销售时间等,同时能够实现对商品销售信息的添加、修改、删除和查询功能。

二、数据库设计1、数据字典2、E-R图超市收银系统E-R图实体有6个:1 用户实体:其属性为:用户账号,用户名,用户权限;2 库房实体:商品入库号;3 商品实体:商品号,商品名,商品类型;4 会员实体:会员号,会员积分;5 供应商实体:供应商号,供应商名,供应商地址,供应商联系电话关系有6个1 顾客与收银员之间的关系2 收银员与会员之间的关系3 收银员与库房之间的关系4 库房与管理员之间的关系5 库房与商品之间的关系6 收银员与商品之间的关系7 会员与商品之间的关系3、关系模型3.1 User(User_id,User_name)此为用户实体对应的关系模式。

3.2 Club(Club_id,Club_jifen)此为创建会员的关系模式。

3.3 Store(Store_id,Store_na,Store_num)此为库房实体关系模式3.4 Goods(Goods_id,Store_id,Goods_na,Goods_type,Goods_price,Supply_id)此为商品实体关系模式3.5 Supply(Supply_id,Supply_name,Supply_adress,Supply_contact)此为供应商实体关系模式3.6 供应商品(Goods_id,Supply_id,Supply_time,Supply_time,Supply_num,Supply_price)此为联系“出售商品”所对应的关系模式3.7 出售商品(Goods_id,Goods_time,User_id,Goods_outprice)此为联系“销售商品”所对应的关系模式3.8 会员购买(Club_id,Goods_id)此为联系“会员购买”所对应的关系模式3.9 商品退货(Order_num,Goods_id,Back_time,Back_num)此为联系“商品退货”所对应的关系模式4、建表:管理员create table 管理员(User_id char(15) primary key,User_na char(10),User_password char(15),User_type int)此为建表create proc 管理员p1 @User_id char(15),@User_na char(10),@User_password char(15),@User_type intasinsertinto 管理员values (@User_id,@User_na,@User_password,@User_type)此为创建存插入储过程create proc 管理员p2 @User_id char(15)asdeletefrom 管理员where User_id=@User_id;此为创建删数据存储过程商品入库create table 商品入库(Store_id char(8) primary key,Store_na char(8),Store_num int)此为创建表create proc 商品入库p1 @Store_id char(8),@Store_na char(10),@Store_num int asinsertinto 商品入库values (@Store_id,@Store_na,@Store_num)创建存储过程create trigger 入库on 商品入库for insertasdeclare @store intselect @store=store_num from insertedif(@store<1)beginrollback transactionraiserror('进货量不能小于1',16,1)End 触发器商品存储情况create table 商品存储情况(Goods_id char(8) primary key,Store_id char(8),Goods_na char(10),Supply_id char(8),Goods_type char(10),Goods_price int)此为创建商品存储情况的表create proc insert_商品存储情况@Goods_id char(8) ,@Store_id char(8),@Goods_na char(10),@Supply_id char(8),@Goods_type char(10),@Goods_price intasinsertinto 商品存储情况values (@Goods_id,@Store_id,@Goods_na,@Supply_id,@Goods_type,@Goods_price) 创建插入的存储过程create proc delete_商品存储情况@Store_id char(8)asdeletefrom 商品存储情况where Store_id=@Store_id 此为创建删除数据的存储过程create trigger 商品on 商品存储情况for insertasdeclare @Goods char(8)select @Goods=Goods_price from insertedif(@Goods<=1)beginrollback transactionraiserror('商品的价格不能小于1',16,1)End/*触发器*/会员情况create table 会员情况(Club_id char(15) primary key,Club_jifen int) 建表create proc insert_会员情况@Club_id char(15),@Club_jifen intasinsertinto 会员情况values (@Club_id,@Club_jifen) 创建存储过程create trigger clubon 会员情况for insertasdeclare @jifen intselect @jifen=Club_jifen from insertedif(@jifen<0)beginrollback transactionraiserror('会员积分不能小于零!!',16,1)End 触发器供应商create table 供应商(Supply_id char(8) primary key,Supply_na char(10),Supply_address char(20),Supply_contact char(11))创建供应商表create proc insert_供应商@Supply_id char(8),@Supply_na char(10),@Supply_address char(20),@Supply_contact char(11)asinsertinto 供应商values (@Supply_id,@Supply_na,@Supply_address,@Supply_contact) 创建存储添加数据的过程create proc delete_供应商@Supply_id char(8)asdeletefrom 供应商where Supply_id=@Supply_id 创建删除供应商数据的存储过程销售商品create table 销售商品(Goods_id char(8) ,Goods_time datetime,User_id char(15),Goods_outprice int,Goods_dazhe int,primary key (Goods_id,User_id),foreign key (Goods_id) references 商品存储情况(Goods_id),foreign key (User_id) references 管理员(User_id)) 创建销售商品表create proc insert_销售商品@Goods_id char(8) ,@Goods_time datetime,@User_id char(15),@Goods_outprice int,@Goods_dazhe intasinsertinto 销售商品values (@Goods_id,@Goods_time,@User_id ,@Goods_outprice ,@Goods_dazhe) 创建销售商品插入数据的存储过程create trigger 销售on 销售商品for insertasdeclare @goods_outprice int,@goods_dazhe intselect @goods_outprice=Goods_id, @goods_dazhe=Goods_dazhe from inserted if(@goods_outprice<0 or @goods_dazhe<0)beginrollback transactionraiserror('出售价格和打折均不能小于零!!',16,1)End 创建触发器供应商品create table 供应商品(Order_num char(8),Goods_id char(8),Supply_id char(8),Supply_time datetime,Goods_num int,Goods_inprice int,primary key (Goods_id,Supply_id),foreign key (Goods_id) references 商品存储情况(Goods_id),foreign key (Supply_id) references 供应商(Supply_id)) 创建供应商品表create proc insert_供应商品@Order_num char(8),@Goods_id char(8),@Supply_id char(8),@Supply_time datetime,@Goods_num int,@Goods_inprice intasinsertinto 供应商品values(@Order_num ,@Goods_id ,@Supply_id ,@Supply_time,@Goods_num ,@Goods_inprice ) 创建插入供应商品数据的存储过程create proc delete_供应商品@Goods_id char(8),@Supply_id char(8)asdeletefrom 供应商品where Goods_id=@Goods_id and Supply_id=@Supply_id 创建删除数据存储过程create trigger 供应xon 供应商品for insertasdeclare @goods_num int,@goods_inprice intselect @goods_num=Goods_num,@goods_inprice=Goods_inprice from insertedif(@goods_num<0 or @goods_inprice<0)beginrollback transactionraiserror('供应商品数量和商品进价不能小于零!!',16,1)商品退货create table 商品退货(Order_num char(8),Supply_id char(8),Goods_id char(8),Back_time datetime,Back_num int,primary key (Order_num,Goods_id,Supply_id),foreign key (Goods_id) references 商品存储情况(Goods_id),foreign key (Supply_id) references 供应商(Supply_id)) 此为创建商品退货表create proc insert_商品退货@Order_num char(8),@Supply_id char(8),@Goods_id char(8),@Back_time datetime,@Back_num intasinsertinto 商品退货values (@Order_num,@Supply_id ,@Goods_id ,@Back_time ,@Back_num )存储过程create trigger 返回物品on 商品退货for insertasdeclare @back_num intselect @back_num=Back_num from insertedif(@back_num<0)beginrollback transactionraiserror('退回商品数量不能小于等于零!!',16,1)End 创建触发器会员购买create table 会员购买(Club_id char(15),Goods_id char(8),primary key (Goods_id,Club_id),foreign key (Goods_id) references 商品存储情况(Goods_id), foreign key (Club_id)references 会员情况(Club_id)) 创建会员购买表create proc insert_会员购买@Club_id char(15),@Goods_id char(8)asinsertinto 会员购买values (@Club_id,@Goods_id ) 创建添加数据的存储过程create proc delete_会员购买@Club_id char(15)asdeletefrom 会员购买where Club_id=@Club_id 创建删除数据的存储过程三、详细设计1、登录界面2、主界面3、查询商品4、出售商品四、总结收获与体会我觉得这次实验的收获和体会很大,主要有一下几点:(1)在这次试验中我对数据库系统设计的基本框架有了更深刻认识和学习,而且学习了数据库设计的基本步骤以及每个步骤的主要任务。

相关主题