源代码:
package PaperManagement;
import java.util.ArrayList;
import java.util.Scanner;
public class WarehouseManagement {
public static void main(String[] args) {
ArrayList<WarehouseInformation> array= new ArrayList<WarehouseInformation>();
while(true) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司 ");
System.out.println(" 仓库管理系统2022版 ");
System.out.println("***********************************************************");
System.out.println(" 1、商品入库管理 ");
System.out.println(" 2、商品信息修改 ");
System.out.println(" 3、商品出库管理 ");
System.out.println(" 4、仓库盘点管理 ");
System.out.println("**********************************************************");
System.out.println("请输入你的选择:");
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
System.out.println(line);
// scanner.close();
switch(line) {
case "1":
UpLoad(array);
break;
case "2":
Addmessage(array);
break;
case "3":
break;
case "4":
break;
default :
System.out.println("该选项不存在");
break;
}
}
}
public static void UpLoad(ArrayList<WarehouseInformation> array) {
Addmessage(array);
Scanner sc = new Scanner(System.in);
while(true) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司 ");
System.out.println(" 仓库管理系统2022版 ");
System.out.println("*********************************************************** ");
System.out.println(" 商品编号: ");
String itemno = sc.nextLine();
System.out.println("********************************************************** ");
for(int i = 0;i<array.size();i++) {
WarehouseInformation s = array.get(i);
boolean flag = false;
if(s.getitemno().equals(itemno)) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司 ");
System.out.println(" 仓库管理系统2022版 ");
System.out.println("*********************************************************** ");
System.out.println(" 商品编号: "+s.getitemno()+" ");
System.out.println(" 商品名称:"+s.getitemname() + " ");
System.out.println(" 供货商信息:" + s.getsuppliername()+" ");
System.out.println(" 请输入入库时间: ");
String warehousingtime = sc.nextLine();
System.out.println("********************************************************** ");
if(warehousingtime.length() <= 10 ) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系毕业设计论文管理系统2021版 ");
System.out.println(" 毕业设计论文提交 ");
System.out.println("*********************************************************** ");
System.out.println(" 商品编号: "+s.getitemno()+" ");
System.out.println(" 商品名称:"+s.getitemname() + " ");
System.out.println(" 供货商信息:" + s.getsuppliername()+" ");
System.out.println(" 入库时间:"+s.getwarehousingtime()+" ");
System.out.println(" 请输入出库时间: ");
String shipmenttime = sc.nextLine();
System.out.println("********************************************************** ");
if(shipmenttime.length() <= 200) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学软件工程系毕业设计论文管理系统2021版 ");
System.out.println(" 毕业设计论文提交 ");
System.out.println("*********************************************************** ");
System.out.println(" 商品编号: "+s.getitemno()+" ");
System.out.println(" 商品名称:"+s.getitemname() + " ");
System.out.println(" 供货商信息:" + s.getsuppliername()+" ");
System.out.println(" 入库时间:"+s.getwarehousingtime()+" ");
System.out.println(" 出库时间: "+s.getshipmenttime()+" ");
System.out.println("********************************************************** ");
System.out.println(" 该商品入库操作已完成,是否提交(Y/N) ");
String judge = sc.nextLine();
switch(judge) {
case "y":
case "Y":
s.setwarehousingtime(warehousingtime);
s.setshipmenttime(shipmenttime);
array.add(s);
return;
case "n":
case "N":
return;
}
}else {
System.out.println("输入错误,请重新输入:");
i--;
}
}
else {
System.out.println("输入错误,请重新输入:");
i--;
}
}
}
}
}
public static void Addmessage(ArrayList<WarehouseInformation> array) { //添加商品信息
Scanner sc = new Scanner(System.in);
String itemno;
System.out.println("请输入商品编码:");
itemno = sc.nextLine();
sc.close();
System.out.println("请输入商品名称:");
String itemname = sc.nextLine();
System.out.println("请输入供货商名称:");
String suppliername = sc.nextLine();
System.out.println("请输入入库时间:");
String warehousingtime = sc.nextLine();
System.out.println("请输入出库时间:");
String shipmenttime = sc.nextLine();
System.out.println("请输入仓库编号:");
String warehousenumber = sc.nextLine();
System.out.println("请输入存放商品的具体位置:");
String warehouseplace = sc.nextLine();
WarehouseInformation s = new WarehouseInformation();
s.setitemno(itemno);
s.setitemname(itemname);
s.setsuppliername(suppliername);
s.setwarehousingtime(warehousingtime);
s.setwarehousenumber(warehousenumber);
s.setshipmenttime(shipmenttime);
s.setwarehousenumber(warehousenumber);
s.setwarehouseplace(warehouseplace);
array.add(s);
System.out.println("商品信息添加成功");
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司 ");
System.out.println(" 仓库管理系统2022版 ");
System.out.println("*********************************************************** ");
System.out.println(" 商品编号: "+s.getitemno()+" ");
System.out.println(" 商品名称:"+s.getitemname() + " ");
System.out.println(" 供货商信息:" + s.getsuppliername()+" ");
System.out.println(" 入库时间:"+warehousingtime+" ");
System.out.println(" 出库时间:"+s.getshipmenttime()+" ");
System.out.println(" 仓库编号:"+s.getwarehousenumber()+" ");
System.out.println(" 存放商品的具体位置:"+s.getwarehouseplace()+" ");
}
package PaperManagement;
import PaperManagement.WarehouseInformation;
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 setitemno(int itemnumber)
{this.itemnumber=itemnumber;}
public int getoutnumber()
{return outnumber;}
public void setoutnumber(int outnumber)
{this.outnumber=outnumber;}
public WarehouseInformation(){}
}