package com.steering.pss.sale.order.bomGeneration.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.tools.EntityTool;
import com.steering.pss.sale.order.bomGeneration.daoImp.BomSaveDaoImp;
import com.steering.pss.sale.order.bomGeneration.model.BaseMaterialEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomAEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomBEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomCEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomDEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomEEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomFEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomGEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomIEntity;
import com.steering.pss.sale.order.bomGeneration.model.DesignBomKEntity;
import com.steering.pss.sale.order.bomGeneration.model.SlmOrdDesignBomHEntity;
import com.steering.pss.sale.order.orderchange.CrmBaseMaterialService;

/**
 * BOM保存数据实现类
 * 
 * @author Administrator
 * 
 */
public class IBomSaveDao implements BomSaveDaoImp {
	/**
	 * 保存OM-电炉
	 * 
	 * @param con
	 * @param bomAentity
	 * @throws SQLException
	 */
	public void saveBomA(Connection con, DesignBomAEntity bomAEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomA");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomAEntity.getBom());
		ps.setObject(2, bomAEntity.getInMaterialNo());
		ps.setObject(3, bomAEntity.getInMaterialDesc());
		ps.setObject(4, bomAEntity.getOutMaterialNo());
		ps.setObject(5, bomAEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存BOM-铸造
	 * 
	 * @param con
	 * @param bomBEntity
	 * @throws SQLException
	 */
	public void saveBomB(Connection con, DesignBomBEntity bomBEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomB");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomBEntity.getBom());
		ps.setObject(2, bomBEntity.getInMaterialNo());
		ps.setObject(3, bomBEntity.getInMaterialDesc());
		ps.setObject(4, bomBEntity.getOutMaterialNo());
		ps.setObject(5, bomBEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存BOM-锻造
	 * 
	 * @param con
	 * @param bomCEntity
	 * @throws SQLException
	 */
	public void saveBomC(Connection con, DesignBomCEntity bomCEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomC");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomCEntity.getBom());
		ps.setObject(2, bomCEntity.getInMaterialNo());
		ps.setObject(3, bomCEntity.getInMaterialDesc());
		ps.setObject(4, bomCEntity.getOutMaterialNo());
		ps.setObject(5, bomCEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-轧管
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomD(Connection con, DesignBomDEntity bomDEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomD");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomDEntity.getBom());
		ps.setObject(2, bomDEntity.getInMaterialNo());
		ps.setObject(3, bomDEntity.getInMaterialDesc());
		ps.setObject(4, bomDEntity.getOutMaterialNo());
		ps.setObject(5, bomDEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-镦拨扩
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomE(Connection con, DesignBomEEntity bomEEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomE");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomEEntity.getBom());
		ps.setObject(2, bomEEntity.getInMaterialNo());
		ps.setObject(3, bomEEntity.getInMaterialDesc());
		ps.setObject(4, bomEEntity.getOutMaterialNo());
		ps.setObject(5, bomEEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-热处理
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomF(Connection con, DesignBomFEntity bomFEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomF");
		PreparedStatement ps = con.prepareStatement(sql);
		;
		ps.setObject(1, bomFEntity.getBom());
		ps.setObject(2, bomFEntity.getInMaterialNo());
		ps.setObject(3, bomFEntity.getInMaterialDesc());
		ps.setObject(4, bomFEntity.getOutMaterialNo());
		ps.setObject(5, bomFEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-加工
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomI(Connection con, DesignBomIEntity bomIEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomI");
		PreparedStatement ps = con.prepareStatement(sql);
		;
		ps.setObject(1, bomIEntity.getBom());
		ps.setObject(2, bomIEntity.getInMaterialNo());
		ps.setObject(3, bomIEntity.getInMaterialDesc());
		ps.setObject(4, bomIEntity.getOutMaterialNo());
		ps.setObject(5, bomIEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存合同行与物料对应关系
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @param bom
	 *            BOM主键
	 * @throws SQLException
	 */
	public void saveLineBom(Connection con, String designKey, String bom)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveLineBom");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.setObject(2, bom);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存质量主键、产品物料BOM、接箍物料BOM关系
	 * 
	 * @param con
	 * @param designKey
	 *            质量主键
	 * @param bom
	 *            产品物料BOM
	 * @param bomJG
	 *            接箍物料
	 * @throws SQLException
	 */
	public void saveLineBomJG(Connection con, String designKey, String bom,
			String bomJG) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveLineBomJG");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.setObject(2, bom);
		ps.setObject(3, bomJG);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存BOM
	 * 
	 * @param con
	 *            连接字符串
	 * @param bom
	 *            BOM类
	 * @throws SQLException
	 */
	public void saveBom(Connection con, DesignBomEntity bom)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBom");
		sql = sql.replaceAll("#MATERIAL_NO#", bom.getMaterialNo());
		sql = sql.replaceAll("#MATERIAL_DESC#", bom.getMaterialDesc());
		sql = sql.replaceAll("#BOM_TYP#", bom.getBomTyp());
		sql = sql.replaceAll("#MSC_PLINE#", bom.getMscPline());
		sql = sql.replaceAll("#WHOLE_BACKLOG#", bom.getWholeBacklog());
		sql = sql.replaceAll("#WHOLE_BACKLOG_DESC#", bom.getWholeBacklogDesc());
		sql = sql.replaceAll("#MSC#", bom.getMsc());
		sql = sql.replaceAll("#MSC_DESC#", bom.getMscDesc());
		sql = sql.replaceAll("#GRADECODE#", bom.getGradecode());
		sql = sql.replaceAll("#GRADENAME#", bom.getGradename());
		sql = sql.replaceAll("#SPEC_CODE_C#", bom.getSpecCodeC());
		sql = sql.replaceAll("#SPEC_NAME_C#", bom.getSpecNameC());
		sql = sql.replaceAll("#SPEC_CODE_R#", bom.getSpecCodeR());
		sql = sql.replaceAll("#SPEC_NAME_R#", bom.getSpecNameR());
		sql = sql.replaceAll("#SPEC_CODE_D#", bom.getSpecCodeD());
		sql = sql.replaceAll("#SPEC_NAME_D#", bom.getSpecNameD());
		sql = sql.replaceAll("#SPEC_CODE_Z#", bom.getSpecCodeZ());
		sql = sql.replaceAll("#SPEC_NAME_Z#", bom.getSpecNameZ());
		sql = sql.replaceAll("#A_IN_MATERIAL_NO#", bom.getAInMaterialNo());
		sql = sql.replaceAll("#A_IN_MATERIAL_DESC#", bom.getAInMaterialDesc());
		sql = sql.replaceAll("#A_OUT_MATERIAL_NO#", bom.getAOutMaterialNo());
		sql = sql
				.replaceAll("#A_OUT_MATERIAL_DESC#", bom.getAOutMaterialDesc());
		sql = sql.replaceAll("#B_IN_MATERIAL_NO#", bom.getBInMaterialNo());
		sql = sql.replaceAll("#B_IN_MATERIAL_DESC#", bom.getBInMaterialDesc());
		sql = sql.replaceAll("#B_OUT_MATERIAL_NO#", bom.getBOutMaterialNo());
		sql = sql
				.replaceAll("#B_OUT_MATERIAL_DESC#", bom.getBOutMaterialDesc());
		sql = sql.replaceAll("#C_IN_MATERIAL_NO#", bom.getCInMaterialNo());
		sql = sql.replaceAll("#C_IN_MATERIAL_DESC#", bom.getCInMaterialDesc());
		sql = sql.replaceAll("#C_OUT_MATERIAL_NO#", bom.getCOutMaterialNo());
		sql = sql
				.replaceAll("#C_OUT_MATERIAL_DESC#", bom.getCOutMaterialDesc());
		sql = sql.replaceAll("#D_IN_MATERIAL_NO#", bom.getDInMaterialNo());
		sql = sql.replaceAll("#D_IN_MATERIAL_DESC#", bom.getDInMaterialDesc());
		sql = sql.replaceAll("#D_OUT_MATERIAL_NO#", bom.getDOutMaterialNo());
		sql = sql
				.replaceAll("#D_OUT_MATERIAL_DESC#", bom.getDOutMaterialDesc());
		sql = sql.replaceAll("#E_IN_MATERIAL_NO#", bom.getEInMaterialNo());
		sql = sql.replaceAll("#E_IN_MATERIAL_DESC#", bom.getEInMaterialDesc());
		sql = sql.replaceAll("#E_OUT_MATERIAL_NO#", bom.getEOutMaterialNo());
		sql = sql
				.replaceAll("#E_OUT_MATERIAL_DESC#", bom.getEOutMaterialDesc());
		sql = sql.replaceAll("#F_IN_MATERIAL_NO#", bom.getFInMaterialNo());
		sql = sql.replaceAll("#F_IN_MATERIAL_DESC#", bom.getFInMaterialDesc());
		sql = sql.replaceAll("#F_OUT_MATERIAL_NO#", bom.getFOutMaterialNo());
		sql = sql
				.replaceAll("#F_OUT_MATERIAL_DESC#", bom.getFOutMaterialDesc());
		sql = sql.replaceAll("#J_IN_MATERIAL_NO#", bom.getJInMaterialNo());
		sql = sql.replaceAll("#J_IN_MATERIAL_DESC#", bom.getJInMaterialDesc());
		sql = sql.replaceAll("#J_OUT_MATERIAL_NO#", bom.getJOutMaterialNo());
		sql = sql
				.replaceAll("#J_OUT_MATERIAL_DESC#", bom.getJOutMaterialDesc());
		sql = sql.replaceAll("#I_IN_MATERIAL_NO#", bom.getIInMaterialNo());
		sql = sql.replaceAll("#I_IN_MATERIAL_DESC#", bom.getIInMaterialDesc());
		sql = sql.replaceAll("#I_OUT_MATERIAL_NO#", bom.getIOutMaterialNo());
		sql = sql
				.replaceAll("#I_OUT_MATERIAL_DESC#", bom.getIOutMaterialDesc());
		sql = sql.replaceAll("#PROCESS_CODE_CS#", bom.getProcessCodeCs());
		PreparedStatement ps = con.prepareStatement(sql);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 修改BOM清单
	 * 
	 * @param con
	 *            连接字符串
	 * @param bom
	 *            BOM类
	 * @throws SQLException
	 */
	public void updateBom(Connection con, DesignBomEntity bom)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.updateBom");
		sql = EntityTool.fillSqlByEntity(sql, bom);
		PreparedStatement ps = con.prepareStatement(sql);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-电炉
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialA(Connection con, DesignBomAEntity bomAEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialA");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomAEntity.getInMaterialNo());
		ps.setObject(2, bomAEntity.getInMaterialDesc());
		ps.setObject(3, bomAEntity.getOutMaterialNo());
		ps.setObject(4, bomAEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-铸造
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialB(Connection con, DesignBomBEntity bomBEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialB");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomBEntity.getInMaterialNo());
		ps.setObject(2, bomBEntity.getInMaterialDesc());
		ps.setObject(3, bomBEntity.getOutMaterialNo());
		ps.setObject(4, bomBEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-锻造
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialC(Connection con, DesignBomCEntity bomCEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialC");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomCEntity.getInMaterialNo());
		ps.setObject(2, bomCEntity.getInMaterialDesc());
		ps.setObject(3, bomCEntity.getOutMaterialNo());
		ps.setObject(4, bomCEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-轧管
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialD(Connection con, DesignBomDEntity bomDEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialD");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomDEntity.getInMaterialNo());
		ps.setObject(2, bomDEntity.getInMaterialDesc());
		ps.setObject(3, bomDEntity.getOutMaterialNo());
		ps.setObject(4, bomDEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-墩拔扩
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialE(Connection con, DesignBomEEntity bomEEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialE");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomEEntity.getInMaterialNo());
		ps.setObject(2, bomEEntity.getInMaterialDesc());
		ps.setObject(3, bomEEntity.getOutMaterialNo());
		ps.setObject(4, bomEEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-热处理
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialF(Connection con, DesignBomFEntity bomFEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialF");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomFEntity.getInMaterialNo());
		ps.setObject(2, bomFEntity.getInMaterialDesc());
		ps.setObject(3, bomFEntity.getOutMaterialNo());
		ps.setObject(4, bomFEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-接箍
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomGEntity
	 *            接箍加工
	 * @throws SQLException
	 */
	public void saveBaseMaterialJ(Connection con, DesignBomGEntity bomGEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialJ");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomGEntity.getInMaterialNo());
		ps.setObject(2, bomGEntity.getInMaterialDesc());
		ps.setObject(3, bomGEntity.getOutMaterialNo());
		ps.setObject(4, bomGEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-加工
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialI(Connection con, DesignBomIEntity bomIEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialI");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomIEntity.getInMaterialNo());
		ps.setObject(2, bomIEntity.getInMaterialDesc());
		ps.setObject(3, bomIEntity.getOutMaterialNo());
		ps.setObject(4, bomIEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料
	 * 
	 * @param con
	 *            连接字符串
	 * @param baseMaterial
	 *            基础物料
	 * @throws SQLException
	 */
	public void saveBaseMaterial(Connection con, BaseMaterialEntity baseMaterial)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterial");
		sql = EntityTool.fillSqlByEntity(sql, baseMaterial);
		PreparedStatement ps = con.prepareStatement(sql);
		ps.executeUpdate();
		ps.close();

		//crm迁移
		CrmBaseMaterialService crmBaseMaterialService =new CrmBaseMaterialService();
		crmBaseMaterialService.saveBaseMaterial(con,baseMaterial);
	}

	/**
	 * 保存 基础数据-投入物料集合-加工
	 * 
	 * @param con连接字符串
	 * @param inMaterialSet
	 *            投入物料集合码(产出物料编码+3位流水号)
	 * @param inMaterialNo
	 *            投入物料编码(配料方案)
	 * @param inMaterialDesc
	 *            投入物料描述(配料方案)
	 * @throws SQLException
	 */
	public void saveBaseMaterialIn(Connection con, String inMaterialSet,
			String inMaterialNo, String inMaterialDesc) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialIIn");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialSet);
		ps.setObject(2, inMaterialNo);
		ps.setObject(3, inMaterialDesc);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-投入物料集合-加工
	 * 
	 * @param con连接字符串
	 * @param inMaterialSet
	 *            投入物料集合码(产出物料编码+3位流水号)
	 * @param inMaterialNo
	 *            产出物料编码(配料方案)
	 * @param inMaterialDesc
	 *            产出物料描述(配料方案)
	 * @throws SQLException
	 */
	public void saveBaseMaterialI(Connection con, String inMaterialSet,
			String outMaterialNo, String outMaterialDesc) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialI");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialSet);
		ps.setObject(2, outMaterialNo);
		ps.setObject(3, outMaterialDesc);
		ps.executeUpdate();
		ps.close();
	}

	// ------------------------基础数据-投入产出-产线能力-------------------------
	/**
	 * 保存 基础数据-电炉投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialAPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialAPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-铸造投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialBPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialBPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-锻造投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialCPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialCPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-轧管投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialDPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialDPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-墩拔扩投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialEPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialEPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-热处理投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialFPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialFPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-接箍投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialJPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialJPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-加工投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialIPl(Connection con, String outInMaterialNo,
			String plineCode, String plineName) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialIPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, outInMaterialNo);
		ps.setObject(2, plineCode);
		ps.setObject(3, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-加工
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomK(Connection con, DesignBomKEntity bomFEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomK");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomFEntity.getBom());
		ps.setObject(2, bomFEntity.getInMaterialNo());
		ps.setObject(3, bomFEntity.getInMaterialDesc());
		ps.setObject(4, bomFEntity.getOutMaterialNo());
		ps.setObject(5, bomFEntity.getOutMaterialDesc());
		ps.setObject(6, bomFEntity.getGroupNum());
		ps.setObject(7, bomFEntity.getMark());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-加工
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomAEntity
	 *            电炉
	 * @throws SQLException
	 */
	public void saveBaseMaterialK(Connection con, DesignBomKEntity bomFEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialK");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomFEntity.getInMaterialNo());
		ps.setObject(2, bomFEntity.getInMaterialDesc());
		ps.setObject(3, bomFEntity.getOutMaterialNo());
		ps.setObject(4, bomFEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-加工投入产出-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialKPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName,
			String inMaterialDesc, String outMaterialDesc) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialKPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, outInMaterialNo);
		ps.setObject(3, plineCode);
		ps.setObject(4, plineName);
		ps.setObject(5, inMaterialDesc);
		ps.setObject(6, outMaterialDesc);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存 基础数据-接箍加工-产线能力
	 * 
	 * @param con
	 *            连接字符串
	 * @param inMaterialNo
	 *            投入物料编码
	 * @param outInMaterialNo
	 *            产出物料编码
	 * @param plineCode
	 *            适用产线编码
	 * @param plineName
	 *            适用产线描述
	 * @throws SQLException
	 */
	public void saveBaseMaterialHPl(Connection con, String inMaterialNo,
			String outInMaterialNo, String plineCode, String plineName,
			String inMaterialDesc, String outMaterialDesc) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialHPl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, inMaterialNo);
		ps.setObject(2, inMaterialDesc);
		ps.setObject(3, outInMaterialNo);
		ps.setObject(4, outMaterialDesc);
		ps.setObject(5, plineCode);
		ps.setObject(6, plineName);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存基础物料-接箍加工
	 * 
	 * @param con
	 *            连接字符串
	 * @param bomGEntity
	 *            接箍加工
	 * @throws SQLException
	 */
	public void saveBaseMaterialH(Connection con,
			SlmOrdDesignBomHEntity bomHEntity) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IBomSaveDao.saveBaseMaterialH");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomHEntity.getInMaterialNo());
		ps.setObject(2, bomHEntity.getInMaterialDesc());
		ps.setObject(3, bomHEntity.getOutMaterialNo());
		ps.setObject(4, bomHEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * BOM-接箍加工
	 * 
	 * @param con
	 * @param bomDEntity
	 * @throws SQLException
	 */
	public void saveBomH(Connection con, SlmOrdDesignBomHEntity bomHEntity)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory.getSql("IBomSaveDao.saveBomH");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, bomHEntity.getBom());
		ps.setObject(2, bomHEntity.getInMaterialNo());
		ps.setObject(3, bomHEntity.getInMaterialDesc());
		ps.setObject(4, bomHEntity.getOutMaterialNo());
		ps.setObject(5, bomHEntity.getOutMaterialDesc());
		ps.executeUpdate();
		ps.close();
	}
}
