Ver código fonte

단가 팝업 및 구매요청현황 에서 삭제기능 추가

dwkim 2 anos atrás
pai
commit
8f870556c8

+ 3 - 0
src/main/java/com/oqpo/api/mapper/pomng/PchReqMapper.java

@@ -91,4 +91,7 @@ public interface PchReqMapper {
91 91
 
92 92
     int selectCancelPchReqAmt(@Param("pchPodrUnqNo") String pchPodrUnqNo, List<PchOdrDtlPtclEntity> gridUpdateData)throws Exception;
93 93
 
94
+
95
+    int updateOrdPchReqDelete(@Param("brandId") String brandId, @Param("pchReqUnqNo") String pchReqUnqNo, @Param("userId") String userId )throws Exception;
96
+
94 97
 }

+ 2 - 0
src/main/java/com/oqpo/api/mapper/stinfo/ItemUnitMapper.java

@@ -75,5 +75,7 @@ public interface ItemUnitMapper {
75 75
     List<ItemUnitEntity> selectPopItemStoreUnitBaseGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId,  @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, GridRequest gridRequest)throws Exception;
76 76
     int selectPopItemStoreUnitBaseGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn)throws Exception;
77 77
 
78
+    List<ItemUnitEntity> selectPopContItemBrandUnitGridList(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("contYn") String contYn, GridRequest gridRequest)throws Exception;
79
+    int selectPopContItemBrandUnitGridCnt(@Param("sBrandId") String sBrandId, @Param("sItemNm") String sItemNm, @Param("sPodrPssblDvsn") String sPodrPssblDvsn, @Param("contYn") String contYn)throws Exception;
78 80
 
79 81
 }

+ 24 - 2
src/main/java/com/oqpo/api/service/pomng/PchReqService.java

@@ -8,7 +8,6 @@ import com.oqpo.api.entity.pomng.PchReqDtlPtclEntity;
8 8
 import com.oqpo.api.entity.pomng.PchWishListEntity;
9 9
 import com.oqpo.api.entity.pomng.PchWishListItemEntity;
10 10
 import com.oqpo.api.entity.pomng.WishListItemEntity;
11
-import com.oqpo.api.entity.rtnmng.RtnReqDtlPtclEntity;
12 11
 import com.oqpo.api.entity.stinfo.BrandEntity;
13 12
 import com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity;
14 13
 import com.oqpo.api.enums.SystemMessageCode;
@@ -682,6 +681,29 @@ public class PchReqService extends CommonService {
682 681
     }
683 682
 
684 683
 
685
-    
684
+    /* 구매요청 임시저장 삭제 */
685
+    @Transactional
686
+    public void delPchReqInfo(String userId, String brandId, String pchReqUnqNo) throws Exception {
687
+        try {
688
+
689
+            // 임시저장 여부 확인
690
+            String jobProcYn = pchReqMapper.selectPchReqStatProcYn(brandId, pchReqUnqNo);
691
+
692
+            // N일경우 이미 임시저장 상태가 아님을 알림
693
+            if ("N".toString().equals(jobProcYn)) {
694
+                throw new GlobalException(SystemMessageCode.ERR_PCH_JOB_FAIL);
695
+            }
696
+
697
+            pchReqMapper.updateOrdPchReqDelete(brandId, pchReqUnqNo, userId);
698
+
699
+
700
+        } catch (GlobalException e) {
701
+            e.getStackTrace();
702
+            throw new GlobalException(e.getSystemMessageCode());
703
+        } catch (Exception e) {
704
+            e.getStackTrace();
705
+            throw new RuntimeException();
706
+        }
707
+    }
686 708
 
687 709
 }

+ 47 - 0
src/main/java/com/oqpo/api/service/stinfo/ItemService.java

@@ -931,4 +931,51 @@ public class ItemService extends CommonService {
931 931
                 .collect(Collectors.toList());
932 932
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
933 933
     }
