商品銷售統(tǒng)計(jì)課程設(shè)計(jì)_第1頁
商品銷售統(tǒng)計(jì)課程設(shè)計(jì)_第2頁
商品銷售統(tǒng)計(jì)課程設(shè)計(jì)_第3頁
商品銷售統(tǒng)計(jì)課程設(shè)計(jì)_第4頁
商品銷售統(tǒng)計(jì)課程設(shè)計(jì)_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、目錄一、課程設(shè)計(jì)概述3二、系統(tǒng)的需求分析3三、系統(tǒng)總體設(shè)計(jì)6四、詳細(xì)設(shè)計(jì)7五、 系統(tǒng)實(shí)現(xiàn)11六、系統(tǒng)測試18七、課程設(shè)計(jì)總結(jié)21八、參考文獻(xiàn)21一、課程設(shè)計(jì)概述系統(tǒng)的主要目標(biāo)減輕收銀時計(jì)算商品總價(jià)的復(fù)雜度系統(tǒng)的開發(fā)環(huán)境及運(yùn)行環(huán)境操作系統(tǒng):Windos7Java版本:5IDE:myeclipse 2017 CI二、系統(tǒng)的需求分析1.系統(tǒng)可行性分析技術(shù)復(fù)雜度相對簡單投入資金小對于社會普遍存在的收銀時計(jì)算問題得到良好解決人員投入1人2. 系統(tǒng)功能需求分析商品銷售統(tǒng)計(jì)系統(tǒng)的完整功能如下:2.1輸入商品信息管理對于輸入的商品,可以進(jìn)行數(shù)量上的修改,以及商品的刪除2.2銷售統(tǒng)計(jì)管理對已輸入的

2、商品進(jìn)行總價(jià)統(tǒng)計(jì),并能在商品數(shù)量多的時候進(jìn)行分頁顯示3. 系統(tǒng)功能描述此系統(tǒng)的主要功能就是把人們從繁瑣的收錢計(jì)費(fèi)中解脫出來,通過計(jì)算機(jī)來計(jì)算出所應(yīng)收取的錢數(shù)。4. 系統(tǒng)的數(shù)據(jù)流圖商品銷售統(tǒng)計(jì)系統(tǒng)是基于pc上的系統(tǒng),通過數(shù)據(jù)庫里的商品單價(jià)來進(jìn)行計(jì)算總價(jià)操作。商品銷售統(tǒng)計(jì)系統(tǒng)的基本數(shù)據(jù)流圖如圖1所示。圖 1分析商品銷售統(tǒng)計(jì)系統(tǒng)的功能需求,得到功能級數(shù)據(jù)流圖如圖2。圖 25. 系統(tǒng)UML建模設(shè)計(jì):6. 系統(tǒng)的用例分析7. 系統(tǒng)的狀態(tài)圖8. 系統(tǒng)的UML類圖三、系統(tǒng)總體設(shè)計(jì)系統(tǒng)結(jié)構(gòu)方框圖各模塊功能詳細(xì)的UML類圖設(shè)計(jì)數(shù)據(jù)管理子系統(tǒng):數(shù)據(jù)庫只有一張圖表故省略掉E-R圖、數(shù)據(jù)表之間的關(guān)系、數(shù)據(jù)庫表結(jié)構(gòu)數(shù)據(jù)

3、庫表設(shè)計(jì)人機(jī)交互子系統(tǒng)四、詳細(xì)設(shè)計(jì)各模塊的流程圖主模塊結(jié)算商品輸入商品修改商品刪除商品查詢商品5、 系統(tǒng)實(shí)現(xiàn)想使用工廠模式來進(jìn)行事務(wù)的調(diào)用,又因?yàn)榉N種因素而沒直接使用,而直接裝進(jìn)了主調(diào)用功能類中各模塊、各個類的具體實(shí)現(xiàn) (包括截圖)對應(yīng)與Mybatis的接口statisticsModel 模型類SetXXX . getXXX .int id;String name;int mea;float price;double amount; / 考慮計(jì)量單位的不同double total; /單類商品 的總價(jià)格Overridepublic String toString() String str;if

4、(mea=0)str=件;return 編號:+id+, 商品名稱: + name + , 計(jì)量單位: +str+ , 價(jià)格: + price + /+str+, 數(shù)量:+ amount+ 件, 合計(jì):+total+;elsestr=kg;return 編號:+id+, 商品名稱: + name + , 計(jì)量單位: +str+ , 價(jià)格: + price + /+str+, 重量:+ amount+ kg, 合計(jì):+total+;重點(diǎn)功能的實(shí)現(xiàn)statisticsUtil 商品查詢功能類package com.util;import java.io.IOException;import jav

