package com.steering.pss.qcm;

import java.sql.SQLException;
import java.util.ArrayList;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;
import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.SqlBuilder;
import com.steering.comm.tools.StringTool;

/**
 * 材质项目基础信息管理类
 * @author WQ 2014/10/16
 * @version v1.0
 * @modify
 */
public class CoreMaterialItemMng extends DBCommon {

    /**
     * 根据小类别获取所属大类别
     * @param phyCode 小类代码
     * @return obj
     */
    public CoreReturnObject GetPhyMax(String phyCode) {
        Object[] params = new Object[] { phyCode };
        return this.getDataBySqlID("CoreMaterialAdministration.GetPhyMax",
                params);
    }

    /**
     * 获取关联表最大id
     * @return obj
     */
    public CoreReturnObject GetMaxItem_R() {
        return this.getDataBySqlID("CoreMaterialAdministration.GetMaxItem_R");
    }

    /**
     * 根据材质项目编号，获取对应的多个试验方向、温度、尺寸
     * @param phyCode 材质项目编号
     * @return obj
     */
    public CoreReturnObject GetITEM_F(String phyTypeC) {
        Object[] params = new Object[] { phyTypeC };
        return this.getDataBySqlID("CoreMaterialAdministration.GetITEM_F",
                params);
    }
    
    /**
     * 根据检验项查询温度、位置。
     * @param phyCode
     * @return
     */
    public CoreReturnObject GetPhyRPos(String phyCode){
    	SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.GetPhyRPos");
    	b.Fill(new String[]{phyCode});
    	return this.getData(b.toString());
    }
    
    public CoreReturnObject SavePos(ArrayList<ArrayList<String>> parms){
    	ArrayList<String> sqllist = new ArrayList<String>();
    	for(ArrayList<String> parm : parms){
    		if(parm.get(4).equals("")){
    			SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.InsertPos");
        		b.Fill(new String[]{parm.get(0), parm.get(1), parm.get(2)});
        		sqllist.add(b.toString());
    		}else{
    			SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.UpdatePos");
        		b.Fill(new String[]{parm.get(0), parm.get(1), parm.get(2), parm.get(3)});
        		sqllist.add(b.toString());
    		}
    	}
    	return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
    }
    
    public CoreReturnObject DeleteOrResumePos(ArrayList<String[]> parms, String validflag){
    	ArrayList<String> sqllist = new ArrayList<String>();
    	for(String[] parm: parms){
    		SqlBuilder b;
    		if(validflag.equals("0")){
    			b = new SqlBuilder("CoreMaterialAdministration.DeletePos");
    		}else{
    			b = new SqlBuilder("CoreMaterialAdministration.ResumePos");
    		}
    		b.Fill(parm);
			sqllist.add(b.toString());
    	}
    	return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
    }
    
    /**
     * 加载检验项对应的尺寸数据
     * @param phyCode
     * @return
     */
    public CoreReturnObject getSizeItem(String phyTypeC){
    	SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.loadSizeItem");
    	b.Fill(new String[]{phyTypeC});
    	return this.getData(b.toString());
    }

