超市商品管理系统源代码

合集下载

(完整word版)c语言程序设计超市管理系统

(完整word版)c语言程序设计超市管理系统

实验题目:超市管理系统一、实验目的1.熟悉 c 语言的编译连接和运行过程。

2.掌握 c 语言的数据类型,熟悉整型、实型、字符型变量的定义方式及如何给它们赋值。

3.掌握if 语句及switch 语句的运用方法及嵌套应用方法。

4.掌握实现循环结构的三种语句while 、do-while. 、for 的使用。

5.掌握函数的定义方法和调用方法。

6.能够采用模块化思想调试程序。

二.实验内容1.编写程序并进行调试运行。

2.输入商品资料,并保存于文件。

每件商品包含信息如:商品号、商品名、商品类别、商品总量、商品上限和下限、商品价格、进货日期、生产日期、保质期等。

3.对已存入的商品信息进行更新操作,包括添加一件商品信息、删除某件商品信息和修改商品信息。

4.通过按商品名、商品种类、商品进货量的方式查询商品信息。

5.输入某商品号后对其利润进行统计、对进货价格相同的商品进行统计。

6 对商品的库存量和利润进行排序。

7.最后输出商品信息,供需要时打印。

二、需求分析1.该程序可用于对商品的基本信息的存储、更新、查询、输出、统计、排序等操作,以实现管理者对商品的管理和消费者对商品的了解。

2.其中更新功能包括:添加信息、删除信息、修改信息、可根据需要添加一个或多件商品信息,也可对个别商品信息进行适当的删除或修改。

以便随时更新商品信息。

3.程序中设计的查询功能可根据需要从若干数据中查询某件商品信息,并且可根据三种不同的方法查询:按商品名查询、按商品种类查询和按商品进货量查询。

以满足不同的需要。

四、概要设计1、方案设计对系统进行分析,给出结构图分析:系统要求实现许多的功能,因此遵循结构化程序设计思想来进行本系统的设计—自顶向下、逐步细化,将系统设计任务分解出许多子功能模块进行设计结构图如下:超市管理管理系统查询模块排序模块退出系统退出系统查询模块排序模块统计模块*更新模块*输出信息¥录入信息按商品名查询利润排行库存量排行退出系统第二类商品第一类商品退出系统2 •功能模块说明:对各个模块进行功能的描述(1).输入模块:录入需要管理的商品信息并将信息保存于文件中,以方便日后进行打印、读取、更新等操作。

超市管理系统(参考案例)

超市管理系统(参考案例)

软件工程课程设计题目:超市前台POS销售系统及后台管理系统专业:班级:学号:姓名:指导老师:目录:一、问题定义 (3)1.系统开发目的 (3)2.背景说明 (3)3.项目确立 (3)4.应用范围 (3)5.名词定义 (3)二、可行性研究 (4)1.管理可行性分析 (4)2.经济可行性分析 (4)3.技术可行性分析 (4)4. 系统初步ER图 (5)5.可行性研究结论 (5)三、需求分析 (5)1. 用户需求分析 (5)2. 系统功能分析 (6)3. 系统结构 (7)4. 流程图 (7)5. 系统ER图 (9)四、设计 (1)1.系统模型: (1)2.模块子系统结构: (3)五、测试 (5)1. 测试过程分析: (5)2 .测试方案: (6)4. 测试结果 (9)5. 评估和建议 (9)六、实现 (10)七、维护 (10)八、总结 (10)一、问题定义1.系统开发目的1.大大提高超市的运作效率;2.通过全面的信息采集和处理,辅助提高超市的决策水平;3.使用本系统,可以迅速提升超市的管理水平,为降低经营成本,提高效益,增强超市扩张力,提供有效的技术保障。

2.背景说明21世纪,超市的竞争也进入到了一个全新的领域,竞争已不再是规模的竞争,而是技术的竞争、管理的竞争、人才的竞争。

技术的提升和管理的升级是超市业的竞争核心。

零售领域目前呈多元发展趋势,多种业态:超市、仓储店、便利店、特许加盟店、专卖店、货仓等相互并存。

如何在激烈的竞争中扩大销售额、降低经营成本、扩大经营规模,成为超市营业者努力追求的目标。

3.项目确立针对超市的特点,为了帮助超市解决现在面临的问题,提高小型超市的竞争力,我们将开发以下系统:前台POS销售系统、后台管理系统,其中这两个子系统又包含其它一些子功能。

4.应用范围本系统适应于各种超市。

5.名词定义①商品条形码:每种商品具有唯一的条形码,对于某些价格一样的商品,可以使用自定义条形码。

②交易清单:包括交易的流水账号、每类商品的商品名、数量、该类商品的总金额、交易的时间、负责本次收银的员工号。

超市管理系统完整+源代码

超市管理系统完整+源代码

有一个小型超市,出售N(N>=10)种商品,设计并实现一个系统,完成下列功能:1.保存及输出。

超市中的各种商品信息保存在指定文件中,可以把它们输出显示。

2.计算并排序。

计算每类商品的总价值(sum,单精度)及平均价(aver,单精度,输出一位小数),将每类商品按平均价从大到小的顺序排序打印出来。

3.统计。

统计输出库存量低于100的货号及类别。

统计输出有两种以上(含两种)商品库存量低于100的商品类别。

1.2总体结构本程序主要分为八个模块:主模块、信息输出修改模块、新建信息模块、排序模块、计算模块、统计模块1、统计模块2、打印模块。

1)主模块:通过调用各分模块实现功能;2)信息输出修改模块:输出显示文件中商品信息内容,添加商品信息,删除商品信息,修改商品信息;3)新建商品信息模块:建立一个新结构体,为链表存信息用,并且将信息保存在指定的文件中;4)排序模块:把文件中顺序零乱的商品信息按单价的大小从高到低进行排序,放到链表里存储;5)计算模块:将所有商品的价格与库存量进行累加求和;6)打印模块:将商品信息按每类平均价格排序(从高到低)按顺序打印出来;7)统计模块1:统计库存量低于100的货名及类别;8)统计模块2:统计商品库存量有2种以上(含2种)低于100的商品类别。

