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 CoreSpecificationsGradeChem extends DBCommon {
	
	/**
     * 产品规格基础信息查询
     * @param includeDeleted 是否包含已删除数据
     * @param name 产品规格描述
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
	public CoreReturnObject getLineList(Boolean includeDeleted,
            String name, String gradeName) {
        String deletedFlag = includeDeleted ? "0" : "";
        Object[] params = new Object[] { deletedFlag, name, gradeName, gradeName};
        return this.getDataBySqlID("CoreSpecificationsGradeChem.QUERY", params);
	}
	
	public CoreReturnObject SelectCode(String code,
            String name) {
        Object[] params = new Object[] {code, name};
        return this.getDataBySqlID("CoreSpecificationsGradeChem.SELECT", params);
    }
    
    public CoreReturnObject doAdd(ArrayList<ArrayList<Object>> parms) {
		CoreReturnObject cro = new CoreReturnObject();
		
		String sql = CoreXmlSqlParsersFactory.getSql("CoreSpecificationsGrade.ADD");
		
		ArrayList<Object> sqllist=new ArrayList<Object>();
		ArrayList<Object[]> parmlist=new ArrayList<Object[]>();
		
		for(int i=0;i<parms.size();i++)
		{
			sqllist.add(sql);
			parmlist.add(parms.get(i).toArray());
		}
		
		try {
			cro = this.getDao("TgDao").ExcuteTransction(sqllist, parmlist);
		} catch (Exception e) {
			cro = cro.SetErrInfo(e.getMessage());
		}

		return cro;
	}

	public CoreReturnObject doModify(ArrayList<Object> parms) {
		return this.setDataBySqlID("CoreSpecificationsGradeChem.ADD", parms.toArray());
	}
	
	public CoreReturnObject doUpdate(ArrayList<Object> parms) {
        return this.setDataBySqlID("CoreSpecificationsGradeChem.UPDATE", parms.toArray());
    }
	
	/**
     * 产品规格基础信息删除或恢复
     * @param plineCodes 产线代码集合
     * @param operator 操作人
     * @param isDelete true删除 false恢复
     * @return CoreReturnObject 必须返回CoreReturnObject
     */
    public CoreReturnObject deleteLineInfo(ArrayList<Object> parms,
            Boolean isDelete) {
        if (isDelete) {
            return this.setDataBySqlID("CoreSpecificationsGradeChem.DELETE", parms.toArray());
        } else {
             return this.setDataBySqlID("CoreSpecificationsGradeChem.RESUME", parms.toArray());
        }
	}
}
