package com.uas.platform.b2b.model;

public enum OrderType {
	/**
	 * {@code 100 采购}
	 */
	purc(100, "采购单"),

	/**
	 * {@code 101销售}
	 */
	sale(101, "销售单"),

	/**
	 * {@code 102 发货单}
	 */
	salesend(102, "发货单"),

	/**
	 * {@code 103发货提醒}
	 */
	salenotice(103, "发货提醒"),

	/**
	 * {@code 104采购询价}
	 */
	purcinquiry(104, "采购询价单"),

	/**
	 * {@code 105销售询价}
	 */
	saleinquiry(105, "销售询价单"),

	/**
	 * {@code 106代采订单}
	 */
	deputyorder(106, "代采订单"),

	/**
	 * {@code 107模具询价单}
	 */
	inquirymould(107, "模具询价单"),

	/**
	 * {@code 108客户采购验退单}
	 */
	salereturn(108, "客户采购验退单"),

	/**
	 * {@code 109客户采购验收单}
	 */
	saleaccept(109, "客户采购验收单"),

	/**
	 * {@code 110应收对账单}
	 */
	apcheck(110, "应收对账单"),

	/**
	 * {@code 111 委外验退单}
	 */
	makereturn(111, "委外验退单"),

	/**
	 * {@code 112 委外验收单}
	 */
	makeaccpet(112, "委外验收单");

	private OrderType(int value, String phrase) {
		this.value = value;
		this.phrase = phrase;
	}

	private final int value;

	private final String phrase;

	/**
	 * @return 状态的整型编码
	 */
	public int value() {
		return this.value;
	}

	/**
	 * @return 状态的描述
	 */
	public String getPhrase() {
		return this.phrase;
	}

	/**
	 * @param statusCode
	 *            状态的编码
	 * @return 状态
	 * @throws IllegalArgumentException
	 *             如果statusCode不存在的话
	 */
	public static OrderType valueOf(int statusCode) {
		for (OrderType status : values()) {
			if (status.value == statusCode) {
				return status;
			}
		}
		throw new IllegalArgumentException("没有与编号 [" + statusCode + "]匹配的状态");
	}

	/**
	 * 返回状态的编号
	 */
	@Override
	public String toString() {
		return Integer.toString(value);
	}
}
