




已閱讀5頁,還剩24頁未讀, 繼續(xù)免費閱讀
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
課 程 設 計 報 告 課程名稱:面向對象程序設計C+ 設計題目: 超市商品管理系統(tǒng) 專 業(yè):計算機科學與技術 姓 名: 學 號: 指導教師:李 曉 虹2016 年 1 月 10 日摘要:商品管理系統(tǒng)是一個超市不可或缺的一部分,它的內容對于超市的管理者或者決策者來說都很重要。所以超市管理系統(tǒng)應該能夠為用戶提供充足的信息和快捷的查詢手段。隨著科學技術的不斷提高,其強大的功能已經為人們深刻意識,它已經進入人類社會的各個領域并發(fā)揮著重要作用。因此,通過電腦軟件編程,開發(fā)這樣一套商品管理系統(tǒng)成為很有必要的事情。用戶可以根據(jù)該系統(tǒng)查詢相關信息,管理者可以根據(jù)該系統(tǒng)查詢、修改商品信息。關鍵詞:商品管理、查詢、編程一.需求分析隨著科技的進步,計算機技術的飛速發(fā)展,許多企業(yè)在進行技術改造的同時,各種工作也趨向于信息技術化管理。管理系統(tǒng)事一個信息化、智能化和先進管理集合,一個高效有用的管理系統(tǒng)課一減少一個企業(yè)或者上商家的管理費用和人力物力開支,不僅可以節(jié)省大量時間,還可以為企業(yè)的各項決策帶來巨大的經濟效益。與人們生活接觸最貼近的超市也有它自己完善的管理系統(tǒng)。計算機的自動化管理系統(tǒng)提高了超市管理的管理水平和工作效率,增強超市的競爭能力降低成本,為客戶提供更加優(yōu)質的服務。所以需要開發(fā)一個計算機系統(tǒng)來代替人工管理超市人員對商品信息管理和顧客購買等方面的工作。使用該系統(tǒng)可以使超市的服務更加快捷、準確和方便,減少大量的人工操作,提高了工作效率。1.功能需求分析1).登陸根據(jù)系統(tǒng)的使用權限不同,講登陸權限設置為管理員登陸和普通用戶登錄,管理員登陸需要賬號和密碼,普通用戶登陸不需要賬號和密碼;普通用戶登錄具有操作權限:查找商品,買入商品,售出商品,商品排序系統(tǒng)管理員登陸具有的操作權限:增加商品,刪除商品,查找商品,修改商品,售出商品,買入商品,清空庫存,商品排序。2).商品管理功能:商品管理功能主要是針對超市管理人員使用,對庫存商品進行簡單的管理。本功能當中主要可以實現(xiàn)商品的添加、查詢、修改、刪除,出售,買入等功能。(1)添加商品通過主頁面提示菜單鍵入相對應數(shù)字進入添加商品選項,然后根據(jù)提示添加商品信息,主要包括商品ID、商品名稱、商品金額、商品數(shù)量、商品生產廠家、以、商品的庫存量以及備注。(2)刪除商品通過主頁面的提示菜單鍵入相應數(shù)字進入刪除商品選項,完成最商品信息的刪除。首先選擇輸入要刪除商品的類別,再輸入要刪除的商品的名稱,根據(jù)查詢結果刪除商品的記錄,如果該商品在庫存物品當中不存在,則系統(tǒng)給出相應提示,該商品不存在。(3)修改商品通過主頁面的提示菜單鍵入相應數(shù)字進入修改商品選項,對商品信息進行修改??筛鶕?jù)查詢的結果對相應的商品信息進行修改,包括商品的名稱、品牌、價格、生產廠家和庫存量。(4)查詢商品通過主頁面的提示菜單鍵入相應數(shù)字進入查詢商品選項,對商品信息進行查詢??筛鶕?jù)相應提示選擇查詢方式,按商品類別、商品名稱、生產廠家進行查詢商品的全部信息。如果存在相應商品的信息,則輸出所查詢商品的信息,如果不存在該商品的記錄,則系統(tǒng)自動提示該商品的記錄不存在。(5) 排序輸出,排序方式有:1. 按ID從小到大排序2. 按ID從大到小排序3. 按名稱從小到大排序4. 按名稱從大到小排序5. 按數(shù)量從小到大排序6. 按數(shù)量從大到小排序7. 按價格從小到大排序8. 按價格從大到小排序2 總體設計 圖1超市商品管理系統(tǒng)模塊結構圖 三.詳細設計1.利用數(shù)據(jù)結構,數(shù)據(jù)結構要求:在整個系統(tǒng)當中除了使用類層次結構、繼承機制、模板等,還使用的了數(shù)據(jù)結構當中的鏈表結構,主要用來進行商品的管理功能。包括商品的添加、修改、刪除、查詢等??梢酝ㄟ^鏈表進行存儲、訪問操作。通過動態(tài)申請鏈表空間,用指針操作數(shù)據(jù)節(jié)點完成商品信息的一系列操作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(賬號密碼輸入錯誤, 超市商品管理系統(tǒng));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(庫存數(shù)量不夠);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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 西安職業(yè)技術學院《軟件設計V:軟件工程導論》2023-2024學年第二學期期末試卷
- 南通大學《小學心理輔導設計》2023-2024學年第二學期期末試卷
- 新鄉(xiāng)工程學院《大數(shù)據(jù)挖掘及應用》2023-2024學年第二學期期末試卷
- 宜昌科技職業(yè)學院《晶體光學實驗》2023-2024學年第二學期期末試卷
- 四川體育職業(yè)學院《電工電子》2023-2024學年第二學期期末試卷
- 西安理工大學《虛擬儀器實踐》2023-2024學年第二學期期末試卷
- 西安科技大學《實驗診斷學見習》2023-2024學年第二學期期末試卷
- 廣州美術學院《外科護理學(Ⅱ)》2023-2024學年第二學期期末試卷
- 中華女子學院《電子商務基礎與應用》2023-2024學年第二學期期末試卷
- (高清版)DBJ 08-56-1996 建筑幕墻工程技術規(guī)程(玻璃幕墻分冊)
- 浙江寧波鎮(zhèn)海區(qū)2025屆中考生物對點突破模擬試卷含解析
- 2025屆八省聯(lián)考語文試卷評析及備考策略 課件
- 脫硫塔拆除施工方案
- 北京二十中2025屆高考英語二模試卷含解析
- 《高速公路電動汽車清障救援作業(yè)規(guī)范》
- 五年級下冊異分母分數(shù)加減法練習200題有答案
- 急性心衰的急救護理與流程
- 我的家鄉(xiāng)江西吉安
- 肺栓塞病人的術后護理
- 國開2024年秋《心理健康教育》形考任務1-9答案
- 電力運維管理平臺方案設計
評論
0/150
提交評論