package com.steering.mes.zgmil.report;

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

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

public class FrmTubeAccord extends DBCommon {

    /**
     *查询上料锯切
     */
    public CoreReturnObject queryMinResult(String date, String endDate,
            String bc, String bz,String JudgeStoveNo , String[] plineCodes) {
        String sql = CoreXmlSqlParsersFactory
                .getSql("FrmTubeAccord.queryMinResult");
        if (!date.equals("")) {
            sql += " AND T2.END_SAW_TIME BETWEEN TO_DATE('" + date
                    + "' ,'YYYY-MM-DD HH24:MI:SS') AND TO_DATE('" + endDate
                    + "' ,'YYYY-MM-DD HH24:MI:SS') ";
        }
        if (!bc.equals("")) {
            sql += "  AND T2.COL_SHIFT = '" + bc + "' ";
        }
        if (!bz.equals("")) {
            sql += " AND T2.COL_GROUP = '" + bz + "' ";
        }
        if (!JudgeStoveNo.equals("")) {
            sql += " AND T2.JUDGE_STOVE_NO LIKE '%" + JudgeStoveNo + "%' ";
        }
        sql += CoreConverter.toSqlConditionString("T.PLINE_CODE", plineCodes);
        sql += " GROUP BY T.LOT_NO, T.PLINE_CODE,T1.STEELNAME, T1.GRADENAME, T1.PIPE_SIZE, T.CUT_NUM,"
                + "T.SCRAP_NUM, T.CUT_DBNUM, T.JUDGE_STOVE_NO, T1.LENGTH_RANGE, T1.SAW_NUM, "
                + "T.CUT_HEAD_LENGTH, T.CUT_TRAIL_LENGTH, T2.COL_SHIFT, T2.COL_GROUP, T2.COL_USER, "
                + "T.REMARK, T2.END_SAW_TIME  ORDER BY T2.END_SAW_TIME ASC";
        return this.getData(sql);
    }
}
