仓库物资管理报告Word格式文档下载.docx
《仓库物资管理报告Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《仓库物资管理报告Word格式文档下载.docx(33页珍藏版)》请在冰点文库上搜索。
![仓库物资管理报告Word格式文档下载.docx](https://file1.bingdoc.com/fileroot1/2023-5/1/96d02abd-61bc-4b81-9dca-7b2fd7fd63dc/96d02abd-61bc-4b81-9dca-7b2fd7fd63dc1.gif)
(1)根据电器名称,对库存信息从小到大进行排序(注:
电器名称使用字符串比较函数strcmp比较大小),并输出排序后的电器品牌名称。
(2)根据库存数量,对库存信息进行排序,并按库存量从高到低的顺序输出电器信息。
2.1系统功能模块图printf("
\t====================================================\n"
);
printf("
\t========仓库物资管理系统========\n"
\t========1、创建库存记录文件========\n"
\t========2、物资入库管理========\n"
\t========3、物资出库管理========\n"
\t========4、查询物资信息========\n"
\t========5、统计物资信息========\n"
\t========6、排序物资信息========\n"
\t========请选择功能(1-6)========\n"
2.2数据结构设计
对全局变量,结构体类型等进行定义和说明
#include<
stdio.h>
#include<
string.h>
structgoods
{
charname[N];
charbrand[N];
intnumber;
};
//*******************库存商品
structdate
intyear;
intmonth;
intday;
//******************日期
structin_goods
charbrand[N];
intin_num;
floatin_money;
structdatein_day;
//结构体的镶套定义
charin_peo_name[N];
//*****************入库商品
structout_goods
intout_num;
floatout_money;
structdateout_day;
charout_peo_name[N];
};
//*******************出库商品3.系统详细设计
#defineN10
#defineLEN20
charname[N];
intnumber;
intyear;
intmonth;
intday;
intin_num;
floatin_money;
structdatein_day;
charin_peo_name[N];
intout_num;
floatout_money;
structdateout_day;
//*******************出库商品
voidBuild();
//创建库存文件
voidIn_control();
//创建入库文件
voidOut_control();
//创建出库文件
voidSelect_Message();
//查询信息
voidStatistic_Message();
//排序信息
voidSort_Name();
//以电器名称排序
voidSort_Num();
//以电器存量排序
voidSort_Message();
//统计信息
voidStatistic_Name_Num();
//以电器名称统计
voidStatistic_Brand_Num();
//以品牌名称统计
voidStatistic_All_Money();
//统计总价格
voidStatistic_Profit();
//统计总收益
voidSelet_Name();
//以电器名称查询
voidSelet_Brand();
//以品牌名称查询
voidSelet_Out_Peo_Name();
//以提货人查询
voidSelet_in_Peo_Name();
//以送货人查询
//========================================================
voidmain()//******目录入口***********在主函数中建立主菜单
inti=0;
charch='
y'
;
do
{
\t============================================\n"
\t========1、创建库存记录文件========\n"
\t=============================================\n"
scanf("
%d"
&
i);
switch(i)
case1:
Build();
break;
case2:
In_control();
case3:
Out_control();
case4:
Select_Message();
case5:
Statistic_Message();
case6:
Sort_Message();
}
printf("
\t是否继续操作(Y/N)?
\n"
//getchar();
ch=getchar();
}while(ch=='
Y'
||ch=='
//判断为真时执行循环体
}
//==================创建库存文件=====================
voidBuild()
FILE*fp;
intsize=0,i=0;
if((fp=fopen("
库存记录.txt"
"
w"
))==NULL)
printf("
不能打开此记录,请核实\n"
return;
\t请输入本次输入的库存记录条数(单次输入最大为20条)\n"
size);
structgoodsg[LEN];
\t请逐条输入电器的基本信息\n"
for(i=0;
i<
size;
i++)
\t电器名称品牌名称库存数量\n"
scanf("
%s%s%d"
g[i].name,&
g[i].brand,&
g[i].number);
fwrite(&
g[i],sizeof(structgoods),1,fp);
fclose(fp);
getchar();
//===================创建入库文件====================
voidIn_control()
FILE*fp1,*fp2;
intsize=0;
inti,j;
structgoodstemp={"
\0"
0"
0};
chara[1]={'
\0'
if((fp1=fopen("
入库记录.txt"
a+"
))==NULL)
\t请输入本次输入的入库记录条数(单次输入最大为20条)\n"
structin_goodsig[LEN];
\t电器名称品牌名称入库数量单价日期(年/月/日)送货人姓名\n"
%s%s%d%f%d%d%d%s"
ig[i].name,&
ig[i].brand,&
ig[i].in_num,&
ig[i].in_money,&
ig[i].in_day.year,&
ig[i].in_day.month,&
ig[i].in_day.day,&
ig[i].in_peo_name);
fwrite(&
ig[i],sizeof(structin_goods),1,fp1);
if((fp2=fopen("
r+"
structgoodsg[LEN]={'
for(i=0;
LEN;
fread(&
g[i],sizeof(structgoods),1,fp2);
for(j=0;
j<
j++)
{
if(strcmp(g[i].name,ig[j].name)==0&
&
strcmp(g[i].brand,ig[j].brand)==0)
g[i].number=g[i].number+ig[j].in_num;
}
}//修改库存信息
rewind(fp2);
if(strcmp(g[i].name,a)!
=0)
//将g中的一个数据写入文件
}//更新库存文件
fclose(fp1);
fclose(fp2);
//=====================创建出库文件=======================
voidOut_control()
inti,j=0;
structout_goodsog[LEN];
出库记录.txt"
\t请输入本次输入的出库记录条数(单次输入最大为20条)\n"
\t电器名称品牌名称出库数量单价日期(年/月/日)提货人姓名\n"
og[i].name,&
og[i].brand,&
og[i].out_num,&
og[i].out_money,&
og[i].out_day.year,&
og[i].out_day.month,&
og[i].out_day.day,&
og[i].out_peo_name);
j=0;
while(!
feof(fp2))
fread(&
g[j],sizeof(structgoods),1,fp2);
if(strcmp(g[j].name,og[i].name)==0&
strcmp(g[j].brand,og[i].brand)==0)
{
if(og[i].out_num>
g[j].number)
{
printf("
出库数量大于库存数量,请核实后重新输入\n"
scanf("
g[j].number=g[j].number-og[i].out_num;
}//越界判定(重新输入正确的信息)
else
}
elseif(strcmp(g[j].name,og[i].name)!
=0&
strcmp(g[j].brand,og[i].brand)!
printf("
该货物不存在,请核实\n"
g[j].number=g[j].number-og[i].out_num;
j++;
if(j>
i)
break;
rewind(fp2);
//将文件位置重新指向文件开头
rewind(fp1);
j;
i++)//更新库存记录
i++)//更新出库文件记录
og[i],sizeof(structout_goods),1,fp1);
//==================查询信息目录=====================
voidSelect_Message()
\t请选择查询方式\n"
\t1、输入电器名称,在库存记录文件中查找相应的物资信息并输出\n"
\t2、输入品牌名称,在库存记录文件中查找该品牌的所有电器信息并输出\n"
\t3、输入提货人姓名,输出该提货人对应的出库记录\n"
\t4、输入送货人姓名,输出该送货人对应的入库记录\n"
Selet_Name();
Selet_Brand();
Selet_Out_Peo_Name();
Selet_in_Peo_Name();
是否选择其他查询方式继续查询?
ch=getchar();
//======================以电器名称查询=====================
voidSelet_Name()
//建立库存数组
chartname[N];
r"
do
\t请输入要查询的电器名称\n"
%s"
tname);
getchar();
feof(fp))//当源文件未结束时进行循环
if(strcmp(tname,g[i].name)==0)
电器名称:
%s\n品牌名称:
%s\n库存数量:
%d\n"
g[i].name,g[i].brand,g[i].number);
i++;
\t是否继续查询?
(Y/N)\n"
rewind(fp);
//================以品牌名称查询=======================
voidSelet_Brand()
chartbrand[N];
\t请输入要查询的品牌名称\n"
tbrand);
\t%s的电器有:
feof(fp))
if(strcmp(tbrand,g[i].brand)==0)
\t电器名称:
g[i].name,g[i].number);
//====================以提货人姓名查询=====================
voidSelet_Out_Peo_Name()
chartiname[N];
\t不能打开此记录,请核实\n"
\t请输