/* 자재관리 자재기본정보 송신 */ SELECT MTRL_ID, MTRL_CL_CD, MTRL_BLON_CL_CD, DEPT1, DEPT2, KDN_DEPT1, KDN_DEPT2, MTRL_CO_ID, MTRL_STRG_PLCE_CD, MTRL_USER_ID, MTRL_STS_CD, LST_BX_NO, WRHSG_SHP_CL_CD, SHP_PURP_CTT, INST_L, INST_M, INST_S, POSS_CLCD , ATCH_FILE_ID1 , MOD_ID, MOD_DATE, REG_ID, REG_DATE FROM ( SELECT MTRL_ID, MTRL_CL_CD, MTRL_BLON_CL_CD, DEPT1, DEPT2, KDN_DEPT1, KDN_DEPT2, MTRL_CO_ID, MTRL_STRG_PLCE_CD, MTRL_USER_ID, MTRL_STS_CD, LST_BX_NO, WRHSG_SHP_CL_CD, SHP_PURP_CTT, INST_L, INST_M, INST_S, POSS_CLCD , ATCH_FILE_ID1 , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY MTRL_ID) AS R_NUM FROM TM_EQUIP_BASE WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재기본정보 송신 상태 변경 */ UPDATE TM_EQUIP_BASE SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND MTRL_ID IN ( SELECT MTRL_ID FROM ( SELECT MTRL_ID, MTRL_CL_CD, MTRL_BLON_CL_CD, DEPT1, DEPT2, KDN_DEPT1, KDN_DEPT2, MTRL_CO_ID, MTRL_STRG_PLCE_CD, MTRL_USER_ID, MTRL_STS_CD, LST_BX_NO, WRHSG_SHP_CL_CD, SHP_PURP_CTT, INST_L, INST_M, INST_S, POSS_CLCD , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ATCH_FILE_ID1 , ROW_NUMBER() OVER (ORDER BY MTRL_ID) AS R_NUM FROM TM_EQUIP_BASE WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재이력정보 송신 */ SELECT MTRL_HST_SEQNO, MTRL_ID, MTRL_CL_CD, DCU_ID, MODEM_MAC, METER_ID, WRHSG_SHP_CL_CD, HNDOVR_BLON_CL_CD, TRF_DEPT1, TRF_DEPT2, TRF_KDN_DEPT1, TRF_KDN_DEPT2, HNDOVR_CO_ID, HNDOVR_USER_ID, HNDOVR_STRG_PLCE, TKOVR_BLON_CL_CD, TFE_DEPT1, TFE_DEPT2, TFE_KDN_DEPT1, TFE_KDN_DEPT2, TKOVR_CO_ID, TKOVR_USER_ID, TKOVR_STRG_PLCE, MTRL_STS_CD, WRHSG_SHP_YMD, MTRL_BX_NO , MOD_ID, MOD_DATE, REG_ID, REG_DATE , SHP_PURP_CD, ATCH_FILE_ID1 FROM ( SELECT MTRL_HST_SEQNO, MTRL_ID, MTRL_CL_CD, DCU_ID, MODEM_MAC, METER_ID, WRHSG_SHP_CL_CD, HNDOVR_BLON_CL_CD, TRF_DEPT1, TRF_DEPT2, TRF_KDN_DEPT1, TRF_KDN_DEPT2, HNDOVR_CO_ID, HNDOVR_USER_ID, HNDOVR_STRG_PLCE, TKOVR_BLON_CL_CD, TFE_DEPT1, TFE_DEPT2, TFE_KDN_DEPT1, TFE_KDN_DEPT2, TKOVR_CO_ID, TKOVR_USER_ID, TKOVR_STRG_PLCE, MTRL_STS_CD, WRHSG_SHP_YMD, MTRL_BX_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , SHP_PURP_CD, ATCH_FILE_ID1 , ROW_NUMBER() OVER (ORDER BY TO_NUMBER(MTRL_HST_SEQNO)) AS R_NUM FROM TM_EQUIP_MOVE WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재이력정보 송신 상태 변경 */ UPDATE TM_EQUIP_MOVE SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND MTRL_HST_SEQNO IN ( SELECT MTRL_HST_SEQNO FROM ( SELECT MTRL_HST_SEQNO, MTRL_ID, MTRL_CL_CD, DCU_ID, MODEM_MAC, METER_ID, WRHSG_SHP_CL_CD, HNDOVR_BLON_CL_CD, TRF_DEPT1, TRF_DEPT2, TRF_KDN_DEPT1, TRF_KDN_DEPT2, HNDOVR_CO_ID, HNDOVR_USER_ID, HNDOVR_STRG_PLCE, TKOVR_BLON_CL_CD, TFE_DEPT1, TFE_DEPT2, TFE_KDN_DEPT1, TFE_KDN_DEPT2, TKOVR_CO_ID, TKOVR_USER_ID, TKOVR_STRG_PLCE, MTRL_STS_CD, WRHSG_SHP_YMD, MTRL_BX_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , SHP_PURP_CD, ATCH_FILE_ID1 , ROW_NUMBER() OVER (ORDER BY TO_NUMBER(MTRL_HST_SEQNO)) AS R_NUM FROM TM_EQUIP_MOVE WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재마스터 수신 */ MERGE INTO TM_EQUIP_MTRL USING DUAL ON (MTRL_ID = #{MTRL_ID}) WHEN NOT MATCHED THEN INSERT ( MTRL_ID, MTRL_CL_CD, MTRL_UDI, MTRL_IDNT_NO, MTRL_SERNO, FCL_NO, MNFCT_YM, DLVG_PCKN_NO, NOW_PCKN_NO, MTRL_DLVG_NO, MTRL_NO, MTRL_OPE_STS_CL_CD, MTRL_STS_CL_CD, MTRL_STRG_PLCE_NO, MST_CL_CD, MTRL_EXPL, USE_YN, INST_L, INST_M, INST_S, POSS_CLCD , FCTY_ID, MTRL_KND_CL_CD , MOD_ID, MOD_DATE, REG_ID, REG_DATE ) VALUES ( #{MTRL_ID}, #{MTRL_CL_CD}, #{MTRL_UDI}, #{MTRL_IDNT_NO}, #{MTRL_SERNO}, #{FCL_NO}, #{MNFCT_YM}, #{DLVG_PCKN_NO}, #{NOW_PCKN_NO}, #{MTRL_DLVG_NO}, #{MTRL_NO}, #{MTRL_OPE_STS_CL_CD}, #{MTRL_STS_CL_CD}, #{MTRL_STRG_PLCE_NO}, #{MST_CL_CD}, #{MTRL_EXPL}, #{USE_YN}, #{INST_L}, #{INST_M}, #{INST_S}, #{POSS_CLCD} , (CASE WHEN LENGTH(#{FCL_NO}) = 11 AND SUBSTR(#{FCL_NO}, 1, 3) = '012' THEN REPLACE(REPLACE(#{FCL_NO},'-',''),':','') ELSE REPLACE(REPLACE(#{MTRL_IDNT_NO},'-',''),':','') END), #{MTRL_CL_CD} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') ) WHEN MATCHED THEN UPDATE SET MTRL_CL_CD = #{MTRL_CL_CD} , MTRL_UDI = #{MTRL_UDI} , MTRL_IDNT_NO = #{MTRL_IDNT_NO} , MTRL_SERNO = #{MTRL_SERNO} , FCL_NO = #{FCL_NO} , MNFCT_YM = #{MNFCT_YM} , DLVG_PCKN_NO = #{DLVG_PCKN_NO} , NOW_PCKN_NO = #{NOW_PCKN_NO} , MTRL_DLVG_NO = #{MTRL_DLVG_NO} , MTRL_NO = #{MTRL_NO} , MTRL_OPE_STS_CL_CD = #{MTRL_OPE_STS_CL_CD} , MTRL_STS_CL_CD = #{MTRL_STS_CL_CD} , MTRL_STRG_PLCE_NO = #{MTRL_STRG_PLCE_NO} , MST_CL_CD = #{MST_CL_CD} , MTRL_EXPL = #{MTRL_EXPL} , USE_YN = #{USE_YN} , INST_L = #{INST_L} , INST_M = #{INST_M} , INST_S = #{INST_S} , POSS_CLCD = #{POSS_CLCD} , FCTY_ID = (CASE WHEN LENGTH(#{FCL_NO}) = 11 AND SUBSTR(#{FCL_NO}, 1, 3) = '012' THEN REPLACE(REPLACE(#{FCL_NO},'-',''),':','') ELSE REPLACE(REPLACE(#{MTRL_IDNT_NO},'-',''),':','') END) , MTRL_KND_CL_CD = #{MTRL_CL_CD} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS'))
/* 자재관리 자재보관장소 수신 */ MERGE INTO TM_MNG_PLCE USING DUAL ON (MTRL_STRG_PLCE_NO = #{MTRL_STRG_PLCE_NO}) WHEN NOT MATCHED THEN INSERT ( MTRL_STRG_PLCE_NO, MTRL_STRG_PLCE_KND_CL_CD, AMMS_MTRL_STRG_PLCE_REG_CL_CD, MTRL_STRG_PLCE_NM, MTRL_STRG_PLCE_POST_NO, MTRL_STRG_PLCE_ADDR, MTRL_STRG_PLCE_DTLS_ADDR, USE_YN , MOD_ID, MOD_DATE, REG_ID, REG_DATE ) VALUES ( #{MTRL_STRG_PLCE_NO}, #{MTRL_STRG_PLCE_KND_CL_CD}, #{AMMS_MTRL_STRG_PLCE_REG_CL_CD}, #{MTRL_STRG_PLCE_NM}, #{MTRL_STRG_PLCE_POST_NO}, #{MTRL_STRG_PLCE_ADDR}, #{MTRL_STRG_PLCE_DTLS_ADDR}, #{USE_YN} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') ) WHEN MATCHED THEN UPDATE SET MTRL_STRG_PLCE_KND_CL_CD = #{MTRL_STRG_PLCE_KND_CL_CD} , AMMS_MTRL_STRG_PLCE_REG_CL_CD = #{AMMS_MTRL_STRG_PLCE_REG_CL_CD} , MTRL_STRG_PLCE_NM = #{MTRL_STRG_PLCE_NM} , MTRL_STRG_PLCE_POST_NO = #{MTRL_STRG_PLCE_POST_NO} , MTRL_STRG_PLCE_ADDR = #{MTRL_STRG_PLCE_ADDR} , MTRL_STRG_PLCE_DTLS_ADDR = #{MTRL_STRG_PLCE_DTLS_ADDR} , USE_YN = #{USE_YN} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS'))
/* 자재관리 패킹 수신 */ MERGE INTO TM_PCKN USING DUAL ON (BONBU_CD = #{BONBU_CD} AND PCKN_NO = #{PCKN_NO}) WHEN NOT MATCHED THEN INSERT ( BONBU_CD, PCKN_NO, QR_CD_CTT, UPPO_PCKN_NO, PCKN_TP_CL_CD, PCKN_LVL, PCKN_EXPL, USE_YN , MOD_ID, MOD_DATE, REG_ID, REG_DATE ) VALUES ( #{BONBU_CD}, #{PCKN_NO}, #{QR_CD_CTT}, #{UPPO_PCKN_NO}, #{PCKN_TP_CL_CD}, #{PCKN_LVL}, #{PCKN_EXPL}, #{USE_YN} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') ) WHEN MATCHED THEN UPDATE SET QR_CD_CTT = #{QR_CD_CTT} , UPPO_PCKN_NO = #{UPPO_PCKN_NO} , PCKN_TP_CL_CD = #{PCKN_TP_CL_CD} , PCKN_LVL = #{PCKN_LVL} , PCKN_EXPL = #{PCKN_EXPL} , USE_YN = #{USE_YN} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS'))
/* 자재관리 자재납품마스터_DCU 송신 */ SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, WAN_MAC_ADDR, AMI_FRMW_VER_NM, MST_PLC_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, MOD_DATE, REG_ID, REG_DATE FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, WAN_MAC_ADDR, AMI_FRMW_VER_NM, MST_PLC_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_DCU WHERE 1 = 1 AND NVL(MKAMI_SEND_YN, 'N') = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재납품마스터_DCU 송신 상태 변경 */ UPDATE TM_DLVG_DCU SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND (EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) IN ( SELECT EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, WAN_MAC_ADDR, AMI_FRMW_VER_NM, MST_PLC_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_DCU WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재납품마스터_모뎀 송신 */ SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, MODM_MAC_ADDR, MCU_FRMW_VER_NM, PLC_CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, MOD_DATE, REG_ID, REG_DATE FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, MODM_MAC_ADDR, MCU_FRMW_VER_NM, PLC_CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_MODM WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재납품마스터_모뎀 송신 상태 변경 */ UPDATE TM_DLVG_MODM SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND (EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) IN ( SELECT EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, MTRL_NO, CNTR_CO_BIZR_REG_NO, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, LDIN_NW_MODM_TP_CL_CD, MNFCO_CL_CD, MODM_UNITC, MODM_MAC_ADDR, MCU_FRMW_VER_NM, PLC_CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_MODM WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재납품마스터_계기 송신 */ SELECT EXL_UPD_GRP_NO, MTRL_ID, AMMS_DLVG_HDQR_CL_CD, ANNC_NO, MNFCO_CL_CD, BX_NO, MTRL_NO, MNFCT_YM, LSEFT_YM, PLLT_NO , MOD_ID, MOD_DATE, REG_ID, REG_DATE FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, AMMS_DLVG_HDQR_CL_CD, ANNC_NO, MNFCO_CL_CD, BX_NO, MTRL_NO, MNFCT_YM, LSEFT_YM, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_METR WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재납품마스터_계기 송신 상태 변경 */ UPDATE TM_DLVG_METR SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND (EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) IN ( SELECT EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, AMMS_DLVG_HDQR_CL_CD, ANNC_NO, MNFCO_CL_CD, BX_NO, MTRL_NO, MNFCT_YM, LSEFT_YM, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_METR WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재납품마스터_LTE모뎀 송신 */ SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, LHV_CL_CD, AMMS_CMN_NW_TP_CL_CD, MTRL_NO, CNTR_CO_BIZR_REG_NO, CMCO_CD, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, MNFCO_CL_CD, CRC_NO, MODM_UNITC, CRC_CHRG, MODM_MAC_ADDR, SMGWC_ID, FRMW_VER_NM, CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, TEQP_IDNT_NO, USIM_NO, IPV6_ADDR, SRL_NO, PLLT_NO , MOD_ID, MOD_DATE, REG_ID, REG_DATE FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, LHV_CL_CD, AMMS_CMN_NW_TP_CL_CD, MTRL_NO, CNTR_CO_BIZR_REG_NO, CMCO_CD, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, MNFCO_CL_CD, CRC_NO, MODM_UNITC, CRC_CHRG, MODM_MAC_ADDR, SMGWC_ID, FRMW_VER_NM, CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, TEQP_IDNT_NO, USIM_NO, IPV6_ADDR, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_LTE_MODM WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000
/* 자재관리 자재납품마스터_LTE모뎀 송신 상태 변경 */ UPDATE TM_DLVG_LTE_MODM SET MKAMI_SEND_YN = 'Y' , MKAMI_SEND_DATE = SYSTIMESTAMP WHERE 1 = 1 AND (EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) IN ( SELECT EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID FROM ( SELECT EXL_UPD_GRP_NO, MTRL_ID, BX_NO, CNTR_NO, ORD_NO, LHV_CL_CD, AMMS_CMN_NW_TP_CL_CD, MTRL_NO, CNTR_CO_BIZR_REG_NO, CMCO_CD, AMMS_DLVG_HDQR_CL_CD, ORD_YMD, MDL_NM, MNFCO_CL_CD, CRC_NO, MODM_UNITC, CRC_CHRG, MODM_MAC_ADDR, SMGWC_ID, FRMW_VER_NM, CMN_MODL_VER_NM, MNFCT_YM, DLVG_YMD, SYS_TITL_NM, TEQP_IDNT_NO, USIM_NO, IPV6_ADDR, SRL_NO, PLLT_NO , MOD_ID, TO_CHAR(MOD_DATE, 'YYYYMMDDHH24MISS') AS MOD_DATE, REG_ID, TO_CHAR(REG_DATE, 'YYYYMMDDHH24MISS') AS REG_DATE , ROW_NUMBER() OVER (ORDER BY EXL_UPD_GRP_NO, AMMS_DLVG_HDQR_CL_CD, MTRL_ID) AS R_NUM FROM TM_DLVG_LTE_MODM WHERE 1 = 1 AND MKAMI_SEND_YN = 'N' ) WHERE 1 = 1 AND R_NUM BETWEEN 1 AND 1000 )
/* 자재관리 자재유형 수신 */ UPDATE TM_EQUIP_MTRL SET MTRL_KND_CL_CD = #{AMMS_MTRL_KND_CL_CD} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS')) WHERE 1 = 1 AND MTRL_NO = #{MTRL_NO} ; MERGE INTO TM_MTRL_TP USING DUAL ON (MTRL_NO = #{MTRL_NO}) WHEN NOT MATCHED THEN INSERT ( MTRL_NO, AMMS_MTRL_KND_CL_CD, AMMS_VOLT_CL_CD, AMMS_METR_PH_KND_CL_CD, AMMS_CMN_MHD_CL_CD, AMMS_FCL_TP_CL_CD, AMMS_INS_INFO_CL_CD, AMMS_CMN_NW_TP_CL_CD, TDU_INCLD_YN, MTRL_TP_EXPL, AMMS_MTRL_FORM_CL_CD, APWR_NDL_DIGT_CNT, MAX_DM_NDL_DIGT_CNT, RPWR_NDL_DIGT_CNT , MOD_ID, MOD_DATE, REG_ID, REG_DATE ) VALUES ( #{MTRL_NO}, #{AMMS_MTRL_KND_CL_CD}, #{AMMS_VOLT_CL_CD}, #{AMMS_METR_PH_KND_CL_CD}, #{AMMS_CMN_MHD_CL_CD}, #{AMMS_FCL_TP_CL_CD}, #{AMMS_INS_INFO_CL_CD}, #{AMMS_CMN_NW_TP_CL_CD}, #{TDU_INCLD_YN}, #{MTRL_TP_EXPL}, #{AMMS_MTRL_FORM_CL_CD}, #{APWR_NDL_DIGT_CNT}, #{MAX_DM_NDL_DIGT_CNT}, #{RPWR_NDL_DIGT_CNT} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') ) WHEN MATCHED THEN UPDATE SET AMMS_MTRL_KND_CL_CD = #{AMMS_MTRL_KND_CL_CD} , AMMS_VOLT_CL_CD = #{AMMS_VOLT_CL_CD} , AMMS_METR_PH_KND_CL_CD = #{AMMS_METR_PH_KND_CL_CD} , AMMS_CMN_MHD_CL_CD = #{AMMS_CMN_MHD_CL_CD} , AMMS_FCL_TP_CL_CD = #{AMMS_FCL_TP_CL_CD} , AMMS_INS_INFO_CL_CD = #{AMMS_INS_INFO_CL_CD} , AMMS_CMN_NW_TP_CL_CD = #{AMMS_CMN_NW_TP_CL_CD} , TDU_INCLD_YN = #{TDU_INCLD_YN} , MTRL_TP_EXPL = #{MTRL_TP_EXPL} , AMMS_MTRL_FORM_CL_CD = #{AMMS_MTRL_FORM_CL_CD} , APWR_NDL_DIGT_CNT = #{APWR_NDL_DIGT_CNT} , MAX_DM_NDL_DIGT_CNT = #{MAX_DM_NDL_DIGT_CNT} , RPWR_NDL_DIGT_CNT = #{RPWR_NDL_DIGT_CNT} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS')) ;
/* 자재관리 AMMS등록업체 - 하도급사 수신 */ MERGE INTO TM_SBCN_CO USING DUAL ON (COCMP_BUPE_ID = #{COCMP_BUPE_ID}) WHEN NOT MATCHED THEN INSERT ( COCMP_BUPE_ID, TRNA, BIZNO, CORP_REGST_NO, RPSNT_NM, TYPBU_NM, TOIN_NM, ZIPCD, SIDO_ADDR, BUPE_ADDR, USE_YN , MOD_ID, MOD_DATE, REG_ID, REG_DATE , DEPT1, DEPT2, KDN_DEPT1, KDN_DEPT2 ) VALUES ( #{COCMP_BUPE_ID}, #{TRNA}, #{BIZNO}, #{CORP_REGST_NO}, #{RPSNT_NM}, #{TYPBU_NM}, #{TOIN_NM}, #{ZIPCD}, #{SIDO_ADDR}, #{BUPE_ADDR}, #{USE_YN} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') , #{DEPT1}, #{DEPT2}, #{KDN_DEPT1}, #{KDN_DEPT2} ) WHEN MATCHED THEN UPDATE SET TRNA = #{TRNA} , BIZNO = #{BIZNO} , CORP_REGST_NO = #{CORP_REGST_NO} , RPSNT_NM = #{RPSNT_NM} , ZIPCD = #{ZIPCD} , SIDO_ADDR = #{SIDO_ADDR} , BUPE_ADDR = #{BUPE_ADDR} , USE_YN = #{USE_YN} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS')) , DEPT1 = #{DEPT1} , DEPT2 = #{DEPT2} , KDN_DEPT1 = #{KDN_DEPT1} , KDN_DEPT2 = #{KDN_DEPT2}
/* 자재관리 AMMS등록업체 - 내선업체 수신 */ MERGE INTO TM_INLN_CO USING DUAL ON (COCMP_BUPE_ID = #{COCMP_BUPE_ID}) WHEN NOT MATCHED THEN INSERT ( COCMP_BUPE_ID, TRNA, BIZNO, CORP_REGST_NO, RPSNT_NM, TYPBU_NM, TOIN_NM, ZIPCD, SIDO_ADDR, BUPE_ADDR, USE_YN , MOD_ID, MOD_DATE, REG_ID, REG_DATE , DEPT1, DEPT2, KDN_DEPT1, KDN_DEPT2 ) VALUES ( #{REG_CO_NO}, #{BIZR_NM}, #{BIZR_NO}, #{BIZR_SERNO}, #{REPR_NM}, NULL, NULL, #{POST_NO}, #{CO_ADDR}, #{CO_DTLS_ADDR}, #{USE_YN} , NVL(#{MOD_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{MOD_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS'), NVL(#{REG_ID}, 'DFXAGENT_USER'), TO_TIMESTAMP(NVL(#{REG_DATE}, TO_CHAR(SYSTIMESTAMP, 'YYYYMMDDHH24MISS')), 'YYYYMMDDHH24MISS') , #{DEPT1}, #{DEPT2}, #{KDN_DEPT1}, #{KDN_DEPT2} ) WHEN MATCHED THEN UPDATE SET TRNA = #{TRNA} , BIZNO = #{BIZNO} , CORP_REGST_NO = #{CORP_REGST_NO} , RPSNT_NM = #{RPSNT_NM} , ZIPCD = #{ZIPCD} , SIDO_ADDR = #{SIDO_ADDR} , BUPE_ADDR = #{BUPE_ADDR} , USE_YN = #{USE_YN} , MOD_ID = NVL(#{MOD_ID}, 'DFXAGENT_USER') , MOD_DATE = DECODE(#{MOD_DATE}, NULL, SYSTIMESTAMP, TO_TIMESTAMP(#{MOD_DATE}, 'YYYYMMDDHH24MISS')) , DEPT1 = #{DEPT1} , DEPT2 = #{DEPT2} , KDN_DEPT1 = #{KDN_DEPT1} , KDN_DEPT2 = #{KDN_DEPT2}