使用java仓库管理系统设计.docx

上传人:scccc 文档编号:13234228 上传时间:2021-12-19 格式:DOCX 页数:25 大小:28.88KB
返回 下载 相关 举报
使用java仓库管理系统设计.docx_第1页
第1页 / 共25页
使用java仓库管理系统设计.docx_第2页
第2页 / 共25页
使用java仓库管理系统设计.docx_第3页
第3页 / 共25页
使用java仓库管理系统设计.docx_第4页
第4页 / 共25页
使用java仓库管理系统设计.docx_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《使用java仓库管理系统设计.docx》由会员分享,可在线阅读,更多相关《使用java仓库管理系统设计.docx(25页珍藏版)》请在三一文库上搜索。

1、使用JAVA的仓库管理系统毕业设计目录系统开发的必要性及介绍系统概要设计系统详细设计系统源代码调试分析和测试结果系统使用说明书心得体会参考文献课程设计题目:仓库货品信息管理系统一、系统开发的必要性及介绍1.必要性仓库管理是现代物流管理的一个重要组成部分,仓库货物管理信息系统的设计,可以实现对存储货物信息及统计单据的计算机管理,简化作业程序,提高作业效率,为企业创造更高的利润。2.主要功能介绍本系统有对库存货品信息的输入、插入、删除、查找等功能,并能将建立和更新的库存信息保存于文件供输出或打印。对于查找、删除等功能要求能按货品名、货品号分别进行。每个货品的相关信息包括:货品号、货品名、货品库存量

2、、进货日期、货品生产厂家及供应商等。二、系统概要设计1.系统设计任务要求系统能实现库存货品信息的输入、插入、删除、查找等功能,并能将建立和更新的库存信息保存于文件供输出或打印。对于查找、删除等功能能够按货品名、货品号分别进行。每个货品的相关信息包括:货品号、货品名、货品库存量、进货日期、货品生产厂家及供应商等。2.方案确定库存货品信息管理系统要求实现许多功能,可遵循结构化程序设计思想来进行本系统的设计自顶向下,逐步细化,也就是将软件设计任务划分成许多容易解决的小的子任务,即分解出许多子功能模块进行设计。本程序经过分析可划分出6个子任务:输入、输出、插入、删除、查找和保存。3.模块划分 (1)程

3、序设计模块连接图库存货品信息管理系统的模块连接结构如下图:仓库货品信息管理系统 主程序模块 载入模块保存模块 查找模块删除模块插入模块 输出模块输入模块4.环境要求硬件:PC机软件:电脑安装有TC集成环境三、系统详细设计1数据结构设计(1)数据结构的选择选取动态数据结构,本系统是通过双向链表来完成的。动态存储分配与释放:申请存储空间函数malloc( )函数首部原型为void * malloc(unsigned int size)释放存储空间函数free( )函数首部原型为void free(void*p)动态数据结构双向链表 (2) 数据类型的选择struct commodity /*定义双

4、向链表结构体*/int number; /*货物编号*/ char namemax; /*货物名称*/ int counter; /*货物数量*/ struct commodity *piror, *next; /*定义两指针,分别指向其前驱和后继*/;(3)变量函数说明:COM *input( )操作结果:输入货品信息COM *insert_perf( )操作结果:插入某货品COM *del_perf( )操作结果:删除某货品serch( )操作结果:查找某货品print_perf( )操作结果:输出某货品save(COM*head)操作结果:保存COM *openfile( )操作结果:载

5、入2.流程框图查找模块和载入模块的算法框图在此略。开始(1)输入模块申请一个结点空间,使ptr1指向它将ptr1指向结点输入货品的信息ptr1->num!=0 NNULL=>ptr1Y ptr1!=NULL N是否为第一个数据(n=0) Y NPtr1=>ptr2->next;ptr2=>ptr1->prior Yptr1=>head Yn+1=>n, ptr1=>ptr2NULL=>ptr2->next 返回head结束(2)插入模块 开始调入载入模块Head=NULL申请一个结点空间,使ptr3指向它给ptr3指向结点输入预

6、插入货品的信息 Head=>ptr1ptr1!=NULL N Y返回NULLptr1=>ptr2;ptr1->next=>ptr1ptr2=>ptr1->priorptr3=>ptr2->next;ptr2=>ptr3->priorNULL=>ptr3->next“yes”or “no” NY 返回head结束开始(3)保存模块输入预保存文件的文件名创建文件成功 N YHead=>ptr1Ptr1!=NULL N Y将ptr1指向结点的数据写入文件Ptr1->next=>ptr1结束开始 2030(4)输

