package com.steering.pss.judge.Bll;

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

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

import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.comm.tools.SqlBuilder;
import com.steering.pss.judge.model.QcmBcPassApplyEntity;
import com.steering.pss.judge.model.QcmBcPassConfigEntity;
import com.steering.pss.judge.model.QcmZgJugdeApplyEntity;
import com.steering.pss.plnsaleord.stove.PlanFurnProduction;
import com.steering.pss.qcm.model.GenericEntity;
import com.steering.pss.ydm.pipemanage.FrmBcIqInList;

public class BllRolledJhyPassApply  extends DBCommon {
	
	public CoreReturnObject passConfigSave(String[] parm){
		ArrayList<String> sqllist = new ArrayList<String>();
		SqlBuilder b = new SqlBuilder("");
		if(parm[1].equals("")){
			Connection con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
			b = new SqlBuilder("JdgQcmJhyPassConfig.GetMaxPk");
			b.Fill(new String[]{ parm[0], parm[3] });
			GenericEntity maxValue = EntityTool.getEntityBySql(
					b.toString(), con, GenericEntity.class);
			b = new SqlBuilder("JdgQcmJhyPassConfig.Insert");
			parm[1] = maxValue.getMaxValue();
			b.Fill(parm);
			sqllist.add(b.toString());
		}else{
			b = new SqlBuilder("JdgQcmJhyPassConfig.Update");
			b.Fill(new String[]{ parm[0], parm[1], parm[3], parm[2]});
			sqllist.add(b.toString());
		}
		
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
	}
	
	public CoreReturnObject passConfigDelete(String[] parm){
		ArrayList<String> sqllist = new ArrayList<String>();
		SqlBuilder b = new SqlBuilder("JdgQcmJhyPassConfig.Delete");
		b.Fill(parm);
		sqllist.add(b.toString());
		b = new SqlBuilder("JdgQcmJhyPassConfig.setAuditStep");
		b.Fill(parm);
		sqllist.add(b.toString());
		
		return this.getDao(CoreConstantData.sysbeanstr).ExcuteTransction(sqllist);
	}
	
}