附录(程序清单)#include "stdio.h" /*输入,输出头文件*/#include "stdlib.h" /*申请空间头文件*/#include "string.h" /*对字符串加工头文件*/#include "conio.h" /*清屏头文件*/FILE *fp;int n=0; /*定义文件指针类型*/int i,j,a[4],m; /*定义整数类型*/float aver[4],sum[4],g[4],h; /*定义浮点类型*/char c[5]="elec"; /*定义字符数组类型*/char d[5]="comm"; /*定义字符数组类型*/char e[5]="food"; /*定义字符数组类型*/char f[5]="offi"; /*定义字符数组类型*/struct good /*定义结构体*/{int num; /*商品编号*/char name[20]; /*商品名称*/char kind[40]; /*商品类型*/float price; /*商品价格*/char unit[10]; /*商品单位*/int quantity; /*商品数量*/struct good *next; /*定义结构体指针类型*/}*head,*p1,*p2;struct good *createlist() /*创建链表函数*/ {struct good *head1,*p1,*p2; /*定义结构体指针类型*/if((fp=fopen("goods message.txt","w"))==NULL) /*判断能否打开文件*/ {printf("can not open the file");exit(0); /*结束程序*/}head1=(struct good *)malloc(sizeof(struct good)); /*申请头结点空间*/ p1=head1;p2=head1;printf("*********************************************\n");printf("请输入信息:编号,名称,类型,价格,单位,数目\n");printf(" (以输入“-1”表示结束输入)\n");printf("*********************************************\n");printf("____________________\n");scanf("%d %s %s %f %s %d",&p1->num,p1->name,p1->kind,&p1->price,p1-> unit,&p1->quantity); /*输入商品信息*/printf("____________________\n");p1->next=NULL;fprintf(fp,"%d %s %s %f %s %d",p1->num,p1->name,p1->kind,p1->price,p1->unit,p1->quantity);/*将商品信息写入文件*/while(1){p1=(struct good *)malloc(sizeof(struct good)); /*申请新空间*/ printf("*********************************************\n");printf("请输入信息:编号,名称,类型,价格,单位,数目\n");printf(" (以输入“-1”表示结束输入)\n");printf("*********************************************\n");printf("____________________\n");scanf("%d",&p1->num);if(p1->num==-1) /*申请空间结束条件*/{printf("____________________\n\n");fprintf(fp,"%d",-1);fclose(fp);return head1; /*返回头指针*/}scanf("%s %s %f %s %d",p1->name,p1->kind,&p1->price,p1->unit,&p1->quan tity); /*输入商品信息*/printf("________________\n");fprintf(fp,"%d %s %s %f %s %d",p1->num,p1->name,p1->kind,p1->price,p1->unit,p1->quantity);/*将商品信息写入文件*/p1->next=NULL;p2->next=p1;p2=p1;}}struct good *paixu(struct good*head2) /*链表排序函数*/{struct good *p6,*p7,*r,*s; /*定义结构体指针类型*/for(i=0;i<=3;i++) /*赋初值值*/{a[i]=0;sum[i]=0;aver[i]=0;}p6=(struct good *)malloc(sizeof(struct good)); /*申请新空间*/ p6->next=head2;head2=p6;while(p6->next!=NULL) /*判断循环结束条件*/{p7=p6->next;r=p6;while(p7->next!=NULL) /*判断循环结束条件*/{if((p7->next->price)>(r->next->price)) /*判断是否调换*/r=p7;p7=p7->next;}if(p6!=r) /*判断循环结束条件*/{s=r->next; /*指针调换*/r->next=s->next;s->next=p6->next;p6->next=s;}p6=p6->next;}p6=head2;head2=head2->next;free(p6); /*释放第一个无效空间*/return head2;}void jisuan(){p1=head;do{if(strcmp(p1->kind,c)==0) /*判断是否为电器类型*/{sum[0]=sum[0]+(p1->price)*(p1->quantity); /*求电器总价*/a[0]=a[0]+p1->quantity; /*求电器总件数*/}if(strcmp(p1->kind,d)==0) /*判断是否为日用品类型*/{sum[1]=sum[1]+(p1->price)*(p1->quantity); /*求日用品总价*/ a[1]=a[1]+p1->quantity; /*求日用品总件数*/}if(strcmp(p1->kind,e)==0) /*判断是否为办公用品类型*/{sum[2]=sum[2]+(p1->price)*(p1->quantity); /*求办公用品总价*/ a[2]=a[2]+p1->quantity; /*求办公用品总件数*/}if(strcmp(p1->kind,f)==0) /*判断是否为食品类型*/{sum[3]=sum[3]+(p1->price)*(p1->quantity); /*求食品总价*/a[3]=a[3]+p1->quantity; /*求食品总件数*/}p1=p1->next;}while (p1!=NULL); /*遍历链表结束条件*/for(i=0;i<4;i++)aver[i]=sum[i]/a[i]; /*求每类商品平均价*/printf("****************************************************\n");printf("商品类型\t 平均价\t 总库存量\n");printf("****************************************************\n");printf("____________________________________________________\n");printf("电器总价值:%0.1f\t平均价:%0.1f\t总库存量:%d\n",sum[0],aver[0],a[0]); printf("____________________________________________________\n");printf("日用品总价值:%0.1f\t平均价:%0.1f\t总库存量:%d\n",sum[1],aver[1],a[1]);printf("____________________________________________________\n"); printf("食品总价值:%0.1f\t平均价:%0.1f\t总库存量:%d\n",sum[2],aver[2],a[2]); printf("____________________________________________________\n");printf("办公用品总价值:%0.1f\t平均价:%0.1f\t总库存量:%d\n",sum[3],aver[3],a[3]);printf("____________________________________________________\n"); }void shuchu() /*输出商品信息函数*/{do{struct good *p3,*p4,*p5; /*定义结构体指针类型*/int n=0,p=0,q=0,r=0;printf("所有商品信息:\n");printf("编号,名称,类型,价格,单位,数目\n");printf("**********************************\n");if((fp=fopen("goods message.txt","rb+"))==NULL) /*判断能否打开文件*/{printf("can not open the file");exit(0); /*结束程序*/}head=(struct good *)malloc(sizeof(struct good)); /*申请头结点空间*/p3=head;fscanf(fp,"%d %s %s %f %s %d",&p3->num,p3->name,p3->kind,&p3->price,p3->unit,&p3->quantity);/*从文件中写到链表*/while(1){p4=(struct good *)malloc(sizeof(struct good)); /*申请头结点空间*/fscanf(fp,"%d ",&p4->num);if(p4->num!=-1) /*判断循环结束条件*/{fscanf(fp,"%s %s %f %s %d",p4->name,p4->kind,&p4->price,p4->unit,&p4->quantity); /*从文件中写到链表*/p4->next=NULL;p3->next=p4;p3=p4;}else{p3->next=NULL;break;}}fclose(fp); /*关闭文件*/p3=head;while(p3!=NULL){printf(" %d %s %s %0.1f %s %d\n\n",p3->num,p3->name,p3->kind,p3->price,p3->unit,p3->quantity);printf("__________________________________\n");p3=p3->next;}printf("**********************************\n");printf("//////////////////////////////////\n");while(n!=4){p3=head;printf("**********************************\n");printf("1 添加商品信息\n");printf("2 删除某商品信息\n");printf("3 修改某商品信息\n");printf("4 返回(当你完成了对某一商品的添加、删除或者修改后请按4返回)\n");printf("**********************************\n");scanf("%d",&n);if(n==1) /*添加商品信息*/{printf("请输入商品编号名称类型价格单位数目\n");printf("**********************************\n");p4=(struct good *)malloc(sizeof(struct good)); /*申请空间*/scanf("%d %s %s %f %s %d",&p4->num,p4->name,p4->kind,&p4->price,p4-> unit,&p4->quantity); /*输入商品信息*/p4->next=NULL;while(p3->next!=NULL) /*判断循环结束条件*/{p3=p3->next;}p3->next=p4;p3=head;if((fp=fopen("goods message.txt","w"))==NULL) /*判断能否打开文件*/{printf("can not open the file");exit(0); /*结束程序*/}while(p3!=NULL){fprintf(fp,"%d %s %s %f %s %d",p3->num,p3->name,p3->kind,p3->price,p3->unit,p3->quantity)/*将商品信息写入文件*/p3=p3->next;}fprintf(fp,"%d",-1);fclose(fp); /*关闭文件*/printf("**********************************\n");printf("__________________________________\n");printf("------------请按4返回-------------\n");printf("__________________________________\n");printf("**********************************\n");}if(n==2) /*删除商品*/{printf("**********************************\n");printf("请输入需要删除的商品编号\n");printf("**********************************\n");scanf("%d",&p);printf("**********\n");printf("1 确认删除\n2 取消删除\n");printf("**********\n");scanf("%d",&r);if(r==1){if((head->num)==p){head=head->next;free(p3); /*释放空间*/}else{p4=head;p3=p4->next;while(p3!=NULL) /*判断循环结束条件*/{if((p3->num)==p){p5=p3->next;free(p3); /*释放空间*/p4->next=p5;break;}p3=p3->next;p4=p4->next;}}if((fp=fopen("goods message.txt","w"))==NULL) /*判断能否打开文件*/{printf("can not open the file");exit(0); /*结束程序*/}p3=head;while(p3!=NULL) /*判断循环结束条件*/{fprintf(fp,"%d %s %s %f %s %d",p3->num,p3->name,p3->kind,p3->price,p3->unit,p3->quantity); /*将商品信息写入文件*/p3=p3->next;}fprintf(fp,"%d",-1);fclose(fp); /*关闭文件*/}if(r==2)continue; /*继续循环*/printf("**********************************\n");printf("__________________________________\n");printf("------------请按4返回-------------\n");printf("__________________________________\n");printf("**********************************\n");}if(n==3) /*修改某商品信息*/{printf("请输入需要修改的商品编号\n");scanf("%d",&q);while(p3!=NULL) /*判断循环结束条件*/{if((p3->num)==q) /*判断是否为所需要修改的商品*/{printf("请输入商品单价与库存量(如果单价不变请输入原来的单价)\n");scanf("%f %d",&p3->price,&p3->quantity); /*输入商品价格与库存量*/}p3=p3->next;}if((fp=fopen("goods message.txt","w"))==NULL) /*判断能否打开文件*/{printf("can not open the file");exit(0); /*结束程序*/}p3=head;while(p3!=NULL) /*判断循环结束条件*/{fprintf(fp,"%d %s %s %f %s %d",p3->num,p3->name,p3->kind,p3->price,p3->unit,p3->quantity);/*将商品信息写入文件*/p3=p3->next;}fprintf(fp,"%d",-1);fclose(fp); /*关闭文件*/printf("**********************************\n");printf("__________________________________\n");printf("------------请按4返回-------------\n");printf("__________________________________\n");printf("**********************************\n");}if(n==4) /*退出*/break;}printf("**********\n");printf("1 继续修改\n---------\n2 返回\n");printf("**********\n");scanf("%d",&p);if(p==1)continue; /*继续循环*/if(p==2)break; /*跳出循环*/}while(n!=2);fclose(fp); /*关闭文件*/}void printf0(struct good *p) /*遍历链表并打印电器类商品函数*/{struct good *p3; /*定义结构体指针类型*/p3=p;while (p3!=NULL) /*判断遍历链表循环结束条件*/{if(strcmp(p3->kind,c)==0) /*判断商品类型是否为电器类型*/{printf("%d\t%s\t%s\t%0.1f\t%s\t%d\n",p3->num,p3->name,p3->kind,p3->price, p3->unit,p3->quantity); /*输出电器类商品信息*/ printf("________________________________________________\n");}p3=p3->next;}return;void printf1(struct good *p) /*遍历链表并打印日用品类商品函数*/{struct good *p3; /*定义结构体指针类型*/p3=p;while (p3!=NULL) /*判断遍历链表循环结束条件*/{if(strcmp(p3->kind,d)==0) /*判断商品类型是否为日用品类型*/{printf("%d\t%s\t%s\t%0.1f\t%s\t%d\n",p3->num,p3->name,p3->kind,p3->price, p3->unit,p3->quantity); /*输出日用品类商品信息*/ printf("________________________________________________\n");}p3=p3->next;}return;}void printf2(struct good *p) /*遍历链表并打印办公用品类商品函数*/{struct good *p3; /*定义结构体指针类型*/p3=p;while (p3!=NULL) /*判断遍历链表循环结束条件*/{if(strcmp(p3->kind,e)==0) /*判断商品类型是否为办公用品类型*/{printf("%d\t%s\t%s\t%0.1f\t%s\t%d\n",p3->num,p3->name,p3->kind,p3->price, p3->unit,p3->quantity); /*输出办公用品类商品信息*/ printf("________________________________________________\n");}p3=p3->next;}return;}void printf3(struct good *p) /*遍历链表并打印食品类商品函数*/{struct good *p3; /*定义结构体指针类型*/p3=p;while (p3!=NULL) /*判断遍历链表循环结束条件*/{if(strcmp(p3->kind,f)==0) /*判断商品类型是否为食品类型*/{printf("%d\t%s\t%s\t%0.1f\t%s\t%d\n",p3->num,p3->name,p3->kind,p3->price, p3->unit,p3->quantity); /*输出食品类商品信息*/ printf("________________________________________________\n");}p3=p3->next;}return;}void shunxudayin(){for(i=0;i<4;i++)g[i]=aver[i]; /*将平均价赋给新数组*/for(j=0;j<3;j++) /*将新数组用冒泡排序法排序*/for(i=j+1;i<4;i++){if(g[j]<g[i]){h=g[j];g[j]=g[i];g[i]=h;}}printf("\n****************************\n");printf("商品平均价格排序表(从高到低)\n");printf("****************************\n");printf("________________________________________________\n"); printf("编号\t名称\t类别\t单价\t单位\t数量\n");printf("________________________________________________\n"); for(j=0;j<4;j++)for(i=0;i<4;i++){if (aver[i]==g[j]) /*判断每类商品平均价格的先后顺序*/switch(i){case 0:printf0(head); /*调用遍历链表并打印电器类商品函数*/break;case 1:printf1(head); /*调用遍历链表并打印日用品类商品函数*/break;case 2:printf2(head);/*调用遍历链表并打印办公用品类商品函数*/break;case 3:printf3(head); /*调用遍历链表并打印食品类商品函数*/break;}}}void tongji1(){p1=head;printf("\n************************\n");printf("库存量低于100的货名及类别\n");printf("************************\n");printf("________________________\n");printf("商品名称\t商品类型\n");printf("________________________\n");while(p1!=NULL) /*判断遍历链表循环结束条件*/{if(p1->quantity<100) /*判断库存量是否小于100*/{printf("%s\t%s\n",p1->name,p1->kind); /*输出商品名称及类别*/ printf("________________________\n");}p1=p1->next;}}void tongji2(){printf("\n**********************************************\n");printf("商品库存量有2种以上(含2种)低于100的商品类别:\n");printf("**********************************************\n");printf("________\n");if((a[0]<100)&&(a[0]>=2)) /*判断电器类库存量是否为2种以上(含2种)低于100*/{printf("电器\n");printf("________\n");}if((a[1]<100)&&(a[1]>=2)) /*判断日用品类库存量是否为2种以上(含2种)低于100*/{printf("日用品\n");printf("________\n");}if((a[2]<100)&&(a[2]>=2)) /*判断食品类库存量是否为2种以上(含2种)低于100*/{printf("食品\n");printf("________\n");}if((a[3]<100)&&(a[3]>=2)) /*判断办公用品类库存量是否为2种以上(含2种)低于100*/{printf("办公用品\n");printf("________\n");}}int main(int argc, char* argv[]){struct good *p1,*p2; /*定义结构体指针类型*/while(1){printf("***********************************************\n");printf("1 ----------输出查看或者修改已存信息-----------\n");printf("-----------------------------------------------\n");printf("2 -----重新输入新信息(并且删除原有信息)------\n"); printf("-----------------------------------------------\n");printf("3 统计商品信息(如果您还没有查看过信息请先按1)\n"); printf("-----------------------------------------------\n");printf("4 -------------------退出---------------------\n");printf("***********************************************\n");scanf("%d",&m);if(m==1)shuchu(); /*调用输出信息函数*/if(m==2){system("cls");head=createlist(); /*调用建立链表函数*/}if(m==3){printf("统计结果如下\n");head=paixu(head); /*调用链表排序函数*/ jisuan(); /*调用计算函数*/shunxudayin(); /*调用顺序打印函数*/tongji1(); /*调用统计1函数*/tongji2(); /*调用统计2函数*/}if(m==4){p1=head;while(p1!=NULL) /*判断遍历链表结束条件*/ {p2=p1->next;free(p1); /*释放空间*/p1=p2;}break;}}return 0; /*结束程序*/}。

第4章 商品代码

第4章 商品代码

(3)混合型代码
• 。混合型代码又称数字、字母混合型代码,是由 数字和字母混合组成的代码。它兼有数字型编码 和字母型编码的优点,结构严密,具有良好的直 观性和表达性,同时又有使用上的习惯。但编码 组成形式复杂,给计算机输入带来一定的不变。 字母常用于表示商品的产地、性质等特征,可放 在数字前边或后边,用于辅助数字代码。如 “H1226”代表浙江产的杭罗;“C8112”表示涤粘 中长纤维色布。因此在商品分类编码中常使用这 种编码。
层次编码法
X X X X


第七、八位数字为第四层级 (代表品种或组类) 第三层级(小类) -第五、六位数字 第二层级(中类)第三、四位数字 第一层级(大类)第一、二位数字


• • • • •
代码 A 门 01 01 10 01 第一层,农业产品 第二层,粮食作物 第三层,小麦 第四层,冬小麦
.2 商品编码的原则
1 2
3 4 5 6 7
唯一性 可扩性 简明、易记、易检验, 简明性 既便于手工,又便于计算机处理 稳定性 层次性 统一协调性 自检
.2 商品编码的原则
1 2
3 4 5 6 7
唯一性 可扩性 简明性 稳定性 层次性 统一协调性 自检
1.2.2 商品编码的原则
1 2
3 4 5 6 7
唯一性 可扩性 简明性 能清晰反映商品分类体系和 稳定性 分类目录内部固有的逻辑关 系 层次性 统一协调性 自检
1.2.2 商品编码的原则
1 2
3 4 5 6 7
唯一性 可扩性 简明性 稳定性 层次性 统一协调性 自检 以便实现信息交流和信息共享
1.2.2 商品编ห้องสมุดไป่ตู้的原则
1 2

超市各种商品代码的认识

超市各种商品代码的认识
(3)畐U食类:调味料、粮油、常温制品、低温制品、速冻类、农
副产品
调味料:佐料、酱油、醋、其他调料
粮油:袋装米面、散装米面、精品油、散油、方便面挂面、豆类 制品、其他粮油类
常温制品:常温肉制品、酱菜、罐头、其他常温制品 低温制品:低温肉制品、其他低温制品 速冻类:汤圆、水饺、丸子、冰糕、海产品、其他速冻食品 农副产品:禽蛋类、生鲜肉、蔬菜、水果、干货、其他农副产品
1、基本设备:货架(种类)、促销平台、立风柜、岛柜、空调、电源
2、辅助设备:电子秤、打价枪 理货员岗位职责及每日工作流程
1、理货员岗位职责
1、了解并掌握本区的商品名称、用途、价格、生产日期、保质期等基本信息 资料;
2、及时整理、补充商品,保证货架及货堆的丰满,管辖区域商品无缺物价签 现象;
3、每日按规定的时间打好续货单,及时补充货源;
帽类 床上用品:被褥、垫盖、其他床上用品 箱包类:皮包类、其他箱包类 针织类:毛巾、台布、其他针织品
(4)文体区:文化用品、体育用品、玩具 文化用品:纸制品、办公用品、书籍、音像制品、其他文化用品 体育用品:球类、健身类、保护类、其他体育用品类 玩具:电动玩具、智力玩具、毛绒玩具、其他玩具
3、联营商品(无库存,不参加盘点) 卖场内设备常识
(7)主管安排的其他事情
12:00——12:30
(1)货架整理,将商品摆放整齐,有不足的进行补充
(2)将购物车篮摆放在固定位置
12:30——12:40交班
(1)告诉下一班当日上午的到货情况
(2)当日上午未完成工作需下一班人员继续的内容
(3)需要续货的商品情况
12:40点名,下班
(二)午班
12:30以前
X8〜X6代表国家代码,X5〜X2代表商品项目代码,X1为校验码

MCC码查询大全

MCC码查询大全
8398
慈善和社会服务
0
需能够提供《事业单位法人证书》,其中经费来源为“自收自支”的不得纳入公益类商户
县乡优惠
9703
县乡优惠—宾馆餐饮娱乐类
上海地区暂不使用
9704
县乡优惠—房产汽车类
上海地区暂不使用
元封顶
9705
县乡优惠—批发类
上海地区暂不使用
9元封顶
9706
县乡优惠—超市加油类
上海地区暂不使用
5950
玻璃器皿和水晶饰品店
5970
工艺美术商店
5971
艺术商和画廊
7012
分时使用的别墅或度假用房
7011
住宿服务
宾馆酒店餐饮部分可再独立申请(%)
7032
运动和娱乐露营地
7631
手表、钟表和首饰维修店
7033
活动房车及露营场所
7829
电影和录像创作发行
7911
歌舞厅、KTV
7922
戏剧制片(不含电影)、演出和票务
原手续费率2013年2月25日停用。
便民类
5994
报亭、报摊
原手续费率0%,2013年2月25日停用。
7523
停车场及车库
原手续费率0%,2013年2月25日停用。
9402
国家邮政服务
原手续费率0%,2013年2月25日停用。
公益类
公立医院、公立学校、慈善
8062
公立医院
0
需能够提供《事业单位法人证书》且经费来源为“财政补助”、“财政拨付”等类似财政补助的描述
5968
订阅/订购直销服务
5969
其他直销商户
5972
邮票和纪念币商店

基于JAVA超市账单管理系统毕业设计(含源文件)

基于JAVA超市账单管理系统毕业设计(含源文件)

毕业设计说明书题目:超市账单管理系统超市账单管理系统摘要:随着科学技术的不断发展,计算机越来越普及,随之各种软件也相应而出。

许许多多的企业也用上了相应的软件,来加快自身的发展。

由于超市行业的不断壮大,也需要一套软件来相应的软件来管理。

在这种情况下超市账单管理系统也应运而生。

超市账单管理系统主要是对超市账单、供应商、用户的简单管理。

