/**
 * @(#)file    BidIngBiz.java
 * @(#)author  Son Hyung Min 
 * @(#)version 1.0
 * @(#)date    2014-06-23
 * @(#)since   JDK 1.4.2
 */
package kr.co.udapsoft.ebid.buyer.bid.purchase.biz;



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

import oracle.toplink.internal.ox.StrBuffer;
import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.sql.Row;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;
import kr.co.udapsoft.common.code.CommCodeManager;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;
import kr.co.udapsoft.ebid.buyer.sycs.user.biz.UserCommon;

import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.modular.web.ibsheet7.util.IBSheet7Utils;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

   
public class TBECheckDetailBiz extends Biz {

	public TBECheckDetailBiz(HandlerStorage storage) {
		super(storage);
	}

	public void doBiz() throws Exception {
        ValueObject user = new ValueObject();
        RowSet tbe_info = null;
        RowSet tbe_result = null;
		boolean success = false;
		if(storage.compareEvent("FORM_SELECT")){
	            user = getOrderReqeustValueObject();
	            storage.addValueObject("Order", user);
	            /**		파일 목록 조회			 **/
		}else if(storage.compareEvent("GET_FILE_LIST")){
			 params.set("sheet1", getFileList());
	         storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}else if(storage.compareEvent("SAVE") || storage.compareEvent("REVIEW") || storage.compareEvent("RECALL")){
			success = saveProc(storage.getEvent());
			if(success)
				storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}
		
	}
	
	private ValueObject getfilelist(String filegb,String id,String returnid){
		ValueObject vo = new ValueObject();
		RowSet rowSet = FileManager.getFileList(filegb, id);
		String str="";
	        for(int i=0;i<rowSet.size();i++){
	        	Row row=rowSet.getRow(i);
	        	str += (i+1)+" : "+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
	        	if(i+1!=rowSet.size()){
	        		str +="\r\n";
	        	}
	        }
	        vo.set(returnid, str);
		return vo;
	}