7、出模块 调用载入模块Head= =NULL YYHead=>ptr1输出ptr1指向结点的货品信息 Ptr1->next=>ptr1 NPtr1!=NULL Y N结束对以上各模块的文字解释说明:(1)输入模块:其实就是一个建立链表的操作模块。建立链表的具体操作就是逐一输入各结点数据,并建立其前后相链的关系。首先设三个指针变量:head,ptr1,ptr2。它们都是指向结构体类型数据的。先使head的值为NULL,这是链表为空的情况。用malloc函数开辟一个结点,并使ptr1,ptr2都指向它,之后从键盘读入一个货品的数据给ptr1所指向的结点。当输入的ptr1->n

8、um不为0时,令headptr1;ptr2=ptr1,即把ptr1的值赋给head,使ptr2,ptr1,head都指向这一新开辟的结点,此结点就成为链表中的第一个结点。再开辟一个新结点并使ptr1指向它,读入该结点的数据,如果输入的ptr1->num不为0,则应链入这第二个结点,这时和上一个结点的处理不同,是将ptr1的值赋给ptr2->next,也就是使第一个结点的next成员指向第二个结点,接着将ptr2也指向结点2。再开辟一个新结点并使ptr1指向它,读入该结点的数据,同样将ptr1的值赋给ptr2->next,也就是使第三个结点链接到第二个结点之后,并接着将ptr1

9、的值赋给ptr2,使ptr2指向结点3。再开辟一个新结点,并使ptr1指向它,输入该结点的数据,如果输入ptr1->num为0,则是输入结束标志,此结点不被链接到链表中,就将NULL赋给ptr2->next。建立链表过程至此结束,ptr1最后所指结点并未链入链表中。(2)插入模块:要完成的是链表的插入操作,即将一个新结点插入到一个已有的链表中,对刚刚建立的链表,首先新设一个指针变量ptr0,并开辟一个结点使ptr3指向它,输入该结点的数据,即新货的有关数据,接下来查找要插入位置结点,找到后只需修改此结点和ptr0指向结点指针域的值即可,链表中所有元素位置均不需移动,这就体现了链表的

10、优点。(3)删除模块:要完成的是链表的删除操作,只需修改链表中要删除结点的前一个结点的链指针。使之指向被删除结点的后面一个结点即可。(4)保存模块:将最终想要保留的数据信息保存于文件中。(5)输出模块:要完成的是依次输出链表中各结点的数据的操作。首先找到链表头结点的地址,也就是head的值,然后设一个指针变量ptr1,先指向第一个结点,输出ptr1所指的结点,然后使ptr1后移一个结点,再输入直至链表的尾结点结束。四、系统源代码#include<stdio.h> /*标准输入/输出头文件*/#include<conio.h> /*包含绘制图形函数等头文件*/#inclu

11、de<string.h> /*包含字符串处理函数头文件*/#include<stdlib.h> /*包含动态存储与释放函数头文件*/#include<graphics.h>#define LEN sizeof(COM)#define PRINT "% -15ld% -15s% -15dn",ptr1->num,ptr1->name,ptr1->count#define CHECK_COUNT ptr1->count<0#define CHECK_COUNT2 ptr3->count<0#defin

12、e NULL 0typedef struct com long int num; char name10; int count; struct com *prior, *next; COM; /*定义结构体*/COM *input(); /*输入货品信息*/COM *insert( ); /*插入货品信息*/COM *delet( ); /*删除货品信息*/void search( ); /*查找货品信息*/void save(COM *head); /*保存货品信息*/COM *openfile( ); /*从文件将货品信息载入链表*/void print( ); /*输出货品信息*/FIL

