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




import java.sql.Connection;

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 com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

   
public class QuotRequestBiz extends Biz {

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

	public void doBiz() throws Exception {
        ValueObject user = new ValueObject();
		
		if(storage.compareEvent("SHEET_SELECT")){
			params.set("sheet1", getBoardList(params));
			storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}else if(storage.compareEvent("FORM_SELECT")){
	            user = getOrderReqeustValueObject();
	            storage.addValueObject("Order", user);
	            /**		파일 목록 조회			 **/
		        storage.addValueObject(user.get("DOC_ETC_OUT"), getfilelist(user.get("DOC_ETC_OUT"),params.get("DEMANDED_ID"),user.get("DOC_ETC_OUT")));
		}else if(storage.compareEvent("GET_ITEM_LIST")){
			params.set("sheet1", geitemList(params));
			storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}else if(storage.compareEvent("GET_SECRET_SAVE")){			
			boolean success = updateSecret(params);				
			storage.setSuccess(success);
		}else if(storage.compareEvent("GET_MORAL_SAVE")){			
			boolean success = updateMoral(params);				
			storage.setSuccess(success);
		}else if(storage.compareEvent("GET_INDUSTRY_SAVE")){			
			boolean success = updateIndustry(params);				
			storage.setSuccess(success);
		}else if(storage.compareEvent("GET_ROLES_SAVE")){			
			boolean success = updateRoles(params);				
			storage.setSuccess(success);
		}else if(storage.compareEvent("GET_PRICESYS_SAVE")){			
			boolean success = updatePricesys(params);				
			storage.setSuccess(success);
		}else{			
			user = getInfoObject(params);
            storage.addValueObject("DocInfoPop", user);
		}
	}
	
	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();
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append("( SELECT CASE WHEN BID_FROM_DT > SYSDATE OR BID_TO_DT < SYSDATE THEN '불가능'	\n");
        	sqlstr.append("              WHEN BID_RNNC_ID IS NULL AND SITEDESC_FLAG = 'Y'  AND STATUS_NM = '04' AND SITEPARTI_YN = 'Y' THEN '가능'	\n");
        	sqlstr.append("              WHEN BID_RNNC_ID IS NULL AND SITEDESC_FLAG = 'N'  AND STATUS_NM = '04' THEN '가능'	\n");
        	sqlstr.append("              ELSE '불가능' END AS ESTI_YN,	\n");
        	sqlstr.append(" 			TO_CHAR(AA.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT,		\n");
        	sqlstr.append("        AA.STATUS_CD,																				\n");            
        	sqlstr.append("        AA.BID_NO,																					\n");	
        	sqlstr.append("        AA.BID_DEG,																					\n");
        	sqlstr.append("        AA.BID_MASTER_NM,																			\n");
        	sqlstr.append("        AA.DEMANDED_TITLE,																			\n");
        	sqlstr.append("        AA.SITEDESC_FLAG,																			\n");
        	sqlstr.append("        AA.SITEPARTI_YN,																				\n");
        	sqlstr.append("        AA.VENDOR_CD,																				\n");
        	sqlstr.append("        AA.DEMANDED_ID,																				\n");
        	sqlstr.append("        DECODE(AA.SIGN_DT, '미제출', '', '입찰포기','', AA.SIGN_DT) SIGN_DT,							\n");
        	sqlstr.append("        DECODE(AA.SIGN_DT, '미제출', '미제출', '입찰포기','입찰포기', '제출완료') SIGN_YN,				 	\n");//2016.12.8 제출완료표기
        	sqlstr.append("        AA.STATUS_NM,																				\n");
        	sqlstr.append("        AA.DEMANDED_KIND,																			\n");
        	sqlstr.append("        AA.POSTPONE_YN,																				\n");
        	sqlstr.append("        AA.MODIFY_YN,																				\n");
        	sqlstr.append("        AA.TBE_FLAG,																					\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        NVL(AA.TBE_STATUS,'') TBE_STATUS,																				\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        (select count(*) from TBE_SUPP cnt where bid_no = aa.bid_no and bid_deg < aa.bid_deg and vendor_cd = aa.vendor_cd and status_cd <> '00') as tbe_comp_cnt		\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append(" FROM (																								\n");
        	sqlstr.append(" SELECT A.BID_TO_DT,																					\n");
        	sqlstr.append("        A.STATUS_CD,																					\n");
        	sqlstr.append("        A.BID_NO,																					\n");
        	sqlstr.append("        A.BID_DEG,																					\n");
        	sqlstr.append("        A.BID_MASTER_NM,																				\n");
        	sqlstr.append("        A.DEMANDED_TITLE,																			\n");
        	sqlstr.append("        A.SITEDESC_FLAG,																				\n");
        	sqlstr.append("        A.BID_FROM_DT,																				\n");
        	sqlstr.append("         CASE WHEN A.BID_TO_DT > SYSDATE AND A.STATUS_CD = '04' THEN '04'		\n");  //입찰진행중(~마감시간 전까지) 2015.3.26 시행결의반려 제외 
        	sqlstr.append("         WHEN A.BID_TO_DT < SYSDATE AND A.STATUS_CD = '04' THEN '04E'			\n");  //입찰마감 (마감시간 ~ 개찰전)
        	//sqlstr.append("         WHEN A.STATUS_CD = '05' THEN '05'														        \n");   
        	sqlstr.append(" 		WHEN A.STATUS_CD = '05' OR  A.STATUS_CD = '06' OR A.STATUS_CD = '07' THEN '05'              \n");  //업체선정중(개찰 ~ 시행결의 완료)
        	sqlstr.append(" 		ELSE '' END AS STATUS_NM,																	\n");
        	sqlstr.append("        B.SITEPARTI_YN,																				\n");
        	sqlstr.append("        B.BID_RNNC_ID,																				\n");
        	sqlstr.append("        B.BID_RNNC_NM,																				\n");
        	sqlstr.append("        B.BID_RNNC_DT,																				\n");
        	sqlstr.append("        B.RNNC_REASON,																				\n");
        	sqlstr.append("        B.VENDOR_CD,																					\n"); 
        	sqlstr.append("        A.DEMANDED_ID,																				\n");
        	sqlstr.append("        A.DEMANDED_KIND,																				\n");
        	sqlstr.append("        DECODE(B.BID_RNNC_DT,NULL,DECODE(B.SIGN_DT,NULL,'미제출',TO_CHAR(B.SIGN_DT,'YYYY-MM-DD HH24:MI:SS')),'입찰포기') AS SIGN_DT,	\n");
        	sqlstr.append("        DECODE(A.POSTPONE_REASON,'','N','Y') AS POSTPONE_YN,								\n");
        	sqlstr.append("        DECODE(A.MODIFY_REASON,'','N','Y') AS MODIFY_YN,									\n");
        	sqlstr.append("        A.TBE_FLAG,																		\n");	//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        C.STATUS_CD AS TBE_STATUS														\n");	//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append(" FROM BID_MASTER A  ,BID_SUPP B, TBE_SUPP C												\n");
        	sqlstr.append(" WHERE A.BID_NO = B.BID_NO(+)															\n");
        	sqlstr.append(" AND A.BID_DEG = B.BID_DEG(+)															\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.VENDOR_CD = C.VENDOR_CD(+)														\n");
        	sqlstr.append(" AND A.ONBID_YN = 'Y'																	\n");
        	sqlstr.append(" AND A.NOTI_DY <= TO_CHAR(SYSDATE,'YYYYMMDD')											\n");
        	sqlstr.append(" AND A.CMPT_CD = '01'																	\n");
        	sqlstr.append(" AND (A.OUT_ITEM_CD IN (SELECT OUT_ITEM_CD FROM SUPP_OUT_ITEM WHERE CORP_ID =  '"+params.get("VENDOR_CD")+"')									\n");
        	sqlstr.append("    OR A.MATERIAL_GB IN (SELECT SC.PARENT_LEVEL FROM SUPP_PUR_ITEM SA , PMM_MATERIALGROUP_V SB , PMM_MATERIALGROUP_V SC WHERE SA.KIND_SMALL=SB.MATERIALGROUP AND SB.PARENT_LEVEL = SC.MATERIALGROUP AND SA.CORP_ID =  '"+params.get("VENDOR_CD")+"' GROUP BY SC.PARENT_LEVEL))							\n");
        	sqlstr.append(" AND A.STATUS_CD IN ('04','05','06','07')																				\n");	//2015.3.26 07추가 
        	sqlstr.append(" AND B.VENDOR_CD(+) = '"+params.get("VENDOR_CD")+"') AA WHERE 1=1	\n");
        	sqlstr.append(" AND ((AA.SITEDESC_FLAG = 'Y' AND AA.SITEPARTI_YN = 'Y') OR AA.SITEDESC_FLAG = 'N')										\n");
        	if(!param.get("P_BID_MASTER_NM").isEmpty())
        		sqlstr.append("   AND AA.BID_MASTER_NM LIKE '%'|| '"+param.get("P_BID_MASTER_NM")+"' ||'%'											\n");
        	if(!param.get("SITEDESC_FROM_DT").isEmpty())
        		sqlstr.append("   AND AA.BID_TO_DT >  TO_DATE('"+param.get("SITEDESC_FROM_DT")+"'||'000000','YYYY-MM-DDHH24MISS') 					\n");
        	if(!param.get("SITEDESC_TO_DT").isEmpty())
        		sqlstr.append("   AND AA.BID_TO_DT <  TO_DATE('"+param.get("SITEDESC_TO_DT")+"'||'235959','YYYY-MM-DDHH24MISS')						\n");
        	
        	if(!param.get("P_STATUS").isEmpty())
        		sqlstr.append("   AND AA.STATUS_NM = '"+param.get("P_STATUS")+"'																	\n");
        	sqlstr.append(" UNION ALL																												\n");
        	sqlstr.append(" SELECT CASE WHEN BID_FROM_DT > SYSDATE OR BID_TO_DT < SYSDATE THEN '불가능'	\n");
        	sqlstr.append("              WHEN BID_RNNC_ID IS NOT NULL THEN '불가능'	\n");
        	sqlstr.append(" 	          WHEN BID_RNNC_ID IS NULL AND SITEDESC_FLAG = 'Y' AND VENDOR_CD = '"+params.get("VENDOR_CD")+"' AND STATUS_NM = '04' AND SITEPARTI_YN = 'Y' THEN '가능'	\n");
        	sqlstr.append("              WHEN BID_RNNC_ID IS NULL AND SITEDESC_FLAG = 'N' AND VENDOR_CD = '"+params.get("VENDOR_CD")+"' AND STATUS_NM = '04' THEN '가능'	\n");
        	sqlstr.append("              ELSE '불가능' END AS ESTI_YN,	\n");
        	sqlstr.append(" 			TO_CHAR(AA.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT,		\n");
        	sqlstr.append("        AA.STATUS_CD,																					\n");            
        	sqlstr.append("        AA.BID_NO,																						\n");	
        	sqlstr.append("        AA.BID_DEG,																						\n");
        	sqlstr.append("        AA.BID_MASTER_NM,																				\n");
        	sqlstr.append("        AA.DEMANDED_TITLE,																				\n");
        	sqlstr.append("        AA.SITEDESC_FLAG,																				\n");
        	sqlstr.append("        AA.SITEPARTI_YN,																					\n");
        	sqlstr.append("        AA.VENDOR_CD,																					\n");
        	sqlstr.append("        AA.DEMANDED_ID,																					\n");
        	sqlstr.append("        DECODE(AA.SIGN_DT, '미제출', '', '입찰포기','', AA.SIGN_DT) SIGN_DT,								\n");
        	sqlstr.append("        DECODE(AA.SIGN_DT, '미제출', '미제출', '입찰포기','입찰포기', '제출완료') SIGN_YN,						\n");//2016.12.8 제출완료표기
        	sqlstr.append("        AA.STATUS_NM,																					\n");
        	sqlstr.append("        AA.DEMANDED_KIND,																				\n");
        	sqlstr.append("        AA.POSTPONE_YN,																					\n");
        	sqlstr.append("        AA.MODIFY_YN,																					\n");
        	sqlstr.append("        AA.TBE_FLAG,																						\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        NVL(AA.TBE_STATUS,'') TBE_STATUS,																					\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        (select count(*) from TBE_SUPP cnt where bid_no = aa.bid_no and bid_deg < aa.bid_deg and vendor_cd = aa.vendor_cd and status_cd <> '00') as tbe_comp_cnt		\n");//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append(" FROM (																									\n");
        	sqlstr.append(" SELECT A.BID_TO_DT,																						\n");
        	sqlstr.append("        A.STATUS_CD,																						\n");
        	sqlstr.append("        A.BID_NO,																						\n");
        	sqlstr.append("        A.BID_DEG,																						\n");
        	sqlstr.append("        A.BID_MASTER_NM,																					\n");
        	sqlstr.append("        A.DEMANDED_TITLE,																				\n");
        	sqlstr.append("        A.SITEDESC_FLAG,																					\n");
        	sqlstr.append("        A.BID_FROM_DT,																					\n");
        	sqlstr.append("         CASE WHEN A.BID_TO_DT > SYSDATE AND A.STATUS_CD = '04' THEN '04'	                         	\n");  // 2015.3.26 '05','06'제외 
        	sqlstr.append("         WHEN A.BID_TO_DT < SYSDATE AND A.STATUS_CD = '04' THEN '04E'			                        \n");  // 2015.3.26,'05','06'제외 
        	sqlstr.append(" 		WHEN A.STATUS_CD = '05' OR  A.STATUS_CD = '06' OR A.STATUS_CD = '07' THEN '05'                  \n");  //2015.3.26 추가
        	sqlstr.append(" 		ELSE '' END AS STATUS_NM,																	    \n");
        	sqlstr.append("        B.SITEPARTI_YN,																					\n");
        	sqlstr.append("        B.BID_RNNC_ID,																					\n");
        	sqlstr.append("        B.BID_RNNC_NM,																					\n");
        	sqlstr.append("        B.BID_RNNC_DT,																					\n");
        	sqlstr.append("        B.RNNC_REASON,																					\n");
        	sqlstr.append("        B.VENDOR_CD,																						\n"); 
        	sqlstr.append("        A.DEMANDED_ID,																					\n");
        	sqlstr.append("        A.DEMANDED_KIND,																					\n");
        	sqlstr.append("        DECODE(A.POSTPONE_REASON,'','N','Y') AS POSTPONE_YN,												\n");
        	sqlstr.append("        DECODE(A.MODIFY_REASON,'','N','Y') AS MODIFY_YN,													\n");
        	sqlstr.append("        DECODE(B.BID_RNNC_DT,NULL,DECODE(B.SIGN_DT,NULL,'미제출',TO_CHAR(B.SIGN_DT,'YYYY-MM-DD HH24:MI:SS')),'입찰포기') AS SIGN_DT,	\n");
        	sqlstr.append("        A.TBE_FLAG,																\n");	//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append("        C.STATUS_CD AS TBE_STATUS												\n");	//2022.01.11 TBE대상이며 검토미완료시 견적불가능하도록
        	sqlstr.append(" FROM BID_MASTER A  ,BID_SUPP B, TBE_SUPP C										\n");
        	sqlstr.append(" WHERE A.BID_NO = B.BID_NO														\n");
        	sqlstr.append(" AND A.BID_DEG = B.BID_DEG														\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.VENDOR_CD = C.VENDOR_CD(+)												\n");
        	sqlstr.append(" AND A.ONBID_YN = 'Y'															\n");
        	sqlstr.append(" AND A.NOTI_DY <= TO_CHAR(SYSDATE,'YYYYMMDD')									\n");
        	sqlstr.append(" AND A.CMPT_CD <> '01'															\n");
        	//sqlstr.append(" AND A.OPEN_DT IS NULL															\n");
        	sqlstr.append(" AND A.STATUS_CD IN ('04','05','06','07')										\n");//2015.3.26 07추가 
        	sqlstr.append(" AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"') AA WHERE 1=1	\n");
        	sqlstr.append(" AND ((AA.SITEDESC_FLAG = 'Y' AND AA.SITEPARTI_YN = 'Y') OR AA.SITEDESC_FLAG = 'N')						\n");
        	if(!param.get("P_BID_MASTER_NM").isEmpty())
        		sqlstr.append("   AND AA.BID_MASTER_NM LIKE '%'|| '"+param.get("P_BID_MASTER_NM")+"' ||'%'							\n");
        	if(!param.get("SITEDESC_FROM_DT").isEmpty())
        		sqlstr.append("   AND AA.BID_TO_DT >  TO_DATE('"+param.get("SITEDESC_FROM_DT")+"'||'000000','YYYY-MM-DDHH24MISS') 	\n");
        	if(!param.get("SITEDESC_TO_DT").isEmpty())
        		sqlstr.append("   AND AA.BID_TO_DT <  TO_DATE('"+param.get("SITEDESC_TO_DT")+"'||'235959','YYYY-MM-DDHH24MISS')		\n");
        	
        	if(!param.get("P_STATUS").isEmpty())
        		sqlstr.append("   AND AA.STATUS_NM = '"+param.get("P_STATUS")+"'													\n");
        	sqlstr.append("  )ORDER BY BID_TO_DT 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 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.BID_NO,                   \n");
        	sqlstr.append("              A.BID_DEG,                   \n");
        	sqlstr.append("              A.DEMANDED_ID,                   \n");
        	sqlstr.append("              A.DEMANDED_NO,                   \n");
        	sqlstr.append("              A.DEPT_CD,                   \n");
        	sqlstr.append("              A.DEPT_NM,                   \n");
        	sqlstr.append("              A.DEMANDED_TITLE,                   \n");
        	sqlstr.append("              A.DEMANDED_KIND,                   \n");
        	sqlstr.append("              A.DEMANDED_DATE,                   \n");
        	sqlstr.append("              TO_CHAR(TO_DATE(A.DEMANDED_DATE,'YYYYMMDD'),'YYYY-MM-DD') AS DEMANDED_DATE_NM,                   \n");
        	sqlstr.append("              A.REQUEST_DATE,                   \n");
        	sqlstr.append("              A.REQ_DEPT_CD,                   \n");
        	sqlstr.append("              A.REQ_DEPT_NM,                   \n");
        	sqlstr.append("              A.EMP_NO,                   \n");
        	sqlstr.append("              A.EMP_NM,                   \n");
        	sqlstr.append("              A.PAY_ITEM,                   \n");
        	sqlstr.append("              F_GET_PAY_ITEM_VIEW(A.PAY_ITEM,A.COST_CODE,A.COST_TYPE,A.DEPT_CD) AS PAY_ITEM_NM,                   \n");
        	sqlstr.append("              A.COST_CODE,                   \n");
        	sqlstr.append("              A.COST_TYPE,                   \n");
        	sqlstr.append("              A.CONT_AMT,                   \n");
        	sqlstr.append("              A.ACT_AMT,                   \n");
        	sqlstr.append("              A.ACT_RATE,                   \n");
        	sqlstr.append("              A.RECEIPT_DATE,                   \n");
        	sqlstr.append("              TO_CHAR(A.RECEIPT_DATE,'YYYY-MM-DD') AS RECEIPT_DATE_NM,                   \n");
        	sqlstr.append("              A.ONBID_YN,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('ONBID',ONBID_YN) AS ONBID_YN_NM,                   \n");
        	sqlstr.append("              A.CMPT_CD,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('CMPT_CD',A.CMPT_CD) AS CMPT_NM,                   \n");
        	sqlstr.append("              A.SUCC_CD,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('SUCC_CD',A.SUCC_CD) AS SUCC_NM,                   \n");
        	sqlstr.append("              A.NOTI_DY,                   \n");
        	sqlstr.append("              TO_CHAR(TO_DATE(A.NOTI_DY,'YYYYMMDD'),'YYYY-MM-DD') AS NOTI_DY_NM,                   \n");
        	sqlstr.append("              A.SITEDESC_FLAG,                   \n");
        	sqlstr.append("              DECODE(A.SITEDESC_FLAG,'Y','예','N','아니오','') AS SITEDESC_FLAG_NM,                   \n");
        	sqlstr.append("              A.SITEDESCCHRGPRSNID,                   \n");
        	sqlstr.append("              F_GET_USER_NM(A.SITEDESCCHRGPRSNID) AS SITEDESCCHRGPRSNNM,                   \n");
        	sqlstr.append("              A.SITEDESC_CRG_NM,                   \n");
        	sqlstr.append("              A.SITEDESCTELNO,                   \n");
        	sqlstr.append("              A.SITEDESCEMAIL,                   \n");
        	sqlstr.append("              A.SITEDESCDATE,                   \n");
        	sqlstr.append("              TO_CHAR(A.SITEDESCDATE,'YYYY-MM-DD HH24:MI') AS SITEDESCDATE_NM,                   \n");
        	sqlstr.append("              A.SITEDESCPLACE,                   \n");
        	sqlstr.append("              A.BID_FROM_DT,                   \n");
        	sqlstr.append("              TO_CHAR(A.BID_FROM_DT,'YYYY-MM-DD HH24:MI') AS BID_FROM_DT_NM,                   \n");
        	sqlstr.append("              A.BID_TO_DT,                   \n");
        	sqlstr.append("              TO_CHAR(A.BID_TO_DT,'YYYY-MM-DD HH24:MI') AS BID_TO_DT_NM,                   \n");
        	sqlstr.append("              A.PUREMPNO,                   \n");
        	sqlstr.append("              F_GET_USER_NM(A.PUREMPNO) AS PUREMPNM,                   \n");
        	sqlstr.append("              A.PO_EMPNM,                   \n");
        	sqlstr.append("              A.OPEN_EMPNM,                   \n");
        	sqlstr.append("              A.OPEN_EMPID,                   \n");
        	sqlstr.append("              A.OPEN_DT,                   \n");
        	sqlstr.append("              A.TBE_FLAG,                   \n");
        	sqlstr.append("              DECODE(A.TBE_FLAG,'Y','예','N','아니오','') AS TBE_FLAG_NM,                   \n");
        	sqlstr.append("              A.DELIVERY_CONDITION,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('PUR_LEAD_GB',A.DELIVERY_CONDITION) AS DELIVERY_CONDITION_NM,	\n");
        	sqlstr.append("              A.DELIVERY_PLACE,                   \n");
        	sqlstr.append("              A.INNER_REMARKS,                   \n");
        	sqlstr.append("              A.OUTER_REMARKS,                   \n");
        	sqlstr.append("              A.ATT_ID,                   \n");
        	sqlstr.append("              A.BID_APP_DATE,                   \n");
        	sqlstr.append("              A.BID_APP_NO,                   \n");
        	sqlstr.append("              A.CONT_APP_DATE,                   \n");
        	sqlstr.append("              A.CONT_APP_NO,                   \n");
        	sqlstr.append("              A.DOC_ETC_IN,                   \n");
        	sqlstr.append("              A.DOC_ETC_OUT,                   \n");
        	sqlstr.append("              A.BID_MASTER_NM,                   \n");
        	sqlstr.append("              A.POSTPONE_REASON,                   \n");
        	sqlstr.append("              A.CANCEL_REASON,                   \n");
        	sqlstr.append("              A.MODIFY_REASON,                   \n");
        	sqlstr.append("              A.FIB_REASON,                   \n");
        	sqlstr.append("              A.OUT_ITEM_CD,                   \n");
        	sqlstr.append("              GET_OUT_ITEM_NM(A.OUT_ITEM_CD) AS OUT_ITEM_NM,                   \n");
        	sqlstr.append("              A.STATUS_CD,                   \n");
        	sqlstr.append("              DECODE(A.STATUS_CD,'04','현설완료',F_GET_CODE_NAME('BID_STATUS_CD',A.STATUS_CD)) AS STATUS_NM,                   \n");
        	sqlstr.append("              A.DIV_PO_YN,                   \n");
        	sqlstr.append("              A.CURRENCY_GB,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('911',A.CURRENCY_GB) AS CURRENCY_GB_NM,                   \n");
        	sqlstr.append("              A.CURRENCY_GB_YN,                   \n");
        	sqlstr.append("              A.PBC_CBE_TYPE_CD,                   \n");
        	sqlstr.append("              A.PBC_INSTALL_YN,                   \n");
        	sqlstr.append("              A.PBC_COMMISS_YN,                   \n");
        	sqlstr.append("              A.PBC_SPETOOL_YN,                   \n");
        	sqlstr.append("              A.PBC_TEST_YN,                   \n");
        	sqlstr.append("              A.PBC_DOC_YN,                   \n");
        	sqlstr.append("              A.PBC_PACK_YN,                   \n");
        	sqlstr.append("              A.PBC_LANDTRAN_YN,                   \n");
        	sqlstr.append("              A.DELIVERY_CONDITION_YN,                   \n");
        	sqlstr.append("              A.PBC_FEE_YN,                   \n");
        	sqlstr.append("              A.PBC_OPTION_COMMENT,                   \n");
        	sqlstr.append("              A.PBC_OPTION_YN,                   \n");
        	sqlstr.append("              A.PAY_CON_RATE,                   \n");
        	sqlstr.append("              A.CBC_DAMAGE_RATE,                   \n");
        	sqlstr.append("              A.CBC_DAMAGE_MAXRATE,                   \n");
        	sqlstr.append("       		 F_GET_CODE_NAME('LIQ_DMG_CD', A.CBC_DAMAGE_CD) AS CBC_DAMAGE_NM,			\n");
		    sqlstr.append("       		 A.PBC_DEFECT_CONDI2,			\n");
		    sqlstr.append("       		 A.CBC_DERECT_TERM_CD2,			\n");
		    sqlstr.append("       		 A.CBC_DEFECT_DAY2,				\n");
        	sqlstr.append("              A.CBC_FIRST_RATE,                   \n");
        	sqlstr.append("              A.PBC_FIRST_CONDI,                   \n");
        	sqlstr.append("              A.CPC_MID_RATE,                   \n");
        	sqlstr.append("              A.PBC_MID_CONDI,                   \n");
        	sqlstr.append("              A.PBC_REST_RATE,                   \n");
        	sqlstr.append("              A.PBC_REST_CONDI,                   \n");
        	sqlstr.append("              A.PBC_FRSTGUAR_RATE,                   \n");
        	sqlstr.append("              A.PBC_FRSTGUAR_CONDI,                   \n");
        	sqlstr.append("              A.CONTFUL_RATE,                   \n");
        	sqlstr.append("              A.CONTFUL_CONDI,                   \n");
        	sqlstr.append("              A.WARR_RATE,                   \n");
        	sqlstr.append("              A.WARR_CONDI,                   \n");
        	sqlstr.append("              A.PBC_DEFECT_CONDI,                   \n");
        	sqlstr.append("              A.CBC_DEFECT_DAY,                   \n");
        	sqlstr.append("              A.CBC_DERECT_TERM_CD,                   \n");
        	sqlstr.append("       		  F_GET_CODE_NAME('CBC_DERECT_TERM_CD',A.CBC_DERECT_TERM_CD) AS CBC_DERECT_TERM_NM,			\n");
        	sqlstr.append("              A.DELI_FROM_DY,                   \n");
        	sqlstr.append("              TO_CHAR(TO_DATE(A.DELI_FROM_DY,'YYYYMMDD'),'YYYY-MM-DD') AS DELI_FROM_DY_NM,                   \n");
        	sqlstr.append("              A.DELI_TO_DY,                   \n");
        	sqlstr.append("              TO_CHAR(TO_DATE(A.DELI_TO_DY,'YYYYMMDD'),'YYYY-MM-DD') AS DELI_TO_DY_NM,                   \n");
        	sqlstr.append("              A.OBC_CONT_TYPE_CD,                   \n");
        	sqlstr.append("              F_GET_CODE_NAME('CONT_TYPE',A.OBC_CONT_TYPE_CD) AS OBC_CONT_TYPE_NM,                   \n");
        	sqlstr.append("              A.OBC_FRST_CASH_RATE,                   \n");
        	sqlstr.append("              A.OBC_MID_CASH_RATE,                   \n");
        	sqlstr.append("              A.OBC_MID_BILL_RATE,                   \n");
        	sqlstr.append("              A.OBC_FIN_CASH_RATE,                   \n");
        	sqlstr.append("              A.OBC_FIN_BILL_RATE,                   \n");
        	sqlstr.append("              A.OBC_FRST_CONDI,                   \n");
        	sqlstr.append("              A.OBC_MID_PAYDAY,                   \n");
        	sqlstr.append("              A.OBC_FIN_PAYDAY,                   \n");
        	sqlstr.append("              A.OBC_FRST_CNT_CONDI,                   \n");
        	sqlstr.append("              A.OBC_MID_REQ_MONTH,                   \n");
        	sqlstr.append("              A.OBC_MID_CNT,                   \n");
        	sqlstr.append("              A.OBC_FIN_CONDI,                   \n");
        	sqlstr.append("              A.OBC_EMP_RATE,                   \n");
        	sqlstr.append("              A.OBC_EMP_YN,                   \n");
        	sqlstr.append("              A.OBC_PENSION_RATE,                   \n");
        	sqlstr.append("              A.OBC_PENSION_YN,                   \n");
        	sqlstr.append("              A.OBC_HEALTH_RATE,                   \n");
        	sqlstr.append("              A.OBC_HEALTH_YN,                   \n");
        	sqlstr.append("              A.OBC_ELDER_RATE,                   \n");
        	sqlstr.append("              A.OBC_ELDER_YN,                   \n");
        	sqlstr.append("              A.OBC_WORK_RATE,                   \n");
        	sqlstr.append("              A.OBC_WORK_YN,                   \n");
        	sqlstr.append("              A.OBC_RESIGN_RATE,                   \n");
        	sqlstr.append("              A.OBC_RESIGN_YN,                   \n");
        	sqlstr.append("              A.OBC_SAFE_RATE,                   \n");
        	sqlstr.append("              A.OBC_SAFE_YN,                   \n");
        	sqlstr.append("              A.OBC_ENV_RATE,                   \n");
        	sqlstr.append("              A.OBC_ENV_YN,                   \n");
        	sqlstr.append("              A.OBC_SITE_RATE,                   \n");
        	sqlstr.append("              A.OBC_SITE_YN,                   \n");
        	sqlstr.append("              A.OBC_DUTY_RATE,                   \n");
        	sqlstr.append("              A.OBC_DUTY_YN,                   \n");
        	sqlstr.append("              A.OBC_WARR_YN,                   \n");
        	sqlstr.append("              A.PAY_DIV,                   \n");
        	sqlstr.append("              A.OBC_FRST_CONT_RATE,				\n");
        	sqlstr.append("              A.OBC_IND_YN,                   \n");
        	sqlstr.append("              B.SITE_ATTEND_YN,                   \n");
        	sqlstr.append("              DECODE(B.SITEPARTI_YN,'Y','참석','불참') AS SITEDESC_YN_NM,                   \n");
			sqlstr.append("       		  DECODE(B.SITEPARTI_YN,'Y','참석','불참') AS SITEDESC_YN,                                        \n");
			sqlstr.append("       CASE WHEN A.CMPT_CD = '01' AND BID_TO_DT > SYSDATE AND A.SITEDESC_FLAG = 'N' THEN '가능'		\n");
			sqlstr.append("               WHEN A.CMPT_CD <> '01' AND B.VENDOR_CD IS NULL THEN '불가능'		\n");
			sqlstr.append("               WHEN BID_FROM_DT > SYSDATE OR BID_TO_DT < SYSDATE THEN '불가능'		\n");
			sqlstr.append("               WHEN B.BID_RNNC_DT IS NOT NULL THEN '입찰포기'		\n");
			sqlstr.append("               WHEN A.SITEDESC_FLAG = 'Y' AND SITEPARTI_YN = 'Y' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"' AND BID_TO_DT > SYSDATE THEN '가능'		\n");
			sqlstr.append("               WHEN A.SITEDESC_FLAG = 'N' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"' AND BID_TO_DT > SYSDATE THEN '가능'			\n");
			sqlstr.append("               WHEN SITEPARTI_YN = 'Y' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"' AND BID_TO_DT < SYSDATE THEN '불가능'			\n");
			sqlstr.append("               WHEN SITEPARTI_YN = 'N' THEN '불가능'			\n");
			sqlstr.append("               ELSE '' END AS ESTI_YN,								\n");
            sqlstr.append("   		CASE WHEN B.BID_RNNC_DT IS NOT NULL THEN '입찰포기'||' ('||TO_CHAR(B.BID_RNNC_DT,'YYYY-MM-DD HH24:MI')||')'			\n");
            sqlstr.append("           WHEN BID_FROM_DT > SYSDATE OR BID_TO_DT < SYSDATE THEN '견적서 제출 기간이 아닙니다.'		\n");
			sqlstr.append("        	WHEN A.SITEDESC_FLAG = 'Y' AND SITEPARTI_YN = 'N' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"'  AND BID_TO_DT < SYSDATE THEN '현설불참, 견적제출마감시간 지남'			\n");
			sqlstr.append("           WHEN A.SITEDESC_FLAG = 'N' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"'  AND BID_TO_DT < SYSDATE THEN '견적제출마감시간 지남'		\n");
			sqlstr.append("      	   WHEN SITEPARTI_YN = 'Y' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"'  AND BID_TO_DT < SYSDATE THEN '견적제출마감시간 지남'						\n");
			sqlstr.append("      	   WHEN SITEPARTI_YN = 'N' AND B.VENDOR_CD = '"+params.get("VENDOR_CD")+"'  AND BID_TO_DT < SYSDATE THEN '견적제출마감시간 지남'						\n");
			sqlstr.append("           WHEN SITEDESC_FLAG='Y' AND SITEPARTI_YN = 'N' THEN '현설불참'																													\n");
			sqlstr.append("            ELSE '' END AS ESTI_N,																																											\n");
			sqlstr.append("       TO_CHAR(B.SIGN_DT,'YYYY-MM-DD HH24:MI:SS') AS SIGN_DT,																															\n");
			sqlstr.append("       DECODE(B.SIGN_DT,NULL, '', '(제출완료)') AS SIGN_YN,		 	\n"); //2016.12.8 제출완료 표기
			sqlstr.append("       B.BID_RNNC_ID,																																														\n");
			sqlstr.append("       B.BID_RNNC_NM,																																														\n");
			sqlstr.append("       B.BID_RNNC_DT,																																														\n");
	        sqlstr.append("       F_GET_CODE_NAME('CONT_TYPE',A.OBC_CONT_TYPE_CD) AS OBC_CONT_TYPE_NM,																								\n");
			sqlstr.append("       B.RNNC_REASON,																																														\n");	
			sqlstr.append("       TO_CHAR(C.SUPP_REQ_DY,'YYYY-MM-DD') AS SUPP_REQ_DY_NM,																														\n");
		    sqlstr.append("       C.EVAL_EMPNM,																																													\n");
		    sqlstr.append("       C.EVAL_EMPID,                                																																				        \n");
		    sqlstr.append("       C.EVAL_TEL,                                																																				        \n");
		    sqlstr.append("       A.REBID_REASON,                                																																				        \n");
		    sqlstr.append("       A.REBID_OUTREASON,                                																																				        \n");
		    sqlstr.append("       NVL(B.SECRET_YN,'N') AS SECRET_YN,                																																				        \n");		    
		    sqlstr.append("       NVL(B.MORAL_YN,'N') AS MORAL_YN,                																																				        \n");
		    sqlstr.append("       NVL(B.INDUSTRY_YN,'N') AS INDUSTRY_YN,                																																				        \n");
		    sqlstr.append("       NVL(B.ROLES_YN,'N') AS ROLES_YN,                																																				        \n");
		    sqlstr.append("       NVL(B.PRICESYS_YN,'N') AS PRICESYS_YN,                																																				        \n");
		    sqlstr.append("       B.SECRET_YN_DY,                      																																\n");		    		    
		    sqlstr.append("       B.MORAL_YN_DY,                      																																\n");
		    sqlstr.append("       B.INDUSTRY_YN_DY,                      																																\n");
		    sqlstr.append("       B.ROLES_YN_DY,                      																																\n");
		    sqlstr.append("       B.PRICESYS_YN_DY,                      																																\n");
		    sqlstr.append("       B.VENDOR_CD                                																																				        \n");
			sqlstr.append("        FROM BID_MASTER A  , BID_SUPP B ,TBE_INFO C                                   																									    \n");
			sqlstr.append("       WHERE A.BID_NO = '"+params.get("BID_NO")+"'																																			\n");
			sqlstr.append("       AND A.BID_DEG = '"+params.get("BID_DEG")+"'																																			\n");
			sqlstr.append("       AND A.BID_NO = B.BID_NO(+)																																										\n");
			sqlstr.append("       AND A.BID_DEG = B.BID_DEG(+)																																									\n");
		    sqlstr.append("       AND A.BID_NO = C.BID_NO(+)																																									\n");
			sqlstr.append("       AND A.BID_DEG = C.BID_DEG(+)																																								\n");
			sqlstr.append("       AND B.VENDOR_CD(+) = '"+params.get("VENDOR_CD")+"'																																	\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 geitemList(ValueObject param) {
		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StrBuffer sqlstr = new StrBuffer();
        try{
        	sqlstr.append("    SELECT A.BID_NO,																											\n");
        	sqlstr.append("           A.BID_DEG,        																									 	\n");
        	sqlstr.append("           A.MATERIAL_CD,      																								    \n");
        	sqlstr.append("           TO_CHAR(TO_DATE(A.REQUEST_DATE,'YYYYMMDD'),'YYYY-MM-DD') AS REQUEST_DATE,        \n");
        	sqlstr.append("           A.CONT_UNIT_AMT,        																							  \n");
        	sqlstr.append("           A.ACT_UNIT_AMT,     																								     \n");
        	sqlstr.append("           A.DEMANDED_PRI,      																								    \n");
        	sqlstr.append("           A.DEMANDED_QTY,       																								   \n");
        	sqlstr.append("           A.STD,        																												  \n");
        	sqlstr.append("           B.MATERIAL_NAME,      																								    \n");
        	sqlstr.append("           F_GET_UNIT_KIND_NAME(A.MATERIAL_CD) AS UNIT_KIND     											    \n");
        	sqlstr.append("      FROM BID_ITEM A , PMM_COMM_MATERIAL_MASTER B    															    \n");
        	sqlstr.append("      WHERE A.MATERIAL_CD = B.MATERIAL_CD    																			   \n");
        	sqlstr.append("        AND A.BID_NO = ?																														\n");
        	sqlstr.append("        AND A.BID_DEG = ?																														\n");	
        	sqlstr.append("        ORDER BY A.MATERIAL_CD																												\n");
			search.setStatement(sqlstr.toString());
			search.addParameter(param.get("BID_NO"));
			search.addParameter(param.get("BID_DEG"));
            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;
	}
	
    private boolean updateSecret(ValueObject params) 
    {
        StringBuffer sqlStr = new StringBuffer();

        Persistent persistent = null;
        
        conn.begin();
        try 
        {
        	Connection con = conn.getConnection();
            persistent = new PersistentImpl(con);
            
            sqlStr.append("          UPDATE BID_SUPP                       \n");
            sqlStr.append("             SET SECRET_YN = ?                  \n");
            sqlStr.append("               , SECRET_YN_DY = sysdate         \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("SECRET_YN"));
            persistent.addParameter(params.get("BID_NO"));       
            persistent.addParameter(params.get("BID_DEG"));
            persistent.addParameter(params.get("VENDOR_CD"));
                   
            persistent.execute();
            persistent.clearParameters();
        } catch(Exception e){
            WAFLogger.error(e);
            storage.setMessage(e.getMessage());
            storage.setSuccess(false);
            conn.setRollback();
            return false;
        } finally{
            conn.end();
        }               
        return true;
    }

    private boolean updateMoral(ValueObject params) 
    {
        StringBuffer sqlStr = new StringBuffer();

        Persistent persistent = null;
        
        conn.begin();
        try 
        {
        	Connection con = conn.getConnection();
            persistent = new PersistentImpl(con);
            
            sqlStr.append("          UPDATE BID_SUPP                       \n");
            sqlStr.append("             SET MORAL_YN = ?                  \n");
            sqlStr.append("               , MORAL_YN_DY = sysdate         \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("MORAL_YN"));
            persistent.addParameter(params.get("BID_NO"));       
            persistent.addParameter(params.get("BID_DEG"));
            persistent.addParameter(params.get("VENDOR_CD"));
                   
            persistent.execute();
            persistent.clearParameters();
        } catch(Exception e){
            WAFLogger.error(e);
            storage.setMessage(e.getMessage());
            storage.setSuccess(false);
            conn.setRollback();
            return false;
        } finally{
            conn.end();
        }               
        return true;
    }
    
    private boolean updateIndustry(ValueObject params) 
    {
        StringBuffer sqlStr = new StringBuffer();

        Persistent persistent = null;
        
        conn.begin();
        try 
        {
        	Connection con = conn.getConnection();
            persistent = new PersistentImpl(con);
            
            sqlStr.append("          UPDATE BID_SUPP                       \n");
            sqlStr.append("             SET INDUSTRY_YN = ?                  \n");
            sqlStr.append("               , INDUSTRY_YN_DY = sysdate         \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("INDUSTRY_YN"));
            persistent.addParameter(params.get("BID_NO"));       
            persistent.addParameter(params.get("BID_DEG"));
            persistent.addParameter(params.get("VENDOR_CD"));
                   
            persistent.execute();
            persistent.clearParameters();
        } catch(Exception e){
            WAFLogger.error(e);
            storage.setMessage(e.getMessage());
            storage.setSuccess(false);
            conn.setRollback();
            return false;
        } finally{
            conn.end();
        }               
        return true;
    }
    
    private boolean updateRoles(ValueObject params) 
    {
    	StringBuffer sqlStr = new StringBuffer();
    	
    	Persistent persistent = null;
    	
    	conn.begin();
    	try 
    	{
    		Connection con = conn.getConnection();
    		persistent = new PersistentImpl(con);
    		
    		sqlStr.append("          UPDATE BID_SUPP                       \n");
    		sqlStr.append("             SET ROLES_YN = ?                  \n");
    		sqlStr.append("               , ROLES_YN_DY = sysdate         \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("ROLES_YN"));
    		persistent.addParameter(params.get("BID_NO"));       
    		persistent.addParameter(params.get("BID_DEG"));
    		persistent.addParameter(params.get("VENDOR_CD"));
    		
    		persistent.execute();
    		persistent.clearParameters();
    	} catch(Exception e){
    		WAFLogger.error(e);
    		storage.setMessage(e.getMessage());
    		storage.setSuccess(false);
    		conn.setRollback();
    		return false;
    	} finally{
    		conn.end();
    	}               
    	return true;
    }

    private boolean updatePricesys(ValueObject params) 
    {
    	StringBuffer sqlStr = new StringBuffer();
    	
    	Persistent persistent = null;
    	
    	conn.begin();
    	try 
    	{
    		Connection con = conn.getConnection();
    		persistent = new PersistentImpl(con);
    		
    		sqlStr.append("          UPDATE BID_SUPP                       \n");
    		sqlStr.append("             SET PRICESYS_YN = ?                  \n");
    		sqlStr.append("               , PRICESYS_YN_DY = sysdate         \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("PRICESYS_YN"));
    		persistent.addParameter(params.get("BID_NO"));       
    		persistent.addParameter(params.get("BID_DEG"));
    		persistent.addParameter(params.get("VENDOR_CD"));
    		
    		persistent.execute();
    		persistent.clearParameters();
    	} catch(Exception e){
    		WAFLogger.error(e);
    		storage.setMessage(e.getMessage());
    		storage.setSuccess(false);
    		conn.setRollback();
    		return false;
    	} finally{
    		conn.end();
    	}               
    	return true;
    }
    
	private ValueObject getInfoObject(ValueObject params) {

		Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        ValueObject valueobject = null;
     //   String sqlstr = "";
        StrBuffer sqlstr = new StrBuffer();
        try{
		    sqlstr.append("       select dept_nm, vendor_name,demanded_title,REP_NAME,ADDRESS,																																		        \n");
		    sqlstr.append("       DECODE(B.SECRET_YN_DY,NULL,SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),7,2) || '일'                      \n");
		    sqlstr.append("            ,SUBSTR(TO_CHAR(B.SECRET_YN_DY,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(B.SECRET_YN_DY,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(B.SECRET_YN_DY,'YYYYMMDD'),7,2) || '일') AS SECRET_YN_DY,                      \n");
		    sqlstr.append("       DECODE(B.MORAL_YN_DY,NULL,SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),7,2) || '일'                      \n");
		    sqlstr.append("            ,SUBSTR(TO_CHAR(B.MORAL_YN_DY,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(B.MORAL_YN_DY,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(B.MORAL_YN_DY,'YYYYMMDD'),7,2) || '일') AS MORAL_YN_DY,                      \n");
		    sqlstr.append("       DECODE(B.INDUSTRY_YN_DY,NULL,SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),7,2) || '일'                      \n");
		    sqlstr.append("            ,SUBSTR(TO_CHAR(B.INDUSTRY_YN_DY,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(B.INDUSTRY_YN_DY,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(B.INDUSTRY_YN_DY,'YYYYMMDD'),7,2) || '일') AS INDUSTRY_YN_DY,                      \n");
		    sqlstr.append("       DECODE(B.ROLES_YN_DY,NULL,SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),7,2) || '일'                      \n");
		    sqlstr.append("            ,SUBSTR(TO_CHAR(B.ROLES_YN_DY,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(B.ROLES_YN_DY,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(B.ROLES_YN_DY,'YYYYMMDD'),7,2) || '일') AS ROLES_YN_DY,                      \n");
		    sqlstr.append("       DECODE(B.PRICESYS_YN_DY,NULL,SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(SYSDATE,'YYYYMMDD'),7,2) || '일'                      \n");
		    sqlstr.append("            ,SUBSTR(TO_CHAR(B.PRICESYS_YN_DY,'YYYYMMDD'),1,4) || '년 ' || SUBSTR(TO_CHAR(B.PRICESYS_YN_DY,'YYYYMMDD'),5,2) || '월 ' || SUBSTR(TO_CHAR(B.PRICESYS_YN_DY,'YYYYMMDD'),7,2) || '일') AS PRICESYS_YN_DY                      \n");
			sqlstr.append("        FROM BID_MASTER A, BID_SUPP B, SUPP_INFO C                               																									    \n");
			sqlstr.append("       WHERE A.BID_NO = '"+params.get("P_BID_NO")+"'																																			\n");
			sqlstr.append("       AND A.BID_DEG = '"+params.get("P_BID_DEG")+"'																																			\n");
			sqlstr.append("       AND A.BID_NO = B.BID_NO(+)																																										\n");
			sqlstr.append("       AND A.BID_DEG = B.BID_DEG(+)																																									\n");
			sqlstr.append("       AND B.VENDOR_CD(+) = '"+params.get("P_VENDOR_CD")+"'																																	\n");
			sqlstr.append("       AND B.VENDOR_CD = C.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;
        }
	}
}