本系统主要用java语言进行开发,mysql数据库和Eclipse开发工具;主要用的核心技术是Servlet,用来处理用户的请求和页面之间的跳转,JDBC(Java Data Base Connectivity)连接数据库实现处理与数据库的交互。

主要用的美工技术是div+css,javaScript处理页面显示效果。

本系统能更快,更方便的管理好整个工作流程中的各个模块,使工作效率达到最优化。

关键词:java;Servlet;div+css;javaScript;mysql;超市账单管理系统;Title:Supermarket Bill Management SystemAbstract: Along with the science and technology unceasing development, the computer more and more popular, with a variety of software is out. Many companies also use the corresponding software, to accelerate the development of oneself. As a result of Supermarket has grown, also need a set of software to the software to management. In this case the supermarket bill management system also emerge as the times require. Supermarket bill management system is mainly the easy management of supermarket bills, suppliers, users. This system is mainly the use of Java language development, database mysql and Eclipse development tools; the main core technology is Servlet, It used to handle user requests and jump between pages. JDBC(Java Data Base Connectivity)used to handle the interaction with the database .Mainly using artist technical is div+css,javaScript, handling page display effect. This system can be faster, more convenient management of the whole working process of each module, so that the work efficiency is optimized.Keywords: java ,Servlet,div+css,javaScript,mysql,Supermarket bill management system目录摘要 (I)Abstract (II)1 正文 (1)1.1研究背景分析 (1)1.2 超市账单管理系统的概述 (2)1.3所需软、硬件技术准备 (2)1.4可行性分析 (3)1.4.1 技术可行性 (3)1.4.2 经济可行性 (3)1.4.3 社会可行性 (3)2 需求分析 (4)2.1 需求分析的任务及主要内容 (4)2.2.1 具体业务的需求 (4)2.2 层次图 (4)2.3数据流图 (5)3 概要设计 (5)3.1 系统分析 (5)3.1.1 系统的总体分析 (6)3.2 数据库的设计与实现 (6)3.2.1 数据库系统分析 (7)3.2.2 数据库物理实现 (7)4 详细设计 (9)4.1 Servlet的详细应用 (9)4.2 特定模块的详细介绍 (9)4.2.1 登陆模块 (9)4.2.2 账单管理模块 (15)4.2.2 供应商管理模块 (21)4.2.3 用户管理模块 (26)5 系统测试 (33)结语 (34)注释 (34)参考文献 (35)致谢 (37)附录1 (38)1 正文1.1研究背景分析超级市场是以顾客自选方式经营的大型综合性零售商场,又称自选商场。

超市进销存管理系统-需求分析

超市进销存管理系统-需求分析

1 前言超市作为人们日常生活不可或缺的一部分,而且随着经济的发展,超市的规模越来越大,商品的种类也越来越纷杂,一个高效实用的超市管理系统至关重要。

超市管理系统能帮助管理人员快速有效的管理进货,销售,库存,商品进销结算等各项业务,能极大的提高超市管理的高效性,实时性,安全性,科学性和智能化程度,从而降低营业成本和增加收益。

本系统大致可实现以下功能(模块):1.系统管理:包括密码验证和系统的登录与退出,还有密码修改等功能。

2.信息查询:包括进货信息和出货信息的查询,还有商品库存信息,资金结算信息查询等。

3.进出货管理:即超市日常进出货操作,包括进货和前台销售两个子管理系统。

4.商品信息管理:包括商品进出售的信息,销售商品的定价等。

能够执行添加,修改,删除,查询等操作。

本章将简要地说明本文档的目的、范围、参考文件和术语定义。

1.1目的本文档的目的在于给出“超市进销存管理系统”(以下简称本平台)的功能说明。

1)向用户描述“超市进销存管理系统”的功能;2)为编制后续各阶段的文档提供基本依据;3)提供给用户确认或本地化修改的基本文件;4)作为日后软件确认测试和系统验收之参考依据;5)作为日后系统维护工作基准文件。

本文档的内容涵盖了本系统的总体结构设计、软件运行环境设计、处理流程设计和软件功能设计等。

本文档的使用者包括本系统用户、需求分析人员、项目管理人员、软件设计人员、软件质量控制人员以及软件维护人员。

1.2范围软件产品名称:超市进销存管理系统V1.0通过使用本软件产品,能完成如下功能:1.采购员能实时得知库存不足的商品列表,方便进行采购2.经理能得到实时的营业分析,查看商品销售和采购情况,实时调整经营策略3.系统能对销售和采购单据进行有效管理,支持用户随时进行查询和统计4.前台POS系统能对售出的商品进行方便快捷的结算,且能与会员管理系统进行联接,支持会员功能5.管理员(业务员)能实时查看商品的库存动态,实时设置商品信息。

商品订购系统设计完整代码

商品订购系统设计完整代码

商品订购系统设计完整代码以下是一个商品订购系统的设计完整代码示例:```pythonimport jsonclass Product:def __init__(self, id, name, price):self.id = id = nameself.price = priceclass Order:def __init__(self, id, products):self.id = idself.products = productsdef calculate_total(self):total = 0for product in self.products:total += product.pricereturn totalclass OrderSystem:def __init__(self):self.products = []self.orders = []def add_product(self, product):self.products.append(product)def create_order(self, product_ids): order_products = []for id in product_ids:for product in self.products:if product.id == id:order_products.append(product)breakorder_id = len(self.orders) + 1order = Order(order_id, order_products) self.orders.append(order)return order_iddef get_order_total(self, order_id):for order in self.orders:if order.id == order_id:return order.calculate_totalreturn Nonedef save_to_file(self, filename): data ="products": [],"orders": []}for product in self.products:data["products"].append"id": product.id,"name": ,"price": product.price})for order in self.orders:order_product_ids = []for product in order.products:order_product_ids.append(product.id) data["orders"].append"id": order.id,"product_ids": order_product_ids})with open(filename, 'w') as file:json.dump(data, file)def load_from_file(self, filename):with open(filename, 'r') as file:data = json.load(file)for product_data in data["products"]:product = Product(product_data["id"], product_data["name"], product_data["price"])self.add_product(product)for order_data in data["orders"]:order_products = []for product_id in order_data["product_ids"]:for product in self.products:if product.id == product_id:order_products.append(product)order = Order(order_data["id"], order_products)self.orders.append(order)#创建商品订购系统示例order_system = OrderSystem#添加商品product_1 = Product(1, "苹果", 3)product_2 = Product(2, "香蕉", 2)product_3 = Product(3, "橙子", 4)order_system.add_product(product_1)order_system.add_product(product_2)order_system.add_product(product_3)#创建订单order_id = order_system.create_order([1, 3])#获取订单总价order_total = order_system.get_order_total(order_id) if order_total is not None:print(f"订单{order_id}总价为:{order_total}")else:print("订单不存在")#保存数据到文件order_system.save_to_file("order_data.json")#从文件加载数据order_system.load_from_file("order_data.json")```这个代码示例演示了一个简单的商品订购系统。

python代码完成超市管理系统的设计与实现

python代码完成超市管理系统的设计与实现

python代码完成超市管理系统的设计与实现超市管理系统是一个相对复杂的系统,涵盖了商品管理、库存管理、销售管理、员工管理等多个模块。

以下是一个简化的超市管理系统的Python代码示例,主要实现了商品管理和销售管理两个功能。

pythonclass Product:def __init__(self, id, name, price, quantity):self.id = id = nameself.price = priceself.quantity = quantityclass Supermarket:def __init__(self):self.products = []def add_product(self, product):self.products.append(product)def sell_product(self, product_id, quantity):for product in self.products:if product.id == product_id:if product.quantity >= quantity:product.quantity -= quantityreturn quantity * product.priceelse:return "库存不足"return "商品不存在"# 示例supermarket = Supermarket()# 添加商品product1 = Product(1, "苹果", 5, 100)product2 = Product(2, "香蕉", 3, 50)supermarket.add_product(product1)supermarket.add_product(product2)# 销售商品print(supermarket.sell_product(1, 10)) # 输出 50print(supermarket.sell_product(2, 30)) # 输出 "库存不足"在这个示例中,我们定义了两个类:Product和Supermarket。

超市管理系统的设计与实现

超市管理系统的设计与实现

超市管理系统的设计与实现1. 建立数据库和基本表,并建立合理的约束(1)打开VFP,建立一个项目,命名为csglxt。

(2)在项目中建立数据库:以班级+小组(如汉语1102-01)(3)在数据库中建立5张表:“商品信息表”表的结构字段名字段类型字段宽度小数位索引商品编号字符型 10 ——主索引商品名称字符型 50 ————厂商名称字符型 50 ————价格数值型 8 2 ——库存数量整型——————“用户表”表的结构字段名字段类型字段宽度小数位索引用户编号字符型 10 ——主索引用户名字符型 8 ————用户密码字符型 20 ————用户类型字符型10 ————“会员表”表的结构字段名字段类型字段宽度小数位索引会员编号字符型 8 ——主索引会员姓名字符型 8 ————会员卡号字符型 8 ————会员电话字符型11 ————注册日期日期型——————累计消费金额数值型 20 2 ------会员地址备注型——————照片通用型——————“进货记录表”表的结构字段名字段类型字段宽度小数位索引进货单编号字符型 10 ——主索引商品编号字符型 10 ——普通索引进货数量整型 4 ————商品单价数值型 10 2 ------总额数值型 20 2 ——进货日期日期型——————经手人字符型8 ——普通索引备注备注型 20 ————“销售表”表的结构字段名字段类型字段宽度小数位索引销售单编号字符型 10 ——主索引商品编号字符型 10 ——普通索引销售数量整型——————商品单价数值型 10 2 ------总额数值型 20 2 ——销售日期日期型——————销售人员字符型8 ——普通索引——普通索引会员编号字符型 8备注备注型——————(4)参照完整性约束:商品信息表、销售表通过商品编号进行连接,商品信息表、进货记录表也通过商品编号进行连接;用户表以用户编号和销售表的销售人员编号连接,用户表以用户编号和进货记录表的经手人编号连接;会员表以会员编号和销售连接。

超市库存管理系统信息系统分析报告与设计

超市库存管理系统信息系统分析报告与设计

超市库存管理信息系统分析与设计专业:班级:学号:姓名:二〇一五年七月课程设计评分标准一、系统规划(一)选题背景随着我国经济的飞速发展,各种类型规模的公司企业迅速崛起,许多从事生产和经营管理的企业都有自己生产和销售的产品,而这些产品都需要储存在仓库中,对于每个企业来说,随着企业规模的不断扩大,产品数量的急剧增加,所生产产品的种类也会不断地更新与发展,有关产品的各种信息量也会成倍增长。

面对庞大的产品信息量,如何有效地管理库存产品,对这些企业来说是非常重要的,库存管理的重点是销售信息能否及时反馈,从而确保企业运行效益。

而库存管理又涉及入库、出库的产品、经办人员及客户等方方面面的因素,如何管理这些信息数据,是一项复杂的系统工程,充分考验着仓库管理员的工作能力,工作量的繁重是可想而知的,所以这就需要由库存管理系统来提高库存管理工作的效率,这对信息的规范管理、科学统计和快速查询,减少管理方面的工作量,同时对于调动广大员工的工作积极性,提高企业的生产效率,都具有十分重要的现实意义。

(二)当前管理中存在的问题1.信息传递不透明商品信息反馈不及时,预测不精确,导致存货结构、周期不够合理,给企业造成了大量多余的物流成本。

沃尔玛超市与供应商之间的关系尚不够协调,信息传递尚不够透明。

2.库存管理系统不够完善目前该超市的库存管理系统还不甚完备,功能也并不强大,各个区域系统相互独立,口径不统一,造成资源的极大浪费。

有些地区的沃尔玛超市的库房还不是现代化的立体仓库,里面既没有铝货架,也没有负责搬卸、移动货物的升降式叉车,这样使库房的空间不能够充分得到利用,使单位储藏成本居高不下,而且货物的装卸搬运多依靠工人手工完成,这样势必增加货物破损、遗失的可能性。

同时由于库房管理人员的素质较低、工作随意性强,对货物码放的专无序的状态,缺乏明显的分类。

3超市高库存与缺货现象在一家沃尔沃门店中,可能畅销商品总是缺货,而非畅销品却总是占用了大量的资金和库存空间,这些商品数量庞大,严重影响着门店的库存周转率和资金周转率(三)系统需求分析1.组织结构分析图1 组织结构图财务部:进行日常业务会计科目的记录、监督、总结,为各个部门的业务开张提供资金支持. 销售部:对出售的商品的质量和数量进行统计,同时将数据反馈到采购部及系统中,以便做出下期的计划.采购部:主要负责对商品的采购,根据销售反馈的数据进行有针对性得采购,同时对即将采购的物品做出销售计划.库存部:主要负责商品的收发,并且严格做好记录,出具票据及将数据填写到系统中.销售部:对出售的商品的质量和数量进行统计,同时将数据反馈到采购部及系统中以便做出下期的计划.2)功能结构分析图2 功能结构图库存管理经理:整个库存管理部门的领导,信息查询进库管理部门:对于采购部门采购的货物进行统计并核查采购清单,登记货物详情,退货明细登记.货物管理部门:对于仓库安全,卫生的管理,将货物分类存放,对于货物定期检查,核实,迁移,库存警报.出库管理部门:货物出库明细,货品出库,商品退货返厂,商品来往明细.3)企业主要业务流程分析超市需要定期地进行库存商品的盘点,包括数量是否符合、商品报废情况等等,并核实账单是否相符。

自动售货机系统源代码

自动售货机系统源代码

