package ceshi;

public class WarehouseInformation {
private String itemnode;//编号

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 getItemnode() {
return itemnode;
}

public void setItemnode(String itemnode) {
this.itemnode = itemnode;
}

public String getSuppliername() {
return suppliername;
}

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

public String getItemname() {
return itemname;
}

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

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 WarehouseInformation(String itemnode,String itemname,String suppliername,String warehousingtime,String shipmenttime,String warehousenumber,String warehouseplace,int itemnumber,int outnumber) {
this.itemnode = itemnode;
this.itemname = itemname;
this.itemnumber= itemnumber;
this.outnumber=outnumber;
this.shipmenttime=shipmenttime;
this.suppliername=suppliername;
this.warehousenumber=warehousenumber;
this.warehouseplace=warehouseplace;
this.warehousingtime=warehousingtime;
}
public WarehouseInformation( ) {
this.itemnode = "";
this.itemname = "";
this.itemnumber=0;
this.outnumber=0;
this.shipmenttime="";
this.suppliername= "";
this.warehousenumber="";
this.warehouseplace="";
this.warehousingtime="";
}


}
package ceshi;

import javax.security.auth.callback.LanguageCallback;
import java.util.Scanner;

public class WarehouseManagement {
//static int i=0;
/* static String [] a =new String[5];
static String [] b =new String[5];
static String [] c =new String[5];

static String [] d =new String[5];
static String [] e =new String[5];
static String [] f =new String[5];
static int [] g =new int [5];*/
static WarehouseInformation[] a =new WarehouseInformation[5];
//public static void
//static WarehouseInformation[] si = new WarehouseInformation[5];
public static int menu(){
Scanner sc=new Scanner(System.in);
System.out.println("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+
" 1、 商品入库管理\n"+
" 2、 商品信息修改\n"+
" 3、 商品出库管理\n"+
" 4、 仓库盘点管理\n"+
"****************************************************************\n");
int ch;
System.out.println("请选择");
ch=sc.nextInt();
return ch;
}
public static void luru(int i){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"商品编号:(八位)");
String s;
Scanner sc=new Scanner(System.in);
s= sc.next();

System.out.print("商品名称:");
String s1;
s1=sc.next();

System.out.print("供货商信息:");
String s2;
s2=sc.next();

System.out.print("入库时间(八位):");
String s3;
s3=sc.next();
System.out.print("存放库房号(三位):");
String s4;
s4=sc.next();
System.out.print("存放位置信息(八位):");
String s5;
s5=sc.next();
System.out.print("入库商品数量:");
int s6;
s6=sc.nextInt();
if(s.length()==8&&s3.length()==8&&s4.length()==3&&s5.length()==8){
System.out.println("该商品的入库操作已完成,是否提交(Y/N)");
String s7;
s7=sc.next();
if (s7.equals("Y")) {
a[i].setItemnode(s);
a[i].setItemname(s1);
a[i].setSuppliername(s2);
a[i].setWarehousingtime(s3);
a[i].setWarehouseplace(s5);
a[i].setWarehousenumber(s4);
a[i].setItemnumber(s6);
System.out.println("录入成功");
}
else{
luru(i);
}
}
else{
System.out.print("输入不符合规范");
luru(i);
}
}
public static void xiugai(int i){
System.out.println("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"请输入商品编号\n");
Scanner sc=new Scanner(System.in);
String s1;
s1=sc.next();
for (int j=0;j<i;j++){
if(a[j].getItemnode().equals(s1)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
// Scanner sc=new Scanner(System.in);
int x;
x=sc.nextInt();
if (x!=1&&x!=2&&x!=3&&x!=4&&x!=5&&x!=7&&x!=6){
System.out.println("该选项不存在");
}
if(x==1){
String s2;
s2=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnode(s2);
System.out.println("修改成功");
}

}
if(x==2){
String s3;
s3=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemname(s3);
System.out.println("修改成功");
}
}
if(x==6){
String s4;
s4=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehouseplace(s4);
System.out.println("修改成功");
}
}
if(x==3){
String s5;
s5=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setSuppliername(s5);
System.out.println("修改成功");
}
}
if(x==4){
String s6;
s6=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousingtime(s6);
System.out.println("修改成功");
}
}
if(x==5){
String s7;
s7=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousenumber(s7);
System.out.println("修改成功");
}
}
if(x==7){
int s8;
s8=sc.nextInt();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnumber(s8);
System.out.println("修改成功");
}
}
// return 1;
}
if(j==4){
if(a[j].getItemnode().equals(s1)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
// Scanner sc=new Scanner(System.in);
int x;
x=sc.nextInt();
if (x!=1&&x!=2&&x!=3&&x!=4&&x!=5&&x!=7&&x!=6){
System.out.println("该选项不存在");
}
if(x==1){
String s2;
s2=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnode(s2);
System.out.println("修改成功");
}

}
if(x==2){
String s3;
s3=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemname(s3);
System.out.println("修改成功");
}
}
if(x==6){
String s4;
s4=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehouseplace(s4);
System.out.println("修改成功");
}
}
if(x==3){
String s5;
s5=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setSuppliername(s5);
System.out.println("修改成功");
}
}
if(x==4){
String s6;
s6=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousingtime(s6);
System.out.println("修改成功");
}
}
if(x==5){
String s7;
s7=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousenumber(s7);
System.out.println("修改成功");
}
}
if(x==7){
int s8;
s8=sc.nextInt();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnumber(s8);
System.out.println("修改成功");
}
}
}
}
}

}
public static void chuku(int i){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"请输入商品编号:");
Scanner sc=new Scanner(System.in);
String s;
s=sc.next();
for (int j=0;j<i;j++){
if(a[j].getItemnode().equals(s)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("出库时间:");
// Scanner sc=new Scanner(System.in);
String x;
x=sc.next();
System.out.print("出库数量");
int y=sc.nextInt();
if(y>a[j].getItemnumber()){
System.out.println("输入错误");
}
else {
a[j].setItemnumber(a[j].getItemnumber()- y);
}
}
if(j==4){
if(a[j].getItemnode().equals(s)) {
System.out.print("***************************************************************\n" +
" 石家庄铁道大学前进22软件开发有限公司\n" +
" 仓库管理系统2022版\n" +
"****************************************************************\n" + "1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("出库时间:");
// Scanner sc=new Scanner(System.in);
String x;
x = sc.next();
System.out.print("出库数量");
int y = sc.nextInt();
if (y > a[j].getItemnumber()) {
System.out.println("输入错误");
} else {
a[j].setItemnumber(a[j].getItemnumber() - y);
}
} }
}

}
public static void pandian(int i){
for(int j=0;j<i;j++){
System.out.print("商品编号:");
System.out.print(a[j].getItemnode());
System.out.print("商品名称:");
System.out.print(a[j].getItemname());
System.out.print("库存数量:");
System.out.println(a[j].getItemnumber());
}
}
public static void main(String[] args){
a[0]=new WarehouseInformation();
a[1]=new WarehouseInformation();
a[2]=new WarehouseInformation();
a[3]=new WarehouseInformation();
a[4]=new WarehouseInformation();
int choice;
int i=0;
boolean flag=true;
while(flag){
choice=menu();
switch(choice){
case 1:
luru(i);
i++;
break;
case 2:
xiugai(i);
break;
case 3:
chuku(i);
break;
case 4:
pandian(i);
break;
case 5:
flag=false;
}
}
}
}