9/9
定义PlanInformation类,其中包括十四个私有变量(id,planid,planname,process,nextprocess,operator,recipient,plannumber, innumber,outnumber,missnumber,badnumber, inspectednumber,statement)。该功能完成Mes的基本功能功能,定义PlanManagement类完成下列功能。
1、利用数组实现至少存储五个日报记录入库的基本信息;(1分)
2、Mes系统的主界面如下图所示:(1分)
//2305-3 20234055 张同宁
package com.example;
import java.util.*;
import java.util.Scanner;
import java.util.HashMap;
import java.util.Map;
class PlanInformation {
// 私有变量
private int id;//日报流水号
private String planid;//产品生产批次号
private String planname;//产品名称
private String process;//当前工序名称
private String nextprocess;//下一接收工序名称
private String operator;//当前工序的操作者
private String recipient;//下一道工序的接受者
private int plannumber;//该产品定要要求的产品数量
private int innumber;//从上一道工序的接收的合格产品总数
private int outnumber;//当前工序的产品转出总数
private int missnumber;//当前工序的产品丢失数量
private int badnumber;//当前工序的产品废品数量
private int inspectednumber;//当前工序的产品待检验数量
private int statement;//该日报记录的状态
// 构造函数,用于赋初值
public PlanInformation (int id,String planid ,String planname,String process ,String nextprocess,
String operator,String recipient,int plannumber, int innumber,int outnumber,int missnumber,
int badnumber,int inspectednumber,int statement){
this.id=id;
this.planid=planid;
this.planname=planname;
this.process=process;
this.nextprocess=nextprocess;
this.operator=operator;
this.recipient=recipient;
this.plannumber=plannumber;
this.innumber=innumber;
this.outnumber=outnumber;
this.missnumber=missnumber;
this.badnumber=badnumber;
this.inspectednumber=inspectednumber;
}
public int getId(){
return id ;
}
public void setId(int id){
this.id=id;
}
public String getPlanid(){
return planid;
}
public void setPlanid(String planid){
this.planid=planid;
}
public String getPlanname() {
return planname;
}
public void setPlanname(String planname) {
this.planname = planname;
}
public String getProcess() {
return process;
}
public void setProcess(String process) {
this.process = process;
}
public String getNextprocess() {
return nextprocess;
}
public void setNextprocess(String nextprocess) {
this.nextprocess = nextprocess;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getRecipient() {
return recipient;
}
public void setRecipient(String recipient) {
this.recipient = recipient;
}
public int getPlannumber() {
return plannumber;
}
public void setPlannumber(int plannumber) {
this.plannumber = plannumber;
}
public int getInnumber() {
return innumber;
}
public void setInnumber(int innumber) {
this.innumber = innumber;
}
public int getOutnumber() {
return outnumber;
}
public void setOutnumber(int outnumber) {
this.outnumber = outnumber;
}
public int getMissnumber() {
return missnumber;
}
public void setMissnumber(int missnumber) {
this.missnumber = missnumber;
}
public int getBadnumber() {
return badnumber;
}
public void setBadnumber(int badnumber) {
this.badnumber = badnumber;
}
public int getInspectednumber() {
return inspectednumber;
}
public void setInspectednumber(int inspectednumber) {
this.inspectednumber = inspectednumber;
}
public int getStatement() {
return statement;
}
public void setStatement(int statement) {
this.statement = statement;
}
}
import java.util.Scanner;
public class PlanManagement {
private PlanInformation[] items = new PlanInformation[5];
private int itemCount = 0; // 记录实际存储的商品数量
private Scanner scanner = new Scanner(System.in); // 将scanner移动到类级别,使其可以在整个类中使用
public static void main(String[] args) {
PlanManagement manager = new PlanManagement();
manager.showMainMenu();
}
public void showMainMenu() {
while (true) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
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("请输入选项(1-4):");
int choice = scanner.nextInt();
scanner.nextLine(); // 处理换行符
switch (choice) {
case 1:
generatePlan();
break;
case 2:
submitReport();
break;
case 3:
confirmReport();
break;
case 4:
showProgress();
break;
default:
System.out.println("该选项不存在。");
break;
}
}
}