|
@@ -5,76 +5,80 @@
|
5
|
5
|
|
6
|
6
|
<select id="selectStockMngGridList" resultType="com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity">
|
7
|
7
|
/* StockMngMapper.selectStockMngGridList */
|
8
|
|
- SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
|
9
|
|
- C.store_id, FN_STORE_NM(A.brand_id, C.store_id) AS store_nm,
|
10
|
|
- A.whs_id, C.whs_nm, A.location, D.location_nm, A.item_id, E.item_nm, E.unit, A.stck_qty,
|
11
|
|
- A.PRP_STCK_QTY as prp_stck_qty,
|
12
|
|
- A.SFT_STCK_RT as sft_stck_rt,
|
13
|
|
- CASE WHEN A.PRP_STCK_QTY > 0 THEN A.STCK_QTY / A.PRP_STCK_QTY * 100 ELSE 0 END AS cur_stck_rt
|
14
|
|
- /* , A.cur_stck_rt */
|
15
|
|
- FROM stck_mgnt_base_info A
|
16
|
|
- INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
|
17
|
|
- 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
|
18
|
|
- INNER JOIN item_base_info E ON A.item_id = E.item_id
|
19
|
|
- <if test="sItemClass1 != null and sItemClass1 != ''">
|
20
|
|
- INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
|
21
|
|
- AND B.item_class1 = #{sItemClass1}
|
22
|
|
- <if test="sItemClass2 != null and sItemClass2 != ''">
|
23
|
|
- AND B.item_class2 = #{sItemClass2}
|
24
|
|
- <if test="sItemClass3 != null and sItemClass3 != ''">
|
25
|
|
- AND B.item_class3 = #{sItemClass3}
|
26
|
|
- <if test="sItemClass4 != null and sItemClass4 != ''">
|
27
|
|
- AND B.item_class4 = #{sItemClass4}
|
|
8
|
+
|
|
9
|
+ select c.brand_id, c.item_id, c.item_nm, c.unit , c.stck_qty, c.prp_stck_qty, c.sft_stck_rt
|
|
10
|
+ ,c.cur_stck_rt, d.whs_nm, e.location_nm
|
|
11
|
+ ,c.whs_id, c.location, FN_BRAND_NM(c.brand_id) AS brand_nm
|
|
12
|
+ ,d.store_id, FN_STORE_NM(c.brand_id, d.store_id) AS store_nm, c.view_cd
|
|
13
|
+ from (
|
|
14
|
+ select a.brand_id, a.item_id, a.item_nm, a.unit , nvl(b.stck_qty,0) as stck_qty, nvl(b.PRP_STCK_QTY,0) as prp_stck_qty, nvl(b.sft_stck_rt,0) as sft_stck_rt
|
|
15
|
+ ,CASE WHEN b.PRP_STCK_QTY > 0 THEN b.stck_qty / b.PRP_STCK_QTY * 100 ELSE 0 END AS cur_stck_rt /* , A.cur_stck_rt */
|
|
16
|
+ ,#{sWhsId} as whs_id, #{sLocation} as location, case when b.item_id is null then 'C' else 'R' end as view_cd
|
|
17
|
+ from item_base_info a
|
|
18
|
+ left outer join stck_mgnt_base_info b on a.item_id = b.item_id
|
|
19
|
+ and b.brand_id = #{sBrandId}
|
|
20
|
+ <if test="sWhsId != null and sWhsId != ''">
|
|
21
|
+ and b.whs_id = #{sWhsId}
|
|
22
|
+ </if>
|
|
23
|
+ <if test="sLocation != null and sLocation != ''">
|
|
24
|
+ AND b.location = #{sLocation}
|
|
25
|
+ </if>
|
|
26
|
+
|
|
27
|
+ where a.brand_id = #{sBrandId}
|
|
28
|
+ <if test="sItemStCd != null and sItemStCd != ''">
|
|
29
|
+ AND a.item_st_cd = #{sItemStCd}
|
|
30
|
+ </if>
|
|
31
|
+ <if test="sItemType != null and sItemType != ''">
|
|
32
|
+ AND a.item_type = #{sItemType}
|
|
33
|
+ </if>
|
|
34
|
+ <if test='"P".equals(sItemGubun)'>
|
|
35
|
+ AND a.pch_item_yn = 'Y'
|
|
36
|
+ </if>
|
|
37
|
+ <if test='"S".equals(sItemGubun)'>
|
|
38
|
+ AND a.sale_item_yn = 'Y'
|
|
39
|
+ </if>
|
|
40
|
+ <if test="sItemId != null and sItemId != ''">
|
|
41
|
+ AND a.item_id = #{sItemId}
|
|
42
|
+ </if>
|
|
43
|
+ <if test="sItemNm != null and sItemNm != ''">
|
|
44
|
+ AND a.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
|
45
|
+ </if>
|
|
46
|
+ ) c
|
|
47
|
+ INNER JOIN whs_mgnt_base_info d ON c.brand_id = d.brand_id AND c.whs_id = d.whs_id
|
|
48
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
49
|
+ AND d.store_id = #{sStoreId}
|
|
50
|
+ AND d.whs_dvsn = 'W02'
|
|
51
|
+ </if>
|
|
52
|
+ <if test="sStoreId == null or sStoreId == ''">
|
|
53
|
+ AND d.whs_dvsn = 'W01'
|
|
54
|
+ </if>
|
|
55
|
+ INNER JOIN whs_mgnt_base_loc e ON c.brand_id = e.brand_id AND c.whs_id = e.whs_id AND c.location = e.location
|
|
56
|
+ <if test="sItemClass1 != null and sItemClass1 != ''">
|
|
57
|
+ INNER JOIN item_class_ptcl g ON c.item_id = g.item_id
|
|
58
|
+ AND g.item_class1 = #{sItemClass1}
|
|
59
|
+ <if test="sItemClass2 != null and sItemClass2 != ''">
|
|
60
|
+ AND g.item_class2 = #{sItemClass2}
|
|
61
|
+ <if test="sItemClass3 != null and sItemClass3 != ''">
|
|
62
|
+ AND g.item_class3 = #{sItemClass3}
|
|
63
|
+ <if test="sItemClass4 != null and sItemClass4 != ''">
|
|
64
|
+ AND g.item_class4 = #{sItemClass4}
|
|
65
|
+ </if>
|
|
66
|
+ </if>
|
28
|
67
|
</if>
|
29
|
68
|
</if>
|
30
|
|
- </if>
|
31
|
|
- </if>
|
32
|
|
- WHERE A.del_yn = 'N'
|
33
|
|
- AND A.brand_id = #{sBrandId}
|
34
|
|
- <if test="sStoreId != null and sStoreId != ''">
|
35
|
|
- AND C.store_id = #{sStoreId}
|
36
|
|
- AND C.whs_dvsn = 'W02'
|
37
|
|
- </if>
|
38
|
|
- <if test="sStoreId == null or sStoreId == ''">
|
39
|
|
- AND C.whs_dvsn = 'W01'
|
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="sItemStCd != null and sItemStCd != ''">
|
48
|
|
- AND E.item_st_cd = #{sItemStCd}
|
49
|
|
- </if>
|
50
|
|
- <if test="sItemType != null and sItemType != ''">
|
51
|
|
- AND E.item_type = #{sItemType}
|
52
|
|
- </if>
|
53
|
|
- <if test='"P".equals(sItemGubun)'>
|
54
|
|
- AND E.pch_item_yn = 'Y'
|
55
|
|
- </if>
|
56
|
|
- <if test='"S".equals(sItemGubun)'>
|
57
|
|
- AND E.sale_item_yn = 'Y'
|
58
|
|
- </if>
|
59
|
|
- <if test="sItemId != null and sItemId != ''">
|
60
|
|
- AND A.item_id = #{sItemId}
|
61
|
|
- </if>
|
62
|
|
- <if test="sItemNm != null and sItemNm != ''">
|
63
|
|
- AND E.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
64
|
|
- </if>
|
65
|
69
|
<choose>
|
66
|
70
|
<when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
67
|
71
|
<if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
68
|
72
|
<if test="gridRequest.sord == 'asc'.toString()">
|
69
|
|
- ORDER BY A.item_id ASC
|
|
73
|
+ ORDER BY c.item_id ASC
|
70
|
74
|
</if>
|
71
|
75
|
<if test="gridRequest.sord == 'desc'.toString()">
|
72
|
|
- ORDER BY A.item_id DESC
|
|
76
|
+ ORDER BY c.item_id DESC
|
73
|
77
|
</if>
|
74
|
78
|
</if>
|
75
|
79
|
</when>
|
76
|
80
|
<otherwise>
|
77
|
|
- ORDER BY A.item_id ASC
|
|
81
|
+ ORDER BY c.item_id ASC
|
78
|
82
|
</otherwise>
|
79
|
83
|
</choose>
|
80
|
84
|
<if test="gridRequest.pagingYn == true">
|
|
@@ -85,55 +89,61 @@
|
85
|
89
|
<select id="selectStockMngGridCnt" resultType="int">
|
86
|
90
|
/* StockMngMapper.selectStockMngGridCnt */
|
87
|
91
|
SELECT COUNT(*)
|
88
|
|
- FROM stck_mgnt_base_info A
|
89
|
|
- INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
|
90
|
|
- 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
|
91
|
|
- INNER JOIN item_base_info E ON A.item_id = E.item_id
|
92
|
|
- <if test="sItemClass1 != null and sItemClass1 != ''">
|
93
|
|
- INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
|
94
|
|
- AND B.item_class1 = #{sItemClass1}
|
95
|
|
- <if test="sItemClass2 != null and sItemClass2 != ''">
|
96
|
|
- AND B.item_class2 = #{sItemClass2}
|
97
|
|
- <if test="sItemClass3 != null and sItemClass3 != ''">
|
98
|
|
- AND B.item_class3 = #{sItemClass3}
|
99
|
|
- <if test="sItemClass4 != null and sItemClass4 != ''">
|
100
|
|
- AND B.item_class4 = #{sItemClass4}
|
101
|
|
- </if>
|
102
|
|
- </if>
|
103
|
|
- </if>
|
104
|
|
- </if>
|
105
|
|
- WHERE A.del_yn = 'N'
|
106
|
|
- AND A.brand_id = #{sBrandId}
|
107
|
|
- <if test="sStoreId != null and sStoreId != ''">
|
108
|
|
- AND C.store_id = #{sStoreId}
|
109
|
|
- AND C.whs_dvsn = 'W02'
|
110
|
|
- </if>
|
111
|
|
- <if test="sStoreId == null or sStoreId == ''">
|
112
|
|
- AND C.whs_dvsn = 'W01'
|
113
|
|
- </if>
|
|
92
|
+ from (
|
|
93
|
+ select a.brand_id, a.item_id, a.item_nm, a.unit , nvl(b.stck_qty,0) as stck_qty, nvl(b.PRP_STCK_QTY,0) as prp_stck_qty, nvl(b.sft_stck_rt,0) as sft_stck_rt
|
|
94
|
+ ,CASE WHEN b.PRP_STCK_QTY > 0 THEN b.stck_qty / b.PRP_STCK_QTY * 100 ELSE 0 END AS cur_stck_rt /* , A.cur_stck_rt */
|
|
95
|
+ ,#{sWhsId} as whs_id, #{sLocation} as location
|
|
96
|
+ from item_base_info a
|
|
97
|
+ left outer join stck_mgnt_base_info b on a.item_id = b.item_id
|
|
98
|
+ and b.brand_id = #{sBrandId}
|
114
|
99
|
<if test="sWhsId != null and sWhsId != ''">
|
115
|
|
- AND A.whs_id = #{sWhsId}
|
|
100
|
+ and b.whs_id = #{sWhsId}
|
116
|
101
|
</if>
|
117
|
102
|
<if test="sLocation != null and sLocation != ''">
|
118
|
|
- AND A.location = #{sLocation}
|
|
103
|
+ AND b.location = #{sLocation}
|
119
|
104
|
</if>
|
|
105
|
+
|
|
106
|
+ where a.brand_id = #{sBrandId}
|
120
|
107
|
<if test="sItemStCd != null and sItemStCd != ''">
|
121
|
|
- AND E.item_st_cd = #{sItemStCd}
|
|
108
|
+ AND a.item_st_cd = #{sItemStCd}
|
122
|
109
|
</if>
|
123
|
110
|
<if test="sItemType != null and sItemType != ''">
|
124
|
|
- AND E.item_type = #{sItemType}
|
|
111
|
+ AND a.item_type = #{sItemType}
|
125
|
112
|
</if>
|
126
|
113
|
<if test='"P".equals(sItemGubun)'>
|
127
|
|
- AND E.pch_item_yn = 'Y'
|
|
114
|
+ AND a.pch_item_yn = 'Y'
|
128
|
115
|
</if>
|
129
|
116
|
<if test='"S".equals(sItemGubun)'>
|
130
|
|
- AND E.sale_item_yn = 'Y'
|
|
117
|
+ AND a.sale_item_yn = 'Y'
|
131
|
118
|
</if>
|
132
|
119
|
<if test="sItemId != null and sItemId != ''">
|
133
|
|
- AND A.item_id = #{sItemId}
|
|
120
|
+ AND a.item_id = #{sItemId}
|
134
|
121
|
</if>
|
135
|
122
|
<if test="sItemNm != null and sItemNm != ''">
|
136
|
|
- AND E.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
|
123
|
+ AND a.item_nm LIKE CONCAT('%',#{sItemNm},'%')
|
|
124
|
+ </if>
|
|
125
|
+ ) c
|
|
126
|
+ INNER JOIN whs_mgnt_base_info d ON c.brand_id = d.brand_id AND c.whs_id = d.whs_id
|
|
127
|
+ <if test="sStoreId != null and sStoreId != ''">
|
|
128
|
+ AND d.store_id = #{sStoreId}
|
|
129
|
+ AND d.whs_dvsn = 'W02'
|
|
130
|
+ </if>
|
|
131
|
+ <if test="sStoreId == null or sStoreId == ''">
|
|
132
|
+ AND d.whs_dvsn = 'W01'
|
|
133
|
+ </if>
|
|
134
|
+ INNER JOIN whs_mgnt_base_loc e ON c.brand_id = e.brand_id AND c.whs_id = e.whs_id AND c.location = e.location
|
|
135
|
+ <if test="sItemClass1 != null and sItemClass1 != ''">
|
|
136
|
+ INNER JOIN item_class_ptcl g ON c.item_id = g.item_id
|
|
137
|
+ AND g.item_class1 = #{sItemClass1}
|
|
138
|
+ <if test="sItemClass2 != null and sItemClass2 != ''">
|
|
139
|
+ AND g.item_class2 = #{sItemClass2}
|
|
140
|
+ <if test="sItemClass3 != null and sItemClass3 != ''">
|
|
141
|
+ AND g.item_class3 = #{sItemClass3}
|
|
142
|
+ <if test="sItemClass4 != null and sItemClass4 != ''">
|
|
143
|
+ AND g.item_class4 = #{sItemClass4}
|
|
144
|
+ </if>
|
|
145
|
+ </if>
|
|
146
|
+ </if>
|
137
|
147
|
</if>
|
138
|
148
|
</select>
|
139
|
149
|
|