5、a.io.Reader;import java.util.List;import org.apache.ibatis.io.Resources;import org.apache.ibatis.session.SqlSession;import org.apache.ibatis.session.SqlSessionFactory;import org.apache.ibatis.session.SqlSessionFactoryBuilder;import com.impl.statisticsOperation;import com.model.statisticsModel;public

6、 class statisticsUtil private static SqlSessionFactory sqlSessionFactory;private static Reader reader;statictry reader=Resources.getResourceAsReader(com/conf/dbconf.xml);sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); catch (IOException e) / TODO Auto-generated catch blocke.printSt

7、ackTrace();public void all_select()SqlSession sqlSession=sqlSessionFactory.openSession();List query_msg=null;try statisticsOperation statisticsOperation=sqlSession.getMapper(statisticsOperation.class);query_msg=statisticsOperation.all_select(); catch (Exception e) / TODO Auto-generated catch blocke.

8、printStackTrace();finally sqlSession.close();for(int j=0;jquery_msg.size();j+)System.out.println(query_msg:+query_msg.get(j);/查找商品public statisticsModel statistics_select(int id)SqlSession sqlSession=sqlSessionFactory.openSession();statisticsModel myModel=null;List query_msg=null;try statisticsOpera

9、tion statisticsOperation=sqlSession.getMapper(statisticsOperation.class);query_msg=statisticsOperation.statistics_select(id); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();finally sqlSession.close();for(int j=0;jquery_msg.size();j+)myModel=(statisticsModel)query_msg.get(j)

10、;System.out.println(query_msg:+query_msg.get(j);return myModel;主功能類 testpackage com.serv;import java.util.ArrayList;import java.util.List;import java.util.Scanner;import com.model.statisticsModel;import com.util.statisticsUtil;public class test public static statisticsUtil statisticsUtil = new stati

11、sticsUtil();public static void main(String args) List sale = new ArrayList();statisticsModel temp = null;double total = 0;boolean flag = true;/ TODO Auto-generated method stubSystem.out.println(歡迎進(jìn)入商品銷售管理系統(tǒng));System.out.println(請輸入相應(yīng)的數(shù)字執(zhí)行對應(yīng)的操作:);Scanner scanner = new Scanner(System.in);String key = ;

12、while (flag) System.out.println(1.輸入商品 2.修改商品數(shù)量 3.刪除商品 4.查看總價(jià)統(tǒng)計(jì) 0.重新計(jì)算 其他.退出系統(tǒng));System.out.println(-我是可愛的分隔符-);try key = scanner.nextLine(); catch (Exception e) / TODO: handle exceptione.printStackTrace();switch (key) case 1:statisticsUtil.all_select();while (true) System.out.println(請輸入商品編號:(非數(shù)字結(jié)束輸

13、入);int number;try number = scanner.nextInt(); catch (Exception e1) / TODO Auto-generated catch blockbreak;try temp = statisticsUtil.statistics_select(number);if (temp = null) System.out.println(無此商品);continue;if(temp.getMea()=0)System.out.println(清輸入數(shù)量:);else if(temp.getMea()=1)System.out.println(請輸

14、入重量 單位kg);double amount = scanner.nextDouble();System.out.println(amount);temp.setAmount(amount);temp.setTotal();sale.add(temp); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();scanner.nextLine();break;case 2:System.out.println(請輸入要修改的行號:);try int index = scanner.nextInt();t

15、emp = (statisticsModel) sale.get(index);System.out.println(請輸入要修改的數(shù)量:);double number = scanner.nextDouble();temp.setAmount(number);temp.setTotal();sale.set(index, temp);scanner.nextLine();System.out.println(修改成功!); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();break;case 3

16、:System.out.println(請輸入要刪除的行號:);try int index = scanner.nextInt();sale.remove(index);scanner.nextLine();System.out.println(刪除成功!); catch (Exception e) / TODO Auto-generated catch blocke.printStackTrace();break;case 4:for (int i = 0; i sale.size(); i+) System.out.println(i + . + sale.get(i);total += (statisticsModel) sale.get(i).getTotal();System.out.println(共計(jì): + total + 元);total = 0;break;case 0:sale.clear();break;default:flag = false;break;System.out.println(再見);六、系統(tǒng)測試測試用例測試結(jié)果

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論