首页 > 其他分享 >9.4

9.4

时间:2023-09-04 21:46:15浏览次数:37  
标签:scanner String warehouseInformation System println 9.4 out

public class WarehouseInformation {
private String itemno; //商品编号
private String itemname; //商品名称
private String suppliername; //供货商名称
private String warehousingtime; //入库时间
private String shipmenttime; //出库时间
private String warehousenumber; //仓库编号
private String warehouseplace; //存放商品的具体位置
private int itemnumber; //入库商品的数量
private int outnumber; //出库商品的数量

public String getItemno() {
return itemno;
}

public void setItemno(String itemno) {
this.itemno = itemno;
}

public String getItemname() {
return itemname;
}

public void setItemname(String itemname) {
this.itemname = itemname;
}

public String getSuppliername() {
return suppliername;
}

public void setSuppliername(String suppliername) {
this.suppliername = suppliername;
}

public String getWarehousingtime() {
return warehousingtime;
}

public void setWarehousingtime(String warehousingtime) {
this.warehousingtime = warehousingtime;
}

public String getShipmenttime() {
return shipmenttime;
}

public void setShipmenttime(String shipmenttime) {
this.shipmenttime = shipmenttime;
}

public String getWarehousenumber() {
return warehousenumber;
}

public void setWarehousenumber(String warehousenumber) {
this.warehousenumber = warehousenumber;
}

public String getWarehouseplace() {
return warehouseplace;
}

public void setWarehouseplace(String warehouseplace) {
this.warehouseplace = warehouseplace;
}

public int getItemnumber() {
return itemnumber;
}

public void setItemnumber(int itemnumber) {
this.itemnumber = itemnumber;
}

public int getOutnumber() {
return outnumber;
}

public void setOutnumber(int outnumber) {
this.outnumber = outnumber;
}

public void setInitialValues(String itemno, String itemname, String suppliername, String warehousingtime, String shipmenttime, String warehousenumber, String warehouseplace, int itemnumber, int outnumber) {
this.itemno = itemno;
this.itemname = itemname;
this.suppliername = suppliername;
this.warehousingtime = warehousingtime;
this.shipmenttime = shipmenttime;
this.warehousenumber = warehousenumber;
this.warehouseplace = warehouseplace;
this.itemnumber = itemnumber;
this.outnumber = outnumber;
}
import java.util.Scanner;
public class WarehouseManagement {



static int nnum=0;

public static void main(String[] args) {

WarehouseInformation[] warehouseInformations=new WarehouseInformation[5];
WarehouseInformation warehouseInformation1=new WarehouseInformation();
warehouseInformation1.setItemno("20224085");
warehouseInformation1.setItemname("华为笔记本电脑");
warehouseInformation1.setSuppliername("河北省正大光明有限公司");
warehouseInformation1.setWarehousenumber("003");
warehouseInformation1.setWarehouseplace("0180350");
warehouseInformation1.setItemnumber(100);
warehouseInformation1.setOutnumber(0);

WarehouseInformation warehouseInformation2 = new WarehouseInformation();
warehouseInformation2.setItemno("20224086");
warehouseInformation2.setItemname("Apple iPhone");
warehouseInformation2.setSuppliername("Guangdong Xinrui Technology Co., Ltd.");
warehouseInformation2.setWarehousenumber("004");
warehouseInformation2.setWarehouseplace("0180351");
warehouseInformation2.setItemnumber(50);
warehouseInformation2.setOutnumber(10);

WarehouseInformation warehouseInformation3 = new WarehouseInformation();
warehouseInformation3.setItemno("20224087");
warehouseInformation3.setItemname("Samsung Tablet");
warehouseInformation3.setSuppliername("Shanghai Letian Electronics Co., Ltd.");
warehouseInformation3.setWarehousenumber("005");
warehouseInformation3.setWarehouseplace("0180352");
warehouseInformation3.setItemnumber(80);
warehouseInformation3.setOutnumber(20);

WarehouseInformation warehouseInformation4 = new WarehouseInformation();
warehouseInformation4.setItemno("20224088");
warehouseInformation4.setItemname("Huawei Smartphone");
warehouseInformation4.setSuppliername("Beijing Zhongxing Technology Co., Ltd.");
warehouseInformation4.setWarehousenumber("006");
warehouseInformation4.setWarehouseplace("0180353");
warehouseInformation4.setItemnumber(120);
warehouseInformation4.setOutnumber(50);

WarehouseInformation warehouseInformation5 = new WarehouseInformation();
warehouseInformation5.setItemno("20224089");
warehouseInformation5.setItemname("Xiaomi TV");
warehouseInformation5.setSuppliername("Zhejiang Rongyao Electronics Co., Ltd.");
warehouseInformation5.setWarehousenumber("007");
warehouseInformation5.setWarehouseplace("0180354");
warehouseInformation5.setItemnumber(60);
warehouseInformation5.setOutnumber(30);
warehouseInformations[0]=warehouseInformation1;
warehouseInformations[1]=warehouseInformation2;
warehouseInformations[2]=warehouseInformation3;
warehouseInformations[3]=warehouseInformation4;
warehouseInformations[4]=warehouseInformation5;



Scanner scanner=new Scanner(System.in);
while (true){
pzmu();
System.out.println("请输入数字选择功能:");
int option=scanner.nextInt();
if(option==1){
addcommodity(warehouseInformations,scanner);
}
else if(option==2){
changemod(warehouseInformations,scanner);
}
else if(option==3){
ckmannger(warehouseInformations,scanner);
}
else if(option==4){
showgoods(warehouseInformations);
}
else{
System.out.println("该选项不存在");
}
}

}


private static void showgoods(WarehouseInformation[] warehouseInformations) {
pzno();
for (int i=0;i< warehouseInformations.length;i++){
System.out.println((i+1)+"、商品编号:"+warehouseInformations[i].getItemno()+"、 商品名称:"+warehouseInformations[i].getItemname()+"、 库存数量:"+(warehouseInformations[i].getItemnumber()-warehouseInformations[i].getOutnumber()));


}

System.out.println("………………………………………………….");

System.out.println("**********************************************************");

}

private static void ckmannger(WarehouseInformation[] warehouseInformations, Scanner scanner) {
pzno();
String is=new String(); //可能出错
System.out.println("请输入商品编号:");
String itemno=scanner.next();
WarehouseInformation warehouseInformation=findmod(warehouseInformations,itemno);
if(warehouseInformation==null){
System.out.println("库中没有该商品");
return;
}
System.out.println("1.商品编号:"+warehouseInformation.getItemno());
System.out.println("2.商品名称:"+warehouseInformation.getItemname());
System.out.println("3.供货商信息:"+warehouseInformation.getSuppliername());
System.out.println("4.入库时间:"+warehouseInformation.getWarehousingtime());
System.out.println("5.存放仓库号:"+warehouseInformation.getWarehousenumber());
System.out.println("6.存放位置信息:"+warehouseInformation.getWarehouseplace());
System.out.println("7.入库商品数量:"+warehouseInformation.getItemnumber());

System.out.println("请输入出库时间:");
String outtime=scanner.next();
System.out.println("请输入出库数量:");
int outnumber=scanner.nextInt();
if(outnumber>warehouseInformation.getItemnumber()){
System.out.println("超过入库数量!");
return;
}else {
System.out.println("是否保存(y/n):");
String ism=scanner.next();
if(ism.equalsIgnoreCase("Y")){
warehouseInformation.setOutnumber(outnumber);
warehouseInformation.setShipmenttime(outtime);
System.out.println("保存成功!");
return;
}
else{
return;
}
}
}

private static void changemod(WarehouseInformation[] warehouseInformations, Scanner scanner) {
while (true) {
pzno();
String is = new String(); //可能出错
System.out.println("请输入商品编号:");
String itemno = scanner.next();
WarehouseInformation warehouseInformation = findmod(warehouseInformations, itemno);
if (warehouseInformation == null) {
System.out.println("库中没有该商品");
continue;
}
System.out.println("1.商品编号:" + warehouseInformation.getItemno());
System.out.println("2.商品名称:" + warehouseInformation.getItemname());
System.out.println("3.供货商信息:" + warehouseInformation.getSuppliername());
System.out.println("4.入库时间:" + warehouseInformation.getWarehousingtime());
System.out.println("5.存放仓库号:" + warehouseInformation.getWarehousenumber());
System.out.println("6.存放位置信息:" + warehouseInformation.getWarehouseplace());
System.out.println("7.入库商品数量:" + warehouseInformation.getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):");
int judge = scanner.nextInt();
if (judge == 1) {
System.out.println("请输入修改后的商品编号");
String no = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setItemno(no);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 2) {
System.out.println("请输入修改后的商品名称:");
String mname = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setItemname(mname);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 3) {
System.out.println("请输入修改后的供货商信息:");
String supname = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setSuppliername(supname);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 4) {
System.out.println("请输入修改后的入库时间:");
String intime = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setWarehousingtime(intime);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 5) {
System.out.println("请输入修改后的存放仓库号:");
String hosenumber = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setWarehousenumber(hosenumber);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 6) {
System.out.println("请输入修改后的存放位置信息:");
String place = scanner.next();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setWarehouseplace(place);
System.out.println("保存成功!");
return;
} else {
return;
}
}
if (judge == 7) {
System.out.println("请输入修改后的商品数量:");
int num = scanner.nextInt();
System.out.println("是否保存(y/n):");
is = scanner.next();
if (is.equalsIgnoreCase("Y")) {
warehouseInformation.setItemnumber(num);
System.out.println("保存成功!");
return;
} else {
System.out.println("该选项不存在!");
return;
}
}
}
}

public static void addcommodity(WarehouseInformation[] warehouseInformations, Scanner scanner) {
while (true) {
pzno();
WarehouseInformation warehouseInformation = new WarehouseInformation();
System.out.println("请输入商品编码:");
String confirm1 = scanner.next();
if (confirm1.length() != 8) {
System.out.println("录入错误");
return;
} else {
warehouseInformation.setItemno(confirm1);
}
System.out.println("请输入商品名称:");
String confirm2 = scanner.next();
warehouseInformation.setItemname(confirm2);
System.out.println("请输入供货商信息:");
String confirm3 = scanner.next();
warehouseInformation.setSuppliername(confirm3);
System.out.println("入库时间:");
String confirm4 = scanner.next();
if (confirm4.length() != 8) {
System.out.println("录入错误");
return;
} else {
warehouseInformation.setWarehousingtime(confirm4);
}
System.out.println("请输入存放仓库号:");
String confirm5 = scanner.next();
if (confirm5.length() != 3) {
System.out.println("录入错误");
return;
} else {
warehouseInformation.setWarehousenumber(confirm5);
}
System.out.println("请输入存放位置信息:");
String confirm6 = scanner.next();
warehouseInformation.setWarehouseplace(confirm6);

pzno();
System.out.println("1.商品编号:" + warehouseInformation.getItemno());
System.out.println("2.商品名称:" + warehouseInformation.getItemname());
System.out.println("3.供货商信息:" + warehouseInformation.getSuppliername());
System.out.println("4.入库时间:" + warehouseInformation.getWarehousingtime());
System.out.println("5.存放仓库号:" + warehouseInformation.getWarehousenumber());
System.out.println("6.存放位置信息:" + warehouseInformation.getWarehouseplace());
System.out.println("7.入库商品数量:" + warehouseInformation.getItemnumber());
System.out.println("该商品入库操作已完成,是否提交(Y/N)");
String tj = scanner.next();
if (tj.equalsIgnoreCase("Y")) {
warehouseInformations[nnum] = warehouseInformation;
nnum++;
System.out.println("提交成功!");
break;
} else
continue;

}

}

public static void pzno(){
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
}


public static void pzmu(){
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println(" 1、商品入库管理");
System.out.println(" 2、商品信息修改");
System.out.println(" 3、商品出库管理");
System.out.println(" 4、仓库盘点管理");
System.out.println("***********************************************************");
}


public static WarehouseInformation findmod(WarehouseInformation[] warehouseInformations,String itrmno){
for(int i=0;i<warehouseInformations.length;i++){
if(warehouseInformations[i].getItemno().equals(itrmno)&&warehouseInformations[i]!=null){
return warehouseInformations[i];
}
}
return null;
}













}


}

