首页 > 其他分享 >2024.9.29

2024.9.29

时间:2024-09-29 20:45:53浏览次数:7  
标签:String int 2024.9 29 System plan println out

信2305-3 20234094 刘奕阳
import java.util.Scanner;

public class MESSystem {

// 产品工艺表
private static final String[][] PROCESS_TABLE = {
    {"10", "射蜡", "柳泽羽"},
    {"20", "修蜡", "藤艺哲"},
    {"30", "面层", "郝一诺"},
    {"40", "封浆", "杨松铎"},
    {"50", "熔化", "刘宇恒"},
    {"60", "切割", "陶攀印"},
    {"70", "精磨", "阎琪文"},
    {"80", "调型", "郝正一"},
    {"90", "检验", "刘静一"}
};

private static PlanInformation[] records = new PlanInformation[5];
private static int recordCount = 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("**********************************************************");
        
        int choice = scanner.nextInt();
        scanner.nextLine(); // Consume newline
        
        switch (choice) {
            case 1:
                generatePlan(scanner);
                break;
            case 2:
                submitDailyReport(scanner);
                break;
            case 3:
                confirmDailyReport(scanner);
                break;
            case 4:
                reportProgress();
                break;
            default:
                System.out.println("该选项不存在");
                break;
        }
    }
}

private static void generatePlan(Scanner scanner) {
    System.out.println("请输入产品批次:");
    String planid = scanner.nextLine();
    System.out.println("请输入产品名称:");
    String planname = scanner.nextLine();
    System.out.println("请输入计划数量:");
    int plannumber = scanner.nextInt();
    scanner.nextLine(); // Consume newline
    
    System.out.println("***********************************************************");
    System.out.println("产品批次:" + planid);
    System.out.println("产品名称:" + planname);
    System.out.println("计划数量:" + plannumber);
    System.out.println("该产品入库操作已完成,是否提交(Y/N)");
    
    String choice = scanner.nextLine();
    if ("Y".equalsIgnoreCase(choice)) {
        PlanInformation plan = new PlanInformation(recordCount + 1, planid, planname, 
                PROCESS_TABLE[0][1], PROCESS_TABLE[1][1], 
                PROCESS_TABLE[0][2], PROCESS_TABLE[1][2], 
                plannumber, 0, 0, 0, 0, 0, 0);
        records[recordCount++] = plan;
    }
}

private static void submitDailyReport(Scanner scanner) {
    System.out.println("请输入产品批次号:");
    String planid = scanner.nextLine();
    
    PlanInformation plan = findPlanById(planid);
    if (plan == null) {
        System.out.println("库中没有该产品计划");
        return;
    }
    
    if (plan.getStatement() == 0) {
        recordDailyReport(scanner, plan);
    }
}

private static void recordDailyReport(Scanner scanner, PlanInformation plan) {
    System.out.println("产品批次:" + plan.getPlanid());
    System.out.println("产品名称:" + plan.getPlanname());
    System.out.println("计划数量:" + plan.getPlannumber());
    System.out.println("当前工序:" + plan.getProcess());
    System.out.println("下一工序:" + plan.getNextprocess());
    System.out.println("操作员:" + plan.getOperator());
    System.out.println("接收员:" + plan.getRecipient());
    
    int currentIndex = getProcessIndex(plan.getProcess());
    
    if (currentIndex > 0) {
        System.out.println("上一道工序转入数量:");
        int innumber = scanner.nextInt();
        plan.setInnumber(innumber);
    }
    
    System.out.println("转出总数:");
    int outnumber = scanner.nextInt();
    System.out.println("丢失数量:");
    int missnumber = scanner.nextInt();
    System.out.println("废品数量:");
    int badnumber = scanner.nextInt();
    System.out.println("待检验数量:");
    int inspectednumber = scanner.nextInt();
    scanner.nextLine(); // Consume newline
    
    if (plan.getInnumber() != outnumber + missnumber + badnumber + inspectednumber) {
        System.out.println("录入错误信息,请更改上述三个数量");
        return;
    }
    
    plan.setOutnumber(outnumber);
    plan.setMissnumber(missnumber);
    plan.setBadnumber(badnumber);
    plan.setInspectednumber(inspectednumber);
    
    System.out.println("确认提交(Y/N)");
    String choice = scanner.nextLine();
    if ("Y".equalsIgnoreCase(choice)) {
        plan.setStatement(1);
    }
}

private static void confirmDailyReport(Scanner scanner) {
    System.out.println("请输入产品批次:");
    String planid = scanner.nextLine();
    
    PlanInformation plan = findPlanById(planid);
    if (plan == null || plan.getStatement() != 1) {
        System.out.println("库中没有该产品批次或状态不正确");
        return;
    }
    
    System.out.println("产品批次:" + plan.getPlanid());
    System.out.println("产品名称:" + plan.getPlanname());
    System.out.println("计划数量:" + plan.getPlannumber());
    System.out.println("当前工序:" + plan.getProcess());
    System.out.println("下一工序:" + plan.getNextprocess());
    System.out.println("操作员:" + plan.getOperator());
    System.out.println("接收员:" + plan.getRecipient());
    System.out.println("上一道工序转入数量:" + plan.getInnumber());
    
    System.out.println("确认结果并生成新任务记录(Y/N)");
    String choice = scanner.nextLine();
    if ("Y".equalsIgnoreCase(choice)) {
        int currentIndex = getProcessIndex(plan.getProcess());
        plan.setStatement(2);
        
        if (currentIndex + 1 < PROCESS_TABLE.length) {
            PlanInformation newPlan = new PlanInformation(recordCount + 1, plan.getPlanid(), plan.getPlanname(),
                    PROCESS_TABLE[currentIndex + 1][1], 
                    currentIndex + 2 < PROCESS_TABLE.length ? PROCESS_TABLE[currentIndex + 2][1] : "",
                    PROCESS_TABLE[currentIndex + 1][2],
                    currentIndex + 2 < PROCESS_TABLE.length ? PROCESS_TABLE[currentIndex + 2][2] : "",
                    plan.getPlannumber(), plan.getOutnumber() - plan.getMissnumber() - plan.getBadnumber() - plan.getInspectednumber(),
                    0, 0, 0, 0, 0);
            records[recordCount++] = newPlan;
            System.out.println("新的生产任务记录已生成");
        }
    }
}

