北大青鸟第一单元超市收银管理系统.docx

上传人:b****5 文档编号:3196398 上传时间:2022-11-20 格式:DOCX 页数:52 大小:43.80KB
下载 相关 举报
北大青鸟第一单元超市收银管理系统.docx_第1页
第1页 / 共52页
北大青鸟第一单元超市收银管理系统.docx_第2页
第2页 / 共52页
北大青鸟第一单元超市收银管理系统.docx_第3页
第3页 / 共52页
北大青鸟第一单元超市收银管理系统.docx_第4页
第4页 / 共52页
北大青鸟第一单元超市收银管理系统.docx_第5页
第5页 / 共52页
点击查看更多>>
下载资源
资源描述

北大青鸟第一单元超市收银管理系统.docx

《北大青鸟第一单元超市收银管理系统.docx》由会员分享,可在线阅读,更多相关《北大青鸟第一单元超市收银管理系统.docx(52页珍藏版)》请在冰豆网上搜索。

北大青鸟第一单元超市收银管理系统.docx

北大青鸟第一单元超市收银管理系统

包结构

四个包,九个类,一个资源文件

客户端类

packagecom.supermarket.Client;

/**

*客户端界面

*/

importjava.text.SimpleDateFormat;

importjava.util.ArrayList;

importjava.util.Date;

importjava.util.Scanner;

importcom.supermarket.Tools.Datas;

importcom.supermarket.Tools.SysConstans;

importcom.supermarket.entity.Goods;

publicclassClient{

//定义扫描器,用于键盘输入

publicstaticScannerinput=newScanner(System.in);

//创建客户端业务类对象,调用方法

publicstaticClientBcb=newClientB();

publicstaticvoidmain(String[]args){

do{

System.out.println("***********欢迎使用青鸟超市系统*************");

System.out.println("1.登录"+"\n2.退出");

System.out.println("***********请选择1/2*************");

Stringchoice=input.next();

if(choice.equals("1")){

//登录视图

createLoginView();

break;

}

elseif(choice.equals("2")){

//退出

System.exit(0);

}

else{

//输入有误,报错

System.out.println("无此选项!

");

}

}while(true);

System.out.println("***********谢谢使用青鸟超市系统*************");

}

/**

*登录视图

*通过输入的用户名与密码验证用户身份,管理员则进入管理界面,收银员则进入收银界面,都不是则提示错误,并重新进行输入

*/

publicstaticvoidcreateLoginView(){

do{

//提示登录信息

System.out.println("请输入用户名:

");

Stringname=input.next();

System.out.println("请输入密码:

");

Stringpassword=input.next();

//调用客户端登录方法,接收返回值,判断登录者的身份

Datasdatas=cb.doLogin(name,password);

//判断是管理员还是收银员

if(datas.getFlag().equals(SysConstans.SYS_ADMIN)){

createAdminView();

break;

}elseif(datas.getFlag().equals(SysConstans.SYS_CASHIER)){

createCashierView();

break;

}else{

System.out.println("用户名或密码有误,请重新输入");

}

}while(true);

}

/**

*管理员菜单

*实现管理员功能:

*1.商品入库2.商品出库3.新增商品4.查询全部商品5.按编号查询商品6.退出

*/

privatestaticvoidcreateAdminView(){

//循环操作

//管理员菜单

System.out.println("管理员登录成功,进入管理员界面");

do{

System.out.println("***********欢迎进入青鸟超市库存管理系统*************");

System.out.println("1.商品入库\t2.商品出库\t3.新增商品\t4.查询全部商品\t5.按序号查询商品\t6.退出");

//提示用户选择

System.out.println("请输入您的选择");

intchoice=input.nextInt();

switch(choice){

//商品入库,调入库方法

case1:

//提示输入要入库的编号

System.out.println("请输入入库商品编号:

");

//定义变量接收输入的编号

Stringgoodnum=input.next();

//调用方法判断库存中是否有要入库的商品

if(cb.Find(goodnum).getFlag().equals(SysConstans.SYS_SUCCESS)){

System.out.println("请输入入库数量:

");

intcount=input.nextInt();

if(count>=0){

Datasdatas=cb.RuKu(goodnum,count);

if(datas.getFlag().equals(SysConstans.SYS_SUCCESS)){

System.out.println("入库成功!

");

showList(cb.FindAll());

}

}else{

System.out.println("入库数量必须大于0");

}

}else{

System.out.println("无此商品,请选择3新增");

}

break;

//商品出库,调出库方法

case2:

do{//提示输入出库商品编号

System.out.println("请选择出库商品编号:

");

//定义变量接收编号

Stringgoodid=input.next();

//先查询是否由此商品

if(cb.Find(goodid).getFlag().equals(SysConstans.SYS_SUCCESS)){

//提示输入出库数量

System.out.println("请输入出库数量:

");

intcount=input.nextInt();

if(count>0){

Datasdatas=cb.ChuKu(goodid,count);

if(datas.getFlag().equals(SysConstans.SYS_LACK)){

System.out.println("库存不足!

");

showGood(datas);

break;

}else{

System.out.println("出库成功!

");

showList(datas);

break;

}

}else{

System.out.println("出库数量必须大于0!

");

}

}else{

System.out.println("库存中无此商品,请选择3新增");

break;

}

}while(true);

break;

case3:

//新增商品,调新增方法

do{//提示输入新增商品编号

System.out.println("请输入新增商品的编号:

");

Stringnewgoodid=input.next();

if(cb.Find(newgoodid).getFlag().equals(SysConstans.SYS_SUCCESS)){

System.out.println("商品已存在");

break;

}

else{

System.out.println("请输入商品名称:

");

Stringname=input.next();

System.out.println("请输入商品单价:

");

doubleprice=input.nextDouble();

System.out.println("请输入商品单位:

");

Stringunit=input.next();

System.out.println("请输入商品数量:

");

intcount=input.nextInt();

Goodsgood=newGoods(newgoodid,(name+"\t"),price,unit,count);

//把要新增的商品通过调用方法传给业务类,并接收返回值

Datasdatas=cb.Add(good);

System.out.println("新增商品成功!

");

//打印商品列表

showList(cb.FindAll());

break;

}

}while(true);

break;

//查询全部商品的方法

case4:

//查询商品,调用showList方法参数为Datas类型,是FindAll传回来的

showList(cb.FindAll());

break;

//按编号查询商品,调按编号查询方法

case5:

//提示输入编号

System.out.println("请输入要查询的编号:

");

//定义变量接收输入

Stringid=input.next();

//判断库存中是否存在编号为goodid的商品

Datasdatas=cb.Find(id);

//如果存在,调用方法,打印商品

if(datas.getFlag().equals(SysConstans.SYS_SUCCESS)){

showGood(datas);

}else{

System.out.println("没有此商品");

}

break;

case6:

//退出

System.out.println("管理员退出成功!

");

System.exit(0);

default:

//提示无此选项

System.out.println("无此选项,请重新输入:

");

}

}while(

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

当前位置:首页 > 幼儿教育 > 唐诗宋词

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1