项目报告书 JAVA设计报告.docx

上传人:小飞机 文档编号:1719590 上传时间:2022-12-16 格式:DOCX 页数:42 大小:1.43MB
返回 下载 相关 举报
项目报告书 JAVA设计报告.docx_第1页
第1页 / 共42页
项目报告书 JAVA设计报告.docx_第2页
第2页 / 共42页
项目报告书 JAVA设计报告.docx_第3页
第3页 / 共42页
项目报告书 JAVA设计报告.docx_第4页
第4页 / 共42页
项目报告书 JAVA设计报告.docx_第5页
第5页 / 共42页
点击查看更多>>
资源描述

《项目报告书 JAVA设计报告.docx》由会员分享,可在线阅读,更多相关《项目报告书 JAVA设计报告.docx(42页珍藏版)》请在三一办公上搜索。

1、项目实习报告书小组人数2实习名称软件开发实习(A)周数2实习地点钟海楼软件实验室班级软件1073人数31起止时间2008.12.22-2009.1.4形式集中 分散指导教师张健小组成员:马晓槟(200711701319)、凌志强(200711701315)一、软件项目开发选择掌握使用Java语言开发数据库应用程序的基本技能,巩固数据库原理及应用等理论知识。编写一个文本界面的Java应用程序,该应用程序能够与数据库建立连接,并且在数据库上执行数据操纵语言。(1)DepartmentalStore项目Domino是一间大型百货商店,Domino库存管理系统预期目标如下: 数据库将能维护供应商的详细

2、资料(维护:查询、插入、删除、修改)。 数据库将能维护商品的详细资料。 数据库将能维护交易的详细资料。 库存管理软件系统应能打印商品可用库存的报表(屏幕上显示出报表即可)(2)ShareAccounting项目Ericmobil是一间国际商业股份有限公司,该公司计划发行一千万股股票(每股 $10)筹集资金,股份按以下四种类型分配:常驻居民、非常驻居民、国内公司、外国公司。Ericmobil的股份账务系统维护股东的详细资料,系统预期目标如下: 数据库将能维护申请者的详细资料。 该股份账务系统应该可以进行适当的查询。 该股份账务系统应该可以打印基于股东类型的分配列表。 该股份账务系统应该可以打印基

3、于股东类型的最大分配列表(以上四种股民的最大股东)。 该股份账务系统应该可以打印基于日期的分配列表。-我们小组选择了项目1.DepartmentalStore项目。-二、实习进度第1-3天:软件项目分配及概念讨论,项目分析第4-5天:数据库设计及实施,建立连接SQL Server数据库的数据源第6-7天:用户界面设计 第7-9天:用Java语言开发项目第10-11天:测试与验证第12-13天:软件项目文档写作三、实习要求软件项目开发以项目组的形式组织实施,每个项目组由2人组成,单号项目组从以上两个开发项目中选做第一个项目,双号项目组选做第二个项目,每组成员协作完成整个项目。项目开发提交文档:1

