首页 > 其他分享 >一考代码精简

一考代码精简

时间:2024-09-26 16:34:49浏览次数:1  
标签:一考 String Information int 代码 System println 精简 out

import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

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;
}
public int getid() {
return id;
}
public String getplanname() {
return planname;
}
public String getprocess() {
return process;
}
public String getplanid() {
return planid;
}
public String getnextpocess() {
return nextprocess;
}
public String getoperator() {
return operator;
}
public String getrecipient() {
return recipient;
}
public int getplannumber() {
return plannumber;
}
public int getinnumber() {
return innumber;
}
public int getoutnumber() {
return outnumber;
}
public int getmissnumber() {
return missnumber;
}
public int getbadnumber() {
return badnumber;
}
public int getinspectednumber() {
return inspectednumber;
}
public int getstatement() {
return statement;
}

public void setid(int id) {
    this.id = id;
}
public void setplanid(String planid) {
    this.planid = planid;
}
public void setplanname(String planname) {
    this.planname = planname;
}
public void setprocess(String process) {
    this.process = process;
}
public void setnextprocess(String nextprocess) {
    this.nextprocess = nextprocess;
}
public void setoperator(String operator) {
    this.operator = operator;
}
public void setrecipient(String recipient) {
    this.recipient = recipient;
}
public void setplannumber(int plannumber) {
    this.plannumber = plannumber;
}
public void setinnumber(int innumber) {
    this.innumber = innumber;
}
public void setoutnumber(int outnumber) {
    this.outnumber = outnumber;
}
public void setmissnumber(int missnumber) {
    this.missnumber = missnumber;
}
public void setbadnumber(int badnumber) {
    this.badnumber = badnumber;
}
public void setinspectednumber(int inspectednumber) {
    this.inspectednumber = inspectednumber;
}
public void setstatement(int statement) {
    this.statement = statement;
}

}

public class PlanManagement {
private static List PlanInformationList = new ArrayList<>();
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
displayMainMenu();
int choice = scanner.nextInt();
scanner.nextLine();
switch (choice) {
case 1:
ProductPlan();
break;
case 2:
SubmitDaily();
break;
case 3:
ConfirmDaily();
break;
case 4:
StatisticalProgress();
break;
default:
System.out.println("该选项不存在,请重新输入");
}
}
}

private static void displayMainMenu() {
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.println("请输入选项(1-4):");
}

private static PlanInformation findInformationByplanid(String planid) {
for (PlanInformation info : PlanInformationList) {
if (info.getplanid().equals(planid)) {
return info;
}
}
return null;
}

private static void ProductPlan() {
System.out.println("");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("
");
System.out.print("产品批次:");
String planid = scanner.nextLine();
System.out.print("产品名称:");
String planname = scanner.nextLine();
System.out.print("计划数量:");
int plannumber = scanner.nextInt();
scanner.nextLine();
System.out.println("**********************************************************");

if (planid.isEmpty() || planname.isEmpty() || plannumber <= 0) {
    System.out.println("录入错误");
    return;
}

PlanInformation Information = new PlanInformation(0, planid, planname, "", "", "", "", plannumber, 0, 0, 0, 0, 0, 0);
PlanInformationList.add(Information);

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)");
System.out.println("**********************************************************");
String confirm = scanner.nextLine();
if (confirm.equalsIgnoreCase("Y")) {
    System.out.println("商品信息已提交,返回主界面。");
} else {
    PlanInformationList.remove(Information);
    System.out.println("商品信息未提交,返回产品入库界面。");
}

}

