Explorar o código

모바일 재고실사, 창고품목조회 및 바코드를 통한 품목정보 조회

dwkim %!s(int64=2) %!d(string=hai) anos
pai
achega
6268acc563

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

@@ -64,4 +64,14 @@ public interface StockMngMapper {
64 64
     List<StckMgntBaseInfoEntity> selectWhsLocOutPassQty(@Param("brandId") String brandId, @Param("whsId") String whsId, @Param("location") String location,
65 65
                                                         List<StckMgntBaseInfoEntity> gridItemData) throws Exception;
66 66
 
67
+    /* 창고별 품목 현황 */
68
+    List<StckMgntBaseInfoEntity> selectPopItemStockMngGridList(@Param("sBrandId") String sBrandId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation
69
+                                                        ,@Param("sItemNm") String sItemNm, GridRequest gridRequest) throws Exception;
70
+
71
+    int selectPopItemStockMngGridCnt(@Param("sBrandId") String sBrandId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation
72
+                                     ,@Param("sItemNm") String sItemNm) throws Exception;
73
+
74
+    StckMgntBaseInfoEntity selectPopItemStockInfo(@Param("sBrandId") String sBrandId, @Param("sWhsId") String sWhsId, @Param("sLocation") String sLocation
75
+            ,@Param("sBarcode") String sBarcode) throws Exception;
76
+
67 77
 }

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

@@ -12,9 +12,7 @@ import com.oqpo.api.web.dto.request.GridRequest;
12 12
 import com.oqpo.api.web.dto.request.stockmng.ProcStockRequest;
13 13
 import com.oqpo.api.web.dto.request.stockmng.StockMngCddGridRequest;
14 14
 import com.oqpo.api.web.dto.response.GridResponse;
15
-import com.oqpo.api.web.dto.response.stockmng.StockHistListResponse;
16
-import com.oqpo.api.web.dto.response.stockmng.StockMngInfoResponse;
17
-import com.oqpo.api.web.dto.response.stockmng.StockMngListResponse;
15
+import com.oqpo.api.web.dto.response.stockmng.*;
18 16
 import lombok.extern.slf4j.Slf4j;
19 17
 import org.springframework.beans.factory.annotation.Autowired;
20 18
 import org.springframework.stereotype.Service;
@@ -228,6 +226,36 @@ public class StockMngService extends CommonService {
228 226
 
229 227
     */
230 228
 
229
+    /*
230
+          재고관리 그리드 리스트 조회
231
+         */
232
+    public GridResponse selectPopItemStockMngGridList(String sBrandId, String sWhsId, String sLocation,
233
+                                                String sItemNm, GridRequest gridRequest) throws Exception {
234
+        int gridPage = gridRequest.getGridPage();
235
+        int gridSize = gridRequest.getGridSize();
236
+
237
+        int gridRecords = stockMngMapper.selectPopItemStockMngGridCnt(sBrandId, sWhsId, sLocation, sItemNm);
238
+        int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
239
+        List<StckMgntBaseInfoEntity> entities = stockMngMapper.selectPopItemStockMngGridList(sBrandId, sWhsId, sLocation, sItemNm, gridRequest);
240
+        List<Object> gridRows = entities.stream()
241
+                .map(m -> PopItemWhsStockListResponse.builder()
242
+                        .viewCd("R")
243
+                        .brandId(m.getBrandId())
244
+                        .brandNm(m.getBrandNm())
245
+                        .itemId(m.getItemId())
246
+                        .itemNm(m.getItemNm())
247
+                        .unit(m.getUnit())
248
+                        .stckQty(m.getStckQty())
249
+                        .waitQty(m.getWaitQty())
250
+                        .build())
251
+                .collect(Collectors.toList());
252
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
253
+    }
231 254
 
255
+    /* 바코드 품목 정보 조회 */
256
+    public BarcodeWhsItemInfoResponse selectBarcodeWhsItemMngInfo(String sBrandId, String sWhsId, String sLocation, String sBarcode) throws Exception {
257
+        StckMgntBaseInfoEntity entity = stockMngMapper.selectPopItemStockInfo(sBrandId, sWhsId, sLocation, sBarcode);
258
+        return BarcodeWhsItemInfoResponse.toDTO(entity);
259
+    }
232 260
 
233 261
 }

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

@@ -5,6 +5,7 @@ import com.oqpo.api.service.stockmng.StockMngService;
5 5
 import com.oqpo.api.web.dto.request.stockmng.*;
6 6
 import com.oqpo.api.web.dto.response.GridResponse;
7 7
 import com.oqpo.api.web.dto.response.SaveResponse;
