package bbb;
public class WarehouseInformation {
private String itemnumno;
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 WarehouseInformation () {
}
public WarehouseInformation( String itemnumno,String itemname,String suppliername,
String warehousingtime,String shipmenttime,String warehousenumber,
String warehouseplace,int itemnumber,int outnumber) {
super();
this.itemnumno=itemnumno;
this.itemname=itemname;
this.suppliername=suppliername;
this.warehousingtime=warehousingtime;
this.shipmenttime=shipmenttime;
this.warehousenumber=warehousenumber;
this.warehouseplace=warehouseplace;
this.itemnumber=itemnumber;
this.outnumber=outnumber;
}
public String getItemnumno() {
return itemnumno;
}
public void setItemnumno(String itemnumno) {
this.itemnumno = itemnumno;
}
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;
}
package bbb;
import java.util.ArrayList;
import java.util.Scanner;
import bbb.WarehouseInformation;
public class WarehouseManagement {
private WarehouseInformation[] warehouseInformations;
public WarehouseManagement() {
this.warehouseInformations = new WarehouseInformation[5];
}
public static void main(String[] args) {
}
// ArrayList<WarehouseInformation> x = new ArrayList<WarehouseInformation>();
// WarehouseInformation t1=x.warehouse("11111111","陈","铁大","20223987","20230904","111","1111aaaa");
// WarehouseInformation t2=x.warehouse("22222222","田","铁大","20223987","20230904","222","2222bbbb");
// WarehouseInformation t3=x.warehouse("33333333","王","铁大","20223987","20230904","333","3333cccc");
// WarehouseInformation t4=x.warehouse("44444444","李","铁大","20223987","20230904","444","4444dddd");
// WarehouseInformation t5=x.warehouse("55555555","郭","铁大","20223987","20230904","555","5555eeee");
public void run() {
Scanner scanner = new Scanner(System.in);
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.print("请输入数字进行操作:");
int choice = scanner.nextInt();
scanner.nextLine();
switch (choice) {
case 1:
warehouseInboundManagement(scanner);
break;
case 2:
modifyItemInformation(scanner);
break;
case 3:
warehouseOutboundManagement(scanner);
break;
case 4:
warehouseInventoryManagement();
break;
default:
System.out.println("录入错误!");
break;
}
}
}
private void warehouseInboundManagement(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
WarehouseInformation warehouseInformation = new WarehouseInformation();
System.out.print("商品编号:");
String itemnumno = scanner.nextLine();
warehouseInformation.setItemnumno(itemnumno);
System.out.print("商品名称:");
String itemname = scanner.nextLine();
warehouseInformation.setItemname(itemname);
System.out.print("供货商信息:");
String suppliername = scanner.nextLine();
warehouseInformation.setSuppliername(suppliername);
System.out.print("入库时间:");
String warehousingtime = scanner.nextLine();
warehouseInformation.setWarehousingtime(warehousingtime);
System.out.print("存放仓库号:");
String warehousenumber = scanner.nextLine();
warehouseInformation.setWarehousenumber(warehousenumber);
System.out.print("存放位置信息:");
String warehouseplace = scanner.nextLine();
warehouseInformation.setWarehouseplace(warehouseplace);
System.out.print("入库商品数量:");
int itemnumber = scanner.nextInt();
scanner.nextLine();
warehouseInformation.setItemnumber(itemnumber);
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("商品编号:" + warehouseInformation.getItemnumno());
System.out.println("商品名称:" + warehouseInformation.getItemname());
System.out.println("供货商信息:" + warehouseInformation.getSuppliername());
System.out.println("入库时间:" + warehouseInformation.getWarehousingtime());
System.out.println("存放仓库号:" + warehouseInformation.getWarehousenumber());
System.out.println("存放位置信息:" + warehouseInformation.getWarehouseplace());
System.out.println("入库商品数量:" + warehouseInformation.getItemnumber());
System.out.print("该商品入库操作已完成,是否提交(Y/N):");
String submitChoice = scanner.nextLine();
if (submitChoice.equalsIgnoreCase("Y")) {
// 存储商品信息到数组中
for (int i = 0; i < warehouseInformations.length; i++) {
if (warehouseInformations[i] == null) {
warehouseInformations[i] = warehouseInformation;
break;
}
}
}
}
private void modifyItemInformation(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemnumno = scanner.nextLine();
WarehouseInformation targetItem = null;
for (WarehouseInformation warehouseInformation : warehouseInformations) {
if (warehouseInformation != null && warehouseInformation.getItemnumno().equals(itemnumno)) {
targetItem = warehouseInformation;
break;
}
}
if (targetItem == null) {
System.out.println("库中没有该商品!");
return;
}
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("1、商品编号:" + targetItem.getItemnumno());
System.out.println("2、商品名称:" + targetItem.getItemname());
System.out.println("3、供货商信息:" + targetItem.getSuppliername());
System.out.println("4、入库时间:" + targetItem.getWarehousingtime());
System.out.println("5、存放仓库号:" + targetItem.getWarehousenumber());
System.out.println("6、存放位置信息:" + targetItem.getWarehouseplace());
System.out.println("7、商品数量:" + targetItem.getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
int modifyChoice = scanner.nextInt();
scanner.nextLine();
switch (modifyChoice) {
case 1:
System.out.print("请输入修改后的商品编号:");
String modifiedItemnumno = scanner.nextLine();
targetItem.setItemnumno(modifiedItemnumno);
break;
case 2:
System.out.print("请输入修改后的商品名称:");
String modifiedItemname = scanner.nextLine();
targetItem.setItemname(modifiedItemname);
break;
case 3:
System.out.print("请输入修改后的供货商信息:");
String modifiedSuppliername = scanner.nextLine();
targetItem.setSuppliername(modifiedSuppliername);
break;
case 4:
System.out.print("请输入修改后的入库时间:");
String modifiedWarehousingtime = scanner.nextLine();
targetItem.setWarehousingtime(modifiedWarehousingtime);
break;
case 5:
System.out.print("请输入修改后的存放仓库号:");
String modifiedWarehousenumber = scanner.nextLine();
targetItem.setWarehousenumber(modifiedWarehousenumber);
break;
case 6:
System.out.print("请输入修改后的存放位置信息:");
String modifiedWarehouseplace = scanner.nextLine();
targetItem.setWarehouseplace(modifiedWarehouseplace);
break;
case 7:
System.out.print("请输入修改后的商品数量:");
int modifiedItemnumber = scanner.nextInt();
scanner.nextLine();
targetItem.setItemnumber(modifiedItemnumber);
break;
default:
System.out.println("该选项不存在!");
break;
}
System.out.print("是否保存修改的信息(Y/N):");
String saveChoice = scanner.nextLine();
if (!saveChoice.equalsIgnoreCase("Y")) {
return;
}
System.out.println("修改信息保存成功!");
}
private void warehouseOutboundManagement(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemnumno = scanner.nextLine();
WarehouseInformation targetItem = null;
for (WarehouseInformation warehouseInformation : warehouseInformations) {
if (warehouseInformation != null && warehouseInformation.getItemnumno().equals(itemnumno)) {
targetItem = warehouseInformation;
break;
}
}
if (targetItem == null) {
System.out.println("库中没有该商品!");
return;
}
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("1、商品编号:" + targetItem.getItemnumno());
System.out.println("2、商品名称:" + targetItem.getItemname());
System.out.println("3、供货商信息:" + targetItem.getSuppliername());
System.out.println("4、入库时间:" + targetItem.getWarehousingtime());
System.out.println("5、存放仓库号:" + targetItem.getWarehousenumber());
System.out.println("6、存放位置信息:" + targetItem.getWarehouseplace());
System.out.println("7、入库商品数量:" + targetItem.getItemnumber());
System.out.print("出库时间:");
String shipmenttime = scanner.nextLine();
targetItem.setShipmenttime(shipmenttime);
System.out.print("出库数量:");
int outnumber = scanner.nextInt();
scanner.nextLine();
targetItem.setOutnumber(outnumber);
System.out.print("是否保存出库信息(Y/N):");
String saveChoice = scanner.nextLine();
if (!saveChoice.equalsIgnoreCase("Y")) {
return;
}
System.out.println("出库信息保存成功!");
}
private void warehouseInventoryManagement() {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
for (int i = 0; i < warehouseInformations.length; i++) {
WarehouseInformation warehouseInformation = warehouseInformations[i];
if (warehouseInformation != null) {
System.out.println((i + 1) + "、商品编号:" + warehouseInformation.getItemnumno() + "、商品名称:" + warehouseInformation.getItemname() + "、库存数量:" + warehouseInformation.getItemnumber());
}
}
}
}
public void setOutnumber(int outnumber) {
this.outnumber = outnumber;
}
public void show() {
System.out.println(this.itemnumber+this.outnumber);
}
}
标签:String,9.17,System,warehouseInformation,println,out,scanner From: https://www.cnblogs.com/tianpeisen/p/17710058.html