	/**
	 * 발주의뢰(외주) 접수를 검색하여 리턴
	 * @param Params
	 * @return
	 */
	private RowSet getBoardList(ValueObject param) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{ 
        	sqlstr.append(" SELECT A.BID_DEG																															\n");
        	sqlstr.append("      , B.DEPT_NM																																\n");
        	sqlstr.append("      , A.BID_NO																																\n");
        	sqlstr.append("      , A.BID_MASTER_NM																													\n");
        	sqlstr.append("      , A.ONBID_YN																															\n");
        	sqlstr.append("      , TO_CHAR(A.REQUEST_DATE,'YYYY-MM-DD') AS REQUEST_DATE														\n");
        	sqlstr.append("      , TO_CHAR(A.RECEIPT_DATE,'YYYY-MM-DD') AS RECEIPT_DATE															\n");
        	sqlstr.append("      , A.STATUS_CD 																															\n");
        	sqlstr.append("      , F_GET_CODE_NAME('BID_STATUS_CD',STATUS_CD) AS STATUS_NM													\n");
        	sqlstr.append("      , A.DEMANDED_ID		 																												\n");
        	sqlstr.append("      , TO_CHAR(A.OPEN_DT,'YYYY-MM-DD HH24:MI') AS OPEN_DT															\n");
        	sqlstr.append("      , A.OPEN_EMPNM		 																												\n");
        	sqlstr.append("   FROM BID_MASTER A	, ACZ10100V B																									\n");
        	sqlstr.append("   WHERE A.DEPT_CD = B.DEPT_CD																										\n");
        	sqlstr.append("   AND A.STATUS_CD IN ('04','05','06')																									\n");
        	sqlstr.append("   AND A.DEMANDED_KIND = 'O'						\n");
        	sqlstr.append("   AND A.OPEN_DT IS NOT NULL																									\n");
        	if(!param.get("P_DEPT_CD").isEmpty())
        		sqlstr.append("   AND A.DEPT_CD = '"+param.get("P_DEPT_CD")+"'																											\n");
        	if(!param.get("P_BID_MASTER_NM").isEmpty())
        		sqlstr.append("   AND A.BID_MASTER_NM LIKE '%'|| '"+param.get("P_BID_MASTER_NM")+"' ||'%'																	\n");
        	if(!param.get("P_DEMANDED_FROM_DT").isEmpty() && !param.get("P_DEMANDED_TO_DT").isEmpty())
        		sqlstr.append("   AND A.REQUEST_DATE BETWEEN  '"+param.get("P_DEMANDED_FROM_DT")+"' AND '"+param.get("P_DEMANDED_TO_DT")+"'		\n");
        	if(!param.get("P_RCEIPT_FROM_DT").isEmpty() && !param.get("P_RCEIPT_TO_DT").isEmpty())
        		sqlstr.append("   AND A.REQUEST_DATE BETWEEN  '"+param.get("P_RCEIPT_FROM_DT")+"' AND '"+param.get("P_RCEIPT_TO_DT")+"'					\n");
        	if(!param.get("P_DEMANDED_STATUS").isEmpty())
        		sqlstr.append("   AND A.STATUS_CD = '"+param.get("P_DEMANDED_STATUS")+"'																						\n");
			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        return rowSet;
	}
	

	
	/**
	 * 업체별기술문서 _ 업체정보
	 * @param Params
	 * @return
	 */
	private ValueObject getOrderReqeustValueObject() {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        ValueObject valueobject = null;
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append("SELECT A.CORP_REG_NO          				  							\n");
        	sqlstr.append(",A.CORP_KOR            													    \n");
        	sqlstr.append(",B.REG_NM              														\n");
        	sqlstr.append(",B.REG_EMAIL           													    \n");
            sqlstr.append(",B.REG_TEL             													    \n");
            sqlstr.append(",B.BID_NO             														    \n");
            sqlstr.append(",B.BID_DEG          													        \n");
            sqlstr.append(",B.VENDOR_CD         											            \n");
            sqlstr.append(",B.STATUS_CD AS TBE_STATUS_CD      							    \n");
            sqlstr.append(",C.STATUS_CD AS UPPER_STATUS_CD      							    \n");  //2015.3.5 TBE현재상태값 MKLEE
            sqlstr.append(",C.EVAL_EMPID AS EVAL_EMPID      							    \n");  //2015.3.5 TBE현재상태값 MKLEE
            sqlstr.append(",F_GET_CODE_NAME('TBE_SUPP_STATUS_CD',B.STATUS_CD) AS TBE_STATUS_NM    \n");
            sqlstr.append("FROM SUPP_INFO A              										    \n");
            sqlstr.append("    ,TBE_SUPP B                  										\n");
            sqlstr.append("    ,TBE_INFO C                  										\n");
            sqlstr.append("WHERE A.CORP_ID=B.VENDOR_CD                 						\n");
            sqlstr.append("AND B.BID_NO = C.BID_NO                            		        \n");
            sqlstr.append("AND B.BID_DEG = C.BID_DEG           	  	                        \n");
            sqlstr.append("AND B.BID_NO=  '"+params.get("BID_NO")+"'               		    \n");
            sqlstr.append("AND B.BID_DEG=   '"+params.get("BID_DEG")+"'	           	  	    \n");
            sqlstr.append("AND A.CORP_ID=   '"+params.get("CORP_ID")+"'	         	       \n");
        	search.setStatement(sqlstr.toString());
            rowSet = search.execute();
            if( rowSet != null && rowSet.size() > 0 ){
            	valueobject = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
        }
        catch(WAFSQLException se) {
        	super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally {
        	if( valueobject == null ) valueobject = new ValueObject();
            return valueobject;
        }
	}
	/**
	 * 업체별기술문서 _ 문서리스트 조회
	 * @param Params
	 * @return
	 */
	private RowSet getFileList() {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
        	
        	sqlstr.append("SELECT A.REQ_DEG													\n");
        	sqlstr.append("		,B.DOC_NM														\n");
        	sqlstr.append("		,B.STATUS_CD													\n");
        	sqlstr.append("		,F_GET_CODE_NAME('TBE_SUPP_STATUS_CD',B.STATUS_CD) AS STATUS_NM	\n");
        	sqlstr.append("		,TO_CHAR(A.REG_DT,'YYYY-MM-DD') AS REG_DT	\n");
        	sqlstr.append("		,TO_CHAR(A.DOC_DT,'YYYY-MM-DD') AS DOC_DT	\n");
        	sqlstr.append("		,PB.FILE_NAME													\n");
        	sqlstr.append("		,PB.FILE_PATH													\n");
        	sqlstr.append("		,PB.FILE_ID														\n");
        	sqlstr.append("		,PB.REAL_FILE_NAME											\n");
        	sqlstr.append("		,B.EVAL_FILE_GB 												\n");
        	sqlstr.append("		,B.EVAL_FILE_ID 												\n");
        	sqlstr.append("		,A.NOTI															\n");
        	sqlstr.append("		,T.STATUS_CD AS TBE_STATUS_CD						\n");
        	sqlstr.append("FROM TBE_SUPP_CHASU A											\n");
        	sqlstr.append("		,TBE_SUPP_ATTFILE B 										\n");
        	sqlstr.append("		,PUB0510T PA													\n");
        	sqlstr.append("		,PUB0500T PB													\n");
        	sqlstr.append("		,TBE_SUPP T													\n");
        	sqlstr.append("WHERE A.BID_NO=B.BID_NO										\n"); 
        	sqlstr.append("	AND A.BID_DEG=B.BID_DEG 									\n");
        	sqlstr.append("	AND A.VENDOR_CD=B.VENDOR_CD							\n");
        	sqlstr.append("	AND A.REQ_DEG = B.REQ_DEG									\n");
        	sqlstr.append("	AND PA.FILE_ID = PB.FILE_ID								 	\n");
        	sqlstr.append("	AND PA.FILE_GB = B.EVAL_FILE_GB						 	\n");
        	sqlstr.append("	AND PA.ID = B.EVAL_FILE_ID									\n");
        	sqlstr.append("    AND A.BID_NO=T.BID_NO										\n"); 
        	sqlstr.append("	AND A.BID_DEG=T.BID_DEG 									\n");
        	sqlstr.append("	AND A.VENDOR_CD=T.VENDOR_CD							\n");
        	sqlstr.append("	AND A.BID_NO = '"+params.get("BID_NO")+"'				\n");
        	sqlstr.append("	AND A.BID_DEG = '"+params.get("BID_DEG")+"'			\n");
        	sqlstr.append("	AND A.VENDOR_CD = '"+params.get("VENDOR_CD")+"'	\n");
        	sqlstr.append("ORDER BY A.REQ_DEG DESC, B.EVAL_FILE_GB DESC		\n");
			search.setStatement(sqlstr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally {    
            if(rowSet == null){
            	rowSet = new RowSetImpl();
            }
        }
        
        return rowSet;
	}
	
	  /**
     * 사용자 정보 저장
	 * @param event
	 * @param valueObject
	 * @return
	 */
	public boolean saveProc(String event) {
        try {
            conn.begin();
        	String[] status = super.gets("sheet1.STATUS");
            for (int i = 0; i < status.length; i++) {
				if (IBSheet7Utils.equalStatusUpdate(status[i])) {
					tbe_supp_file_update(super.conn.getConnection(), IBSheet7Utils.getIBSheet7SqlParams("SHEET1", params, i));
					tbe_supp_chasu_noti_update(super.conn.getConnection(), IBSheet7Utils.getIBSheet7SqlParams("SHEET1", params, i));
					ValueObject vo = IBSheet7Utils.getIBSheet7SqlParams("SHEET1", params, i);
					String file_gb = "TBE_FIN" + params.get("VENDOR_CD") + params.get("BID_NO") + params.get("BID_DEG");
					if("10".equals(vo.get("STATUS_CD"))){
						FileManager.copyFileList(super.conn.getConnection(), vo.get("EVAL_FILE_GB"),vo.get("EVAL_FILE_ID"), 	file_gb, vo.get("EVAL_FILE_ID"));
					}						
					params.set("FILE_GB", file_gb);
					params.set("FILE_ID", vo.get("EVAL_FILE_ID"));
				}
			}
            conn.end();
            
            conn.begin();
            //해당차수에 모든 문서가 검토완료 일경우 해당 차수 상태값 10 업데이트.
            if(storage.compareEvent("REVIEW")){
	            if(supp_not_fin_file() == 0){
	            	params.set("TBE_STATUS_CD", "10");
	            	/*RowSet Rs = GetFileList();
	            	for(int i=0; i < Rs.size();i++){
	            		ValueObject row = RowSetUtility.getValueObject(Rs.getRow(i));
						String file_gb = "TBE_FIN" + params.get("VENDOR_CD") + params.get("BID_NO") + params.get("BID_DEG");
						FileManager.copyFileList(super.conn.getConnection(), row.get("EVAL_FILE_GB"),row.get("EVAL_FILE_ID"), 	file_gb, row.get("EVAL_FILE_ID"));
						params.set("FILE_GB", file_gb);
						params.set("FILE_ID", row.get("EVAL_FILE_ID"));
	            	}*/
	            }
            }
            tbe_supp_update(super.conn.getConnection());
            return true;
        }
        catch(Exception e) {
        	storage.addObject("ibsheet7Data", IBSheet7Utils.exceptionHandle(storage.request, e));
            WAFLogger.error(this.getClass().getName() + " --> saveProc() : " + e.getMessage());
            WAFLogger.error(e);
            conn.setRollback();

            storage.setDetailMessage(e);
            return false;
        }
        finally {
            conn.end();
        }
    }
	
	
	/**
     * 기술문서 파일 상태 업데이트
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public void tbe_supp_file_update(Connection connection, ValueObject valueObject) throws Exception {
        Persistent persistent = new PersistentImpl(connection);
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("  UPDATE TBE_SUPP_ATTFILE	\n");
			sqlstr.append("  SET STATUS_CD = ?	\n");
			sqlstr.append("  WHERE BID_NO =?	\n");
			sqlstr.append("  AND BID_DEG =?	\n");
			sqlstr.append("  AND VENDOR_CD = ?	\n");
			sqlstr.append("  AND REQ_DEG = ?	\n");
			sqlstr.append("  AND EVAL_FILE_GB = ?	\n");
        	
            persistent.setStatement(sqlstr.toString());
            persistent.addParameter(valueObject.get("STATUS_CD"));
            persistent.addParameter(params.get("BID_NO"));
            persistent.addParameter(params.get("BID_DEG"));
            persistent.addParameter(params.get("VENDOR_CD"));
            persistent.addParameter(valueObject.get("REQ_DEG"));
            persistent.addParameter(valueObject.get("EVAL_FILE_GB"));
            
            persistent.execute();
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> insert_CONT_OUT_SUPP() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
    }
	
	/**
     * 기술문서 파일 상태 업데이트
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public void tbe_supp_chasu_noti_update(Connection connection, ValueObject valueObject) throws Exception {
        Persistent persistent = new PersistentImpl(connection);
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("  UPDATE TBE_SUPP_CHASU	\n");
        	if(storage.compareEvent("RECALL")){//재요청일경우만 업데이트
        		sqlstr.append("  SET EDIT = '"+params.get("EDIT")+"'	\n");
        		if(!valueObject.get("NOTI").isEmpty()){
        			sqlstr.append("  , NOTI = '"+valueObject.get("NOTI")+"'	\n");
        		}
        		sqlstr.append("  WHERE BID_NO = ?	\n");
    			sqlstr.append("  AND BID_DEG = ?	\n");
    			sqlstr.append("  AND VENDOR_CD = ?	\n");
    			sqlstr.append("  AND REQ_DEG = ?	\n");
                persistent.setStatement(sqlstr.toString());
                persistent.addParameter(params.get("BID_NO"));
                persistent.addParameter(params.get("BID_DEG"));
                persistent.addParameter(params.get("VENDOR_CD"));
                persistent.addParameter(valueObject.get("REQ_DEG"));
                persistent.execute();
        	}else{
        		if(!valueObject.get("NOTI").isEmpty()){
	        		sqlstr.append("  SET NOTI = '"+valueObject.get("NOTI")+"'	\n");
	        		sqlstr.append("  WHERE BID_NO = ?	\n");
	    			sqlstr.append("  AND BID_DEG = ?	\n");
	    			sqlstr.append("  AND VENDOR_CD = ?	\n");
	    			sqlstr.append("  AND REQ_DEG = ?	\n");
	                persistent.setStatement(sqlstr.toString());
	                persistent.addParameter(params.get("BID_NO"));
	                persistent.addParameter(params.get("BID_DEG"));
	                persistent.addParameter(params.get("VENDOR_CD"));
	                persistent.addParameter(valueObject.get("REQ_DEG"));
	                persistent.execute();
	        	}
        	}
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> insert_CONT_OUT_SUPP() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
    }
	
	/**
     * 기술문서 파일 상태 업데이트
	 * @param connection
	 * @param valueObject
	 * @throws Exception
	 */
	public void tbe_supp_update(Connection connection) throws Exception {
        Persistent persistent = new PersistentImpl(connection);
        StrBuffer sqlstr = new StrBuffer();
        try {
        	sqlstr.append("  UPDATE TBE_SUPP	\n");
        	sqlstr.append("  SET STATUS_CD = ?	\n");
        	if(!params.get("FILE_GB").isEmpty())
        		sqlstr.append("  , FIN_FILE_GB = ?	\n");
    		if(!params.get("FILE_ID").isEmpty())	
        		sqlstr.append("  , FIN_FILE_ID = ?	\n");
        	sqlstr.append("  WHERE BID_NO = ?	\n");
        	sqlstr.append("  AND BID_DEG =?	\n");
        	sqlstr.append("  AND VENDOR_CD = ?	\n");
            persistent.setStatement(sqlstr.toString());
            persistent.addParameter(params.get("TBE_STATUS_CD"));
            if(!params.get("FILE_GB").isEmpty())
            	 persistent.addParameter(params.get("FILE_GB"));
            if(!params.get("FILE_ID").isEmpty())	
            	 persistent.addParameter(params.get("FILE_ID"));
            persistent.addParameter(params.get("BID_NO"));
            persistent.addParameter(params.get("BID_DEG"));
            persistent.addParameter(params.get("VENDOR_CD"));
            persistent.execute();
        }
        catch(Exception e) {
            WAFLogger.error(this.getClass().getName() + " --> insert_CONT_OUT_SUPP() : " + e.getMessage());
            WAFLogger.error("SQL : " + sqlstr);
            WAFLogger.error(e);
            throw e;
        }
    }
	
	/**
	 * 업체_미완료 문서 카운트
	 * @param Params
	 * @return
	 */
	private int supp_not_fin_file() {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        int cnt = -1;
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append("SELECT COUNT(*) AS FIN_FILE FROM TBE_SUPP_ATTFILE		\n");
        	sqlstr.append("WHERE BID_NO =  '"+params.get("BID_NO")+"'   		\n");
        	sqlstr.append("AND BID_DEG =  '"+params.get("BID_DEG")+"'		\n");
        	sqlstr.append("AND VENDOR_CD =  '"+params.get("VENDOR_CD")+"'			\n");
        	sqlstr.append("AND REQ_DEG =  (SELECT MAX(REQ_DEG)FROM TBE_SUPP_CHASU WHERE BID_NO = '"+params.get("BID_NO")+"' AND BID_DEG =   '"+params.get("BID_DEG")+"'	 AND VENDOR_CD =  '"+params.get("VENDOR_CD")+"')		\n");
        	sqlstr.append("AND STATUS_CD <> '10' 		\n"); 
        	search.setStatement(sqlstr.toString());
            rowSet = search.execute();
            if( rowSet != null && rowSet.size() > 0 ){
            	cnt = rowSet.getRow(0).getInt("FIN_FILE");
            }
        }
        catch(WAFSQLException se) {
        	super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally {
            return cnt;
        }
	}
	
	/**
	 * 발주의뢰(외주) 접수를 검색하여 리턴
	 * @param Params
	 * @return
	 */
	private RowSet GetFileList() {
		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StrBuffer sqlstr = new StrBuffer();
        try{
        	
        	sqlstr.append(" SELECT B.BID_NO,B.BID_DEG,B.VENDOR_CD,B.REQ_DEG,B.EVAL_FILE_GB,B.EVAL_FILE_ID,B.DOC_NM,B.STATUS_CD FROM TBE_SUPP A,TBE_SUPP_ATTFILE B			\n");
        	sqlstr.append(" WHERE A.BID_NO = B.BID_NO																																												\n");
        	sqlstr.append(" AND A.BID_DEG = B.BID_DEG																																													\n");
        	sqlstr.append(" AND A.VENDOR_CD = B.VENDOR_CD																																										\n");
        	sqlstr.append(" AND A.BID_NO = ?																																																\n");
        	sqlstr.append(" AND A.BID_DEG = ?																																																\n");
        	sqlstr.append(" AND A.VENDOR_CD = ?																																															\n");
        	sqlstr.append(" AND B.REQ_DEG = (SELECT MAX(REQ_DEG) FROM TBE_SUPP_CHASU WHERE BID_NO = ? AND BID_DEG = ? AND VENDOR_CD = ?)												\n");					
			search.setStatement(sqlstr.toString());
			search.addParameter(params.get("BID_NO"));
			search.addParameter(params.get("BID_DEG"));
			search.addParameter(params.get("VENDOR_CD"));
			search.addParameter(params.get("BID_NO"));
            search.addParameter(params.get("BID_DEG"));
            search.addParameter(params.get("VENDOR_CD"));
            rowSet = search.execute();
        }catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);  
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }finally{    
            if(rowSet == null)rowSet = new RowSetImpl();
        }
        return rowSet;
	}
	
	
	
}