Browse Source

재고 관리 개발중

marseyes 2 years ago
parent
commit
82cc1d7310

+ 56 - 0
src/main/java/com/oqpo/api/entity/stockmng/StckCddMgntInfoEntity.java

@@ -0,0 +1,56 @@
1
+package com.oqpo.api.entity.stockmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.Setter;
6
+import lombok.ToString;
7
+
8
+import java.io.Serializable;
9
+
10
+@Getter
11
+@Setter
12
+@ToString
13
+public class StckCddMgntInfoEntity implements Serializable {
14
+
15
+    @ApiModelProperty(value = "실사아이디")
16
+    private String cddId;
17
+    @ApiModelProperty(value = "실사일자")
18
+    private String cddDt;
19
+    @ApiModelProperty(value = "실사시각")
20
+    private String cddTm;
21
+    @ApiModelProperty(value = "실사구분")
22
+    private String cddDvsn;
23
+    @ApiModelProperty(value = "단위")
24
+    private String unit;
25
+    @ApiModelProperty(value = "전산기존수량")
26
+    private String comExstQty;
27
+    @ApiModelProperty(value = "실사수량")
28
+    private String cddQty;
29
+    @ApiModelProperty(value = "변동수량")
30
+    private String chgQty;
31
+    @ApiModelProperty(value = "실사담당자명")
32
+    private String cddMgrNm;
33
+    @ApiModelProperty(value = "창고아이디")
34
+    private String whsId;
35
+    @ApiModelProperty(value = "창고명")
36
+    private String whsNm;
37
+    @ApiModelProperty(value = "품목아이디")
38
+    private String itemId;
39
+    @ApiModelProperty(value = "LOCATION")
40
+    private String location;
41
+    @ApiModelProperty(value = "브랜드아이디")
42
+    private String brandId;
43
+    @ApiModelProperty(value = "품목명")
44
+    private String itemNm;
45
+    @ApiModelProperty(value = "재고수량")
46
+    private String stckQty;
47
+    @ApiModelProperty(value = "시스템등록일시")
48
+    private String sysRegDttm;
49
+    @ApiModelProperty(value = "시스템등록아이디")
50
+    private String sysRegId;
51
+    @ApiModelProperty(value = "시스템변경일시")
52
+    private String sysChgDttm;
53
+    @ApiModelProperty(value = "시스템변경아이디")
54
+    private String sysChgId;
55
+
56
+}

+ 55 - 0
src/main/java/com/oqpo/api/entity/stockmng/StckMgntBaseInfoEntity.java

@@ -0,0 +1,55 @@
1
+package com.oqpo.api.entity.stockmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.Setter;
6
+import lombok.ToString;
7
+
8
+import java.io.Serializable;
9
+import java.util.List;
10
+
11
+@Getter
12
+@Setter
13
+@ToString
14
+public class StckMgntBaseInfoEntity implements Serializable {
15
+
16
+    @ApiModelProperty(value = "브랜드아이디")
17
+    private String brandId;
18
+    @ApiModelProperty(value = "브랜드명")
19
+    private String brandNm;
20
+    @ApiModelProperty(value = "창고아이디")
21
+    private String whsId;
22
+    @ApiModelProperty(value = "창고명")
23
+    private String whsNm;
24
+    @ApiModelProperty(value = "LOCATION")
25
+    private String location;
26
+    @ApiModelProperty(value = "LOCATION명")
27
+    private String locationNm;
28
+    @ApiModelProperty(value = "품목아이디")
29
+    private String itemId;
30
+    @ApiModelProperty(value = "품목명")
31
+    private String itemNm;
32
+    @ApiModelProperty(value = "재고구분")
33
+    private String stckDvsn;
34
+    @ApiModelProperty(value = "재고구분명")
35
+    private String stckDvsnNm;
36
+    @ApiModelProperty(value = "단위")
37
+    private String unit;
38
+    @ApiModelProperty(value = "재고수량-현재고수량")
39
+    private String stckQty;
40
+    @ApiModelProperty(value = "적정재고수량")
41
+    private String prpStckQty;
42
+    @ApiModelProperty(value = "안전재고비율")
43
+    private String sftStckRt;
44
+    @ApiModelProperty(value = "현재고비율")
45
+    private String curStckRt;
46
+    @ApiModelProperty(value = "시스템등록일시")
47
+    private String sysRegDttm;
48
+    @ApiModelProperty(value = "시스템등록아이디")
49
+    private String sysRegId;
50
+    @ApiModelProperty(value = "시스템변경일시")
51
+    private String sysChgDttm;
52
+    @ApiModelProperty(value = "시스템변경아이디")
53
+    private String sysChgId;
54
+
55
+}