13、E *fp; /*定义指向文件的指针变量*/COM *head=NULL;COM *ptr1=NULL,*ptr2=NULL;char filename110; /*定义字符数组,用来存放文件名*/char filename2 =".dat" /*文件扩展名.dat*/*输入模块*/COM *input( )char string1 ="number" char string2 ="name" char string3 ="count" int n=1; if(ptr1=(COM*)malloc(LEN)=NULL

14、) /*申请空间函数*/ printf("No enough memory,fail to creat linklist!"); getch( ); /*无回显的从键盘读取任意一个字符*/ clrscr( ); printf("Please input depend on the emply(goodsnumber=0 over):n"); do printf("Please input the No.%d goods'%s:n",n,string1); scanf("%ld",&ptr1->

15、num);flushall(); if(ptr1->num=0) printf("Please press any key to back to last Menu:"); getch( ); free(ptr1); return(0); printf("Please input the No.%d goods'%s:n",n,string2);scanf("%s",&ptr1->name); flushall( ); /*刷新缓冲区函数*/ printf("Please input the No

16、.%d goods'%s:n",n,string3);scanf("%d",&ptr1->count); flushall( ); if(CHECK_COUNT) printf("Please input the right goodscount!n"); while(CHECK_COUNT); while(ptr1->num!=NULL) if(n=1) head=ptr1; else ptr2->next=ptr1; ptr1->prior=ptr2; n=n+1; ptr2=ptr1; if(ptr

17、1=(COM* )malloc(LEN)=NULL) printf("No enough memory,fail to creat linklist!"); getch( ); do printf("Please input the No.%d goods'%s:n",n,string1); scanf("%ld",&ptr1->num); flushall( ); if(ptr1->num=0) ptr1->num=NULL; break; printf("Please input the

18、 No.%d goods'%s:n",n,string2);scanf("%s",&ptr1->name); flushall( ); printf("Please input the No.%d goods'%s:n",n,string3);scanf("%d",&ptr1->count); flushall( ); if(CHECK_COUNT) printf("Please input the right goodscount!n"); while(CHE

19、CK_COUNT); ptr2->next=NULL; gotoxy(1,24); printf("Finish the inputting of goods'message,press any key to back to last Menu,please save:"); getch(); return(head);/*插入模块*/COM * insert( ) COM * ptr3; char string1 ="goodsnumber" char string2 ="goodsname" char string3

20、 ="goodscount" char judge10; clrscr( ); gotoxy(18,10); printf("Please input inserted goods'fliename:"); head=openfile( ); if(head=NULL) return(NULL); else do clrscr( ); printf("Please input inserted goods'goodsmessage:n"); if(ptr3=(COM*)malloc(LEN)=NULL) printf(

21、"No enough memory,fail to creat node!"); getch(); do printf("Please input goods'%s(>0):n",string1);scanf("%ld",&ptr3->num); flushall( ); if(ptr3->num<=0) printf("Error inputting!please choose the inserted goods againn"); getch( );return; pr

