|
@@ -0,0 +1,226 @@
|
|
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.stockmng.WhsMngMapper">
|
|
5
|
+
|
|
6
|
+ <select id="selectWhsMngGridList" resultType="com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity">
|
|
7
|
+ /* StockMngMapper.selectWhsMngGridList */
|
|
8
|
+ SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
|
|
9
|
+ A.whs_id, A.whs_nm, A.whs_dvsn, A.mgr_nm, A.mgr_tel_no, A.zip_no,
|
|
10
|
+ A.addr1, A.addr2, A.whs_st_cd, A.store_id,
|
|
11
|
+ DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, A.sys_reg_id, DATE_FORMAT(A.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, A.sys_chg_id
|
|
12
|
+ FROM whs_mgnt_base_info A
|
|
13
|
+ WHERE A.brand_id = #{sBrandId}
|
|
14
|
+ AND A.whs_id = #{entity.whsId}
|
|
15
|
+
|
|
16
|
+ SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
|
|
17
|
+ C.store_id, FN_STORE_NM(A.brand_id, C.store_id) AS store_nm,
|
|
18
|
+ A.whs_id, C.whs_nm, A.location, D.location_nm, A.item_id, E.item_nm, A.unit, A.stck_qty, A.prp_stck_qty,
|
|
19
|
+ A.sft_stck_rt, A.cur_stck_rt
|
|
20
|
+ FROM stck_mgnt_base_info A
|
|
21
|
+ INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
|
|
22
|
+ INNER JOIN whs_mgnt_base_loc D ON A.brand_id = D.brand_id AND A.whs_id = D.whs_id AND A.location = D.location
|
|
23
|
+ INNER JOIN item_base_info E ON A.item_id = E.item_id
|
|
24
|
+ <if test="sItemClass1 != null and sItemClass1 != ''">
|
|
25
|
+ INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
|
|
26
|
+ AND B.item_class1 = #{sItemClass1}
|
|
27
|
+ <if test="sItemClass2 != null and sItemClass2 != ''">
|
|
28
|
+ AND B.item_class2 = #{sItemClass2}
|
|
29
|
+ <if test="sItemClass3 != null and sItemClass3 != ''">
|
|
30
|
+ AND B.item_class3 = #{sItemClass3}
|
|
31
|
+ <if test="sItemClass4 != null and sItemClass4 != ''">
|
|
32
|
+ AND B.item_class4 = #{sItemClass4}
|
|
33
|
+ </if>
|
|
34
|
+ </if>
|
|
35
|
+ </if>
|
|
36
|
+ </if>
|
|
37
|
+ WHERE A.brand_id = #{sBrandId}
|
|
38
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
39
|
+ AND C.store_id = #{sStoreId}
|
|
40
|
+ </if>
|
|
41
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
42
|
+ AND A.whs_id = #{sWhsId}
|
|
43
|
+ </if>
|
|
44
|
+ <if test="sLocation != null and sLocation != ''">
|
|
45
|
+ AND A.location = #{sLocation}
|
|
46
|
+ </if>
|
|
47
|
+ <if test="sItemId != null and sItemId != ''">
|
|
48
|
+ AND A.item_id = #{sItemId}
|
|
49
|
+ </if>
|
|
50
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
51
|
+ AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
|
52
|
+ </if>
|
|
53
|
+ <choose>
|
|
54
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
55
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
56
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
57
|
+ ORDER BY A.item_id ASC
|
|
58
|
+ </if>
|
|
59
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
60
|
+ ORDER BY A.item_id DESC
|
|
61
|
+ </if>
|
|
62
|
+ </if>
|
|
63
|
+ </when>
|
|
64
|
+ <otherwise>
|
|
65
|
+ ORDER BY A.item_id ASC
|
|
66
|
+ </otherwise>
|
|
67
|
+ </choose>
|
|
68
|
+ <if test="gridRequest.pagingYn == true">
|
|
69
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
70
|
+ </if>
|
|
71
|
+ </select>
|
|
72
|
+
|
|
73
|
+ <select id="selectStockMngGridCnt" resultType="int">
|
|
74
|
+ /* StockMngMapper.selectStockMngGridCnt */
|
|
75
|
+ SELECT COUNT(*)
|
|
76
|
+ FROM stck_mgnt_base_info A
|
|
77
|
+ INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
|
|
78
|
+ INNER JOIN whs_mgnt_base_loc D ON A.brand_id = D.brand_id AND A.whs_id = D.whs_id AND A.location = D.location
|
|
79
|
+ INNER JOIN item_base_info E ON A.item_id = E.item_id
|
|
80
|
+ <if test="sItemClass1 != null and sItemClass1 != ''">
|
|
81
|
+ INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
|
|
82
|
+ AND B.item_class1 = #{sItemClass1}
|
|
83
|
+ <if test="sItemClass2 != null and sItemClass2 != ''">
|
|
84
|
+ AND B.item_class2 = #{sItemClass2}
|
|
85
|
+ <if test="sItemClass3 != null and sItemClass3 != ''">
|
|
86
|
+ AND B.item_class3 = #{sItemClass3}
|
|
87
|
+ <if test="sItemClass4 != null and sItemClass4 != ''">
|
|
88
|
+ AND B.item_class4 = #{sItemClass4}
|
|
89
|
+ </if>
|
|
90
|
+ </if>
|
|
91
|
+ </if>
|
|
92
|
+ </if>
|
|
93
|
+ WHERE A.brand_id = #{sBrandId}
|
|
94
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
95
|
+ AND C.store_id = #{sStoreId}
|
|
96
|
+ </if>
|
|
97
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
98
|
+ AND A.whs_id = #{sWhsId}
|
|
99
|
+ </if>
|
|
100
|
+ <if test="sLocation != null and sLocation != ''">
|
|
101
|
+ AND A.location = #{sLocation}
|
|
102
|
+ </if>
|
|
103
|
+ <if test="sItemId != null and sItemId != ''">
|
|
104
|
+ AND A.item_id = #{sItemId}
|
|
105
|
+ </if>
|
|
106
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
107
|
+ AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
|
108
|
+ </if>
|
|
109
|
+ </select>
|
|
110
|
+
|
|
111
|
+ <select id="selectStckMgntBaseInfo" resultType="com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity">
|
|
112
|
+ /* StockMngMapper.selectStckMgntBaseInfo */
|
|
113
|
+ SELECT A.brand_id, A.whs_id, A.location, A.item_id, A.unit, A.stck_qty, A.prp_stck_qty, A.sft_stck_rt, A.cur_stck_rt,
|
|
114
|
+ DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, A.sys_reg_id, DATE_FORMAT(A.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, A.sys_chg_id,
|
|
115
|
+ B.item_nm
|
|
116
|
+ FROM stck_mgnt_base_info A
|
|
117
|
+ LEFT JOIN item_base_info B ON A.item_id = B.item_id
|
|
118
|
+ WHERE A.brand_id = #{brandId}
|
|
119
|
+ AND A.whs_id = #{whsId}
|
|
120
|
+ AND A.location = #{location}
|
|
121
|
+ AND A.item_id = #{itemId}
|
|
122
|
+ </select>
|
|
123
|
+
|
|
124
|
+ <insert id="insertStckMgntBaseInfo" >
|
|
125
|
+ /* StockMngMapper.insertStckMgntBaseInfo */
|
|
126
|
+ INSERT INTO stck_mgnt_base_info
|
|
127
|
+ (brand_id, whs_id, location, item_id, unit, stck_qty, prp_stck_qty, sft_stck_rt, cur_stck_rt,
|
|
128
|
+ sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
129
|
+ VALUES
|
|
130
|
+ (#{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId}, #{entity.unit}, #{entity.stckQty},
|
|
131
|
+ #{entity.prpStckQty}, #{entity.sftStckRt}, #{entity.curStckRt},
|
|
132
|
+ NOW(), #{userId}, NOW(), #{userId})
|
|
133
|
+ </insert>
|
|
134
|
+
|
|
135
|
+ <update id="updateStckMgntBaseInfo4StckProc" >
|
|
136
|
+ /* StockMngMapper.updateStckMgntBaseInfo4StckProc */
|
|
137
|
+ UPDATE stck_mgnt_base_info SET
|
|
138
|
+ stck_qty = #{entity.stckQty}, /* 재고수량 */
|
|
139
|
+ cur_stck_rt = #{entity.curStckRt}, /* 현재고비율 */
|
|
140
|
+ sys_chg_dttm = NOW(),
|
|
141
|
+ sys_chg_id = #{userId}
|
|
142
|
+ WHERE brand_id = #{entity.brandId}
|
|
143
|
+ AND whs_id = #{entity.whsId}
|
|
144
|
+ AND location = #{entity.location}
|
|
145
|
+ AND item_id = #{entity.itemId}
|
|
146
|
+ </update>
|
|
147
|
+
|
|
148
|
+ <update id="updateStckMgntBaseInfo4BaseChg" >
|
|
149
|
+ /* StockMngMapper.updateStckMgntBaseInfo4BaseChg */
|
|
150
|
+ UPDATE stck_mgnt_base_info SET
|
|
151
|
+ prp_stck_qty = #{entity.prpStckQty}, /* 적정재고수량 */
|
|
152
|
+ sft_stck_rt = #{entity.sftStckRt}, /* 안전재고비율 */
|
|
153
|
+ sys_chg_dttm = NOW(),
|
|
154
|
+ sys_chg_id = #{userId}
|
|
155
|
+ WHERE brand_id = #{entity.brandId}
|
|
156
|
+ AND whs_id = #{entity.whsId}
|
|
157
|
+ AND location = #{entity.location}
|
|
158
|
+ AND item_id = #{entity.itemId}
|
|
159
|
+ </update>
|
|
160
|
+
|
|
161
|
+ <insert id="insertStckMgntDtlHist" >
|
|
162
|
+ /* StockMngMapper.insertStckMgntDtlHist */
|
|
163
|
+ INSERT INTO stck_mgnt_dtl_hist
|
|
164
|
+ (stck_mgnt_dtl_no, brand_id, whs_id, location, item_id, item_nm, inout_cd, inout_qty, whs_mgnt_unq_no,
|
|
165
|
+ rtn_mgnt_unq_no, chg_dvsn, sys_reg_dttm,
|
|
166
|
+ sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
167
|
+ VALUES
|
|
168
|
+ (#{entity.stckMgntDtlNo}, #{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId},
|
|
169
|
+ #{entity.itemNm}, #{entity.inoutCd}, #{entity.inoutQty}, #{entity.whsMgntUnqNo}, #{entity.rtnMgntUnqNo}, #{entity.chgDvsn},
|
|
170
|
+ NOW(), #{userId}, NOW(), #{userId})
|
|
171
|
+ </insert>
|
|
172
|
+
|
|
173
|
+ <select id="selectStockHistGridList" resultType="com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity">
|
|
174
|
+ /* StockMngMapper.selectStockHistGridList */
|
|
175
|
+ SELECT A.stck_mgnt_dtl_no,
|
|
176
|
+ A.inout_cd, FN_CODE_NM('INOUT_CD', A.inout_cd) AS inout_nm, A.inout_qty,
|
|
177
|
+ IFNULL(A.whs_mgnt_unq_no, A.rtn_mgnt_unq_no) AS relation_no, /* 관련번호 */
|
|
178
|
+ 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
|
|
179
|
+ FROM stck_mgnt_dtl_hist A
|
|
180
|
+ WHERE A.brand_id = #{sBrandId}
|
|
181
|
+ AND A.whs_id = #{sWhsId}
|
|
182
|
+ AND A.location = #{sLocation}
|
|
183
|
+ AND A.item_id = #{sItemId}
|
|
184
|
+ <if test="sInoutCd != null and sInoutCd != ''">
|
|
185
|
+ AND A.inout_cd = #{sInoutCd}
|
|
186
|
+ </if>
|
|
187
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
188
|
+ AND A.sys_reg_dttm BETWEEN STR_TO_DATE(CONCAT(#{fromDt},'000000'),'%Y%m%d%H%i%S') AND STR_TO_DATE(CONCAT(#{toDt},'000000'),'%Y%m%d%H%i%S')
|
|
189
|
+ </if>
|
|
190
|
+ <choose>
|
|
191
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
192
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
193
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
194
|
+ ORDER BY A.stck_mgnt_dtl_no ASC
|
|
195
|
+ </if>
|
|
196
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
197
|
+ ORDER BY A.stck_mgnt_dtl_no DESC
|
|
198
|
+ </if>
|
|
199
|
+ </if>
|
|
200
|
+ </when>
|
|
201
|
+ <otherwise>
|
|
202
|
+ ORDER BY A.stck_mgnt_dtl_no ASC
|
|
203
|
+ </otherwise>
|
|
204
|
+ </choose>
|
|
205
|
+ <if test="gridRequest.pagingYn == true">
|
|
206
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
207
|
+ </if>
|
|
208
|
+ </select>
|
|
209
|
+
|
|
210
|
+ <select id="selectStockHistGridCnt" resultType="int">
|
|
211
|
+ /* StockMngMapper.selectStockHistGridCnt */
|
|
212
|
+ SELECT COUNT(*)
|
|
213
|
+ FROM stck_mgnt_dtl_hist A
|
|
214
|
+ WHERE A.brand_id = #{sBrandId}
|
|
215
|
+ AND A.whs_id = #{sWhsId}
|
|
216
|
+ AND A.location = #{sLocation}
|
|
217
|
+ AND A.item_id = #{sItemId}
|
|
218
|
+ <if test="sInoutCd != null and sInoutCd != ''">
|
|
219
|
+ AND A.inout_cd = #{sInoutCd}
|
|
220
|
+ </if>
|
|
221
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != '' ">
|
|
222
|
+ AND A.sys_reg_dttm BETWEEN STR_TO_DATE(CONCAT(#{fromDt},'000000'),'%Y%m%d%H%i%S') AND STR_TO_DATE(CONCAT(#{toDt},'000000'),'%Y%m%d%H%i%S')
|
|
223
|
+ </if>
|
|
224
|
+ </select>
|
|
225
|
+
|
|
226
|
+</mapper>
|