浏览代码

Merge branch 'master' of http://106.246.249.162:13000/orderqueen/oqpo-api

dwkim 2 年之前
父节点
当前提交
c94f671b6e

+ 21 - 2
src/main/java/com/oqpo/api/service/stockmng/WhsMngService.java

@@ -57,6 +57,7 @@ public class WhsMngService extends CommonService {
57 57
                         .whsStNm(m.getWhsStNm())
58 58
                         .storeId(m.getStoreId())
59 59
                         .storeNm(m.getStoreNm())
60
+                        .baseYn(m.getBaseYn())
60 61
                         .build())
61 62
                 .collect(Collectors.toList());
62 63
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
@@ -87,6 +88,7 @@ public class WhsMngService extends CommonService {
87 88
                         .stckDvsnNm(m.getStckDvsnNm())
88 89
                         .locStCd(m.getLocStCd())
89 90
                         .locStNm(m.getLocStNm())
91
+                        .locBaseYn(m.getLocBaseYn())
90 92
                         .build())
91 93
                 .collect(Collectors.toList());
92 94
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
@@ -113,10 +115,10 @@ public class WhsMngService extends CommonService {
113 115
             entity.setWhsDvsn(StringUtil.isEmpty(entity.getStoreId()) ? WhsDvsn.BRAND.getCd() : WhsDvsn.STORE.getCd());
114 116
 
115 117
             //브랜드만 체크 작업 진행함
116
-            if ("".equals(saveWhsInfoRequest.getStoreId())) {
118
+            if (StringUtil.isEmpty(saveWhsInfoRequest.getStoreId())) {
117 119
                 // 기본 창고 존재 여부 확인
118 120
                 String baseWhsId = whsMngMapper.selectBaseWhsId(entity.getBrandId());
119
-                if ("Y".toString().equals(entity.getBaseYn())) {
121
+                if ("Y".equals(entity.getBaseYn())) {
120 122
                     if (!"N".equals(baseWhsId)) {
121 123
                         // 기존에 기본이 있고 신규창고가 Y로 오면
122 124
                         // 기존거는 N 및 Location도 N처리함
@@ -177,6 +179,23 @@ public class WhsMngService extends CommonService {
177 179
             entity.setWhsDvsn(StringUtil.isEmpty(entity.getStoreId()) ? WhsDvsn.BRAND.getCd() : WhsDvsn.STORE.getCd());
178 180
             entity.setBaseYn(saveWhsInfoRequest.getBaseYn());
179 181
 
182
+            //브랜드만 체크 작업 진행함
183
+            if (StringUtil.isEmpty(saveWhsInfoRequest.getStoreId())) {
184
+                // 기본 창고 존재 여부 확인
185
+                String baseWhsId = whsMngMapper.selectBaseWhsId(entity.getBrandId());
186
+                if ("Y".equals(entity.getBaseYn())) {
187
+                    if (!"N".equals(baseWhsId)) {
188
+                        // 기존에 기본이 있고 신규창고가 Y로 오면
189
+                        // 기존거는 N 및 Location도 N처리함
190
+                        whsMngMapper.updateClearBaseWhs(entity.getBrandId());
191
+                        whsMngMapper.updateClearBaseWhsLoc(entity.getBrandId(), baseWhsId);
192
+                    }
193
+                } else {
194
+                    if ("N".equals(baseWhsId)) {
195
+                        entity.setBaseYn("Y");
196
+                    }
197
+                }
198
+            }
180 199
             whsMngMapper.updateWhsMgntBaseInfo(userId, entity);
181 200
 
182 201
             // 창고로케이션정보

+ 3 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/LocInfoListResponse.java

@@ -27,4 +27,7 @@ public class LocInfoListResponse {
27 27
     @ApiModelProperty(value = "창고상태명")
28 28
     private String locStNm;
29 29
 
30
+    @ApiModelProperty(value = "로케이션 기본여부")
31
+    private String locBaseYn;
32
+
30 33
 }

+ 4 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/WhsMngInfoResponse.java

@@ -51,6 +51,9 @@ public class WhsMngInfoResponse {
51 51
     @ApiModelProperty(value = "시스템변경아이디")
52 52
     private String sysChgId;
53 53
 
54
+    @ApiModelProperty(value = "창고기본여부")
55
+    private String baseYn;
56
+
54 57
     public static WhsMngInfoResponse toDTO(WhsMgntBaseInfoEntity entity) {
55 58
         if (entity == null) return null;
56 59
         return WhsMngInfoResponse.builder()
@@ -73,6 +76,7 @@ public class WhsMngInfoResponse {
73 76
                 .sysRegId(entity.getSysRegId())
74 77
                 .sysChgDttm(entity.getSysChgDttm())
75 78
                 .sysChgId(entity.getSysChgId())
79
+                .baseYn(entity.getBaseYn())
76 80
                 .build();
77 81
     }
78 82
 

+ 2 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/WhsMngListResponse.java

@@ -41,5 +41,7 @@ public class WhsMngListResponse {
41 41
     @ApiModelProperty(value = "담당자전화번호")
42 42
     private String mgrTelNo;
43 43
 
44
+    @ApiModelProperty(value = "창고기본여부")
45
+    private String baseYn;
44 46
 
45 47
 }

+ 17 - 14
src/main/resources/mybatis/sqlmaps/stockmng/WhsMng.xml

@@ -8,7 +8,8 @@
8 8
         SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
9 9
             A.whs_id, A.whs_nm, A.whs_dvsn, FN_CODE_NM('WHS_DVSN', A.whs_dvsn) AS whs_dvsn_nm,
10 10
             A.mgr_nm, FN_GET_TELNO(A.mgr_tel_no) AS mgr_tel_no, A.whs_st_cd, FN_CODE_NM('WHS_ST_CD', A.whs_st_cd) AS whs_st_nm,
11
-            A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm
11
+            A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
12
+            A.base_yn
12 13
         FROM whs_mgnt_base_info A
13 14
         WHERE A.brand_id = #{sBrandId}
14 15
         <if test="sStoreId != null and sStoreId != ''">
@@ -69,6 +70,7 @@
69 70
             A.mgr_nm, FN_GET_TELNO(A.mgr_tel_no) AS mgr_tel_no, A.zip_no,
70 71
             A.addr1, A.addr2, A.whs_st_cd, FN_CODE_NM('WHS_ST_CD', A.whs_st_cd) AS whs_st_nm,
71 72
             A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
73
+            A.base_yn,
72 74
             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
73 75
         FROM whs_mgnt_base_info A
74 76
         WHERE A.brand_id = #{brandId}
@@ -84,7 +86,8 @@
84 86
         /* WhsMngMapper.selectWhsLocGridList */
85 87
         SELECT A.brand_id, A.whs_id, A.location, A.location_nm,
86 88
             A.stck_dvsn, FN_CODE_NM('STCK_DVSN', A.stck_dvsn) AS stck_dvsn_nm,
87
-            A.loc_st_cd, FN_CODE_NM('LOC_ST_CD', A.loc_st_cd) AS loc_st_nm
89
+            A.loc_st_cd, FN_CODE_NM('LOC_ST_CD', A.loc_st_cd) AS loc_st_nm,
90
+            A.loc_base_yn
88 91
         FROM whs_mgnt_base_loc A
89 92
         WHERE A.brand_id = #{brandId}
90 93
         AND A.whs_id = #{whsId}
@@ -170,7 +173,7 @@
170 173
             location_nm = #{entity.locationNm},
171 174
             stck_dvsn = #{entity.stckDvsn},
172 175
             loc_st_cd = #{entity.locStCd},
173
-            loc_base_yn = #{entity.baseYn},
176
+            loc_base_yn = #{entity.locBaseYn},
174 177
             sys_chg_dttm = NOW(),
175 178
             sys_chg_id = #{entity.sysChgId}
176 179
         WHERE brand_id = #{entity.brandId}
@@ -287,11 +290,11 @@
287 290
 
288 291
     <select id="selectBaseWhsId" resultType="String">
289 292
         /* WhsMngMapper.selectBaseWhsId */
290
-        SELECT nvl(whs_id,'N') as whs_id
293
+        SELECT NVL(whs_id,'N') as whs_id
291 294
         FROM whs_mgnt_base_info A
292 295
         WHERE A.brand_id = #{brandId}
293
-        AND   A.base_yn = 'Y'
294
-        AND   A.store_id is null or A.store_id <![CDATA[ <> ]]> ''
296
+        AND A.base_yn = 'Y'
297
+        AND (A.store_id IS NULL OR A.store_id = '')
295 298
         limit 1
296 299
     </select>
297 300
 
@@ -305,17 +308,17 @@
305 308
     </select>
306 309
 
307 310
     <update id="updateClearBaseWhs">
308
-        update whs_mgnt_base_info
309
-        set    base_yn = 'N'
310
-        where  brand_id = #{brandId}
311
-        AND    store_id is null or store_id <![CDATA[ <> ]]> ''
311
+        UPDATE whs_mgnt_base_info SET
312
+            base_yn = 'N'
313
+        WHERE brand_id = #{brandId}
314
+        AND (store_id IS NULL OR store_id = '')
312 315
     </update>
313 316
 
314 317
     <update id="updateClearBaseWhsLoc">
315
-        update whs_mgnt_base_loc
316
-        set    loc_base_yn = 'N'
317
-        where  brand_id = #{brandId}
318
-        and    whs_id = #{whsId}
318
+        UPDATE whs_mgnt_base_loc SET
319
+            loc_base_yn = 'N'
320
+        WHERE brand_id = #{brandId}
321
+        AND whs_id = #{whsId}
319 322
     </update>
320 323
 
321 324
 </mapper>