#include<stdio.h>#include<stdlib.h>#include<string.h>#include "goods.h"bool GetCharge(int Sum,int Money);void Getsmalcharge(int Money,int *ChargeNum); int KouLing();char ChooseJieMian();char SaleCenter();void loadGoodsFrom* gs);char ManageCenter();void KunCun();void Sale();void ShangJia();void TongJiFun();Goods goods[3];TongJi tj[3];void init(){for(int i = 0; i < 3; ++i){tj[i].jrxl = 0;tj[i].jrzje = 0;}}void main(){//初始化init();int op = 0;//读取商品信息loadGoodsFrom);char c = ChooseJieMian();while(true){system("cls");if( c == '1'){c = SaleCenter();}else if(c == '2'){op = KouLing();if(op == 1){//进入管理界面c = ManageCenter();//system("pause");}else if(op == 0){//进去销售界面c = SaleCenter();}}}}//----------------------------------------------------/*** @return 1销售界面2管理界面*/char SaleCenter(){char state='N';int Sum=0;char Pro = 'd';// printf("\n********************************\n");while(true){state='N';Sum=0;while(!(Pro == 'c' || Pro == 'a' || Pro == 'b' || Pro == 'q')){system("cls");printf("\n\t*******************************************");printf("\n\t*********顾客您好,请选择商品**************\n");printf("\n\t·a·商品%s ·b·商品%s ·c·商品%s ·q·管理\n",goods[0].name,goods[1].name,goods[2].name);printf("\n\t -%d- -%d- -%d- (单位:件)",goods[0].totalCount,goods[1].totalCount,goods[2].totalCount);printf("\n\t*******************************************\n\t\t");Pro = getchar();}if(Pro == 'q')break;switch(Pro){case 'a':{Sum=Sum+2;printf("\n\t·商品A价格为%d,请投币·",Sum);}break;case 'A':{Sum=Sum+2;printf("\n\t·商品A价格为%d,请投币·",Sum);}break;case 'b':{Sum=Sum+3;printf("\n\t·商品B价格为%d,请投币·",Sum);}break;case 'B':{Sum=Sum+3;printf("\n\t·商品B价格为%d,请投币·",Sum);}break;case 'c':{Sum=Sum+6;printf("\n\t·商品C价格为%d,请投币·",Sum);}break;case 'C':{Sum=Sum+6;printf("\n\t·商品C价格为%d,请投币·",Sum);}break;default:{printf("\n\t输入物品有误!!!!\n");}break;};int Money;bool st=false;while(!st){// printf("\n输入金额:");scanf("%d",&Money);getchar();st=GetCharge(Sum,Money);};Pro = 'd';system("PAUSE");}return '2';}bool GetCharge(int Sum,int Money){int ChargeNum[4];for(int i=0;i<4;i++){ChargeNum[i]=0;}if(Sum>Money){printf("\n\t·所投金额不足支付所选商品,请重新投币·");return false;}else if(Sum==Money){printf("\n\t·所投金额等于商品价格,请在商品出口处拿取商品·\n");//销售成功的操作if(Sum == goods[0].price){goods[0].totalCount --;Sale();tj[0].jrxl ++;tj[0].jrzje += Sum;}else if(Sum == goods[1].price){goods[1].totalCount --;Sale();tj[1].jrxl ++;tj[1].jrzje += Sum;}else if(Sum == goods[2].price){goods[1].totalCount --;Sale();tj[2].jrxl ++;tj[2].jrzje += Sum;}return true;}else{int Result=Money-Sum;Getsmalcharge(Result,ChargeNum);printf("\n\t·所投金额大于商品价格,为您找零%d元·\n",Result);printf("\n\t\t-壹元面值%d张-\n",ChargeNum[0]);printf("\n\t\t-贰元面值%d张-\n",ChargeNum[1]);printf("\n\t\t-伍元面值%d张-\n",ChargeNum[2]);printf("\n\t\t-拾元面值%d张-\n",ChargeNum[3]);printf("\n\t·请在商品出口处拿取商品·\n");// printf("\n余额为%d元,应找零\n1 元%d张\n2 元%d张\n5 元%d张\n10元%d张\n",Result,ChargeNum[0],ChargeNum[1],ChargeNum[2],ChargeNum[3]);}//end if//销售成功的操作if(Sum == goods[0].price){goods[0].totalCount --;Sale();tj[0].jrxl ++;tj[0].jrzje += Sum;}else if(Sum == goods[1].price){goods[1].totalCount --;Sale();tj[1].jrxl ++;tj[1].jrzje+= Sum;}else if(Sum == goods[2].price){goods[2].totalCount --;Sale();tj[2].jrxl ++;tj[2].jrzje+= Sum;}return true;}/**成功卖出操作的后台操作*/void Sale(){FILE* fp;if ((fp = fopen("d:\\goods.out", "w")) == NULL){printf ("未找到文件d:\\goods.out...系统将退出\n ");exit(0);}fprintf(fp,"%s %d %d\n",goods[0].name,goods[0].totalCount,goods[0].price);fprintf(fp,"%s %d %d\n",goods[1].name,goods[1].totalCount,goods[1].price);fprintf(fp,"%s %d %d\n",goods[2].name,goods[2].totalCount,goods[2].price);//关闭文件fclose(fp);fp = NULL;}//------------------------------------void Getsmalcharge(int Money,int *ChargeNum){if(Money<0)return;int Sum=Money;int charge[4]={1,2,5,10};ChargeNum[3]=Sum/charge[3];Sum=Sum%charge[3];ChargeNum[2]=Sum/charge[2];Sum=Sum%charge[2];ChargeNum[1]=Sum/charge[1];Sum=Sum%charge[1];ChargeNum[0]=Sum/charge[0];Sum=Sum%charge[0];}/***@return 1 口令正确0 口令错误,并返回销售界面*/int KouLing(){char kl[50];int count = 0,ret = 0;char rkl[50] = "admin";while(strcmp(rkl,kl) != 0){if(count == 0){printf("\n\t*******************************************");printf("\n\t****************管理口令验证***************\n");printf("\n\t·Tip·忘记口令,输入“cancel”,进入销售界面\n");printf("\n\t*******************************************\n\t\t");}else{printf("\n\t*******************************************");printf("\n\t****************管理口令验证***************\n");printf("\n\t·Tip·忘记口令,输入“cancel”,进入销售界面\n");printf("\n\t*******************************************");printf("\n\t\t\t\t输入错误次数:%d次\n\t\t",count);}count++;scanf("%s",kl);system("CLS");if(strcmp(kl,"cancel") == 0)break;}if(strcmp(kl,"cancel") == 0)ret = 0;elseret = 1;return ret;}/*** @ return '1' , '2'*/char ChooseJieMian(){char c = '3';while(true){system("cls");printf("\n\t*******************************************");printf("\n\t****************界面选择*******************\n");printf("\n\t·1·-销售界面- ·2·-管理界面-\n");printf("\n\t*******************************************\n\t\t");c = getchar();if(c == '1' || c == '2')break;}system("cls");return c;char ManageCenter(){while(true){int op = 7;while( !(op == 1|| op == 2 || op == 3 || op == 4|| op == 5 || op == 6)){system("cls");printf("\n\t*******************************************");printf("\n\t*************欢迎您,管理员****************\n");printf("\n\t·1·-库存查询- ·2·-商品上架-\n");printf("\n\t·3·-销售查询- ·4·-会计查询-\n");printf("\n\t·5·-结算功能- ·6·-销售界面-\n");printf("\n\t*******************************************\n\t\t");scanf("%d",&op);}bool flag = false;switch(op){case 1:{KunCun();}break;case 2:{ShangJia();}break;case 3:{TongJiFun();}break;case 4:{}break;case 5:{}break;case 6:{flag = true;}break;default:break;}if(flag)break;elsesystem("PAUSE");}return '1';}*从文件里读取商品信息@return 商品列表*/void loadGoodsFrom* gs){//获得FILE 指针FILE* fp;if ((fp = fopen("d:\\goods.out", "r")) == NULL){printf ("未找到文件d:\\goods.out...系统将退出\n ");exit(0);}//Goods gs[3];int i = 0;while(!feof(fp)){fscanf(fp,"%s %d %d",gs[i].name,&gs[i].totalCount,&gs[i].price);i++;}//关闭文件fclose(fp);fp = NULL;}void KunCun(){int i = 0;printf("\n\t·商品名称··商品价格(元)··商品余量(件)·\n");for(i = 0; i < 3; ++i){printf("\n\t-%s-\t\t-%d-\t\t-%d-\n",goods[i].name,goods[i].price,goods[i].totalCount);}}void ShangJia(){printf("\n\t·Tip·正数增加,负数减少商品\n");int gs1 = 0,gs2 = 0,gs3 = 0;printf("\n\t\t-商品%s(余%d件): ",goods[0].name,goods[0].totalCount);scanf("%d",&gs1);printf("\n\t\t-商品%s(余%d件): ",goods[1].name,goods[1].totalCount);scanf("%d",&gs2);printf("\n\t\t-商品%s(余%d件): ",goods[2].name,goods[2].totalCount);scanf("%d",&gs3);goods[0].totalCount = gs1 + goods[0].totalCount < 0 ? 0:gs1 + goods[0].totalCount;goods[1].totalCount = gs2 + goods[1].totalCount < 0 ? 0:gs2 + goods[1].totalCount;goods[2].totalCount = gs3 + goods[2].totalCount < 0 ? 0:gs3 + goods[2].totalCount;//写文件//获得FILE 指针FILE* fp;if ((fp = fopen("d:\\goods.out", "w")) == NULL){printf ("未找到文件d:\\goods.out...系统将退出\n ");exit(0);}fprintf(fp,"%s %d %d\n",goods[0].name,goods[0].totalCount,goods[0].price);fprintf(fp,"%s %d %d\n",goods[1].name,goods[1].totalCount,goods[1].price);fprintf(fp,"%s %d %d\n",goods[2].name,goods[2].totalCount,goods[2].price);//关闭文件fclose(fp);fp = NULL;}void TongJiFun(){printf("\n\t·今日商品销售情况一览·\n");printf("\n\t\t-商品%s %d件共%d元-\n",goods[0].name,tj[0].jrxl,tj[0].jrzje);printf("\n\t\t-商品%s %d件共%d元-\n",goods[1].name,tj[1].jrxl,tj[1].jrzje);printf("\n\t\t-商品%s %d件共%d元-\n",goods[2].name,tj[2].jrxl,tj[2].jrzje);printf("\n\t·共计%d件,%d元·\n",tj[0].jrxl + tj[1].jrxl+tj[2].jrxl,tj[0].jrzje+tj[1].jrzje+tj[2].jrzje);}//Goods.htypedef struct _Goods{char name[50];int totalCount;int price;}Goods;typedef struct _TongJi{int jrxl;int jrzje;}TongJi;。

C语言实现超市管理系统

C语言实现超市管理系统

C语⾔实现超市管理系统本⽂实例为⼤家分享了C语⾔实现超市管理系统的具体代码,供⼤家参考,具体内容如下超市管理系统1.包括管理员和顾客2.管理员有登⼊,录⼊商品信息,显⽰所有商品信息功能3.顾客有购物车和结算功能4.购物车具有显⽰商品列表,显⽰购物车商品,往购物车添加商品的功能函数void UpdateKu();//更新购物车信息函数void calculate();//计算所购商品价格并修改保存int menu1();//打印主菜单函数int menu2();//打印管理员菜单函数int menu3();//打印顾客函数void CreateGoods();//录⼊商品信息函数void ShowGoods();//显⽰库存信息函数void ShopCart();//对购物车进⾏操作int ShopCartMenu();//打印购物车菜单void ShowCart();//显⽰购物列表void add();//在购物车⾥添加商品建⽴库存函数void CreateGoods(){//⼿动建⽴库存信息FILE *fp;//定义⽂件指针int i;printf("请输⼊需要录⼊的商品个数:\n");scanf("%d",&n);//输⼊数量printf("请依次输⼊货物信息:\n");printf("--------------------------------------------\n");for(i=0;i<n;i++){//向⽂件中写⼊信息printf("第%d个商品:\n",i+1);printf("货号:");fflush(stdin);//清空输⼊流gets(goods[i].ID);//输⼊货号printf("品名:");fflush(stdin);//清空输⼊流gets(goods[i].brand);//输⼊品名printf("进价: ");fflush(stdin);//清空输⼊流scanf("%lf",&goods[i].inprice);//输⼊进价printf("售价:");fflush(stdin);//清空输⼊流scanf("%lf",&goods[i].outprice);//输⼊售价printf("数量:");fflush(stdin);//清空输⼊流scanf("%d",&goods[i].storage);//输⼊数量printf("保质期:");fflush(stdin);//清空输⼊流gets(goods[i].date);//输⼊货号printf("\n");}if((fp=fopen("kucun.txt","w"))==NULL){//判断⽂件是否创建失败printf("创建⽂件失败。

超市管理系统(参考案例)

超市管理系统(参考案例)

超市管理系统(参考案例) LT一、问题定义1.系统开发目的1.大大提高超市的运作效率;2.通过全面的信息采集和处理,辅助提高超市的决策水平;3.使用本系统,可以迅速提升超市的管理水平,为降低经营成本,提高效益,增强超市扩张力,提供有效的技术保障。

2.背景说明21世纪,超市的竞争也进入到了一个全新的领域,竞争已不再是规模的竞争,而是技术的竞争、管理的竞争、人才的竞争。

技术的提升和管理的升级是超市业的竞争核心。

零售领域目前呈多元发展趋势,多种业态:超市、仓储店、便利店、特许加盟店、专卖店、货仓等相互并存。

如何在激烈的竞争中扩大销售额、降低经营成本、扩大经营规模,成为超市营业者努力追求的目标。

3.项目确立针对超市的特点,为了帮助超市解决现在面临的问题,提高小型超市的竞争力,我们将开发以下系统:前台POS销售系统、后台管理系统,其中这两个子系统又包含其它一些子功能。

4.应用范围本系统适应于各种超市。

5.名词定义①商品条形码:每种商品具有唯一的条形码,对于某些价格一样的商品,可以使用自定义条形码。

②交易清单:包括交易的流水账号、每类商品的商品名、数量、该类商品的总金额、交易的时间、负责本次收银的员工号。

③商品积压:在一定时期内,远无法完成销售计划的商品会造成积压。

④促销:在一定时期内,某些商品会按低于原价的促销价格销售。

⑤库存告警提示:当商品的库存数量低于库存报警数量时发出提示。

⑥盘点:计算出库存、销售额、盈利等经营指标。

二、可行性研究1.操作可行性分析超市的经营者大多具备电脑基本操作知识,对于必要的专业操作经短期培训即可;管理基础工作和各项管理制度比较健全,执行严格,原始数据采集完整,保存良好。

2.经济可行性分析超市管理系统的投入,能够提高工作效率,减少工作人员,从而减少人力资本的投入,根据核算,系统投入三个月后,就能够基本收回开发系统的投资,从经济角度来说,本系统开发完全必要。

