




已阅读5页,还剩24页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
课 程 设 计 报 告 课程名称:面向对象程序设计C+ 设计题目: 超市商品管理系统 专 业:计算机科学与技术 姓 名: 学 号: 指导教师:李 晓 虹2016 年 1 月 10 日摘要:商品管理系统是一个超市不可或缺的一部分,它的内容对于超市的管理者或者决策者来说都很重要。所以超市管理系统应该能够为用户提供充足的信息和快捷的查询手段。随着科学技术的不断提高,其强大的功能已经为人们深刻意识,它已经进入人类社会的各个领域并发挥着重要作用。因此,通过电脑软件编程,开发这样一套商品管理系统成为很有必要的事情。用户可以根据该系统查询相关信息,管理者可以根据该系统查询、修改商品信息。关键词:商品管理、查询、编程一.需求分析随着科技的进步,计算机技术的飞速发展,许多企业在进行技术改造的同时,各种工作也趋向于信息技术化管理。管理系统事一个信息化、智能化和先进管理集合,一个高效有用的管理系统课一减少一个企业或者上商家的管理费用和人力物力开支,不仅可以节省大量时间,还可以为企业的各项决策带来巨大的经济效益。与人们生活接触最贴近的超市也有它自己完善的管理系统。计算机的自动化管理系统提高了超市管理的管理水平和工作效率,增强超市的竞争能力降低成本,为客户提供更加优质的服务。所以需要开发一个计算机系统来代替人工管理超市人员对商品信息管理和顾客购买等方面的工作。使用该系统可以使超市的服务更加快捷、准确和方便,减少大量的人工操作,提高了工作效率。1.功能需求分析1).登陆根据系统的使用权限不同,讲登陆权限设置为管理员登陆和普通用户登录,管理员登陆需要账号和密码,普通用户登陆不需要账号和密码;普通用户登录具有操作权限:查找商品,买入商品,售出商品,商品排序系统管理员登陆具有的操作权限:增加商品,删除商品,查找商品,修改商品,售出商品,买入商品,清空库存,商品排序。2).商品管理功能:商品管理功能主要是针对超市管理人员使用,对库存商品进行简单的管理。本功能当中主要可以实现商品的添加、查询、修改、删除,出售,买入等功能。(1)添加商品通过主页面提示菜单键入相对应数字进入添加商品选项,然后根据提示添加商品信息,主要包括商品ID、商品名称、商品金额、商品数量、商品生产厂家、以、商品的库存量以及备注。(2)删除商品通过主页面的提示菜单键入相应数字进入删除商品选项,完成最商品信息的删除。首先选择输入要删除商品的类别,再输入要删除的商品的名称,根据查询结果删除商品的记录,如果该商品在库存物品当中不存在,则系统给出相应提示,该商品不存在。(3)修改商品通过主页面的提示菜单键入相应数字进入修改商品选项,对商品信息进行修改。可根据查询的结果对相应的商品信息进行修改,包括商品的名称、品牌、价格、生产厂家和库存量。(4)查询商品通过主页面的提示菜单键入相应数字进入查询商品选项,对商品信息进行查询。可根据相应提示选择查询方式,按商品类别、商品名称、生产厂家进行查询商品的全部信息。如果存在相应商品的信息,则输出所查询商品的信息,如果不存在该商品的记录,则系统自动提示该商品的记录不存在。(5) 排序输出,排序方式有:1. 按ID从小到大排序2. 按ID从大到小排序3. 按名称从小到大排序4. 按名称从大到小排序5. 按数量从小到大排序6. 按数量从大到小排序7. 按价格从小到大排序8. 按价格从大到小排序2 总体设计 图1超市商品管理系统模块结构图 三.详细设计1.利用数据结构,数据结构要求:在整个系统当中除了使用类层次结构、继承机制、模板等,还使用的了数据结构当中的链表结构,主要用来进行商品的管理功能。包括商品的添加、修改、删除、查询等。可以通过链表进行存储、访问操作。通过动态申请链表空间,用指针操作数据节点完成商品信息的一系列操作2.代码详细设计:1).登陆代码void CAdminLoginDialog:OnLogin() / TODO: Add your control notification handler code hereCString name;CString keyword;this-GetDlgItemText(IDC_EDIT1, name);this-GetDlgItemText(IDC_EDIT2, keyword);char *pNameStr = (LPSTR)(LPCTSTR)name;char *pKeywordStr = (LPSTR)(LPCTSTR)keyword;CStringTool stringTool;if(stringTool.IsEqual(pNameStr, 123456) & stringTool.IsEqual(pKeywordStr, 123456)CAdminMainDialog dialog;OnOK();dialog.DoModal();elsethis-MessageBox(账号密码输入错误, 超市商品管理系统);2).查找商品代码:void CLocateDialog:OnLocate() / TODO: Add your control notification handler code hereCString str1;this-GetDlgItemText(IDC_COMBO1, str1);char *pSeleteStr = CSTRING_TO_CHAR(str1);CString str2;this-GetDlgItemText(IDC_EDIT1, str2);char *pItemStr = CSTRING_TO_CHAR(str2);CStringTool stringTool;if(stringTool.IsEqual(pSeleteStr, 名称)CItem item = this-m_pItemSystem-LocateItemByName(pItemStr);if(item = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;char pIdID_STR_SIZE;char pNameNAME_STR_SIZE;char pPrice100;char pNumber100;char pDescribeDESCRIBE_STR_SIZE;item.GetID(pId);item.GetName(pName);item.GetDescribe(pDescribe);double dPrice = item.GetPrice();int iNumber = item.GetNumber();sprintf(pPrice, %lf, dPrice);sprintf(pNumber, %d, iNumber);this-SetDlgItemText(IDC_STATIC1, pId);this-SetDlgItemText(IDC_STATIC2, pName);this-SetDlgItemText(IDC_STATIC3, pPrice);this-SetDlgItemText(IDC_STATIC4, pNumber);this-SetDlgItemText(IDC_STATIC5, pDescribe);else if(stringTool.IsEqual(pSeleteStr, ID)CItem item = this-m_pItemSystem-LocateItemById(pItemStr);if(item = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;char pIdID_STR_SIZE;char pNameNAME_STR_SIZE;char pPrice100;char pNumber100;char pDescribeDESCRIBE_STR_SIZE;item.GetID(pId);item.GetName(pName);item.GetDescribe(pDescribe);double dPrice = item.GetPrice();int iNumber = item.GetNumber();sprintf(pPrice, %lf, dPrice);sprintf(pNumber, %d, iNumber);this-SetDlgItemText(IDC_STATIC1, pId);this-SetDlgItemText(IDC_STATIC2, pName);this-SetDlgItemText(IDC_STATIC3, pPrice);this-SetDlgItemText(IDC_STATIC4, pNumber);this-SetDlgItemText(IDC_STATIC5, pDescribe);elseassert(0);3) .添加新商品:void CInsertDialog:OnOk() / TODO: Add your control notification handler code hereif(this-UpdateData() = false)return;CString id;CString name;CString price;CString number;CString describe;GetDlgItemText(IDC_EDIT1, id);GetDlgItemText(IDC_EDIT2, name);GetDlgItemText(IDC_EDIT3, price);GetDlgItemText(IDC_EDIT4, number);GetDlgItemText(IDC_EDIT5, describe);char *pName;char *pId;char *pDescribe;char *pNumber;char *pPrice;pName = CSTRING_TO_CHAR(name);pId = CSTRING_TO_CHAR(id);pDescribe = CSTRING_TO_CHAR(describe);pNumber = CSTRING_TO_CHAR(number);pPrice = CSTRING_TO_CHAR(price);int iNumber = atoi(pNumber);double dPrice = atof(pPrice);CStringTool stringTool;if(stringTool.IsEqual(pId, ) |stringTool.IsEqual(pName, ) |stringTool.IsEqual(pPrice, ) |stringTool.IsEqual(pNumber, ) |stringTool.IsEqual(pDescribe, ) )this-MessageBox(请输入完整的信息);return;CItem item;item.SetID(pId);item.SetName(pName);item.SetPrice(dPrice);item.SetNumber(iNumber);item.SetDescribe(pDescribe);if(m_pItemSystem-NoSuchItem() = item)this-MessageBox(插入的商品非法);return;if(m_pItemSystem-IsHaveID(pId)this-MessageBox(已存在相同ID的商品!);return;m_pItemSystem-InsertItem(pName, pId, dPrice, pDescribe, iNumber);this-m_pItemSystem-SaveFile(FILE_STRING);this-MessageBox(增加商品成功);this-EndDialog(IDC_OK);4) .删除商品代码:void CDeleteDialog:OnOk() / TODO: Add your control notification handler code hereCString str1;this-GetDlgItemText(IDC_COMBO1, str1);char *pSeleteStr = CSTRING_TO_CHAR(str1);CString str2;this-GetDlgItemText(IDC_EDIT1, str2);char *pItemStr = CSTRING_TO_CHAR(str2);CStringTool stringTool;if(stringTool.IsEqual(pSeleteStr, 名称)if(this-m_pItemSystem-LocateItemByName(pItemStr) = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;this-m_pItemSystem-DeleteItemByName(pItemStr);else if(stringTool.IsEqual(pSeleteStr, ID)if(this-m_pItemSystem-LocateItemById(pItemStr) = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;char nameNAME_STR_SIZE;this-m_pItemSystem-GetItemControllerByID(pItemStr).GetItemName(name);this-m_pItemSystem-DeleteItemByName(name);elseassert(0);this-m_pItemSystem-SaveFile(FILE_STRING);this-MessageBox(删除商品成功);this-EndDialog(IDC_OK);5) .修改商品信息代码:void CReviseDialog:OnOk() / TODO: Add your control notification handler code hereif(this-UpdateData() = false)return;CString str1;this-GetDlgItemText(IDC_COMBO1, str1);char *pSeleteStr = CSTRING_TO_CHAR(str1);CString str2;this-GetDlgItemText(IDC_EDIT1, str2);char *pItemStr = CSTRING_TO_CHAR(str2);CStringTool stringTool;if(stringTool.IsEqual(pSeleteStr, 名称)CItem item = this-m_pItemSystem-LocateItemByName(pItemStr);if(item = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;CString edit1; CString edit2;CString edit3;CString edit4;CString edit5;this-GetDlgItemText(IDC_EDIT1, edit1);this-GetDlgItemText(IDC_EDIT2, edit2);this-GetDlgItemText(IDC_EDIT3, edit3);this-GetDlgItemText(IDC_EDIT4, edit4);this-GetDlgItemText(IDC_EDIT5, edit5);if(edit1.IsEmpty() | edit2.IsEmpty() | edit3.IsEmpty() | edit4.IsEmpty() | edit5.IsEmpty()this-MessageBox(请输入完整的信息);return;char *pId;char *pName;char *pPrice;char *pNumber;char *pDescribe;pName = CSTRING_TO_CHAR(edit1);pId = CSTRING_TO_CHAR(edit2);pPrice = CSTRING_TO_CHAR(edit3);pNumber = CSTRING_TO_CHAR(edit4);pDescribe = CSTRING_TO_CHAR(edit5);double dPrice = atof(pPrice);int iNumber = atof(pNumber);CItemController itemController = this-m_pItemSystem-GetItemControllerByName(pName);itemController.SetItemID(pId);itemController.SetItemPrice(dPrice);itemController.SetItemNumber(iNumber);itemController.SetItemDescribe(pDescribe);this-m_pItemSystem-SaveFile(FILE_STRING);this-MessageBox(修改成功);this-EndDialog(IDC_OK);else if(stringTool.IsEqual(pSeleteStr, ID)CItem item = this-m_pItemSystem-LocateItemById(pItemStr);if(item = this-m_pItemSystem-NoSuchItem()this-MessageBox(对不起,库存中没有此商品);return;CString edit1; CString edit2;CString edit3;CString edit4;CString edit5;this-GetDlgItemText(IDC_EDIT1, edit1);this-GetDlgItemText(IDC_EDIT2, edit2);this-GetDlgItemText(IDC_EDIT3, edit3);this-GetDlgItemText(IDC_EDIT4, edit4);this-GetDlgItemText(IDC_EDIT5, edit5);if(edit1.IsEmpty() | edit2.IsEmpty() | edit3.IsEmpty() | edit4.IsEmpty() | edit5.IsEmpty()this-MessageBox(请输入完整的信息);return;char *pId;char *pName;char *pPrice;char *pNumber;char *pDescribe;pName = CSTRING_TO_CHAR(edit2);pId = CSTRING_TO_CHAR(edit1);pPrice = CSTRING_TO_CHAR(edit3);pNumber = CSTRING_TO_CHAR(edit4);pDescribe = CSTRING_TO_CHAR(edit5);double dPrice = atof(pPrice);int iNumber = atof(pNumber);CItemController itemController = this-m_pItemSystem-GetItemControllerByID(pId);itemController.SetItemName(pName);itemController.SetItemPrice(dPrice);itemController.SetItemNumber(iNumber);itemController.SetItemDescribe(pDescribe);this-m_pItemSystem-SaveFile(FILE_STRING);this-MessageBox(修改成功);this-EndDialog(IDC_OK);elseassert(0);6) .售出商品:void CSellDialog:OnOk() / TODO: Add your control notification handler code hereif(this-UpdateData() = false)return;CString static1;CString static2;CString static3;CString static4;CString static5;this-GetDlgItemText(IDC_STATIC1, static1);this-GetDlgItemText(IDC_STATIC2, static2);this-GetDlgItemText(IDC_STATIC3, static3);this-GetDlgItemText(IDC_STATIC4, static4);this-GetDlgItemText(IDC_STATIC5, static5);if(static1.IsEmpty() & static2.IsEmpty() & static3.IsEmpty() & static4.IsEmpty() & static5.IsEmpty()this-MessageBox(没有找到商品);return;int itemNumber = atof(CSTRING_TO_CHAR(static4);if(this-m_number itemNumber)this-MessageBox(库存数量不够);return;char *pName = CSTRING_TO_CHAR(static2);CItemController itemController = this-m_pItemSystem-GetItemControllerByName(pName);itemController.SetItemNumber(itemNumber-this-m_number);this-m_pItemSystem-SaveFile(FILE_STRING);this-MessageBox(出售成功);this-EndDialog(IDC_OK);BOOL CSellDialog:OnInitDialog() CDialog:OnInitDialog();/ TODO: Add extra initialization hereModifyStyleEx(WS_EX_TOOLWINDOW, WS_EX_APPWINDOW);(CComboBox*)GetDlgItem(IDC_COMBO1)-SetCurSel(0);return TRUE; / return TRUE unless you set the focus to a control / EXCEPTION: OCX Property Pages should return FALSE7) .买入商品:void CBuyDialog:OnOk() / TODO: Add your control notification handler code hereif(this-UpdateData() = false)return;CString static1;CString static2;CString static3;CString static4;CString static5;this-GetDlgItemText(IDC_STATIC1, static1);this-GetDlgItemText(IDC_STATIC2, static2);this-GetDlgItemText(IDC_STATIC3, static3);this-GetDlgItemText(IDC_STATIC4, static4);this-GetDlgItemText(IDC_STAT
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 中医治未病宣传
- 2025电商平台的合同书范例
- 2025已购经济适用住房出售合同
- 2025关于知识产权行业标准合同范本
- 《水资源与健康常识》课件
- 工程地质勘察课件
- 城市燃气泄漏事故处置
- 2025房屋租赁合同范本简约版
- 2025标准广州市房屋租赁合同
- 2025粮食收购合同范本
- 2024年12月大学英语四级考试真题及答案第1套
- SA8000社会责任法律法规清单一览表
- 化学-辽宁省协作体2024-2025学年度高三上学期期末考试试题试题和答案
- 2025年文化产业投资入股保密协议模板3篇
- 2025-2030年中国酶制剂行业竞争格局展望及发展战略研究报告
- 消化道出血介入术后护理
- 《自救器的使用与创伤急救》培训课件2025
- 2025年浙江杭州市人才管理服务中心(杭州市人事考试院)编外员工招聘高频重点提升(共500题)附带答案详解
- 军恋对象申请书表
- 环保设施租约解除协议
- 木材干燥学的课程设计
评论
0/150
提交评论