package com.steering.pss.judge.DAL;

import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.Util.StringUtils;
import com.steering.comm.db.DBCommon;

/**
 * 成品报表
 */
public class FrmProductReport extends DBCommon {
    
    public CoreReturnObject Query(String balYearMonth,String balYearMonth2, String processCode, String factoryRegion){
        String sqlQuery = CoreXmlSqlParsersFactory.getSql("FrmProductReport.Query");
        if(!StringUtils.isEmpty(balYearMonth)){
            sqlQuery += " and T.BAL_YEAR_MONTH >= '"+balYearMonth+"' and T.BAL_YEAR_MONTH <= '"+balYearMonth2+"'";
        }
        if(!StringUtils.isEmpty(processCode)){
            sqlQuery += " and T.PROCESS_CODE = '"+processCode+"'";
        }
        if(!StringUtils.isEmpty(factoryRegion)){
            sqlQuery += " and B.FACTORY_CODE = '"+factoryRegion+"'";
        }
//        sqlQuery += " GROUP BY\n" +
//                "\tT.PROCESS_CODE,\n" +
//                "\tT.PLINE_CODE,\n" +
//                "\tT.PRODUCNAME,\n" +
//                "\tT.STEELNAME,\n" +
//                "\tT.GRADENAME,\n" +
//                "\tT.SPEC_NAME,\n" +
//                "\tT.MODEL_DESC,\n" +
//                "\tT.STD_NAME,\n" +
//                "\tT.PLINE_NAME,\n" +
//                "\tT.PRO_ORDER_NO,\n" +
//                "\tT.ACT_DIMATER,\n" +
//                "\tT.ACT_HEIGHT,\n" +
//                "\tT.BAL_YEAR_MONTH,\n" +
//                "\tT.DELIVERY_STATE_NAME,\n" +
//                "\tB.BASENAME";
        sqlQuery += " ORDER BY T.PROCESS_CODE,T.PLINE_CODE,B.BASENAME";
        return this.getData(sqlQuery);
    }

    // 查询生产区域
    public CoreReturnObject QueryFactory(){
        String sqlQuery = CoreXmlSqlParsersFactory.getSql("FrmProductReport.QueryFactory");
        return this.getData(sqlQuery);
    }
}
