fix:出入库枚举修改

This commit is contained in:
2023-05-11 16:48:25 +08:00
parent 0e6913243c
commit 36fa3dfd95

View File

@@ -16,29 +16,30 @@ import java.util.Map;
@Getter
public enum IOSEnum {
//出入库类型
IO_TYPE(MapOf.of("入库","1","出库","2")),
IO_TYPE(MapOf.of("入库", "1", "出库", "2")),
//单据类型
BILL_TYPE(MapOf.of("生产入库","1","手工入库","2")),
BILL_TYPE(MapOf.of("生产入库", "1", "手工入库", "2")),
//单据状态
BILL_STATUS(MapOf.of("生成","1","分配中","2","分配完","3","完成","9")),
BILL_STATUS(MapOf.of("生成", "10", "分配中", "20", "分配完", "30", "完成", "99")),
//单据状态
WORK_STATUS(MapOf.of("生成","1","下发","2")),
WORK_STATUS(MapOf.of("生成", "00", "生成", "10", "执行中", "20", "完成", "99")),
;
private Map<String,String> code;
private Map<String, String> code;
public String code(String desc){
public String code(String desc) {
String code = this.getCode().get(desc);
if (StringUtils.isNotEmpty(code)){
if (StringUtils.isNotEmpty(code)) {
return code;
}
throw new BadRequestException(this.name()+"对应类型"+desc+"未定义");
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
}
public String check(String code){
public String check(String code) {
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
if (entry.getValue().equals("code")){
if (entry.getValue().equals("code")) {
return entry.getValue();
}
}
throw new BadRequestException(this.name()+"对应类型"+code+"未定义");
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
}
}