934
+
935
+
936
+    /*
937
+      팝업 품목 리스트 조회
938
+     */
939
+    public GridResponse selectPopItemContGridList(String sBrandId, String sStoreId, String sPodrPssblDvsn, String sItemNm, String contYn,
940
+                                                  GridRequest gridRequest) throws Exception {
941
+        int gridPage = gridRequest.getGridPage();
942
+        int gridSize = gridRequest.getGridSize();
943
+
944
+        int gridRecords = 0;
945
+        int gridTotal = 0;
946
+        List<ItemUnitEntity> entities = new ArrayList<ItemUnitEntity>();
947
+
948
+        //if (StringUtil.isEmpty(sStoreId)) {
949
+        //    gridRecords = itemUnitMapper.selectPopItemBrandBaseUnitGridCnt(sBrandId, sItemNm, sPodrPssblDvsn);
950
+       //     gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
951
+        //    entities = itemUnitMapper.selectPopItemBrandBaseUnitGridList(sBrandId, sItemNm, sPodrPssblDvsn, gridRequest);
952
+       // } else {
953
+            gridRecords = itemUnitMapper.selectPopContItemBrandUnitGridCnt(sBrandId,  sItemNm, sPodrPssblDvsn, contYn.toString());
954
+            gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
955
+            entities = itemUnitMapper.selectPopContItemBrandUnitGridList(sBrandId,  sItemNm, sPodrPssblDvsn,contYn.toString(),  gridRequest);
956
+       // }
957
+
958
+        List<Object> gridRows = entities.stream()
959
+                .map(m -> ItemPopSearchResponse.builder()
960
+                        .viewCd("R")
961
+                        .itemId(m.getItemId())
962
+                        .itemNm(m.getItemNm())
963
+                        .podrPssblDvsn(m.getPodrPssblDvsn())
964
+                        .podrPssblDvsnNm(m.getPodrPssblDvsnNm())
965
+                        .unit(m.getUnit())
966
+                        .unitNm(m.getUnitNm())
967
+                        .unitAmt(m.getUnitAmt())
968
+                        .stddQty(m.getStddQty())
969
+                        .unitGubun(m.getUnitGubun())
970
+                        .spplyId(m.getSpplyId())
971
+                        .spplyNm(m.getSpplyNm())
972
+                        .brandUnitUnqNo(m.getBrandUnitUnqNo())
973
+                        .storeUnitUnqNo(m.getStoreUnitUnqNo() == null ? "" : m.getStoreUnitUnqNo())
974
+                        .whsPassQty(m.getWhsPassQty() == null ? 0 : m.getWhsPassQty())
975
+                        .storeDeliType(m.getStoreDeliType() == null ? "" : m.getStoreDeliType())
976
+                        .storeDeliTypeNm(m.getStoreDeliTypeNm() == null ? "" : m.getStoreDeliTypeNm())
977
+                        .build())
978
+                .collect(Collectors.toList());
979
+        return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
980
+    }
934 981
 }

+ 20 - 1
src/main/java/com/oqpo/api/web/controller/pomng/PchReqController.java

@@ -282,8 +282,27 @@ public class PchReqController {
282 282
         return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
283 283
     }
284 284
 
285
-    
286 285
 
286
+    /**
287
+     * 설명 : 구매요청 임시저장 삭제
288
+     *
289
+     * @param userId
290
+     * @param savePchReqlRequest
291
+     * @return SaveResponse
292
+     * @throws Exception
293
+     */
294
+    @ApiImplicitParams({
295
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header"),
296
+            @ApiImplicitParam(name = "brandId", value = "브랜드코드", required = true, dataType = "String", paramType = "query"),
297
+            @ApiImplicitParam(name = "pchReqUnqNo", value = "발주요청번호", required = true, dataType = "String", paramType = "query")
298
+    })
299
+    @ApiOperation(value = "구매요청 임시저장 삭제")
300
+    @GetMapping("/del-pchReq")
301
+    public ResponseEntity<SaveResponse> delPchReq(@ApiIgnore String userId,  @RequestParam(value = "brandId") String brandId,  @RequestParam(value = "pchReqUnqNo") String pchReqUnqNo) throws Exception {
302
+        pchReqService.delPchReqInfo(userId,  brandId, pchReqUnqNo);
303
+        return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.DELETE_OK));
304
+
305
+    }
287 306
 
