定義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;
}
}
}