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.SlmBaseMaterialDPlEntity;

/**
 * 轧管产线能力维护
 * 
 * @author Administrator
 * 
 */
public class FrmBaseMaterialDPl extends DBCommon {

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

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

	/**
	 * 修改
	 * 
	 * @param jsonStrList
	 * @return
	 */
	public CoreReturnObject updateBaseMaterialDPl(ArrayList<String> jsonStrList) {
		ArrayList<String> sqlList = new ArrayList<String>();
		String sql = CoreXmlSqlParsersFactory
				.getSql("FrmBaseMaterialDPl.updateBaseMaterialDPl");
		for (String jsonStr : jsonStrList) {
			JSONObject obj = JSONObject.fromObject(jsonStr);
			SlmBaseMaterialDPlEntity entity = (SlmBaseMaterialDPlEntity) JSONObject
					.toBean(obj, SlmBaseMaterialDPlEntity.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);
	}
}
