瀏覽代碼

재고 실사 작업중

marseyes 2 年之前
父節點
當前提交
f6e814c55b

+ 4 - 4
src/main/java/com/oqpo/api/entity/stockmng/StckCddMgntDtlEntity.java

@@ -15,17 +15,17 @@ public class StckCddMgntDtlEntity implements Serializable {
15 15
     @ApiModelProperty(value = "실사아이디")
16 16
     private String cddId;
17 17
     @ApiModelProperty(value = "실사순번")
18
-    private String cddSeq;
18
+    private int cddSeq;
19 19
     @ApiModelProperty(value = "품목아이디")
20 20
     private String itemId;
21 21
     @ApiModelProperty(value = "단위")
22 22
     private String unit;
23 23
     @ApiModelProperty(value = "전산기존수량")
24
-    private String comExstQty;
24
+    private int comExstQty;
25 25
     @ApiModelProperty(value = "실사수량")
26
-    private String cddQty;
26
+    private int cddQty;
27 27
     @ApiModelProperty(value = "변동수량")
28
-    private String chgQty;
28
+    private int chgQty;
29 29
     @ApiModelProperty(value = "시스템등록일시")
30 30
     private String sysRegDttm;
31 31
     @ApiModelProperty(value = "시스템등록아이디")

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

@@ -20,14 +20,26 @@ public class StckCddMgntInfoEntity implements Serializable {
20 20
     private String cddTm;
21 21
     @ApiModelProperty(value = "실사구분")
22 22
     private String cddDvsn;
23
+    @ApiModelProperty(value = "실사구분명")
24
+    private String cddDvsnNm;
23 25
     @ApiModelProperty(value = "실사담당자명")
24 26
     private String cddMgrNm;
25 27
     @ApiModelProperty(value = "창고아이디")
26 28
     private String whsId;
29
+    @ApiModelProperty(value = "창고명")
30
+    private String whsNm;
27 31
     @ApiModelProperty(value = "LOCATION")
28 32
     private String location;
33
+    @ApiModelProperty(value = "LOCATION명")
34
+    private String locationNm;
29 35
     @ApiModelProperty(value = "브랜드아이디")
30 36
     private String brandId;
37
+    @ApiModelProperty(value = "브랜드명")
38
+    private String brandNm;
39
+    @ApiModelProperty(value = "매장아이디")
40
+    private String storeId;
41
+    @ApiModelProperty(value = "매장명")
42
+    private String storeNm;
31 43
     @ApiModelProperty(value = "시스템등록일시")
32 44
     private String sysRegDttm;
33 45
     @ApiModelProperty(value = "시스템등록아이디")

+ 1 - 1
src/main/java/com/oqpo/api/constant/ChgDvsn.java

@@ -1,4 +1,4 @@
1
-package com.oqpo.api.constant;
1
+package com.oqpo.api.enums;
2 2
 
3 3
 import lombok.Getter;
4 4
 import lombok.Setter;

+ 1 - 1
src/main/java/com/oqpo/api/constant/InOutCd.java

@@ -1,4 +1,4 @@
1
-package com.oqpo.api.constant;
1
+package com.oqpo.api.enums;
2 2
 
3 3
 import lombok.Getter;
4 4
 import lombok.Setter;

+ 27 - 0
src/main/java/com/oqpo/api/mapper/stockmng/StockCddMapper.java

@@ -0,0 +1,27 @@
1
+package com.oqpo.api.mapper.stockmng;
2
+
3
+
4
+import com.oqpo.api.entity.stockmng.StckCddMgntDtlEntity;
5
+import com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity;
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 StockCddMapper {
14
+
15
+    List<StckCddMgntInfoEntity> selectStockCddGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId,
16
+                                                       @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation,
17
+                                                       @Param("sCddDvsn") String sCddDvsn, @Param("fromDt") String fromDt, @Param("toDt") String toDt,
18
+                                                       GridRequest gridRequest) throws Exception;
19
+
20
+    int selectStockCddGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId,
21
+                              @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation,
22
+                              @Param("sCddDvsn") String sCddDvsn, @Param("fromDt") String fromDt, @Param("toDt") String toDt) throws Exception;
23
+
24
+    int insertStckCddMgntInfo(@Param("userId") String userId, StckCddMgntInfoEntity entity) throws Exception;
25
+
26
+    int insertStckCddMgntDtl(@Param("userId") String userId, StckCddMgntDtlEntity entity) throws Exception;
27
+}