22、intf("Please input goods'%s:n",string2);scanf("%s",&ptr3->name);flushall( ); printf("Please input goods'%s:n",string3);scanf("%d",&(ptr3->count); flushall( ); if(CHECK_COUNT2) printf("Please input the right goodscount(>0)!n")

23、; while(CHECK_COUNT2); ptr1=head; while(ptr1!=NULL) ptr2=ptr1; ptr1=ptr1->next; ptr1->prior=ptr2; ptr2->next=ptr3;ptr3->prior=ptr2; ptr3->next=NULL; printf("nInserting success!Cotinue to insert?(yes or no):"); scanf("%s",judge); clrscr( ); while(! strcmp(judge,&quo

24、t;yes"); gotoxy(20,10); printf("Inserting success!n"); gotoxy(18,11); printf("Press any key to back to last Menun"); gotoxy(16,12); printf("And make sure to Save(6) them or you will lose them!n"); getch( ); return(head);/*删除模块*/COM *delet( ) char name10; char judge

25、10; int sel; int del_num; clrscr( ); gotoxy(20,10); printf("Please input delected goods'fliename:"); head=openfile( ); clrscr( ); if(head=NULL) return(NULL); else do do clrscr( ); gotoxy(3,4); printf("Please input delected goods'message:"); gotoxy(1,9); printf(" *1.D

26、el depend on goodsnumbern"); gotoxy(1,10); printf(" *2.Del depend on goodsnamen"); gotoxy(10,22); printf("please choose a number between 1 and 2:"); scanf("%d",&sel); switch(sel) case 1:clrscr( ); gotoxy(6,6); printf("Please input goodsnumber:"); scan

27、f("%d",&del_num); break; case 2:clrscr( ); gotoxy(6,6); printf("Please input goodsname:"); scanf("%s",&name); break; while(sel!=1&&sel!=2); ptr1=head; if(ptr1->num=del_num|(strcmp(ptr1->name,name)=0) head=ptr1->next; printf("Success to dele

28、ct goodsmessage!n"); else /*判断是否是目标结点*/ while(ptr1!=NULL&&ptr1->num!=del_num&&strcmp(ptr1->name,name)!=0) ptr2=ptr1; ptr1=ptr1->next;ptr1->prior=ptr2; if(ptr1->num=del_num|(strcmp(ptr1->name,name)=0) ptr2->next=ptr1->next; ptr1->next->prior=ptr1->

29、;prior; free(ptr1); printf("nSuccess to delect goodsmessage!nn"); else printf("nCan't find this goodsmessage!nn"); printf("Cotinue to delect?(yes or no):"); scanf("%s",judge); while(!strcmp(judge,"yes"); clrscr( ); gotoxy(20,10); printf("Del

30、ecting success!n"); gotoxy(18,11); printf("Press any key to back to last Menun"); gotoxy(16,12); printf("And make sure to Save(6) them or you will lose them!n"); getch( ); return(head); /*查找模块*/void search( )char name10; char judge10; int sel; long int sel_num; clrscr( ); go

31、toxy(18,10); printf("Please press searched goods'fliename:"); head=openfile( ); if(head=NULL) return; else do do clrscr( ); gotoxy(5,4); printf("Please choose the way to search:"); gotoxy(1,9); printf(" *1.Search depend on goodsnumbern"); printf(" *1.Search dep

32、end on goodsnamen"); gotoxy(10,22); printf("please choose a number between 1 and 2:"); scanf("%d",&sel); switch(sel) case 1:clrscr( ); printf("Please input goodsnumber:"); scanf("%ld",&sel_num); break; case 2:clrscr( ); printf("Please input g

33、oodsname:"); scanf("%s",name); break; while(sel!=1&&sel!=2); ptr1=head; while(ptr1!=NULL&&ptr1->num!=sel_num&&strcmp(ptr1->name,name)!=0) ptr1=ptr1->next; if (ptr1->num=sel_num)|(strcmp(ptr1->name,name)=0) printf("n Success to search goodsme

34、ssage!n"); printf("goodsnumber goodsname goodscountnn"); printf(PRINT); else printf("nCan't find this goodsmessage!nn"); printf("Cotinue to search?(yes or no):"); scanf("%s",judge); while(!strcmp(judge,"yes"); gotoxy(10,24); printf("Ple

35、ase press any key to back to last Menu:"); getch( ); /*输出模块*/void print( ) int i=1; clrscr( ); gotoxy(18,10); printf("Please input printed goods'filename:"); head=openfile( ); if(head=NULL) return; else clrscr( ); printf(" The printed result as follows:n"); printf("

36、goodsnumber goodsname goodscountnn"); ptr1=head; do printf(PRINT); ptr1=ptr1->next; if(i/10=1) /*超过十行换页*/ i=0; printf("Press any key to change page:"); getch( ); clrscr( ); gotoxy(0,6); printf("goodsnumber goodsname goodscountnn"); i=i+1; while(ptr1!=NULL); gotoxy(10,24);

37、 printf("Please press any key to back to last Menu:"); getch( ); /*保存模块*/void save(COM *head) clrscr(); gotoxy(8,13); printf("Please input saved goods'filename(limit to letter or number):"); scanf("%s",filename1); if(fp=fopen(strcat(filename1,filename2),"wb&quo

38、t;)=NULL) /*以二进制只写方式打开一个流*/ printf("Fail to creat FILE!"); getch( ); return; ptr1=ptr2=head; while(ptr1!=NULL) if(fwrite(ptr1,sizeof(COM),1,fp)!=1) printf("Fail to print message to FILE!"); getch( ); return; ptr1=ptr1->next; fclose(fp); gotoxy(10,24); printf("Saving succe

39、ss!Press any key to back to last Menu:"); getch();/*载入模块*/COM * openfile( )int n=1; scanf("%s",filename1); if(fp=fopen(strcat(filename1,filename2),"rb")=NULL) gotoxy(15,13); printf("This filename isn't exist,please check if exist.npress any key back to Menu");

40、getch( ); return(NULL); if(ptr1=ptr2=(COM*)malloc(LEN)=NULL) printf("No enough memory,fail to creat linklist!nPlease press any key back to Menun"); getch( ); return(NULL); if(fread(ptr1,sizeof(COM),1,fp)!=1) /*从fp指向的流中读取1个字段,每个字段为COM的字符长,并把它们放到ptr1指向的字符数组中,文件的位置指示器随着所读取的字符数而下移*/ printf(&qu

41、ot;Fail to print message from FILE!nPlease press any key back to Menun"); getch( ); return(NULL); if(ptr1->next=NULL) head=ptr1; else do if(n=1) head=ptr1; else ptr2->next=ptr1; n=n+1; ptr2=ptr1; if(ptr1=(COM*)malloc(LEN)=NULL) printf("No enough memory,fail to creat linklist!nPlease press any key to back to Menun"); getch( );return(NULL); if(fread(ptr1,sizeof(COM),1,fp)!=1)

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

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1