3.技术可行性分析(1).硬件:电脑一台(2).软件:操作系统:中文Windows XP开发系统:Microsoft Visual Foxpro 6.0安装SQL Server 2000的服务器版本系统本身对硬件和软件的要求都不高且系统兼容性很强,平台的移植性也很好,因此无论在系统的硬件及软件上都满足开发的要求。

超市管理系统--面向对象程序设计(双语)设计报告

超市管理系统--面向对象程序设计(双语)设计报告

面向对象程序设计(双语)设计报告一、超市管理系统总体设计1、系统概述随着人们生活水平的不断提高,购物已成为一种时尚。

每天都有大量的消费者在各大商场中留下消费信息,所以作为商场的管理人员就需要有一个自动化、智能化的管理系统来完成这些信息的处理。

由此我们设计开发小超市管理系统。

目前市场上的超市管理系统,大部分为基于分布式数据库的网络管理系统,对于规模较小的超市没有必要花巨资来购买这样功能全面的管理系统,此外,对于那样功能齐全的管理系统也需要花大精力来维护。

基于这种情况,我们用所学的java知识,可以开发一种既能节约资金,又能完成小超市日常的管理任务。

本系统所包括的功能主要有:限于不同身份的人登录的登录界面;权限管理功能;商品销售功能;商品管理功能;销售管理功能。

在系统的设计中,用户管理功能可以管理登录本系统的人员,如:管理员、用户和超级用户等。

在最初的系统使用中只有技术管理员一种身份。

商品销售功能;可以完成商品信息的查询。

如:输入一种商品的编号在商品信息栏就显示该商品的所有信息,名称、价格、生产日期、生产地。

然后选择购买功能,就可以将商品添加到购物信息栏,最后选择提交,所购买的商品信息同时也添加到数据库中。

在商品管理功能中,可以把一种新引进的商品信息添加到小超市管理系统中。

在销售管理功能中,可以查看超市的销售情况,所有商品的购买信息都存储在数据库中。

在系统的安全性方面,我们规定了不同权限的登录用户,管理员(主要负责用户管理)可以登录到任何一个管理模块,以及后台的数据库,能够改变任一个登录者的用户名和密码。

用户只能进入到销售界面。

老板超级主要查看商品的销售情况和商品管理,他可以进入到商品销售管理查看商品的销售情况。

通过这样的权限限制就可以方便的控制系统的安全性。

总之,小超市管理系统是一个经济、实惠的应用软件,适合小规模的商店和超市。

操作难度小,易学易用。

2、实现功能对商品进行录入与记录,员工的信息登记,顾客消费的信息记录,有关会员的积分情况、等各种的统计报表,另外还提供各类统计查询。

java超市管理系统课程设计报告

java超市管理系统课程设计报告

java超市管理系统课程设计报告湖南文理学院课程设计题目:超市管理系统系别计算机科学与技术班级计科12102学生姓名罗巍杨欢杨沁铠唐振学号 201217010223指导教师谭文学课程设计进行地点:第三实验楼A617任务下达时间: 2014 年5月21日起止日期:2014年5月21日起——至 2014年6月21日止目录一、系统需求分析.................................. - 6 -1.1系统名称:...................................... - 6 -1.2系统介绍:...................................... - 6 -1.3开发背景........................................ - 6 -1.4.系统面向的用户群体.............................. - 7 -1.5开发环境........................................ - 7 -二、系统总体设计.................................. - 7 -2.1系统功能结构图 .................................. - 7 -三、系统详细设计...................... 错误!未定义书签。

3.1数据库实体E-R图设计 ................ 错误!未定义书签。

3.2数据库表的设计 ...................... 错误!未定义书签。

3.3物理设计文档 ........................ 错误!未定义书签。

3.4详细设计............................ 错误!未定义书签。

四、系统总结.......................... 错误!未定义书签。

C#简单超市收银系统源码

C#简单超市收银系统源码

C#简单超市收银系统源码using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class ProductFather{public double Price{get;set;}public string Name{get;set;}public string ID{get;set;}public ProductFather(string id, double price, string Name){this.ID = id;this.Price = price; = Name;}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class SamSung:ProductFather{public SamSung(string id, double price, string Name): base(id, price, Name){}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class Acer:ProductFather{public Acer(string id, double price, string Name): base(id, price, Name){}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class Banana : ProductFather{public Banana(string id, double price, string Name): base(id, price, Name){}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class JiangYou:ProductFather{public JiangYou(string id, double price, string Name) : base(id, price, Name){}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class SupperMarket{//创建仓库对象CangKu ck = new CangKu();/// <summary>/// 创建超市对象的时候,给仓库的货架上导入货物/// </summary>public SupperMarket(){ck.JinPros("Acer", 1000);ck.JinPros("SamSung", 1000);ck.JinPros("JiangYou", 1000);ck.JinPros("Banana", 1000);}/// <summary>/// 跟用户交互的过程/// </summary>public void AskBuying(){Console.WriteLine("欢迎观临,请问您需要些什么?");Console.WriteLine("我们有Acer、SamSung、Jiangyou、Banana");string strType = Console.ReadLine();Console.WriteLine("您需要多少?");int count = Convert.ToInt32(Console.ReadLine());//去仓库取货物ProductFather[] pros = ck.QuPros(strType, count);//下面该计算价钱了double realMoney = GetMoney(pros);Console.WriteLine("您总共应付{0}元", realMoney);Console.WriteLine("请选择您的打折方式1--不打折2--打九折3--打85 折4--买300送50 5--买500送100");string input = Console.ReadLine();//通过简单工厂的设计模式根据用户的舒服获得一个打折对象CalFather cal = GetCal(input);double totalMoney = cal.GetTotalMoney(realMoney);Console.WriteLine("打完折后,您应付{0}元", totalMoney);Console.WriteLine("以下是您的购物信息");foreach (var item in pros){Console.WriteLine("货物名称:"++","+"\t"+"货物单价:"+item.Price+","+"\t"+"货物编号:"+item.ID);}}/// <summary>/// 根据用户的选择打折方式返回一个打折对象/// </summary>/// <param name="input">用户的选择</param>/// <returns>返回的父类对象但是里面装的是子类对象</returns>public CalFather GetCal(string input){CalFather cal = null;switch (input){case "1": cal = new CalNormal();break;case "2": cal = new CalRate(0.9);break;case "3": cal = new CalRate(0.85);break;case "4": cal = new CalMN(300, 50);break;case "5": cal = new CalMN(500, 100);break;}return cal;}/// <summary>/// 根据用户买的货物计算总价钱/// </summary>/// <param name="pros"></param>/// <returns></returns>public double GetMoney(ProductFather[] pros){double realMoney = 0;//realMoney = pros[0].Price * pros.Length;for (int i = 0; i < pros.Length; i++){realMoney += pros[i].Price;// realMoney = pros[i] * pros.Length;}return realMoney;}public void ShowPros(){ck.ShowPros();}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{/// <summary>/// 不打折该多少钱就多少钱/// </summary>class CalNormal:CalFather{public override double GetTotalMoney(double realMoney){return realMoney;}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{/// <summary>/// 按折扣率打折/// </summary>class CalRate:CalFather{/// <summary>/// 折扣率/// </summary>public double Rate{get;set;}public CalRate(double rate){this.Rate = rate;}public override double GetTotalMoney(double realMoney){return realMoney * this.Rate;}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{/// <summary>/// 买M元送N元/// </summary>class CalMN:CalFather{//买500送100public double M{get;set;}public double N{get;set;}public CalMN(double m, double n){this.M = m;this.N = n;}public override double GetTotalMoney(double realMoney){//600 -100//1000-200//1200if (realMoney >= this.M){return realMoney - (int)(realMoney / this.M) * this.N;}else{return realMoney;}}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class CangKu{List<List<ProductFather>> list = new List<List<ProductFather>>();/// <summary>///向用户展示货物/// </summary>public void ShowPros(){foreach (var item in list){Console.WriteLine("我们超市有:" + item[0].Name + "," + "\t" + "有" +item.Count + "个," + "\t" + "每个" + item[0].Price + "元");}}//list[0]存储Acer电脑//list[1]存储三星手机//list[2]存储酱油//list[3]存储香蕉/// <summary>/// 在创建仓库对象的时候像仓库中添加货架/// </summary>public CangKu(){list.Add(new List<ProductFather>());list.Add(new List<ProductFather>());list.Add(new List<ProductFather>());list.Add(new List<ProductFather>());}/// <summary>/// 进货/// </summary>/// <param name="strType">货物的类型</param>/// <param name="count">货物的数量</param>public void JinPros(string strType, int count){for (int i = 0; i < count; i++){switch (strType){case "Acer": list[0].Add(new Acer(Guid.NewGuid().ToString(), 1000, "宏基笔记本"));break;case "SamSung": list[1].Add(new SamSung(Guid.NewGuid().ToString(), 2000, "棒之手机"));break;case "JiangYou": list[2].Add(new JiangYou(Guid.NewGuid().ToString(), 10, "老抽酱油"));break;case "Banana": list[3].Add(new Banana(Guid.NewGuid().ToString(), 50, "大香蕉"));break;}}}/// <summary>/// 从仓库中提取货物/// </summary>/// <param name="strType"></param>/// <param name="count"></param>/// <returns></returns>public ProductFather[] QuPros(string strType, int count){ProductFather[] pros = new ProductFather[count];for (int i = 0; i < pros.Length; i++){switch (strType){case "Acer":pros[i] = list[0][0];list[0].RemoveAt(0);break;case "SamSung": pros[i] = list[1][0];list[1].RemoveAt(0);break;case "JiangYou": pros[i] = list[2][0];list[2].RemoveAt(0);break;case "Banana": pros[i] = list[3][0];list[3].RemoveAt(0);break;}}return pros;}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class SupperMarket{//创建仓库对象CangKu ck = new CangKu();/// <summary>/// 创建超市对象的时候,给仓库的货架上导入货物/// </summary>public SupperMarket(){ck.JinPros("Acer", 1000);ck.JinPros("SamSung", 1000);ck.JinPros("JiangYou", 1000);ck.JinPros("Banana", 1000);}/// <summary>/// 跟用户交互的过程/// </summary>public void AskBuying(){Console.WriteLine("欢迎观临,请问您需要些什么?");Console.WriteLine("我们有Acer、SamSung、Jiangyou、Banana");string strType = Console.ReadLine();Console.WriteLine("您需要多少?");int count = Convert.ToInt32(Console.ReadLine());//去仓库取货物ProductFather[] pros = ck.QuPros(strType, count);//下面该计算价钱了double realMoney = GetMoney(pros);Console.WriteLine("您总共应付{0}元", realMoney);Console.WriteLine("请选择您的打折方式1--不打折2--打九折3--打85 折4--买300送50 5--买500送100");string input = Console.ReadLine();//通过简单工厂的设计模式根据用户的舒服获得一个打折对象CalFather cal = GetCal(input);double totalMoney = cal.GetTotalMoney(realMoney);Console.WriteLine("打完折后,您应付{0}元", totalMoney);Console.WriteLine("以下是您的购物信息");foreach (var item in pros){Console.WriteLine("货物名称:"++","+"\t"+"货物单价:"+item.Price+","+"\t"+"货物编号:"+item.ID);}}/// <summary>/// 根据用户的选择打折方式返回一个打折对象/// </summary>/// <param name="input">用户的选择</param>/// <returns>返回的父类对象但是里面装的是子类对象</returns>public CalFather GetCal(string input){CalFather cal = null;switch (input){case "1": cal = new CalNormal();break;case "2": cal = new CalRate(0.9);break;case "3": cal = new CalRate(0.85);break;case "4": cal = new CalMN(300, 50);break;case "5": cal = new CalMN(500, 100);break;}return cal;}/// <summary>/// 根据用户买的货物计算总价钱/// </summary>/// <param name="pros"></param>/// <returns></returns>public double GetMoney(ProductFather[] pros){double realMoney = 0;//realMoney = pros[0].Price * pros.Length;for (int i = 0; i < pros.Length; i++){realMoney += pros[i].Price;// realMoney = pros[i] * pros.Length;}return realMoney;}public void ShowPros(){ck.ShowPros();}}}using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _16超市收银系统{class Program{static void Main(string[] args){//创建超市对象SupperMarket sm = new SupperMarket();//展示货物sm.ShowPros();//跟用户交互sm.AskBuying();Console.ReadKey();}}}。

新华书店进销存管理系统部分程序源代码

新华书店进销存管理系统部分程序源代码

