资源描述
南昌航空大学
《酒店客房管理系统 》课程设计报告
学 院 软件学院 专 业 软件工程
班 级 112062 学 号 20
学生姓名 李昂 指导教师 王璐
课程成绩 完成日期 2013年7月2号
目录
1 酒店客房管理管理系统需求分析2
1.1开发背景3
1.2 系统主要业务分析3
1。3 系统功能需求分析4
1.4 系统数据模型9
2 酒店客房管理系统逻辑结构设计12
2。1 系统模块划分12
2。2 数据库逻辑结构设计13
2。3 在数据库中创建表的语句15
3 酒店客房管理系统功能设计(存储过程与触发器)16
3.1 前台操作功能设计16
3。1.1 开房登记操作16
3.1。2 退房结账17
3。1。3 房信息查看18
3。2 预订管理功能设计19
3。2。1 预定房间19
3。2.2 预定入住20
3.2.3 解除预订21
3。3 信息查询功能设计21
3。3 报表统计功能设计23
4 课程设计总结23
1 酒店客房管理管理系统需求分析
1.1开发背景
当前,随着信息的不断飞速发展,信息技术已逐渐成为各种技术的基础,信息也成为企业具有竞争力的核心要素。企业的生存和发展依靠正确的决策,而决策的基础就是信息,所以企业竞争力的高低完全取决于企业对信息的获取和处理能力.企业要准确、快速的获取和处理信息,企业信息化是必然的选择。企业必须加快内部信息交流,改进企业业务流程和管理模式,提高运行效率,降低成本,提高竞争力,信息化建设是企业适应社会发展的要求。企业管理信息系统即企业MIS是企业信息化的重要内容。
随着我国改革开放的不断推进,人民生活水平日益提高,旅游经济蓬勃发展,这一切都带动了酒店行业的发展.再加上入境旅游的人也越来越多,入境从事商务活动的外宾也越来越多。传统的手工已不适应现代化酒店管理的需要.及时、准确、全方位的网络化信息管理成为必需.
酒店是一个服务至上的行业,从客人的预定开始,到入住登记直至最后退房结账,每一步骤都要保持一致性的服务水准,错失一步, 会令其辛苦经营的形象功亏一篑。要成为一间成功的酒店,就必须作到宾至如归,面对酒店业内激烈的竞争形势,各酒店均在努力拓展其服务领域的广度和深度。虽然计算机并不是酒店走向成功的关键元素,但它可以帮助那些真正影响成败的要素发挥更大的效用.因此,采用全新的计算机网络和管理系统,将成为提高酒店的管理效率,改善服务水准的重要手段之一.
1。2 系统主要业务分析
1。2。1前台操作:
〈1〉开房登记:客人把自身信息和要入住的房号告诉酒店操作员,酒店操作员可以帮用户登记入住信息;
<2>退房登记:客人要是想查询房间的状态--是否已入住、是否已预订、是否是空闲—-时,由酒店操作员帮忙查询;
〈3〉房状态查看:客人要退房的时候付清住宿费,酒店操作员便帮客人把在住记录改成历史记录.
1。2.2预定管理:
<1>预定房间:客人把自身信息和想预订的房间号给酒店操作员,酒店操作员便帮客人预订这间房间,之后其他人在此房间被取消预定前无法入住或预定;
〈2>预定入住:客人把自身信息和预定的房间号告诉酒店操作员,酒店操作员调出预定记录核对后在客户出示身份证件后便允许他登记入住此房间;
〈3>解除预定:客人把自身信息和预定了的房号告诉酒店操作员,酒店操作员便帮客户取消预订.
1。2。3信息查询:
〈1〉在住客人列表查询:显示现在在住的客人信息
<2〉预订客人列表查询:显示预定了房间的客人信息
〈3〉历史客人列表查询:显示所有曾经在该酒店定房或入住的
1。2。4报表统计:
〈1〉开房记录统计:显示现在有多少已经开房入住的客人
〈2〉退房结账统计:显示现在有多少客人已经退房结账
<3>预订房间统计:显示现在有多少客人预定了房间
1。3 系统功能需求分析
图1-1 0层数据流图
图1—2 1层数据流图
图1—3 2层数据流图—-房间操作处理
图1-4 2层数据流图—-预定操作处理
图1—5 2层数据流图——信息查询处理
图1-6 2层数据流图——报表统计处理
1。4 系统数据模型
根据上面所述的业务流程,可以得到系统的数据流图.根据业务流程以及对应的数据流图,可以得到客户、账户、信用卡、表单、凭证等的数据字典。根据得到的数据字典,我们可以得到各个实体的属性图。以下就是主要实体的数据字典和实体图.
客人信息的数据项有:姓名、性别、证件类型号、证件号码、联系电话.由客人信息的数据项可以得到其相应的实体属性图,如图1—7 所示:
客人信息
姓名
性别
证件类型号
联系电话
证件号码
图1-7 客人信息实体图
证件类型的数据项有:证件类型号、证件类型名.由证件类型的数据项可以得到其相应的实体属性图,如图1—8 所示:
证件类型
证件类型号
证件类型名
图1—8 证件类型实体图
房间信息的数据项有:房号、房类型号、价格、押金、房状态。由房间信息的数据项可以得到其相应的实体属性图,如图1-9 所示:
房间信息
房状态
押金
价格
房类型号
房号
图1-9 房间信息实体图
房类型的数据项有:房类型号、房类型名、房间平米。由房类型的数据项可以得到其相应的实体属性图,如图1—10 所示:
房类型
房类型号
房类型名
房间平米
图1-10 房类型实体图
订单的数据项有:订单编号、客人证件号、预计入住日期、预计离开日期、入住日期、结账离开日期、应付金额.由订单的数据项可以得到其相应的实体属性图,如图1-11 所示:
订单
客人证件号
预计入住日期
预计离开日期
订单编号
入住日期
结账离开日期
应付金额
图1-11 订单实体图
由上述各实体及其属性可以得到实体间的关系图即ER图,如下图1—12 所示:
预订
开房
包含
包含
证件类型
客人信息
订单
房间信息
房类型
n
m
1
n
1
n
m
1
图1-12 E—R图
2 酒店客房管理系统逻辑结构设计
2。1 系统模块划分
主要功能
报表统计
前台操作
预订管理
信息查询
退房结账统计
预订房间统计
开房记录统计
预订客人列表查询
历史客人列表查询
在住客人列表查询
解除预订
预订入住
预订房间
退房结账
开房登记
房状态查看
图2—1 系统模块划分
2。2 数据库逻辑结构设计
数据库的关系模型根据数据模型来确定,即将关系模型转化为SQL—Server数据库系统所支持的实际数据模型,得到数据库的逻辑结构。在数据库的关系模型及系统处理过程中的数据的结构的基础上,获得系统数据库表以及表之间的关系.在本系统中,以下是系统中几个主要的数据依赖和数据库表结构,如表2—1 到2-7 所示:
数据依赖
表2—1 数据依赖关系
关系名
主 要 函 数 依 赖
客人信息
BCNF
证件号码-→(姓名,性别,证件类型号,联系电话)
证件类型
BCNF
证件类型号—→(证件类型名)
房间信息
BCNF
房号—→(房类型号,价格,押金,房状态)
房类型
BCNF
房类型号—→(房类型名,房间平米)
订单
BCNF
订单编号—→(客人证件号,预计入住日期,预计离开日期,入住日期,结账离开日期,应付金额)
开房
BCNF
(订单编号,房号)-→()
表2-2 订单表(order_log)
编号
字段名
字段类型
备注说明
字段约束
1
order_id
char(10)
订单编号
主键
2
cust_id
char(20)
客人证件号
外键
3
plan_enter_date
datetime
预计入住日期
4
plan_leave_date
datetime
预计离开日期
5
enter_date
datetime
入住日期
6
leave_date
datetime
结账离开日期
7
order_money
int
应付金额
表2—3 客人信息表(customer)
编号
字段名
字段类型
备注说明
字段约束
1
cust_id
char(20)
证件号码
主键
2
ptype_id
char(10)
证件类型号
外键
3
cust_name
char(10)
姓名
4
sex
char(1)
性别
5
phone
char(10)
联系电话
表2—4 房间信息表(room)
编号
字段名
字段类型
备注说明
字段约束
1
room_id
char(10)
房号
主键
2
rtype_id
char(10)
房类型号
外键
3
rprice
int
价格
4
rdeposit
int
押金
5
rstate
char(10)
房状态
表2—5 证件类型表(paper_type)
编号
字段名
字段类型
备注说明
字段约束
1
ptype_id
char(10)
证件类型号
主键
2
ptype_name
char(10)
证件类型名
表2—6 房类型表(room_type)
编号
字段名
字段类型
备注说明
字段约束
1
rtype_id
char(10)
房类型号
主键
2
rtype_name
char(10)
房类型名
3
rarea
numeric(5,2)
房间平米
表2-7 开房表(book_room)
编号
字段名
字段类型
备注说明
字段约束
1
order_id
char(10)
订单编号
主键
2
room_id
char(10)
房号
2。3 在数据库中创建表的语句
创建房类型表:
createtable room_type(
rtype_id char(10)primarykey,
rtype_name char(10),
rarea numeric(5,2)
);
创建房间信息表:
createtable room(
room_id char(10)primarykey,
rtype_id char(10),
rprice int,
rdeposit int,
rstate char(10),
foreignkey(rtype_id)references room_type(rtype_id)
);
创建证件类型表:
createtable paper_type(
ptype_id char(10)primarykey,
ptype_name char(10)
);
创建客人信息表:
createtable customer(
cust_id char(20)primarykey,
ptype_id char(10),
cust_name char(10),
sex char(1),
phone char(10),
foreignkey(ptype_id)references paper_type(ptype_id)
);
创建订单表:
createtable order_log(
order_id char(10)primarykey,
cust_id char(20),
plan_enter_date datetime,
plan_leave_date datetime,
enter_date datetime,
leave_date datetime,
order_money int,
foreignkey(cust_id)references customer(cust_id)
);
创建订房表:
createtablebook_room(
order_id char(10),
room_id char(10),
foreignkey(order_id)references order_log(order_id),
foreignkey(room_id)references room(room_id)
);
3 酒店客房管理系统功能设计(存储过程与触发器)
3.1 前台操作功能设计
3。1.1 开房登记操作
—-输入房号查询房状态
createprocedurepro_rstate@room_idchar(10)as
selectroom_id房号,rstate房状态fromroom
whereroom_id=@room_id
-—运行
execpro_rstate101
—-输入房状态查询房号
createprocedurepro_rstate1@rstatechar(10)as
selectroom_id房号,rtype_name房类型名,rarea房间平米,rprice价格,rdeposit押金
fromroom,room_type
whereroom。rtype_id=room_type。rtype_idandrstate=@rstate;
——运行
execpro_rstate1空闲
——输入房号把房间状态改成入住
createprocedurepro_change_rstate_into_live@room_idchar(10)as
updateroom
setrstate=’入住’
whereroom_id=@room_id
selectroom_id房号,rstate房状态fromroomwhereroom_id=@room_id
-—运行
execpro_change_rstate_into_live101
-—输入顾客信息(证件号码,证件类型号,姓名,性别,联系电话)
createprocedurepro_insert_cust@cust_idchar(20),@ptype_idchar(10),@cust_namechar(10),
@sexchar(1),@phonechar(10)as
insertintocustomervalues(@cust_id,@ptype_id,@cust_name,@sex,@phone);
selectcust_id证件号码,ptype_id证件号类型,cust_name姓名,sex性别,phone联系电话
fromcustomer
—-运行
execpro_insert_cust’360203199307274018’,'01',’李昂’,'m’,’18296115815’
-—输入订单信息(订单编号,客人证件号,入住日期,预计离开日期)
createprocedurepro_insert_order@order_idchar(10),@cust_idchar(20),@enter_datedatetime,
@plan_leave_datedatetimeas
insertintoorder_log(order_id,cust_id,enter_date,plan_leave_date)
values(@order_id,@cust_id,@enter_date,@plan_leave_date);
selectorder_id订单编号,cust_id客人证件号,plan_enter_date预计入住日期,enter_date入住日期,
plan_leave_date预计离开日期,leave_date结账离开日期,order_money应付金额fromorder_log
-—运行
execpro_insert_order’000001’,’360203199307274018',’2013-7-1’,'2013-7—10’
——输入开房信息(订单号,房号)
createprocedurepro_insert_book_room@order_idchar(10),@room_idchar(10)as
insertintobook_roomvalues(@order_id,@room_id);
selectorder_id订单编号,room_id房号frombook_room
whereorder_id=@order_id
-—运行
execpro_insert_book_room’000001’,’101'
3。1.2 退房结账
-—输入房号把房间状态改成空闲
createprocedurepro_change_rstate_into_free@room_idchar(10)as
updateroom
setrstate=’空闲’
whereroom_id=@room_id;
selectroom_id房号,rstate房状态fromroomwhereroom_id=@room_id
-—运行
execpro_change_rstate_into_free'101’
-—退房结账时输入订单号,输出应结账金额并自动把订单中的“结账离开日期”改为当前日期
createprocedurepro_quit_getmoney@order_idchar(10)as
begin
declare@enter_datedatetime,@order_moneyint,@sumint
declaregetCurcursorfor
selectenter_date,order_money
fromorder_log
whereorder_id=@order_id;
opengetCur
fetchgetCurinto@enter_date,@order_money
begin
updateorder_log
setleave_date=getdate()
whereorder_id=@order_id;
select@sum=(day(getdate())—day(@enter_date))*@order_money;
end
closegetCur
deallocategetCur
end
—-运行
execpro_quit_getmoney’000001’
3.1。3 房信息查看
——输入房号查询房信息
createprocedurepro_room_info@room_idchar(10)as
selectroom_id房号,rtype_id房类型号,rprice价格,rdeposit押金,rstate房状态
fromroom
whereroom_id=@room_id
-—运行
execpro_room_info’101'
3。2 预订管理功能设计
3。2。1 预定房间
——输入房号查询房状态
createprocedurepro_rstate@room_idchar(10)as
selectroom_id房号,rstate房状态fromroom
whereroom_id=@room_id
—-运行
execpro_rstate’101’
——输入房号把房间状态改成预订
createprocedurepro_change_rstate_into_subscribe@room_idchar(10)as
updateroom
setrstate=’预订’
whereroom_id=@room_id;
selectroom_id房号,rstate房状态fromroom
whereroom_id=@room_id
——运行
execpro_change_rstate_into_subscribe101
—-输入顾客信息(证件号码,证件类型号,姓名,性别,联系电话)
createprocedurepro_insert_cust@cust_idchar(20),@ptype_idchar(10),@cust_namechar(10),
@sexchar(1),@phonechar(10)as
insertintocustomervalues(@cust_id,@ptype_id,@cust_name,@sex,@phone);
selectcust_id证件号码,ptype_id证件号类型,cust_name姓名,sex性别,phone联系电话
fromcustomer
——运行
execpro_insert_cust’360203201307274018’,'01’,'王小贱',’m’,’12345678900’
—-输入订单信息(订单编号,客人证件号,预计入住日期)进行预订
createprocedurepro_subscribe@order_idchar(10),@cust_idchar(20),@plan_enter_datedatetimeas
insertintoorder_log(order_id,cust_id,plan_enter_date)
values(@order_id,@cust_id,@plan_enter_date);
selectorder_id订单编号,cust_id客人证件号,plan_enter_date预计入住日期,enter_date入住日期,
plan_leave_date预计离开日期,leave_date结账离开日期,order_money应付金额
fromorder_log
whereorder_id=@order_id;
——运行
execpro_subscribe’000002',’360203201307274018’,’2013—6—29'
—-输入订房信息(订单号,房号)
createprocedurepro_insert_book_room@order_idchar(10),@room_idchar(10)as
insertintobook_roomvalues(@order_id,@room_id);
selectorder_id订单编号,room_id房号frombook_room
whereorder_id=@order_id
——运行
execpro_insert_book_room’000002','201’
3。2.2 预定入住
-—输入订单编号,查询此订单的信息(看是否为已预订)
createprocedurepro_subscribe_to_enter@order_idchar(10)as
ifexists(select*fromorder_logwhereorder_id=@order_id)
print'已预订’
else
print’未预定’
——运行
execpro_subscribe_to_enter101
——输入房号把房间状态改成入住
createprocedurepro_change_rstate_into_live@room_idchar(10)as
updateroom
setrstate=’入住’
whereroom_id=@room_id
selectroom_id房号,rstate房状态fromroomwhereroom_id=@room_id
——运行
execpro_change_rstate_into_live101
-—输入订单信息(订单编号,预计离开日期,入住日期,应付金额)
createprocedurepro_subscribe_to_live@order_idchar(10),@plan_leave_datedatetime,@enter_datedatetime,
@order_moneyintas
updateorder_logsetplan_leave_date=@plan_leave_date,enter_date=@enter_date,order_money=@order_money
whereorder_id=@order_id
selectorder_id订单编号,cust_id客人证件号,plan_enter_date预计入住日期,enter_date入住日期,
plan_leave_date预计离开日期,leave_date结账离开日期,order_money应付金额fromorder_log
whereorder_id=@order_id
——运行
execpro_subscribe_to_live’000002','2013—7-12','2013—7—1’,300
3。2。3 解除预订
—-删除订房信息(订单号,房号) 【触发器实现】
createtriggertrig_dele_book_roomonorder_log
fordeleteas
deletebook_roomfrombook_room,deleted
wherebook_room.order_id=deleted。order_id
——输入订单编号,删除客人信息、订单对应的房号、订单信息并把对应的房间状态改成空闲(取消预订)
createprocedurepro_cancel_subscribe@order_idchar(10)as
declare@cust_idchar(20)
declaregetCurcursorfor
selectcust_idfromorder_log
whereorder_id=@order_id
opengetCur
fetchgetCurinto@cust_id
updateroom
setrstate=’空闲'
whereroom_idin(selectroom_id
frombook_room
whereorder_id=@order_id)
deletefromorder_log
whereorder_id=@order_id
deletefrombook_room
whereorder_id=@order_id
deletefromcustomer
wherecust_id=@cust_id
closegetCur
deallocategetCur
——运行
execpro_cancel_subscribe’000002’
3.3信息查询功能设计
——查询在住客人列表
create procedure pro_select_cust as
declare @cust_id char(20)
declare getCur cursor for
select cust_id from order_log
where enter_date is not null and leave_date is null
open getCur
fetch getCur into @cust_id
select cust_id 证件号码,ptype_id 证件号类型,cust_name 姓名,sex 性别,phone 联系电话
from customer
where cust_id=@cust_id
close getCur
deallocate getCur
——运行
exec pro_select_cust
—-查询预订客人信息
create procedure pro_select_subscribe as
declare @cust_id char(20)
declare getCur cursor for
select cust_id from order_log
where plan_enter_date is not null and enter_date is null
open getCur
fetch getCur into @cust_id
select cust_id 证件号码,ptype_id 证件号类型,cust_name 姓名,sex 性别,phone 联系电话
from customer
where cust_id=@cust_id
close getCur
deallocate getCur
——运行
exec pro_select_subscribe
--查询历史客人信息
create procedure pro_select_past as
declare @cust_id char(20)
declare getCur cursor for
select cust_id from order_log
where leave_date is not null
open getCur
fetch getCur into @cust_id
select cust_id 证件号码,ptype_id 证件号类型,cust_name 姓名,sex 性别,phone 联系电话
from customer
where cust_id=@cust_id
close getCur
deallocate getCur
--运行
exec pro_select_past
3。3报表统计功能设计
-—开房记录统计
create procedure pro_sum_live as
declare @count int
select @count=COUNT(*) from order_log
where enter_date is not null and leave_date is null
print'开房记录共'+convert(char(10),@count)+’条’
--运行
exec pro_sum_live
—-退房结账记录统计
create procedure pro_sum_leave as
declare @count int
select @count=COUNT(*) from order_log
where leave_date is not null
print'退房结账记录共’+convert(char(10),@count)+'条'
-—运行
exec pro_sum_leave
——预订房间记录统计
create procedure pro_sum_subscribe as
declare @count int
select @count=COUNT(*) from order_log
where plan_enter_date is not null and enter_date is null
print’预定房间记录共'+convert(char(10),@count)+’条’
-—运行
exec pro_sum_subscribe
4 课程设计总结
本次课程设计并不是我一第一次接触数据库设计,所以做起来的时候觉得还是比较顺手。直到后面开始用触发器和存储过程来实现功能的时候比较吃力,想了挺多,也问了老师挺多的,后来总算交出了一份比较满意的答卷。我终于明白,再困难的问题总会有个解决的答案.在检查课设的时候,指导老师一丝不苟的态度让我很感动,因为听说隔壁班的老师检查三两下就放过了,我心想这样不是应付我们学生吗,这可是我们一点一滴辛苦做出来的数据库设计啊!但是我们的指导老师很负责,虽然经常因为检查得认真仔细花费的时间多而受到同学们的抱怨,但是老师还是坚持地不放过任何一个敷衍了事者,验收辛苦劳动者们收获的成功果实.
通过本次实验,我受益颇多,在此感谢为我解答问题的段喜龙老师和检查我们课设的王璐老师,谢谢!
15
展开阅读全文