288 307
 
289 308
 

+ 18 - 0
src/main/java/com/oqpo/api/web/controller/stinfo/ItemController.java

@@ -413,4 +413,22 @@ public class ItemController {
413 413
         return ResponseEntity.ok(itemService.selectPopItemBaseGridList(itemPopGridRequest.getSBrandId(), itemPopGridRequest.getSStoreId(),
414 414
                 itemPopGridRequest.getSPodrPssblDvsn(), itemPopGridRequest.getSItemNm(), itemPopGridRequest.toDTO(itemPopGridRequest)));
415 415
     }
416
+
417
+
418
+    /**
419
+     * 설명 : 품목 팝업 그리드 리스트
420
+     *
421
+     * @param itemContPopGridRequest
422
+     * @return
423
+     * @throws Exception
424
+     */
425
+    @ApiImplicitParams({
426
+            @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
427
+    })
428
+    @ApiOperation(value = " 품목 단가 팝업 기본 리스트")
429
+    @PostMapping("/pop-cont-item-list")
430
+    public ResponseEntity<GridResponse> selectPopItemBaseGridList(@RequestBody @Valid ItemContPopGridRequest itemContPopGridRequest) throws Exception {
431
+        return ResponseEntity.ok(itemService.selectPopItemContGridList(itemContPopGridRequest.getSBrandId(), itemContPopGridRequest.getSStoreId(),
432
+                itemContPopGridRequest.getSPodrPssblDvsn(), itemContPopGridRequest.getSItemNm(),  itemContPopGridRequest.getContYn().toString(), itemContPopGridRequest.toDTO(itemContPopGridRequest)));
433
+    }
416 434
 }

+ 33 - 0
src/main/java/com/oqpo/api/web/dto/request/stinfo/item/ItemContPopGridRequest.java

@@ -0,0 +1,33 @@
1
+package com.oqpo.api.web.dto.request.stinfo.item;
2
+
3
+import com.oqpo.api.web.dto.request.GridRequest;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+
9
+
10
+@Getter
11
+@Setter
12
+public class ItemContPopGridRequest extends GridRequest {
13
+
14
+    @NotBlank
15
+    @ApiModelProperty(value = "브랜드아이디")
16
+    private String sBrandId;
17
+
18
+    @ApiModelProperty(value = "매장아이디")
19
+    private String sStoreId;
20
+
21
+    @ApiModelProperty(value = "발주가능여부")
22
+    private String sPodrPssblDvsn;
23
+
24
+    @ApiModelProperty(value = "품목명")
25
+    private String sItemNm;
26
+
27
+    @ApiModelProperty(value = "단가계약건 포함여부")
28
+    private String contYn;
29
+
30
+    protected ItemContPopGridRequest(Integer gridSize, Integer gridPage, String sidx, String sord, Boolean pagingYn, Integer gridFirst) {
31
+        super(gridSize, gridPage, sidx, sord, pagingYn, gridFirst);
32
+    }
33
+}

+ 13 - 0
src/main/resources/mybatis/sqlmaps/pomng/PchReq.xml

@@ -15,6 +15,7 @@
15 15
                 ,pch_req_mgr_id
16 16
         from   pch_req_base_info
17 17
         where  brand_id = #{sBrandId}
18
+        and    pch_req_st_cd <![CDATA[ <> ]]> 'PR98'
18 19
         <if test="sStoreId == null or sStoreId == ''">
19 20
             and   ((store_id is null or store_id = '') or (store_id is not null and store_id <![CDATA[ <> ]]> '' and pch_req_st_cd <![CDATA[ <> ]]> 'PR00'))
20 21
         </if>
@@ -57,6 +58,7 @@
57 58
             select count(*) as cnt
58 59
             from   pch_req_base_info
59 60
             where  brand_id = #{sBrandId}
61
+            and    pch_req_st_cd <![CDATA[ <> ]]> 'PR98'
60 62
             <if test="sStoreId == null or sStoreId == ''">
