package com.steering.pss.qcm;

import java.util.ArrayList;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.db.DBCommon;

public class CoreProductionPlane extends DBCommon {

    /**
     * 生产产线与工序点对应管理查询
     */
    public CoreReturnObject doQuery() {

        return this.getDataBySqlID("CoreProductionPlane.GetPLine");
    }

    public CoreReturnObject getPlineStation(String plinecode) {

        Object []obj = new Object[]{plinecode,plinecode,plinecode};
        return this.getDataBySqlID("CoreProductionPlane.GetStation",obj);
    }

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

        CoreReturnObject cro = new CoreReturnObject();
        ArrayList<Object> sqlIDList = new ArrayList<Object>();
        ArrayList<Object[]> parmlist = new ArrayList<Object[]>();
        sqlIDList.add(CoreXmlSqlParsersFactory
                .getSql("CoreProductionPlane.DELETE"));
        parmlist.add(new Object[] {plinecode });
        if (parm.size() > 0) {
            for (int i = 0; i < parm.size(); i++) {
                ArrayList<Object> list = (ArrayList<Object>) parm.get(i);
                parmlist.add(list.toArray());
                sqlIDList.add(CoreXmlSqlParsersFactory
                        .getSql("CoreProductionPlane.ADD"));
            }
        }
        cro = this.getDao("TgDao").ExcuteTransction(sqlIDList, parmlist);
        return cro;
    }
    
}
