以下是java入学测试经过模块化修改的源代码。
package mes;
public class Mesmain {
public static void main(String[] args) {
PlanManagement a=new PlanManagement();
a.menu();
}
}
package mes;
public 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(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)
{
super();
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;
this.statement = statement;
}
public PlanInformation() {
super();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public void setPlanid(String planid) {
this.planid = planid;
}
public String getPlanid() {
return 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 i) {
this.statement = i;
}
}
package mes;
import java.util.Scanner;
public class PlanManagement {
//信2305-1 20234196 尚子煊
private PlanInformation a[]=new PlanInformation[100];
private PlanInformation exp;
private int count=0;
private String[][] processTable = {
{"10", "射蜡", "柳泽羽"},
{"20", "修蜡", "藤艺哲"},
{"30", "面层", "郝一诺"},
{"40", "封浆", "杨松铎"},
{"50", "熔化", "刘宇恒"},
{"60", "切割", "陶攀印"},
{"70", "精磨", "阎琪文"},
{"80", "调型", "郝正一"},
{"90", "检验", "刘静一"}
};
public void menu()
{
int i=1;
while(i==1)
{
title();
System.out.println(" 1、生成计划");
System.out.println(" 2、提交日报");
System.out.println(" 3、确认日报");
System.out.println(" 4、统计进度");
System.out.println("***********************************************************");
Scanner sc1=new Scanner(System.in);
int e1=sc1.nextInt();
switch(e1) {
case 1:
Planmake();
i--;
break;
case 2:
Planshangjiao();
i--;
break;
case 3:
querenPlan();
i--;
break;
case 4:
Tongji();
i--;
break;
default:
System.out.println("该选项不存在");
break;
}
}
}
public void querenPlan() {
Scanner sc=new Scanner(System.in);
char c;
title();
System.out.print(" 请输入产品批次号:");
String pici=sc.nextLine();
System.out.println("***********************************************************");
for(int i=0;i<count;i++) {
if(a[i].getPlanid().equals(pici)&&a[i].getStatement()==1)
{
title();
System.out.println(" 1、产品批次:"+a[i].getPlanid());
System.out.println(" 2、产品名称:"+a[i].getPlanname());
System.out.println(" 3、计划数量:"+a[i].getPlannumber());
System.out.println(" 4、当前工序:"+a[i].getProcess());
System.out.println(" 5、下一工序:"+a[i].getNextprocess());
System.out.println(" 6、操作员:"+a[i].getOperator());
System.out.println(" 7、接收员:"+a[i].getRecipient());
System.out.println(" 8、上一道工序转入数量:"+a[i].getInnumber());
System.out.println(" 9、转出总数:"+a[i].getOutnumber());
System.out.println(" 10、丢失数量:"+a[i].getMissnumber());
System.out.println(" 11、废品数量:"+a[i].getBadnumber());
System.out.println(" 12、待检验数量:"+a[i].getInspectednumber());
System.out.println("***********************************************************");
System.out.println(a[i].getStatement());
System.out.println("该产品入库操作已完成,是否提交(Y/N)");
System.out.println("***********************************************************");
c=sc.next().charAt(0);
sc.nextLine();
if(c=='Y'||c=='y') {
a[i].setStatement(2);
menu();
break;
}
else if(c=='N'||c=='n')
{
querenPlan();
break;
}
}
}
System.out.println("无该产品");
}
public void Planmake()
{
Scanner sc1=new Scanner(System.in);
title();
System.out.print(" 产品批次:");
String pici=sc1.nextLine();
System.out.print(" 产品名称:");
String name=sc1.nextLine();
System.out.print(" 计划数量:");
int num=sc1.nextInt();
exp=new PlanInformation(pici,name,"1","2","3","4",num,0,0,0,0,0,0);
System.out.println("该产品入库操作已完成,是否提交(Y/N)");
System.out.println("***********************************************************");
char c=sc1.next().charAt(0);
if(c=='Y'||c=='y') {
a[count]=exp;
count++;
menu();
}
else if(c=='N') {
Planmake();
}
}
public void shuchu() {
for(int i=0;i<=count;i++) {
System.out.println(" 1、产品批次:"+a[i].getPlanid());
System.out.println(" 2、产品名称:"+a[i].getPlanname());
System.out.println(" 3、计划数量:"+a[i].getPlannumber());
System.out.println(" 4、完成数量:0");
System.out.println(" 5、剩余数量:"+a[i].getPlannumber());
}
}
public void Tongji(){
title();
shuchu();
System.out.println("***********************************************************");
System.out.println("***********************************************************");
}
public void title() {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("***********************************************************");
}
public void Planshangjiao()
{
Scanner sc=new Scanner(System.in);
title();
System.out.print(" 请输入产品批次号:");
String pici=sc.nextLine();
System.out.println("***********************************************************");
for(int i=0;i<100;i++) {
if(a[i].getPlanid().equals(pici)==true&&a[i].getStatement()==0) {
title();
System.out.println(" 1、产品批次:"+a[i].getPlanid());
System.out.println(" 2、产品名称:"+a[i].getPlanname());
System.out.println(" 3、计划数量:"+a[i].getPlannumber());
System.out.print(" 4、当前工序:");
String nowwork=sc.nextLine();
System.out.print(" 5、下一工序:");
String nextwork=sc.nextLine();
System.out.print(" 6、操作员:");
System.out.println(Manmake(nowwork));
System.out.print(" 7、接收员:");
System.out.println(Manmake(nextwork));
System.out.print(" 8、上一道工序转入数量:");
int before;
before=sc.nextInt();
System.out.print(" 9、转出总数:");
int chu=sc.nextInt();
System.out.print(" 10、丢失数量:");
int lost=sc.nextInt();
System.out.print(" 11、废品数量:");
int feipin=sc.nextInt();
System.out.print(" 12、待检验数量:");
int check=sc.nextInt();
if(before!=chu+lost+feipin+check) {
System.out.println("您输入的数据有误,请稍后重新输入");
}
System.out.println("该产品入库操作已完成,是否提交(Y/N)");
System.out.println("***********************************************************");
char c=sc.next().charAt(0);
if(c=='Y') {
a[i].setProcess(nowwork);
a[i].setNextprocess(nextwork);
a[i].setOperator(Manmake(nowwork));
a[i].setRecipient(Manmake(nextwork));
a[i].setInnumber(before);
a[i].setOutnumber(chu);
a[i].setMissnumber(lost);
a[i].setBadnumber(feipin);
a[i].setInspectednumber(check);
a[i].setStatement(1);
menu();
}
else if(c=='N') {
Planmake();
}
}
else if(a[i].getPlanid().equals(pici)==true&&a[i].getStatement()==2)
{
title();
System.out.println(" 1、产品批次:"+a[i].getPlanid());
System.out.println(" 2、产品名称:"+a[i].getPlanname());
System.out.println(" 3、计划数量:"+a[i].getPlannumber());
System.out.print(" 4、当前工序:"+a[i].getProcess());
System.out.print(" 5、下一工序:"+a[i].getNextprocess());
System.out.print(" 6、操作员:"+a[i].getOperator());
System.out.print(" 7、接收员:"+a[i].getRecipient());
System.out.print(" 8、上一道工序转入数量:"+a[i].getInnumber());
System.out.print(" 9、转出总数:");
int chu=sc.nextInt();
System.out.print(" 10、丢失数量:");
int lost=sc.nextInt();
System.out.print(" 11、废品数量:");
int feipin=sc.nextInt();
System.out.print(" 12、待检验数量:");
int check=sc.nextInt();
if(a[i].getInnumber()!=chu+lost+feipin+check) {
System.out.println("您输入的数据有误,请稍后重新输入");
}
System.out.println("该产品入库操作已完成,是否提交(Y/N)");
System.out.println("***********************************************************");
char c=sc.next().charAt(0);
if(c=='Y') {
a[i].setOutnumber(chu);
a[i].setMissnumber(lost);
a[i].setBadnumber(feipin);
a[i].setInspectednumber(check);
a[i].setStatement(1);
menu();
}
else if(c=='N') {
Planmake();
}
}
else {
System.out.println("库中没有该产品计划");
Planshangjiao();
}
}
}
private String Manmake(String e) {
String result=null;
if(e.equals("射蜡")true) {
result="柳泽羽";
}
else if(e.equals("修蜡")true) {
result="藤艺哲";
}
else if(e.equals("面层")true) {
result="郝一诺";
}
else if(e.equals("封浆")true) {
result="杨松铎";
}
else if(e.equals("熔化")true) {
result="刘宇恒";
}
else if(e.equals("切割")true) {
result="陶攀印";
}
else if(e.equals("精磨")true) {
result="阎琪文";
}
else if(e.equals("调型")true) {
result="郝正一";
}
else if(e.equals("检验")==true) {
result="刘静一";
}
return result;
}
}