Browse Source

브랜드 창고관리 버그 수정

marseyes 2 years ago
parent
commit
3b31d1adaa

+ 35 - 0
src/main/java/com/oqpo/api/enums/WhsDvsn.java

@@ -0,0 +1,35 @@
1
+package com.oqpo.api.enums;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+
6
+public enum WhsDvsn {
7
+
8
+    BRAND("W01", "본사"), //
9
+    STORE("W02", "매장"), //
10
+    ;
11
+
12
+    WhsDvsn(String cd, String nm) {
13
+        this.cd = cd;
14
+        this.name = nm;
15
+    }
16
+
17
+    @Getter
18
+    @Setter
19
+    private String cd;
20
+
21
+    @Getter
22
+    @Setter
23
+    private String name;
24
+
25
+    public static String getName(String ccd) {
26
+        WhsDvsn[] values = WhsDvsn.values();
27
+        for (WhsDvsn icd : values) {
28
+            if (icd.cd.equals(ccd)) {
29
+                return icd.name;
30
+            }
31
+        }
32
+        return ccd;
33
+    }
34
+
35
+}

+ 9 - 5
src/main/java/com/oqpo/api/service/stockmng/WhsMngService.java

@@ -4,9 +4,11 @@ package com.oqpo.api.service.stockmng;
4 4
 import com.oqpo.api.entity.CodeEntity;
5 5
 import com.oqpo.api.entity.stockmng.*;
6 6
 import com.oqpo.api.enums.SystemMessageCode;
7
+import com.oqpo.api.enums.WhsDvsn;
7 8
 import com.oqpo.api.exception.GlobalException;
8 9
 import com.oqpo.api.mapper.stockmng.WhsMngMapper;
9 10
 import com.oqpo.api.service.CommonService;
11
+import com.oqpo.api.util.StringUtil;
10 12
 import com.oqpo.api.web.dto.request.GridRequest;
11 13
 import com.oqpo.api.web.dto.request.stockmng.SaveWhsInfoRequest;
12 14
 import com.oqpo.api.web.dto.response.GridResponse;
@@ -107,6 +109,7 @@ public class WhsMngService extends CommonService {
107 109
             entity.setAddr2(saveWhsInfoRequest.getAddr2());
108 110
             entity.setWhsStCd(saveWhsInfoRequest.getWhsStCd());
109 111
             entity.setStoreId(saveWhsInfoRequest.getStoreId());
112
+            entity.setWhsDvsn(StringUtil.isEmpty(entity.getStoreId()) ? WhsDvsn.BRAND.getCd() : WhsDvsn.STORE.getCd());
110 113
             whsMngMapper.insertWhsMgntBaseInfo(userId, entity);
111 114
 
112 115
             // 창고로케이션정보
@@ -143,6 +146,7 @@ public class WhsMngService extends CommonService {
143 146
             entity.setAddr2(saveWhsInfoRequest.getAddr2());
144 147
             entity.setWhsStCd(saveWhsInfoRequest.getWhsStCd());
145 148
             entity.setStoreId(saveWhsInfoRequest.getStoreId());
149
+            entity.setWhsDvsn(StringUtil.isEmpty(entity.getStoreId()) ? WhsDvsn.BRAND.getCd() : WhsDvsn.STORE.getCd());
146 150
             whsMngMapper.updateWhsMgntBaseInfo(userId, entity);
147 151
 
148 152
             // 창고로케이션정보
@@ -250,7 +254,7 @@ public class WhsMngService extends CommonService {
250 254
         int gridPage = gridRequest.getGridPage();
251 255
         int gridSize = gridRequest.getGridSize();
252 256
 
253
-        int gridRecords = 0 ;
257
+        int gridRecords = 0;
254 258
         int gridTotal = 0;
255 259
 
256 260
         //창고구분(브랜드 W01/매장 W02)
@@ -267,10 +271,10 @@ public class WhsMngService extends CommonService {
267 271
                         .brandNm(m.getBrandNm())
268 272
                         .whsId(m.getWhsId())
269 273
                         .whsNm(m.getWhsNm())
270
-                        .location(m.getLocationInfo() == null ? "" : m.getLocationInfo().getLocation() == null ? "" : m.getLocationInfo().getLocation() )
271
-                        .locationNm(m.getLocationInfo() == null ? "" : m.getLocationInfo().getLocationNm() == null ? "" : m.getLocationInfo().getLocationNm() )
272
-                        .stckDvsn(m.getLocationInfo() == null ? "" : m.getLocationInfo().getStckDvsn() == null ? "" : m.getLocationInfo().getStckDvsn() )
273
-                        .stckDvsnNm(m.getLocationInfo() == null ? "" : m.getLocationInfo().getStckDvsnNm() == null ? "" : m.getLocationInfo().getStckDvsnNm() )
274
+                        .location(m.getLocationInfo() == null ? "" : m.getLocationInfo().getLocation() == null ? "" : m.getLocationInfo().getLocation())
275
+                        .locationNm(m.getLocationInfo() == null ? "" : m.getLocationInfo().getLocationNm() == null ? "" : m.getLocationInfo().getLocationNm())
276
+                        .stckDvsn(m.getLocationInfo() == null ? "" : m.getLocationInfo().getStckDvsn() == null ? "" : m.getLocationInfo().getStckDvsn())
277
+                        .stckDvsnNm(m.getLocationInfo() == null ? "" : m.getLocationInfo().getStckDvsnNm() == null ? "" : m.getLocationInfo().getStckDvsnNm())
274 278
                         .build())
275 279
                 .collect(Collectors.toList());
276 280
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);