+ 48 - 0
src/main/java/com/oqpo/api/entity/stockmng/StckMgntDtlHistEntity.java

@@ -0,0 +1,48 @@
1
+package com.oqpo.api.entity.stockmng;
2
+
3
+import io.swagger.annotations.ApiModelProperty;
4
+import lombok.Getter;
5
+import lombok.Setter;
6
+import lombok.ToString;
7
+
8
+import java.io.Serializable;
9
+
10
+@Getter
11
+@Setter
12
+@ToString
13
+public class StckMgntDtlHistEntity implements Serializable {
14
+
15
+    @ApiModelProperty(value = "재고관리상세번호")
16
+    private String stckMgntDtlNo;
17
+    @ApiModelProperty(value = "브랜드아이디")
18
+    private String brandId;
19
+    @ApiModelProperty(value = "창고아이디")
20
+    private String whsId;
21
+    @ApiModelProperty(value = "LOCATION")
22
+    private String location;
23
+    @ApiModelProperty(value = "품목아이디")
24
+    private String itemId;
25
+    @ApiModelProperty(value = "입고관리고유번호")
26
+    private String whsMgntUnqNo;
27
+    @ApiModelProperty(value = "품목명")
28
+    private String itemNm;
29
+    @ApiModelProperty(value = "재고구분")
30
+    private String stckDvsn;
31
+    @ApiModelProperty(value = "입고수량")
32
+    private String whsQty;
33
+    @ApiModelProperty(value = "출고수량")
34
+    private String dwhsQty;
35
+    @ApiModelProperty(value = "입고관리구분")
36
+    private String whsMgntDvsn;
37
+    @ApiModelProperty(value = "반품관리고유번호")
38
+    private String rtnMgntUnqNo;
39
+    @ApiModelProperty(value = "시스템등록일시")
40
+    private String sysRegDttm;
41
+    @ApiModelProperty(value = "시스템등록아이디")
42
+    private String sysRegId;
43
+    @ApiModelProperty(value = "시스템변경일시")
44
+    private String sysChgDttm;
45
+    @ApiModelProperty(value = "시스템변경아이디")
46
+    private String sysChgId;
47
+
48
+}

+ 24 - 0
src/main/java/com/oqpo/api/mapper/stockmng/StockMngMapper.java

@@ -0,0 +1,24 @@
1
+package com.oqpo.api.mapper.stockmng;
2
+
3
+
4
+import com.oqpo.api.entity.stinfo.BrandEntity;
5
+import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
6
+import com.oqpo.api.web.dto.request.GridRequest;
7
+import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+@Mapper
13
+public interface StockMngMapper {
14
+
15
+    List<StckMgntBaseInfoEntity> selectStockMngGridList(@Param("sBrandId") String sBrandId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation,
16
+                                                        @Param("sItemClass1") String sItemClass1, @Param("sItemClass2") String sItemClass2, @Param("sItemClass3") String sItemClass3,
17
+                                                        @Param("sItemClass4") String sItemClass4, @Param("sItemId") String sItemId, @Param("sItemNm") String sItemNm,
18
+                                                        GridRequest gridRequest) throws Exception;
19
+
20
+    int selectStockMngGridCnt(@Param("sBrandId") String sBrandId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation,
21
+                              @Param("sItemClass1") String sItemClass1, @Param("sItemClass2") String sItemClass2, @Param("sItemClass3") String sItemClass3,
22
+                              @Param("sItemClass4") String sItemClass4, @Param("sItemId") String sItemId, @Param("sItemNm") String sItemNm) throws Exception;
23
+
24
+}