标签:scanner,String,warehouseInformation,System,println,9.4,out
From: https://www.cnblogs.com/UuUuuu0203/p/17678165.html

相关文章

  • 闲话9.4
    今天终于没有摆一天了。今天上午把昨天晚上剩的一道题写了写,然后补了补期望......
  • python DAY 2 #9.4
    赋值方法: 字符串拼接中间要加+号 python中的除法是浮点数除法整除是//  是向下取整,而不是向0取整  2**3代表2的3次方 类型转换方法,非输出语句中,字符串只能与字符串一起拼接 输入:input()默认类型是个str,需要强制转换为int输入多个数的方法:#......
  • 2023.9.4值得推荐的一款服务器空间
    ,已经体验一个月咯,非常不错的免费资源,适合大家去了解了解~!他们家的免费空间,免费服务器,非常稳定,非常靠谱,值得拥有,价格厚道~!免备案服务,域名管理等等服务,应有尽有,2023年你值得了解,他们家的免费云服务器还是独立IP的哦,非常非常好,非常NICE~!官网地址:https://www.sanfengyun.com......
  • CSS2.1规范笔记——9.4 常规流
    常规流常规流中的盒属于一个FC,可能是BFC或是IFC中的一个。块级盒参与BFC,行内级盒参与IFC。BFCBFC的产生条件:float:left|rightposition:absolute|fixeddisplay:inline-block|table-cell|table-caption(以及匿名的表格元素)overflow:hidden|auto|scrollBFC的布局......
  • aqyi_pc_v9.4.156_去广告版
    特点描述:01.全新LOGO设计颜色统一深色风格02.绿化处理免安装,去安全效验,移除各种广告03.去今日推荐弹窗、去右下角精彩节目推送弹窗04.去缓冲广告、暂停广告,看片秒播,拒绝卡顿05.NSIS编译额外启动器,退出软件自动结束进程驻留程序下载地址:https://wwt.lanzouq.com/iOu4o04s4q2......
  • SecureCRT 9.4发布啦!看看有哪些新功能吧!
    导读SecureCRT非常适合安全连接到运行Windows、UNIX和VMS的远程系统。SecureCRT支持通过Xmodem、Zmodem、Ymodem、Kermit和SFTP进行安全文件传输。背景SecureCRT是一款高度可定制的终端仿真器,支持Secure Shell (SSH)以及Telnet、Telnet/TLS和串行协议......
  • Matlab/Simulink双馈风机接入的三机九节点模型,所有参数已调好且可调,可直接运行,风电渗
    Matlab/Simulink双馈风机接入的三机九节点模型,所有参数已调好且可调,可直接运行,风电渗透率19.4%可作为仿真环境搭建风机参与一次调频的控制策略,桨距角、超速减载、虚拟惯性控制等,研究频率动态响应、储能调频(模型里无一次调频控制)ID:68279660695889354......
  • 9.4. 分布式与微服务架构
    在本章节中,我们将介绍分布式系统和微服务架构的基本概念。分布式系统解决了单体应用面临的可扩展性、高可用性等问题,而微服务架构进一步提升了系统的可维护性和灵活性。9.4.1.分布式系统基本概念分布式系统是由多个独立的计算节点组成的系统,这些节点通过网络进行通信和协作。......
  • Gradle 6.9.4 复制 / 导出依赖 jar 包到指定目录
    由于是docker构建因此下载包很慢需要将下载到本地taskcopyJars(type:Copy){fromconfigurations.runtimeClasspathinto"$buildDir/libs/deps"}......
  • gitlab-ce-15.9.4安装
    如果需要汉化,请根据汉化来选择版本汉化包下载地址:https://gitlab.com/xhang/gitlab/1.依赖包安装yum-yinstallpolicycoreutilsopenssh-serveropenssh-clientspostfix2.下载gitlab-ce并安装#下载安装包https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/git......