资源描述
目录
一、设计任务――产品进销存管理系统 1
二、功能需求分析 1
三、功能算法设计 1
3.1各功能函数关系图 1
3.2详细算法设计 2
四、代码实现 3
4.1重要代码 3
4。1。1相关头文件的编写以及结构体的建立 3
4。1。2添加产品信息函数 3
4。1。3查询产品信息函数 5
4.1。4主函数 7
4。2运行结果 8
4。2。1系统界面 8
4.2.2添加 8
4。2。3查询 9
4。2.4退出 9
五、调试分析 10
5.1存储结构的建立 10
5。2定义查询功能 10
5。3功能缺失弥补 10
六、课设总结 10
七、谢辞 10
八、参考文献 10
一、设计任务――产品进销存管理系统
问题描述:
针对某一种行业的库房的产品进销存情况进行管理。
基本要求:
⑴采用一定的存储结构对库房的货品及其数量进行分类管理;
⑵可以进行产品类的添加、产品的添加、产品数量的添加;
⑶能够查询库房每种产品的总量、进货日期、销出数量、销售时间等。
二、功能需求分析
系统的功能主要有:管理员操作:进入系统后,管理员就可以对产品的进货,销售,存货等方面的信息有个详细的了解。并且可以对产品的类,产品,产品的数量,产品销售信息进行管理,可以添加新的产品信息。同时对库房每种产品的总量、进货日期、销出数量、销售时间等也可以有详细的了解.
三、 功能算法设计
菜单
3.1各功能函数关系图
退出
查询
添加
3.2详细算法设计
(1)头文件设计
添加相关头文件即可
(2)int Create(sqlist &L);
创建数据库系统用于储存产品的相关信息,如每种产品的总量、进货日期、销出数量、销售时间等.
(3)int Add(sqlist &L);
添加产品的相关信息,如产品类、产品、产品数量、进货日期、销出数量、销售时间等.
(4)void View(sqlist &L);
查询产品相关信息,比如每种产品的总量、进货日期、销出数量、销售时间等.
(5) void Display(sqlist &L);
对查询到的产品的一些相关信息进行打印输出,从而对我们所需要查的产品的具体情况一目了然。
(6) void menu_operation();
对菜单整体情况和布局进行显示,并显示出出它的各项功能:添加功能,查询功能以及退出菜单。
(7) Void main();
编辑主函数,实现对各部分的分工和控制和执行作用。
四、代码实现
4。1重要代码
4。1.1相关头文件的编写以及结构体的建立
#include〈stdio。h>
#include<stdlib.h>
#include〈string.h〉
#include<conio。h〉
#define ok 1
#define error 0
#define overflow 0
#define SQMOUTLINK_INIT_SIZE 100
#define SQMOUTLINKINCREMENT 10
typedef struct date
{ int year;
int month;
int day;}date;
typedef struct productnode
{char product_name[40]; //产品名称
int product_quantity; //产品总量
int sales_quantity; //销售数量
int product_stock; //产品库存
date buy_time; //进货日期
date sales_time; //销售日期
struct productnode *next;
}productnode,*plinklist;
typedef struct kindnode
{ productnode * first_product; //头指针
char pkindname[40]; //商品名称
int kind_number; //产品种类个数
}kindnode;
typedef struct
{ kindnode* kindelem;
int length;
int listsize;}sqlist;
4。1.2添加产品信息函数
int Add(sqlist &L)
{ plinklist p,q; int k,j,n; char pkindname[20];
printf(”请输入添加产品所属的商品类:\n”);
scanf(”%s",&pkindname);
for(k=0;k〈L.length;k++)//查找该商品
{ if(strcmp((L。kindelem[k])。pkindname,pkindname)==0)
{
printf(”请输入所要添加的产品类数量(个):\n"); scanf(”%d”,&n);
L。kindelem[k]。kind_number=L。kindelem[k]。kind_number+n;
if(L。kindelem[k].first_product==NULL)//商品下没产品
{ q=(plinklist)malloc(sizeof(productnode));
printf(”请输入需添加产品的名称:\n”);
scanf(”%s”,&(q—〉product_name));
printf("请输入产品总量:\n");
scanf("%d”,&(q-〉product_quantity));
printf("请输入进货日期(年—月—日):\n"); scanf(”%d—%d—%d”,&((q—>buy_time)。year),&((q—〉buy_time)。month),&((q—〉buy_time)。day));
printf(”请输入销售数量:\n");
scanf("%d",&(q->sales_quantity));
printf(”请输入销售时间(年—月-日):\n”); scanf("%d-%d—%d”,&((q-〉sales_time)。year),&((q—〉sales_time)。month),&((q—>sales_time).day));
q—>product_stock=(q-〉product_quantity)—(q—>sales_quantity);
q-〉next=NULL;
L.kindelem[k]。first_product=q;
p=L。kindelem[k]。first_product;
for(j=1;j〈n;j++)
{ q=(plinklist)malloc(sizeof(productnode));
printf("请输入需添加产品的名称:\n”);
scanf(”%s”,&(q—>product_name));
printf(”请输入产品总量:\n");
scanf("%d",&(q—〉product_quantity));
printf(”请输入进货日期(年-月—日):\n"); scanf(”%d—%d-%d",&((q—>buy_time).year),&((q—>buy_time)。month),&((q—〉buy_time).day));
printf(”请输入销售数量:\n");
scanf(”%d”,&(q—〉sales_quantity));
printf(”请输入销售时间(年-月—日):\n”); scanf(”%d—%d-%d”,&((q—〉sales_time)。year),&((q—〉sales_time).month),&((q—〉sales_time)。day));
q-〉product_stock=(q—〉product_quantity)—(q—〉sales_quantity);
q-〉next=p->next; p-〉next=q; p=q;
}
}
else//商品下有产品
{
p=L。kindelem[k]。first_product;
for(j=0;j〈n;j++)
{ q=(plinklist)malloc(sizeof(productnode));
printf(”请输入需添加产品的名称:\n");
scanf(”%s”,&(q—〉product_name));
printf(”请输入产品总量:\n");
scanf(”%d”,&(q—〉product_quantity));
printf(”请输入进货日期(年—月-日):\n”);
scanf("%d-%d-%d",&((q—〉buy_time)。year),&((q—>buy_time)。month),&((q—〉buy_time)。day));
printf("请输入销售数量:\n”);
scanf(”%d",&(q—>sales_quantity));
printf("请输入销售时间(年—月—日):\n”); scanf(”%d-%d-%d",&((q—〉sales_time)。year),&((q-〉sales_time).month),&((q-〉sales_time)。day));
q-〉product_stock=(q—〉product_quantity)-(q—〉sales_quantity);
for(p=L.kindelem[k]。first_product;(p—〉next)!=NULL;p=p—>next);
q—>next=p->next; p—〉next=q;p=q;
}
} break;
}
}
if(k〉=L.length)//没有该商品类
{strcpy(L。kindelem[k]。pkindname,pkindname);
L。length++;
printf(”请输入所要添加的产品类数量(个):\n"); scanf("%d",&n);
L。kindelem[k].kind_number=n;
for(j=0;j〈n;j++)
{ p=(plinklist)malloc(sizeof(productnode));
printf(”请输入此产品类所含产品的产品名称:\n");
scanf(”%s",&(p-〉product_name));
printf(”请输入产品总量:\n");
scanf("%d”,&(p-〉product_quantity));
printf(”请输入产品的进货日期(年—月-日):\n");
scanf("%d-%d-%d”,&((p—〉buy_time).year),&((p—>buy_time).month),&((p->buy_time)。day));
printf("请输入产品的销售数量:\n”);
scanf(”%d",&(p->sales_quantity));
printf(”请输入产品的销售时间(年—月-日):\n”);
scanf("%d—%d—%d",&((p->sales_time)。year),&((p->sales_time).month),&((p—>sales_time)。day));
p-〉product_stock=(p—〉product_quantity)—(p-〉sales_quantity);
L.kindelem[k]。first_product=p;p-〉next=NULL;
}
} return ok;
}
4。1。3查询产品信息函数
void View(sqlist &L)
{int i,k,order,flag=0;
char pkindname[20],product_name[20];
plinklist p;
printf("请输入待查询产品所商品类:\n”);
scanf(”%s",&pkindname);
for(i=0;i<L.length;i++) //进行商品匹配
{if(strcmp((L.kindelem[i])。pkindname,pkindname)==0)//找到商品
{int m=0;
printf("输入待查询的产品:\n");scanf(”%s”,&product_name);
for(p=L。kindelem[i]。first_product;p!=NULL;p=p—>next)//进行产品的匹配
{m++;
if(strcmp(p-〉product_name,product_name)==0)//找到产品
{
printf("查询选项:\n");
printf(”\t1——-进货日期\n”);
printf(”\t2——-产品总量\n");
printf(”\t3—--销售数量\n");
printf(”\t4—--销售日期\n”);
printf("\t5-——产品库存\n”);
printf(”\t6-——全部信息\n");
printf("\t0———返回\n");
loop:
printf("请进行选择:(0-7)\n”);
scanf(”%d”,&order);
switch(order)
{ case1:printf(”*进货日期\t”);
printf("%d-%d-%d\n”,(p—>buy_time)。year,(p—〉buy_time)。month,(p—>buy_time)。day);
printf("………………………………………\n”);goto loop;
case 2: printf("*产品总量\t”);
printf(”%d\n",p—>product_quantity);
printf(”………………………………………\n");goto loop;
case 3: printf(”*销售数量\t”);
printf("%d\n",p->sales_quantity);
printf(”………………………………………\n");goto loop;
case 4: printf("*销售日期\t”); printf(”%d—%d-%d\n",(p-〉sales_time)。year,(p—>sales_time).month,(p—〉sales_time)。day);
printf("………………………………………\n”);goto loop;
case 5: printf(”*产品库存\t”);
printf(”%d\n”,p—〉product_stock);
printf(”………………………………………\n");goto loop;
case 6: printf(”*查询信息如下:\n”);
printf(”\t”);
printf(”产品的名称\t”);
printf(”%s\t”,p—>product_name);
printf("进货日期\t");
printf(”%d-%d-%d\n",(p-〉buy_time)。year,(p-〉buy_time)。month,(p—〉buy_time).day);
printf(”\t");
printf(”产品总量\t”);
printf(”%d\t",p—〉product_quantity);
printf(”销售数量\t");
printf(”%d\n”,p—>sales_quantity);
printf("\t”);
printf("销售日期\t”);
printf("%d—%d—%d\n",(p—>sales_time).year,(p-〉sales_time)。month,(p—〉sales_time).day);
printf(”\t”);
printf(”产品库存\t");
printf(”%d\t”,p—>product_stock);goto loop;
case 0: system("cls”);flag=1; break;
default: printf("对不起,你输入有误!”);goto loop; } break;
}
}
4.1.4主函数
void main()
{int order;
sqlist L;
Init(L);
loop:
menu_operation();
printf(”………………………………………………\n");
scanf(”%d”,&order);
switch(order)
{ case 1:system("cls”);
Add(L); goto loop;
case 2:system(”cls");
View(L); goto loop;
case 0: exit(0);
}
}
4.2运行结果
4。2.1系统界面
4。2。2添加
4。2.3查询
4。2.4退出
五、调试分析
5.1存储结构的建立
认识邻接矩阵存储结构,经过不断地调试,成功完成图创建函数的编辑。
5.2定义查询功能
让用户更快的,更好的查询到产品的相关信息,在做到存储以后马上就能根据提示进行查询。
5。3功能缺失弥补
进行整体效果调试,减少一些运行时出现的问题和错误,使其功能效果更加完善。
六、课设总结
要做好一件事,只能一步一步的去做,不可能一下子就完成。在程序的编写,实现上同样如此。简单的几个功能,在真正实现、编写代码的过程却发现有很多的问题没有解决.比如要存储哪些数据,用什么方式存储;用怎么样的结构去保存各种数据等。并且在最后去演示系统的时候还出来很大的漏洞,不过后来经过修改,终于成功的完成了系统.
要做好一个系统,一个严谨的思维是不可以或缺的,每一个联系都要考虑,每个细节都需要注意,每一种错误都要会解决.只有把每一种问题都解决了,才能做出一个完善的系统出来。
七、谢辞
本报告是在王英华老师的悉心指导和热情关怀下完成的,同时也感谢给予我帮助的各位同学。
八、参考文献
1、严蔚敏,吴伟民.数据结构(C语言版)[M].清华大学出版社2010.3
2、严蔚敏,吴伟民.数据结构(C语言版)[M].清华大学出版社1999.2
3、严蔚敏,吴伟民.数据结构(C语言版)[M].清华大学出版社2007.8
9
展开阅读全文