123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <?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, 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
- 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 = 'ROD0'
- 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 as , 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 as , 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 = 'ROD0'
- 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="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'
- 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 = 'ROD0'
- 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
- , 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.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}
- , 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
- , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
- values
- (#{entity.colPickUnqNo}, #{entity.spplyId}, #{entity.spplyNm}, #{entity.storeId}, #{entity.colRegDt}
- , #{entity.colTotAmt}, #{entity.pickMgrNm}, #{entity.pickMgrTelNo}, #{entity.pickMgrEmal}, #{entity.pickMgrMblNo}
- , #{entity.pndrTelNo}, #{entity.pickStCd}, #{entity.rodrRegDt}, #{entity.colReqDt}, #{entity.colSchDt}
- , #{entity.colCmpltDt}, #{entity.whsId}, #{entity.location}, #{entity.whsDvsn}, #{entity.brandId}, #{entity.colDesc}
- , 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_qty, col_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.colQty}, #{item.colAmt}, #{item.delayYn}, #{item.delayRsn}
- , now(), #{item.sysRegId}, now(), #{item.sysChgId})
- </foreach>
- </insert>
- </mapper>
|