package com.steering.pss.ydm.base;

import java.util.ArrayList;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.converter.CoreConverter;
import com.steering.comm.db.DBCommon;

/**
 * 用于基础信息查询的公共类
 * @author WHB 2015-1-20
 */
public class YdmBaseQuery extends DBCommon {
    // 8001仓储作业单位
    public CoreReturnObject getManagement() {
        return this.getDataBySqlID("YdmBaseQuery.8001");
    }

    // 料架类型
    public CoreReturnObject getRackType() {
        return this.getDataBySqlID("YdmBaseQuery.8010");
    }

    // 料位属性
    public CoreReturnObject getLocationAttribute() {
        return this.getDataBySqlID("YdmBaseQuery.8005");
    }

    // 支持空间
    public CoreReturnObject getRackSp() {
        return this.getDataBySqlID("YdmBaseQuery.8011");
    }

    // 料位类型
    public CoreReturnObject getLocationType() {
        return this.getDataBySqlID("YdmBaseQuery.8004");
    }

    /**
     * 获取编码对应的备注
     * @param strbascCode 编码
     * @return 平台统一返回对象
     */
    public CoreReturnObject getStorageMemo(String strbascCode) {
        return this.getDataBySqlID("YdmBaseQuery.storageMemo",
                new Object[] { strbascCode });
    }

    /**
     * 库类型
     * @return 平台统一返回对象
     */
    public CoreReturnObject storageBind() {
        return this.getDataBySqlID("YdmBaseQuery.8003");
    }

    /**
     * 地址编码数据绑定
     * @return CoreReturnObject 地址编码数据
     */
    public CoreReturnObject addressCodeBind() {
        return this.getDataBySqlID("YdmBaseQuery.8009");
    }

    /**
     * 仓库类别数据绑定
     * @return CoreReturnObject 平台统一返回对象
     */
    public CoreReturnObject storageClass() {
        return this.getDataBySqlID("YdmBaseQuery.8002");
    }

    /**
     * 仓库的最大库号
     * @param storage "ZHH" 仓库类型+仓储地址
     * @return CoreReturnObject 最大库号
     */
    public CoreReturnObject storageEendCode(String storage) {
        return this.getDataBySqlID("YdmBaseQuery.storageEendCode",
                new Object[] { storage });
    }

    /**
     * 作业单位
     * @return CoreReturnObject 作业单位
     */
    public CoreReturnObject departQuery(String departMent,String flag) {
    	String _flag = flag;
    	if(_flag.equals("0"))
    	{
    		return this.getDataBySqlID("YdmBaseQuery.departQuery",new Object[]{"1"});
    	}else	
    	{
    		return this.getDataBySqlID("YdmBaseQuery.departQuery1",new Object[]{departMent});
    	}
//		String condition = CoreConverter.toSqlConditionString("DEPARTID",
//				arr);
//		String sql = CoreXmlSqlParsersFactory.getSql("YdmBaseQuery.departQuery");
//		sql = sql.replaceAll("#CONDITION#", condition);
		//sql += "  ORDER BY ORDER_NO,ORDER_SEQ,DELVRY_EDATE DESC ";
	//	return this.getData(sql);
		// return this.getDataBySqlID("CoreOrderReport.doQuery", params);

    	
    	
    	
        //return this.getDataBySqlID("YdmBaseQuery.departQuery");
    }

    /**
     * 作业单位
     * @param strDerartid 子节点ID
     * @return CoreReturnObject 作业单位
     */
    public CoreReturnObject getSuperior(String strDerartid) {
        return this.getDataBySqlID("YdmBaseQuery.getSuperior",
                new Object[] { strDerartid });
    }
}
