Browse Source

창고 관리

marseyes 2 years ago
parent
commit
239dd0435f

+ 3 - 1
src/main/java/com/oqpo/api/mapper/stockmng/WhsMngMapper.java

@@ -20,7 +20,9 @@ public interface WhsMngMapper {
20 20
 
21 21
     WhsMgntBaseInfoEntity selectWhsMgntBaseInfo(@Param("brandId") String brandId, @Param("whsId") String whsId) throws Exception;
22 22
 
23
-    List<WhsMgntBaseLocEntity> selectWhsLocGridList(@Param("brandId") String brandId, @Param("whsId") String whsId) throws Exception;
23
+    List<WhsMgntBaseLocEntity> selectWhsLocGridList(@Param("brandId") String brandId, @Param("whsId") String whsId, GridRequest gridRequest) throws Exception;
24
+
25
+    int selectWhsLocGridCnt(@Param("brandId") String brandId, @Param("whsId") String whsId) throws Exception;
24 26
 
25 27
     int insertWhsMgntBaseInfo(@Param("userId") String userId, WhsMgntBaseInfoEntity entity) throws Exception;
26 28
 

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

@@ -59,8 +59,31 @@ public class WhsMngService extends CommonService {
59 59
     /* 창고관리 정보 조회 */
60 60
     public WhsMngInfoResponse selectWhsMngInfo(String brandId, String whsId) throws Exception {
61 61
         WhsMgntBaseInfoEntity entity = whsMngMapper.selectWhsMgntBaseInfo(brandId, whsId);
62
-        List<WhsMgntBaseLocEntity> locEntityList = whsMngMapper.selectWhsLocGridList(brandId, whsId);
63
-        return WhsMngInfoResponse.toDTO(entity, locEntityList);
62
+        return WhsMngInfoResponse.toDTO(entity);
63
+    }
64
+
65
+    /*
66
+      Location 그리드 리스트 조회
67
+     */
68
+    public GridResponse selectWhsLocGridList(String brandId, String whsId, GridRequest gridRequest) throws Exception {
69
+        int gridPage = gridRequest.getGridPage();
70
+        int gridSize = gridRequest.getGridSize();
71
+
72
+        int gridRecords = whsMngMapper.selectWhsLocGridCnt(brandId, whsId);
73
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
74
+        List<WhsMgntBaseLocEntity> entities = whsMngMapper.selectWhsLocGridList(brandId, whsId, gridRequest);
75
+        List<Object> gridRows = entities.stream()
76
+                .map(m -> LocInfoListResponse.builder()
77
+                        .viewCd("R")
78
+                        .location(m.getLocation())
79
+                        .locationNm(m.getLocationNm())
80
+                        .stckDvsn(m.getStckDvsn())
81
+                        .stckDvsnNm(m.getStckDvsnNm())
82
+                        .locStCd(m.getLocStCd())
83
+                        .locStNm(m.getLocStNm())
84
+                        .build())
85
+                .collect(Collectors.toList());
86
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
64 87
     }
65 88
 
66 89
     /* 창고정보 등록 */

+ 17 - 0
src/main/java/com/oqpo/api/web/controller/stockmng/WhsMngController.java

@@ -64,6 +64,23 @@ public class WhsMngController {
64 64
         return ResponseEntity.ok(whsMngService.selectWhsMngInfo(brandId, whsId));
65 65
     }
66 66
 
67
+    /**
68
+     * 설명 : Location 그리드 리스트
69
+     *
70
+     * @param locationGridRequest
71
+     * @return
72
+     * @throws Exception
73
+     */
74
+    @ApiImplicitParams({
75
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
76
+    })
77
+    @ApiOperation(value = "Location 그리드 리스트")
78
+    @PostMapping("/location-grid-list")
79
+    public ResponseEntity<GridResponse> locationGridList(@RequestBody @Valid LocationGridRequest locationGridRequest) throws Exception {
80
+        return ResponseEntity.ok(whsMngService.selectWhsLocGridList(locationGridRequest.getBrandId(), locationGridRequest.getWhsId(),
81
+                locationGridRequest.toDTO(locationGridRequest)));
82
+    }
83
+
67 84
     /**
68 85
      * 설명 : 창고 신규등록
69 86
      *

+ 21 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/LocationGridRequest.java

@@ -0,0 +1,21 @@
1
+package com.oqpo.api.web.dto.request.stockmng;
2
+
3
+import com.oqpo.api.web.dto.request.GridRequest;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+
9
+@Getter
10
+@Setter
11
+public class LocationGridRequest extends GridRequest {
12
+
13
+    @ApiModelProperty(value = "브랜드아이디")
14
+    private String brandId;
15
+    @ApiModelProperty(value = "창고아이디")
16
+    private String whsId;
17
+
18
+    protected LocationGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
19
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
20
+    }
21
+}

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

@@ -0,0 +1,30 @@
1
+package com.oqpo.api.web.dto.response.stockmng;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+@Getter
8
+@Setter
9
+@Builder
10
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
11
+@JsonInclude(JsonInclude.Include.ALWAYS)
12
+public class LocInfoListResponse {
13
+
14
+    @ApiModelProperty(value = "CRUD")
15
+    private String viewCd;
16
+
17
+    @ApiModelProperty(value = "LOCATION")
18
+    private String location;
19
+    @ApiModelProperty(value = "로케이션명")
20
+    private String locationNm;
21
+    @ApiModelProperty(value = "재고상태구분")
22
+    private String stckDvsn;
23
+    @ApiModelProperty(value = "재고상태구분명")
24
+    private String stckDvsnNm;
25
+    @ApiModelProperty(value = "창고상태코드")
26
+    private String locStCd;
27
+    @ApiModelProperty(value = "창고상태명")
28
+    private String locStNm;
29
+
30
+}

+ 1 - 37
src/main/java/com/oqpo/api/web/dto/response/stockmng/WhsMngInfoResponse.java

@@ -2,14 +2,9 @@ package com.oqpo.api.web.dto.response.stockmng;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonInclude;
4 4
 import com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity;
5
-import com.oqpo.api.entity.stockmng.WhsMgntBaseLocEntity;
6 5
 import io.swagger.annotations.ApiModelProperty;
7 6
 import lombok.*;
8 7
 
9
-import java.util.List;
10
-import java.util.stream.Collectors;
11
-
12
-
13 8
 @Getter
14 9
 @Setter
15 10
 @Builder
@@ -56,10 +51,7 @@ public class WhsMngInfoResponse {
56 51
     @ApiModelProperty(value = "시스템변경아이디")
57 52
     private String sysChgId;
58 53
 
59
-    @ApiModelProperty(value = "위치정보 리스트")
60
-    private List<LocationInfo> locationInfoList;
61
-
62
-    public static WhsMngInfoResponse toDTO(WhsMgntBaseInfoEntity entity, List<WhsMgntBaseLocEntity> locationInfoList) {
54
+    public static WhsMngInfoResponse toDTO(WhsMgntBaseInfoEntity entity) {
63 55
         if (entity == null) return null;
64 56
         return WhsMngInfoResponse.builder()
65 57
                 .brandId(entity.getBrandId())
@@ -81,35 +73,7 @@ public class WhsMngInfoResponse {
81 73
                 .sysRegId(entity.getSysRegId())
82 74
                 .sysChgDttm(entity.getSysChgDttm())
83 75
                 .sysChgId(entity.getSysChgId())
84
-                .locationInfoList(locationInfoList.stream()
85
-                        .map(m -> LocationInfo.builder()
86
-                                .location(m.getLocation())
87
-                                .locationNm(m.getLocationNm())
88
-                                .stckDvsn(m.getStckDvsn())
89
-                                .stckDvsnNm(m.getStckDvsnNm())
90
-                                .locStCd(m.getLocStCd())
91
-                                .locStNm(m.getLocStNm())
92
-                                .build())
93
-                        .collect(Collectors.toList()))
94 76
                 .build();
95 77
     }
96 78
 
97
-    @Getter
98
-    @Builder
99
-    @AllArgsConstructor(access = AccessLevel.PROTECTED)
100
-    static class LocationInfo {
101
-        @ApiModelProperty(value = "LOCATION")
102
-        private String location;
103
-        @ApiModelProperty(value = "로케이션명")
104
-        private String locationNm;
105
-        @ApiModelProperty(value = "재고상태구분")
106
-        private String stckDvsn;
107
-        @ApiModelProperty(value = "재고상태구분명")
108
-        private String stckDvsnNm;
109
-        @ApiModelProperty(value = "창고상태코드")
110
-        private String locStCd;
111
-        @ApiModelProperty(value = "창고상태명")
112
-        private String locStNm;
113
-    }
114
-
115 79
 }

+ 11 - 0
src/main/resources/mybatis/sqlmaps/stockmng/WhsMng.xml

@@ -84,6 +84,17 @@
84 84
         WHERE A.brand_id = #{brandId}
85 85
         AND A.whs_id = #{whsId}
86 86
         ORDER BY A.location ASC
87
+        <if test="gridRequest.pagingYn == true">
88
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
89
+        </if>
90
+    </select>
91
+
92
+    <select id="selectWhsLocGridCnt" resultType="int">
93
+        /* WhsMngMapper.selectWhsLocGridCnt */
94
+        SELECT COUNT(*)
95
+        FROM whs_mgnt_base_loc A
96
+        WHERE A.brand_id = #{brandId}
97
+        AND A.whs_id = #{whsId}
87 98
     </select>
88 99
 
89 100
     <insert id="insertWhsMgntBaseInfo" >