package com.jeeplus.modules.sg.balancedlibrary.liKuResourcePool.utils;

public class LiKuUtils {
    /**
     * 判断是否是段长数据
     * YES-是 NO-不是
     */
    public static final Integer YES = 1;
    public static final Integer NO = 0;

    /**
     * 地区编号值
     * HLA2-市公司 HLD1-扬中 HLB1-丹阳 句容-HLC1 未知地区-NO_PLACE
     */
    public static final String HLA2 = "HLA2";
    public static final String HLD1 = "HLD1";
    public static final String HLB1 = "HLB1";
    public static final String HLC1 = "HLC1";

    /**
     * 上报地区所属值
     */
    public static final String BB_PLACE = "市公司";
    public static final String YZ_PLACE = "扬中";
    public static final String DY_PLACE = "丹阳";
    public static final String JR_PLACE = "句容";

    /**
     * 判断库存地所属标记
     * BB_FLAG-市公司 YZ_FLAG-扬中 DY_FLAG-丹阳 JR_FLAG-句容 NO_FLAG-未知地区
     * */
    public static final Integer BB_FLAG = 1;
    public static final Integer YZ_FLAG = 2;
    public static final Integer DY_FLAG = 3;
    public static final Integer JR_FLAG = 4;
    public static final Integer NO_FLAG = 0;

    /**
     * 判断单位
     * */
    public static final String METER = "米";
    public static final String Kilometer = "千米";


    /**
     * 根据单位判断物资是否为段长
     * @param unit
     * @return
     */
    public static Integer isTheUnitMeter(String unit) {
        if (METER.equals(unit) || Kilometer.equals(unit)) {
            return YES;
        } else {
            return NO;
        }
    }

    /**
     * 判断物资或利库所属地区
     * @param area
     * @return
     */
    public static Integer judgmentArea(String area) {
        if (HLA2.equals(area) || area.contains(BB_PLACE)) {
            return BB_FLAG;
        } else if (HLD1.equals(area) || area.contains(YZ_PLACE)) {
            return YZ_FLAG;
        } else if (HLB1.equals(area) || area.contains(DY_PLACE)) {
            return DY_FLAG;
        } else if (HLC1.equals(area) || area.contains(JR_PLACE)) {
            return JR_FLAG;
        } else {
            return NO_FLAG;
        }
    }
}