+ 62 - 0
src/main/java/com/oqpo/api/service/stockmng/StockMngService.java

@@ -0,0 +1,62 @@
1
+package com.oqpo.api.service.stockmng;
2
+
3
+
4
+import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
5
+import com.oqpo.api.mapper.stockmng.StockMngMapper;
6
+import com.oqpo.api.service.CommonService;
7
+import com.oqpo.api.web.dto.request.GridRequest;
8
+import com.oqpo.api.web.dto.response.GridResponse;
9
+import com.oqpo.api.web.dto.response.stockmng.StockMngListResponse;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Service;
13
+
14
+import java.util.List;
15
+import java.util.stream.Collectors;
16
+
17
+@Service
18
+@Slf4j
19
+public class StockMngService extends CommonService {
20
+
21
+    @Autowired
22
+    private StockMngMapper stockMngMapper;
23
+
24
+    /*
25
+      재고관리 그리드 리스트 조회
26
+     */
27
+    public GridResponse selectStockMngGridList(String sBrandId, String sWhsId, String sLocation,
28
+                                            String sItemClass1, String sItemClass2, String sItemClass3,
29
+                                            String sItemClass4, String sItemId, String sItemNm, GridRequest gridRequest) throws Exception {
30
+        int gridPage = gridRequest.getGridPage();
31
+        int gridSize = gridRequest.getGridSize();
32
+
33
+        // fromDt = fromDt == null ? null : fromDt.replace(".", "");
34
+        // toDt = toDt == null ? null : toDt.replace(".", "");
35
+
36
+        int gridRecords = stockMngMapper.selectStockMngGridCnt(sBrandId, sWhsId, sLocation, sItemClass1, sItemClass2, sItemClass3, sItemClass4, sItemId, sItemNm);
37
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
38
+        List<StckMgntBaseInfoEntity> entities = stockMngMapper.selectStockMngGridList(sBrandId, sWhsId, sLocation, sItemClass1, sItemClass2, sItemClass3, sItemClass4, sItemId, sItemNm, gridRequest);
39
+        List<Object> gridRows = entities.stream()
40
+                .map(m -> StockMngListResponse.builder()
41
+                        .viewCd("R")
42
+                        .brandId(m.getBrandId())
43
+                        .brandNm(m.getBrandNm())
44
+                        .whsId(m.getWhsId())
45
+                        .whsNm(m.getWhsNm())
46
+                        .location(m.getLocation())
47
+                        .locationNm(m.getLocationNm())
48
+                        .itemId(m.getItemId())
49
+                        .itemNm(m.getItemNm())
50
+                        .stckDvsn(m.getStckDvsn())
51
+                        .stckDvsnNm(m.getStckDvsnNm())
52
+                        .unit(m.getUnit())
53
+                        .stckQty(m.getStckQty())
54
+                        .prpStckQty(m.getPrpStckQty())
55
+                        .sftStckRt(m.getSftStckRt())
56
+                        .curStckRt(m.getCurStckRt())
57
+                        .build())
58
+                .collect(Collectors.toList());
59
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
60
+    }
61
+
62
+}

+ 42 - 0
src/main/java/com/oqpo/api/web/controller/stockmng/StockMngController.java

