TaskStatusAgvEnum.java 1.24 KB
package com.huaheng.common.utils;

public enum TaskStatusAgvEnum {
    TASK1(1, "创建"),
    TASK10(10, "下发ACS"),
    TASK20(20, "取料"),
    TASK30(30, "执行中"),
    TASK100(100, "AGV任务完成");

//    TASK50(50, "XZ00014");
    private Integer taskStatusName;
    private String taskStatusCode;


    // 构造方法
    private TaskStatusAgvEnum(Integer taskStatusName, String taskStatusCode) {
        this.taskStatusName = taskStatusName;
        this.taskStatusCode = taskStatusCode;
    }

    public static String getTaskStatusCode(Integer taskStatusName){
        for (TaskStatusAgvEnum taskStatusEnum : TaskStatusAgvEnum.values()) {
            if (taskStatusEnum.taskStatusName.equals(taskStatusName)){
                return taskStatusEnum.taskStatusCode;
            }
        }
        return null;
    }
    public static void main(String[] args) {
        TaskStatusAgvEnum[] values = TaskStatusAgvEnum.values();
//        for (TaskStatusEnum value : values) {
//            System.out.println(value + " taskStatusCode: " + value.taskStatusCode + " taskStatusName: " + value.taskStatusName);
//        }
//        System.out.println("======================");

        System.out.println(TaskStatusAgvEnum.getTaskStatusCode(10));

    }

}