    /**
     * 保存
     * @param spbAddParams 新增参数
     * @param spbUpdateParams 保存参数
     * @return obj
     */
    public CoreReturnObject doSave(ArrayList<ArrayList<String>> spbAddParams,
            ArrayList<ArrayList<String>> spbUpdateParams) {
        CoreReturnObject spbCro = new CoreReturnObject();
        String spbAddSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.GetITEM_FADD");
        ArrayList<Object> spbSqlList = new ArrayList<Object>();
        ArrayList<Object[]> spbParmList = new ArrayList<Object[]>();

        if (spbAddParams.size() > 0) {
            for (int i = 0; i < spbAddParams.size(); i++) {
                spbSqlList.add(spbAddSql);
                spbParmList.add(spbAddParams.get(i).toArray());
            }
        }

        if (spbUpdateParams.size() > 0) {
            for (int j = 0; j < spbUpdateParams.size(); j++) {
            	String spbUpdateSql = CoreXmlSqlParsersFactory
                        .getSql("CoreMaterialAdministration.GetITEM_FUPDATE");
            	if(spbUpdateParams.get(j).get(5).equals("")){
            		spbUpdateSql = spbUpdateSql.replaceAll("#ITEM_CODE_F_CONDITION#", "ITEM_CODE_F IS NULL");
            	}else{
            		spbUpdateSql = spbUpdateSql.replaceAll("#ITEM_CODE_F_CONDITION#", "ITEM_CODE_F = '#ITEM_CODE_F#'");
            	}
            	if(spbUpdateParams.get(j).get(6).equals("")){
            		spbUpdateSql = spbUpdateSql.replaceAll("#ITEM_CODE_C_CONDITION#", "ITEM_CODE_C IS NULL");
            	}else{
            		spbUpdateSql = spbUpdateSql.replaceAll("#ITEM_CODE_C_CONDITION#", "ITEM_CODE_C = '#ITEM_CODE_C#'");
            	}
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#ITEM_CODE_F2#", spbUpdateParams.get(j).get(0));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#ITEM_CODE_C2#", spbUpdateParams.get(j).get(1));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#UPDATE_NAME#", spbUpdateParams.get(j).get(2));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#MEMO#", spbUpdateParams.get(j).get(3));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#PHY_TYPE_C#", spbUpdateParams.get(j).get(4));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#ITEM_CODE_F#", spbUpdateParams.get(j).get(5));
            	spbUpdateSql = StringTool.ReplaceAll(spbUpdateSql, "#ITEM_CODE_C#", spbUpdateParams.get(j).get(6));
                spbSqlList.add(spbUpdateSql);
                spbParmList.add(new Object[]{});
            }
        }

        try {
            spbCro = this.getDao("TgDao").ExcuteTransction(spbSqlList,
                    spbParmList);
        }
        catch (Exception e) {
            spbCro = spbCro.SetErrInfo(e.getMessage());
        }

        return spbCro;

    }