+ 144 - 0
src/main/java/com/oqpo/api/service/stockmng/StockCddService.java

@@ -0,0 +1,144 @@
1
+package com.oqpo.api.service.stockmng;
2
+
3
+
4
+import com.oqpo.api.entity.stockmng.StckCddMgntDtlEntity;
5
+import com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity;
6
+import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
7
+import com.oqpo.api.exception.GlobalException;
8
+import com.oqpo.api.mapper.CommonMapper;
9
+import com.oqpo.api.mapper.stockmng.StockCddMapper;
10
+import com.oqpo.api.mapper.stockmng.StockMngMapper;
11
+import com.oqpo.api.service.CommonService;
12
+import com.oqpo.api.util.DateUtil;
13
+import com.oqpo.api.util.StringUtil;
14
+import com.oqpo.api.web.dto.request.GridRequest;
15
+import com.oqpo.api.web.dto.request.stockmng.SaveStockCddRequest;
16
+import com.oqpo.api.web.dto.response.GridResponse;
17
+import com.oqpo.api.web.dto.response.stockmng.StockCddListResponse;
18
+import lombok.extern.slf4j.Slf4j;
19
+import org.apache.ibatis.annotations.Param;
20
+import org.springframework.beans.factory.annotation.Autowired;
21
+import org.springframework.stereotype.Service;
22
+import org.springframework.transaction.annotation.Transactional;
23
+
24
+import java.util.List;
25
+import java.util.stream.Collectors;
26
+
27
+@Service
28
+@Slf4j
29
+public class StockCddService extends CommonService {
30
+
31
+    @Autowired
32
+    private StockCddMapper stockCddMapper;
33
+
34
+    @Autowired
35
+    private StockMngMapper stockMngMapper;
36
+
37
+    /*
38
+      재고실사 그리드 리스트 조회
39
+     */
40
+    public GridResponse selectStockCddGridList(String sBrandId, String sStoreId, String sWhsId, String sLocation,
41
+                                               String sCddDvsn, String fromDt, String toDt, GridRequest gridRequest) throws Exception {
42
+
43
+        int gridPage = gridRequest.getGridPage();
44
+        int gridSize = gridRequest.getGridSize();
45
+
46
+        fromDt = fromDt == null ? null : fromDt.replace(".", "");
47
+        toDt = toDt == null ? null : toDt.replace(".", "");
48
+
49
+        int gridRecords = stockCddMapper.selectStockCddGridCnt(sBrandId, sStoreId, sWhsId, sLocation, sCddDvsn, fromDt, toDt);
50
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
51
+        List<StckCddMgntInfoEntity> entities = stockCddMapper.selectStockCddGridList(sBrandId, sStoreId, sWhsId, sLocation, sCddDvsn, fromDt, toDt, gridRequest);
52
+        List<Object> gridRows = entities.stream()
53
+                .map(m -> StockCddListResponse.builder()
54
+                        .viewCd("R")
55
+                        .cddId(m.getCddId())
56
+                        .cddDt(m.getCddDt())
57
+                        .cddTm(m.getCddTm())
58
+                        .cddDvsn(m.getCddDvsn())
59
+                        .cddDvsnNm(m.getCddDvsnNm())
60
+                        .cddMgrNm(m.getCddMgrNm())
61
+                        .brandId(m.getBrandId())
62
+                        .brandNm(m.getBrandNm())
63
+                        .storeId(m.getStoreId())
64
+                        .storeNm(m.getStoreNm())
65
+                        .whsId(m.getWhsId())
66
+                        .whsNm(m.getWhsNm())
67
+                        .location(m.getLocation())
68
+                        .locationNm(m.getLocationNm())
69
+                        .build())
70
+                .collect(Collectors.toList());
71
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
72
+    }
73
+
74
+    /* 재고 실사 저장 */
75
+    @Transactional
76
+    public void saveStockCdd(String userId, SaveStockCddRequest saveStockCddRequest) throws Exception {
77
+        try {
78
+            // 1. 재고실사기본정보(stck_cdd_mgnt_info) 등록
79
+            StckCddMgntInfoEntity infoEntity = new StckCddMgntInfoEntity();
80
+            infoEntity.setCddId(fnGetDealNo(27, "")); // 실사아이디 채번
81
+            infoEntity.setCddDt(StringUtil.isEmpty(saveStockCddRequest.getCddDt()) ? DateUtil.getCurrentDate() : saveStockCddRequest.getCddDt());
82
+            infoEntity.setCddTm(StringUtil.isEmpty(saveStockCddRequest.getCddTm()) ? DateUtil.getCurrentTime() : saveStockCddRequest.getCddTm());
83
+            infoEntity.setCddDvsn(saveStockCddRequest.getCddDvsn());
84
+            infoEntity.setWhsId(saveStockCddRequest.getWhsId());
85
+            infoEntity.setLocation(saveStockCddRequest.getLocation());
86
+            infoEntity.setBrandId(saveStockCddRequest.getBrandId());
87
+            infoEntity.setStoreId(saveStockCddRequest.getStoreId());
88
+
89
+            stockCddMapper.insertStckCddMgntInfo(userId, infoEntity);
90
+
91
+            // 2. 재고실사상세정보(stck_cdd_mgnt_dtl) 등록
92
+            List<StckCddMgntDtlEntity> dtlList = saveStockCddRequest.toEntities(saveStockCddRequest.getGridInsertData());
93
+            int idx = 1;
94
+            for (StckCddMgntDtlEntity dtlEntity : dtlList) {
95
+                // 기존수량 조회
96
+                StckMgntBaseInfoEntity baseInfo = stockMngMapper.selectStckMgntBaseInfo(saveStockCddRequest.getBrandId(), saveStockCddRequest.getWhsId(),
97
+                        saveStockCddRequest.getLocation(), dtlEntity.getItemId());
98
+
99
+                // 재고실사상세정보 등록
100
+                dtlEntity.setCddId(infoEntity.getCddId());
101
+                dtlEntity.setCddSeq(idx);
102
+                dtlEntity.setUnit(baseInfo.getUnit());
103
+                dtlEntity.setComExstQty(baseInfo.getStckQty()); // 기존재고수량
104
+                dtlEntity.setChgQty(dtlEntity.getCddSeq() - baseInfo.getStckQty()); // 변동수량 = 실사수량 - 기존재고수량
105
+                stockCddMapper.insertStckCddMgntDtl(userId, dtlEntity);
106
+
107
+                // 재고관리기본정보(stck_mgnt_base_info) 업데이트
108
+                StckMgntBaseInfoEntity stckEntity = new StckMgntBaseInfoEntity();
109
+                stckEntity.setBrandId(saveStockCddRequest.getBrandId());
110
+
111
+                /*
112
+    @ApiModelProperty(value = "창고아이디")
113
+    private String whsId;
114
+    @ApiModelProperty(value = "LOCATION")
115
+    private String location;
116
+    @ApiModelProperty(value = "품목아이디")
117
+    private String itemId;
118
+    @ApiModelProperty(value = "단위")
119
+    private String unit;
120
+    @ApiModelProperty(value = "재고수량")
121
+    private int stckQty;
122
+    @ApiModelProperty(value = "적정재고수량")
123
+    private int prpStckQty;
124
+    @ApiModelProperty(value = "안전재고비율")
125
+    private BigDecimal sftStckRt;
126
+    @ApiModelProperty(value = "현재고비율")
127
+    private BigDecimal curStckRt;
128
+                * */
129
+
130
+                stockMngMapper.updateStckMgntBaseInfo4StckProc(userId, stckEntity);
131
+
132
+                // 재고관리상세이력(stck_mgnt_dtl_hist) 등록
133
+
134
+                idx++;
135
+            }
136
+        } catch (GlobalException e) {
137
+            e.getStackTrace();
138
+            throw new GlobalException(e.getSystemMessageCode());
139
+        } catch (Exception e) {
140
+            e.getStackTrace();
141
+            throw new RuntimeException();
142
+        }
143
+    }
144
+}

