package com.steering.pss.plnsaleord.processOrder;

import java.util.ArrayList;
import net.sf.json.JSONObject;

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

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.pss.plnsaleord.processOrder.entity.SlmBaseMaterialEPlEntity;

/**
 * 镦拔扩产线能力维护
 * 
 * @author Administrator
 * 
 */
public class FrmBaseMaterialEPl extends DBCommon {

	public CoreReturnObject getBaseMaterialE(String inMaterialNo,
			String outMaterialNo) {
		Object[] params = new Object[] { inMaterialNo, outMaterialNo };
		return this.getDataBySqlID("FrmBaseMaterialEPl.getBaseMaterialE",
				params);
	}

	public CoreReturnObject getBaseMaterialEPl(String inMaterialNo,
			String outMaterialNo) {
		Object[] params = new Object[] { inMaterialNo, outMaterialNo };
		return this.getDataBySqlID("FrmBaseMaterialEPl.getBaseMaterialEPl",
				params);
	}

	/**
	 * 修改
	 * 
	 * @param jsonStrList
	 * @return
	 */
	public CoreReturnObject updateBaseMaterialEPl(ArrayList<String> jsonStrList) {
		ArrayList<String> sqlList = new ArrayList<String>();
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmBaseMaterialEPl.updateBaseMaterialEPl");
		for (String jsonStr : jsonStrList) {
			JSONObject obj = JSONObject.fromObject(jsonStr);
			SlmBaseMaterialEPlEntity entity = (SlmBaseMaterialEPlEntity) JSONObject
					.toBean(obj, SlmBaseMaterialEPlEntity.class);
			if (entity.getDisableFl().equals("True")) {
				entity.setDisableFl("1");
			} else {
				entity.setDisableFl("0");
			}
			sql = EntityTool.fillSqlByEntity(sql, entity);
			sqlList.add(sql);
		}
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(
				sqlList);
	}
}
