package com.steering.pss.judge.DAL;

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.SqlBuilder;

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

/**
 * 数据库表QCM_LG_CHEMJUDGE_EXCEPTION所对应的Java类（生成工具：代码生成工具4.0
 * 访问地址：http://172.16.2.128/tool/）
 * 
 * @author tgcx-test date 2016-09-08
 */
public class QcmLgChemjudgeExceptionDAL extends DBCommon {

	/**
	 * 通用查询
	 */
	public CoreReturnObject Query(String furnaceNo, String processCode) {
		SqlBuilder b = new SqlBuilder("QcmLgChemjudgeExceptionDAL.Query");
    	b.Fill(new String[]{furnaceNo, processCode});
		
		return this.getData(b.toString());
	}
	
	/**
     * 查询炼钢判定不合格记录
     * @param stoveNo
     * @param judgeStoveNo
     * @param judgeTimeB
     * @param judgeTimeE
     * @return
     */
    public CoreReturnObject QuerySteelMaking(String judgeStoveNo,
    		String judgeTimeB, String judgeTimeE){
    	SqlBuilder b = new SqlBuilder("QcmLgChemjudgeExceptionDAL.QuerySteelMaking");
        b.AppendLn("AND T.JUDGE_STOVE_NO LIKE '%' || {1} || '%'", !judgeStoveNo.equals(""));
        b.AppendLn("AND T.CREATE_TIME >= TO_DATE({2}, 'YYYY-MM-DD HH24:MI:SS')", !judgeTimeB.equals(""));
        b.AppendLn("AND T.CREATE_TIME <= TO_DATE({3}, 'YYYY-MM-DD HH24:MI:SS')", !judgeTimeE.equals(""));
        b.AppendLn("ORDER BY T.JUDGE_STOVE_NO, T.CHEM_JUDGE_ID DESC");
        b.Fill(new String[]{ "A", judgeStoveNo, judgeTimeB, judgeTimeE });
        
        return this.getData(b.toString());
    }

	/**
	 * 通过主键查询
	 */
	public CoreReturnObject QueryByPk(String chemJudgeId, String judgeStoveNo, String planProorder, String ordLnPk) {
		String sqlQuery = CoreXmlSqlParsersFactory.getSql("QcmLgChemjudgeExceptionDAL.QueryByPk");
		return this.getData(sqlQuery);
	}
}