+ 2 - 3
src/main/java/com/oqpo/api/service/stockmng/StockMngService.java

@@ -1,8 +1,8 @@
1 1
 package com.oqpo.api.service.stockmng;
2 2
 
3 3
 
4
-import com.oqpo.api.constant.ChgDvsn;
5
-import com.oqpo.api.constant.InOutCd;
4
+import com.oqpo.api.enums.ChgDvsn;
5
+import com.oqpo.api.enums.InOutCd;
6 6
 import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
7 7
 import com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity;
8 8
 import com.oqpo.api.exception.GlobalException;
@@ -13,7 +13,6 @@ import com.oqpo.api.web.dto.request.stockmng.ProcStockRequest;
13 13
 import com.oqpo.api.web.dto.response.GridResponse;
14 14
 import com.oqpo.api.web.dto.response.stockmng.StockHistListResponse;
15 15
 import com.oqpo.api.web.dto.response.stockmng.StockMngListResponse;
16
-import io.swagger.annotations.ApiModelProperty;
17 16
 import lombok.extern.slf4j.Slf4j;
18 17
 import org.springframework.beans.factory.annotation.Autowired;
19 18
 import org.springframework.stereotype.Service;

+ 66 - 0
src/main/java/com/oqpo/api/web/controller/stockmng/StockCddController.java

