package cn.iocoder.yudao.module.erp.enums;
|
|
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
import java.util.Arrays;
|
|
/**
|
* ERP 采购订单审批状态枚举
|
*
|
* <p>改造说明:采购订单原先复用 {@link ErpAuditStatus} 并依赖 BPM(Flowable)流程审批,
|
* 现改为与「产品技术确认函」一致的轻量级单级/或签状态机,故独立定义本枚举,
|
* 避免与 {@link ErpAuditStatus} 中 CANCEL(30, 已作废) 的取值冲突。
|
*
|
* <p>取值与字典 erp_audit_status 对齐(0 草稿 / 10 审批中 / 20 审批通过 / 30 审批不通过),
|
* 因此列表页仍可沿用 CellDict 渲染,无需新增字典类型。
|
* APPROVE 保持为 20,与既有「已审核才能入库/退货」等判断完全兼容。
|
*
|
* @author 超级管理员
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum ErpPurchaseOrderStatusEnum implements ArrayValuable<Integer> {
|
|
DRAFT(0, "未提交"),
|
PROCESS(10, "审批中"),
|
APPROVE(20, "审核通过"),
|
REJECT(30, "审核不通过"),
|
CANCEL(40, "已取消");
|
|
public static final Integer[] ARRAYS = Arrays.stream(values())
|
.map(ErpPurchaseOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
|
public static ErpPurchaseOrderStatusEnum fromStatus(Integer status) {
|
if (status == null) {
|
return null;
|
}
|
return Arrays.stream(values()).filter(item -> item.getStatus().equals(status)).findFirst().orElse(null);
|
}
|
|
public static ErpPurchaseOrderStatusEnum fromName(String name) {
|
if (name == null) {
|
return null;
|
}
|
return Arrays.stream(values()).filter(item -> item.getName().equals(name)).findFirst().orElse(null);
|
}
|
|
/**
|
* 状态
|
*/
|
private final Integer status;
|
/**
|
* 状态名
|
*/
|
private final String name;
|
|
@Override
|
public Integer[] array() {
|
return ARRAYS;
|
}
|
|
}
|