package com.steering.pss.kaohe.server;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.Util.StringUtils;
import com.steering.comm.db.DBCommon;

public class JHYChongJiQry extends DBCommon {
	 public CoreReturnObject Query(String CHECK_NO,String STEEL_NO,String STEEL_GRADE,String DIMATER1,String DIMATER2,String HEIGHT1,String HEIGHT2,String CIC,String LUHAO1,String LUHAO2,String DATE_BEGIN,String DATE_END ,String SupplyUnit){
	        String sqlQuery = CoreXmlSqlParsersFactory.getSql("JhyChongjiDAL.Query");
	        
	        
	       
	        sqlQuery = sqlQuery.replaceAll("#CHECK_NO#", CHECK_NO);
	        sqlQuery = sqlQuery.replaceAll("#STEEL_NO#", STEEL_NO);
	        sqlQuery = sqlQuery.replaceAll("#STEEL_GRADE#", STEEL_GRADE);
	        sqlQuery = sqlQuery.replaceAll("#DIMATER1#", DIMATER1);
	        sqlQuery = sqlQuery.replaceAll("#HEIGHT1#", HEIGHT1);
	        sqlQuery = sqlQuery.replaceAll("#DIMATER2#", DIMATER2);
	        sqlQuery = sqlQuery.replaceAll("#HEIGHT2#", HEIGHT2);
	        sqlQuery = sqlQuery.replaceAll("#CIC#", CIC);
//	        sqlQuery = sqlQuery.replaceAll("#LUHAO1#", LUHAO1);
//	        sqlQuery = sqlQuery.replaceAll("#LUHAO2#", LUHAO2);
	        sqlQuery = sqlQuery.replaceAll("#DATE_BEGIN#", DATE_BEGIN);
	        sqlQuery = sqlQuery.replaceAll("#DATE_END#", DATE_END);

		 if(!SupplyUnit.equals(""))
		 {
			 sqlQuery+="and supply_unit ='"+SupplyUnit+"'";
		 }
		 if(!StringUtils.isEmpty(LUHAO1) && !StringUtils.isEmpty(LUHAO2)){
			 sqlQuery+="and T.HEAT_NO >='"+LUHAO1+"'";
			 sqlQuery+="and T.HEAT_NO <='"+LUHAO2+"'";
		 }else if(!StringUtils.isEmpty(LUHAO1)){
			 sqlQuery+="and T.HEAT_NO LIKE '%'|| "+LUHAO1+" || '%'";
		 }
	        return this.getData("JhyDao",sqlQuery);
	    }
}