资料范本本资料为word版本,可以直接编辑和打印,感谢您的下载新华书店进销存管理系统部分程序源代码地点:__________________时间:__________________说明:本资料适用于约定双方经过谈判,协商而共同承认,共同遵守的责任与义务,仅供参考,文档可直接下载或修改,不需要的部分可直接删除,使用时请详细阅读内容附录2新华书店进销存管理系统部分程序源代码主程序MAIN.PRG程序代码SET DEFAULT TO C:\毕业设计PUBLIC nkfgl,nxsgl,ncggl,nkcgl,nxtgl STORE .f. TO nkfgl,nxsgl,ncggl,nkcgl,nxtgl PUBLIC nname,ndepartmentSTORE "" TO nname,ndepartmentDo Form loginfRead EventsDo Form mainRead EventsQuit主表单MAIN.SCX代码2.1 表单Init过程程序代码do mmenu.mpr with this,.T.bel2.caption = nnamebel4.caption = ndepartment系统登入表单LOGINF.SCX代码3.1 表单登入按钮Click事件程序代码SELECT userGO TOP*检查用户名和密码是否输入If empty(thisform.text1.value) thenbel3.caption = "请输入用户名"returnelseif empty(thisform.text2.value) thenbel3.caption = "请输入密码"returnendifendif*操作USER表,查询满足条件记录locate for name = alltrim(thisform.text1.value)if !found()bel3.caption="用户不存在"returnelseif user.password != alltrim(thisform.text2.value) thenbel3.caption="密码错误"returnendifendifnname = ndepartment = user.department nkfgl = user.kfglnxsgl = user.xsglncggl = user.cgglnkcgl = user.kcglnxtgl = user.xtglthisform.releaseclear events系统管理表单XTGLF.SCX代码4.1 表单Init过程程序代码thisform.text1.enabled = .f. thisform.text2.enabled = .f. thisform.text3.enabled = .f. bo1.enabled = .f. thisform.check1.enabled = .f. thisform.check2.enabled = .f. thisform.check3.enabled = .f.thisform.check4.enabled = .f. thisform.check5.enabled = .f. bel5.visible = .f. thisform.text3.visible = .f. mand10.enabled = .f. mand11.enabled = .f. thisform.dis_recordthisform.dis_reccommand4.2 表单自定义过程DIS_RECORD程序代码PUBLIC newcommandSTORE .f. TO newcommandif reccount("user") = 0thisform.text1.value = ""thisform.text2.value = ""bo1.value = "" thisform.check1.value = 0thisform.check2.value = 0thisform.check3.value = 0thisform.check4.value = 0thisform.check5.value = 0elsethisform.text1.value = thisform.text2.value = user.password bo1.value = user.department if user.kfgl thenthisform.check1.value = 1elsethisform.check1.value = 0endifif user.xsgl thenthisform.check2.value = 1elsethisform.check2.value = 0endifif user.cggl thenthisform.check3.value = 1elsethisform.check3.value = 0endifif user.kcgl thenthisform.check4.value = 1elsethisform.check4.value = 0endifif user.xtgl thenthisform.check5.value = 1elsethisform.check5.value = 0endifendifthisform.refresh4.3 表单自定义过程DIS_RECCOMMAND程序代码private nstore 0 to nn = reccount("user")if n=1 .or. n=0 thenmand1.enabled = .f. mand2.enabled = .f. mand3.enabled = .f. mand4.enabled = .f.elseif recno("user")=1 thenmand1.enabled = .f.mand2.enabled = .f. mand3.enabled = .t. mand4.enabled = .t.elseif recno("user")=n thenmand1.enabled = .t. mand2.enabled = .t. mand3.enabled = .f. mand4.enabled = .f.elsemand1.enabled = .t. mand2.enabled = .t. mand3.enabled = .t. mand4.enabled = .t.endifendifendifthisform.refresh4.4 表单保存按钮Click事件程序代码if empty(thisform.text1.value) then=messagebox("请输入用户名",0+48+0,"出错")thisform.refreshreturnendifif empty(thisform.text2.value) then=messagebox("请输入密码",0+48+0,"出错")thisform.text2.setfocusthisform.refreshreturnendifif .not.(alltrim(thisform.text2.value) ==alltrim(thisform.text3.value)) then=messagebox("密码重复错误,请重新输入",0+48+0,"出错") thisform.text2.value = ""thisform.text3.value = ""thisform.text2.setfocusthisform.refreshreturnendifif empty(bo1.value) then=messagebox("请选择所属部门",0+48+0,"出错")thisform.refreshreturnendififthisform.check1.value=0.and.thisform.check2.value=0.and .thisform.check3.value=0.and.thisform.check4.value=0.an d.thisform.check5.value=0 then=messagebox("至少选择一个用户权限",0+48+0,"出错") thisform.check1.setfocusthisform.refreshreturnendififthisform.check1.value=1.and.thisform.check2.value=1.and .thisform.check3.value=1.and.thisform.check4.value=1.an d.thisform.check5.value=1 thenmesbox=messagebox("此用户将具有全部权限,请确认",4+48+0,"警告")if mesbox=7 thenthisform.check1.setfocusthisform.refreshreturnendifendif*用户权限处理PRIVATEnname,npassword,ndepartment,nkf,nxs,ncg,nkc,nxt nname = alltrim(thisform.text1.value)npassword = alltrim(thisform.text2.value)ndepartment = alltrim(bo1.value) if thisform.check1.value = 1 thennkf = .t.elsenkf = .f.endifif thisform.check2.value = 1 thennxs = .t.elsenxs = .f.endifif thisform.check3.value = 1 thenncg = .t.elsencg = .f.endifif thisform.check4.value = 1 thennkc = .t.elsenkc = .f.endifif thisform.check5.value = 1 thennxt = .t.elsenxt = .f.endif*判断是新记录保存还是修改记录If newcommand then && newcommand = .t. 是新记录保存locate for =alltrim(thisform.text1.value) if found() then=messagebox("用户已经存在",0+48+0,"出错")thisform.text1.setfocusthisform.refreshreturnendif*数据表user保存记录insert intouser(name,password,department,kfgl,xsgl,cggl,kcgl,xtgl) values (nname,npassword,ndepartment,nkf,nxs,ncg,nkc,nxt) =messagebox("保存完毕",0+48+0,"提示")elseupdate user set password=npassword,department=ndepartment,kfgl=nkf,xsgl=nxs,cggl=ncg,kcgl=nkc,xtgl=nxt where name= nname=messagebox("修改完成",0+48+0,"提示")endif*表单初始化thisform.text1.enabled = .f.thisform.text2.enabled = .f.thisform.text3.enabled = .f.bo1.enabled = .f.thisform.check1.enabled = .f.thisform.check2.enabled = .f.thisform.check3.enabled = .f.thisform.check4.enabled = .f. thisform.check5.enabled = .f. mand1.enabled = .t. mand2.enabled = .t. mand3.enabled = .t. mand4.enabled = .t. mand5.enabled = .t. mand6.enabled = .t. mand7.enabled = .t. mand8.enabled = .t. mand9.enabled = .t. mand10.enabled =.f. mand11.enabled =.f. mand12.enabled = .t. bel5.visible = .f. thisform.text3.visible = .f. thisform.dis_reccommand thisform.dis_recordnewcommand = .f.thisform.refresh4.5 表单浏览按钮Click事件程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,80 noFLOAT CLOSE nominimize nogrow nozoom systembrow fields name,department,kfgl,xsgl,cggl,kcgl window browsewin noappend nomodify nodeleterelease window browsewin图书管理表单TSGL.SCX代码5.1 自定义过程AUTO_BOOKID程序代码select bookset order to bookidgo bottomprivate autoid1,autoid2,autoid3,autoid4autoid1 =alltrim(str(val(substr(alltrim(book.bookid),2,6))+1,6,0 ))autoid2 = len(autoid1)if autoid2 != 6 thenfor n = autoid2 to 5autoid1 = "0" + autoid1endforendifautoid4 = "B" + alltrim(autoid1)thisform.text1.value = autoid4 5.2 新建按钮Click事件程序代码thisform.text2.enabled = .t. thisform.text3.enabled = .t. thisform.text4.enabled = .t. thisform.text5.enabled = .t. thisform.text6.enabled = .t. bo1.enabled = .t. thisform.text7.enabled = .t. thisform.text8.enabled = .t. mand1.enabled = .f. mand2.enabled = .f. mand3.enabled = .f. mand4.enabled = .f. mand5.enabled = .f. mand6.enabled = .f. mand7.enabled = .f. mand8.enabled = .f. mand9.enabled = .f. mand10.enabled =.t. mand11.enabled =.t.mand12.enabled = .t.thisform.text2.value = ""thisform.text3.value = ""thisform.text4.value = ""thisform.text5.value = ""thisform.text6.value = ""bo1.value = ""thisform.text7.value = 0thisform.text8.value = 0thisform.auto_bookidthisform.text2.setfocusthisform.newcommand = .t.thisform.refresh5.3 删除按钮Click事件程序代码if reccount("book")=1 then=messagebox("只有一条记录,不能删除",0+16+0,"出错") returnelsenbookid = alltrim(thisform.text1.value) nbookname = alltrim(thisform.text2.value)mesbox=messagebox("是否删除"+nbookid+"号图书",4+48+0,"警告")if mesbox=7 thenreturnelseuse book EXCLUSIVEdelete from book where bookid=nbookidpack=messagebox(nbookid+"图书已经删除",0+48+0,"提示") endifendifthisform.dis_recordthisform.dis_reccommandthisform.grid1.recordsource = "book"thisform.refresh5.4 保存按钮Click事件程序代码if empty(thisform.text2.value)=messagebox("请输入书名",0+48+0,"出错")thisform.text2.setfocusthisform.refreshreturnendifif empty(thisform.text3.value)=messagebox("请输入书号",0+48+0,"出错") thisform.text3.setfocusthisform.refreshreturnendifif empty(thisform.text4.value)=messagebox("请输入出版社",0+48+0,"出错") thisform.text4.setfocusthisform.refreshreturnendifif empty(thisform.text5.value)=messagebox("请输入作者信息",0+48+0,"出错") thisform.text5.setfocusthisform.refreshreturnendifif empty(bo1.value)=messagebox("请选择图书类型",0+48+0,"出错")bo1.setfocusthisform.refreshreturnendifif thisform.text7.value = 0=messagebox("请输入价格",0+48+0,"出错")bo1.setfocusthisform.refreshreturnendifPRIVATEnbookid,nbookname,nbookno,nbookphouse,nbookwriter,nbook cd,nbookclass,nbookprice,nbookdiscountnbookid = alltrim(thisform.text1.value)nbookname = alltrim(thisform.text2.value)nbookno = alltrim(thisform.text3.value)nbookphouse = alltrim(thisform.text4.value)nbookwriter = alltrim(thisform.text5.value)nbookcd = alltrim(thisform.text6.value)nbookclass = alltrim(bo1.value)nbookprice = thisform.text7.valuenbookdiscount = thisform.text8.value*判断是新记录保存还是修改记录If thisform.newcommand then && newcommand = .t. 是新记录保存*数据表book保存记录insert into book(bookid,bookname,bookno,bookphouse,bookwriter,bookcd,bookclass,bookprice,bookdiscount) values(nbookid,nbookname,nbookno,nbookphouse,nbookwriter,nbookcd,nbookclass,nbookprice,nbookdiscount)=messagebox("保存完毕",0+48+0,"提示")elseupdate book setbookname=nbookname,bookno=nbookno,bookphouse=nbookphouse,bookwriter=nbookwriter,bookcd=nbookcd,bookclass=nbookclass,bookprice=nbookprice,bookdiscount=nbookdiscountwhere bookid=nbookid=messagebox("修改完成",0+48+0,"提示")endif*表单初始化thisform.text2.enabled = .f.thisform.text3.enabled = .f.thisform.text4.enabled = .f.thisform.text5.enabled = .f.thisform.text6.enabled = .f.bo1.enabled = .f.thisform.text7.enabled = .f.thisform.text8.enabled = .f.mand5.enabled = .t.mand6.enabled = .t.mand7.enabled = .t.mand8.enabled = .t.mand9.enabled = .t.mand10.enabled =.f.mand11.enabled =.f.mand12.enabled = .t.thisform.dis_recordthisform.dis_reccommandthisform.newcommand = .f.thisform.refresh5.5 浏览按钮Click事件程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,160 noFLOAT CLOSE nominimize nogrow nozoom systembrow fieldsbookid,bookname,bookno,bookphouse,bookwriter,bookcd,boo kclass,bookprice,bookdiscount window browsewin noappend nomodify nodeleterelease window browsewin会员输入表单KFGL_HYSR.SCX程序代码6.1 自定义过程AUTO_VIPID程序代码select vipset order to vipidgo bottomprivate autoid1,autoid2,autoid3,autoid4autoid1 =alltrim(str(val(substr(alltrim(vip.vipid),2,6))+1,6,0)) autoid2 = len(autoid1)if autoid2 != 6 thenfor n = autoid2 to 5autoid1 = "0" + autoid1endforendifautoid4 = "V" + alltrim(autoid1)thisform.text1.value = autoid46.2 保存按钮Click事件程序代码*输入数据校验if empty(thisform.text2.value)=messagebox("请输入会员姓名",0+16+0,"出错") thisform.text2.setfocusreturnendifif thisform.optiongroup1.value = 0=messagebox("请选择会员性别",0+16+0,"出错") thisform.optiongroup1.option1.setfocus returnelseprivate nvipsexstore "" to nvipsexif thisform.optiongroup1.value = 1store "男" to nvipsexelsestor "女" to nvipsexendifendifif empty(thisform.text4.value)=messagebox("请输入会员联系地址",0+16+0,"出错") thisform.text4.setfocusreturnendifif empty(thisform.text5.value)=messagebox("请输入会员联系电话",0+16+0,"出错") thisform.text5.setfocusreturnendifif empty(thisform.text6.value)=messagebox("请输入邮政编码",0+16+0,"出错") thisform.text6.setfocusreturnendif*保存数据private nvipid,nvipname,nvipadd,nvipphone,nvipcode nvipid = alltrim(thisform.text1.value)nvipname = alltrim(thisform.text2.value)nvipadd = alltrim(thisform.text4.value)nvipphone = alltrim(thisform.text5.value) nvipcode = alltrim(thisform.text6.value)insert into vip(vipid,vipname,vipsex,vipadd,vipphone,vipcode,vipsum,vi pdiscount) values(nvipid,nvipname,nvipsex,nvipadd,nvipphone,nvipcode,0,0) =messagebox("保存成功",0+48+0,"提示")nmesbox=messagebox("是否打印会员卡?",4+32+0,"会员卡打印")if nmesbox = 6selectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphon e,vip.vipcode from vip where vip.vipid = nvipid into cursor vipcardselect vipcardreport form vipcard.frx to printuse in vipcardendifthisform.auto_vipidmand2.click6.3 清除按钮Click事件程序代码thisform.text2.value = ""thisform.optiongroup1.value = 0thisform.text4.value = ""thisform.text5.value = ""thisform.text6.value = ""thisform.text1.setfocusthisform.refresh会员查询表单KFGL_HYCX.SCX程序代码7.1 表单自定义过程DIS_GRID程序代码thisform.grid1.readonly = .t.thisform.grid1.columncount = 8thisform.grid1.column1.header1.caption = "会员编号" thisform.grid1.column1.width = 80thisform.grid1.column1.movable = .f.thisform.grid1.column1.resizable = .f.thisform.grid1.column2.header1.caption = "会员姓名" thisform.grid1.column2.width = 80thisform.grid1.column2.movable = .f.thisform.grid1.column2.resizable = .f.thisform.grid1.column3.header1.caption = "会员性别" thisform.grid1.column3.width = 80thisform.grid1.column3.movable = .f.thisform.grid1.column3.resizable = .f.thisform.grid1.column4.header1.caption = "联系地址"thisform.grid1.column4.width = 250thisform.grid1.column4.movable = .f.thisform.grid1.column4.resizable = .f.thisform.grid1.column5.header1.caption = "联系电话"thisform.grid1.column5.width = 80thisform.grid1.column5.movable = .f.thisform.grid1.column5.resizable = .f.thisform.grid1.column6.header1.caption = "邮政编码"thisform.grid1.column6.width = 80thisform.grid1.column6.movable = .f.thisform.grid1.column6.resizable = .f.thisform.grid1.column7.header1.caption = "累计购书金额"thisform.grid1.column7.width = 80thisform.grid1.column7.movable = .f.thisform.grid1.column7.resizable = .f.thisform.grid1.column8.header1.caption = "会员优惠折扣"thisform.grid1.column8.width = 80thisform.grid1.column8.movable = .f.thisform.grid1.column8.resizable = .f.thisform.refresh7.2 表单Init过程程序代码thisform.dis_gridpublic ncombo1,ncombo2,ntext1,chsql,cxsqlstore "" to ncombo1,ncombo2,ntext1,chsql,cxsqlthisform.optiongroup1.value = 0thisform.optiongroup1.enabled = .f.thisform.grid1.recordsource = Nullselectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphon e,vip.vipcode,vip.vipsum,vip.vipdiscount from vip into cursor hycx_temptable order by vip.vipidthisform.grid1.recordsource = "hycx_temptable"thisform.dis_gridthisform.refresh7.3 表单添加条件按钮Click事件程序代码if empty(bo1.value) .or.empty(bo2.value) .or.empty(thisform.text1.value)=messagebox("请输入条件",0+48+0,"出错")bo1.setfocusreturnendifif thisform.optiongroup1.value = 1chsql = " AND "endifif thisform.optiongroup1.value = 2chsql = " OR "endifchsql = chsql + ncombo1 + ncombo2 + ntext1 thisform.edit1.value = thisform.edit1.value + chsql if .not.empty(thisform.edit1.value)thisform.optiongroup1.value = 1thisform.optiongroup1.enabled = .t.endifbo1.value = ""bo2.value = ""thisform.text1.value = ""chsql = ""bo1.setfocusthisform.refresh7.4 表单条件查询按钮Click事件程序代码if empty(thisform.edit1.value)=messagebox("请输入查询条件",0+16+0,"出错")mand1.setfocusthisform.refreshreturnendifcxsql = alltrim(thisform.edit1.value)thisform.grid1.recordsource = Nullselectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphon e,vip.vipcode,vip.vipsum,vip.vipdiscount from vip where &cxsql into cursor hycx_temptable order by vip.vipid thisform.grid1.recordsource = "hycx_temptable"thisform.dis_gridthisform.optiongroup1.value = 0thisform.optiongroup1.enabled = .f.bo1.value = ""bo2.value = ""thisform.text1.value = ""thisform.edit1.value = ""store "" to ncombo1,ncombo2,ntext1,chsql,cxsqlthisform.refresh会员修改表单KFGL_HYXG.SCX程序代码表单Init过程程序代码LPARAMETERS nPar1select vipset order to vipidlocate for vip.vipid = nPar1 thisform.text1.value = vip.vipid thisform.text2.value = vip.vipname if vip.vipsex = "男"thisform.optiongroup1.value = 1 elsethisform.optiongroup1.value = 2 endifthisform.text4.value = vip.vipadd thisform.text5.value = vip.vipphone thisform.text6.value = vip.vipcode thisform.refresh保存按钮Click事件程序代码*输入数据校验if empty(thisform.text2.value)=messagebox("请输入会员姓名",0+48+0,"出错") thisform.text2.setfocusreturnendifif thisform.optiongroup1.value = 0=messagebox("请选择会员性别",0+48+0,"出错") thisform.optiongroup1.option1.setfocusreturnelseprivate nvipsexstore "" to nvipsexif thisform.optiongroup1.value = 1store "男" to nvipsexelsestor "女" to nvipsexendifendifif empty(thisform.text4.value)=messagebox("请输入会员联系地址",0+48+0,"出错") thisform.text4.setfocusreturnendifif empty(thisform.text5.value)=messagebox("请输入会员联系电话",0+48+0,"出错")thisform.text5.setfocusreturnendifif empty(thisform.text6.value)=messagebox("请输入邮政编码",0+48+0,"出错")thisform.text6.setfocusreturnendif*修改数据private nvipid,nvipname,nvipadd,nvipphone,nvipcodenvipid = alltrim(thisform.text1.value)nvipname = alltrim(thisform.text2.value)nvipadd = alltrim(thisform.text4.value)nvipphone = alltrim(thisform.text5.value)nvipcode = alltrim(thisform.text6.value)update vip set vip.vipname = nvipname, vip.vipsex = nvipsex, vip.vipadd = nvipadd, vip.vipphone = nvipphone, vip.vipcode = nvipcode where vip.vipid = nvipid=messagebox("修改已完成",0+48+0,"提示")thisform.release删除按钮Click事件程序代码nvipid = alltrim(thisform.text1.value)mesbox=messagebox("是否删除" + nvipid + "号会员",4+48+0,"警告")if mesbox=7 thenreturnelseuse vip EXCLUSIVEdelete from vip where vip.vipid = nvipidpack=messagebox("会员" + nvipid + "已经删除",0+48+0,"提示")endifthisform.release会员卡打印表单KFGL_HYDY.SCX程序代码9.1 打印按钮Click事件程序代码if empty(thisform.text1.value)=messagebox("请输入会员编号",0+16+0,"出错")thisform.text1.setfocusreturnelsenvipid = thisform.text1.valueendifnmesbox=messagebox("是否打印会员卡?",4+32+0,"会员卡打印")if nmesbox = 6selectvip.vipid,vip.vipname,vip.vipsex,vip.vipadd,vip.vipphon e,vip.vipcode from vip where vip.vipid = nvipid into cursor vipcardselect vipcardreport form vipcard.frx to printuse in vipcardendif9.2 输入框Text1的Valid事件程序代码this.value = alltrim(this.value)if .not.empty(this.value)select vipgo toplocate for vip.vipid = this.valueif found()thisform.text2.value = vip.vipname thisform.text3.value = vip.vipsex thisform.text4.value = vip.vipadd thisform.text5.value = vip.vipphone thisform.text6.value = vip.vipcodeelse=messagebox("会员编号不存在",0+16+0,"出错") thisform.text1.value = ""thisform.text2.value = ""thisform.text3.value = ""thisform.text4.value = ""thisform.text5.value = ""thisform.text6.value = ""endifendifthisform.refresh采购员管理表单KFGL_CGY.SCX程序代码10.1 表单自定义过程AUTO_BUYERID程序代码select buyerset order to buyeridgo bottomprivate autoid1,autoid2,autoid3,autoid4autoid1 =alltrim(str(val(substr(alltrim(buyer.buyerid),4,2))+1,2 ,0))autoid2 = len(autoid1)if autoid2 =1autoid1 = "0" + autoid1endifautoid4 = "BUY" + alltrim(autoid1)thisform.text1.value = autoid410.2 表单表单保存按钮Click程序代码privatenbuyerid,nbuyername,nbuyersex,nbuyerbirthday,nbuyeradd, nbuyerphoneif empty(thisform.text2.value)=messagebox("请输入采购员姓名",0+48+0,"出错")thisform.text2.setfocusthisform.refreshreturnendifif thisform.optiongroup1.value = 0=messagebox("请选择采购员性别",0+48+0,"出错") thisform.optiongroup1.option1.setfocus thisform.refreshreturnendifif thisform.text3.value = {}=messagebox("请输入出生年月",0+48+0,"出错") thisform.text3.setfocusthisform.refreshreturnendifif empty(thisform.text4.value) then=messagebox("请输入家庭住址",0+48+0,"出错") thisform.text4.setfocusthisform.refreshreturnendifif empty(thisform.text5.value) then=messagebox("请输入联系电话",0+48+0,"出错") thisform.text5.setfocusthisform.refreshreturnendifnbuyerid = alltrim(thisform.text1.value)nbuyername = alltrim(thisform.text2.value)if thisform.optiongroup1.value = 1nbuyersex = "男"elsenbuyersex = "女"endifnbuyerbirthday = dtoc(thisform.text3.value)nbuyeradd = alltrim(thisform.text4.value)nbuyerphone = alltrim(thisform.text5.value)*判断是新记录保存还是修改记录If thisform.newcommand = .t. && newcommand = .t. 是新记录保存*数据表buyer保存记录insert intobuyer(buyerid,buyername,buyersex,buyerbirthday,buyeradd ,buyerphone) values(nbuyerid,nbuyername,nbuyersex,nbuyerbirthday,nbuyeradd ,nbuyerphone)=messagebox("保存完毕",0+48+0,"提示")elseupdate buyer setbuyername=nbuyername,buyersex=nbuyersex,buyerbirthday=n buyerbirthday,buyeradd=nbuyeradd,buyerphone=nbuyerphone where buyerid=nbuyerid=messagebox("修改完成",0+48+0,"提示")endif*表单初始化thisform.text1.enabled = .f.thisform.text2.enabled = .f.thisform.optiongroup1.enabled = .f.thisform.text3.enabled = .f.thisform.text4.enabled = .f.thisform.text5.enabled = .f.mand1.enabled = .t.mand2.enabled = .t.mand3.enabled = .t.mand4.enabled = .t.mand5.enabled = .t.mand6.enabled = .t.mand7.enabled = .t.mand8.enabled = .t.mand9.enabled = .t.mand10.enabled =.f.mand11.enabled =.f.mand12.enabled = .t.thisform.dis_recordthisform.dis_reccommandthisform.newcommand = .f.thisform.refresh10.3 表单删除按钮Click程序代码if reccount("buyer")=1 then=messagebox("只有一条记录,不能删除",0+16+0,"出错") returnelsenbuyerid = alltrim(thisform.text1.value)nbuyername = alltrim(thisform.text2.value)mesbox=messagebox("是否删除"+nbuyerid+"号采购员"+nbuyername,4+48+0,"警告")if mesbox=7 thenreturnelseuse buyer EXCLUSIVEdelete from buyer where buyer.buyerid=nbuyeridpack=messagebox(nbuyerid+"号采购员"+nbuyername+"已经删除",0+48+0,"提示")endifendifthisform.dis_recordthisform.dis_reccommandthisform.refresh10.4 表单浏览按钮Click程序代码DEFINE WINDOW browsewin FROM 1,1 TO 30,120 noFLOAT CLOSE nominimize nogrow nozoom systemselect buyerset order to buyeridbrow fieldsbuyerid,buyername,buyersex,buyerbirthday,buyeradd,buyer phone window browsewin noappend nomodify nodeleterelease window browsewin10.5 表单自定义过程DIS_RECORD程序代码select buyerset order to buyeridif reccount("buyer") = 0thisform.text1.value = ""thisform.text2.value = ""thisform.optiongroup1.value = 0thisform.text3.value = {}thisform.text4.value = ""thisform.text5.value = ""elsethisform.text1.value = buyer.buyerid thisform.text2.value = buyer.buyernameif buyer.buyersex = "男"thisform.optiongroup1.value = 1elsethisform.optiongroup1.value = 2endifthisform.text3.value = buyer.buyerbirthday thisform.text4.value = buyer.buyeraddthisform.text5.value = buyer.buyerphoneendifthisform.refresh采购员信息查找表单KFGL_CGY_CZ.SCX程序代码11.1 表单查找按钮Click事件程序代码if thisform.optiongroup1.value = 1 .and. empty(thisform.text1.value)=messagebox("请输入采购员编号",0+16+0,"出错") thisform.text1.setfocusreturnendifif thisform.optiongroup1.value = 2 .and. empty(thisform.text2.value)=messagebox("请输入采购员姓名",0+16+0,"出错") thisform.text2.setfocusreturnendifif thisform.optiongroup1.value = 0=messagebox("请选择条件",0+16+0,"出错")thisform.optiongroup1.option1.setfocusreturnendifselect buyerset order to buyeridgo topif thisform.optiongroup1.value = 1locate for buyerid == alltrim(thisform.text1.value) if .not.found()=messagebox("没有附和条件记录",0+16+0,"出错") thisform.text1.setfocusreturnendifelselocate for buyername = alltrim(thisform.text2.value) if .not.found()=messagebox("没有附和条件记录",0+16+0,"出错") thisform.text2.setfocusreturnendifendifcggl_cgy.dis_recordcggl_cgy.dis_reccommandcggl_cgy.refresh thisform.release。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

