package com.steering.pss.ydm.acasleavefactory;


import java.util.ArrayList;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import com.steering.comm.converter.CoreConverter;
import com.steering.comm.db.DBCommon;


/**
 * 铁运出厂月计划
 * @author Administrator 2015-06-15
 */
public class FrmCasTrainMonth extends DBCommon {
    /**
     * 查询可发货资源主信息
     * @param list 查询参数
     * @return obj
     */
    public CoreReturnObject queryOrderInfo(ArrayList<Object> params,
            String spclNO, String staintNo, String reviaNo,
            String[] salgs) {
        String sql = CoreXmlSqlParsersFactory
                .getSql("FrmCasTrainMonth.queryOrderInfo");
        if (!spclNO.equals("")) {
            sql += "  AND T.SPCL_LN_NO='" + spclNO + "'";
        }
        if (!staintNo.equals("")) {
            sql += "  AND T.STATION_NO='" + staintNo + "'";
        }
        if (!reviaNo.equals("")) {
            sql += "  AND T.CUSTOMER_NO='" + reviaNo + "'";
        }
//        if (tryptrNo.equals("0")) {
//            sql += "  AND T.PRD_CLS !='405005'";
//        }
//        else {
//            sql += "  AND T.PRD_CLS ='" + tryptrNo + "'";
//        }
        sql += CoreConverter.toSqlConditionString("T.CREATE_DEPT", salgs);
        sql += " GROUP BY T.CUSTOMER_NO,T.CUSTOMER_NM,T.TRANSIT_TYP,T.RECEIV_NO,"
                + "T.RECEIV_NM,T.STATION_NO,T.STATION_NM,T.SPCL_LN_NO,T.SPCL_LN_NM,"
                + "T.SALE_ORG,T.SALE_ORG_DESC,T.CREATE_DEPT,T.DEPARTNAME,T.PRD_CLS  ORDER BY T.CUSTOMER_NM ";
        return this.getData(sql, params.toArray());
    }

    /**
     * 查询发货资源子信息
     * @param list 查询参数
     * @return obj
     */
    public CoreReturnObject queryOrderInfoC(ArrayList<Object> param) {
        return this.getDataBySqlID("FrmCasTrainMonth.queryOrderInfoC", param
                .toArray());
    }
}
