package com.steering.pss.judge.Bll;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import CoreFS.SA06.CoreReturnObject;

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.SqlBuilder;

public class BllQcmJhyElementsQuery extends DBCommon{
	
	/**
	 * 删除检化验成分
	 * @param assayNo
	 * @return
	 */
	public CoreReturnObject deleteJhyChem(String stoveNo, String sampleNo){
		Connection jhyCon = null;
		CoreReturnObject cro = new CoreReturnObject();
		try{
			SqlBuilder b = new SqlBuilder("JdgSteerChemAuditResult.updateCxFlagBySmpNoHtNo");
			jhyCon = this.getDao("JhyDao").getConnection();
			jhyCon.setAutoCommit(false);
			b.Fill(new String[]{ stoveNo, sampleNo, "-1" });
			Statement st = jhyCon.createStatement();
			st.executeUpdate(b.toString());
			st.close();
			
			b = new SqlBuilder("QcmJhyElementsDAL.deleteJhyElementsByAssayNo");
			b.Fill(new String[]{ stoveNo + "_" + sampleNo + "_S" });
			this.setData(b.toString());
			
			jhyCon.commit();
			return cro;
		}catch(Exception ex){
			try {
				jhyCon.rollback();
			} catch (SQLException e) {
				e.printStackTrace();
			}
			cro.setV_errMsg(ex.getMessage());
			return cro;
		}finally{
			try {
				jhyCon.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}
