package cn.iocoder.yudao.module.mes.enums.pro;
|
|
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
import java.util.Arrays;
|
|
/**
|
* MES 工序计费类型枚举
|
*
|
* <p>决定报工工资的计算口径:
|
* <ul>
|
* <li>计时:报工工资 = 本次报工工时 × 工资定额(元/小时)</li>
|
* <li>计件:报工工资 = 本次报工数量 × 工资定额(元/件)</li>
|
* </ul>
|
*
|
* @author 超级管理员
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum MesProProcessBillingTypeEnum implements ArrayValuable<Integer> {
|
|
TIME(1, "计时"),
|
PIECE(2, "计件");
|
|
public static final Integer[] ARRAYS = Arrays.stream(values())
|
.map(MesProProcessBillingTypeEnum::getType).toArray(Integer[]::new);
|
|
/**
|
* 类型值
|
*/
|
private final Integer type;
|
/**
|
* 类型名
|
*/
|
private final String name;
|
|
@Override
|
public Integer[] array() {
|
return ARRAYS;
|
}
|
|
public static MesProProcessBillingTypeEnum valueOfType(Integer type) {
|
if (type == null) {
|
return null;
|
}
|
return Arrays.stream(values()).filter(e -> e.getType().equals(type)).findFirst().orElse(null);
|
}
|
|
public static String getNameByType(Integer type) {
|
MesProProcessBillingTypeEnum billingType = valueOfType(type);
|
return billingType != null ? billingType.getName() : String.valueOf(type);
|
}
|
|
}
|