@@ -0,0 +1,66 @@
1
+package com.oqpo.api.web.controller.stockmng;
2
+
3
+import com.oqpo.api.enums.SystemMessageCode;
4
+import com.oqpo.api.service.stockmng.StockCddService;
5
+import com.oqpo.api.web.dto.request.stockmng.*;
6
+import com.oqpo.api.web.dto.response.GridResponse;
7
+import com.oqpo.api.web.dto.response.SaveResponse;
8
+import io.swagger.annotations.ApiImplicitParam;
9
+import io.swagger.annotations.ApiImplicitParams;
10
+import io.swagger.annotations.ApiOperation;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.http.ResponseEntity;
14
+import org.springframework.web.bind.annotation.PostMapping;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RestController;
18
+import springfox.documentation.annotations.ApiIgnore;
19
+
20
+import javax.validation.Valid;
21
+
22
+@Slf4j
23
+@RestController
24
+@RequestMapping("/api/stock/cdd")
25
+public class StockCddController {
26
+
27
+    @Autowired
28
+    private StockCddService stockCddService;
29
+
30
+    /**
31
+     * 설명 : 재고실사 그리드 리스트
32
+     *
33
+     * @param stockCddGridRequest
34
+     * @return
35
+     * @throws Exception
36
+     */
37
+    @ApiImplicitParams({
38
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
39
+    })
40
+    @ApiOperation(value = "재고실사 그리드 리스트")
41
+    @PostMapping("/detail-grid-list")
42
+    public ResponseEntity<GridResponse> detailGridList(@RequestBody @Valid StockCddGridRequest stockCddGridRequest) throws Exception {
43
+        return ResponseEntity.ok(stockCddService.selectStockCddGridList(stockCddGridRequest.getSBrandId(), stockCddGridRequest.getSStoreId(), stockCddGridRequest.getSWhsId(),
44
+                stockCddGridRequest.getSLocation(), stockCddGridRequest.getSCddDvsn(), stockCddGridRequest.getFromDt(), stockCddGridRequest.getToDt(),
45
+                stockCddGridRequest.toDTO(stockCddGridRequest)));
46
+    }
47
+
48
+    /**
49
+     * 설명 : 재고 실사 저장
50
+     *
51
+     * @param userId
52
+     * @param saveStockCddRequest
53
+     * @return SaveResponse
54
+     * @throws Exception
55
+     */
56
+    @ApiImplicitParams({
57
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
58
+    })
59
+    @ApiOperation(value = "재고 실사 저장")
60
+    @PostMapping("/save-stock-cdd")
61
+    public ResponseEntity<SaveResponse> saveStockCdd(@ApiIgnore String userId, @RequestBody @Valid SaveStockCddRequest saveStockCddRequest) throws Exception {
62
+        stockCddService.saveStockCdd(userId, saveStockCddRequest);
63
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
64
+    }
65
+
66
+}

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

