package com.steering.mes.signature;

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 TJG 2015-04-09
 */
public class PipeManageClassInfo extends DBCommon {

	public CoreReturnObject getDeptBySection(String section){
        Object[] params = new Object[]{section};
        return this.getDataBySqlID("PipeManageClassInfo.getDepartmentBySectionID", params);
    }
	
    /**
     * 根据仓库类型、仓库类别、科室查询仓库号
     * @param list 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryStorage(ArrayList<String> list) {
        return this.getDataBySqlID("PipeManageClassInfo.queryStorage", list
                .toArray());
    }

    /**
     * 根据仓库号查询料位号
     * @param list 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryLocation(ArrayList<String> list) {
        return this.getDataBySqlID("PipeManageClassInfo.queryLocation", list
                .toArray());
    }

    /**
     * 出库类型查询
     * @param strcoed 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryType(String strcoed) {
        return this.getDataBySqlID("PipeManageClassInfo.queryType",
                new Object[] { strcoed });
    }

    /**
     * 出库类型查询
     * @param strcoed 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryPline(String strcoed) {
        return this.getDataBySqlID("PipeManageClassInfo.queryPline",
                new Object[] { strcoed });
    }

    /**
     * 入库单号
     * @param list 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryInList(ArrayList<String> list) {
        return this.getDataBySqlID("PipeManageClassInfo.queryInList", list
                .toArray());
    }

    /**
     * 物料描述查询
     * @param list 传递参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryMaterial(ArrayList<String> list) {
        return this.getDataBySqlID("PipeManageClassInfo.queryMaterial", list
                .toArray());
    }
   /**
     * 扣型描述查询
     * @param str 参数
     * @return 平台统一返回对象
     */
    public CoreReturnObject queryModel(String str) {
        return this.getDataBySqlID("PipeManageClassInfo.queryModel",new Object[] { str });
    }
    
    /***
     *根据数据权限查找仓库科室
     * @return
     */
    public CoreReturnObject getStoreNo(String storeType,String storeAtrr,String[] arr)
    {
    	String condition = CoreConverter.toSqlConditionString("MANAGEMENT_NO",arr);
    	String sql = CoreXmlSqlParsersFactory.getSql("PipeManageClassInfo.getStoreNo");
    	sql = sql.replaceAll("#CONDITION#", condition);
    	sql += " and t.STORAGE_TYPE_NO  LIKE '%'|| '"+storeType+"' ||'%'";
    	sql += " and t.STORAGE_ATTR LIKE '%'|| '"+storeAtrr+"' ||'%' ";
    	sql += "  order by t.STORAGE_NAME asc ";
    		return this.getData(sql);
    }
}
