开学考试管理系统修改

修改之后还是有一些功能实现的不完全,但我已经尽力了
package test;

public class PlanInformation {
public static int temp=0;//将工序对应操作人员
public 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 innumbe;//接收的合格产品总数
private int outnumbe;//产品转出总数
private int missnumber;//产品丢失数量
private int badnumber;//产品废品数量
private int inspectednumber;//当前工序的产品待检验数量
private int statement;//表示该日报记录的状态,0表示初始计划,1表示日报提交,2表示日报确认。

public PlanInformation() {
}

public PlanInformation(int id, String planid, String planname, String process, String nextprocess, String operator, String recipient, int plannumber, int innumbe, int outnumbe, 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.innumbe = innumbe;
    this.outnumbe = outnumbe;
    this.missnumber = missnumber;
    this.badnumber = badnumber;
    this.inspectednumber = inspectednumber;
    this.statement = statement;
}

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 getInnumbe() {
    return innumbe;
}

public void setInnumbe(int innumbe) {
    this.innumbe = innumbe;
}

public int getOutnumbe() {
    return outnumbe;
}

public void setOutnumbe(int outnumbe) {
    this.outnumbe = outnumbe;
}

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

}
package test;

import java.util.Scanner;

public class PlanManagement {
private static PlanInformation[] plan = new PlanInformation[10];
//private static String[] p1={"10","20","30","40","50","60","70","80","90"};
private static String[] p1 = {"柳泽羽", "藤艺哲", "郝一诺", "杨松铎", "刘宇恒", "陶攀印", "阎琪文", "郝正一", "刘静一", "无"};
private static String[] p2 = {"10.射蜡", "20.修蜡", "30.面层", "40.封浆", "50.熔化", "60.切割", "70.精磨", "80.调型", "90.检验", "无"};
public static int count = 0;

public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    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("请输入选项:");
        int choice = scanner.nextInt();
        scanner.nextLine();
        switch (choice) {
            case 1:
                generate(scanner);
                break;
            case 2:
                submit(scanner);
                break;
            case 3:
                confirm(scanner);
                break;
            case 4:
                statistics(scanner);
                break;
            default:
                System.out.println("该选项不存在,请重新输入!");
                break;
        }
    }
}

//生成日报方法
public static void generate(Scanner scanner) {
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.print("产品批次:");
    String id = scanner.nextLine();
    if (id.length() != 8) {
        System.out.println("录入错误!");
        return;
    }
    System.out.print("产品名称:");
    String name = scanner.nextLine();
    System.out.print("计划数量:");
    int num = scanner.nextInt();
    scanner.nextLine();
    PlanInformation inform = new PlanInformation(1, id, name, "", "", "", "", num, 0, 0, 0, 0, 0, 0);
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.println("产品批次:" + inform.getPlanid());
    System.out.println("产品名称:" + inform.getPlanname());
    System.out.println("计划数量:" + inform.getPlannumber());
    System.out.println("该产品入库操作已完成,是否提交(Y/N)");
    System.out.println("***********************************************************");
    String flag = scanner.nextLine();
    if (flag.equals("Y")) {
        plan[count] = inform;
        plan[count].setStatement(0);//将批次状态statement设置成为0
        count++;
        System.out.println("信息储存成功!");
        return;
    } else {
        System.out.println("忽略上述录入内容!");
        return;
    }
}

//提交日报方法
public static void submit(Scanner scanner) {
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.print("请输入产品批次号:");
    String id1 = scanner.nextLine();
    if (id1.length() != 8) {
        System.out.println("录入错误!");
        return;
    }
    System.out.println("***********************************************************");
    int flag = 100, i;
    for (i = 0; i < plan.length; i++) {
        if (plan[i].getPlanid().equals(id1)) {
            flag = i;
            break;
        }
    }

    if (flag != i) {
        System.out.println("库中没有该产品批次。");
        return;
    }

    if (plan[flag].getStatement() == 0) {
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("***********************************************************");
        System.out.println("1、产品批次:" + plan[flag].getPlanid());
        System.out.println("2、产品名称:" + plan[flag].getPlanname());
        System.out.println("3、计划数量:" + plan[flag].getPlannumber());
        plan[flag].setProcess(p2[plan[flag].temp]);
        plan[flag].setNextprocess(p2[plan[flag].temp + 1]);
        System.out.println("4、当前工序:" + plan[flag].getProcess());
        System.out.println("5、下一工序:" + plan[flag].getNextprocess());
        plan[flag].setOperator(p1[plan[flag].temp]);
        plan[flag].setRecipient(p1[plan[flag].temp + 1]);
        System.out.println("6、操作员:" + plan[flag].getOperator());
        System.out.println("7、接收员:" + plan[flag].getRecipient());
        System.out.println("8、上一道工序转入数量:");
        int num4 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setInnumbe(num4);
        System.out.print("9、转出总数:");
        int num = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setOutnumbe(num);
        System.out.print("10、丢失数量:");
        int num1 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setMissnumber(num1);
        System.out.print("11、废品数量:");
        int num2 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setBadnumber(num2);
        System.out.print("12、待检验数量:");
        int num3 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setInspectednumber(num3);
        plan[flag].id++;
        if (plan[flag].getStatement() != 0) {
            if (num1 + num2 + num3 + num != num4) {
                System.out.println("录入错误,请修改上述信息!");
                return;
            }
        }
    } else if (plan[flag].getStatement() == 2) {
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("***********************************************************");
        System.out.println("1、产品批次:" + plan[flag].getPlanid());
        System.out.println("2、产品名称:" + plan[flag].getPlanname());
        System.out.println("3、计划数量:" + plan[flag].getPlannumber());
        plan[flag].setProcess(p2[plan[flag].temp]);
        plan[flag].setNextprocess(p2[plan[flag].temp + 1]);
        System.out.println("4、当前工序:" + plan[flag].getProcess());
        System.out.println("5、下一工序:" + plan[flag].getNextprocess());
        plan[flag].setOperator(p1[plan[flag].temp]);
        plan[flag].setRecipient(p1[plan[flag].temp + 1]);
        System.out.println("6、操作员:" + plan[flag].getOperator());
        System.out.println("7、接收员:" + plan[flag].getRecipient());
        System.out.println("8、上一道工序转入数量:");
        int num4 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setInnumbe(num4);
        System.out.print("9、转出总数:");
        int num = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setOutnumbe(num);
        System.out.print("10、丢失数量:");
        int num1 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setMissnumber(num1);
        System.out.print("11、废品数量:");
        int num2 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].setBadnumber(num2);
        System.out.print("12、待检验数量:");
        int num3 = scanner.nextInt();
        scanner.nextLine();
        plan[flag].id++;
        plan[flag].setInspectednumber(num3);
        if (num1 + num2 + num3 != num) {
            System.out.println("录入错误,请修改上述信息!");
            return;
        }
    }
    System.out.println("该产品批次已提交,是否保存(Y/N)");
    String flag1 = scanner.nextLine();
    if (flag1.equals("Y")) {
        plan[flag].setStatement(1);
        System.out.println("结果提交成功!");
        return;
    } else {
        System.out.println("忽略上述录入内容!");
        return;
    }
}