    /**
     * 材质项目基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 材质项目描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject getLineListPhy(Boolean includeDeleted, String name) {
        String deletedFlag = includeDeleted ? "0" : "";
        Object[] params = new Object[] { deletedFlag, name };
        return this.getDataBySqlID("CoreMaterialAdministration.PHYQUERY",
                params);
    }

    /**
     * 材质项目基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 材质项目描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject getLineListPhyC(Boolean includeDeleted, String name) {
        String deletedFlag = includeDeleted ? "0" : "";
        Object[] params = new Object[] { deletedFlag, name };
        return this.getDataBySqlID("CoreMaterialAdministration.PHYCQUERY",
                params);
    }

    /**
     * 材质项目基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 材质项目描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject getLineListPhyProject(Boolean includeDeleted,
            String name) {
        String deletedFlag = includeDeleted ? "0" : "";
        Object[] params = new Object[] { deletedFlag, name };
        return this.getDataBySqlID(
                "CoreMaterialAdministration.PHYPROJECTQUERY", params);
    }

    /**
     * 材质项目基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 材质项目描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject getLineListItem(Boolean includeDeleted, String name) {
        String deletedFlag = includeDeleted ? "0" : "";
        Object[] params = new Object[] { deletedFlag, name };
        return this.getDataBySqlID("CoreMaterialAdministration.ITEMQUERY",
                params);
    }

    /**
     * 材质项目基础信息新增
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doAddPhy(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYADD");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息新增
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doAddPhyC(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYCADD");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息新增
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doAddPhyProject(ArrayList<String> parm, ArrayList<String> parmStation) {
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYPROJECTADD");
        String sqlInsert  = CoreXmlSqlParsersFactory.getSql("CoreMaterialAdministration.insertBasePhyRStation");
        ArrayList<String> sqlList = new ArrayList<String>();
        ArrayList<Object[]> parmList = new ArrayList<Object[]>();
        sqlList.add(strSql);
        parmList.add(parm.toArray());
        
        if(!parmStation.get(0).equals("")){
	        String[] stationCodes = parmStation.get(0).split(";");
	        String[] stationNames = parmStation.get(1).split(";");
	        for(int i = 0; i < stationCodes.length; i++){
	        	sqlList.add(sqlInsert);
	            parmList.add(new Object[]{parmStation.get(2),parmStation.get(3),
	            		stationCodes[i], stationNames[i], parmStation.get(4)});
	        }
        }
        
        return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqlList, parmList);
    }

    /**
     * 材质项目基础信息新增
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doAddItem(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.ITEMADD");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息修改
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doModifyPhy(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYMODIFY");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息修改
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doModifyPhyC(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYCMODIFY");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息修改
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doModifyPhyProject(ArrayList<String> parm, ArrayList<String> parmStation) {
        String sqlDeletePhyRStation = CoreXmlSqlParsersFactory.getSql("CoreMaterialAdministration.delBasePhyRStation");
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.PHYPROJECTMODIFY");
        String sqlInsert  = CoreXmlSqlParsersFactory.getSql("CoreMaterialAdministration.insertBasePhyRStation");
        ArrayList<String> sqlList = new ArrayList<String>();
        ArrayList<Object[]> parmList = new ArrayList<Object[]>();
        sqlList.add(strSql);
        sqlList.add(sqlDeletePhyRStation);
        parmList.add(parm.toArray());
        parmList.add(new Object[]{parmStation.get(2)});
        
        if(!parmStation.get(0).equals("")){
	        String[] stationCodes = parmStation.get(0).split(";");
	        String[] stationNames = parmStation.get(1).split(";");
	        for(int i = 0; i < stationCodes.length; i++){
	        	sqlList.add(sqlInsert);
	            parmList.add(new Object[]{parmStation.get(2),parmStation.get(3),
	            		stationCodes[i], stationNames[i], parmStation.get(4)});
	        }
        }
        return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqlList, parmList);
    }

    /**
     * 材质项目基础信息修改
     * @param parm 参数
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject doModifyItem(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        String strSql = CoreXmlSqlParsersFactory
                .getSql("CoreMaterialAdministration.ITEMMODIFY");
        try {
            cro = this.getDao("TgDao").ExcuteNonQuery(strSql, parm.toArray());
        }
        catch (SQLException e) {
            cro = cro.SetErrInfo(e.getMessage());
        }
        return cro;
    }

    /**
     * 材质项目基础信息删除或恢复
     * @param plineCodes 产线代码集合
     * @param operator 操作人
     * @param isDelete true删除 false恢复
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject deleteLineInfoPhy(ArrayList<Object> plineCodes,
            String operator, Boolean isDelete) {
        ArrayList<String> sqlIDList = new ArrayList<String>();
        ArrayList<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < plineCodes.size(); i++) {
            if (isDelete) {
                sqlIDList.add("CoreMaterialAdministration.PHYDELETE");
                params.add(new Object[] { operator,
                        plineCodes.get(i).toString() });
            }
            else {
                sqlIDList.add("CoreMaterialAdministration.PHYRESUME");
                params.add(new Object[] { plineCodes.get(i).toString() });
            }
        }
        return this.setDataById(sqlIDList, params);
    }

    /**
     * 材质项目基础信息删除或恢复
     * @param plineCodes 产线代码集合
     * @param operator 操作人
     * @param isDelete true删除 false恢复
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject deleteLineInfoPhyC(ArrayList<Object> plineCodes,
            String operator, Boolean isDelete) {
        ArrayList<String> sqlIDList = new ArrayList<String>();
        ArrayList<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < plineCodes.size(); i++) {
            if (isDelete) {
                sqlIDList.add("CoreMaterialAdministration.PHYCDELETE");
                params.add(new Object[] { operator,
                        plineCodes.get(i).toString() });
            }
            else {
                sqlIDList.add("CoreMaterialAdministration.PHYCRESUME");
                params.add(new Object[] { plineCodes.get(i).toString() });
            }
        }
        return this.setDataById(sqlIDList, params);
    }

    /**
     * 材质项目基础信息删除或恢复
     * @param plineCodes 产线代码集合
     * @param operator 操作人
     * @param isDelete true删除 false恢复
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject deleteLineInfoPhyProject(
            ArrayList<Object> plineCodes, String operator, Boolean isDelete) {
        ArrayList<String> sqlIDList = new ArrayList<String>();
        ArrayList<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < plineCodes.size(); i++) {
            if (isDelete) {
                sqlIDList.add("CoreMaterialAdministration.PHYPROJECTDELETE");
                params.add(new Object[] { operator,
                        plineCodes.get(i).toString() });
            }
            else {
                sqlIDList.add("CoreMaterialAdministration.PHYPROJECTRESUME");
                params.add(new Object[] { plineCodes.get(i).toString() });
            }
        }
        return this.setDataById(sqlIDList, params);
    }

    /**
     * 材质项目基础信息删除或恢复
     * @param plineCodes 产线代码集合
     * @param operator 操作人
     * @param isDelete true删除 false恢复
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject deleteLineInfoItem(ArrayList<Object> plineCodes,
            String operator, Boolean isDelete) {
        ArrayList<String> sqlIDList = new ArrayList<String>();
        ArrayList<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < plineCodes.size(); i++) {
            if (isDelete) {
                sqlIDList.add("CoreMaterialAdministration.ITEMDELETE");
                params.add(new Object[] { operator,
                        plineCodes.get(i).toString() });
            }
            else {
                sqlIDList.add("CoreMaterialAdministration.ITEMRESUME");
                params.add(new Object[] { plineCodes.get(i).toString() });
            }
        }
        return this.setDataById(sqlIDList, params);
    }

    /**
     * 材质项目基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 材质项目描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject getComBaseStd(String name) {
        return this.getDataBySqlID("CoreMaterialAdministration.getComBaseStd");
    }

    public CoreReturnObject getMaxItem_Code(String code) {
        return this.getDataBySqlID(
                "CoreMaterialAdministration.getMaxItem_Code",
                new Object[] { code });
    }

    public CoreReturnObject getMaxPhyCode() {
        return this.getDataBySqlID("CoreMaterialAdministration.getMaxPhyCode");
    }

    public CoreReturnObject getMaxPhy_C_Code() {
        return this
                .getDataBySqlID("CoreMaterialAdministration.getMaxPhy_C_Code");
    }

    public CoreReturnObject getMaxPhyStdCode() {
        return this
                .getDataBySqlID("CoreMaterialAdministration.getMaxPhyStdCode");
    }

    public CoreReturnObject iSExistPhyStd(ArrayList<String> list) {
        return this.getDataBySqlID("CoreMaterialAdministration.iSExistPhyStd",
                list.toArray());
    }

    public CoreReturnObject iSExistPhy_C(ArrayList<String> list) {
        return this.getDataBySqlID("CoreMaterialAdministration.iSExistPhy_C",
                list.toArray());
    }

    public CoreReturnObject iSExistPhy(ArrayList<String> list) {
        return this.getDataBySqlID("CoreMaterialAdministration.iSExistPhy",
                list.toArray());
    }

    public CoreReturnObject iSExistPhyItem(ArrayList<String> list) {
        return this.getDataBySqlID("CoreMaterialAdministration.iSExistPhyItem",
                list.toArray());
    }

    public CoreReturnObject queryPhy2() {
        return this.getDataBySqlID("CoreMaterialAdministration.queryPhy2");
    }
    
    public CoreReturnObject queryPhy3() {
        return this.getDataBySqlID("CoreMaterialAdministration.queryPhy3");
    }

    public CoreReturnObject loadItem(ArrayList<String> list) {
        return this.getDataBySqlID("CoreMaterialAdministration.loadItem", list
                .toArray());
    }

    public CoreReturnObject getMaxPhy_R_ItemCode() {
        return this
                .getDataBySqlID("CoreMaterialAdministration.getMaxPhy_R_ItemCode");
    }

    public CoreReturnObject deleteOrResumePhy_R_Item(
            ArrayList<ArrayList<String>> list) {
        ArrayList<Object[]> parmlist = new ArrayList<Object[]>();
        ArrayList<String> sqllist = new ArrayList<String>();
        String sqlString = "";
        for (int i = 0; i < list.size(); i++) {
        	sqlString = CoreXmlSqlParsersFactory
                    .getSql("CoreMaterialAdministration.deleteOrResumePhy_R_Item");
        	if(list.get(i).get(3).equals("")){
        		sqlString = sqlString.replaceAll("#ITEM_CODE_F_CONDITION#", "ITEM_CODE_F IS NULL");
        	}else{
        		sqlString = sqlString.replaceAll("#ITEM_CODE_F_CONDITION#", "ITEM_CODE_F = '#ITEM_CODE_F#'");
        	}
        	if(list.get(i).get(4).equals("")){
        		sqlString = sqlString.replaceAll("#ITEM_CODE_C_CONDITION#", "ITEM_CODE_C IS NULL");
        	}else{
        		sqlString = sqlString.replaceAll("#ITEM_CODE_C_CONDITION#", "ITEM_CODE_C = '#ITEM_CODE_C#'");
        	}
        	if(list.get(i).get(5).equals("")){
        		sqlString = sqlString.replaceAll("#ITEM_CODE_W_CONDITION#", "ITEM_CODE_W IS NULL");
        	}else{
        		sqlString = sqlString.replaceAll("#ITEM_CODE_W_CONDITION#", "ITEM_CODE_W = '#ITEM_CODE_W#'");
        	}
        	sqlString = StringTool.ReplaceAll(sqlString, "#VALIDFLAG#", list.get(i).get(0));
        	sqlString = StringTool.ReplaceAll(sqlString, "#DELETE_NAME#", list.get(i).get(1));
        	sqlString = StringTool.ReplaceAll(sqlString, "#PHY_TYPE_C#", list.get(i).get(2));
        	sqlString = StringTool.ReplaceAll(sqlString, "#ITEM_CODE_F#", list.get(i).get(3));
        	sqlString = StringTool.ReplaceAll(sqlString, "#ITEM_CODE_C#", list.get(i).get(4));
        	sqlString = StringTool.ReplaceAll(sqlString, "#ITEM_CODE_W#", list.get(i).get(5));
            parmlist.add(new Object[]{});
            sqllist.add(sqlString);
        }
        return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
                sqllist, parmlist);
    }

    public CoreReturnObject isExistItem_R(ArrayList<String> list) {
    	String sql = CoreXmlSqlParsersFactory.getSql("CoreMaterialAdministration.isExistItem_R");
    	if(list.get(0).equals("")){
    		sql = sql.replaceAll("#ITEM_CODE_C#", "AND ITEM_CODE_C IS NULL");
    	}else{
    		sql = sql.replaceAll("#ITEM_CODE_C#", "AND ITEM_CODE_C = '#ITEM_CODE_C#'");
    	}
    	if(list.get(1).equals("")){
    		sql = sql.replaceAll("#ITEM_CODE_F#", "AND ITEM_CODE_F IS NULL");
    	}else{
    		sql = sql.replaceAll("#ITEM_CODE_F#", "AND ITEM_CODE_F = '#ITEM_CODE_F#'");
    	}
    	sql = StringTool.ReplaceAll(sql, "#ITEM_CODE_C#", list.get(0));
    	sql = StringTool.ReplaceAll(sql, "#ITEM_CODE_F#", list.get(1));
    	sql = StringTool.ReplaceAll(sql, "#PHY_TYPE_C#", list.get(2));
        return this.getData(sql);
    }
    
    public CoreReturnObject isExistPos_R(String[] parm) {
    	SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.isExistPos_R");
    	b.Fill(parm);
    	
        return this.getData(b.toString());
    }
    
    /**
     * 获取试样组基础信息
     * @return
     */
    public CoreReturnObject getPhyMinInfo(){
    	SqlBuilder b = new SqlBuilder("CoreMaterialAdministration.getPhyMinInfo");
    	
        return this.getData(b.toString());
    }
}
