MaterialCategory.php 907 Bytes
Newer Older
王源's avatar
王源 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php
/**
 * Created by PhpStorm.
 * User: Zero
 * Date: 2020/3/23
 * Time: 17:45
 */

namespace Meibuyu\Micro\Constants;

class MaterialCategory
{

    const FU_LIAO = 1; // 辅料
    const MIAN_LIAO = 2; // 面料
    const LI_BU = 3; // 里布
    const HAO_CAI = 4; // 耗材

19 20 21
    const FU_LIAO_WAREHOUSE = 33;
    const MIAN_LIAO_WAREHOUSE = 36;

22 23 24 25 26 27
    /**
     * 通过原料类型获取对应仓库id
     * @param $categoryId
     * @return int
     * @throws \Exception
     */
王源's avatar
王源 committed
28
    public static function getWarehouseId($categoryId)
29 30 31 32
    {
        switch ($categoryId) {
            case self::FU_LIAO:
            case self::HAO_CAI:
33
                return self::FU_LIAO_WAREHOUSE;
34 35
            case self::MIAN_LIAO:
            case self::LI_BU:
36
                return self::MIAN_LIAO_WAREHOUSE;
37 38 39 40 41
            default:
                throw new \Exception("原料类型不存在");
        }
    }

王源's avatar
王源 committed
42
}