//确认日报方法
public static void confirm(Scanner scanner) {
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.print("请输入产品批次:");
    String id1 = scanner.nextLine();
    if (id1.length() != 8) {
        System.out.println("录入错误!");
        return;
    }
    System.out.println("***********************************************************");
    int flag = 100, i;

    for (i = 0; i < plan.length; i++) {
        if (plan[i].getPlanid().equals(id1)) {
            flag = i;
            break;
        }
    }

    if (flag != i) {
        System.out.println("库中没有该产品批次。");
        return;
    }
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.println("1、产品批次:" + plan[flag].getPlanid());
    System.out.println("2、产品名称:" + plan[flag].getPlanname());
    System.out.println("3、计划数量:" + plan[flag].getPlannumber());
    System.out.println("4、当前工序:" + plan[flag].getProcess());
    System.out.println("5、下一工序:" + plan[flag].getNextprocess());
    System.out.println("6、操作员:" + plan[flag].getOperator());
    System.out.println("7、接收员:" + plan[flag].getRecipient());
    System.out.println("8、上一道工序转入数量:" + plan[flag].getInnumbe());
    System.out.println("9、转出总数:" + plan[flag].getOutnumbe());
    System.out.println("10、丢失数量:" + plan[flag].getMissnumber());
    System.out.println("11、废品数量:" + plan[flag].getBadnumber());
    System.out.println("12、待检验数量:" + plan[flag].getInspectednumber());
    System.out.println("该产品批次已确认,是否确认结果(Y/N)");
    String flag1 = scanner.nextLine();
    if (flag1.equals("Y")) {
        plan[flag].temp++;
        plan[flag].setStatement(2);
        plan[flag].setProcess(p2[plan[flag].temp]);
        plan[flag].setNextprocess(p2[plan[flag].temp + 1]);
        plan[flag].setOperator(p1[plan[flag].temp]);
        plan[flag].setRecipient(p1[plan[flag].temp + 1]);
        plan[flag].setInnumbe(plan[flag].getOutnumbe() - plan[flag].getInspectednumber() - plan[flag].getBadnumber() - plan[flag].getMissnumber());
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("***********************************************************");
        System.out.println("1、产品批次:" + plan[flag].getPlanid());
        System.out.println("2、产品名称:" + plan[flag].getPlanname());
        System.out.println("3、计划数量:" + plan[flag].getPlannumber());
        System.out.println("4、当前工序:" + plan[flag].getProcess());
        System.out.println("5、下一工序:" + plan[flag].getNextprocess());
        System.out.println("6、操作员:" + plan[flag].getOperator());
        System.out.println("7、接收员:" + plan[flag].getRecipient());
        plan[flag].setInnumbe(plan[flag].getOutnumbe() + plan[flag].getMissnumber() + plan[flag].getBadnumber() + plan[flag].getInspectednumber());
        System.out.println("8、上一道工序转入数量:" + plan[flag].getInnumbe());
        return;
    } else {
        System.out.println("忽略上述录入内容!");
        return;
    }

}

//统计日报方法
public static void statistics(Scanner scanner) {
    System.out.println("***********************************************************");
    System.out.println("石家庄铁道大学无限23软件开发有限公司");
    System.out.println("Mes系统2023版");
    System.out.println("***********************************************************");
    for (int i = 0; i < plan.length; i++) {
        if (plan[i] != null && plan[i].id == 9) {
            System.out.println("1、产品批次:" + plan[i].getPlanid());
            System.out.println("2、产品名称:" + plan[i].getPlanname());
            System.out.println("3、计划数量:" + plan[i].getPlannumber());
            System.out.println("4、完成数量:" + plan[i].getOutnumbe());
            System.out.println("5、剩余数量:" + (plan[i].getPlannumber() - plan[i].getOutnumbe()));
            System.out.println("***********************************************************");
        }
        else{
            System.out.println("工序为空或产品未进行到最后一个工序");
            break;
        }
    }
}

}

posted @ 2024-09-24 21:49  Look_Back  阅读(4)  评论(0编辑  收藏  举报