import java.util.Scanner;
public class WarehouseManagement {
public void ruku(WarehouseInformation[] ware,int k){
while (true){
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
Scanner sin=new Scanner(System.in);
while(true)
{
String no;
System.out.print("商品编号:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].itemno=no;
break;
}
}
System.out.print("商品名称:");
ware[k].itemname=sin.next();
System.out.print("供货商信息:");
ware[k].suppliername=sin.next();
while(true)
{
String no;
System.out.print("入库时间:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].warehousingtime=no;
break;
}
}
while(true)
{
String no;
System.out.print("仓库编号:");
no=sin.next();
if(no.length()!=3){
System.out.println("录入错误");continue;
}
else{
ware[k].warehousenumber=no;
break;
}
}
while(true)
{
String no;
System.out.print("存放位置信息:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].warehouseplace=no;
break;
}
}
System.out.print("入库数量:");
ware[k].itemnumber=sin.nextInt();
System.out.println("该商品入库操作已完成,是否提交(Y/N)");
char pd;
pd=sin.next().charAt(0);
if(pd=='Y'){
System.out.println("**********************************************************");
break;
}
if(pd=='N'){
ware[k].itemnumber=0;
ware[k].itemno="";
ware[k].itemname="";
ware[k].warehouseplace="";
ware[k].warehousingtime="";
ware[k].suppliername="";
ware[k].shipmenttime="";
ware[k].warehousenumber="";
ware[k].outnumber=0;
}
}
}
public void xiugai(WarehouseInformation[] ware){
int k=-1;
String no;
Scanner sin=new Scanner(System.in);
while (true){
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************");
System.out.print("请输入商品编号:");
no=sin.next();
int pd=0;
for(int i=0;i< ware.length;i++){
if(ware[i].itemno.equals(no)){
k=i;
pd=1;
break;
}
}
if(pd==1){
break;
}
}
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************\n" +
"1、商品编号:"+ware[k].itemno+"\n" +
"2、商品名称:"+ware[k].itemname+"\n" +
"3、供货商信息:"+ware[k].suppliername+"\n" +
"4、入库时间:"+ware[k].warehousingtime+"\n" +
"5、存放仓库号:"+ware[k].warehousenumber+"\n" +
"6、存放位置信息:"+ware[k].warehouseplace+"\n" +
"7、入库商品数量:"+ware[k].itemnumber);
int xz;
while(true) {
System.out.print("请选择需要修改的信息编号(1-7):");
xz = sin.nextInt();
if (xz == 1) {
System.out.print("请输入修改后的编号:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemno = xg;
}break;
}
else if (xz == 2) {
System.out.print("请输入修改后的名称:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemname = xg;
}break;
}
else if (xz == 3) {
System.out.print("请输入修改后的供货商信息:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].suppliername = xg;
}break;
}
else if (xz == 4) {
System.out.print("请输入修改后的入库时间:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehousingtime = xg;
}break;
}
else if (xz == 5) {
System.out.print("请输入修改后的存放仓库号:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehousenumber = xg;
}break;
}
else if (xz == 6) {
System.out.print("请输入修改后的存放位置:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehouseplace = xg;
}break;
}
else if (xz == 7) {
System.out.print("请输入修改后的入库商品数量:");
int xg;
xg = sin.nextInt();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemnumber = xg;
}break;
}
else{
System.out.println("该选项不存在");break;
}
}
}
public void chuku(WarehouseInformation[] ware){
while(true) {
Scanner sin = new Scanner(System.in);
int k = -1;
while (true) {
k = -1;
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
System.out.print("请输入商品编号:");
String no;
no = sin.next();
for (int i = 0; i < 5; i++) {
if (ware[i].itemno.equals(no)) {
k = i;
break;
}
}
if (k != -1) {
break;
}
}
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************\n" +
"1、商品编号:" + ware[k].itemno + "\n" +
"2、商品名称:" + ware[k].itemname + "\n" +
"3、供货商信息:" + ware[k].suppliername + "\n" +
"4、入库时间:" + ware[k].warehousingtime + "\n" +
"5、存放仓库号:" + ware[k].warehousenumber + "\n" +
"6、存放位置信息:" + ware[k].warehouseplace + "\n" +
"7、入库商品数量:" + ware[k].itemnumber);
System.out.print("出库时间:");
String time;
time = sin.next();
System.out.print("出库数量:");
int ck;
ck = sin.nextInt();
System.out.println("是否保存结果(Y/N)");
char sb = sin.next().charAt(0);
if (sb == 'Y') {
ware[k].outnumber = ck;
ware[k].shipmenttime = time;
return;
}
}
}
public void pandian(WarehouseInformation[] ware) {
int k=1;
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
for(int i=0;i<5;i++){
if(ware[i].itemno.length()==8){
k++;
System.out.println(k+" 商品编号:"+ware[i].itemno+" 商品名称:"+ware[i].itemname+" 库存数量"+(ware[i].itemnumber-ware[i].outnumber));
}
}
}
}
public class WarehouseInformation {
String itemno;
String itemname;
String suppliername;
String warehousingtime;
String shipmenttime;
String warehousenumber;
String warehouseplace;
int itemnumber;
int outnumber;
public WarehouseInformation(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;
}
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;
}
}
import java.util.Scanner;标签:String,入学,System,next,测试,ware,重写,sin,out From: https://www.cnblogs.com/Snor9/p/17711590.html
public class WarehouseManagement {
public void ruku(WarehouseInformation[] ware,int k){
while (true){
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
Scanner sin=new Scanner(System.in);
while(true)
{
String no;
System.out.print("商品编号:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].itemno=no;
break;
}
}
System.out.print("商品名称:");
ware[k].itemname=sin.next();
System.out.print("供货商信息:");
ware[k].suppliername=sin.next();
while(true)
{
String no;
System.out.print("入库时间:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].warehousingtime=no;
break;
}
}
while(true)
{
String no;
System.out.print("仓库编号:");
no=sin.next();
if(no.length()!=3){
System.out.println("录入错误");continue;
}
else{
ware[k].warehousenumber=no;
break;
}
}
while(true)
{
String no;
System.out.print("存放位置信息:");
no=sin.next();
if(no.length()!=8){
System.out.println("录入错误");continue;
}
else{
ware[k].warehouseplace=no;
break;
}
}
System.out.print("入库数量:");
ware[k].itemnumber=sin.nextInt();
System.out.println("该商品入库操作已完成,是否提交(Y/N)");
char pd;
pd=sin.next().charAt(0);
if(pd=='Y'){
System.out.println("**********************************************************");
break;
}
if(pd=='N'){
ware[k].itemnumber=0;
ware[k].itemno="";
ware[k].itemname="";
ware[k].warehouseplace="";
ware[k].warehousingtime="";
ware[k].suppliername="";
ware[k].shipmenttime="";
ware[k].warehousenumber="";
ware[k].outnumber=0;
}
}
}
public void xiugai(WarehouseInformation[] ware){
int k=-1;
String no;
Scanner sin=new Scanner(System.in);
while (true){
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************");
System.out.print("请输入商品编号:");
no=sin.next();
int pd=0;
for(int i=0;i< ware.length;i++){
if(ware[i].itemno.equals(no)){
k=i;
pd=1;
break;
}
}
if(pd==1){
break;
}
}
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************\n" +
"1、商品编号:"+ware[k].itemno+"\n" +
"2、商品名称:"+ware[k].itemname+"\n" +
"3、供货商信息:"+ware[k].suppliername+"\n" +
"4、入库时间:"+ware[k].warehousingtime+"\n" +
"5、存放仓库号:"+ware[k].warehousenumber+"\n" +
"6、存放位置信息:"+ware[k].warehouseplace+"\n" +
"7、入库商品数量:"+ware[k].itemnumber);
int xz;
while(true) {
System.out.print("请选择需要修改的信息编号(1-7):");
xz = sin.nextInt();
if (xz == 1) {
System.out.print("请输入修改后的编号:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemno = xg;
}break;
}
else if (xz == 2) {
System.out.print("请输入修改后的名称:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemname = xg;
}break;
}
else if (xz == 3) {
System.out.print("请输入修改后的供货商信息:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].suppliername = xg;
}break;
}
else if (xz == 4) {
System.out.print("请输入修改后的入库时间:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehousingtime = xg;
}break;
}
else if (xz == 5) {
System.out.print("请输入修改后的存放仓库号:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehousenumber = xg;
}break;
}
else if (xz == 6) {
System.out.print("请输入修改后的存放位置:");
String xg;
xg = sin.next();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].warehouseplace = xg;
}break;
}
else if (xz == 7) {
System.out.print("请输入修改后的入库商品数量:");
int xg;
xg = sin.nextInt();
System.out.println("是否修改(Y/N)");
char gg = sin.next().charAt(0);
if (gg == 'Y') {
ware[k].itemnumber = xg;
}break;
}
else{
System.out.println("该选项不存在");break;
}
}
}
public void chuku(WarehouseInformation[] ware){
while(true) {
Scanner sin = new Scanner(System.in);
int k = -1;
while (true) {
k = -1;
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
System.out.print("请输入商品编号:");
String no;
no = sin.next();
for (int i = 0; i < 5; i++) {
if (ware[i].itemno.equals(no)) {
k = i;
break;
}
}
if (k != -1) {
break;
}
}
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版***********************************************************\n" +
"1、商品编号:" + ware[k].itemno + "\n" +
"2、商品名称:" + ware[k].itemname + "\n" +
"3、供货商信息:" + ware[k].suppliername + "\n" +
"4、入库时间:" + ware[k].warehousingtime + "\n" +
"5、存放仓库号:" + ware[k].warehousenumber + "\n" +
"6、存放位置信息:" + ware[k].warehouseplace + "\n" +
"7、入库商品数量:" + ware[k].itemnumber);
System.out.print("出库时间:");
String time;
time = sin.next();
System.out.print("出库数量:");
int ck;
ck = sin.nextInt();
System.out.println("是否保存结果(Y/N)");
char sb = sin.next().charAt(0);
if (sb == 'Y') {
ware[k].outnumber = ck;
ware[k].shipmenttime = time;
return;
}
}
}
public void pandian(WarehouseInformation[] ware) {
int k=1;
System.out.println("***********************************************************\n" +
"石家庄铁道大学前进22软件开发有限公司\n" +
"仓库管理系统2022版\n" +
"***********************************************************");
for(int i=0;i<5;i++){
if(ware[i].itemno.length()==8){
k++;
System.out.println(k+" 商品编号:"+ware[i].itemno+" 商品名称:"+ware[i].itemname+" 库存数量"+(ware[i].itemnumber-ware[i].outnumber));
}
}
}
}