@@ -48,7 +48,7 @@ public class StockMngController {
48 48
     /**
49 49
      * 설명 : 재고이력 그리드 리스트
50 50
      *
51
-     * @param stockMngGridRequest
51
+     * @param stockHistGridRequest
52 52
      * @return
53 53
      * @throws Exception
54 54
      */

+ 57 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/SaveStockCddRequest.java

@@ -0,0 +1,57 @@
1
+package com.oqpo.api.web.dto.request.stockmng;
2
+
3
+import com.oqpo.api.entity.stockmng.StckCddMgntDtlEntity;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+import java.util.ArrayList;
8
+import java.util.List;
9
+
10
+@Getter
11
+@Setter
12
+public class SaveStockCddRequest {
13
+
14
+    @ApiModelProperty(value = "실사구분")
15
+    private String cddDvsn;
16
+    @ApiModelProperty(value = "실사일자")
17
+    private String cddDt;
18
+    @ApiModelProperty(value = "실사시각")
19
+    private String cddTm;
20
+    @ApiModelProperty(value = "브랜드아이디")
21
+    private String brandId;
22
+    @ApiModelProperty(value = "매장아이디(매장재고관리)")
23
+    private String storeId;
24
+    @ApiModelProperty(value = "창고아이디")
25
+    private String whsId;
26
+    @ApiModelProperty(value = "LOCATION")
27
+    private String location;
28
+
29
+    @ApiModelProperty(value = "재고실사 품목리스트")
30
+    private List<SaveStockCddRequest.StockCddReqData> gridInsertData;
31
+
32
+    public List<StckCddMgntDtlEntity> toEntities(List<SaveStockCddRequest.StockCddReqData> gridData) {
33
+        List<StckCddMgntDtlEntity> entities = new ArrayList<>();
34
+        if (gridData == null || gridData.size() == 0)
35
+            return entities;
36
+
37
+        gridData.forEach(x -> {
38
+            StckCddMgntDtlEntity entity = new StckCddMgntDtlEntity();
39
+            entity.setItemId(x.getItemId());
40
+            entity.setCddQty(x.getCddQty());
41
+            entities.add(entity);
42
+        });
43
+        return entities;
44
+    }
45
+
46
+    @Getter
47
+    @Builder
48
+    @AllArgsConstructor(access = AccessLevel.PROTECTED)
49
+    static class StockCddReqData {
50
+
51
+        @ApiModelProperty(value = "품목아이디")
52
+        private String itemId;
53
+        @ApiModelProperty(value = "실사수량")
54
+        private int cddQty;
55
+
56
+    }
57
+}

+ 32 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/StockCddGridRequest.java

@@ -0,0 +1,32 @@
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 StockCddGridRequest extends GridRequest {
12
+
13
+    @ApiModelProperty(value = "브랜드아이디")
14
+    private String sBrandId;
15
+    @ApiModelProperty(value = "매장아이디")
16
+    private String sStoreId;
17
+    @ApiModelProperty(value = "창고아이디")
18
+    private String sWhsId;
19
+    @ApiModelProperty(value = "LOCATION")
20
+    private String sLocation;
21
+    @ApiModelProperty(value = "실사구분")
22
+    private String sCddDvsn;
23
+
24
+    @ApiModelProperty(value = "시작일")
25
+    private String fromDt;
26
+    @ApiModelProperty(value = "종료일")
27
+    private String toDt;
28
+
29
+    protected StockCddGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
30
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
31
+    }
32
+}

+ 46 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/StockCddListResponse.java

@@ -0,0 +1,46 @@
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 StockCddListResponse {
13
+
14
+    @ApiModelProperty(value = "CRUD")
15
+    private String viewCd;
16
+
17
+    @ApiModelProperty(value = "실사아이디")
18
+    private String cddId;
19
+    @ApiModelProperty(value = "실사일자")
20
+    private String cddDt;
21
+    @ApiModelProperty(value = "실사시각")
22
+    private String cddTm;
23
+    @ApiModelProperty(value = "실사구분")
24
+    private String cddDvsn;
25
+    @ApiModelProperty(value = "실사구분명")
26
+    private String cddDvsnNm;
27
+    @ApiModelProperty(value = "실사담당자명")
28
+    private String cddMgrNm;
29
+    @ApiModelProperty(value = "창고아이디")
30
+    private String whsId;
31
+    @ApiModelProperty(value = "창고명")
32
+    private String whsNm;
33
+    @ApiModelProperty(value = "LOCATION")
34
+    private String location;
35
+    @ApiModelProperty(value = "LOCATION명")
36
+    private String locationNm;
37
+    @ApiModelProperty(value = "브랜드아이디")
38
+    private String brandId;
39
+    @ApiModelProperty(value = "브랜드명")
40
+    private String brandNm;
41
+    @ApiModelProperty(value = "매장아이디")
42
+    private String storeId;
43
+    @ApiModelProperty(value = "매장명")
44
+    private String storeNm;
45
+
46
+}