8
+import com.oqpo.api.web.dto.response.stockmng.BarcodeWhsItemInfoResponse;
8 9
 import com.oqpo.api.web.dto.response.stockmng.StockMngInfoResponse;
9 10
 import io.swagger.annotations.Api;
10 11
 import io.swagger.annotations.ApiImplicitParam;
@@ -143,6 +144,44 @@ public class StockMngController {
143 144
     }
144 145
    */
145 146
 
147
+    /**
148
+     * 설명 : 창고별 품목 조회 팝업
149
+     *
150
+     * @param stockMngGridRequest
151
+     * @return
152
+     * @throws Exception
153
+     */
154
+    @ApiImplicitParams({
155
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
156
+    })
157
+    @ApiOperation(value = "창고별 품목 조회 팝업")
158
+    @PostMapping("/pop-whs-item-grid-list")
159
+    public ResponseEntity<GridResponse> popWhsItemGridList(@RequestBody @Valid PopWhsItemStockGridRequest popWhsItemStockGridRequest) throws Exception {
160
+        return ResponseEntity.ok(stockMngService.selectPopItemStockMngGridList(popWhsItemStockGridRequest.getSBrandId(),
161
+                popWhsItemStockGridRequest.getSWhsId(), popWhsItemStockGridRequest.getSLocation(),
162
+                popWhsItemStockGridRequest.getSItemNm(), popWhsItemStockGridRequest.toDTO(popWhsItemStockGridRequest)));
163
+    }
146 164
 
165
+    /**
166
+     * 설명 : 바코드를 통한 창고 품목 정보조회
167
+     *
168
+     * @param brandId
169
+     * @param whsId
170
+     * @return
171
+     * @throws Exception
172
+     */
173
+    @ApiImplicitParams({
174
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
175
+            @ApiImplicitParam(name = "sBrandId", value = "브랜드아이디", required = true, dataType = "String", paramType = "query"),
176
+            @ApiImplicitParam(name = "sWhsId", value = "창고아이디", required = true, dataType = "String", paramType = "query"),
177
+            @ApiImplicitParam(name = "sLocation", value = "Location", required = true, dataType = "String", paramType = "query"),
178
+            @ApiImplicitParam(name = "sBarcode", value = "바코드", required = true, dataType = "String", paramType = "query")
179
+    })
180
+    @ApiOperation(value = "바코드를 통한 창고 품목 정보조회")
181
+    @GetMapping("/info-barcode-stock")
182
+    public ResponseEntity<BarcodeWhsItemInfoResponse> infoBarcodeStock(@RequestParam(value = "sBrandId") String sBrandId, @RequestParam(value = "sWhsId") String sWhsId,
183
+                                                                @RequestParam(value = "sLocation") String sLocation, @RequestParam(value = "sBarcode") String sBarcode) throws Exception {
184
+        return ResponseEntity.ok(stockMngService.selectBarcodeWhsItemMngInfo(sBrandId, sWhsId, sLocation, sBarcode));
185
+    }
147 186
 
148 187
 }

+ 25 - 0
src/main/java/com/oqpo/api/web/dto/request/stockmng/PopWhsItemStockGridRequest.java

@@ -0,0 +1,25 @@
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 PopWhsItemStockGridRequest 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
+    @ApiModelProperty(value = "품목명")
20
+    private String sItemNm;
21
+
22
+    protected PopWhsItemStockGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
23
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
24
+    }
25
+}

+ 44 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/BarcodeWhsItemInfoResponse.java

@@ -0,0 +1,44 @@
1
+package com.oqpo.api.web.dto.response.stockmng;
2
+
3
+import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
5
+import io.swagger.annotations.ApiModelProperty;
6
+import lombok.*;
7
+
8
+import java.math.BigDecimal;
9
+
10
+@Getter
11
+@Setter
12
+@Builder
13
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
14
+@JsonInclude(JsonInclude.Include.ALWAYS)
15
+public class BarcodeWhsItemInfoResponse {
16
+
17
+    @ApiModelProperty(value = "브랜드아이디")
18
+    private String brandId;
19
+    @ApiModelProperty(value = "브랜드명")
20
+    private String brandNm;
21
+    @ApiModelProperty(value = "품목아이디")
22
+    private String itemId;
23
+    @ApiModelProperty(value = "품목명")
24
+    private String itemNm;
25
+    @ApiModelProperty(value = "단위")
26
+    private String unit;
27
+    @ApiModelProperty(value = "재고수량")
28
+    private int stckQty;
29
+    @ApiModelProperty(value = "출고대기수량")
30
+    private int waitQty;
31
+
32
+    public static BarcodeWhsItemInfoResponse toDTO(StckMgntBaseInfoEntity entity) {
33
+        if (entity == null) return null;
34
+        return BarcodeWhsItemInfoResponse.builder()
35
+                .brandId(entity.getBrandId())
36
+                .brandNm(entity.getBrandNm())
37
+                .itemId(entity.getItemId())
38
+                .itemNm(entity.getItemNm())
39
+                .unit(entity.getUnit())
40
+                .stckQty(entity.getStckQty())
41
+                .waitQty(entity.getWaitQty())
42
+                .build();
43
+    }
44
+}

