LocationAreaUtils.java 1.8 KB
package com.huaheng.common.utils;

import com.huaheng.common.constant.StationConstant;
import com.huaheng.common.exception.BusinessException;

/**
 * 库区 区域转换
 * @author huaheng
 */
public class LocationAreaUtils {

    /**
     * 包装区对应区域限制验证
     * @param  station
     * @return
     */
    public static String checkHLocationCheck(String station, String area) {
        String locationArea = "";
        switch (station) {
            case StationConstant.H1:
                if (!area.equals(StationConstant.HL1) && !area.equals(StationConstant.HL2)) {
                    throw new BusinessException("不能跨区域分配任务");
                }
                break;
            case StationConstant.H2:
                if (!area.equals(StationConstant.HL1) && !area.equals(StationConstant.HL2) && !area.equals(StationConstant.HL3)) {
                    throw new BusinessException("不能跨区域分配任务");
                }
                break;
            case StationConstant.H3:
                if (!area.equals(StationConstant.HL2) && !area.equals(StationConstant.HL3)) {
                    throw new BusinessException("不能跨区域分配任务");
                }
                break;
            case StationConstant.H4:
                if (!area.equals(StationConstant.HL4) && !area.equals(StationConstant.HL5)) {
                    throw new BusinessException("不能跨区域分配任务");
                }
                break;
            case StationConstant.H5:
                if (!area.equals(StationConstant.HL4) && !area.equals(StationConstant.HL5)) {
                    throw new BusinessException("不能跨区域分配任务");
                }
                break;
            default:
                break;
        }
        return locationArea;
    }

}