123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.oqpo.api.mapper.inoutmng.ColOdrMapper">
- <select id="selectColRtnIngCnt" resultType="int">
- select count(*) /* ColOdr.selectColRtnIngCnt */
- from col_odr_base_info base
- ,col_odr_dtl_ptcl ptcl
- where base.col_cmd_unq_no = ptcl.col_cmd_unq_no
- and base.brand_id = #{brandId}
- and base.col_cmd_st_cd in ('COL1','COL2')
- and ptcl.rtn_podr_unq_no = #{rtnPodrUnqNo}
- </select>
- <select id="selectColTargetRtnGridList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
- , base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
- , ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
- , ptcl.item_id as 'rtnOdrDtlInfo.item_id', ptcl.item_nm as 'rtnOdrDtlInfo.item_nm'
- , base.rtn_whs_id, base.rtn_location, fn_whs_nm(base.brand_id, base.rtn_whs_id) as rtn_whs_nm
- , fn_whs_location_nm(base.brand_id, base.rtn_whs_id, base.rtn_location) as rtn_location_nm
- , ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt'
- , ptcl.rtn_req_qty as 'rtnOdrDtlInfo.rtn_req_qty', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
- , date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt, ptcl.rtn_amt as 'rtnOdrDtlInfo.rtn_amt'
- , base.whs_id, fn_whs_nm(base.brand_id, base.whs_id) as whs_nm
- , base.location, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , base.store_id
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C001'
- <if test="sWhsId != null and sWhsId != ''">
- and base.whs_id = #{sWhsId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by base.rtn_podr_unq_no desc , ptcl.rtn_podr_dtl_no asc
- </if>
- </if>
- </when>
- <otherwise>
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColTargetRtnGridCnt" resultType="int">
- select count(*) as cnt
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C001'
- <if test="sWhsId != null and sWhsId != ''">
- and base.whs_id = #{sWhsId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
- </if>
- </select>
- <select id="selectColInstRtnGridList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
- , base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
- , ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
- , ptcl.item_id as 'rtnOdrDtlInfo.item_id', ptcl.item_nm as 'rtnOdrDtlInfo.item_nm'
- , base.rtn_whs_id, base.rtn_location, fn_whs_nm(base.brand_id, base.rtn_whs_id) as rtn_whs_nm
- , fn_whs_location_nm(base.brand_id, base.rtn_whs_id, base.rtn_location) as rtn_location_nm
- , ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt'
- , ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.col_qty', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
- , date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt, ptcl.rtn_amt as 'rtnOdrDtlInfo.rtn_amt'
- , base.whs_id, fn_whs_nm(base.brand_id, base.whs_id) as whs_nm
- , base.location, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , base.store_id
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{brandId}
- and concat(base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no) in
- <foreach collection="gridUpdateData" item="item" separator="," open="(" close=")">
- concat(#{item.rtnPodrUnqNo},#{item.rtnPodrDtlNo})
- </foreach>
- </select>
- <select id="selectPickJobDataList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.brand_id,base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
- ,ptcl.item_id as 'rtnOdrDtlInfo.item_id' , ptcl.item_nm as 'rtnOdrDtlInfo.item_nm', base.whs_id
- ,base.location, ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
- ,ptcl.rtn_odr_amt as 'rtnOdrDtlInfo.rtn_odr_amt', date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt
- , base.rtn_whs_id, base.rtn_location, ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no' , ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
- , base.store_id , base.rtn_mgr_nm , base.rtn_mgr_tel_no, base.rtn_mgr_id
- , nvl(fn_get_telno((select mgr_tel_no from whs_mgnt_base_info where brand_id = base.brand_id and whs_id = base.rtn_whs_id)),' ') as pick_tel_no
- , date_format(base.rtn_odr_reg_dt,'%Y%m%d') as rtn_odr_req_dt
- , base.spply_id, fn_spply_nm(base.spply_id) as spply_nm
- , ptcl.rtn_rsn_dvsn as 'rtnOdrDtlInfo.rtn_rsn_dvsn', ptcl.rtn_rsn as 'rtnOdrDtlInfo.rtn_rsn'
- , base.col_dvsn, ptcl.unit as 'rtnOdrDtlInfo.unit'
- from rtn_odr_base_info base
- join rtn_odr_dtl_ptcl ptcl on base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no and ptcl.rodr_dtl_st_cd = 'ROD1'
- join item_base_info itm on ptcl.item_id = itm.item_id
- and base.brand_id = #{brandId}
- and concat(base.rtn_podr_unq_no,ptcl.rtn_podr_dtl_no) in
- <foreach collection="gridInsertData" item="item" separator="," open="(" close=")">
- concat(#{item.rtnPodrUnqNo},#{item.rtnPodrDtlNo})
- </foreach>
- order by base.brand_id, base.whs_id, base.location, base.rtn_whs_id,base.rtn_location
- </select>
- <insert id="insertColOdrBase">
- insert into col_odr_base_info /* ColOdr.insertColOdrBase*/
- (col_cmd_unq_no, col_reg_dt, brand_id, whs_id, location
- , store_id, item_qty, col_total_amt, col_req_dt, col_dvsn
- , col_cmd_st_cd, col_req_mgr_nm, col_req_mgr_id, col_dt, col_cnfm_nm
- , col_cnfm_id, col_mgr_nm, col_mgr_tel_no, col_mgr_emal, col_mgr_mbl_no
- , rtn_whs_id, rtn_location, spply_id, spply_nm, col_pick_unq_no
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- (#{entity.colCmdUnqNo}, date_format(now(),'%Y%m%d'), #{entity.brandId}, #{entity.whsId}, #{entity.location}
- , #{entity.storeId}, #{entity.itemQty}, #{entity.colTotalAmt}, #{entity.colReqDt}, #{entity.colDvsn}
- , #{entity.colCmdStCd}, #{entity.colReqMgrNm}, #{entity.colReqMgrId}, #{entity.colDt}, #{entity.colCnfmNm}
- , #{entity.colCnfmId}, #{entity.colMgrNm}, #{entity.colMgrTelNo}, #{entity.colMgrEmal}, #{entity.colMgrMblNo}
- , #{entity.rtnWhsId}, #{entity.rtnLocation}, #{entity.spplyId}, #{entity.spplyNm}, #{entity.colPickUnqNo}
- , now(), #{userId}, now(), #{userId})
- </insert>
- <insert id="insertColOdrDtl">
- insert into col_odr_dtl_ptcl /* ColOdr.insertColOdrDtl*/
- (col_cmd_unq_no, col_cmd_dtl_no, item_id, item_nm, unit_amt
- , col_qty, col_amt, rtn_qty, rtn_amt, rtn_rsn_dvsn
- , rtn_rsn, rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_dtl_no, rtn_req_unq_no, col_cmd_dtl_st_cd
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- <foreach collection="gridInsertData" item="item" separator=",">
- (#{item.colCmdUnqNo}, #{item.colCmdDtlNo}, #{item.itemId}, #{item.itemNm}, #{item.unitAmt}
- , #{item.colQty}, #{item.colAmt}, #{item.rtnQty}, #{item.rtnAmt}, #{item.rtnRsnDvsn}
- , #{item.rtnRsn}, #{item.rtnPodrUnqNo}, #{item.rtnPodrDtlNo}, #{item.rtnReqDtlNo}, #{item.rtnReqUnqNo}, 'CDLD1'
- , now(), #{userId}, now(), #{userId})
- </foreach>
- </insert>
- <insert id="insertPickMgntBase">
- insert into pick_info_mgnt /* ColOdr.insertPickMgntBase */
- (col_pick_unq_no, spply_id, spply_nm, store_id, col_reg_dt
- , col_tot_amt, pick_mgr_nm, pick_mgr_tel_no, pick_mgr_emal, pick_mgr_mbl_no
- , pndr_tel_no, pick_st_cd, rodr_reg_dt, col_req_dt, col_sch_dt
- , col_cmplt_dt, whs_id, location, whs_dvsn, brand_id, col_desc, col_dvsn
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- (#{entity.colPickUnqNo}, #{entity.spplyId}, #{entity.spplyNm}, #{entity.storeId}, date_format(now(),'%Y%m%d')
- , #{entity.colTotAmt}, #{entity.pickMgrNm}, #{entity.pickMgrTelNo}, #{entity.pickMgrEmal}, #{entity.pickMgrMblNo}
- , #{entity.pndrTelNo}, #{entity.pickStCd}, date_format(now(),'%Y%m%d'), #{entity.colReqDt}, #{entity.colSchDt}
- , #{entity.colCmpltDt}, #{entity.whsId}, #{entity.location}, #{entity.whsDvsn}, #{entity.brandId}, #{entity.colDesc}, #{entity.colDvsn}
- , now(), #{userId}, now(), #{userId})
- </insert>
- <insert id="insertPickDtlPtcl">
- insert into pick_dtl_ptcl /* ColOdr.insertPickDtlPtcl */
- (col_pick_unq_no, col_pick_dtl_no, rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_unq_no
- , rtn_req_dtl_no, col_cmd_unq_no, col_cmd_dtl_no, pick_dtl_st_cd, item_id
- , item_nm, unit, unit_amt, price_unit, rodr_qty
- , col_req_qty, col_req_amt, delay_yn, delay_rsn
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- <foreach collection="gridInsertData" item="item" separator=",">
- (#{item.colPickUnqNo}, #{item.colPickDtlNo}, #{item.rtnPodrUnqNo}, #{item.rtnPodrDtlNo}, #{item.rtnReqUnqNo}
- , #{item.rtnReqDtlNo}, #{item.colCmdUnqNo}, #{item.colCmdDtlNo}, 'PICKD0', #{item.itemId}
- , #{item.itemNm}, #{item.unit}, #{item.unitAmt}, #{item.priceUnit}, #{item.rodrQty}
- , #{item.colReqQty}, #{item.colReqAmt}, #{item.delayYn}, #{item.delayRsn}
- , now(), #{userId}, now(), #{userId})
- </foreach>
- </insert>
- <select id="selectColGridList" resultType="com.oqpo.api.entity.inoutmng.ColOdrBaseEntity">
- select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm, base.col_cmd_unq_no, ptcl.col_cmd_dtl_no as 'colDtlInfo.col_cmd_dtl_no'
- , ptcl.rtn_podr_unq_no as 'colDtlInfo.rtn_podr_unq_no', ptcl.rtn_podr_dtl_no as 'colDtlInfo.rtn_podr_dtl_no'
- , ptcl.col_cmd_dtl_st_cd as 'colDtlInfo.col_cmd_dtl_st_cd', fn_code_nm('COL_CMD_DTL_ST_CD', ptcl.col_cmd_dtl_st_cd) as 'colDtlInfo.col_cmd_dtl_st_nm'
- , ptcl.item_id as 'colDtlInfo.item_id' , ptcl.item_nm as 'colDtlInfo.item_nm', base.rtn_whs_id, base.rtn_location
- , concat(fn_whs_nm( base.brand_id, base.rtn_whs_id) , ' - ', fn_whs_location_nm(base.brand_id, base.rtn_whs_id,base.rtn_location) ) as rtn_whs_nm
- , base.col_dvsn, fn_code_nm('COL_DVSN',base.col_dvsn) as col_dvsn_nm
- , (case when base.whs_id is null or base.whs_id = '' then base.spply_id else base.whs_id end ) as whs_id
- , (case when base.whs_id is null or base.whs_id = '' then base.spply_nm else (concat(fn_whs_nm( base.brand_id, base.whs_id) , ' - ', fn_whs_location_nm(base.brand_id, base.whs_id,base.location) )) end ) as whs_nm
- , ptcl.rtn_qty as 'colDtlInfo.rtn_qty', ptcl.col_qty as 'colDtlInfo.col_qty', case when ptcl.col_cmd_dtl_st_cd = 'CDLD2' then ptcl.col_amt else 0 end as 'colDtlInfo.col_amt'
- , date_format(base.col_dt , '%Y.%m.%d') as col_dt , base.col_cnfm_nm, base.col_pick_unq_no
- from col_odr_base_info base,
- col_odr_dtl_ptcl ptcl
- where 1=1
- and base.col_cmd_unq_no = ptcl.col_cmd_unq_no
- and base.brand_id = #{sBrandId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- <if test="sColDvsn != null and sColDvsn != ''">
- and base.col_dvsn = #{sColDvsn}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and base.whs_id = #{sWhsId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sColCmdDtlStCd != null and sColCmdDtlStCd != ''">
- and ptcl.col_cmd_dtl_st_cd = #{sColCmdDtlStCd}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and ( ptcl.item_id like concat('%',#{sItemNm},'%') or ptcl_item_nm like concat('%',#{sItemNm},'%') )
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by base.col_cmd_unq_no asc , ptcl.col_cmd_dtl_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by base.col_cmd_unq_no desc , ptcl.col_cmd_dtl_no asc
- </if>
- </if>
- </when>
- <otherwise>
- order by base.col_cmd_unq_no desc , ptcl.col_cmd_dtl_no asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColGridCnt" resultType="int">
- select count(*) as cnt
- from col_odr_base_info base,
- col_odr_dtl_ptcl ptcl
- where 1=1
- and base.col_cmd_unq_no = ptcl.col_cmd_unq_no
- and base.brand_id = #{sBrandId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- <if test="sColDvsn != null and sColDvsn != ''">
- and base.col_dvsn = #{sColDvsn}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and base.whs_id = #{sWhsId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sColCmdDtlStCd != null and sColCmdDtlStCd != ''">
- and ptcl.col_cmd_dtl_st_cd = #{sColCmdDtlStCd}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and ( ptcl.item_id like concat('%',#{sItemNm},'%') or ptcl_item_nm like concat('%',#{sItemNm},'%') )
- </if>
- </select>
- <select id="selectPickInfo" resultType="com.oqpo.api.entity.inoutmng.PickInfoMgntEntity">
- select col_pick_unq_no, spply_id, spply_nm, store_id
- , date_format(col_reg_dt,'%Y.%m.%d') as col_reg_dt
- , col_tot_amt, pick_mgr_nm, fn_get_telno(pick_mgr_tel_no) as pick_mgr_tel_no
- , fn_get_telno(pndr_tel_no) as pndr_tel_no, pick_st_cd, fn_code_nm('PICK_ST_CD', pick_st_cd ) as pick_st_nm
- , date_format(rodr_reg_dt,'%Y.%m.%d') as rodr_reg_dt, date_format(col_req_dt,'%Y.%m.%d') as col_req_dt
- , date_format(col_sch_dt,'%Y.%m.%d') as col_sch_dt, date_format(col_cmplt_dt,'%Y.%m.%d') as col_cmplt_dt
- , whs_id , fn_whs_nm(brand_id, whs_id) as whs_nm, location, fn_whs_location_nm(brand_id, whs_id, location) as location_nm
- , whs_dvsn, fn_code_nm('WHS_DVSN', whs_dvsn) as whs_dvsn_nm, brand_id, fn_brand_nm(brand_id) as brand_nm
- , col_desc
- from pick_info_mgnt
- where col_pick_unq_no = #{colPickUnqNo}
- and brand_id = #{brandId}
- </select>
- <select id="selectPickDtlPtcl" resultType="com.oqpo.api.entity.inoutmng.PickDtlPtclEntity">
- select ptcl.col_pick_unq_no, ptcl.col_pick_dtl_no, ptcl.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no, ptcl.rtn_req_unq_no
- , ptcl.rtn_req_dtl_no, ptcl.col_cmd_unq_no, ptcl.col_cmd_dtl_no
- , ptcl.pick_dtl_st_cd, fn_code_nm('PICK_DTL_ST_CD',ptcl.pick_dtl_st_cd) as pick_dtl_st_nm, ptcl.item_id
- , ptcl.item_nm, ptcl.unit, ptcl.unit_amt, ptcl.price_unit, ptcl.rodr_qty
- , ptcl.col_req_qty, ptcl.col_req_amt, ptcl.delay_yn, ptcl.delay_rsn
- , rptcl.rtn_rsn_dvsn, fn_code_nm('RTN_RSN_DVSN', rptcl.rtn_rsn_dvsn ) as rtn_rsn_dvsn_nm
- , rptcl.rtn_rsn
- from pick_info_mgnt base, pick_dtl_ptcl ptcl
- , rtn_odr_dtl_ptcl rptcl
- where base.col_pick_unq_no = ptcl.col_pick_unq_no
- and ptcl.rtn_podr_unq_no = rptcl.rtn_podr_unq_no
- and ptcl.rtn_podr_dtl_no = rptcl.rtn_podr_dtl_no
- and base.brand_id = #{brandId}
- and base.col_pick_unq_no = #{colPickUnqNo}
- </select>
- <select id="selectColSpplyTargetRtnGridList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
- , base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
- , ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
- , ptcl.item_id as 'rtnOdrDtlInfo.item_id', ptcl.item_nm as 'rtnOdrDtlInfo.item_nm'
- , base.rtn_whs_id, fn_whs_nm(base.brand_id, base.rtn_whs_id) as rtn_whs_nm
- , base.rtn_location, fn_whs_location_nm(base.brand_id, base.rtn_whs_id, base.rtn_location) as rtn_location_nm
- , ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt'
- , ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
- , date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt, ptcl.rtn_amt as 'rtnOdrDtlInfo.rtn_amt'
- , base.whs_id, fn_whs_nm(base.brand_id, base.whs_id) as whs_nm
- , base.location, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , base.store_id, ptcl.rtn_odr_amt as 'rtnOdrDtlInfo.rtn_odr_amt'
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.spply_id = #{sSpplyId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C002'
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by base.rtn_podr_unq_no desc , ptcl.rtn_podr_dtl_no asc
- </if>
- </if>
- </when>
- <otherwise>
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColSpplyTargetRtnGridCnt" resultType="int">
- select count(*) as cnt
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.spply_id = #{sSpplyId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C002'
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
- </if>
- </select>
- <select id="selectSpplyColOdrInfo" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.rtn_podr_unq_no, base.brand_id, fn_brand_nm(base.brand_id) as brand_nm, base.rtn_podr_unq_no, date_format(col_req_dt, '%Y.%m.%d') as col_req_dt
- , (select sum(rtn_amt) from rtn_odr_dtl_ptcl where rtn_podr_unq_no = #{rtnPodrUnqNo} and rodr_dtl_st_cd = 'ROD1' ) as rtn_dodr_total_amt
- , base.rtn_whs_id, fn_whs_nm(base.brand_id, base.rtn_whs_id) as rtn_whs_nm
- , base.rtn_location, fn_whs_location_nm(brand_id, base.rtn_whs_id, base.rtn_location) as rtn_location_nm
- , fn_get_telno((select tel_no from store_base_info where store_id = base.store_id )) as pick_tel_no
- from rtn_odr_base_info base
- where 1=1
- and base.brand_id = #{brandId}
- and base.spply_id = #{spplyId}
- and base.col_dvsn = 'C002'
- and base.rtn_podr_unq_no = #{rtnPodrUnqNo}
- </select>
- <select id="selectSpplyColRtnList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrDtlPtclEntity">
- select ptcl.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no, ptcl.item_id, ptcl.item_nm, ptcl.unit, ptcl.rtn_odr_qty, ptcl.rtn_odr_qty as col_qty
- , ptcl.unit_amt
- , ptcl.rtn_rsn_dvsn, rtn_rsn
- from rtn_odr_dtl_ptcl ptcl
- where ptcl.rtn_podr_unq_no = #{rtnPodrUnqNo}
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- </select>
- <!-- 어디에 쓰는 쿼리인지 찿을 필요 있음
- <select id="selectColSpplyTargetRtnGridList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
- select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
- , base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
- , ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
- , ptcl.item_id as 'rtnOdrDtlInfo.item_id', ptcl.item_nm as 'rtnOdrDtlInfo.item_nm'
- , base.rtn_whs_id, fn_whs_nm(base.brand_id, base.rtn_whs_id) as rtn_whs_nm, ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt'
- , ptcl.rtn_qty as 'rtnOdrDtlInfo.rtn_qty', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
- , date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt, ptcl.rtn_amt as 'rtnOdrDtlInfo.rtn_amt'
- , base.whs_id, fn_whs_nm(base.brand_id, base.whs_id) as whs_nm
- , base.location, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , base.store_id, ptcl.rtn_odr_amt as 'rtnOdrDtlInfo.rtn_odr_amt'
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.spply_id = #{sSpplyId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C002'
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by base.rtn_podr_unq_no desc , ptcl.rtn_podr_dtl_no asc
- </if>
- </if>
- </when>
- <otherwise>
- order by base.rtn_podr_unq_no asc , ptcl.rtn_podr_dtl_no asc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColTargetRtnGridCnt" resultType="int">
- select count(*) as cnt
- from rtn_odr_base_info base
- , rtn_odr_dtl_ptcl ptcl
- where 1=1
- and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and base.brand_id = #{sBrandId}
- and base.spply_id = #{sSpplyId}
- and base.col_req_dt between #{fromDt} and #{toDt}
- and base.rtn_odr_st_cd = 'RO20'
- and ptcl.rodr_dtl_st_cd = 'ROD1'
- and base.col_dvsn = 'C001'
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.rtn_whs_id = #{sRtnWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
- </if>
- </select>
- -->
- <select id="selectColSpplyPickGridList" resultType="com.oqpo.api.entity.inoutmng.PickInfoMgntEntity">
- select pmgnt.brand_id, fn_brand_nm(pmgnt.brand_id) as brand_nm
- , pmgnt.col_pick_unq_no , pmgnt.pick_st_cd, fn_code_nm('PICK_ST_CD',pmgnt.pick_st_cd) as pick_st_nm
- , date_format(pmgnt.col_reg_dt, '%Y.%m.%d') as col_reg_dt , date_format(pmgnt.col_req_dt, '%Y.%m.%d') as col_req_dt
- , date_format(pmgnt.col_sch_dt, '%Y.%m.%d') as col_sch_dt , date_format(pmgnt.col_cmplt_dt, '%Y.%m.%d') as col_cmplt_dt
- , pptcl.item_id as 'pickDtlInfo.item_id' , pptcl.item_nm as 'pickDtlInfo.item_nm', pptcl.col_req_qty as 'pickDtlInfo.col_req_qty'
- , pptcl.col_req_amt as 'pickDtlInfo.col_req_amt' , pptcl.unit_amt as 'pickDtlInfo.unit_amt', ptcl.rtn_rsn_dvsn as 'pickDtlInfo.rtn_rsn_dvsn'
- , fn_code_nm('RTN_RSN_DVSN', ptcl.rtn_rsn_dvsn) as 'pickDtlInfo.rtn_rsn_dvsn_nm', pmgnt.whs_id, pmgnt.location
- , fn_whs_nm(pmgnt.brand_id, pmgnt.whs_id) as whs_nm, fn_whs_location_nm(pmgnt.brand_id, pmgnt.whs_id, pmgnt.location) as location_nm
- , pmgnt.pick_mgr_nm, fn_get_telno(pmgnt.pick_mgr_tel_no) as pick_mgr_tel_no
- from rtn_odr_dtl_ptcl ptcl
- , pick_info_mgnt pmgnt
- , pick_dtl_ptcl pptcl
- where 1 = 1
- and ptcl.rtn_podr_unq_no = pptcl.rtn_podr_unq_no
- and ptcl.rtn_podr_dtl_no = pptcl.rtn_podr_dtl_no
- and pptcl.col_pick_unq_no = pmgnt.col_pick_unq_no
- and pmgnt.brand_id = #{sBrandId} -- 반품주체 공급사
- and pmgnt.spply_id = #{sSpplyId} -- 반품주체 공급사
- and pmgnt.col_dvsn = 'C002' -- c001 : 본사 수거, c002 : 공급사수거
- and pmgnt.col_req_dt between #{fromDt} and #{toDt}
- <if test="sWhsId != null and sWhsId != ''">
- and pmgnt.whs_id = #{sWhsId} -- 반품창고
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (pmgnt.col_pick_unq_no like concat('%', #{sItemNm}, '%') or pptcl.item_id like concat('%', #{sItemNm}, '%') or pptcl.item_nm like concat('%', #{sItemNm}, '%'))
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by pmgnt.col_pick_unq_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by pmgnt.col_pick_unq_no desc
- </if>
- </if>
- </when>
- <otherwise>
- order by pmgnt.col_pick_unq_no desc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColSpplyPickGridCnt" resultType="int">
- select count(*)
- from rtn_odr_dtl_ptcl ptcl
- , pick_info_mgnt pmgnt
- , pick_dtl_ptcl pptcl
- where 1 = 1
- and ptcl.rtn_podr_unq_no = pptcl.rtn_podr_unq_no
- and ptcl.rtn_podr_dtl_no = pptcl.rtn_podr_dtl_no
- and pptcl.col_pick_unq_no = pmgnt.col_pick_unq_no
- and pmgnt.brand_id = #{sBrandId} -- 반품주체 공급사
- and pmgnt.spply_id = #{sSpplyId} -- 반품주체 공급사
- and pmgnt.col_dvsn = 'C002' -- c001 : 본사 수거, c002 : 공급사수거
- and pmgnt.col_req_dt between #{fromDt} and #{toDt}
- <if test="sWhsId != null and sWhsId != ''">
- and pmgnt.whs_id = #{sWhsId} -- 반품창고
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (pmgnt.col_pick_unq_no like concat('%', #{sItemNm}, '%') or pptcl.item_id like concat('%', #{sItemNm}, '%') or pptcl.item_nm like concat('%', #{sItemNm}, '%'))
- </if>
- </select>
- <select id="selectColRtnInstGridList" resultType="com.oqpo.api.entity.inoutmng.PickInfoMgntEntity">
- select mgnt.brand_id, fn_brand_nm(mgnt.brand_id) as brand_nm
- ,mgnt.col_pick_unq_no, dtl.col_pick_dtl_no as 'pickDtlInfo.col_pick_dtl_no'
- , dtl.rtn_podr_unq_no as 'pickDtlInfo.rtn_podr_unq_no' , dtl.rtn_podr_dtl_no as 'pickDtlInfo.rtn_podr_dtl_no'
- ,dtl.item_id as 'pickDtlInfo.item_id', dtl.item_nm as 'pickDtlInfo.item_nm'
- , dtl.rodr_qty as 'pickDtlInfo.rodr_qty' , dtl.col_req_qty as 'pickDtlInfo.col_req_qty'
- , dtl.col_req_qty as 'pickDtlInfo.col_qty', dtl.col_amt as 'pickDtlInfo.col_amt'
- , date_format(mgnt.col_sch_dt,'%Y.%m.%d') as col_sch_dt, mgnt.pick_mgr_nm, fn_get_telno(mgnt.pick_mgr_tel_no) as pick_mgr_tel_no
- , mgnt.whs_id as rtn_whs_id , mgnt.location as rtn_location
- , fn_whs_nm(mgnt.brand_id, mgnt.whs_id) as rtn_whs_nm, fn_whs_location_nm(mgnt.brand_id, mgnt.whs_id, mgnt.location) as rtn_location_nm
- , base.whs_id, base.location
- , fn_whs_nm(base.brand_id, base.whs_id) as whs_nm, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , mgnt.spply_id, fn_spply_nm(mgnt.spply_id) as spply_nm
- from pick_info_mgnt mgnt
- ,pick_dtl_ptcl dtl
- ,rtn_odr_dtl_ptcl ptcl
- ,rtn_odr_base_info base
- where mgnt.col_pick_unq_no = dtl.col_pick_unq_no
- and dtl.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and dtl.rtn_podr_dtl_no = ptcl.rtn_podr_dtl_no
- and ptcl.rtn_podr_unq_no = base.rtn_podr_unq_no
- and mgnt.brand_id = #{sBrandId}
- and mgnt.col_sch_dt between #{fromDt} and #{toDt}
- and mgnt.pick_st_cd = 'PICK0'
- <if test="sStoreId != null and sStoreId != ''">
- and mgnt.store_id = #{sStoreId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.whs_id = #{sRtnWhsId}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and mgnt.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and dtl.whs_id = #{sWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (mgnt.col_pick_unq_no like concat('%',#{sItemNm},'%') or dtl.item_id like concat('%',#{sItemNm},'%') or dtl.item_nm like concat('%',#{sItemNm},'%') )
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by mgnt.col_pick_unq_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by mgnt.col_pick_unq_no desc
- </if>
- </if>
- </when>
- <otherwise>
- order by mgnt.col_pick_unq_no desc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColRtnInstGridCnt" resultType="int">
- select count(*) as cnt
- from pick_info_mgnt mgnt
- ,pick_dtl_ptcl dtl
- ,rtn_odr_dtl_ptcl ptcl
- ,rtn_odr_base_info base
- where mgnt.col_pick_unq_no = dtl.col_pick_unq_no
- and dtl.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and dtl.rtn_podr_dtl_no = ptcl.rtn_podr_dtl_no
- and ptcl.rtn_podr_unq_no = base.rtn_podr_unq_no
- and mgnt.brand_id = #{sBrandId}
- and mgnt.col_sch_dt between #{fromDt} and #{toDt}
- and mgnt.pick_st_cd = 'PICK0'
- <if test="sStoreId != null and sStoreId != ''">
- and mgnt.store_id = #{sStoreId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.whs_id = #{sRtnWhsId}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and mgnt.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and mgnt.whs_id = #{sWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (mgnt.col_pick_unq_no like concat('%',#{sItemNm},'%') or dtl.item_id like concat('%',#{sItemNm},'%') or dtl.item_nm like concat('%',#{sItemNm},'%') )
- </if>
- </select>
- <insert id="insertRtnProcInfoPtcl">
- insert into rtn_proc_info_ptcl
- (rtn_mgnt_unq_no, brand_id, store_id, item_id, item_nm
- , whs_id, location, unit, unit_amt, rtn_qty
- , rtn_odr_qty, col_qty, col_req_dt, col_sch_dt, col_dt
- , col_cnfm_nm, col_mgr_nm, col_mgr_tel_no, col_mgr_emal, col_mgr_mbl_no
- , col_amt, col_agr_yn, col_cnfm_doc_file_no, sttl_yn, spply_id
- , spply_nm, col_pick_unq_no, col_pick_dtl_no, col_cmd_unq_no, col_cmd_dtl_no
- , rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_unq_no, rtn_req_dtl_no, sttl_mgnt_unq_no, sttl_mgnt_dtl_no
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- <foreach collection="gridInsertData" item="item" separator=",">
- (#{item.rtnMgntUnqNo}, #{item.brandId}, #{item.storeId}, #{item.itemId}, #{item.itemNm}
- , #{item.whsId}, #{item.location}, #{item.unit}, #{item.unitAmt}, #{item.rtnQty}
- , #{item.rtnOdrQty}, #{item.colQty}, #{item.colReqDt}, #{item.colSchDt}, #{item.colDt}
- , #{item.colCnfmNm}, #{item.colMgrNm}, #{item.colMgrTelNo}, #{item.colMgrEmal}, #{item.colMgrMblNo}
- , #{item.colAmt}, #{item.colAgrYn}, #{item.colCnfmDocFileNo}, #{item.sttlYn}, #{item.spplyId}
- , #{item.spplyNm}, #{item.colPickUnqNo}, #{item.colPickDtlNo}, #{item.colCmdUnqNo}, #{item.colCmdDtlNo}
- , #{item.rtnPodrUnqNo}, #{item.rtnPodrDtlNo}, #{item.rtnReqUnqNo}, #{item.rtnReqDtlNo}, #{item.sttlMgntUnqNo}, #{item.sttlMgntDtlNo}
- , now(), #{userId}, now(), #{userId})
- </foreach>
- </insert>
- <select id="selectColRtnInstResultGridList" resultType="com.oqpo.api.entity.inoutmng.PickInfoMgntEntity">
- select mgnt.brand_id, fn_brand_nm(mgnt.brand_id) as brand_nm
- ,mgnt.col_pick_unq_no, dtl.col_pick_dtl_no as 'pickDtlInfo.col_pick_dtl_no'
- , dtl.rtn_podr_unq_no as 'pickDtlInfo.rtn_podr_unq_no' , dtl.rtn_podr_dtl_no as 'pickDtlInfo.rtn_podr_dtl_no'
- ,dtl.item_id as 'pickDtlInfo.item_id', dtl.item_nm as 'pickDtlInfo.item_nm'
- , dtl.rodr_qty as 'pickDtlInfo.rodr_qty' , dtl.col_req_qty as 'pickDtlInfo.col_req_qty'
- , dtl.col_qty as 'pickDtlInfo.col_qty', dtl.col_amt as 'pickDtlInfo.col_amt'
- , date_format(mgnt.col_sch_dt,'%Y.%m.%d') as col_sch_dt, date_format(mgnt.col_cmplt_dt,'%Y.%m.%d') as col_cmplt_dt
- , mgnt.pick_mgr_nm, fn_get_telno(mgnt.pick_mgr_tel_no) as pick_mgr_tel_no
- , mgnt.whs_id as rtn_whs_id , mgnt.location as rtn_location
- , fn_whs_nm(mgnt.brand_id, mgnt.whs_id) as rtn_whs_nm, fn_whs_location_nm(mgnt.brand_id, mgnt.whs_id, mgnt.location) as rtn_location_nm
- , base.whs_id, base.location
- , fn_whs_nm(base.brand_id, base.whs_id) as whs_nm, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , mgnt.spply_id, fn_spply_nm(mgnt.spply_id) as spply_nm
- , dtl.pick_dtl_st_cd as 'pickDtlInfo.pick_dtl_st_cd'
- , fn_code_nm('PICK_DTL_ST_CD', dtl.pick_dtl_st_cd) as 'pickDtlInfo.pick_dtl_st_nm'
- from pick_info_mgnt mgnt
- ,pick_dtl_ptcl dtl
- ,rtn_odr_dtl_ptcl ptcl
- ,rtn_odr_base_info base
- where mgnt.col_pick_unq_no = dtl.col_pick_unq_no
- and dtl.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and dtl.rtn_podr_dtl_no = ptcl.rtn_podr_dtl_no
- and ptcl.rtn_podr_unq_no = base.rtn_podr_unq_no
- and mgnt.brand_id = #{sBrandId}
- and mgnt.col_cmplt_dt between #{fromDt} and #{toDt}
- <if test="sStoreId != null and sStoreId != ''">
- and mgnt.store_id = #{sStoreId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.whs_id = #{sRtnWhsId}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and mgnt.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and dtl.whs_id = #{sWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (mgnt.col_pick_unq_no like concat('%',#{sItemNm},'%') or dtl.item_id like concat('%',#{sItemNm},'%') or dtl.item_nm like concat('%',#{sItemNm},'%') )
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- order by mgnt.col_pick_unq_no asc
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- order by mgnt.col_pick_unq_no desc
- </if>
- </if>
- </when>
- <otherwise>
- order by mgnt.col_pick_unq_no desc
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectColRtnInstResultGridCnt" resultType="int">
- select count(*) as cnt
- from pick_info_mgnt mgnt
- ,pick_dtl_ptcl dtl
- ,rtn_odr_dtl_ptcl ptcl
- ,rtn_odr_base_info base
- where mgnt.col_pick_unq_no = dtl.col_pick_unq_no
- and dtl.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and dtl.rtn_podr_dtl_no = ptcl.rtn_podr_dtl_no
- and ptcl.rtn_podr_unq_no = base.rtn_podr_unq_no
- and mgnt.brand_id = #{sBrandId}
- and mgnt.col_cmplt_dt between #{fromDt} and #{toDt}
- <if test="sStoreId != null and sStoreId != ''">
- and mgnt.store_id = #{sStoreId}
- </if>
- <if test="sRtnWhsId != null and sRtnWhsId != ''">
- and base.whs_id = #{sRtnWhsId}
- </if>
- <if test="sSpplyId != null and sSpplyId != ''">
- and mgnt.spply_id = #{sSpplyId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- and dtl.whs_id = #{sWhsId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- and (mgnt.col_pick_unq_no like concat('%',#{sItemNm},'%') or dtl.item_id like concat('%',#{sItemNm},'%') or dtl.item_nm like concat('%',#{sItemNm},'%') )
- </if>
- </select>
- <select id="selectColRtnInstProcList" resultType="com.oqpo.api.entity.inoutmng.PickInfoMgntEntity">
- select mgnt.brand_id, fn_brand_nm(mgnt.brand_id) as brand_nm
- , mgnt.store_id,dtl.item_id as 'pickDtlInfo.item_id', dtl.item_nm as 'pickDtlInfo.item_nm'
- , base.whs_id, base.location
- , fn_whs_nm(base.brand_id, base.whs_id) as whs_nm, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
- , dtl.unit as 'pickDtlInfo.unit' , dtl.unit_amt as 'pickDtlInfo.unit_amt'
- , ptcl.rtn_req_qty as 'pickDtlInfo.rtn_req_qty' , dtl.rodr_qty as 'pickDtlInfo.rodr_qty'
- , dtl.col_req_qty as 'pickDtlInfo.col_req_qty'
- , date_format(mgnt.col_req_dt,'%Y.%m.%d') as col_req_dt
- , date_format(mgnt.col_sch_dt,'%Y.%m.%d') as col_sch_dt
- , date_format(mgnt.col_cmplt_dt,'%Y.%m.%d') as col_cmplt_dt
- , mgnt.pick_mgr_nm, fn_get_telno(mgnt.pick_mgr_tel_no) as pick_mgr_tel_no
- , dtl.col_req_amt as 'pickDtlInfo.col_req_amt'
- , mgnt.spply_id, fn_spply_nm(mgnt.spply_id) as spply_nm
- , mgnt.col_pick_unq_no, dtl.col_pick_dtl_no as 'pickDtlInfo.col_pick_dtl_no'
- , dtl.col_cmd_unq_no as 'pickDtlInfo.col_cmd_unq_no', dtl.col_cmd_dtl_no as 'pickDtlInfo.col_cmd_dtl_no'
- , dtl.rtn_podr_unq_no as 'pickDtlInfo.rtn_podr_unq_no', dtl.rtn_podr_dtl_no as 'pickDtlInfo.rtn_podr_dtl_no'
- , ptcl.rtn_req_unq_no as 'pickDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'pickDtlInfo.rtn_req_dtl_no'
- , mgnt.whs_dvsn, mgnt.col_dvsn
- from pick_info_mgnt mgnt
- ,pick_dtl_ptcl dtl
- ,rtn_odr_dtl_ptcl ptcl
- ,rtn_odr_base_info base
- where mgnt.col_pick_unq_no = dtl.col_pick_unq_no
- and dtl.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
- and dtl.rtn_podr_dtl_no = ptcl.rtn_podr_dtl_no
- and ptcl.rtn_podr_unq_no = base.rtn_podr_unq_no
- and mgnt.brand_id = #{brandId}
- and base.whs_id = #{whsId}
- and concat(base.col_pick_unq_no, ptcl.col_pick_dtl_no) in
- <foreach collection="gridUpdateData" item="item" separator="," open="(" close=")">
- #{item.colPickUnqNo}
- </foreach>
- </select>
- <insert id="insertRtnProcInfoPtcl">
- insert into rtn_proc_info_ptcl
- (rtn_mgnt_unq_no, brand_id, store_id, item_id, item_nm
- , whs_id, location, unit, unit_amt, rtn_req_qty
- , rtn_odr_qty, col_req_qty, col_qty, col_req_dt, col_sch_dt
- , col_dt, col_cnfm_nm, col_mgr_nm, col_mgr_tel_no, col_mgr_emal
- , col_mgr_mbl_no, col_amt, col_agr_yn, col_cnfm_doc_file_no, sttl_yn
- , spply_id, spply_nm, col_pick_unq_no, col_pick_dtl_no, col_cmd_unq_no
- , col_cmd_dtl_no, rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_unq_no, rtn_req_dtl_no
- , sttl_mgnt_unq_no, sttl_mgnt_dtl_no
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- (#{entity.rtnMgntUnqNo}, #{entity.brandId}, #{entity.storeId}, #{entity.itemId}, #{entity.itemNm}
- , #{entity.whsId}, #{entity.location}, #{entity.unit}, #{entity.unitAmt}, #{entity.rtnReqQty}
- , #{entity.rtnOdrQty}, #{entity.colReqQty}, #{entity.colQty}, #{entity.colReqDt}, #{entity.colSchDt}
- , date_fromat(now(),'%Y%m%d'), #{entity.colCnfmNm}, #{entity.colMgrNm}, #{entity.colMgrTelNo}, #{entity.colMgrEmal}
- , #{entity.colMgrMblNo}, #{entity.colAmt}, #{entity.colAgrYn}, #{entity.colCnfmDocFileNo}, #{entity.sttlYn}
- , #{entity.spplyId}, #{entity.spplyNm}, #{entity.colPickUnqNo}, #{entity.colPickDtlNo}, #{entity.colCmdUnqNo}
- , #{entity.colCmdDtlNo}, #{entity.rtnPodrUnqNo}, #{entity.rtnPodrDtlNo}, #{entity.rtnReqUnqNo}, #{entity.rtnReqDtlNo}
- , #{entity.sttlMgntUnqNo}, #{entity.sttlMgntDtlNo}
- , now(), #{userId}, now(), #{userId})
- </insert>
- </mapper>
|