餐饮管理系统实训报告
餐饮管理系统
1、绪论
近年来,随着人们生活水平的不断提高,餐饮业的消费持续增长,竞争越来
越激烈。然而,传统餐饮企业的日常运作是靠人工管理,从原材料入库到客人点单,再到结账基本上由人工完场记录,这样不仅耗费人力资源而且容易导致记录丢失或重复等错误,造成管理水平低下。
2、需求分析
本系统应用计算机对餐饮企业信息进行管理,具有手工管理所无法比拟多的优点,极大地提高了信息管理的效率。本系统运用Microsoft SQL Server2005为后台数据库,以C#为前台开发工具,系统实现了前台管理、食物类型管理、食物管理、桌台管理、开台信息、点菜、结账的功能。
餐厅管理部分:实现菜单类别管理、菜式管理、桌台管理和预订管理。 菜单类别管理:实现食物类别的添加和删除,删除时要将此食物类别下的食物一并删除(给出用户提示);
菜式管理:实现菜式的添加和删除;
3、设计
3.1 数据库设计 数据表设计
用户表
桌子表
开台记录(用餐记录)
客户用餐明细
食物类型
W_foodtype表
餐厅食物
图1 业务流程图
图2 餐饮管理系统功能结构图
3.2前台设计
3.2.1登陆界面:
功能:用户可以通过此界面登陆系统
图3.1 登陆界面
3.2.2 main界面的实现
功能:前台管理,实现各种界面管理,可以通过图片信息查看桌子是否已使用,也可选中图标单击右键选择相应业务
图3.2主界面
3.2.3食物类型管理
功能:可自动添加食物类别,删除食物类别的同时也删除该类别下的食物
图3.3 食物类型管理
3.2.4食物管理
功能:可添加删除食物
图3.4 食物管理
3.2.5桌台信息
功能:可查看桌子的具体信息及使用状态(0为空闲,1为使用)
图3.5桌台管理
3.2.6开台
功能:此界面可也选择用餐人数及服务员和用餐时间
图3.6 开台界面
3.2.7 点菜
功能:单击左边菜谱,输入数量选择服务人员,注明备注单击保存即完成点菜功
能
图3.7点菜界面
3.2.8结账
功能:根据订单号结账
图3.8 结账界面
4、具体实现
前台程序设计
4.1Cdb类:实现C#与数据库连接,调用相应存储过程
public class Cdb
{
private string
appsettingk1=System.Configuration.ConfigurationManager.AppSettings[
public Cdb() {
conn = new SqlConnection(appsettingk1);
}
public DataSet getDataset(String storename, SqlParameter[] parameters) {
SqlCommand cmd = new SqlCommand(storename, conn); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter ad = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); if (parameters != null) {
for (int i = 0; i
cmd.Parameters.Add(parameters[i]);
}
}
ad.Fill(ds);
return ds;
}
public int ExcuteStore(String storename, SqlParameter[] parameters)
{
conn.Open();
SqlCommand cmd = new SqlCommand(storename, conn);
cmd.CommandType = CommandType.StoredProcedure;
if (parameters != null)
{
for (int i = 0; i
{
cmd.Parameters.Add(parameters[i]);
}
}
try
{
cmd.ExecuteNonQuery();
return 0;
}
catch (Exception k)
{
string m = k.Message;
return -1;
}
finally
{
conn.Close();
}
}
}
4.2登陆界面:
public login()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textUid.Text ==
{
MessageBox.Show(
return;
}
Business.CtablesAdmin db = new _1217.Business.CtablesAdmin(); if (db.login(textUid.Text, textPwd.Text) == 1)
{
MessageBox.Show(
this.Hide();
Main m2 = new Main();
m2.ShowDialog();
}
if (db.login (textUid .Text ,textPwd .Text )==0)
{
MessageBox.Show(
}
if (db.login(textUid.Text, textPwd.Text) == -1)
{
MessageBox.Show(
}
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();
}
4.3食物类型管理、食物管理、开台、结账
//添加食物类型
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text ==
{
MessageBox.Show(
return;
}
Business.CtablesAdmin tb = new _1217.Business.CtablesAdmin();
if (tb.addfoodtype(textBox1.Text) == 0)
MessageBox.Show(
bindGridView();
}
}
//删除食物类型
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
if (MessageBox.Show(
MessageBoxIcon.Warning)==DialogResult .Cancel )
{
return;
}
int typeid= int.Parse(dataGridView1.SelectedCells[1].Value.ToString());
Business.CtablesAdmin tb = new _1217.Business.CtablesAdmin(); if (tb.delfoodtype(typeid) == 0)
{
MessageBox.Show(
bindGridView();
else
{
MessageBox.Show(
}
}
}
//添加食物
private void button1_Click(object sender, EventArgs e)
{
if (textname.Text ==
{
MessageBox.Show(
return;
}
Business.CtablesAdmin tb1 = new _1217.Business.CtablesAdmin();
Business.CtablesAdmin tb2 = new _1217.Business.CtablesAdmin();
int c = int.Parse(tb2.atypeid(foodtype.Text).Rows[0][0].ToString());
if (tb1.addfood(c,textname.Text, textunite.Text, textprice.ToString()) == 0)
{
MessageBox.Show(
bindGridView1();
}
else
{
MessageBox.Show(
}
}
//删除食物?
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) {
dataGridView1.AutoGenerateColumns = false;
if (MessageBox.Show(
{
return;
}
else
{
int foodid = int.Parse(dataGridView1.SelectedCells[1].Value.ToString());
Business.CtablesAdmin tb = new _1217.Business.CtablesAdmin(); if (tb.delfoodtype(foodid) == 0)
{
MessageBox.Show(
bindGridView1();
}
else
{
MessageBox.Show(
}
}
}
//开台
private void button1_Click(object sender, EventArgs e)
{
if (numbers.Text ==
{
MessageBox.Show(
}
int uid = int.Parse(comboBox1.SelectedValue.ToString());
if (uid == 0)
{
MessageBox.Show(
return;
}
Business.CtablesAdmin t = new CtablesAdmin();
t.usetable1(dateTimePicker1.Text, int.Parse(numbers.Text), _tid,
comboBox1.SelectedValue.ToString());
t.upstatus(_tid);
MessageBox.Show(
this.Close();
}
private void 取消开台ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (listView1.SelectedItems.Count != 1)
{
MessageBox.Show(
return;
}
string tid = listView1.SelectedItems[0].SubItems[1].Text;
Business.CtablesAdmin t = new _1217.Business.CtablesAdmin();
if (t.cancleusetable(tid) == 0)
{
Business.CtablesAdmin b = new Business.CtablesAdmin();
b.cancleusetable(tid);
b.updatestatus(tid);
MessageBox.Show(
}
}
4.4点菜、结账
//点菜
private void button2_Click(object sender, EventArgs e)
{
if (textBox2.Text ==
MessageBox.Show(
return;
}
if (comboBox1.Text ==
{
MessageBox.Show(
return;
}
Business.CtablesAdmin t = new _1217.Business.CtablesAdmin();
dataGridView1.DataSource = t.getorder(int.Parse(this.id.ToString())); common.Cdb c = new common.Cdb();
DataSet dt = c.getDataset(
SqlParameter(
common.Cdb ss = new common.Cdb();
int aa = int.Parse(ss.getDataset(
SqlParameter(
float lineprice = float.Parse(textBox4.Text.ToString()) * int.Parse(textBox5.Text.ToString()); int foodid = int.Parse(treeView1.SelectedNode.Tag.ToString());
string ud = comboBox1.SelectedValue.ToString();
t.guestfood(foodid, int.Parse(textBox5.Text), textBox6.Text, aa, lineprice.ToString(), ud); MessageBox.Show(
}
//结账
private void button1_Click(object sender, EventArgs e)
{
Business.CtablesAdmin t = new Business.CtablesAdmin();
int s=int.Parse(t.selectordered(ttid).Rows[0][0].ToString());
decimal b = decimal.Parse(t.getsum(s).Rows[0][0].ToString());
Business.CtablesAdmin tt = new Business.CtablesAdmin();
tt.updatestatus(ttid);
tt.jiezhang(b,s);
MessageBox.Show(
}
5、总结
此餐饮管理系统经过三个周基本完成,实现了餐饮管理系统的基本功能,操作简便方便,基本实现了前台管理、食物类型管理、食物管理、开台信息、点菜、结账等基本功能。
经过这三周的实训,培养了我动手创新的能力,在实践中检验了我对知识的掌握能力以及运用能力。同时通过本次实训课让我了解解决实际问题的过程,并提高了我的专业技能,使我把所学的理论知识与实际能力紧密的结合在一起。最重要的是我初步具有了科研意识,我的查找资料,运用资料,完成工程的能力都有了一定提高,为我后继课程的学习打下了坚实的基础。这次实训我的系统没有做到最完善,我认为是我对专业知识的掌握还不够,经过这次实训,我认识到自己的很多不足,需要以后加大努力,弥补缺陷。以后我一定会努力,继续学习,是自己能够更加完善。
6、参考文献
《数据库技术及应用》 中国石油大学出版社
《C#从入门到精通》 清华大学出版社