九月十一日
完成了前两项内容package a1;
import java.util.*;
import java.util.Scanner;
public class PlanManagement {
private PlanInformation[] records;
private int count;
public PlanManagement() {
records = new PlanInformation[5]; // 创建一个存储5个记录的数组
count = 0;
}
public void showMainMenu() {
Scanner scanner = new Scanner(System.in);
int choice;
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): ");
choice = scanner.nextInt();
switch (choice) {
case 1:
generatePlan();
break;
case 2:
submitReport();
break;
case 3:
confirmReport();
break;
case 4:
showProgress();
break;
default:
System.out.println("该选项不存在,请重新选择。");
break;
}
}
}
int gongxun[]= {1,2,3,4,5,6,7,8,9};
String gongxunming[]= {"10.00.射蜡","20.00.修蜡","30.00.面层","40.00.封浆","50.00.熔化","60.00.切割","70.00.精磨","80.00.调型","90.00.检验"};
String caozuoyuan[]= {"柳泽羽","藤艺哲","郝一诺","杨松铎","刘宇恒","陶攀印","阎琪文","郝正一","刘静一"};
private void generatePlan() {
Scanner scanner = new Scanner(System.in);
String planid, planname;
int plannumber;
while (true) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.print("产品批次:");
planid = scanner.nextLine();
if (planid.isEmpty()) {
System.out.println("录入错误,请重新输入产品批次。");
continue;
}
System.out.print("产品名称:");
planname = scanner.nextLine();
if (planname.isEmpty()) {
System.out.println("录入错误,请重新输入产品名称。");
continue;
}
System.out.print("计划数量:");
while (!scanner.hasNextInt()) {
System.out.println("录入错误,请重新输入计划数量。");
scanner.next(); // 清除无效输入
System.out.print("计划数量:");
}
plannumber = scanner.nextInt();
scanner.nextLine(); // 处理换行符
// 显示录入的内容
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.println("产品批次:" + planid);
System.out.println("产品名称:" + planname);
System.out.println("计划数量:" + plannumber);
System.out.println("该产品入库操作已完成,是否提交(Y/N)");
char confirm = scanner.nextLine().toUpperCase().charAt(0);
if (confirm == 'Y') {
if (count < records.length) {
records[count++] = new PlanInformation(
1, planid, planname, "10.00.射蜡", "20.00.修蜡", "柳泽羽", "藤艺哲", plannumber, plannumber, 0, 0, 0, 0, 0
);
System.out.println("产品信息已存储。");
break;
} else {
System.out.println("记录存储空间已满。");
break;
}
} else if (confirm == 'N') {
System.out.println("忽略录入内容,返回产品入库界面。");
continue;
} else {
System.out.println("无效选择,请重新选择。");
}
}
}
private void submitReport() {
Scanner scanner = new Scanner(System.in);
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.print("请输入产品批次号:");
String inputBatchId = scanner.nextLine();
// 查找产品批次
PlanInformation plan = findPlanByBatchId(inputBatchId);
if (plan == null) {
System.out.println("库中没有该产品计划。");
return; // 返回到提交日报界面
}
if (plan.getstatement() == 2) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.println("1、产品批次:" + plan.getplanid());
System.out.println("2、产品名称:" + plan.getplanname());
System.out.println("3、计划数量:" + plan.getplannumber());
System.out.print("4、当前工序:"+plan.getprocess());
System.out.print("5、下一工序:"+plan.getnextprocess());
System.out.print("6、操作员:"+plan.getoperator());
System.out.print("7、接收员:"+plan.getrecipient());
System.out.print("8、上一道工序转入数量:"+plan.getinnumber());
System.out.print("9、转出总数:");
int outNumber = Integer.parseInt(scanner.nextLine());
plan.setoutnumber(outNumber);
System.out.print("10、丢失数量:");
int missnumber=Integer.parseInt(scanner.nextLine());
plan.setmissnumber(missnumber);
System.out.print("11、废品数量:");
int badnumber=Integer.parseInt(scanner.nextLine());
plan.setbadnumber(badnumber);
System.out.print("12、待检验数量:");
int inspectednumber=Integer.parseInt(scanner.nextLine());
plan.setinspectednumber(inspectednumber);
System.out.println("日报已提交。");
plan.setstatement(1);
return ;
}
if (plan.getstatement() == 0) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.println("1、产品批次:" + plan.getplanid());
System.out.println("2、产品名称:" + plan.getplanname());
System.out.println("3、计划数量:" + plan.getplannumber());
System.out.print("9、转出总数:");
int outNumber = Integer.parseInt(scanner.nextLine());
plan.setoutnumber(outNumber);
System.out.print("10、丢失数量:");
int missnumber=Integer.parseInt(scanner.nextLine());
plan.setmissnumber(missnumber);
System.out.print("11、废品数量:");
int badnumber=Integer.parseInt(scanner.nextLine());
plan.setbadnumber(badnumber);
System.out.print("12、待检验数量:");
int inspectednumber=Integer.parseInt(scanner.nextLine());
plan.setinspectednumber(inspectednumber);
System.out.println("日报已提交。");
plan.setstatement(1);
return ;
}
}
private PlanInformation findPlanByBatchId(String batchId) {
for (int i = 0; i < count; i++) {
if (records[i].getplanid().equals(batchId)) {
return records[i];
}
}
return null; // 如果没有找到对应的计划
}
private void confirmReport() {
Scanner scanner = new Scanner(System.in);
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.print("请输入产品批次号:");
String inputBatchId = scanner.nextLine();
// 查找产品批次
PlanInformation plan = findPlanByBatchId(inputBatchId);
if (plan == null) {
System.out.println("库中没有该产品计划。");
return; // 返回到提交日报界面
}
if(plan.getstatement() == 2){
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学无限23软件开发有限公司");
System.out.println("Mes系统2023版");
System.out.println("***********************************************************");
System.out.println("1、产品批次:" + plan.getplanid());
System.out.println("2、产品名称:" + plan.getplanname());
System.out.println("3、计划数量:" + plan.getplannumber());
System.out.print("4、当前工序:"+plan.getprocess());
System.out.print("5、下一工序:"+plan.getnextprocess());
System.out.print("6、操作员:"+plan.getoperator());
System.out.print("7、接收员:"+plan.getrecipient());
System.out.print("8、上一道工序转入数量:"+plan.getinnumber());
System.out.print("9、转出总数:"+plan.getoutnumber());
System.out.print("10、丢失数量:"+plan.getoutnumber());
int missnumber=Integer.parseInt(scanner.nextLine());
plan.setmissnumber(missnumber);
System.out.print("11、废品数量:"+plan.getoutnumber());
int badnumber=Integer.parseInt(scanner.nextLine());
plan.setbadnumber(badnumber);
System.out.print("12、待检验数量:"+plan.getinspectednumber());
System.out.println("日报已提交。");
plan.setstatement(1);
}
}
private void showProgress() {
// 实现统计进度的功能
System.out.println("统计进度功能尚未实现。");
}
public static void main(String[] args) {
PlanManagement pm = new PlanManagement();
pm.showMainMenu();
}
}