You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
3.7 KiB
106 lines
3.7 KiB
package common.ecommerce.hengjian.enums; |
|
|
|
import common.ecommerce.warehouse.enums.InboundStatus; |
|
|
|
/** |
|
* 恒健入库计划单状态。 |
|
* |
|
* <p>两套码表要分清:</p> |
|
* <ul> |
|
* <li><b>列表接口</b>({@code getInboundPlanPage})的过滤参数 |
|
* {@code inboundPlanOrderStatusList} 用<b>数字码</b>: |
|
* 0 草稿 / 5 待审核 / 6 审核拒回 / 8 待装箱 / 10 待发货 / 15 待接收 / |
|
* 20 待入库 / 25 入库中 / 70 已完成 / 100 已取消。</li> |
|
* <li><b>详情</b>与<b>列表响应</b>的 {@code inboundPlanOrderStatus} 回的是 |
|
* 上面这些数字的<b>字符串形式</b>(示例里 {@code "70"}),偶尔也可能是中文名。</li> |
|
* </ul> |
|
* <p>所以 {@link #of(String)} 同时认数字串与中文名;两者都对不上归 {@link #UNKNOWN}。</p> |
|
* |
|
* <p><b>不是</b> {@code inboundOrderList[].inboundOrderStatus}——那是<b>入库单</b> |
|
* (实际收货单)的状态,码表是 0 草稿 / 70 已完成 / 90 已关闭,与计划单不同。 |
|
* 两者不能混用。</p> |
|
*/ |
|
public enum HengjianInboundStatus { |
|
|
|
/** 0 草稿。 */ |
|
DRAFT("0", "草稿", InboundStatus.DRAFT), |
|
/** 5 待审核。 */ |
|
PENDING_REVIEW("5", "待审核", InboundStatus.PENDING_REVIEW), |
|
/** 6 审核拒回。 */ |
|
// 注意:core 叫 REJECTED(审核拒绝),这里是「拒回」,语义相同 |
|
REJECTED("6", "审核拒回", InboundStatus.REJECTED), |
|
/** 8 待装箱。 */ |
|
PENDING_PACKING("8", "待装箱", InboundStatus.PENDING_PACKING), |
|
/** 10 待发货。 */ |
|
PENDING_SHIPMENT("10", "待发货", InboundStatus.PENDING_SHIPMENT), |
|
/** 15 待接收(货未到仓)。 */ |
|
PENDING_RECEIVING("15", "待接收", InboundStatus.IN_TRANSIT), |
|
/** 20 待入库(已收货,待上架)。 */ |
|
PENDING_STORAGE("20", "待入库", InboundStatus.PENDING_STORAGE), |
|
/** 25 入库中(上架中)。 */ |
|
STORING("25", "入库中", InboundStatus.STORING), |
|
/** 70 已完成。 */ |
|
COMPLETED("70", "已完成", InboundStatus.COMPLETED), |
|
/** 100 已取消。 */ |
|
CANCELLED("100", "已取消", InboundStatus.CANCELLED), |
|
/** 无法识别。 */ |
|
UNKNOWN(null, null, InboundStatus.UNKNOWN); |
|
|
|
private final String rawCode; |
|
private final String rawName; |
|
private final InboundStatus core; |
|
|
|
HengjianInboundStatus(String rawCode, String rawName, InboundStatus core) { |
|
this.rawCode = rawCode; |
|
this.rawName = rawName; |
|
this.core = core; |
|
} |
|
|
|
/** 仓方数字码(字符串形式);UNKNOWN 为 null。 */ |
|
public String rawCode() { |
|
return rawCode; |
|
} |
|
|
|
/** 仓方中文名;UNKNOWN 为 null。 */ |
|
public String rawName() { |
|
return rawName; |
|
} |
|
|
|
/** 下发给列表接口时用的数字码;UNKNOWN 返回 null。 */ |
|
public Integer codeForQuery() { |
|
return rawCode == null ? null : Integer.valueOf(rawCode); |
|
} |
|
|
|
public InboundStatus toCore() { |
|
return core; |
|
} |
|
|
|
/** |
|
* 仓方原值 → 平台枚举。 |
|
* |
|
* <p>先按数字串精确匹配,再按中文名精确匹配;都认不出归 {@link #UNKNOWN},<b>不猜</b>。</p> |
|
*/ |
|
public static HengjianInboundStatus of(String raw) { |
|
if (raw == null) { |
|
return UNKNOWN; |
|
} |
|
String s = raw.trim(); |
|
if (s.isEmpty()) { |
|
return UNKNOWN; |
|
} |
|
for (HengjianInboundStatus v : values()) { |
|
if (v == UNKNOWN) { |
|
continue; |
|
} |
|
if (s.equals(v.rawCode) || s.equals(v.rawName)) { |
|
return v; |
|
} |
|
} |
|
return UNKNOWN; |
|
} |
|
|
|
/** 仓方原值 → 底层状态。 */ |
|
public static InboundStatus toCore(String raw) { |
|
return of(raw).toCore(); |
|
} |
|
}
|
|
|