ColOdr.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.oqpo.api.mapper.inoutmng.ColOdrMapper">
  4. <select id="selectColRtnIngCnt" resultType="int">
  5. select count(*) /* ColOdr.selectColRtnIngCnt */
  6. from col_odr_base_info base
  7. ,col_odr_dtl_ptcl ptcl
  8. where base.col_cmd_unq_no = ptcl.col_cmd_unq_no
  9. and base.brand_id = #{brandId}
  10. and base.col_cmd_st_cd in ('COL1','COL2')
  11. and ptcl.rtn_podr_unq_no = #{rtnPodrUnqNo}
  12. </select>
  13. <select id="selectColTargetRtnGridList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
  14. select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
  15. , base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
  16. , ptcl.rtn_req_unq_no as 'rtnOdrDtlInfo.rtn_req_unq_no', ptcl.rtn_req_dtl_no as 'rtnOdrDtlInfo.rtn_req_dtl_no'
  17. , ptcl.item_id as 'rtnOdrDtlInfo.item_id', ptcl.item_nm as 'rtnOdrDtlInfo.item_nm'
  18. , 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'
  19. , ptcl.rtn_qty as 'rtnOdrDtlInfo.rtn_qty', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
  20. , date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt, ptcl.rtn_amt as 'rtnOdrDtlInfo.rtn_amt'
  21. , base.whs_id, fn_whs_nm(base.brand_id, base.whs_id) as whs_nm
  22. , base.location, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
  23. , base.store_id
  24. from rtn_odr_base_info base
  25. , rtn_odr_dtl_ptcl ptcl
  26. where 1=1
  27. and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
  28. and base.brand_id = #{sBrandId}
  29. and base.col_req_dt between #{fromDt} and #{toDt}
  30. and base.rtn_odr_st_cd = 'RO20'
  31. and ptcl.rodr_dtl_st_cd = 'ROD0'
  32. and base.col_dvsn = 'C001'
  33. <if test="sWhsId != null and sWhsId != ''">
  34. and base.whs_id = #{sWhsId}
  35. </if>
  36. <if test="sRtnWhsId != null and sRtnWhsId != ''">
  37. and base.rtn_whs_id = #{sRtnWhsId}
  38. </if>
  39. <if test="sItemNm != null and sItemNm != ''">
  40. and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
  41. </if>
  42. <choose>
  43. <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
  44. <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
  45. <if test="gridRequest.sord == 'asc'.toString()">
  46. order by base.rtn_podr_unq_no as , ptcl.rtn_podr_dtl_no asc
  47. </if>
  48. <if test="gridRequest.sord == 'desc'.toString()">
  49. order by base.rtn_podr_unq_no desc , ptcl.rtn_podr_dtl_no asc
  50. </if>
  51. </if>
  52. </when>
  53. <otherwise>
  54. order by base.rtn_podr_unq_no as , ptcl.rtn_podr_dtl_no asc
  55. </otherwise>
  56. </choose>
  57. <if test="gridRequest.pagingYn == true">
  58. limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
  59. </if>
  60. </select>
  61. <select id="selectColTargetRtnGridCnt" resultType="int">
  62. select count(*) as cnt
  63. from rtn_odr_base_info base
  64. , rtn_odr_dtl_ptcl ptcl
  65. where 1=1
  66. and base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no
  67. and base.brand_id = #{sBrandId}
  68. and base.col_req_dt between #{fromDt} and #{toDt}
  69. and base.rtn_odr_st_cd = 'RO20'
  70. and ptcl.rodr_dtl_st_cd = 'ROD0'
  71. and base.col_dvsn = 'C001'
  72. <if test="sWhsId != null and sWhsId != ''">
  73. and base.whs_id = #{sWhsId}
  74. </if>
  75. <if test="sRtnWhsId != null and sRtnWhsId != ''">
  76. and base.rtn_whs_id = #{sRtnWhsId}
  77. </if>
  78. <if test="sItemNm != null and sItemNm != ''">
  79. and (ptcl.item_id like concat('%', '', '%') or ptcl.item_nm like concat('%', '', '%'))
  80. </if>
  81. </select>
  82. <select id="selectPickJobDataList" resultType="com.oqpo.api.entity.rtnmng.RtnOdrBaseInfoEntity">
  83. select base.brand_id,base.rtn_podr_unq_no, ptcl.rtn_podr_dtl_no as 'rtnOdrDtlInfo.rtn_podr_dtl_no'
  84. ,ptcl.item_id as 'rtnOdrDtlInfo.item_id' , ptcl.item_nm as 'rtnOdrDtlInfo.item_nm', base.whs_id
  85. ,base.location, ptcl.unit_amt as 'rtnOdrDtlInfo.unit_amt', ptcl.rtn_odr_qty as 'rtnOdrDtlInfo.rtn_odr_qty'
  86. ,ptcl.rtn_odr_amt as 'rtnOdrDtlInfo.rtn_odr_amt', date_format(base.col_req_dt,'%Y.%m.%d') as col_req_dt
  87. , 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'
  88. , base.store_id , base.rtn_mgr_nm , base.rtn_mgr_tel_no, base.rtn_mgr_id
  89. , 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
  90. , date_format(base.rtn_odr_reg_dt,'%Y%m%d') as rtn_odr_req_dt
  91. , base.spply_id, fn_spply_nm(base.spply_id) as spply_nm
  92. , ptcl.rtn_rsn_dvsn as 'rtnOdrDtlInfo.rtn_rsn_dvsn', ptcl.rtn_rsn as 'rtnOdrDtlInfo.rtn_rsn'
  93. from rtn_odr_base_info base
  94. join rtn_odr_dtl_ptcl ptcl on base.rtn_podr_unq_no = ptcl.rtn_podr_unq_no and ptcl.rodr_dtl_st_cd = 'ROD0'
  95. join item_base_info itm on ptcl.item_id = itm.item_id
  96. and base.brand_id = #{brandId}
  97. and concat(base.rtn_podr_unq_no,ptcl.rtn_podr_dtl_no) in
  98. <foreach collection="gridInsertData" item="item" separator="," open="(" close=")">
  99. concat(#{item.rtnPodrUnqNo},#{item.rtnPodrDtlNo})
  100. </foreach>
  101. order by base.brand_id, base.whs_id, base.location, base.rtn_whs_id,base.rtn_location
  102. </select>
  103. <insert id="insertColOdrBase">
  104. insert into col_odr_base_info /* ColOdr.insertColOdrBase*/
  105. (col_cmd_unq_no, col_reg_dt, brand_id, whs_id, location
  106. , store_id, item_qty, col_total_amt, col_req_dt, col_dvsn
  107. , col_cmd_st_cd, col_req_mgr_nm, col_req_mgr_id, col_dt, col_cnfm_nm
  108. , col_cnfm_id, col_mgr_nm, col_mgr_tel_no, col_mgr_emal, col_mgr_mbl_no
  109. , rtn_whs_id, rtn_location, spply_id, spply_nm
  110. , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
  111. values
  112. (#{entity.colCmdUnqNo}, date_format(now(),'%Y%m%d'), #{entity.brandId}, #{entity.whsId}, #{entity.location}
  113. , #{entity.storeId}, #{entity.itemQty}, #{entity.colTotalAmt}, #{entity.colReqDt}, #{entity.colReqDt}, #{entity.colDvsn}
  114. , #{entity.colCmdStCd}, #{entity.colReqMgrNm}, #{entity.colReqMgrId}, #{entity.colDt}, #{entity.colCnfmNm}
  115. , #{entity.colCnfmId}, #{entity.colMgrNm}, #{entity.colMgrTelNo}, #{entity.colMgrEmal}, #{entity.colMgrMblNo}
  116. , #{entity.rtnWhsId}, #{entity.rtnLocation}, #{entity.spplyId}, #{entity.spplyNm}
  117. , now(), #{userId}, now(), #{userId})
  118. </insert>
  119. <insert id="insertColOdrDtl">
  120. insert into col_odr_dtl_ptcl /* ColOdr.insertColOdrDtl*/
  121. (col_cmd_unq_no, col_cmd_dtl_no, item_id, item_nm, unit_amt
  122. , col_qty, col_amt, rtn_qty, rtn_amt, rtn_rsn_dvsn
  123. , rtn_rsn, rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_dtl_no, rtn_req_unq_no, col_cmd_dtl_st_cd
  124. , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
  125. values
  126. <foreach collection="gridInsertData" item="item" separator=",">
  127. (#{item.colCmdUnqNo}, #{item.colCmdDtlNo}, #{item.itemId}, #{item.itemNm}, #{item.unitAmt}
  128. , #{item.colQty}, #{item.colAmt}, #{item.rtnQty}, #{item.rtnAmt}, #{item.rtnRsnDvsn}
  129. , #{item.rtnRsn}, #{item.rtnPodrUnqNo}, #{item.rtnPodrDtlNo}, #{item.rtnReqDtlNo}, #{item.rtnReqUnqNo}, 'CDLD1'
  130. , now(), #{userId}, now(), #{userId})
  131. </foreach>
  132. </insert>
  133. <insert id="insertPickMgntBase">
  134. insert into pick_info_mgnt /* ColOdr.insertPickMgntBase */
  135. (col_pick_unq_no, spply_id, spply_nm, store_id, col_reg_dt
  136. , col_tot_amt, pick_mgr_nm, pick_mgr_tel_no, pick_mgr_emal, pick_mgr_mbl_no
  137. , pndr_tel_no, pick_st_cd, rodr_reg_dt, col_req_dt, col_sch_dt
  138. , col_cmplt_dt, whs_id, location, whs_dvsn, brand_id, col_desc
  139. , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
  140. values
  141. (#{entity.colPickUnqNo}, #{entity.spplyId}, #{entity.spplyNm}, #{entity.storeId}, #{entity.colRegDt}
  142. , #{entity.colTotAmt}, #{entity.pickMgrNm}, #{entity.pickMgrTelNo}, #{entity.pickMgrEmal}, #{entity.pickMgrMblNo}
  143. , #{entity.pndrTelNo}, #{entity.pickStCd}, #{entity.rodrRegDt}, #{entity.colReqDt}, #{entity.colSchDt}
  144. , #{entity.colCmpltDt}, #{entity.whsId}, #{entity.location}, #{entity.whsDvsn}, #{entity.brandId}, #{entity.colDesc}
  145. , now(), #{userId}, now(), #{userId})
  146. </insert>
  147. <insert id="insertPickDtlPtcl">
  148. insert into pick_dtl_ptcl /* ColOdr.insertPickDtlPtcl */
  149. (col_pick_unq_no, col_pick_dtl_no, rtn_podr_unq_no, rtn_podr_dtl_no, rtn_req_unq_no
  150. , rtn_req_dtl_no, col_cmd_unq_no, col_cmd_dtl_no, pick_dtl_st_cd, item_id
  151. , item_nm, unit, unit_amt, price_unit, rodr_qty
  152. , col_qty, col_amt, delay_yn, delay_rsn
  153. , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
  154. values
  155. <foreach collection="gridInsertData" item="item" separator=",">
  156. (#{item.colPickUnqNo}, #{item.colPickDtlNo}, #{item.rtnPodrUnqNo}, #{item.rtnPodrDtlNo}, #{item.rtnReqUnqNo}
  157. , #{item.rtnReqDtlNo}, #{item.colCmdUnqNo}, #{item.colCmdDtlNo}, 'PICKD0', #{item.itemId}
  158. , #{item.itemNm}, #{item.unit}, #{item.unitAmt}, #{item.priceUnit}, #{item.rodrQty}
  159. , #{item.colQty}, #{item.colAmt}, #{item.delayYn}, #{item.delayRsn}
  160. , now(), #{item.sysRegId}, now(), #{item.sysChgId})
  161. </foreach>
  162. </insert>
  163. </mapper>