超市商品管理系统源代码import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class sale2 extends JFrame implements ActionListener //销售界面{private JPanel sM=new JPanel();//supermarket面板JLabel label1,label2;JTextField field1,field2;JButton button1,button2;String num=null,name=null,time=null,add=null,t1=null,t2=null,t3=null;int price=0,countBG,n1;// 价格/商品的卖出数量private JTextArea goodsShow=new JTextArea();//文本区private JScrollPane jsp=new JScrollPane(goodsShow); //滚动区域设定内容为商品显示的文本区private JButton[] pS={new JButton(&quot;销售界面&quot;),new JButton(&quot;销售管理&quot;),new JButton(&quot;商品管理&quot;),new JButton(&quot;用户管理&quot;)};//personty 按钮private JLabel[] CD={new JLabel(&quot;清单号&quot;,JLabel.CENTER),new JLabel(&quot;编号&quot;,JLabel.CENTER),new JLabel(&quot;名称&quot;,JLabel.CENTER),new JLabel(&quot;价格&quot;,JLabel.CENTER),new JLabel(&quot;生产日期&quot;,JLabel.CENTER),new JLabel(&quot;产地&quot;,JLabel.CENTER),new JLabel(&quot;数量&quot;,JLabel.CENTER)};//帐单查询时的商品显示标签public sale2(){label1=new JLabel(&quot;按编号查询&quot;,JLabel.CENTER);label2=new JLabel(&quot;按帐单查询&quot;,JLabel.CENTER);field1=new JTextField(30);field2=new JTextField(30);button1=new JButton(&quot;查询1&quot;);button2=new JButton(&quot;查询2&quot;);sM.setLayout(null);field1.setBounds(100,120,150,22);field2.setBounds(600,120,150,22);label1.setBounds(100,90,150,30);label2.setBounds(600,90,150,30);button1.setBounds(260,120,80,22);button2.setBounds(760,120,80,22);button1.addActionListener(this);button2.addActionListener(this);sM.add(label1);sM.add(label2);sM.add(field1);sM.add(field2);sM.add(button1);sM.add(button2);for(int i=0;i&lt;4;i++){pS[i].setBounds(550+i*110,50,100,22); sM.add(pS[i]);pS[i].addActionListener(this);}for(int i=0;i&lt;7;i++)//6个标签的绘制{CD[i].setBounds(100+i*115,160,115,20); sM.add(CD[i]);}jsp.setBounds(100,180,800,500); goodsShow.setLineWrap(true); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);}});sM.add(jsp);this.add(sM);this.setTitle(&quot;销售窗口&quot;); this.setResizable(false);this.setBounds(0,0,1024,768);this.setVisible(true);}public void actionPerformed(ActionEvent p)Connection con,con1;Statement sql,sql1;String url = &quot;jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\supermarket.mdb&quot;;ResultSet rs,rs1;if (p.getSource()==button1){String num=field1.getText();try{ Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);}catch (ClassNotFoundException f){System.out.println(&quot;&quot;+f);}try{con=DriverManager.getConnection(url);sql=con.createStatement();rs=sql.executeQuery(&quot;SELECT count(goodsnum) FROM information where goodsnum=&#39;&quot;+num+&quot;&#39;&quot;);while(rs.next()){countBG=rs.getInt(1);System.out.println(countBG);}rs=sql.executeQuery(&quot;SELECT * FROM goods where num=&#39;&quot;+num+&quot;&#39;&quot;);while(rs.next()){name=rs.getString(2);price=rs.getInt(3);time=rs.getString(4);add=rs.getString(5);n1=1;}con.close();catch (SQLException g){System.out.println(g);}if (n1==1){ goodsShow.append(&quot; (物品销售量查询)&quot;+num+&quot; &quot;+name+&quot; &quot;+price+&quot; &quot;+time+&quot; &quot;+add+&quot; &quot;+countBG+&quot;\n&quot;);n1=0;}else{//goodsShow.setText(&quot; &quot;);num=null;name=null;price=0;time=null;add=null;JOptionPane.showMessageDialog(this,&quot; 输入错误\n 请重新输入&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE);}}if(p.getSource()==pS[0]){View2 frame=new View2();dispose();}if(p.getSource()==pS[2]){Frm_Main frame=new Frm_Main();dispose();}if(p.getSource()==pS[3]){View3 frame=new View3();dispose();}if (p.getSource()==button2){String numb=field2.getText();int num=Integer.parseInt(numb);try{ Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);catch (ClassNotFoundException f){System.out.println(&quot;&quot;+f);}try{con=DriverManager.getConnection(url);sql=con.createStatement();rs=sql.executeQuery(&quot;SELECT goodsnum,count(goodsnum) FROM information where listnum=&quot;+num+&quot; group by goodsnum&quot;);while(rs.next()){ con1=DriverManager.getConnection(url);sql1=con1.createStatement();String number=rs.getString(1);countBG=rs.getInt(2);System.out.println(countBG+number+name+time+price+add);rs1=sql1.executeQuery(&quot;SELECT * FROM goods where num=&#39;&quot;+number+&quot;&#39;&quot;);while (rs1.next()){name=rs1.getString(2);price=rs1.getint(3);time=rs1.getString(4);add=rs1.getString(5);goodsShow.append(&quot; &quot;+num+&quot; &quot;+number+&quot; &quot;+name+&quot; &quot;+price+&quot; &quot;+time+&quot; &quot;+add+&quot; &quot;+countBG+&quot;\n&quot;);}con1.close();}con.close();}catch (SQLException g){System.out.println(g);}//{//goodsShow.setText(&quot; &quot;);//num=null;name=null;price=0;time=null;add=null;//JOptionPane.showMessageDialog(this,&quot;输入错误\n 请重新输入&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE);// }}}}public class View2 extends JFrame implements ActionListener //销售界面{String num=null,name=null,time=null,add=null,t1=null,t2=null,t3=null;int price=0;int n1,n2,ap,n3;private JPanel sM=new JPanel(); //supermarket面板private JButton[] pS={new JButton(&quot;销售界面&quot;),new JButton(&quot;销售管理&quot;), new JButton(&quot;商品管理&quot;),new JButton(&quot;权限管理&quot;)};//personty 按钮private JTextArea goodsShow=new JTextArea(), searchShow=new JTextArea(); //文本区private JScrollPane jsp=new JScrollPane(goodsShow); //滚动区域设定内容为商品显示的文本区private JTextField numSearch=new JTextField(),showGoods=new JTextField(); //商品查询/显示商品private JButton searchGoods=new JButton(&quot;搜索&quot;),buyGoods=new JButton(&quot;购买&quot;),clean=new JButton(&quot;清空&quot;), ok=new JButton(&quot;提交&quot;),print=new JButton(&quot;打印并提交&quot;); //查询按钮private JLabel[] goodsInformation={new JLabel(&quot;商品编码&quot;,JLabel.CENTER),new JLabel(&quot;商品名称&quot;,JLabel.CENTER),new JLabel(&quot;商品价格&quot;,JLabel.CENTER),new JLabel(&quot;生产日期&quot;,JLabel.CENTER),new JLabel(&quot;生产地&quot;,JLabel.CENTER) };private JLabel[] goodsI={new JLabel(&quot;商品编码&quot;,JLabel.CENTER),new JLabel(&quot;商品名称&quot;,JLabel.CENTER),new JLabel(&quot;商品价格&quot;,JLabel.CENTER),new JLabel(&quot;生产日期&quot;,JLabel.CENTER),new JLabel(&quot;生产地&quot;,JLabel.CENTER) } ;private JLabel allPrice=new JLabel(&quot;商品总价:\n &quot;,JLabel.LEFT),label1=new JLabel(&quot;商品信息&quot;,JLabel.RIGHT),label2=new JLabel(&quot;购物信息&quot;,JLabel.RIGHT);public View2(){sM.setLayout(null);for(int i=0;i&lt;4;i++){pS[i].setBounds(550+i*110,50,100,22);sM.add(pS[i]);pS[i].addActionListener(this);}jsp.setBounds(100,180,800,500);goodsShow.setLineWrap(true);numSearch.setBounds(100,50,150,22); searchGoods.setBounds(260,50,60,22); searchGoods.addActionListener(this);buyGoods.setBounds(330,50,60,22);buyGoods.addActionListener(this);showGoods.setBounds(100,120,800,22);for (int b=0;b&lt;5 ;b++ ){goodsInformation[b].setBounds(100+160*b,87,160,30); sM.add(goodsInformation[b]);}for (int b=0;b&lt;5 ;b++ ){goodsI[b].setBounds(100+160*b,150,160,30);sM.add(goodsI[b]);}clean.setBounds(100,690,100,22);clean.addActionListener(this);ok.setBounds(690,690,100,22);ok.addActionListener(this);print.setBounds(800,690,100,22);print.addActionListener(this);allPrice.setBounds(900,480,100,50);label1.setBounds(20,120,80,22);label2.setBounds(20,180,80,22);sM.add(label1);sM.add(label2);sM.add(allPrice);sM.add(print);sM.add(ok);sM.add(showGoods);sM.add(clean);sM.add(numSearch);sM.add(searchGoods);sM.add(buyGoods);sM.add(jsp);addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e) {Connection con;Statement sql;ResultSet rs;try{if (n3!=0){int a1=0;con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;); sql=con.createStatement();rs=sql.executeQuery(&quot;SELECT MAX(编号) from information&quot;);while(rs.next()){a1=rs.getInt(1);}for (int i=0;i&lt;n3 ;i++ ){sql.executeUpdate(&quot;delete from information where 编号=&quot;+(a1-i));}con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);}}catch (SQLException g){System.out.println(g);}System.exit(0);}});this.add(sM);this.setTitle(&quot;销售窗口&quot;);this.setResizable(false);this.setBounds(0,0,1024,768);this.setVisible(true);validate();}if(p.getSource()==buyGoods) //购买按键try{if (num!=null){con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;);sql=con.createStatement();sql.executeUpdate(&quot;insert into information(listnum,goodsnum) values(&#39;&quot;+n2+&quot;&#39;,&#39;&quot;+num+&quot;&#39;)&quot;);rs=sql.executeQuery(&quot;SELECT * FROM information where listnum=&quot;+n2);n3++;//记录购买商品个数con.close();goodsShow.append(&quot; &quot;+num+&quot; &quot;+name+&quot;&quot;+price+&quot; &quot;+time+&quot; &quot;+add+&quot;\n&quot;); }else{JOptionPane.showMessageDialog(this,&quot;请选择商品&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE);}ap=ap+price;//总价allPrice.setText(&quot;商品总价:\n&quot;+ap);}catch (SQLException g){System.out.println(g);}}if(p.getSource()==ok){try{if (n3!=0){con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;);sql=con.createStatement();sql.executeUpdate(&quot;insert into information(listnum,allprice) values(&#39;&quot;+n2+&quot;&#39;,&#39;&quot;+ap+&quot;&#39;)&quot;);rs=sql.executeQuery(&quot;SELECT * FROM information where listnum=&quot;+n2);con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);n2++;//帐单号}{JOptionPane.showMessageDialog(this,&quot;请购买商品&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE);}}catch (SQLException g){System.out.println(g);}}if(p.getSource()==print){try{if (n3!=0){con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;);sql=con.createStatement();sql.executeUpdate(&quot;insert into information(listnum,allprice) values(&#39;&quot;+n2+&quot;&#39;,&#39;&quot;+ap+&quot;&#39;)&quot;);rs=sql.executeQuery(&quot;SELECT * FROM informationwhere listnum=&quot;+n2);con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);n2++;//帐单号}else{JOptionPane.showMessageDialog(this,&quot;请购买商品&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE);}}catch (SQLException g){System.out.println(g);}}if(p.getSource()==clean){ try{ if (n3!=0){ int a1=0;con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;);sql=con.createStatement();rs=sql.executeQuery(&quot;SELECT MAX(编号) from information&quot;);while(rs.next()) {a1=rs.getInt(1);}for (int i=0;i&lt;n3 ;i++ ){ sql.executeUpdate(&quot;delete from information where 编号=&quot;+(a1-i)); } con.close();ap=0;num=null;name=null;price=0;time=null;add=null;n3=0;goodsShow.setText(null);}}catch (SQLException g){System.out.println(g);} }public class Login extends Frame implements ActionListener,WindowListener //登陆界面{public int screanWidth,screanHeight;String idin=null;String keyin=null;String passwordD=null;public static String persontyD=null;MenuBar menubar;Menu menu;MenuItem quet,help;Label id,key;TextField idtf,keytf;Box boxV1,boxV2,boxV3,baseBox,boxx;Button enterB;Login(){ setTitle(&quot;超市管理系统登陆界面&quot;);Toolkit tool=getToolkit();Dimension dim=tool.getScreenSize();screanWidth=dim.width;screanHeight=dim.height;setBounds(dim.width/3,dim.height/3,320,215);menubar=new MenuBar();menu=new Menu(&quot;功能&quot;);help=new MenuItem(&quot;帮助&quot;);quet=new MenuItem(&quot;退出&quot;);quet.setShortcut(new MenuShortcut(KeyEvent.VK_E));quet.addActionListener(new ActionListener() //匿名类实例控制{public void actionPerformed(ActionEvent p){System.exit(0);}} );menu.add(help);menu.add(quet);menubar.add(menu);setMenuBar(menubar);id=new Label(&quot;请输入帐号:&quot;,Label.RIGHT); key=new Label(&quot;请输入密码:&quot;,Label.RIGHT); idtf=new TextField(10);keytf=new TextField(10);keytf.setEchoChar(&#39;*&#39;);enterB=new Button(&quot;登陆&quot;);boxV1=Box.createVerticalBox();boxV1.add(Box.createVerticalStrut(35));boxV1.add(id);boxV1.add(Box.createVerticalStrut(15));boxV1.add(key);boxV1.add(Box.createVerticalStrut(15));boxV2=Box.createVerticalBox();boxV2.add(Box.createVerticalStrut(35));boxV2.add(idtf);boxV2.add(Box.createVerticalStrut(15));boxV2.add(keytf);boxV2.add(Box.createVerticalStrut(15));baseBox=Box.createHorizontalBox();baseBox.add(Box.createHorizontalStrut(25)); baseBox.add(boxV1);baseBox.add(Box.createHorizontalStrut(5));baseBox.add(boxV2);baseBox.add(Box.createHorizontalStrut(70));boxV3=Box.createHorizontalBox();boxV3.add(Box.createHorizontalStrut(125));boxV3.add(enterB);boxV3.add(Box.createHorizontalStrut(125));boxx=Box.createVerticalBox();boxx.add(baseBox);boxx.add(Box.createVerticalStrut(15)); boxx.add(boxV3);boxx.add(Box.createVerticalStrut(70));add(boxx);enterB.addActionListener(this);addWindowListener(this);setResizable(false);setVisible(true);}public void actionPerformed(ActionEvent e){Connection con;Statement sql;ResultSet rs;if (e.getSource()==enterB){idin=idtf.getText();keyin=keytf.getText();try{ Class.forName(&quot;sun.jdbc.odbc.JdbcOdbcDriver&quot;);}catch (ClassNotFoundException f){System.out.println(&quot;&quot;+f);}try{con=DriverManager.getConnection(&quot;jdbc:odbc:q&quot;,&quot;&quot;,&quot;&quot;);sql=con.createStatement();rs=sql.executeQuery(&quot;SELECT * FROM password where ID=&#39;&quot;+idin+&quot;&#39;&quot;);while(rs.next()){passwordD=rs.getString(2);persontyD=rs.getString(3);}con.close();}catch (SQLException g){System.out.println(g);}if (keyin.equals(passwordD)){View2 frame=new View2();this.setVisible(false); }else {JOptionPane.showMessageDialog(this,&quot; 帐户或密码错误\n 请重新输入&quot;,&quot;提示&quot;,JOptionPane.WARNING_MESSAGE); }}}public void windowActivated(WindowEvent o){validate();}public void windowDeactivated(WindowEvent o){setBounds(screanWidth/3,screanHeight/3,320,215);validate();}public void windowClosing(WindowEvent o){dispose();}public void windowClosed(WindowEvent o){System.exit(0);}public void windowIconified(WindowEvent o){}public void windowDeiconified(WindowEvent o){setBounds(screanWidth/3,screanHeight/3,320,215);validate();}public void windowOpened(WindowEvent o){} }。

相关文档
最新文档