|
@@ -0,0 +1,377 @@
|
|
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
|
+
|
|
4
|
+<mapper namespace="com.oqpo.api.mapper.rtnmng.RtnReqMapper">
|
|
5
|
+
|
|
6
|
+ <insert id="insertRtnReqBaseInfo" >
|
|
7
|
+ INSERT INTO rtn_req_base_info /* RtnReqMapper.insertRtnReqBaseInfo */
|
|
8
|
+ (rtn_req_unq_no, store_id, brand_id, rtn_req_dt, rtn_req_tm
|
|
9
|
+ , rtn_req_st_cd, rtn_req_mgr_id, rtn_req_mgr_nm, rtn_req_mgr_tel_no
|
|
10
|
+ , whs_dvsn, col_req_dt, note, rtn_rjct_dt, rtn_rjct_nm
|
|
11
|
+ , rtn_rjct_id, rtn_rjct_rsn, rtn_req_amt, rtn_req_item_qty, rtn_whs_id, rtn_location
|
|
12
|
+ , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
13
|
+ VALUES
|
|
14
|
+ (#{entity.rtnReqUnqNo}, #{entity.storeId}, #{entity.brandId}, #{entity.rtnReqDt}, #{entity.rtnReqTm}
|
|
15
|
+ , #{entity.rtnReqStCd}, #{entity.rtnReqMgrId}, #{entity.rtnReqMgrNm}, #{entity.rtnReqMgrTelNo}
|
|
16
|
+ , #{entity.whsDvsn}, #{entity.colReqDt}, #{entity.note}, #{entity.rtnRjctDt}, #{entity.rtnRjctNm}
|
|
17
|
+ , #{entity.rtnRjctId}, #{entity.rtnRjctRsn}, #{entity.rtnReqAmt}, #{entity.rtnReqItemQty}, #{entity.rtnWhsId}, #{entity.rtnLocation}
|
|
18
|
+ , NOW(), #{userId}, NOW(), #{userId})
|
|
19
|
+
|
|
20
|
+ </insert>
|
|
21
|
+
|
|
22
|
+ <update id="updateRtnReqBaseInfo">
|
|
23
|
+ UPDATE rtn_req_base_info SET /* RtnReqMapper.updateRtnReqBaseInfo */
|
|
24
|
+ rtn_req_dt = #{entity.rtnReqDt},
|
|
25
|
+ rtn_req_tm = #{entity.rtnReqTm},
|
|
26
|
+ rtn_req_st_cd = #{entity.rtnReqStCd},
|
|
27
|
+ whs_dvsn = #{entity.whsDvsn},
|
|
28
|
+ col_req_dt = #{entity.colReqDt},
|
|
29
|
+ note = #{entity.note},
|
|
30
|
+ rtn_req_amt = #{entity.rtnReqAmt},
|
|
31
|
+ rtn_req_item_qty = #{entity.rtnReqItemQty},
|
|
32
|
+ rtn_whs_id = #{entity.rtnWhsId},
|
|
33
|
+ rtn_location = #{entity.rtnLocation},
|
|
34
|
+ sys_chg_dttm = NOW(),
|
|
35
|
+ sys_chg_id = #{userId}
|
|
36
|
+ WHERE rtn_req_unq_no = #{entity.rtnReqUnqNo}
|
|
37
|
+ AND brand_id = #{entity.brandId}
|
|
38
|
+ </update>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+ <insert id="insertRtnReqDtlPtcl" >
|
|
42
|
+ INSERT INTO rtn_req_dtl_ptcl /* RtnReqMapper.insertRtnReqDtlPtcl */
|
|
43
|
+ (rtn_req_unq_no, rtn_req_dtl_no, item_id, item_nm, unit
|
|
44
|
+ , rtn_qty, rtn_amt, rtn_dvsn, rtn_rsn
|
|
45
|
+ , spply_id, unit_amt, store_unit_unq_no, brand_unit_unq_no, rtn_rsn_dvsn
|
|
46
|
+ , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
47
|
+ VALUES
|
|
48
|
+ <foreach collection="gridInsertData" item="item" separator=",">
|
|
49
|
+ (#{item.rtnReqUnqNo}, #{item.rtnReqDtlNo}, #{item.itemId}, #{item.itemNm}, #{item.unit}
|
|
50
|
+ , #{item.rtnQty}, #{item.rtnAmt}, #{item.rtnDvsn}, #{item.rtnRsn}
|
|
51
|
+ , #{item.spplyId}, #{item.unitAmt}, #{item.storeUnitUnqNo}, #{item.brandUnitUnqNo}, #{item.rtnRsnDvsn}
|
|
52
|
+ , NOW(), #{userId}, NOW(), #{userId})
|
|
53
|
+ </foreach>
|
|
54
|
+ </insert>
|
|
55
|
+
|
|
56
|
+ <update id="updateRtnReqDtlPtcl">
|
|
57
|
+ <foreach collection="gridUpdateData" item="item" separator=";">
|
|
58
|
+ UPDATE rtn_req_dtl_ptcl SET /* RtnReqMapper.updateRtnReqDtlPtcl */
|
|
59
|
+ rtn_qty = #{item.rtnQty},
|
|
60
|
+ rtn_amt = #{item.rtnAmt},
|
|
61
|
+ rtn_dvsn = #{item.rtnDvsn},
|
|
62
|
+ rtn_rsn = #{item.rtnRsn},
|
|
63
|
+ rtn_rsn_dvsn = #{item.rtnRsnDvsn},
|
|
64
|
+ sys_chg_dttm = NOW(),
|
|
65
|
+ sys_chg_id = #{userId}
|
|
66
|
+ WHERE rtn_req_unq_no = #{item.rtnReqUnqNo}
|
|
67
|
+ AND rtn_req_dtl_no = #{item.rtnReqDtlNo}
|
|
68
|
+ </foreach>
|
|
69
|
+ </update>
|
|
70
|
+
|
|
71
|
+ <delete id="deleteRtnReqDtlPtcl">
|
|
72
|
+ DELETE FROM rtn_req_dtl_ptcl /* RtnReqMapper.deleteRtnReqDtlPtcl */
|
|
73
|
+ WHERE rtn_req_unq_no = #{rtnReqUnqNo}
|
|
74
|
+ AND rtn_req_dtl_no in
|
|
75
|
+ <foreach collection="gridDeleteData" item="item" separator="," open="(" close=")">
|
|
76
|
+ #{item.rtnReqDtlNo}
|
|
77
|
+ </foreach>
|
|
78
|
+ </delete>
|
|
79
|
+
|
|
80
|
+ <select id="selectMaxRtnReqDtlNo" resultType="int">
|
|
81
|
+ SELECT nvl(Max(convert(rtn_req_dtl_no,int)),0)
|
|
82
|
+ FROM rtn_req_dtl_ptcl
|
|
83
|
+ WHERE rtn_req_unq_no = #{rtnReqUnqNo}
|
|
84
|
+ </select>
|
|
85
|
+
|
|
86
|
+ <select id="selectSumRtnAmt" resultType="com.oqpo.api.entity.rtnmng.RtnReqBaseInfoEntity">
|
|
87
|
+ select count(*) as rtn_req_item_qty, nvl(sum(rtn_amt),0) as rtn_req_amt
|
|
88
|
+ from rtn_req_dtl_ptcl
|
|
89
|
+ where rtn_req_unq_no = #{rtnReqUnqNo}
|
|
90
|
+ </select>
|
|
91
|
+
|
|
92
|
+<!--
|
|
93
|
+ <select id="selectPchReqGridList" resultType="com.oqpo.api.entity.pomng.PchReqBaseInfoEntity">
|
|
94
|
+ select /* PchReq.selectPchReqGridList */
|
|
95
|
+ pch_req_unq_no, brand_id, fn_brand_nm(brand_id) as brand_nm, pch_req_nm
|
|
96
|
+ ,pch_req_st_cd, fn_code_nm('PCH_REQ_ST_Cd',pch_req_st_cd) as pch_req_st_nm
|
|
97
|
+ , pch_req_mgr_nm, date_format(dlv_req_dt,'%Y.%m.%d') as dlv_req_dt, pch_req_total_amt
|
|
98
|
+ ,pch_req_item_qty, date_format(pch_req_rjct_dt,'%Y.%m.%d') as pch_req_rjct_dt, pch_req_rjct_nm
|
|
99
|
+ ,whs_id, fn_whs_nm(brand_id, whs_id) as whs_nm
|
|
100
|
+ ,location, fn_whs_location_nm(brand_id, whs_id, location) as location_nm
|
|
101
|
+ ,date_format(pch_req_dt,'%Y.%m.%d') as pch_req_dt
|
|
102
|
+ from pch_req_base_info
|
|
103
|
+ where brand_id = #{sBrandId}
|
|
104
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
105
|
+ and store_id = #{sStoreId}
|
|
106
|
+ </if>
|
|
107
|
+ and date_format(sys_reg_dttm,'%Y%m%d') between #{fromDt} and #{toDt}
|
|
108
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
109
|
+ and whs_id = #{sWhsId}
|
|
110
|
+ </if>
|
|
111
|
+ <if test="sPchReqStCd != null and sPchReqStCd != ''">
|
|
112
|
+ and pch_req_st_cd = #{sPchReqStCd}
|
|
113
|
+ </if>
|
|
114
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
115
|
+ and pch_req_unq_no in ( select pch_req_unq_no from pch_req_dtl_ptcl
|
|
116
|
+ where date_format(sys_reg_dttm,'%Y%m%d') between #{fromDt} and #{toDt})
|
|
117
|
+ and item_id like concat('%',#{sItemNm},'%') or item_nm like concat('%',#{sItemNm},'%')
|
|
118
|
+ </if>
|
|
119
|
+ <choose>
|
|
120
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
121
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
122
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
123
|
+ order by pch_req_unq_no asc
|
|
124
|
+ </if>
|
|
125
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
126
|
+ order by pch_req_unq_no desc
|
|
127
|
+ </if>
|
|
128
|
+ </if>
|
|
129
|
+ </when>
|
|
130
|
+ <otherwise>
|
|
131
|
+ order by pch_req_unq_no desc
|
|
132
|
+ </otherwise>
|
|
133
|
+ </choose>
|
|
134
|
+ <if test="gridRequest.pagingYn == true">
|
|
135
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
136
|
+ </if>
|
|
137
|
+ </select>
|
|
138
|
+
|
|
139
|
+ <select id="selectPchReqGridCnt" resultType="int">
|
|
140
|
+ select count(*) as cnt
|
|
141
|
+ from pch_req_base_info
|
|
142
|
+ where brand_id = #{sBrandId}
|
|
143
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
144
|
+ and store_id = #{sStoreId}
|
|
145
|
+ </if>
|
|
146
|
+ and date_format(sys_reg_dttm,'%Y%m%d') between #{fromDt} and #{toDt}
|
|
147
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
148
|
+ and whs_id = #{sWhsId}
|
|
149
|
+ </if>
|
|
150
|
+ <if test="sPchReqStCd != null and sPchReqStCd != ''">
|
|
151
|
+ and pch_req_st_cd = #{sPchReqStCd}
|
|
152
|
+ </if>
|
|
153
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
154
|
+ and pch_req_unq_no in ( select pch_req_unq_no from pch_req_dtl_ptcl
|
|
155
|
+ where date_format(sys_reg_dttm,'%Y%m%d') between #{fromDt} and #{toDt})
|
|
156
|
+ and item_id like concat('%',#{sItemNm},'%') or item_nm like concat('%',#{sItemNm},'%')
|
|
157
|
+ </if>
|
|
158
|
+ </select>
|
|
159
|
+
|
|
160
|
+ <select id="selectPchReqInfo" resultType="com.oqpo.api.entity.pomng.PchReqBaseInfoEntity">
|
|
161
|
+ SELECT pch_req_unq_no, brand_id, fn_brand_nm(brand_id) as brand_nm, store_id, pch_req_nm, pch_req_dept
|
|
162
|
+ , pch_req_mgr_nm, DATE_FORMAT(pch_req_dt,'%Y.%m.%d') as pch_req_dt, pch_req_st_cd, fn_code_nm('PCH_REQ_ST_CD', pch_req_st_cd ) AS pch_req_st_nm, pch_req_dvsn
|
|
163
|
+ , note, pch_req_item_qty, pch_req_total_amt, DATE_FORMAT(pch_req_rjct_dt,'%Y.%m.%d') as pch_req_rjct_dt, pch_req_rjct_nm
|
|
164
|
+ , pch_req_rjct_rsn, pch_req_mgr_id, pch_req_rjct_id
|
|
165
|
+ ,whs_id, fn_whs_nm(brand_id, whs_id) as whs_nm
|
|
166
|
+ ,location, fn_whs_location_nm(brand_id, whs_id, location) as location_nm
|
|
167
|
+ , DATE_FORMAT(dlv_req_dt ,'%Y.%m.%d') as dlv_req_dt
|
|
168
|
+ , DATE_FORMAT(sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, sys_reg_id, DATE_FORMAT(sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, sys_chg_id
|
|
169
|
+ , nvl(pch_appr_amt,0) as pch_appr_amt, case when pch_req_total_amt = pch_appr_amt then 'Y' else 'N' end pch_appr_yn
|
|
170
|
+ FROM pch_req_base_info
|
|
171
|
+ WHERE brand_id = #{brandId}
|
|
172
|
+ and pch_req_unq_no = #{pchReqUnqNo}
|
|
173
|
+ </select>
|
|
174
|
+
|
|
175
|
+ <select id="selectPchReqDtlPtcl" resultType="com.oqpo.api.entity.pomng.PchReqDtlPtclEntity">
|
|
176
|
+ SELECT ptcl.pch_req_unq_no, ptcl.pch_req_dtl_no, ptcl.item_id, ptcl.item_nm, ptcl.unit, fn_code_nm('DSTRBT_COST_UNIT',ptcl.unit) AS unit_nm
|
|
177
|
+ , ptcl.pch_req_qty, ptcl.pch_req_amt, ptcl.unit_amt, ptcl.brand_unit_unq_no, ptcl.store_unit_unq_no, ptcl.unit_gubun
|
|
178
|
+ , odr.podr_dtl_st_cd, fn_code_nm(upper('podr_dtl_st_cd'), odr.podr_dtl_st_cd) as podr_dtl_st_nm
|
|
179
|
+ FROM pch_req_dtl_ptcl ptcl
|
|
180
|
+ left outer join pch_odr_dtl_ptcl odr on odr.pch_req_unq_no = ptcl.pch_req_unq_no and odr.pch_req_dtl_no = ptcl.pch_req_dtl_no
|
|
181
|
+ WHERE ptcl.pch_req_unq_no = #{pchReqUnqNo}
|
|
182
|
+ </select>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+ <insert id="insertPchReqBaseInfo" >
|
|
186
|
+ INSERT INTO /* PchReq.insertPchReqBaseInfo */ pch_req_base_info
|
|
187
|
+ (pch_req_unq_no, brand_id, store_id, pch_req_nm, pch_req_dept
|
|
188
|
+ , pch_req_mgr_nm, pch_req_dt, pch_req_tm, pch_req_st_cd, pch_req_dvsn
|
|
189
|
+ , note, pch_req_item_qty, pch_req_total_amt, pch_req_rjct_dt, pch_req_rjct_nm
|
|
190
|
+ , pch_req_rjct_rsn, pch_req_mgr_id, pch_req_rjct_id
|
|
191
|
+ , whs_id, location,dlv_req_dt
|
|
192
|
+ , sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
193
|
+ VALUES
|
|
194
|
+ (#{entity.pchReqUnqNo}, #{entity.brandId}, #{entity.storeId}, #{entity.pchReqNm}, #{entity.pchReqDept}
|
|
195
|
+ , #{entity.pchReqMgrNm}, case when #{entity.pchReqStCd} = 'PR20' then date_format(now(),'%Y%m%d') else null end, null, #{entity.pchReqStCd}, #{entity.pchReqDvsn}
|
|
196
|
+ , #{entity.note}, #{entity.pchReqItemQty}, #{entity.pchReqTotalAmt}, null, null
|
|
197
|
+ , null, #{userId}, null
|
|
198
|
+ , #{entity.whsId}, #{entity.location}, #{entity.dlvReqDt}
|
|
199
|
+ , NOW(), #{userId}, NOW(), #{userId})
|
|
200
|
+ </insert>
|
|
201
|
+
|
|
202
|
+ <update id="updateOrdPchReqBaseInfo">
|
|
203
|
+ UPDATE /* PchReq.updateOrdPchReqBaseInfo */
|
|
204
|
+ pch_req_base_info SET
|
|
205
|
+ pch_req_dt = case when #{entity.pchReqStCd} = 'PR20' then date_format(now(),'%Y%m%d') else null end ,
|
|
206
|
+ pch_req_st_cd = #{entity.pchReqStCd},
|
|
207
|
+ note = #{entity.note},
|
|
208
|
+ pch_req_item_qty = #{entity.pchReqItemQty},
|
|
209
|
+ pch_req_total_amt = #{entity.pchReqTotalAmt},
|
|
210
|
+ whs_id = #{entity.whsId},
|
|
211
|
+ location = #{entity.location},
|
|
212
|
+ dlv_req_dt = #{entity.dlvReqDt},
|
|
213
|
+ sys_chg_dttm = NOW(),
|
|
214
|
+ sys_chg_id = #{userId}
|
|
215
|
+ WHERE brand_id = #{entity.brandId}
|
|
216
|
+ and pch_req_unq_no = #{entity.pchReqUnqNo}
|
|
217
|
+ </update>
|
|
218
|
+
|
|
219
|
+ <update id="updateRejPchReqBaseInfo">
|
|
220
|
+ UPDATE /* PchReq.updateRejPchReqBaseInfo */
|
|
221
|
+ pch_req_base_info SET
|
|
222
|
+ pch_req_rjct_nm = #{pchReqRjctNm},
|
|
223
|
+ pch_req_rjct_dt = date_format(now(),'%Y%m%d'),
|
|
224
|
+ pch_req_rjct_rsn = #{pchReqRjctRsn},
|
|
225
|
+ pch_req_rjct_id = #{userId},
|
|
226
|
+ sys_chg_dttm = NOW(),
|
|
227
|
+ sys_chg_id = #{userId}
|
|
228
|
+ WHERE pch_req_unq_no = #{pchReqUnqNo}
|
|
229
|
+ </update>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+ <insert id="insertPchReqDtlPtcl" >
|
|
233
|
+ INSERT INTO /* PchReq.insertPchReqDtlPtcl */ pch_req_dtl_ptcl
|
|
234
|
+ (pch_req_unq_no, pch_req_dtl_no, item_nm, unit, pch_req_qty
|
|
235
|
+ , pch_req_amt, unit_amt, unit_gubun, brand_unit_unq_no, store_unit_unq_no
|
|
236
|
+ , item_id, sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
237
|
+ VALUES
|
|
238
|
+ <foreach collection="gridInsertData" item="item" separator=",">
|
|
239
|
+ (#{item.pchReqUnqNo}, #{item.pchReqDtlNo}, #{item.itemNm}, #{item.unit}, #{item.pchReqQty}
|
|
240
|
+ , #{item.pchReqAmt}, #{item.unitAmt}, #{item.unitGubun} , #{item.brandUnitUnqNo} , #{item.storeUnitUnqNo}
|
|
241
|
+ , #{item.itemId} , NOW(), #{userId}, NOW(), #{userId})
|
|
242
|
+ </foreach>
|
|
243
|
+
|
|
244
|
+ </insert>
|
|
245
|
+
|
|
246
|
+ <update id="updatePchReqDtlPtcl">
|
|
247
|
+ <foreach collection="gridUpdateData" item="item" separator=";">
|
|
248
|
+ UPDATE /* PchReq.updatePchReqDtlPtcl */
|
|
249
|
+ pch_req_dtl_ptcl SET
|
|
250
|
+ unit = #{item.unit},
|
|
251
|
+ pch_req_qty = #{item.pchReqQty},
|
|
252
|
+ pch_req_amt = #{item.pchReqAmt},
|
|
253
|
+ unit_amt = #{item.unitAmt},
|
|
254
|
+ sys_chg_dttm = NOW(),
|
|
255
|
+ sys_chg_id = #{userId}
|
|
256
|
+ WHERE pch_req_unq_no = #{pchReqUnqNo}
|
|
257
|
+ AND pch_req_dtl_no = #{item.pchReqDtlNo}
|
|
258
|
+ </foreach>
|
|
259
|
+ </update>
|
|
260
|
+
|
|
261
|
+ <delete id="deletePchReqDtlPtcl">
|
|
262
|
+ DELETE /* PchReq.deletePchReqDtlPtcl */
|
|
263
|
+ FROM pch_req_dtl_ptcl
|
|
264
|
+ WHERE pch_req_unq_no = #{pchReqUnqNo}
|
|
265
|
+ and pch_req_dtl_no in
|
|
266
|
+ <foreach collection="gridDeleteData" item="item" separator="," open="(" close=")">
|
|
267
|
+ #{item.pchReqDtlNo}
|
|
268
|
+ </foreach>
|
|
269
|
+
|
|
270
|
+ </delete>
|
|
271
|
+
|
|
272
|
+ <select id="selectMaxPchReqDtlNo" resultType="int">
|
|
273
|
+ SELECT nvl(Max(convert(pch_req_dtl_no,int)),0)
|
|
274
|
+ FROM pch_req_dtl_ptcl
|
|
275
|
+ WHERE pch_req_unq_no = #{pchReqUnqNo}
|
|
276
|
+ </select>
|
|
277
|
+
|
|
278
|
+ <select id="selectSumReqAmt" resultType="com.oqpo.api.entity.pomng.PchReqBaseInfoEntity">
|
|
279
|
+ select count(*) as pch_req_item_qty, nvl(sum(pch_req_amt),0) as pch_req_total_amt
|
|
280
|
+ from pch_req_dtl_ptcl
|
|
281
|
+ where pch_req_unq_no = #{pchReqUnqNo}
|
|
282
|
+ </select>
|
|
283
|
+
|
|
284
|
+ <select id="selectPchReqPoTargetGridList" resultType="com.oqpo.api.entity.pomng.PchReqBaseInfoEntity">
|
|
285
|
+ select base.pch_req_unq_no, ptcl.pch_req_dtl_no as 'pchReqDtlInfo.pch_req_dtl_no', base.brand_id, fn_brand_nm(base.brand_id) as brand_nm
|
|
286
|
+ , base.store_id, store.store_nm
|
|
287
|
+ , bitem.spply_nm as 'itemUnitInfo.spply_nm'
|
|
288
|
+ , 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
|
|
289
|
+ , ptcl.item_id as 'pchReqDtlInfo.item_id', ptcl.item_nm as 'pchReqDtlInfo.item_nm', ptcl.unit_amt as 'pchReqDtlInfo.unit_amt'
|
|
290
|
+ , bitem.unit_amt as 'itemUnitInfo.unit_amt' , ptcl.pch_req_qty as 'pchReqDtlInfo.pch_req_qty', date_format(base.dlv_req_dt, '%Y.%m.%d') as dlv_req_dt
|
|
291
|
+ , ptcl.pch_req_amt as 'pchReqDtlInfo.pch_req_amt', bitem.unit_amt * ptcl.pch_req_qty as 'pchReqDtlInfo.pch_ord_amt'
|
|
292
|
+ , bitem.lead_time as 'itemUnitInfo.lead_time', bitem.spply_id as 'itemUnitInfo.spply_id', base.whs_id, base.location
|
|
293
|
+ from pch_req_base_info base
|
|
294
|
+ join pch_req_dtl_ptcl ptcl on base.pch_req_unq_no = ptcl.pch_req_unq_no
|
|
295
|
+ join brand_item_unit_info bitem on ptcl.brand_unit_unq_no = bitem.brand_unit_unq_no
|
|
296
|
+ left outer join store_base_info store on base.brand_id = store.brand_id and base.store_id = store.store_id
|
|
297
|
+ where 1 = 1
|
|
298
|
+ and base.brand_id = #{sBrandId}
|
|
299
|
+ and base.pch_req_st_cd = 'PR20'
|
|
300
|
+ and base.dlv_req_dt between #{fromDt} and #{toDt}
|
|
301
|
+ <if test="sSpplyId != null and sSpplyId != ''">
|
|
302
|
+ and bitem.spply_id = #{sSpplyId}
|
|
303
|
+ </if>
|
|
304
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
305
|
+ and base.whs_id = #{sWhsId}
|
|
306
|
+ </if>
|
|
307
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
308
|
+ and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
|
|
309
|
+ </if>
|
|
310
|
+ <choose>
|
|
311
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
312
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
313
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
314
|
+ order by base.dlv_req_dt asc, base.whs_id, base.location, bitem.spply_id, base.pch_req_unq_no, ptcl.pch_req_dtl_no
|
|
315
|
+ </if>
|
|
316
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
317
|
+ order by base.dlv_req_dt desc, base.whs_id, base.location, bitem.spply_id, base.pch_req_unq_no, ptcl.pch_req_dtl_no
|
|
318
|
+ </if>
|
|
319
|
+ </if>
|
|
320
|
+ </when>
|
|
321
|
+ <otherwise>
|
|
322
|
+ order by base.dlv_req_dt asc, base.whs_id, base.location, bitem.spply_id, base.pch_req_unq_no, ptcl.pch_req_dtl_no
|
|
323
|
+ </otherwise>
|
|
324
|
+ </choose>
|
|
325
|
+ <if test="gridRequest.pagingYn == true">
|
|
326
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
327
|
+ </if>
|
|
328
|
+
|
|
329
|
+ </select>
|
|
330
|
+
|
|
331
|
+ <select id="selectPchReqPoTargetGridCnt" resultType="int">
|
|
332
|
+ select count(*)
|
|
333
|
+ from pch_req_base_info base
|
|
334
|
+ join pch_req_dtl_ptcl ptcl on base.pch_req_unq_no = ptcl.pch_req_unq_no
|
|
335
|
+ join brand_item_unit_info bitem on ptcl.brand_unit_unq_no = bitem.brand_unit_unq_no
|
|
336
|
+ left outer join store_base_info store on base.brand_id = store.brand_id and base.store_id = store.store_id
|
|
337
|
+ where 1 = 1
|
|
338
|
+ and base.brand_id = #{sBrandId}
|
|
339
|
+ and base.pch_req_st_cd = 'PR20'
|
|
340
|
+ and base.dlv_req_dt between #{fromDt} and #{toDt}
|
|
341
|
+ <if test="sSpplyId != null and sSpplyId != ''">
|
|
342
|
+ and bitem.spply_id = #{sSpplyId}
|
|
343
|
+ </if>
|
|
344
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
345
|
+ and base.whs_id = #{sWhsId}
|
|
346
|
+ </if>
|
|
347
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
348
|
+ and (ptcl.item_id like concat('%', #{sItemNm}, '%') or ptcl.item_nm like concat('%', #{sItemNm}, '%'))
|
|
349
|
+ </if>
|
|
350
|
+ </select>
|
|
351
|
+
|
|
352
|
+ <select id="selectPchRejectPrTargetList" resultType="com.oqpo.api.entity.pomng.PchReqDtlPtclEntity">
|
|
353
|
+ select /* PchReq.selectPchRejectPrTargetList */
|
|
354
|
+ base.pch_req_unq_no, ptcl.pch_req_dtl_no
|
|
355
|
+ , ptcl.item_id, ptcl.item_nm
|
|
356
|
+ , ptcl.pch_req_qty, ptcl.pch_req_amt
|
|
357
|
+ from pch_req_base_info base
|
|
358
|
+ , pch_req_dtl_ptcl ptcl
|
|
359
|
+ where 1 = 1
|
|
360
|
+ and base.pch_req_unq_no = ptcl.pch_req_unq_no
|
|
361
|
+ and base.pch_req_st_cd = 'PR20'
|
|
362
|
+ and base.pch_req_unq_no = #{pchReqUnqNo}
|
|
363
|
+ </select>
|
|
364
|
+
|
|
365
|
+ <update id="updatePchReqStCd">
|
|
366
|
+ <foreach collection="gridUpdateData" item="item" separator=";">
|
|
367
|
+ UPDATE /* PchReq.updatePchReqDtlPtcl */
|
|
368
|
+ pch_req_base_info SET
|
|
369
|
+ pch_req_st_cd = #{item.pchReqStCd},
|
|
370
|
+ sys_chg_dttm = NOW(),
|
|
371
|
+ sys_chg_id = #{userId}
|
|
372
|
+ WHERE pch_req_unq_no = #{item.pchReqUnqNo}
|
|
373
|
+ </foreach>
|
|
374
|
+ </update>
|
|
375
|
+-->
|
|
376
|
+
|
|
377
|
+</mapper>
|