4、每个项目组提交软件系统源代码。2每个项目组提交软件系统设计文档。3每个项目组提交数据库SQL脚本。四、实习结果1.系统设计框图数据库架构图2.SQL脚本/*1.新建名为CommodityManage的数据库*/create database CommodityManage/*2.创建各个表*/create table SupplierDetail( cSupplierID char(6) primary key, vSupplierName varchar(50), vSupplierDescription varchar(50), cSupplierTele char(12) check(c

5、SupplierTele like 0-9 0-9 0-9 0-9- 0-9 0-9 0-9 0-9 0-9 0-9 0-9 ), vSupplierAddress varchar(50), iShipmentDelay int, cCredibilityDeg char(5) check(cCredibilityDeg in(so-so,high,best,medium)create table Commodity( cCommodityID char(6) primary key, vCommodityName varchar(50), vCommodityType varchar(20)

6、, vCommodityDescription varchar(50), mCommodityUnitPrice money, vCommodityUnit char(10),)create table Supply( cCommodityID char(6), cSupplierID char(6), primary key(cCommodityID,cSupplierID) create table CommodityDetail( cCommodityID char(6) not null, cSupplierID char(6) not null, vCommodityName var

7、char(50), vCommodityType varchar(20), iCommodityQty int, iCommodityThreshold int, dCommodityStoreDate datetime, cNeedFlag char(1), cOrderFlag char(1), foreign key (cCommodityID) references Commodity (cCommodityID), foreign key (cSupplierID) references SupplierDetail (cSupplierID) )create table Order

8、Detail( cOrderID char(3) primary key, cCommodityID char(6), cSupplierID char(6), iOrderQty int, dOrderDate datetime, dShipmentDate datetime, vOrderRemark varchar(50), vOrderClerk varchar(50), foreign key (cCommodityID) references Commodity (cCommodityID), foreign key (cSupplierID) references Supplie

9、rDetail (cSupplierID)create table Sold( cJournalNo char(4) primary key, cCommodityID char(6), cSupplierID char(6), vCommodityName varchar(50), iCommodityQty int, dSoldDate datetime foreign key (cCommodityID) references Commodity (cCommodityID), foreign key (cSupplierID) references SupplierDetail (cS

10、upplierID)/*3.在各个表中插入数据*/*3.1 在SupplierDetail表中插入数据*/insert into SupplierDetail values(SE0001,Rdtio Goods,Famous,high quality,0482-2479920,London Bridge No.114,3,best)insert into SupplierDetail values(SE0002,Tehns Squre,so-so,but cheap,0477-5489456,Tianhe Road No.231,5,so-so)insert into SupplierDeta

11、il values(SE0003,Ocean Store,not bad,0479-5461378,Zhongshan Road No.12,4,high)insert into SupplierDetail values(SE0004,Mars Commodities,quite good,and very fast,0762-5897146,Renmin Road No.35,2,high)insert into SupplierDetail values(SE0005,Simple,good serve and good commodities,0495-8543468,Nanjing

12、Square No.64,3,best)insert into SupplierDetail values(SE0006,Just Buy,not so good,0489-5746132,Zhongshan Road No.234,4,so-so)/*3.2 在Commodity表中插入数据*/insert into Commodity values(TM0001,Banana,Fruit,A cheap and delicious fruit,1.7,kilo);/*香蕉*/insert into Commodity values(MD0002,Apple,Fruit,An apple a

13、 day keep the doctor away,2.4,kilo);/*苹果*/insert into Commodity values(ZE0004,Cake,Dessert,A sweet food for you to enjoy,10,box);/*蛋糕*/insert into Commodity values(JJ0007,Chocolate,Dessert,Almost girls enjoy it,15,box);/*巧克力*/insert into Commodity values(SB0009,Toothpaste,Daily-Necessities,Necessiti

14、es for tooth,9.9,box);/*牙膏*/insert into Commodity values(TK0011,Paper,Daily-Necessities,Necessities for clean,4.5,package);/*纸巾*/insert into Commodity values(EF0014,Rice,Daily-Food,Food that people eat everyday,50,kg);/*大米*/insert into Commodity values(GE0020,Peanut oil,Daily-Food,Need for cook,45,c

15、an);/*花生油*/insert into Commodity values(FE0027,Badminton Racket,Fun,Need for sport,99,pair);/*羽毛球拍*/insert into Commodity values(RG0029,Genuine-DVD,Fun,Film,Animation,Concert and so on,111,piece);/*正版DVD*/*3.3 在Supply表中插入数据*/insert into Supply values(TM0001,SE0001)insert into Supply values(TM0001,SE

16、0004)insert into Supply values(MD0002,SE0006)insert into Supply values(EF0014,SE0003)insert into Supply values(TK0011,SE0002)insert into Supply values(JJ0007,SE0005)insert into Supply values(SB0009,SE0005)insert into Supply values(GE0020,SE0001)insert into Supply values(FE0027,SE0002)insert into Sup

17、ply values(RG0029,SE0003)insert into Supply values(ZE0004,SE0004)insert into Supply values(ZE0004,SE0006)insert into Supply values(TK0011,SE0004)insert into Supply values(GE0020,SE0003)insert into Supply values(JJ0007,SE0001)insert into Supply values(JJ0007,SE0002)insert into Supply values(FE0027,SE

18、0003)insert into Supply values(RG0029,SE0006)/*3.4 在CommodityDetail表中插入数据*/insert into CommodityDetail values(TM0001,SE0001,Banana,Fruit,56,10,2008-12-29,n,n)insert into CommodityDetail values(ZE0004,SE0004,Cake,Dessert,150,25,2008-11-20,n,n)insert into CommodityDetail values(TK0011,SE0004,Paper,Dai

19、ly-Necessities,130,50,2008-10-5,n,n)insert into CommodityDetail values(FE0027,SE0003,Badminton Racket,Fun,20,5,2008-9-15,n,n)insert into CommodityDetail values(GE0020,SE0001,Peanut oil,Daily-Food,17,5,2008-11-26,n,n)/*4.需要用到的触发器*/*4.1 在更新CommodityDetail表时自动更改标志位*/create trigger trgUpdateCommodityDet

20、ailon CommodityDetailafter updateasdeclare qty intdeclare threshold intdeclare id char(6)declare need char(1)select id=cCommodityID,qty=iCommodityQty,threshold=iCommodityThreshold,need=cNeedFlag from insertedif(qtythreshold)beginif(need=n)beginupdate CommodityDetailset cNeedFlag=y,cOrderFlag=nwhere

21、cCommodityID=idendendelsebeginupdate CommodityDetailset cNeedFlag=n,cOrderFlag=nwhere cCommodityID=idend/*4.2 在CommodityDetail表中插入新记录时自动填写部分列*/create trigger trgInsertCommodityDetailon CommodityDetailafter insertasupdate CommodityDetailset dCommodityStoreDate=getdate(),cNeedFlag=n,cOrderFlag=nwhere

22、cCommodityID=(select cCommodityID from inserted)/*5.需用到的存储过程*/*5.1 生成售出商品信息*/create proc prcSold journalno char(4),commodityid char(6),qty intasbegin begin tran declare date datetime select date=getdate() declare supplierid char(6) declare commodityname varchar(50) declare result int select supplier

23、id=cSupplierID,commodityname=vCommodityName from CommodityDetail where cCommodityID=commodityid insert into Sold values(journalno,commodityid,supplierid,commodityname,qty,date) update CommodityDetail set iCommodityQty=iCommodityQty-qty where cCommodityID=commodityid set result=(select iCommodityQty

24、from CommodityDetail where cCommodityID=commodityid) if(result0) beginrollback tranprint 货物不足!请重新输入售出的数量。 end commit tranend/*5.2 生成一条定单记录*/create proc prcOrder orderid char(3),commodityid char(6),supplierid char(6),orderqty int,remark varchar(50),clerk varchar(50)asbegindeclare orderdate datetimede

25、clare shipmentdate datetimedeclare delay intselect orderdate=getdate()select delay=iShipmentDelay from SupplierDetailwhere cSupplierID=supplieridselect shipmentdate=dateadd(dd,delay,getdate()insert into OrderDetail values(orderid,commodityid,supplierid,orderqty,orderdate,shipmentdate,remark,clerk)up

26、date CommodityDetail set cOrderFlag=y where cCommodityID=commodityidend以上为SQL脚本3.菜单设计42Supplier Menu1.查看供应商信息2.插入供应商信息*3.修改供应商信息*4.删除供应商信息*0.返回主菜单Commodity Menu1.查看商品信息2.插入商品信息*3.修改商品信息*4.删除商品信息*0.返回主菜单Business Menu1.订单信息菜单2.销售信息菜单0.返回主菜单Main Menu1.进入商品菜单2.进入供应商菜单3.进入交易菜单0.退出系统Order Menu1.查看订单信息2.插入

27、订单信息*3.修改订单信息*4.删除订单信息*0.返回交易菜单Sold Menu1.显示销售信息2.销售商品0.返回交易菜单注:带*选项应写入系统日志4.JAVA源代码import java.io.*;import java.sql.*;/-Heres Commodity Detail-/class Commodity static int n;static String ID;public void CommodityMenu()throws IOExceptionSystem.out.println( |-Commodity Menu-|);System.out.println( 1.Di

28、splay Commodity Detail);System.out.println( 2.Insert Commodity Detail);System.out.println( 3.Update Commodity Detail);System.out.println( 4.Delete Commodity Detail);System.out.println( 0.Exit);System.out.println( |-|);System.out.print( Please choose a number(04):);Commodity c=new Commodity();c.choos

29、e();public void again()throws IOExceptionSystem.out.println(Return to Main Menu ?);System.out.print(Press 10 for Yes,Press 20 for No! );BufferedReader ar=new BufferedReader(new InputStreamReader(System.in);String d=ar.readLine();int m=Integer.parseInt(d);Commodity c=new Commodity();CommodityManage C

30、M=new CommodityManage();if(m=10)c.CommodityMenu();c.choose();else if(m=20)System.out.println(You have exited the Main Menu!);System.exit(0);elseSystem.out.println(Please Enter again!);c.again();public void choose()throws IOException BufferedReader br=new BufferedReader(new InputStreamReader(System.i

31、n);String w=br.readLine();n=Integer.parseInt(w);Commodity c=new Commodity();CommodityManage CM=new CommodityManage();switch(n)case 1:c.DisplayCommodity();c.again();break;case 2:c.InsertCommodity() ;c.again();break;case 3:c.UpdateCommodity() ;c.again();break;case 4:c.DeleteCommodity() ;c.again();brea

32、k;case 0:System.out.println(-You have returned to the Main Menu!-);CM.DisplayMenu();CM.chooseMenu();break;default:System.out.println(Please Enter again:);c.choose();break;public void DisplayCommodity() System.out.println(-1.DisplayCommodity-);Connection con=null;Statement stat;ResultSet res; try Cla

33、ss.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:Commodity); stat=con.createStatement(); res=stat.executeQuery(select * from CommodityDetail); while(res.next() System.out.println( Commodity ID : +res.getString(1); System.out.println( Supplier ID : +res.getString(2)

34、; System.out.println(Commodity Name : +res.getString(3); System.out.println(Commodity Type : +res.getString(4); System.out.println( Quantity : +res.getString(5); System.out.println(Thresold Value : +res.getString(6); System.out.println( Store Date : +res.getString(7); System.out.println( Need Flag :

35、 +res.getString(8); System.out.println( Order Flag : +res.getString(9); System.out.println(n-Commodity Detail-n); catch(Exception e) System.out.println(Could not query: +e); if (con!=null) con=null;public void Display() Connection con=null; PreparedStatement stat; ResultSet res=null; BufferedReader

36、br = new BufferedReader(new InputStreamReader(System.in); try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverManager.getConnection(jdbc:odbc:Commodity); stat=con.prepareStatement(select * from CommodityDetail where cCommodityID=?); stat.setString(1,(String)ID); res=stat.executeQuery(); while

37、(res.next() System.out.println( Commodity ID : +res.getString(1); System.out.println( Supplier ID : +res.getString(2); System.out.println(Commodity Name : +res.getString(3); System.out.println(Commodity Type : +res.getString(4); System.out.println( Quantity : +res.getString(5); System.out.println(Th

38、resold Value : +res.getString(6); System.out.println( Store Date : +res.getString(7); System.out.println( Need Flag : +res.getString(8); System.out.println( Order Flag : +res.getString(9); System.out.println(n-Commodity Detail-n); catch(Exception e) System.out.println(Could not display: +e); if (con

39、!=null) con=null;public void InsertCommodity()throws IOException System.out.println(-2.InsertCommodity-);Connection con=null; PreparedStatement stat=null; int res=0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in); try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); con=DriverMa

40、nager.getConnection(jdbc:odbc:Commodity); stat=con.prepareStatement(insert into CommodityDetail(cCommodityID,cSupplierID,vCommodityName,vCommodityType,iCommodityQty,iCommodityThreshold) values(?,?,?,?,?,?); System.out.print(cCommodityID(6) = ); String cCommodityID=br.readLine(); /从键盘读入值存入字串变量中 ID=cCommodityID;System.out.print(

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号