+ 33 - 0
src/main/java/com/oqpo/api/web/dto/response/stockmng/PopItemWhsStockListResponse.java

@@ -0,0 +1,33 @@
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
+import java.math.BigDecimal;
8
+
9
+@Getter
10
+@Setter
11
+@Builder
12
+@AllArgsConstructor(access = AccessLevel.PROTECTED)
13
+@JsonInclude(JsonInclude.Include.ALWAYS)
14
+public class PopItemWhsStockListResponse {
15
+
16
+    @ApiModelProperty(value = "CRUD")
17
+    private String viewCd;
18
+
19
+    @ApiModelProperty(value = "브랜드아이디")
20
+    private String brandId;
21
+    @ApiModelProperty(value = "브랜드명")
22
+    private String brandNm;
23
+    @ApiModelProperty(value = "품목아이디")
24
+    private String itemId;
25
+    @ApiModelProperty(value = "품목명")
26
+    private String itemNm;
27
+    @ApiModelProperty(value = "단위")
28
+    private String unit;
29
+    @ApiModelProperty(value = "재고수량-현재고수량")
30
+    private Integer stckQty;
31
+    @ApiModelProperty(value = "대기수량")
32
+    private Integer waitQty;
33
+}

+ 57 - 0
src/main/resources/mybatis/sqlmaps/stockmng/StockMng.xml

@@ -372,4 +372,61 @@
372 372
             #{item.itemId}
373 373
         </foreach>
374 374
     </select>
375
+
376
+
377
+    <select id="selectPopItemStockMngGridList" resultType="com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity">
378
+        select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm, base.item_id, item.item_nm, base.unit, base.stck_qty, base.wait_qty
379
+        from  stck_mgnt_base_info base
380
+            , item_base_info item
381
+        where base.brand_id = item.brand_id
382
+        and   base.item_id = item.item_id
383
+        and   base.brand_id = #{sBrandId}
384
+        and   base.whs_id = #{sWhsId}
385
+        and   base.location = #{sLocation}
386
+        <if test="sItemNm != null and sItemNm != ''">
387
+        and   (item.item_id like concat('%', #{sItemNm},'%') or item.item_nm like concat('%', #{sItemNm},'%'))
388
+        </if>
389
+        <choose>
390
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
391
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
392
+                    <if test="gridRequest.sord == 'asc'.toString()">
393
+                        ORDER BY item.item_nm ASC
394
+                    </if>
395
+                    <if test="gridRequest.sord == 'desc'.toString()">
396
+                        ORDER BY item.item_nm DESC
397
+                    </if>
398
+                </if>
399
+            </when>
400
+            <otherwise>
401
+                ORDER BY item.item_nm ASC
402
+            </otherwise>
403
+        </choose>
404
+        <if test="gridRequest.pagingYn == true">
405
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
406
+        </if>
407
+
408
+    </select>
409
+
410
+    <select id="selectPopItemStockMngGridCnt" resultType="int">
411
+        select count(*) as cnt
412
+        from  stck_mgnt_base_info base
413
+        , item_base_info item
414
+        where base.brand_id = item.brand_id
415
+        and   base.item_id = item.item_id
416
+        and   base.brand_id = #{sBrandId}
417
+        and   base.whs_id = #{sWhsId}
418
+        and   base.location = #{sLocation}
419
+        <if test="sItemNm != null and sItemNm != ''">
420
+            and   (item.item_id like concat('%', #{sItemNm},'%') or item.item_nm like concat('%', #{sItemNm},'%'))
421
+        </if>
422
+    </select>
423
+
424
+    <select id="selectPopItemStockInfo" resultType="com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity">
425
+        select base.brand_id, fn_brand_nm(base.brand_id) as brand_nm, base.item_id, item.item_nm, base.unit, base.stck_qty, base.wait_qty
426
+        from  item_base_info item
427
+         left outer join stck_mgnt_base_info base on base.brand_id = item.brand_id and base.item_id = item.item_id
428
+                        and   base.whs_id = #{sWhsId} and   base.location = #{sLocation}
429
+        where item.brand_id = #{sBrandId}
430
+        and   item.barcode = #{sBarcode}
431
+    </select>
375 432
 </mapper>