+ 124 - 0
src/main/resources/mybatis/sqlmaps/stockmng/StockCdd.xml

@@ -0,0 +1,124 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+
4
+<mapper namespace="com.oqpo.api.mapper.stockmng.StockCddMapper">
5
+
6
+    <select id="selectStockCddGridList" resultType="com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity">
7
+        /* StockCddMapper.selectStockCddGridList */
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, A.unit, A.stck_qty, A.prp_stck_qty,
11
+            A.sft_stck_rt, A.cur_stck_rt
12
+        FROM stck_mgnt_base_info A
13
+        INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
14
+        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
15
+        INNER JOIN item_base_info E ON A.item_id = E.item_id
16
+        <if test="sItemClass1 != null and sItemClass1 != ''">
17
+        INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
18
+            AND B.item_class1 = #{sItemClass1}
19
+            <if test="sItemClass2 != null and sItemClass2 != ''">
20
+            AND B.item_class2 = #{sItemClass2}
21
+                <if test="sItemClass3 != null and sItemClass3 != ''">
22
+                AND B.item_class3 = #{sItemClass3}
23
+                    <if test="sItemClass4 != null and sItemClass4 != ''">
24
+                    AND B.item_class4 = #{sItemClass4}
25
+                    </if>
26
+                </if>
27
+            </if>
28
+        </if>
29
+        WHERE A.brand_id = #{sBrandId}
30
+        <if test="sStoreId != null and sStoreId != ''">
31
+        AND C.store_id = #{sStoreId}
32
+        </if>
33
+        <if test="sWhsId != null and sWhsId != ''">
34
+        AND A.whs_id = #{sWhsId}
35
+        </if>
36
+        <if test="sLocation != null and sLocation != ''">
37
+        AND A.location = #{sLocation}
38
+        </if>
39
+        <if test="sItemId != null and sItemId != ''">
40
+        AND A.item_id = #{sItemId}
41
+        </if>
42
+        <if test="sItemNm != null and sItemNm != ''">
43
+        AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
44
+        </if>
45
+        <choose>
46
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
47
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
48
+                    <if test="gridRequest.sord == 'asc'.toString()">
49
+                        ORDER BY A.item_id ASC
50
+                    </if>
51
+                    <if test="gridRequest.sord == 'desc'.toString()">
52
+                        ORDER BY A.item_id DESC
53
+                    </if>
54
+                </if>
55
+            </when>
56
+            <otherwise>
57
+                ORDER BY A.item_id ASC
58
+            </otherwise>
59
+        </choose>
60
+        <if test="gridRequest.pagingYn == true">
61
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
62
+        </if>
63
+    </select>
64
+
65
+    <select id="selectStockCddGridCnt" resultType="int">
66
+        /* StockCddMapper.selectStockCddGridCnt */
67
+        SELECT COUNT(*)
68
+        FROM stck_mgnt_base_info A
69
+        INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
70
+        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
71
+        INNER JOIN item_base_info E ON A.item_id = E.item_id
72
+        <if test="sItemClass1 != null and sItemClass1 != ''">
73
+            INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
74
+            AND B.item_class1 = #{sItemClass1}
75
+            <if test="sItemClass2 != null and sItemClass2 != ''">
76
+                AND B.item_class2 = #{sItemClass2}
77
+                <if test="sItemClass3 != null and sItemClass3 != ''">
78
+                    AND B.item_class3 = #{sItemClass3}
79
+                    <if test="sItemClass4 != null and sItemClass4 != ''">
80
+                        AND B.item_class4 = #{sItemClass4}
81
+                    </if>
82
+                </if>
83
+            </if>
84
+        </if>
85
+        WHERE A.brand_id = #{sBrandId}
86
+        <if test="sStoreId != null and sStoreId != ''">
87
+            AND C.store_id = #{sStoreId}
88
+        </if>
89
+        <if test="sWhsId != null and sWhsId != ''">
90
+            AND A.whs_id = #{sWhsId}
91
+        </if>
92
+        <if test="sLocation != null and sLocation != ''">
93
+            AND A.location = #{sLocation}
94
+        </if>
95
+        <if test="sItemId != null and sItemId != ''">
96
+            AND A.item_id = #{sItemId}
97
+        </if>
98
+        <if test="sItemNm != null and sItemNm != ''">
99
+            AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
100
+        </if>
101
+    </select>
102
+
103
+    <insert id="insertStckCddMgntInfo" >
104
+        /* StockCddMapper.insertStckCddMgntInfo */
105
+        INSERT INTO stck_cdd_mgnt_info
106
+            (cdd_id, cdd_dt, cdd_tm, cdd_dvsn, cdd_mgr_nm, brand_id, store_id, whs_id, location, sys_reg_dttm,
107
+             sys_reg_id, sys_chg_dttm, sys_chg_id)
108
+        VALUES
109
+            (#{entity.cddId}, #{entity.cddDt}, #{entity.cddTm}, #{entity.cddDvsn}, #{entity.cddMgrNm},
110
+             #{entity.brandId}, #{entity.storeId}, #{entity.whsId}, #{entity.location},
111
+             NOW(), #{userId}, NOW(), #{userId})
112
+    </insert>
113
+
114
+    <insert id="insertStckCddMgntDtl" >
115
+        /* StockCddMapper.insertStckCddMgntDtl */
116
+        INSERT INTO stck_cdd_mgnt_dtl
117
+            (cdd_id, cdd_seq, item_id, unit, com_exst_qty, cdd_qty, chg_qty, sys_reg_dttm,
118
+             sys_reg_id, sys_chg_dttm, sys_chg_id)
119
+        VALUES
120
+            (#{entity.cddId}, #{entity.cddSeq}, #{entity.itemId}, #{entity.unit}, #{entity.comExstQty}, #{entity.cddQty}, #{entity.chgQty},
121
+             NOW(), #{userId}, NOW(), #{userId})
122
+    </insert>
123
+
124
+</mapper>

+ 8 - 7
src/main/resources/mybatis/sqlmaps/stockmng/StockMng.xml

@@ -119,8 +119,9 @@
119 119
             (brand_id, whs_id, location, item_id, unit, stck_qty, prp_stck_qty, sft_stck_rt, cur_stck_rt,
120 120
              sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
121 121
         VALUES
122
-            (#{entity.brandid}, #{entity.whsid}, #{entity.location}, #{entity.itemid}, #{entity.unit}, #{entity.stckqty},
123
-             #{entity.prpstckqty}, #{entity.sftstckrt}, #{entity.curstckrt}, NOW(), #{userId}, NOW(), #{userId})
122
+            (#{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId}, #{entity.unit}, #{entity.stckQty},
123
+             #{entity.prpStckQty}, #{entity.sftStckRt}, #{entity.curStckRt},
124
+             NOW(), #{userId}, NOW(), #{userId})
124 125
     </insert>
125 126
 
126 127
     <update id="updateStckMgntBaseInfo4StckProc" >
@@ -139,12 +140,12 @@
139 140
     <insert id="insertStckMgntDtlHist" >
140 141
         /* StockMngMapper.insertStckMgntDtlHist */
141 142
         INSERT INTO stck_mgnt_dtl_hist
142
-            (stck_mgnt_dtl_no, brand_id, whs_id, location, item_id, item_nm, inout_cd, inout_qty,
143
-             whs_mgnt_unq_no, rtn_mgnt_unq_no, chg_dvsn,
144
-             sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
143
+            (stck_mgnt_dtl_no, brand_id, whs_id, location, item_id, item_nm, inout_cd, inout_qty, whs_mgnt_unq_no,
144
+             rtn_mgnt_unq_no, chg_dvsn, sys_reg_dttm,
145
+             sys_reg_id, sys_chg_dttm, sys_chg_id)
145 146
         VALUES
146
-            (#{entity.stckmgntdtlno}, #{entity.brandid}, #{entity.whsid}, #{entity.location}, #{entity.itemid},
147
-             #{entity.itemnm}, #{entity.inoutcd}, #{entity.inoutqty}, #{entity.whsmgntunqno}, #{entity.rtnmgntunqno}, #{entity.chgdvsn},
147
+            (#{entity.stckMgntDtlNo}, #{entity.brandId}, #{entity.whsId}, #{entity.location}, #{entity.itemId},
148
+             #{entity.itemNm}, #{entity.inoutCd}, #{entity.inoutQty}, #{entity.whsMgntUnqNo}, #{entity.rtnMgntUnqNo}, #{entity.chgDvsn},
148 149
              NOW(), #{userId}, NOW(), #{userId})
149 150
     </insert>
150 151