课程设计(论文)-Delphi7.0学校餐饮IC系统.doc_第1页
课程设计(论文)-Delphi7.0学校餐饮IC系统.doc_第2页
免费预览已结束,剩余31页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

湖南农业大学 课程设计报告学校餐饮ic卡系统 university canteen ic card sestem学生姓名 : 年级专业 : 指导老师 : 学 院 : 提交日期:2007年6月目 录前 言21.需求分析31.1数据需求分析41.1.1数据字典41.1.2系统数据流图51.2应用系统功能分析62 概要结构设计63逻辑结构设计84详细设计与实现84.1建立数据库和表84.2系统主窗体94.3管理员登录窗口124.4办理新卡窗口154.5 ic卡注销窗口234.6充值窗口244.7管理员权限窗口264.8关于系统窗口315总结31参考文献31致 谢32学校餐饮ic卡系统作 者: 指导老师:(湖南农业大学信息科学技术学院2005级计算机科学与技术专业3班,长沙 410128)摘 要:随着高校招生规模的不断扩大,学校的后勤管理变得越来越复杂,一个重要的方面就是解决学生的用餐问题。一直延续的餐票制度已经不能适应庞大的信息管理需要。引进一个信息管理系统就成为解决这一问题的迫切要求。餐饮ic卡系统是根据学生的学籍信息来发放一张ic智能卡,学生在卡上充入一定金额,就餐时进行刷卡,无现金交易,避免了工作人员找零而耽误时间。该系统具有办理新卡、ic卡挂失、ic卡充值、消费查询等功能,为工作人员和学生就餐提供了方便。关键字:餐饮ic卡、sql2000数据库、delphi 7canteen ic card sestem for campusauthor:tutor:(computer and information engineering college, computer science and technology class 3,grade2005, hunan agricultural university, changsha 410128)abstract: with enrollments in colleges and universities continues to expand, schools logistical management has become increasingly complex, an important aspect is to solve the problem of meals. it has extended the meal ticket system can not cope with large-scale information management needs. the introduction of an information management system for solving the problem is an urgent requirement. canteen ic card system is based on the information of any pupil to release an ic smart cards students on a card filled with a certain amount of meals when swiping cards without cash transactions, avoid staff have sought and the time wasted. the system is for the new card, report the loss ic card, ic card recharging, consumer inquiries and other functions, for staff and students to provide a convenient meals. key words: canteen ic card, sql2000 server, delphi 7前言随着高校招生规模的不断扩大,学校的后勤管理变得越来越复杂,一个重要的方面就是解决学生的用餐问题。一直延续的餐票制度已经不能适应庞大的信息管理需要。引进一个信息管理系统就成为解决这一问题的迫切要求。该系统应具有办理新卡、ic卡挂失、ic卡充值、消费查询、密码修改等功能。1.需求分析1.1数据需求分析学籍信息:记录学生的基本信息,以便于办理新卡调出档案之用。包括学生姓名、学号、性别、年级、班级、专业。卡信息:卡号、金额、密码、办卡时间。卡用户信息:卡号、学号、姓名、性别、年级、专业、班级、办卡时间管理员信息:姓名、性别、出生日期、编号、密码、权限1.1.1数据字典表1卡的各项数据描述卡=卡号、学号、金额、密码,存取方式:更新表2卡用户的各项数据描述卡用户=卡号、学号、姓名、性别、年级、专业班级、办卡日期,存取方式:更新表3学籍信息的各项数据描述学籍=学号、姓名、性别、年级、班级、专业,存取方式:更新表4用户消费的各项数据描述用户消费=卡号、学号、消费日期、消费金额,存取方式:更新表5管理员信息的各项数据描述管理员=编号、性别、姓名、密码、出生年月、是否超级管理员,存取方式:更新数据流描述1=管理员登录请求,用户名、密码,数据来源:用户输入,数据流向:在管理员信息表中查找比对数据流描述2=办理新卡,学号、卡号、密码、金额,数据来源:学籍信息表中查询结果,数据流向:将新卡信息加入到卡信息表、卡用户信息表中数据流描述3=撤销卡,卡号、卡用户表信息,数据来源:在卡信息表和卡用户信息表中与对应卡号相关的信息,数据流向:去除学籍信息表以外的其他表中与被撤销卡卡号相对应的信息1帐号2检验3登录4系统使用者核对信息判断是否存在用户权限信息检验问题判断是否符合条件依据权限操作系统管理员普通用户图1 系统数据流图1.1.2系统数据流图餐饮ic卡系统ic卡注销ic卡充值管理员权限1.2应用系统功能分析办理新卡图2 系统功能模块2 概要结构设计姓名性别年级专业学号学 生图3 学生信息实体e-r图卡用户卡号姓名性别班级专业年级办卡日学号图4 卡用户实体信息e-r图管理员编号姓名性别密码出生年月是否超级用户图5 管理员实体信息e-r图金额学号密码ic卡卡号图6 ic卡实体信息e-r图学生ic卡用户卡用户联系联系管理员密码识别密码识别确定联系图7 系统e-r图3逻辑结构设计根据餐饮ic卡系统数据需求分析,设计出数据的逻辑结构数据表名称 主要字段学籍信息表: 记录学生的基本信息,以便于办理新卡调出档案之用。包括学生姓名、学号、性别、年级、班级、专业。卡 信 息 表:卡号、金额、密码、办卡时间。卡用户信息表:卡号、学号、姓名、性别、年级、专业、班级、办卡时间管理员信息表:姓名、性别、出生日期、编号、密码、权限4详细设计与实现4.1建立数据库和表 本系统采用的数据库由sql server 2000搭建,建立名为“canteen”的数据库。各数据表的建表sql脚本语言如下。创建“学籍信息”表的脚本create table dbo.学籍信息 (学号 char (10) collate chinese_prc_ci_as not null ,姓名 char (10) collate chinese_prc_ci_as not null ,性别 char (10) collate chinese_prc_ci_as not null ,年级 char (10) collate chinese_prc_ci_as not null ,班级 char (10) collate chinese_prc_ci_as not null ,专业 char (20) collate chinese_prc_ci_as not null ) on primarygo创建卡信息表的脚本create table dbo.卡信息 (卡号 char (10) collate chinese_prc_ci_as not null ,学号 char (10) collate chinese_prc_ci_as null ,金额 float not null ,状态 char (10) collate chinese_prc_ci_as null ,密码 char (20) collate chinese_prc_ci_as not null ) on primarygo创建卡用户信息表的脚本create table dbo.卡用户信息 (卡号 char (10) collate chinese_prc_ci_as null ,学号 char (10) collate chinese_prc_ci_as not null ,姓名 char (20) collate chinese_prc_ci_as not null ,性别 char (10) collate chinese_prc_ci_as not null ,年级 char (10) collate chinese_prc_ci_as not null ,专业 char (20) collate chinese_prc_ci_as not null ,班级 char (10) collate chinese_prc_ci_as not null ,办卡日期 char (10) collate chinese_prc_ci_as not null ) on primarygo创建管理员表的脚本create table dbo.管理员表 (编号 char (10) collate chinese_prc_ci_as not null ,性别 char (10) collate chinese_prc_ci_as null ,姓名 char (10) collate chinese_prc_ci_as not null ,密码 char (20) collate chinese_prc_ci_as not null ,出生年月 datetime not null ,是否超级管理员 char (10) collate chinese_prc_ci_as not null ) on primarygo4.2系统主窗体图8 系统主窗体系统主窗体主要代码如下:uses loginf, /管理员登录窗口 addcardf, /办理新卡窗口 addmoneyf, /ic卡充值窗口 adminf, /管理员权限窗口 dropcardf, /ic卡注销窗口 aboutf; /关于系统窗口/*状态栏显示是期函数*function load_week(const dtime: tdatetime): string;const dstr: array1.7 of string = (星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六);begin result := dstrdayofweek(dtime);end;/*状态栏显示日期,星期,系统时间 *procedure tmain.timer1timer(sender: tobject);beginstate.panels1.text := datetostr(now);state.panels2.text := load_week(now);state.panels4.text := timetostr(now);end;/*管理员登录窗口*procedure tmain.n2click(sender: tobject);begin if speedbutton1.enabled=true then begin messagedlg(已经有管理员登录!,mtinformation,mbok,0); exit; end;login.show;end;/*退出系统*procedure tmain.n3click(sender: tobject);beginclose;end;/*打开办理新卡窗口*procedure tmain.n4click(sender: tobject);beginaddcard.show;end;/*打开ic卡注销窗口*procedure tmain.ic4click(sender: tobject);begindropcard.show;end;/*打开ic卡充值窗口*procedure tmain.ic5click(sender: tobject);beginaddmoney.show;end;/*打开管理员权限设置窗口*procedure tmain.n6click(sender: tobject);beginadmin.show;end;/*办理新卡快捷鍵*procedure tmain.speedbutton1click(sender: tobject);beginn4click(sender);end;/*ic卡注销快捷鍵*procedure tmain.speedbutton4click(sender: tobject);beginic4click(sender);end;/*ic卡充值快捷鍵*procedure tmain.speedbutton5click(sender: tobject);beginic5click(sender);end;/*管理员权限窗口快捷鍵*procedure tmain.speedbutton6click(sender: tobject);beginn6click(sender);end;/*关于系统提示*procedure tmain.n11click(sender: tobject);beginabout.show;end;end.4.3管理员登录窗口图9管理员登路窗口管理员登录窗口主要代码如下: public public declarations procedure clear();/定义清除函数clear(); end;var login: tlogin;implementation$r *.dfmuses mainf;/ *清除输入框信息函数clear()*procedure tlogin.clear;beginedit1.clear;edit2.clear;end;/*用户登录过程*procedure tlogin.bitbtn1click(sender: tobject);var number,user,passw,issuper:string;begin user:=trim(edit1.text); passw:=trim(edit2.text); /要求在用户姓名输入框和密码输入框中 输入信息 if user= then begin messagedlg(请输入用户姓名!,mtwarning,mbok,0); edit1.setfocus; exit; end; if passw= then begin messagedlg(请输入用户密码!,mtwarning,mbok,0); edit2.setfocus; exit; end; /查看是否存在此用户 adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add(select * from 管理员表 where 姓名 =+user+and 密码=+passw+); adoquery1.open; number:=adoquery1.fieldbyname(编号).asstring; issuper:=trim(adoquery1.fieldbyname(是否超级管理员).asstring);if (number) then begin /打开可执行权限 main.ic1.enabled:=true; /卡登记 main.n4.enabled:=true; /办理新卡 main.ic4.enabled:=true; /ic卡注销 main.ic5.enabled:=true; /ic卡充值 main.n5.enabled:=true; /密码修改起始栏 main.speedbutton1.enabled:=true; /办理新卡 main.speedbutton4.enabled:=true; /ic卡注销快捷鍵 main.speedbutton5.enabled:=true; /ic卡充值快捷鍵 if (issuper=是) then begin /超级管理员可进行管理员权限操作 main.n6.enabled:=true; /管理员权限 main.speedbutton6.enabled:=true; /管理员权限快捷鍵 end; messagedlg( 登录成功! ,mtinformation,mbok,0); close; end else messagedlg(用户名或密码错误,请核对!,mtwarning,mbok,0);end;/*退出窗口并清空信息*procedure tlogin.bitbtn2click(sender: tobject);beginclear();close;end;/*启动窗口时清空信息*procedure tlogin.formcreate(sender: tobject);beginclear();end;/*输入完密码之后按回车鍵,执行登录*procedure tlogin.edit2keypress(sender: tobject; var key: char);beginif key=#13 thenbitbtn1.click;end;end.4.4办理新卡窗口图10 办理新卡窗口办理新卡窗口主要代码如下:public public declarations /学号,姓名,出生年月,性别,专业,年级字段 studno,name,bornyear,man,clas,major,grade:string; procedure clear(); /定义输入框信息函数clear(); end;var addcard: taddcard;implementation$r *.dfmuses mainf;/清除输入框信息函数clear();procedure taddcard.clear;beginedit1.clear;edit2.clear;edit3.clear;edit4.clear;edit5.clear;edit6.clear;radiobutton1.checked:=false;radiobutton2.checked:=false;end;/*显示总共卡记录数*procedure taddcard.datasource1datachange(sender: tobject; field: tfield);beginedit4.text:=inttostr(adotable1.recordcount);end;/*搜索学生信息*procedure taddcard.bitbtn3click(sender: tobject);beginif (trim(edit1.text)=)and (trim(edit2.text)=) then begin messagedlg(请输入查询条件! ,mtwarning,mbok, 0); exit; end; adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add(select * from +adotable1.tablename); if radiobutton1.checked then begin /按学号查询 adoquery1.sql.add(where(+radiobutton1.caption+like %+trim(edit1.text)+%); edit1.setfocus; edit2.clear; end else begin /按姓名查询 adoquery1.sql.add(where(+radiobutton2.caption+like %+edit2.text+%); edit2.setfocus; edit1.clear; end; adoquery1.open; studno:=trim(adoquery1.fieldbyname(学号).asstring); name:=trim(adoquery1.fieldbyname(姓名).asstring); clas:=trim(adoquery1.fieldbyname(班级).asstring); man:=trim(adoquery1.fieldbyname(性别).asstring); grade:=trim(adoquery1.fieldbyname(年级).asstring); major:=trim(adoquery1.fieldbyname(专业).asstring); /将查询得到的数据通过复制到数据库中 adotable1.clone(adoquery1,ltunspecified); adoquery1.close;end;/*办理新卡*procedure taddcard.bitbtn1click(sender: tobject);varcardno,cardpassw,money,date,tempcard,tempno:string;begincardno:=trim(edit3.text);cardpassw:=trim(edit5.text);money:=trim(edit6.text);date:=datetostr(now);/要求用户输入基本信息 if cardno= then begin messagedlg(请输入新卡号!,mtwarning,mbok, 0); edit3.setfocus; exit; end; if cardpassw= then begin messagedlg(请为新卡确定密码!,mtwarning,mbok, 0); edit5.setfocus; exit; end; if money= then begin messagedlg(请输入要充入的金额!,mtwarning,mbok, 0); edit6.setfocus; exit; end;/查询是否已经存在此卡号,如是则要求另输入一新卡号adoquery3.close;adoquery3.sql.clear;adoquery3.sql.add(select * from 卡用户信息 where 卡号=+cardno+);adoquery3.open;tempcard:=trim(adoquery3.fieldbyname(卡号).asstring);adoquery3.close;/查询该生是否已经办理了卡,不允许一人多卡adoquery2.close;adoquery2.sql.clear;if radiobutton1.checked thenadoquery2.sql.add(select * from 卡用户信息 where 学号=+trim(edit1.text)+)elseadoquery2.sql.add(select * from 卡用户信息 where 姓名=+trim(edit2.text)+);adoquery2.open;tempno:=trim(adoquery2.fieldbyname(学号).asstring);adoquery2.close;if tempno then begin messagedlg(该生已经办理了餐卡!,mtwarning,mbok, 0); exit; end;if tempcardthenbeginmessagedlg(已经存在此卡号,请重新输入新卡号!,mtwarning,mbok, 0);edit3.setfocus;exit;end;/在卡用户信息表中添加新卡记录adoquery1.close;adoquery1.sql.clear;adoquery1.sql.add(insert into 卡用户信息(卡号,学号,姓名,性别,年级,专业,班级,办卡日期) values (+cardno+,+studno+,+name+,+man+,+grade+,+major+,+clas+,+date+);adoquery1.open;adoquery1.close;/在卡信息表中添加新记录adoquery2.close;adoquery2.sql.clear;adoquery2.sql.add(insert into 卡信息(卡号,密码,学号,金额,状态) values (+cardno+,+cardpassw+,+studno+,+money+,正常);adoquery2.execsql;adoquery2.close;messagedlg(新卡办理成功!,mtinformation,mbok, 0);end;/*输入完查询条件后按回车执行查询功能*procedure taddcard.edit1keypress(sender: tobject; var key: char);beginif key=#13 thenbitbtn3.click;end;/ *输入完查询条件之后按回车执行查询功能*procedure taddcard.edit2keypress(sender: tobject; var key: char);beginif key=#13 thenbitbtn3.click;end;/*输入完充值金额后按回车执行增加新卡功能*procedure taddcard.edit6keypress(sender: tobject; var key: char);beginif key=#13 thenbitbtn1.click;end;4.5 ic卡注销窗口图11 ic卡注销窗口ic卡注销窗口主要代码如下:public public declarations procedure clear(); /定义清除函数clear(); end;var dropcard: tdropcard;implementation$r *.dfmuses mainf;/*清除各选选项的信息*procedure tdropcard.clear;beginedit1.clear;edit2.clear;checkbox1.checked:=false;radiobutton1.checked:=false;radiobutton2.checked:=false;end;/*搜索卡信息*procedure tdropcard.bitbtn3click(sender: tobject);begin if (trim(edit1.text)=)and (trim(edit2.text)=) then begin messagedlg(请输入查询条件!,mtwarning,mbok,0); edit1.setfocus; exit; end; adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add(select * from +adotable1.tablename); if radiobutton1.checked then begin adoquery1.sql.add(where(+radiobutton1.caption+like %+edit1.text+%); edit1.setfocus; edit2.clear; end else begin adoquery1.sql.add(where(+radiobutton2.caption+like %+edit2.text+%); edit2.setfocus; edit1.clear; end; adoquery1.open; adotable1.clone(adoquery1,ltunspecified); adoquery1.close; clear();end;/*注销ic卡*procedure tdropcard.bitbtn1click(sender: tobject);begin if (trim(edit1.text)=)and (trim(edit2.text)=) then begin messagedlg(请输入要注销的卡号或相应学号!,mtwarning,mbok,0); edit1.setfocus; exit; end; if checkbox1.checked then begin /*删除卡用户信息表中的记录* adoquery1.close; adoquery1.sql.clear; if radiobutton1.checked then adoquery1.sql.add(delete from 卡用户信息 where 卡号=+trim(edit1.text)+) else adoquery1.sql.add(delete from 卡用户信息 where 学号=+edit2.text+); adoquery1.execsql; /*删除卡信息表中的记录* adoquery2.close; adoquery2.sql.clear; if radiobutton1.checked then adoquery2.sql.add(delete from 卡信息 where 卡号=+trim(edit1.text)+) else adoquery2.sql.add(delete from 卡信息where学号 =+trim(edit2.text)+); adoquery2.execsql; adoquery2.close; /*删除用户消费中的相应记录* adoquery1.sql.clear; if radiobutton1.checked then adoquery1.sql.add(delete from 用户消费where卡号=+trim(edit1.text)+) else adoquery1.sql.add(delete from 用户消费where 学号=+trim(edit2.text)+); adoquery1.execsql; adoquery1.close; showmessage(注销成功!); end else showmessage(未选择是否注销,请确定!); clear();end;/*退出窗口并清空信息*procedure tdropcard.bitbtn2click(sender: tobject);beginclear();close;end;/*打开窗口时清空信息*procedure tdropcard.formcreate(sender: tobject);beginclear();end;end.4.6充值窗口图12 ic卡充值窗口ic卡充值窗口主要代码如下:uses mainf;/*各输入框清空*procedure taddmoney.clear;beginedit1.clear;edit2.clear;end;/*ic卡充值*procedure taddmoney.bitbtn1click(sender: tobject);varmoney,cardno:string;begin/要求输入正确的卡号和金额if (trim(edit1.text)=) then begin messagedlg(请输入卡号!,mtwarning,mbok,0); edit1.setfocus; exit; end;if (trim(edit2.text)=) then begin messagedlg(请输入充入金额!,mtwarning,mbok,0); edit2.setfocus; exit; end;/查询是否存在此卡号adoquery1.close;adoquery1.sql.clear; adoquery1.sql.add(select*from 卡信息 where 卡号 =+trim(edit1.text)+);adoquery1.open;cardno:=adoquery1.fieldbyname(卡号).asstring;if cardno= thenbeginmessagedlg(没有这个卡号!,mtinformation,mbok, 0);exit;end;money:=adoquery1.fieldbyname(金额).asstring;adoquery1.close;money:=trim(floattostr(strtofloat(money)+strtofloat(trim(edit2.text);adoquery2.close;adoquery2.sql.clear;adoquery2.sql.add(update 卡信息 set 金额=+money+ where 卡号=+trim(edit1.text)+);adoquery2.execsql;adoquery2.close;messagedlg(充值完成!,mtinformation,mbok, 0);end;/*输入完充值金额后按回车执行充值操作*procedure taddmoney.edit2keypress(sender: tobject; var key: char);beginif key=#13 thenbitbtn1.click;end;end.4.7管理员权限窗口图13 管理员权限窗口管理员权限窗口主要代码如下:uses mainf;/*清空各个输入框的函数clear();*procedure tadmin.clear();beginedit1.clear;edit2.clear;edit3.clear;edit4.clear;edit5.clear;edit6.clear;edit7.clear;checkbox1.checked:=false;end;/*查看管理员表中的记录信息*procedure tadmin.bitbtn1click(sender: tobject);beginadoquery1.close;adoquery1.sql.clear;adoquery1.sql.add(s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论