@@ -0,0 +1,42 @@
1
+package com.oqpo.api.web.controller.stockmng;
2
+
3
+import com.oqpo.api.service.stockmng.StockMngService;
4
+import com.oqpo.api.web.dto.request.stockmng.StockMngGridRequest;
5
+import com.oqpo.api.web.dto.response.GridResponse;
6
+import io.swagger.annotations.ApiImplicitParam;
7
+import io.swagger.annotations.ApiImplicitParams;
8
+import io.swagger.annotations.ApiOperation;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import javax.validation.Valid;
15
+
16
+@Slf4j
17
+@RestController
18
+@RequestMapping("/api/stock/mng")
19
+public class StockMngController {
20
+
21
+    @Autowired
22
+    private StockMngService stockMngService;
23
+
24
+    /**
25
+     * 설명 : 재고관리 그리드 리스트
26
+     *
27
+     * @param stockMngGridRequest
28
+     * @return
29
+     * @throws Exception
30
+     */
31
+    @ApiImplicitParams({
32
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
33
+    })
34
+    @ApiOperation(value = "재고관리 그리드 리스트")
35
+    @PostMapping("/detail-grid-list")
36
+    public ResponseEntity<GridResponse> detailGridList(@RequestBody @Valid StockMngGridRequest stockMngGridRequest) throws Exception {
37
+        return ResponseEntity.ok(stockMngService.selectStockMngGridList(stockMngGridRequest.getSBrandId(), stockMngGridRequest.getSWhsId(), stockMngGridRequest.getSLocation(),
38
+                stockMngGridRequest.getSItemClass1(), stockMngGridRequest.getSItemClass2(), stockMngGridRequest.getSItemClass3(), stockMngGridRequest.getSItemClass4(),
39
+                stockMngGridRequest.getSItemId(), stockMngGridRequest.getSItemNm(), stockMngGridRequest.toDTO(stockMngGridRequest)));
40
+    }
41
+
42
+}

+ 37 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/StockMngGridRequest.java

@@ -0,0 +1,37 @@
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 StockMngGridRequest extends GridRequest {
12
+
13
+    @ApiModelProperty(value = "브랜드아이디")
14
+    private String sBrandId;
15
+    @ApiModelProperty(value = "창고아이디")
16
+    private String sWhsId;
17
+    @ApiModelProperty(value = "LOCATION")
18
+    private String sLocation;
19
+
20
+    @ApiModelProperty(value = "품목분류1")
21
+    private String sItemClass1;
22
+    @ApiModelProperty(value = "품목분류2")
23
+    private String sItemClass2;
24
+    @ApiModelProperty(value = "품목분류3")
25
+    private String sItemClass3;
26
+    @ApiModelProperty(value = "품목분류4")
27
+    private String sItemClass4;
28
+
29
+    @ApiModelProperty(value = "품목아이디")
30
+    private String sItemId;
31
+    @ApiModelProperty(value = "품목명")
32
+    private String sItemNm;
33
+
34
+    protected StockMngGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
35
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
36
+    }
37
+}

+ 48 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/StockMngListResponse.java

@@ -0,0 +1,48 @@
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 StockMngListResponse {
13
+
14
+    @ApiModelProperty(value = "CRUD")
15
+    private String viewCd;
16
+
17
+    @ApiModelProperty(value = "브랜드아이디")
18
+    private String brandId;
19
+    @ApiModelProperty(value = "브랜드명")
20
+    private String brandNm;
21
+    @ApiModelProperty(value = "창고아이디")
22
+    private String whsId;
23
+    @ApiModelProperty(value = "창고명")
24
+    private String whsNm;
25
+    @ApiModelProperty(value = "LOCATION")
26
+    private String location;
27
+    @ApiModelProperty(value = "LOCATION명")
28
+    private String locationNm;
29
+    @ApiModelProperty(value = "품목아이디")
30
+    private String itemId;
31
+    @ApiModelProperty(value = "품목명")
32
+    private String itemNm;
33
+    @ApiModelProperty(value = "재고구분")
34
+    private String stckDvsn;
35
+    @ApiModelProperty(value = "재고구분명")
36
+    private String stckDvsnNm;
37
+    @ApiModelProperty(value = "단위")
38
+    private String unit;
39
+    @ApiModelProperty(value = "재고수량-현재고수량")
40
+    private String stckQty;
41
+    @ApiModelProperty(value = "적정재고수량")
42
+    private String prpStckQty;
43
+    @ApiModelProperty(value = "안전재고비율")
44
+    private String sftStckRt;
45
+    @ApiModelProperty(value = "현재고비율")
46
+    private String curStckRt;
47
+
48
+}