window.repositoryObject = {"parameters_custom_fields":[],"object_id":"p383","name":"bat_cus_auto_buy_confirm","subtype":"PROCEDURE","is_user_defined":false,"description":null,"summary":[{"field":"Documentation","value":{"_type":"link","name":"style24@172.30.90.100","id":"d10"}},{"field":"Schema","value":""},{"field":"Name","value":"bat_cus_auto_buy_confirm"},{"field":"Type","value":"Procedure"}],"script":"BEGIN\r\n\t# 1. 구매확정 임시 테이블 데이터 삭제\r\n\tTRUNCATE TABLE TEMP_BUY_CONFIRM_DATA;\r\n    \r\n    # 2. 구매확정 데이터 확인\r\n\tINSERT INTO TEMP_BUY_CONFIRM_DATA\r\n\tSELECT OD.ORD_DTL_NO\r\n\tFROM   TB_ORDER_DETAIL OD\r\n\tWHERE  OD.ORD_DTL_STAT = 'G013_60'\r\n\t#AND    OD.REG_DT > '2021-08-15'\r\n\t#AND    OD.REG_DT > '2021-09-23'\r\n\tAND    DATEDIFF(NOW(), OD.DELV_EDDT) > (\r\n\t\t\t\t\t\t\t\t\t\t\tSELECT STR_SET_VAL2 -- 자동 구매확정처리일수(배송완료일 기준)\r\n\t\t\t\t\t\t\t\t\t\t\tFROM   TB_ENVSET\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE  SITE_CD = 'G000_10'\r\n\t\t\t\t\t\t\t\t\t\t\tAND    ENVSET_TYPE = 'D10'\r\n\t\t\t\t\t\t\t\t\t\t\tORDER BY ENVSET_SQ DESC\r\n\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\r\n\t\t\t\t\t\t\t\t\t\t   )\r\n\tAND    NOT EXISTS (\r\n\t\t\t\t\t   SELECT 1\r\n\t\t\t\t\t   FROM  TB_ORDER_CHANGE OC\r\n\t\t\t\t\t   INNER JOIN TB_ORDER_CHANGE_DETAIL OCD\r\n\t\t\t\t\t   ON    OC.ORD_CHG_SQ = OCD.ORD_CHG_SQ\r\n\t\t\t\t\t   WHERE OCD.ORD_DTL_NO = OD.ORD_DTL_NO\r\n\t\t\t\t\t   AND   OCD.CHG_STAT IN ('G685_20', 'G685_21', 'G685_30', 'G685_31', 'G685_32', 'G685_33', 'G685_34', 'G685_50', 'G685_51') -- 교환접수, 교환대기, 회수요청, 상품검수중, 결제대기, 반품진행중, 교환진행중, 반품접수, 반품대기\r\n\t\t\t\t\t   AND   OCD.DEL_YN = 'N'\r\n\t\t\t\t\t  );\r\n\t\r\n    IF ROW_COUNT()>0 THEN\r\n\t\tSELECT ROW_COUNT();\r\n\tEND IF;\r\n\t\r\nEND","parameters":[],"dependencies":null,"imported_at":"2021-11-11 16:37"};