package com.steering.pss.sale.order.qualityDesign.Dao.idao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.List;

import CoreFS.SA08.CoreXmlSqlParsersFactory;

import com.steering.comm.tools.EntityTool;
import com.steering.pss.sale.order.model.DesignMscEntity;
import com.steering.pss.sale.order.qualityDesign.QualityDesignTool;
import com.steering.pss.sale.order.qualityDesign.Dao.imp.QualityPrePDaoImp;

public class IQualityPrePDao implements QualityPrePDaoImp {

	/**
	 * 修改设定制程主键
	 * 
	 * @param con
	 * @param designKeyB
	 * @param designKeyE
	 * @throws SQLException
	 */
	public void updateDesignMscPL(Connection con, String designKeyB,
			String designKeyE) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.updateDesignMscPL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKeyE);
		ps.setObject(2, designKeyB);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 查询designKey
	 * 
	 * @param con
	 *            连接字符串
	 * @param ordLnPk
	 *            合同行
	 * @return designKey
	 * @throws SQLException
	 */
	public String getDesignKeyByOrdLnPk(java.sql.Connection con, String ordLnPk)
			throws SQLException {
		String designKey = "";
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.getDesignKeyByOrdLnPk");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ResultSet rs = ps.executeQuery();
		if (rs.next()) {
			designKey = rs.getString("DESGIN_KEY");
		}
		rs.close();
		ps.close();
		return designKey;
	}

	/**
	 * 录入质量设计合同行主记录
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            合同行
	 * @throws SQLException
	 * @throws ParseException
	 */
	public void addDesignMsc(java.sql.Connection con, DesignMscEntity orderLine)
			throws SQLException, ParseException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.saveDesignMsc");
		sql = EntityTool.fillSqlByEntity(sql, orderLine);
		PreparedStatement ps = con.prepareStatement(sql);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 刪除质量设计合同行主记录
	 * 
	 * @param con
	 *            连接字符串
	 * @param ordLnPk
	 *            合同行号
	 * @throws SQLException
	 */
	public void deleteDesignMsc(java.sql.Connection con, String ordLnPk)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMsc");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-MSC-接箍制程
	 * 
	 * @param con
	 *            连接字符串
	 * @param ordLnPk
	 *            合同行号
	 * @throws SQLException
	 */
	public void deleteDesignMscJGPL(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscJGPL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计状态明细(修改状态)
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStsTklgLst(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStsTklgLst");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计状态(合同行)(修改状态)
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStsTklg(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStsTklg");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 接箍码
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscJG(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscJG");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 备料码
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscBL(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscBL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 接箍-备料
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscJGBL(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscJGBL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 制程
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPL(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 全制程工序内控标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPLPRC(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPLPRC");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 钢种
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPLGZ(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPLGZ");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStd(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStd");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付成分标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdCic(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdCic");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付理化标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdPic(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdPic");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付理化标准- 取样要求
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdPicSmp(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdPicSmp");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付公差标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdSic(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdSic");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付探伤标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdDic(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdDic");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 交付水压标准
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignStdWic(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignStdWic");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 适用产线
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPlGxPrl(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPlGxPrl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 生产周期主表
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPlPC(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPlPC");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 生产周期明细
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPlPCLst(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPlPCLst");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除质量设计 全制程工序点信息
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            designKey
	 * @throws SQLException
	 */
	public void deleteDesignMscPlSTI(java.sql.Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignMscPlSTI");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 查询合同行
	 * 
	 * @param con
	 * @param ordPk
	 * @param ordLnPk
	 * @param orderSeq
	 *            合同行号
	 * @return
	 * @throws SQLException
	 */
	public DesignMscEntity getOrderLine(java.sql.Connection con, String ordPk,
			String ordLnPk) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.getOrderLine");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordPk);
		ps.setObject(2, ordLnPk);
		ResultSet rs = ps.executeQuery();
		List<DesignMscEntity> orderLine = QualityDesignTool.getEntitysByRs(rs,
				DesignMscEntity.class);
		rs.close();
		ps.close();
		if (orderLine.size() > 0) {
			QualityDesignTool.nullConverNullString(orderLine.get(0));
			return orderLine.get(0);
		} else {
			return null;
		}
	}

	/**
	 * 查询合同行
	 * 
	 * @param con
	 * @param ordPk
	 * @param ordLnPk
	 * @param orderSeq
	 *            合同行号
	 * @return
	 * @throws SQLException
	 */
	public DesignMscEntity getOrderLine(java.sql.Connection con, String ordLnPk)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.getOrderLineN");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ResultSet rs = ps.executeQuery();
		List<DesignMscEntity> orderLine = QualityDesignTool.getEntitysByRs(rs,
				DesignMscEntity.class);
		rs.close();
		ps.close();
		if (orderLine.size() > 0) {
			QualityDesignTool.nullConverNullString(orderLine.get(0));
			return orderLine.get(0);
		} else {
			return null;
		}
	}

	/**
	 * 增加质量设计交付标准索引号
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void addDesignStd(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.addDesignStd");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-合同行生产BOM
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteLineBom(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteLineBom");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-合同行生产BOM-接箍BOM
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteLineBomJG(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteLineBomJG");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-合同行生产BOM-备料BOM
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteLineBomBL(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteLineBomBL");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-轧管规格
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteSpec(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSpec");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-轧管坯料断面
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteBlank(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteBlank");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-坯料规格（连铸/模铸）
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteBilt(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteBilt");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-轧管规格-适用产线
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteSpecLine(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSpecLine");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-轧管坯料断面-适用产线
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteBlankLine(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteBlankLine");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除 质量设计-坯料规格（连铸/模铸）-适用产线
	 * 
	 * @param con
	 *            连接字符串
	 * @param designKey
	 *            质量主键
	 * @throws SQLException
	 */
	public void deleteBiltLine(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteBiltLine");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 验证产品码
	 * 
	 * @param con
	 *            连接字符串
	 * @param psc
	 *            产品码
	 * @return String
	 * @throws SQLException
	 */
	public String getValidPsc(Connection con, String psc) throws SQLException {
		String pscInfo = "";
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.getValidPsc");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, psc);
		ResultSet rs = ps.executeQuery();
		if (rs.next()) {
			pscInfo = rs.getString("PSC");
		}
		rs.close();
		ps.close();
		return pscInfo;

	}

	/**
	 * 查询产品规范类型
	 * 
	 * @param con
	 * @param specCode
	 * @return
	 * @throws SQLException
	 */
	public String getSpecStyle(Connection con, String specCode)
			throws SQLException {
		String specStyle = "";
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.getSpecStyle");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, specCode);
		ResultSet rs = ps.executeQuery();
		if (rs.next()) {
			specStyle = rs.getString("MSC_STYLE");
		}
		rs.close();
		ps.close();
		return specStyle;
	}

	/**
	 * 将现在的操作人替换成前面的状态修改人
	 * 
	 * @param con
	 * @param designKey
	 * @param userName
	 * @throws SQLException
	 */
	public void updateTklgLstFalse(Connection con, String designKey,
			String userName) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.updateTklgLstFalse");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, userName);
		ps.setObject(2, designKey);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 查询生成的MSCN
	 * 
	 * @param con
	 * @param psc
	 *            产品规格码
	 * @param alphaNo
	 *            客户Alpha
	 * @return String
	 * @throws SQLException
	 */
	public String queryAlphaMsc(Connection con, String psc, String alphaNo)
			throws SQLException {
		String mscN = "";
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.queryAlphaMsc");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, psc);
		ps.setObject(2, alphaNo);
		ResultSet rs = ps.executeQuery();
		if (rs.next()) {
			mscN = rs.getString("MSC");
		}
		return mscN;
	}

	/**
	 * 修改合同行MSC
	 * 
	 * @param con
	 * @param ordLnPk
	 * @param msc
	 * @param mscDesc
	 * @param useCode
	 * @param useDesc
	 * @throws SQLException
	 */
	public void updateLine(Connection con, String ordLnPk, String msc,
			String mscDesc, String useCode, String useDesc) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.updateLine");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, msc);
		ps.setObject(2, mscDesc);
		ps.setObject(3, useCode);
		ps.setObject(4, useDesc);
		ps.setObject(5, ordLnPk);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 删除锁定制程表
	 * 
	 * @param con
	 * @param ordLnPk
	 * @throws SQLException
	 */
	public void deleteDesignPlControl(Connection con, String ordLnPk)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteDesignPlControl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 保存制程锁定表
	 * 
	 * @param con
	 * @param ordLnPk
	 * @param msc
	 * @param mscPline
	 * @throws SQLException
	 */
	public void saveDesignPlControl(Connection con, String ordLnPk, String msc,
			String mscPline) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.saveDesignPlControl");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, ordLnPk);
		ps.setObject(2, msc);
		ps.setObject(3, mscPline);
		ps.executeUpdate();
		ps.close();
	}

	/**
	 * 修改设定制程KEY
	 * 
	 * @param con
	 * @param designKeyB
	 * @param designKeyE
	 * @throws SQLException
	 */
	public void updateDesignMscJG(Connection con, String designKeyB,
			String designKeyE) throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.updateDesignMscJG");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKeyE);
		ps.setObject(2, designKeyB);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignCicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignCicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignPicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignPicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignWicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignWicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignDicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignDicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignSicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignSicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignGicDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignGicDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignAddAskDiff(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignAddAskDiff");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}

	public void deleteSlmOrdDesignZbsTemplate(Connection con, String designKey)
			throws SQLException {
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignZbsTemplate");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}
	
	public void deleteSlmOrdDesignBiasC(Connection con, String designKey) throws SQLException{
		String sql = CoreXmlSqlParsersFactory
				.getSql("IQualityPrePDao.deleteSlmOrdDesignZbsTemplate");
		PreparedStatement ps = con.prepareStatement(sql);
		ps.setObject(1, designKey);
		ps.executeUpdate();
		ps.close();
	}
}
