package com.steering.pss.sale.base;

import java.util.ArrayList;

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

import com.steering.comm.db.DBCommon;

public class CoreBasePrdcrRStation extends DBCommon {

    public CoreReturnObject getPrdcrInfo() {
        return this.getDataBySqlID("CoreBasePrdcrRStation.getPrdcrInfo");
    }

    public CoreReturnObject getStationInfo(String baseCode) {
        Object[] obj = new Object[] { baseCode ,baseCode};
        return this.getDataBySqlID("CoreBasePrdcrRStation.GetStationInfo", obj);
    }

    @SuppressWarnings("unchecked")
    public CoreReturnObject save(String code, ArrayList<Object> parm) {

        CoreReturnObject cro = new CoreReturnObject();
        ArrayList<String> sqlList = new ArrayList<String>();
        ArrayList<Object[]> param = new ArrayList<Object[]>();

        sqlList.add(CoreXmlSqlParsersFactory
                .getSql("CoreBasePrdcrRStation.DeletePrdrStation"));
        param.add(new Object[] { code });
        for (int i = 0; i < parm.size(); i++) {
            sqlList.add(CoreXmlSqlParsersFactory
                    .getSql("CoreBasePrdcrRStation.InsertPrdrStation"));
            param.add(((ArrayList<Object>) parm.get(i)).toArray());
        }
        cro = this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
                sqlList, param);
        return cro;
    }
}