61 63
                 and   ((store_id is null or store_id = '') or (store_id is not null and store_id <![CDATA[ <> ]]> '' and pch_req_st_cd <![CDATA[ <> ]]> 'PR00'))
62 64
             </if>
@@ -572,4 +574,15 @@
572 574
         </foreach>
573 575
     </select>
574 576
 
577
+
578
+    <update id="updateOrdPchReqDelete">
579
+        UPDATE /* PchReq.updateOrdPchReqDelete */
580
+            pch_req_base_info SET
581
+                pch_req_st_cd = 'PR98',
582
+                sys_chg_dttm = NOW(),
583
+                sys_chg_id = #{userId}
584
+            WHERE brand_id = #{brandId}
585
+            and   pch_req_unq_no = #{pchReqUnqNo}
586
+    </update>
587
+
575 588
 </mapper>

+ 61 - 0
src/main/resources/mybatis/sqlmaps/stinfo/ItemUnit.xml

@@ -845,4 +845,65 @@
845 845
             and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
846 846
         </if>
847 847
     </select>
848
+
849
+
850
+    <select id="selectPopContItemBrandUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
851
+        select  /* selectPopContItemBrandUnitGridList */
852
+            iInfo.item_id,iInfo.item_nm,iInfo.podr_pssbl_dvsn, fn_code_nm('PODR_PSSBL_DVSN',iInfo.podr_pssbl_dvsn) AS podr_pssbl_dvsn_nm
853
+            ,iInfo.unit, fn_code_nm('DSTRBT_COST_UNIT', iInfo.unit) as unit_nm
854
+        from item_base_info iInfo
855
+        where iInfo.brand_id = #{sBrandId}
856
+        AND   iInfo.item_st_cd = 'IS00'
857
+        <if test="sItemNm != null and sItemNm != ''">
858
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
859
+        </if>
860
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
861
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
862
+        </if>
863
+        <if test="contYn == 'N'.toString()">
864
+            and iInfo.item_id not in ( select item_id
865
+                                    from   brand_item_unit_info iunit
866
+                                    where  iunit.brand_id = #{sBrandId}
867
+                                    and    date_format(now() , '%Y%m%d') between cont_stt_dt and cont_end_dt )
868
+        </if>
869
+
870
+        <choose>
871
+            <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
872
+                <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
873
+                    <if test="gridRequest.sord == 'asc'.toString()">
874
+                        order by iInfo.item_nm asc
875
+                    </if>
876
+                    <if test="gridRequest.sord == 'desc'.toString()">
877
+                        order by iInfo.item_nm desc
878
+                    </if>
879
+                </if>
880
+            </when>
881
+            <otherwise>
882
+                order by iInfo.item_nm asc
883
+            </otherwise>
884
+        </choose>
885
+        <if test="gridRequest.pagingYn == true">
886
+            limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
887
+        </if>
888
+    </select>
889
+
890
+    <select id="selectPopContItemBrandUnitGridCnt" resultType="int">
891
+        select  /* selectPopContItemBrandUnitGridCnt */
892
+        count(*)
893
+        from item_base_info iInfo
894
+        where iInfo.brand_id = #{sBrandId}
895
+        AND   iInfo.item_st_cd = 'IS00'
896
+        <if test="sItemNm != null and sItemNm != ''">
897
+            and  (iInfo.item_nm like concat('%',#{sItemNm},'%') or iInfo.item_id like concat('%',#{sItemNm},'%'))
898
+        </if>
899
+        <if test="sPodrPssblDvsn != null and sPodrPssblDvsn != ''">
900
+            and   iInfo.podr_pssbl_dvsn = #{sPodrPssblDvsn}
901
+        </if>
902
+        <if test="contYn == 'N'.toString()">
903
+            and iInfo.item_id not in ( select item_id
904
+                                from   brand_item_unit_info iunit
905
+                                where  iunit.brand_id = #{sBrandId}
906
+                                and    date_format(now() , '%Y%m%d') between cont_stt_dt and cont_end_dt )
907
+        </if>
908
+    </select>
848 909
 </mapper>