import java.util.Scanner;
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) {
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 int getId() {
return 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;
}
}
class PlanManagement {
private PlanInformation[] records;
private int recordCount;
public PlanManagement() {
records = new PlanInformation[5]; // 存储最多五个日报记录
recordCount = 0;
}
// 主界面
public void displayMainMenu() {
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("请选择功能(1-4):");
int choice = scanner.nextInt();
switch (choice) {
case 1:
generatePlan();
break;
case 2:
submitReport();
break;
case 3:
confirmReport();
break;
case 4:
statistics();
break;
default:
System.out.println("该选项不存在,请重新选择。");
break;
}
}
}
// 生成计划(方法体为空,可根据需求实现)
private void generatePlan() {
// 生成计划的逻辑
System.out.println("生成计划的功能尚未实现。");
}
// 提交日报
private void submitReport() {
if (recordCount >= 5) {
System.out.println("日报记录已满,无法提交新日报。");
return;
}
Scanner scanner = new Scanner(System.in);
System.out.print("请输入产品批次(格式:yyyy-xxx,8位):");
String planid = scanner.nextLine();
System.out.print("请输入产品名称:");
String planname = scanner.nextLine();
System.out.print("请输入当前工序:");
String process = scanner.nextLine();
System.out.print("请输入下一工序:");
String nextprocess = scanner.nextLine();
System.out.print("请输入操作员:");
String operator = scanner.nextLine();
System.out.print("请输入接收员:");
String recipient = scanner.nextLine();
System.out.print("请输入计划数量:");
int plannumber = scanner.nextInt();
System.out.print("请输入转入数量:");
int innumber = scanner.nextInt();
System.out.print("请输入转出总数:");
int outnumber = scanner.nextInt();
System.out.print("请输入丢失数量:");
int missnumber = scanner.nextInt();
System.out.print("请输入废品数量:");
int badnumber = scanner.nextInt();
System.out.print("请输入待检验数量:");
int inspectednumber = scanner.nextInt();
int statement = 0; // 初始状态
PlanInformation newRecord = new PlanInformation(planid, planname, process, nextprocess, operator, recipient,
plannumber, innumber, outnumber, missnumber, badnumber, inspectednumber, statement);
records[recordCount++] = newRecord;
System.out.println("日报提交成功!");
}
// 确认日报
private void confirmReport() {
Scanner scanner = new Scanner(System.in);
System.out.print("请输入产品批次(格式:yyyy-xxx,8位):");
String planid = scanner.nextLine();
PlanInformation foundRecord = null;
for (PlanInformation record : records) {
if (record != null && record.getPlanid().equals(planid) && record.getStatement() == 1) {
foundRecord = record;
break;
}
}
if (foundRecord == null) {
System.out.println("库中没有该产品批次或状态不正确。");
return;
}
// 显示日报信息
displayRecord(foundRecord);
System.out.print("确认结果(Y/N):");
String confirmation = scanner.next();
if (confirmation.equalsIgnoreCase("Y")) {
// 生成新的生产任务记录逻辑
foundRecord.setStatement(2); // 状态设置为确认
System.out.println("日报确认成功!");
displayRecord(foundRecord); // 重新显示确认后的日报信息
} else {
System.out.println("返回确认日报界面。");
}
}
private void displayRecord(PlanInformation record) {
System.out.println("***********************************************************");
System.out.println("产品批次:" + record.getPlanid());
System.out.println("产品名称:" + record.getPlanname());
System.out.println("计划数量:" + record.getPlannumber());
System.out.println("当前工序:" + record.getProcess());
System.out.println("下一工序:" + record.getNextprocess());
System.out.println("操作员:" + record.getOperator());
System.out.println("接收员:" + record.getRecipient());
System.out.println("上一道工序转入数量:" + (record.getId() == 1 ? "N/A" : record.getInnumber())); // 第一工序无需录入
System.out.println("转出总数:" + record.getOutnumber());
System.out.println("丢失数量:" + record.getMissnumber());
System.out.println("废品数量:" + record.getBadnumber());
System.out.println("待检验数量:" + record.getInspectednumber());
System.out.println("***********************************************************");
}
private void statistics() {
Scanner scanner = new Scanner(System.in);
System.out.print("请输入产品批次:");
String planid = scanner.nextLine();
PlanInformation foundRecord = null;
for (PlanInformation record : records) {
if (record != null && record.getPlanid().equals(planid)) {
foundRecord = record;
break;
}
}
if (foundRecord == null) {
System.out.println("库中没有该产品批次信息。");
return;
}
int completedQuantity = foundRecord.getOutnumber();
int remainingQuantity = foundRecord.getPlannumber() - completedQuantity;
System.out.println("***********************************************************");
System.out.println("产品批次:" + foundRecord.getPlanid());
System.out.println("产品名称:" + foundRecord.getPlanname());
System.out.println("计划数量:" + foundRecord.getPlannumber());
System.out.println("完成数量:" + completedQuantity);
System.out.println("剩余数量:" + remainingQuantity);
System.out.println("***********************************************************");
}
public static void main(String[] args) {
PlanManagement planManagement = new PlanManagement();
planManagement.displayMainMenu();
}
}
标签:开学,String,int,System,println,public,考试,out From: https://www.cnblogs.com/yangsongduo/p/18438470