仓库管理系统c语言.docx
- 文档编号:30211521
- 上传时间:2023-08-07
- 格式:DOCX
- 页数:37
- 大小:48.92KB
仓库管理系统c语言.docx
《仓库管理系统c语言.docx》由会员分享,可在线阅读,更多相关《仓库管理系统c语言.docx(37页珍藏版)》请在冰豆网上搜索。
仓库管理系统c语言
作品名称
开发者:
一、系统背景:
本软件能减轻对货物数目管理及价格盈亏等信息处理的工作量以便能快捷及时准确的调整货物的仓储量达到最合理化。
可以使店主不失效率的节省大量精力用于其他方面符合当今社会的商业形式而且本软件体积小操作简单是管理仓库的不二选择
二、系统简介:
设计亮点:
◆三级菜单使操作更简便明了
◆密码操作能有效保证客户信息的安全性
◆独特的dos命令调用使信息存储的实体属性为隐藏且无扩展名大大增大了安全系数
◆数据结构为链表摆脱了数据数量的限制
◆提供三种查看模式并会标出排名
◆退出店主模式时会提示是否保存若选择yes着进行保存操作
基本功能:
·在员工模式下可输入卖出货物的名称和数目程序自动在后台进行一系列的操作
·新建数据并同时对其处理
·修改数据
·插入数据
·删除数据
·查找数据
·查看数据
·数据存档
·修改密码
三、系统结构图
#defineLENsizeof(structshop)
#include
#include
#include
#include
structshop
{
charname[30];
floatprice_in;
floatprice_out;
intnum_in;
intnum_now;
intnum_sold;
floatwin;
floatpercent;
structshop*next;
};
intn=0;
voidmain(void)
{
voidauto1(structshop**h_p);
intmenu1(structshop**h_p);
voidprint1(void);
voidassistant(structshop*head);
intpassword(void);
intmenu2(structshop**h_p);
voidprint2(void);
voidcreat(structshop**h_p);
voidrewrite(structshop**h_p);
voidinsert(structshop**h_p);
voiddeleat(structshop**h_p);
voidsearch(structshop**h_p);
voidprintall(structshop**h_p);
voidsave(structshop*head);
voidpassword_set(void);
intpassword_exi(structshop**h_p);
intdata_exi(structshop**h_p);
voidload(structshop**h_p);
voidsave(structshop*head);
structshop*addbuild(structshop**h_p);
voidsort0(structshop**h_p);
intsearch1(structshop**h_p,chara[30]);
voidsort1(structshop**h_p);
voidsort2(structshop**h_p);
voidsort3(structshop**h_p);
voidprint3(void);
voidpassword_create(void);
structshop*addbuild(structshop**h_p);
inta;
structshop*head,**h_p;
head=NULL;
h_p=&head;
auto1(h_p);
do
{
a=menu1(h_p);
}
while(a!
=3);
system("cls");
printf("谢谢使用^_^");
getch();
}
intmenu1(structshop**h_p)
{
inta,b;
structshop*head;
head=*h_p;
print1();
scanf("%d",&a);
putchar('\n');
getchar();
do
{
switch(a)
{
case1:
assistant(head);break;
case2:
if(password())
do
{
b=menu2(h_p);
}
while(b!
=9);
break;
default:
break;
}
if(a!
=3)
{
system("cls");
print1();
scanf("%d",&a);
}
}
while(a!
=3);
return(a);
}
intmenu2(structshop**h_p)
{
intb;
chara;
structshop*head;
head=*h_p;
print2();
scanf("%d",&b);
putchar('\n');
getchar();
do
{
switch(b)
{
case1:
creat(h_p);break;
case2:
rewrite(h_p);break;
case3:
insert(h_p);break;
case4:
deleat(h_p);break;
case5:
search(h_p);break;
case6:
printall(h_p);break;
case7:
head=*h_p;save(head);break;
case8:
password_set();break;
default:
break;
}
if(b!
=9)
{
system("cls");
print2();
scanf("%d",&b);
getchar();
}
}
while(b!
=9);
printf("\n保存吗?
(y/n):
");
putchar('\n');
scanf("%c",&a);
if(a=='y')
{
head=*h_p;
save(head);
}
return(b);
}
voidauto1(structshop**h_p)
{
if(password_exi(h_p)&&data_exi(h_p))
load(h_p);
}
voidprint1(void)
{
system("cls");
printf("********************************************************************************\n");
printf("仓库管理系统\n");
printf("********************************************************************************\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("#*******************菜单*****************#\n");
printf("#|1.员工模式|#\n");
printf("#|2.店主模式|#\n");
printf("#|3.退出|#\n");
printf("#*********************************************#\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("\n请选择(1-3):
");
}
voidassistant(structshop*head)
{
chara[50],c='y';
intb;
structshop*i;
i=head;
while(c=='y')
{
system("cls");
printf("\n请输入卖出的商品名称:
\n");
gets(a);
putchar('\n');
printf("\n请输入卖出的商品数量:
\n");
scanf("%d",&b);
putchar('\n');
while(strcmp(i->name,a)!
=0&&i->next!
=NULL)
i=i->next;
if(i->next!
=NULL)
{
i->num_now-=b;
i->win=(i->num_in-i->num_now)*(i->price_out-i->price_in);
}
else
printf("\n此商品不存在或通知店主更新数据库\n");
printf("\n继续吗?
(y/n):
");
putchar('\n');
c=getchar();
getchar();
}
save(head);
}
intpassword(void)
{
FILE*fp;
chara[50],b[50];
inti;
system("cls");
fp=fopen("c:
\\y_secrea","rb");
fscanf(fp,"%s",&a);
fclose(fp);
printf("请输入密码:
\n");
putchar('\n');
i=0;
do
{
b[i]=getch();
printf("*");
i++;
}
while(b[i-1]!
=13&&i<19);
b[i-1]='\0';
if(strcmp(a,b)==0)
return
(1);
else
return(0);
}
voidprint2(void)
{
system("cls");
printf("********************************************************************************\n");
printf("店主模式\n");
printf("********************************************************************************\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("#*******************菜单*****************#\n");
printf("#|1.新建2.修改|#\n");
printf("#|3.插入4.删除|#\n");
printf("#|5.查找6.查看|#\n");
printf("#|7.保存8.改密|#\n");
printf("#|9.上一层|#\n");
printf("#*********************************************#\n");
printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
printf("请选择(1-9):
");
}
voidcreat(structshop**h_p)
{
structshop*head,*i,*j;
intf=1;
head=NULL;
n=0;
printf("\n请输入数据若完成请在名称处输“0”.\n\n");
i=j=addbuild(&head);
if(strcmp(i->name,"0")==0)
f=0;
while(f)
{
n++;
if(n==1)
head=j;
f=1;
printf("\n请输入下一种货物的数据.\n\n");
i=addbuild(&head);
if(strcmp(i->name,"0")==0)
{
free(i);
f=0;
break;
}
j->next=i;
j=i;
}
j->next=NULL;
*h_p=head;
}
voidrewrite(structshop**h_p)
{
chara[30];
structshop*i,*j,*head;
head=*h_p;
i=head;
do
{
printf("\n请输入要修改货物的名称:
");
putchar('\n');
gets(a);
if(n>=1&&!
search1(h_p,a))
{
printf("\n不存在的货物名称!
\n");
getch();
if(head==NULL)gotoend;
}
}
while(n>=1&&!
search1(h_p,a));
while(strcmp(a,i->name)!
=0&&i->next!
=NULL)
{
i=i->next;
}
if(strcmp(a,i->name)==0)
{
printf("\n真的要修改吗?
?
(y/n):
");
putchar('\n');
if(getchar()=='y')
{
getchar();
j=addbuild(h_p);
strcpy(i->name,j->name);
i->price_in=j->price_in;
i->price_out=j->price_out;
i->num_in=j->num_in;
i->num_now=j->num_now;
i->num_sold=j->num_sold;
i->win=j->win;
i->percent=j->percent;
free(j);
printf("\n修改完成^_^\n\n");
}
}end:
;
}
voidinsert(structshop**h_p)
{
structshop*i,*j,*x,*head;
head=*h_p;
x=addbuild(h_p);
i=j=head;
while(strcmp(i->name,x->name)<0&&i->next!
=NULL)
{
j=i;
i=i->next;
}
if(strcmp(i->name,x->name)>=0)
{
if(i==head)
head=x;
else
j->next=x;
x->next=i;
}
else
{
i->next=x;
x->next=NULL;
}
printf("\n插入完成^_^\n\n.");
*h_p=head;
}
voiddeleat(structshop**h_p)
{
structshop*i,*j,*head;
chara[30],b;
head=*h_p;
do
{
system("cls");
printf("\n请输入你要删除的货物的名称:
\n");
putchar('\n');
gets(a);
if(n>=1&&!
search1(h_p,a))
{
printf("\n不存在的货物名称!
\n");
if(head==NULL)gotoend;
}
}
while(n>=1&&!
search1(h_p,a));
printf("\n真的要删除吗?
(y/n):
");
putchar('\n');
b=getchar();
getchar();
if(b=='y')
{
i=head;
while(strcmp(i->name,a)!
=0&&i->next!
=NULL)
{
j=i;
i=i->next;
}
if(strcmp(i->name,a)==0)
{
if(i==head)
{
head=i->next;
free(i);
}
else
j->next=i->next;
n--;
printf("\n删除完成^_^.\n\n");
*h_p=head;
}
}
end:
;
}
voidsearch(structshop**h_p)
{
intbegin,end,mid,t;
chara[30];
structshop*i,*head;
head=*h_p;
i=head;
printf("\n请输入要查询货物的名称:
");
putchar('\n');
gets(a);
while((strcmp(i->name,a)!
=0)&&i->next!
=NULL)
{
i=i->next;
}
if((strcmp(i->name,a)==0))
{
printf("\n名称\t进价\t售价\t进货数目存货数目销量\t赢利\t利率\n");
printf("\n===============================================================================\n");
printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f",i->name,i->price_in,i->price_out,i->num_in
i->num_now,i->num_sold,i->win,i->percent);
}
else
printf("\n此货物不存在!
\n");
getch();
}
voidprintall(structshop**h_p)
{
inta,c;
charb='y';
structshop*i;
while(b=='y')
{
do
{
system("cls");
print3();
scanf("%d",&a);
}
while(a!
=1&&a!
=2&&a!
=3);
switch(a)
{
case1:
sort1(h_p);break;
case2:
sort2(h_p);break;
case3:
sort3(h_p);break;
default:
break;
}
for(c=1,i=*h_p;i->next!
=NULL;i=i->next,c++)
{
printf("\n名称\t进价\t售价\t进货数目存货数目销量\t赢利\t利率\t排名\n");
printf("\n===============================================================================\n");
printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d",i->name,i->price_in,i->price_out,i->num_in
i->num_now,i->num_sold,i->win,i->percent,c);
if(c%8==0)
{
getch();
getchar();
printf("按任意键继续。
。
。
\n");
}
}
printf("\n名称\t进价\t售价\t进货数目存货数目销量\t赢利\t利率\t排名\n");
printf("\n===============================================================================\n");
printf("%s%10.2f%10.2f%10d%10d%10d%9.2f%10.2f%8d",i->name,i->price_in,i->price_out,i->num_in
i->num_now,i->num_sold,i->win,i->percent,c);
getch();
getchar();
system("cls");
printf("查看其他排列方式?
(y/n):
");
scanf("%c",&b);
putchar('\n');
}
}
voidsave(structshop*head)
{
FILE*fp;
structshop*i;
system("attribc:
\\y_data-h");
system("delc:
\\y_data");
fp=fopen("c:
\\y_data","wb+");
i=head;
for(i=head;i->next!
=NULL;i=i->next)
{
fprintf(fp,"%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,",i->name,i->price_in,i->price_out,i->num_in
i->num_now,i->num_sold,i->win,i->percent);
}
fprintf(fp,"%s%7.2f,%.2f,%d,%d,%d,%.2f,%.2f,",i->name,i->price_in,i->price_out,i->num_in
i->num_now,i->num_sold,i->win,i->percent);
fclose(fp);
system("attribc:
\\y_data+h");
printf("\n^_^已保存\n");
}
voidpassword_set()
{
FILE*fp;
inti,f=0,t=0;
chara[20],b[20];
do
{
if(password())
{
do
{
system("cls");
printf("请输入新密码(3~19位):
\n");
putchar('\n');
i=0;
do
{
a[i]=getch();
printf("*");
i++;
}
while(a[i-1]!
=13&&i<19);
a[i-1]='\0';
printf("\n请确认新密码:
\n");
putchar('\n');
i=0;
do
{
b[i]=getch();
printf("*");
i++;
}
while(b[i-1]!
=13&&i<19);
b[i-1]='\0';
if(strcmp(a,b)==0&&i>2)
{
t=1;
system("attribc:
\\y_secrea-h");
system("delc:
\\y_secrea");
fp=fopen("c:
\\y_secrea","wb+");
fprintf(fp,"%s",a);
fclose(fp);
printf("\n密码修改完成^_^\n");
};
}
while(t==0);
}
else
f++;
if(f==3)
break;
}
while(t==0);
}
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 仓库 管理 系统 语言
![提示](https://static.bdocx.com/images/bang_tan.gif)