private static void reportProgress() {
    for (PlanInformation plan : records) {
        if (plan != null) {
            System.out.println("***********************************************************");
            System.out.println("产品批次:" + plan.getPlanid());
            System.out.println("产品名称:" + plan.getPlanname());
            System.out.println("计划数量:" + plan.getPlannumber());
            System.out.println("完成数量:" + ((plan.getStatement() == 2) ? plan.getOutnumber() : 0));
            System.out.println("剩余数量:" + (plan.getPlannumber() - ((plan.getStatement() == 2) ? plan.getOutnumber() : 0)));
        }
    }
}

private static int getProcessIndex(String process) {
    for (int i = 0; i < PROCESS_TABLE.length; i++) {
        if (PROCESS_TABLE[i][1].equals(process)) {
            return i;
        }
    }
    return -1;
}

private static PlanInformation findPlanById(String planid) {
    for (PlanInformation record : records) {
        if (record != null && record.getPlanid().equals(planid)) {
            return record;
        }
    }
    return null;
}

}

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;
    this.statement = statement;
}

// Getter 和 Setter 方法
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;
}

}

标签:String,int,2024.9,29,System,plan,println,out
From: https://www.cnblogs.com/-lyy/p/18440723

相关文章

  • 9.29
    //20234096韩坤信2305-3importjava.util.ArrayList;importjava.util.HashMap;importjava.util.List;importjava.util.Map;importjava.util.Scanner;publicclassPlanManagement{privatestaticListrecords=newArrayList<>();privatestaticMap<S......
  • AI预测体彩排3采取888=3策略+和值012路或胆码测试9月29日升级新模型预测第95弹
             经过90多期的测试,当然有很多彩友也一直在观察我每天发的预测结果,得到了一个非常有价值的信息,那就是9码定位的命中率非常高,已到达90%的命中率,这给喜欢打私菜的朋友提供了极高价值的预测结果~当然了,大部分菜友还是走的正常渠道,因此,得想办法进行缩水,尽可能少的......
  • 牛客 9.29 对标 ABC 比赛题面
    ABCDEF(E'shard)输入52214331524G......
  • 2024_9_29_3_北欧神话—希腊神话—罗马神话中的爱神维纳斯
    ---title:北欧神话—希腊神话—罗马神话中的爱神维纳斯description:#多个标签请使用英文逗号分隔或使用数组语法tags:杂谈#多个分类请使用英文逗号分隔或使用数组语法,暂不支持多级分类---相关:https://zhuanlan.zhihu.com/p/54688490爱神维纳斯是北欧、古希腊、罗马神......
  • 20240929
    TreeJourney猜结论#include<bits/stdc++.h>usingnamespacestd;#defineintlonglongconstintN=1e5+5;intn,k,ans,dep[N];vector<int>g[N];voiddfs(intu,intf){dep[u]=dep[f]+1;for(autov:g[u]){if(v==f)......
  • 9.29每日总结
    今天做完了“四则运算”和“生成验证码”,其中“生成验证码”这道题暑假的时候跟着网课做过初级版的,今天又加以改进了不少,为此把黑马的字符串章节差不多看完了,收获比较大的除了StringBuilder和StringJoiner之外,就是“验证码”这道题中用到的字符串转为字符数组(toCharArray),而“四......
  • 课后练习-登录-2024/9/29
    该登录界面是用JOptionPane弹窗接收用户名和密码,之后在数据库中搜索是否存在,最后显示登录成功与否实现loginTest.javapackageJDBC_Test;importcom.alibaba.druid.pool.DruidDataSource;importcom.alibaba.druid.pool.DruidDataSourceFactory;importjavax.sql.DataSou......
  • 9.29学习日志
    一.Python列表(list)Python支持多种复合数据类型,可将不同值组合在一起。最常用的**列表**,是用方括号标注,逗号分隔的一组值。列表可以包含不同类型的元素,但一般情况下,各个元素的类型相同#列表,是一种复合数据(数据容器)x=[10,20,3.14,10+20j,True,"a"]print(x)1、访问列......
  • 9.29Python基础-列表、元组
    Python列表(list)1.列表的定义和初始化列表是一种复合数据类型,可以包含不同类型的元素。x=[10,20,3.14,10+2j,True,False,"hqyj"]print(x)2.访问列表中的值2.1索引列表的索引从0开始,可以正向或反向访问。y1=x[0]#访问第一个元素y2=x[-1]#访......
  • 杂项乱写 9.29
    因为没有模拟赛,所以考虑捡捡之前漏下的小点。注:LCA之后的讲解中可能会出现一些自由的文字,酌情阅读。dfs序求LCA倍增LCA的常数还是过于大了,虽然好记但会导致我们在一些数据奇异的题中比其它方式求LCA的人的得分要低。所以就有了这个用dfs序求lca的高科技,在时间效率......