|
@@ -235,34 +235,58 @@
|
235
|
235
|
|
236
|
236
|
<select id="selectStockHistGridList" resultType="com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity">
|
237
|
237
|
/* StockMngMapper.selectStockHistGridList */
|
238
|
|
- SELECT A.stck_mgnt_dtl_no,
|
239
|
|
- A.inout_cd, FN_CODE_NM('INOUT_CD', A.inout_cd) AS inout_nm, A.inout_qty,
|
240
|
|
- A.relation_no AS relation_no, /* 관련번호 */
|
241
|
|
- A.chg_dvsn, FN_CODE_NM('CHG_DVSN', A.chg_dvsn) AS chg_dvsn_nm, DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d') AS sys_reg_dttm
|
242
|
|
- FROM stck_mgnt_dtl_hist A
|
243
|
|
- WHERE A.brand_id = #{sBrandId}
|
244
|
|
- AND A.whs_id = #{sWhsId}
|
245
|
|
- AND A.location = #{sLocation}
|
246
|
|
- AND A.item_id = #{sItemId}
|
247
|
|
- <if test="sInoutCd != null and sInoutCd != ''">
|
248
|
|
- AND A.inout_cd = #{sInoutCd}
|
249
|
|
- </if>
|
250
|
|
- <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
251
|
|
- AND A.sys_reg_dttm BETWEEN STR_TO_DATE(CONCAT(#{fromDt},'000000'),'%Y%m%d%H%i%S') AND STR_TO_DATE(CONCAT(#{toDt},'235959'),'%Y%m%d%H%i%S')
|
252
|
|
- </if>
|
|
238
|
+ select histock.stck_mgnt_dtl_no,
|
|
239
|
+ histock.inout_cd, FN_CODE_NM('INOUT_CD', histock.inout_cd) AS inout_nm, histock.inout_qty,
|
|
240
|
+ histock.relation_no AS relation_no, /* 관련번호 */
|
|
241
|
+ histock.chg_dvsn, FN_CODE_NM('CHG_DVSN', histock.chg_dvsn) AS chg_dvsn_nm, DATE_FORMAT(histock.sys_reg_dttm,'%Y.%m.%d') AS sys_reg_dttm
|
|
242
|
+ from (
|
|
243
|
+ SELECT A.stck_mgnt_dtl_no,
|
|
244
|
+ A.inout_cd, FN_CODE_NM('INOUT_CD', A.inout_cd) AS inout_nm, A.inout_qty,
|
|
245
|
+ A.relation_no AS relation_no, /* 관련번호 */
|
|
246
|
+ A.chg_dvsn, FN_CODE_NM('CHG_DVSN', A.chg_dvsn) AS chg_dvsn_nm, DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d') AS sys_reg_dttm
|
|
247
|
+ FROM stck_mgnt_dtl_hist A
|
|
248
|
+ WHERE A.brand_id = #{sBrandId}
|
|
249
|
+ AND A.whs_id = #{sWhsId}
|
|
250
|
+ AND A.location = #{sLocation}
|
|
251
|
+ AND A.item_id = #{sItemId}
|
|
252
|
+ <if test="sInoutCd != null and sInoutCd != ''">
|
|
253
|
+ AND A.inout_cd = #{sInoutCd}
|
|
254
|
+ </if>
|
|
255
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
256
|
+ AND A.sys_reg_dttm BETWEEN STR_TO_DATE(CONCAT(#{fromDt},'000000'),'%Y%m%d%H%i%S') AND STR_TO_DATE(CONCAT(#{toDt},'235959'),'%Y%m%d%H%i%S')
|
|
257
|
+ </if>
|
|
258
|
+ union all
|
|
259
|
+ SELECT DATE_FORMAT(a.SYS_CHG_DTTM, '%Y%m%d%H%i%S%f') AS stck_mgnt_dtl_no
|
|
260
|
+ , 'OUT' AS inout_cd, FN_CODE_NM('INOUT_CD', 'OUT') AS inout_nm
|
|
261
|
+ , a.SALE_QTY AS inout_qty, CONCAT(a.OQ_BRAND_ID, '_', a.OQ_MENU_CD) AS relation_no
|
|
262
|
+ , 'SOUT' AS chg_dvsn, FN_CODE_NM('CHG_DVSN', 'SOUT') AS chg_dvsn_nm
|
|
263
|
+ , DATE_FORMAT(a.sys_reg_dttm,'%Y.%m.%d') AS sys_reg_dttm
|
|
264
|
+ FROM stck_sale_mgnt_dtl_hist a
|
|
265
|
+ WHERE 1 = 1
|
|
266
|
+ AND a.BRAND_ID = #{sBrandId}
|
|
267
|
+ AND a.WHS_ID = #{sWhsId}
|
|
268
|
+ AND a.LOCATION = #{sLocation}
|
|
269
|
+ AND a.ITEM_ID = #{sItemId}
|
|
270
|
+ <if test="sInoutCd != null and sInoutCd != ''">
|
|
271
|
+ AND a.inout_cd = #{sInoutCd}
|
|
272
|
+ </if>
|
|
273
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
274
|
+ AND a.BASE_YM BETWEEN STR_TO_DATE(CONCAT(#{fromDt},'000000'),'%Y%m%d%H%i%S') AND STR_TO_DATE(CONCAT(#{toDt},'235959'),'%Y%m%d%H%i%S')
|
|
275
|
+ </if>
|
|
276
|
+ ) histock
|
253
|
277
|
<choose>
|
254
|
278
|
<when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
255
|
279
|
<if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
256
|
280
|
<if test="gridRequest.sord == 'asc'.toString()">
|
257
|
|
- ORDER BY A.stck_mgnt_dtl_no ASC
|
|
281
|
+ ORDER BY histock.stck_mgnt_dtl_no ASC
|
258
|
282
|
</if>
|
259
|
283
|
<if test="gridRequest.sord == 'desc'.toString()">
|
260
|
|
- ORDER BY A.stck_mgnt_dtl_no DESC
|
|
284
|
+ ORDER BY histock.stck_mgnt_dtl_no DESC
|
261
|
285
|
</if>
|
262
|
286
|
</if>
|
263
|
287
|
</when>
|
264
|
288
|
<otherwise>
|
265
|
|
- ORDER BY A.stck_mgnt_dtl_no ASC
|
|
289
|
+ ORDER BY histock.stck_mgnt_dtl_no ASC
|
266
|
290
|
</otherwise>
|
267
|
291
|
</choose>
|
268
|
292
|
<if test="gridRequest.pagingYn == true">
|