package com.steering.pss.sale.order;

import java.util.ArrayList;

import com.steering.comm.db.DBCommon;

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

/**
 * 手工输入MPS编号
 * @author WenHB
 */
public class CoreInPutMpsNo extends DBCommon {

    /**
     * 查询需要维护MPS的合同行
     * @param ordPk
     * @return
     */
    public CoreReturnObject queryMpsLine(String ordPk) {
        Object[] obj = new Object[] { ordPk };
        return this.getDataBySqlID("CoreInPutMpsNo.queryMpsLine", obj);
    }

    /**
     * 将MPS编号保存到合同行上
     * @param parm
     * @return
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject saveMpsLine(ArrayList<Object> parm) {
        CoreReturnObject cro = new CoreReturnObject();
        ArrayList<String> sqlList = new ArrayList<String>();
        ArrayList<Object[]> params = new ArrayList<Object[]>();
        for (int i = 0; i < parm.size(); i++) {
            sqlList.add(CoreXmlSqlParsersFactory
                    .getSql("CoreInPutMpsNo.saveMpsLine"));
            params.add(((ArrayList<Object>) parm.get(i)).toArray());
        }
        if (sqlList.size() > 0) {

            cro = this.getDao(CoreConstantData.sysbeanstr)
                    .ExcuteTransction(sqlList, params);

        }
        return cro;
    }

    /**
     * 更新合同行MPS文本地址
     * @param ordLnPk
     * @return
     */
    public CoreReturnObject updateMpsLine(String mpsFile,String ordLnPk) {
        Object[] obj = new Object[] { mpsFile,ordLnPk };
        return this.setDataBySqlID("CoreInPutMpsNo.updateMpsLine", obj);
    }
    
    public CoreReturnObject selectMpsAddr(String ordLnPk) {
        Object[] obj = new Object[] { ordLnPk };
        return this.getDataBySqlID("CoreInPutMpsNo.selectMpsAddr", obj);
    }
}
