package com.steering.pss.plnsaleord.order.baseMethod;

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

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.pss.plnsaleord.order.model.PlnSaleordProcEntity;


public class CoreOrdProcRefresCal extends DBCommon{
    /**
     * 查询排产合同信息
     * @param ordLnDlyPk
     * @param plnDivideId
     * @return
     */
    public CoreReturnObject queryPlnOrdProc(String ordLnDlyPk,
            String plnDivideId) {
        CoreReturnObject cro = new CoreReturnObject();
        cro = this.getDataBySqlID("CoreOrdProcRefresCal.queryPlnOrdProc",
                new Object[] { ordLnDlyPk, plnDivideId });
        return cro;
    }
    
    /**
     * 保存计算信息
     * @param ordProc
     * @return
     */
    public CoreReturnObject updatePlnOrdProc(PlnSaleordProcEntity ordProc){
        CoreReturnObject cro = new CoreReturnObject();
        String sql = CoreXmlSqlParsersFactory
                .getSql("CoreOrdProcRefresCal.updatePlnOrdProc");
        String sqle = CoreXmlSqlParsersFactory
                .getSql("CoreOrdProcRefresCal.updatePlnOrdProcOutPi");
        if (ordProc.getWeightPerM().trim().equals("")) {
            String sqlUp = EntityTool.fillSqlByEntity(sqle, ordProc);
            cro = this.setData(sqlUp);
        }
        else {
            String sqlUp = EntityTool.fillSqlByEntity(sql, ordProc);
            cro = this.setData(sqlUp);
        }
        return cro;
    }
    
}