private static void SubmitDaily() {
System.out.println("");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("
");
System.out.println("请输入产品批次号:");
String planid = scanner.nextLine();
System.out.println("***********************************************************");
PlanInformation Information = findInformationByplanid(planid);
if (Information == null) {
System.out.println("库中没有该产品计划,返回到提交界面。");
return;
}

int statement = Information.getstatement();

if (statement == 0) {
    System.out.println("***********************************************************");
    System.out.println("          石家庄铁道大学无限23软件开发有限公司");
    System.out.println("                    Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.println("1、产品批次:" + Information.getplanid());
    System.out.println("2、产品名称:" + Information.getplanname());
    System.out.println("3、计划数量:" + Information.getplannumber());
    System.out.println("4、当前工序:" + Information.getprocess());
    System.out.println("5、下一工序:" + Information.getnextpocess());
    System.out.println("6、操作员:" + Information.getoperator());
    System.out.println("7、接收员:" + Information.getrecipient());
    System.out.println("8、上一道工序转入数量:" + Information.getinnumber());
    System.out.println("9、转出总数:" + Information.getoutnumber());
    System.out.println("10、丢失数量:" + Information.getmissnumber());
    System.out.println("11、废品数量:" + Information.getbadnumber());
    System.out.println("12、待检验数量:" + Information.getinspectednumber());
} else if (statement == 2) {
    System.out.println("***********************************************************");
    System.out.println("          石家庄铁道大学无限23软件开发有限公司");
    System.out.println("                    Mes系统2023版");
    System.out.println("***********************************************************");
    System.out.println("1、产品批次:" + Information.getplanid());
    System.out.println("2、产品名称:" + Information.getplanname());
    System.out.println("3、计划数量:" + Information.getplannumber());
    System.out.println("4、当前工序:" + Information.getprocess());
    System.out.println("5、下一工序:" + Information.getnextpocess());
    System.out.println("6、操作员:" + Information.getoperator());
    System.out.println("7、接收员:" + Information.getrecipient());
    System.out.println("8、上一道工序转入数量:" + Information.getinnumber());
}

}

private static void ConfirmDaily() {
System.out.println("");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("
");
System.out.println("请输入产品批次号:XXXXXXXX");
String planid = scanner.nextLine();
System.out.println("");
PlanInformation Information = findInformationByplanid(planid);
if (Information == null) {
System.out.println("库中没有该产品批次,返回到确认日报界面。");
return;
}
System.out.println("
");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("");
System.out.println("1、产品批次:"+ Information.getplanid());
System.out.println("2、产品名称:"+ Information.getplanname());
System.out.println("3、计划数量:"+ Information.getplannumber());
System.out.println("4、当前工序:"+ Information.getprocess());
System.out.println("5、下一工序:"+ Information.getnextpocess());
System.out.println("6、操作员:"+ Information.getoperator());
System.out.println("7、接收员:"+ Information.getrecipient());
System.out.println("8、上一道工序转入数量:"+ Information.getinnumber());
System.out.println("9、转出总数:"+ Information.getoutnumber());
System.out.println("10、丢失数量:"+ Information.getmissnumber());
System.out.println("11、废品数量:"+ Information.getbadnumber());
System.out.println("12、待检验数量:"+ Information.getinspectednumber());
System.out.println("是否确认(Y/N)");
System.out.println("
");
String confirm = scanner.nextLine();
if (confirm.equalsIgnoreCase("Y")) {
System.out.println("已确认。");
System.out.println("将批次状态statement设置成为2");
System.out.println("");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("
");
System.out.println("1、产品批次:"+ Information.getplanid());
System.out.println("2、产品名称:"+ Information.getplanname());
System.out.println("3、计划数量:"+ Information.getplannumber());
System.out.println("4、当前工序:"+ Information.getprocess());
System.out.println("5、下一工序:"+ Information.getnextpocess());
System.out.println("6、操作员:"+ Information.getoperator());
System.out.println("7、接收员:"+ Information.getrecipient());
System.out.println("8、上一道工序转入数量:"+ Information.getinnumber());
System.out.println("***********************************************************");
} else {
System.out.println("已返回。");
return;
}
}

private static void StatisticalProgress() {
System.out.println("");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("
");
System.out.println("抱歉未实现...");
System.out.println("***********************************************************");

}

}
有些功能未实现

标签:一考,String,Information,int,代码,System,println,精简,out
From: https://www.cnblogs.com/lzq233/p/18433668

相关文章

  • 如何利用大模型提升前端研发效率和代码质量
     随着人工智能技术的飞速发展,尤其是大模型(LargeLanguageModels,LLM)的崛起,前端开发者迎来了全新的工作方式。大模型不仅可以提升研发效率,还能够显著提高代码质量。本文将深入探讨前端开发者如何利用大模型及其相关工具,提升工作效率和代码质量,并探讨未来可能的应用场景和发展方向......
  • 老牌经典音乐播放器Winamp终于开放源代码!但禁止修改和分叉
    9月25日消息,Winamp这个2000年代的经典音乐播放器,终于开放了其Windows端的源代码。Winamp的源代码托管在GitHub上,采用WinampCollaborativeLicense(WCL)Version1.0协议。根据该协议,开发者可改进功能并更新播放器UI,满足当前用户的需求,但不得基于该源代码进行分叉、修改或维护分叉......
  • jquery中判断图片是否存在的实现代码
    有时候我们需要判断当前的图片是否存在,方便后期做一些操作,当然也可以参考上一篇文章,如果不存在就替换位默认图片functionisHasImg(src){varimg=newImage();img.src=src;img.onload=function(){if(img.width>0||img.height>0){......
  • 短视频矩阵系统源代码开发技术方案分享
    开发一个短视频矩阵系统的源码可以按照以下技术方案进行:前端开发:使用HTML5、CSS3和JavaScript技术开发前端界面。可以采用Vue.js或React等流行的前端框架来实现页面展示和用户交互功能。后端开发:采用Java或Python等编程语言作为后端开发语言,使用SpringBoot或Django等框架......
  • 一次基于AST的大规模代码迁移实践
    作者:来自vivo互联网大前端团队-WeiXing在研发项目过程中,我们经常会遇到技术架构迭代更新的需求,通过技术的迭代更新,让项目从新的技术特性中受益,但由于很多新的技术迭代版本并不能完全向下兼容,包含了很多非兼容性的改变(BreakingChanges),因此我们需要设计一款工具,帮助我们完成大规......
  • 如何写出让同事无法维护的代码
    一、程序命名容易输入的变量名。比如:Fred,asdf单字母的变量名。比如:a,b,c,x,y,z(如果不够用,可以考虑a1,a2,a3,a4,….)有创意地拼写错误。比如:SetPintleOpening,SetPintalClosing。这样可以让人很难搜索代码。抽象。比如:ProcessData,DoIt,GetData…抽象到就跟什么都没说一样。缩写......
  • 一次基于AST的大规模代码迁移实践
    作者:来自vivo互联网大前端团队-WeiXing在研发项目过程中,我们经常会遇到技术架构迭代更新的需求,通过技术的迭代更新,让项目从新的技术特性中受益,但由于很多新的技术迭代版本并不能完全向下兼容,包含了很多非兼容性的改变(BreakingChanges),因此我们需要设计一款工具,帮助我们完成......
  • 揭秘 Git-stash:掌握暂存技巧,让代码更整洁!
    stash可以冻结目前的状态‍在gitstash出现之前当我们在开发一个新功能的时候,突然来了一个紧急的bug要修复,此时我们可以创建一个分支去修复它;但如果,切换会导致冲突的话,就会切换失败。我们来模拟下(先确保工作区是干净的):$gitbranchbug02$echo"test">>3-branch/br......
  • Git 分支管理全攻略:一篇博客带你玩转代码分支!
    什么是分支?在Git里,分支其实就有点像一个树的枝杈,每个分支上可以有不同的文件的版本,并且不会互相干扰。​分支功能有什么用?在工作中,我们经常是需要和别人一起开发一个项目的,此时可能你开发A功能,别人开发B功能;如果只有一个分支的话,那么所有人都得在这个分支上干活;如果你开发......
  • 一键去水印小程序源码系统 下载无水印的高清图片 带完整的安装代码包以及搭建部署教程
    系统概述一键去水印小程序源码系统是一款专为图片去水印设计的软件开发包(SDK),它集成了先进的图像处理技术和智能识别算法,能够自动识别并去除图片中的水印,同时保持图片的高清画质不受损。该系统支持多种图片格式,包括但不限于JPEG、PNG、GIF等,广泛适用于电商、设计、教育、自媒体......