Bläddra i källkod

반품 발주 취소처리 함

dwkim 2 år sedan
förälder
incheckning
32d6c62fb6

+ 51 - 0
src/main/java/com/oqpo/api/entity/inoutmng/ColOdrBaseEntity.java

@@ -0,0 +1,51 @@
1
+package com.oqpo.api.entity.inoutmng;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+import lombok.ToString;
6
+
7
+import java.io.Serializable;
8
+
9
+@Getter
10
+@Setter
11
+@ToString
12
+public class ColOdrBaseEntity implements Serializable {
13
+    private static final long serialVersionUID = -3590936033715917450L;
14
+
15
+    private String colCmdUnqNo;
16
+    private String colRegDt;
17
+    private String brandId;
18
+    private String whsId;
19
+    private String location;
20
+    private String whsNm;
21
+    private String locationNm;
22
+    private String storeId;
23
+    private String storeNm;
24
+    private Integer itemQty;
25
+    private Long colTotalAmt;
26
+    private String colReqDt;
27
+    private String colDvsn;
28
+    private String colDvsnNm;
29
+    private String colCmdStCd;
30
+    private String colCmdStNm;
31
+    private String colReqMgrNm;
32
+    private String colReqMgrId;
33
+    private String colDt;
34
+    private String colCnfmNm;
35
+    private String colCnfmId;
36
+    private String colMgrNm;
37
+    private String colMgrTelNo;
38
+    private String colMgrEmal;
39
+    private String colMgrMblNo;
40
+    private String rtnWhsId;
41
+    private String rtnLocation;
42
+    private String rtnWhsNm;
43
+    private String rtnLocationNm;
44
+    private String spplyId;
45
+    private String spplyNm;
46
+    private String sysRegDttm;
47
+    private String sysRegId;
48
+    private String sysChgDttm;
49
+    private String sysChgId;
50
+
51
+}

+ 35 - 0
src/main/java/com/oqpo/api/entity/inoutmng/ColOdrDtlPtclEntity.java

@@ -0,0 +1,35 @@
1
+package com.oqpo.api.entity.inoutmng;
2
+
3
+import lombok.Getter;
4
+import lombok.Setter;
5
+import lombok.ToString;
6
+
7
+import java.io.Serializable;
8
+
9
+@Getter
10
+@Setter
11
+@ToString
12
+public class ColOdrDtlPtclEntity implements Serializable {
13
+    private static final long serialVersionUID = -3590936033715917450L;
14
+
15
+    private String colCmdUnqNo;
16
+    private String colCmdDtlNo;
17
+    private String itemId;
18
+    private String itemNm;
19
+    private Long unitAmt;
20
+    private Integer colQty;
21
+    private Long colAmt;
22
+    private Integer rtnQty;
23
+    private Long rtnAmt;
24
+    private String rtnRsnDvsn;
25
+    private String rtnRsn;
26
+    private String rtnPodrUnqNo;
27
+    private String rtnPodrDtlNo;
28
+    private String rtnReqDtlNo;
29
+    private String rtnReqUnqNo;
30
+    private String sysRegDttm;
31
+    private String sysRegId;
32
+    private String sysChgDttm;
33
+    private String sysChgId;
34
+
35
+}

+ 1 - 0
src/main/java/com/oqpo/api/enums/SystemMessageCode.java

@@ -59,6 +59,7 @@ public enum SystemMessageCode {
59 59
     ERR_NOTITEM (40030, "대상품목이 없습니다.", HttpStatus.BAD_REQUEST),
60 60
     ERR_NOTSPPLY (40031, "공급사 정보가 없습니다.", HttpStatus.BAD_REQUEST),
61 61
     ERR_INGPOCNT (40032, "발주 진행중인건이 있어서 반품 반려 처리를 할 수 없습니다.", HttpStatus.BAD_REQUEST),
62
+    ERR_INGCOLCNT (40033, "발주 진행중인건이 있어서 반품 취소처리를 할 수 없습니다.", HttpStatus.BAD_REQUEST),
62 63
     ;
63 64
 
64 65
 

+ 73 - 0
src/main/java/com/oqpo/api/mapper/inoutmng/ColOdrMapper.java

@@ -0,0 +1,73 @@
1
+package com.oqpo.api.mapper.inoutmng;
2
+
3
+
4
+import com.oqpo.api.entity.inoutmng.DeliDtlMgntEntity;
5
+import com.oqpo.api.entity.inoutmng.DeliInfoMgntEntity;
6
+import com.oqpo.api.entity.inoutmng.ShmtOdrBaseEntity;
7
+import com.oqpo.api.entity.inoutmng.ShmtOdrDtlEntity;
8
+import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
9
+import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
10
+import com.oqpo.api.entity.stockmng.WhsProcInfoPtclEntity;
11
+import com.oqpo.api.web.dto.request.GridRequest;
12
+import org.apache.ibatis.annotations.Mapper;
13
+import org.apache.ibatis.annotations.Param;
14
+
15
+import java.util.List;
16
+
17
+@Mapper
18
+public interface ColOdrMapper {
19
+    int selectColRtnIngCnt(@Param("brandId") String brandId, @Param("rtnPodrUnqNo") String rtnPodrUnqNo)throws Exception;
20
+
21
+    /*
22
+    List<PchOdrBaseInfoEntity> selectShmtTargetOdrGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sShmtWhsId") String sShmtWhsId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
23
+    int selectShmtTargetOdrGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sShmtWhsId") String sShmtWhsId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm)throws Exception;
24
+
25
+    int insertShmtOdrBase(@Param("userId") String userId, ShmtOdrBaseEntity entity)throws Exception;
26
+    int insertShmtOdrDtl(@Param("userId") String userId, List<ShmtOdrDtlEntity> gridInsertData)throws Exception;
27
+
28
+    List<PchOdrBaseInfoEntity> selectShmtJobDataList(@Param("brandId") String brandId, List<PchOdrDtlPtclEntity> gridInsertData)throws Exception;
29
+
30
+    int insertDeliInfoMngt(@Param("userId") String userId, DeliInfoMgntEntity entity)throws Exception;
31
+    int insertDeliDtlPtcl(@Param("userId") String userId, List<DeliDtlMgntEntity> gridInsertData)throws Exception;
32
+
33
+    List<ShmtOdrBaseEntity> selectShmtSearchGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sShmtWhsId") String sShmtWhsId, @Param("sShmtReqStCd") String sShmtReqStCd, @Param("swhsId") String swhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
34
+    int selectShmtSearchGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sShmtWhsId") String sShmtWhsId, @Param("sShmtReqStCd") String sShmtReqStCd, @Param("swhsId") String swhsId, @Param("sItemNm") String sItemNm)throws Exception;
35
+
36
+    DeliInfoMgntEntity selectInvInfo(@Param("brandId") String brandId, @Param("dlvSttmtUnqNo") String dlvSttmtUnqNo)throws Exception;
37
+    List<DeliDtlMgntEntity> selectInvDtlList(@Param("brandId") String brandId, @Param("dlvSttmtUnqNo") String dlvSttmtUnqNo)throws Exception;
38
+
39
+    List<PchOdrBaseInfoEntity> selectSpplyTargetOdrGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
40
+    int selectSpplyTargetOdrGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm)throws Exception;
41
+
42
+    PchOdrBaseInfoEntity selectSpplyShmtOdrInfo(@Param("brandId") String brandId, @Param("spplyId") String spplyId, @Param("pchPodrUnqNo") String pchPodrUnqNo)throws Exception;
43
+    List<PchOdrDtlPtclEntity> selectSpplyShmtOdrList(@Param("pchPodrUnqNo") String pchPodrUnqNo)throws Exception;
44
+
45
+
46
+    List<DeliInfoMgntEntity> selectDeliGridList(@Param("sBrandId") String sBrandId, @Param("dtGubun") String dtGubun, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sDlvStCd") String sDlvStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
47
+    int selectDeliGridCnt(@Param("sBrandId") String sBrandId, @Param("dtGubun") String dtGubun, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sDlvStCd") String sDlvStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm)throws Exception;
48
+
49
+    List<DeliInfoMgntEntity> selectSpplyDeliGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
50
+    int selectSpplyDeliGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm)throws Exception;
51
+
52
+    List<DeliInfoMgntEntity> selectWarehouseTargetGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sSpplyId") String sSpplyId, @Param("sDlvSttmtUnqNo") String sDlvSttmtUnqNo, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
53
+    int selectWarehouseTargetGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sSpplyId") String sSpplyId, @Param("sDlvSttmtUnqNo") String sDlvSttmtUnqNo, @Param("sItemNm") String sItemNm)throws Exception;
54
+
55
+    int insertWhsProcInfoPtcl(@Param("userId") String userId, List<WhsProcInfoPtclEntity> gridUpdateData)throws Exception;
56
+
57
+    List<DeliInfoMgntEntity> selectWarehouseProcList(@Param("brandId") String brandId, @Param("whsId") String whsId, List<DeliDtlMgntEntity> gridUpdateData)throws Exception;
58
+
59
+
60
+    int updateDeliDtlStCd(@Param("userId") String userId, List<DeliDtlMgntEntity> gridUpdateData)throws Exception;
61
+    List<DeliInfoMgntEntity> selectDeliInfoStList(@Param("userId") String userId, List<DeliDtlMgntEntity> gridUpdateData)throws Exception;
62
+    int updateDeliInfoStCd(@Param("userId") String userId, List<DeliInfoMgntEntity> gridUpdateData)throws Exception;
63
+
64
+    int updateShmtDtlStCd(@Param("userId") String userId, List<ShmtOdrDtlEntity> gridUpdateData)throws Exception;
65
+    List<ShmtOdrBaseEntity> selectShmtInfoStList(@Param("userId") String userId, List<ShmtOdrDtlEntity> gridUpdateData)throws Exception;
66
+    int updateShmtInfoStCd(@Param("userId") String userId, List<ShmtOdrBaseEntity> gridUpdateData)throws Exception;
67
+
68
+    int updatePchPodrDtlStCd(@Param("userId") String userId, List<PchOdrDtlPtclEntity> gridUpdateData)throws Exception;
69
+
70
+    List<WhsProcInfoPtclEntity> selectWarehouseList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchPodrUnqNo") String sPchPodrUnqNo, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
71
+    int selectWarehouseCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchPodrUnqNo") String sPchPodrUnqNo, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm)throws Exception;
72
+    */
73
+}

+ 3 - 0
src/main/java/com/oqpo/api/mapper/rtnmng/RtnOdrMapper.java

@@ -34,6 +34,9 @@ public interface RtnOdrMapper {
34 34
     RtnOdrBaseInfoEntity selectRtnOdrInfo(@Param("rtnPodrUnqNo") String rtnPodrUnqNo);
35 35
     List<RtnOdrDtlPtclEntity> selectROdrDtlList(@Param("rtnPodrUnqNo") String rtnPodrUnqNo);
36 36
 
37
+    int updateChgRodrStCd(@Param("userId") String userId, @Param("rtnPodrUnqNo") String rtnPodrUnqNo, @Param("rtnOdrStCd") String rtnOdrStCd);
38
+    int updateChangeRodrDtlStCd(@Param("userId") String userId, @Param("rtnPodrUnqNo") String rtnPodrUnqNo, @Param("rodrDtlStCd") String rodrDtlStCd);
39
+
37 40
     /*
38 41
 
39 42
 

+ 44 - 66
src/main/java/com/oqpo/api/service/rtnmng/RtnOdrService.java

@@ -10,6 +10,7 @@ import com.oqpo.api.entity.rtnmng.RtnReqBaseInfoEntity;
10 10
 import com.oqpo.api.entity.rtnmng.RtnReqDtlPtclEntity;
11 11
 import com.oqpo.api.enums.SystemMessageCode;
12 12
 import com.oqpo.api.exception.GlobalException;
13
+import com.oqpo.api.mapper.inoutmng.ColOdrMapper;
13 14
 import com.oqpo.api.mapper.loanmng.LoanStateMapper;
14 15
 import com.oqpo.api.mapper.oper.UserMngMapper;
15 16
 import com.oqpo.api.mapper.rtnmng.RtnOdrMapper;
@@ -18,6 +19,8 @@ import com.oqpo.api.mapper.stinfo.StoreBaseInfoMapper;
18 19
 import com.oqpo.api.mapper.stockmng.StockMngMapper;
19 20
 import com.oqpo.api.service.CommonService;
20 21
 import com.oqpo.api.web.dto.request.GridRequest;
22
+import com.oqpo.api.web.dto.request.pomng.pchOrd.CancelPchOrdDtlRequest;
23
+import com.oqpo.api.web.dto.request.rtnmng.CancelRtnOrdDtlRequest;
21 24
 import com.oqpo.api.web.dto.request.rtnmng.RtnReqOrdInitRequest;
22 25
 import com.oqpo.api.web.dto.request.rtnmng.SaveRtnOrdRequest;
23 26
 import com.oqpo.api.web.dto.response.GridResponse;
@@ -29,6 +32,7 @@ import com.oqpo.api.web.dto.response.rtnmng.rtnOrd.RtnOrdInitInfoResponse;
29 32
 import com.oqpo.api.web.dto.response.rtnmng.rtnOrd.RtnOrdNInitInfoResponse;
30 33
 import com.oqpo.api.web.dto.response.rtnmng.rtnReq.RtnReqInitInfoResponse;
31 34
 import lombok.extern.slf4j.Slf4j;
35
+import org.apache.ibatis.annotations.Param;
32 36
 import org.springframework.beans.factory.annotation.Autowired;
33 37
 import org.springframework.stereotype.Service;
34 38
 import org.springframework.transaction.annotation.Transactional;
@@ -52,6 +56,9 @@ public class RtnOdrService extends CommonService {
52 56
     @Autowired
53 57
     private RtnReqMapper rtnReqMapper;
54 58
 
59
+    @Autowired
60
+    private ColOdrMapper colOdrMapper;
61
+
55 62
     @Autowired
56 63
     private StoreBaseInfoMapper storeBaseInfoMapper;
57 64
 
@@ -427,47 +434,52 @@ public class RtnOdrService extends CommonService {
427 434
 
428 435
 
429 436
     /*
430
-      발주 취소처리
431
-
437
+      반품 발주 취소처리
438
+    */
432 439
     @Transactional
433
-    public void cancelPchOrdDtl(String userId, CancelPchOrdDtlRequest cancelPchOrdDtlRequest) throws Exception {
440
+    public void cancelRtnOrdDtl(String userId, CancelRtnOrdDtlRequest cancelRtnOrdDtlRequest) throws Exception {
434 441
         try {
435
-            // 품목 삭제 상태처리
436
-            long podrAmt = 0;
437
-            List<rtnOdrDtlPtclEntity> gridUpdateData = cancelPchOrdDtlRequest.toCodeEntities(cancelPchOrdDtlRequest.getGridUpdateData());
438
-            List<StckMgntBaseInfoEntity> stckList = new ArrayList<StckMgntBaseInfoEntity>();
439
-            if (gridUpdateData.size() > 0) {
440
-                pchOrdMapper.updateCancelPodrDtl(userId,  gridUpdateData) ;
441 442
 
442
-                for (int i = 0 ; i < gridUpdateData.size() ; i++) {
443
-                    rtnOdrDtlPtclEntity delItem = gridUpdateData.get(i);
444
-                    podrAmt = podrAmt + delItem.getPodrAmt();
443
+            // 수거서 생성 여부 파악 (이미생성시 반품 취소 불가)
444
+            int ingCnt = colOdrMapper.selectColRtnIngCnt(cancelRtnOrdDtlRequest.getBrandId(), cancelRtnOrdDtlRequest.getRtnPodrUnqNo());
445 445
 
446
-                    if ("DL01".equals(cancelPchOrdDtlRequest.getDlvDvsn())) { // 본사배송이면
447
-                        StckMgntBaseInfoEntity stckEntity = new StckMgntBaseInfoEntity();
448
-                        stckEntity.setItemId(delItem.getItemId());
449
-                        stckEntity.setWaitQty(delItem.getPodrQty());
450
-                        stckList.add(stckEntity);
451
-                    }
452
-                }
446
+            if (ingCnt > 0) {
447
+                throw new GlobalException(SystemMessageCode.ERR_INGCOLCNT);
453 448
             }
454 449
 
455
-            //발주취소로 인한 발주 head 상태값 변경처리  pchPodrUnqNo
456
-            String rtnOdrStCd = selectOdrDtlStatusList(cancelPchOrdDtlRequest.getPchPodrUnqNo());
457
-            pchOrdMapper.updateChgPodrStCd(userId, rtnOdrStCd, cancelPchOrdDtlRequest.getPchPodrUnqNo());
450
+            //반품요청 취소처리
451
+            rtnOdrMapper.updateChgRodrStCd(userId, cancelRtnOrdDtlRequest.getRtnPodrUnqNo(),"RO99");
452
+            rtnOdrMapper.updateChangeRodrDtlStCd(userId, cancelRtnOrdDtlRequest.getRtnPodrUnqNo(),"ROD2");
458 453
 
459
-            // 매장 구매요청 발주일경우 사용금액 차감 처리함
460
-            if (!"".equals(cancelPchOrdDtlRequest.getStoreId())) {
461
-                String loanMgntUnqNo = storeBaseInfoMapper.selectStoreLoanMgntUnqNo(cancelPchOrdDtlRequest.getStoreId());
454
+            RtnOdrBaseInfoEntity rtnOdrInfo = rtnOdrMapper.selectRtnOdrInfo(cancelRtnOrdDtlRequest.getRtnPodrUnqNo());
462 455
 
463
-                if (loanMgntUnqNo != null) {
464
-                    loanStateMapper.updateloanMinusPchReqUseAmt(loanMgntUnqNo, cancelPchOrdDtlRequest.getStoreId(), podrAmt);
465
-                }
466
-            }
456
+            // 반품요청건에 대한 상태에 대한 처리상태 변경  RR01
457
+            if ("RR01".equals(rtnOdrInfo.getRtnReqDvsn())) {   // 요청반품건은 반품요청건 상태 변경처리함
458
+                List<RtnOdrDtlPtclEntity> rtnOrdList =  rtnOdrMapper.selectROdrDtlList(cancelRtnOrdDtlRequest.getRtnPodrUnqNo());
459
+
460
+                List<RtnReqDtlPtclEntity> rtnReqDtlList = new ArrayList<RtnReqDtlPtclEntity>();
461
+                List<RtnReqBaseInfoEntity> rtnReqBaseList = new ArrayList<RtnReqBaseInfoEntity>();
462
+                String rtnReqUnqNo = "";
463
+                for (int i = 0 ; i < rtnOrdList.size() ;i++) {
464
+                    RtnOdrDtlPtclEntity rtnOdrEntity = rtnOrdList.get(i);
465
+                    RtnReqDtlPtclEntity rtnReqDtlEntity = new RtnReqDtlPtclEntity();
466
+                    RtnReqBaseInfoEntity rtnReqBaseEntity = new RtnReqBaseInfoEntity();
467
+
468
+                    rtnReqDtlEntity.setRtnReqUnqNo(rtnOdrEntity.getRtnReqUnqNo());
469
+                    rtnReqDtlEntity.setRtnReqDtlNo(rtnOdrEntity.getRtnReqDtlNo());
470
+                    rtnReqDtlEntity.setRtnReqDtlStCd("RRD99");
471
+                    rtnReqDtlList.add(rtnReqDtlEntity);
467 472
 
468
-            //출고가능수량을 복구처리
469
-            if ("DL01".equals(cancelPchOrdDtlRequest.getDlvDvsn())) { // 본사배송이면
470
-                stockMngMapper.updateStckPoUseQty(userId, cancelPchOrdDtlRequest.getBrandId(), cancelPchOrdDtlRequest.getShmtWhsId(), cancelPchOrdDtlRequest.getShmtLocation(), stckList );
473
+                    if (!rtnReqUnqNo.equals(rtnOdrEntity.getRtnReqUnqNo())) {
474
+                        rtnReqUnqNo = rtnOdrEntity.getRtnReqUnqNo();
475
+                        rtnReqBaseEntity.setRtnReqUnqNo(rtnReqUnqNo);
476
+
477
+                        String rtnReqStcd = rtnReqService.selectRtnReqDtlStatusList(rtnReqUnqNo);
478
+                        rtnReqBaseEntity.setRtnReqStCd(rtnReqStcd);
479
+                        rtnReqBaseList.add(rtnReqBaseEntity);
480
+                    }
481
+                }
482
+                rtnReqMapper.updateRtnReqStCd(userId,rtnReqBaseList);
471 483
             }
472 484
 
473 485
         } catch (GlobalException e) {
@@ -480,40 +492,6 @@ public class RtnOdrService extends CommonService {
480 492
         }
481 493
     }
482 494
 
483
-    public String  selectOdrDtlStatusList(String  pchReqUnqNo) throws Exception {
484
-        //PCH_ODR_ST_CD
485
-        String rtnOdrStCd = "";
486
-        List<rtnOdrDtlPtclEntity> dtlEntity = pchOrdMapper.selectOdrDtlStatusList( pchReqUnqNo);
487
-
488
-        int pod0 = 0 ;
489
-        int pod1 = 0 ;
490
-        int pod2 = 0 ;
491
-        int pod4 = 0 ;
492
-
493
-        for (int i = 0 ; i < dtlEntity.size() ; i++ ) {
494
-            rtnOdrDtlPtclEntity entity = dtlEntity.get(i);
495
-            if ( "POD0".equals(entity.getPodrDtlStCd())) {  // 요청
496
-                pod0 = pod0 + entity.getPodrStatusCnt() ;
497
-            } else if ( "POD1".equals(entity.getPodrDtlStCd()) ||  "POD3".equals(entity.getPodrDtlStCd())) {  // 접수 ,출하
498
-                pod1 = pod1 + entity.getPodrStatusCnt() ;
499
-            } else if ( "POD2".equals(entity.getPodrDtlStCd())) {  //발주취소
500
-                pod2 = pod2 + entity.getPodrStatusCnt() ;
501
-            } else if ( "POD4".equals(entity.getPodrDtlStCd())) {  //입고완료
502
-                pod4 = pod4 + entity.getPodrStatusCnt() ;
503
-            }
504
-        }
505
-
506
-        if (pod0 > 0 ) {
507
-            rtnOdrStCd = "PO20";  //요청
508
-        } else if ( pod0 == 0 && pod1 == 0 &&  pod4 == 0 ) {
509
-            rtnOdrStCd = "PO99";  // 취소
510
-        } else {
511
-            rtnOdrStCd = "PO30";  // 접수
512
-        }
513
-
514
-        return rtnOdrStCd;
515
-    }
516
-*/
517 495
     /*
518 496
      공급사 수주현황 리스트
519 497
 

+ 7 - 6
src/main/java/com/oqpo/api/web/controller/rtnmng/RtnOrdController.java

@@ -5,6 +5,7 @@ import com.oqpo.api.enums.SystemMessageCode;
5 5
 import com.oqpo.api.service.pomng.PchOrdService;
6 6
 import com.oqpo.api.service.rtnmng.RtnOdrService;
7 7
 import com.oqpo.api.web.dto.request.pomng.pchOrd.*;
8
+import com.oqpo.api.web.dto.request.rtnmng.CancelRtnOrdDtlRequest;
8 9
 import com.oqpo.api.web.dto.request.rtnmng.RtnOrdSearchGridRequest;
9 10
 import com.oqpo.api.web.dto.request.rtnmng.RtnReqOrdInitRequest;
10 11
 import com.oqpo.api.web.dto.request.rtnmng.SaveRtnOrdRequest;
@@ -153,18 +154,18 @@ public class RtnOrdController {
153 154
      * @param savePchReqlRequest
154 155
      * @return SaveResponse
155 156
      * @throws Exception
156
-
157
+     */
157 158
 
158 159
     @ApiImplicitParams({
159 160
             @ApiImplicitParam(name = "X-AUTH-TOKEN", value = "CONN-KEY", required = true, dataType = "String", paramType = "header")
160 161
     })
161
-    @ApiOperation(value = "구매발주 취소 처리")
162
-    @PostMapping("/cancel-pchPo")
163
-    public ResponseEntity<SaveResponse> cancelPchOdr(@ApiIgnore String userId, @RequestBody @Valid CancelPchOrdDtlRequest cancelPchOrdDtlRequest) throws Exception {
164
-        pchOrdService.cancelPchOrdDtl(userId,  cancelPchOrdDtlRequest);
162
+    @ApiOperation(value = "반품발주 취소 처리")
163
+    @PostMapping("/cancel-rtnPo")
164
+    public ResponseEntity<SaveResponse> cancelRtnOdr(@ApiIgnore String userId, @RequestBody @Valid CancelRtnOrdDtlRequest cancelRtnOrdDtlRequest) throws Exception {
165
+        rtnOdrService.cancelRtnOrdDtl(userId,  cancelRtnOrdDtlRequest);
165 166
         return ResponseEntity.ok(SaveResponse.toDTO(SystemMessageCode.SAVE_OK));
166 167
     }
167
-     */
168
+
168 169
 
169 170
 
170 171
     /**

+ 25 - 0
src/main/java/com/oqpo/api/web/dto/request/rtnmng/CancelRtnOrdDtlRequest.java

@@ -0,0 +1,25 @@
1
+package com.oqpo.api.web.dto.request.rtnmng;
2
+
3
+import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.*;
6
+
7
+import javax.validation.constraints.NotBlank;
8
+import java.util.ArrayList;
9
+import java.util.List;
10
+
11
+@Getter
12
+@Setter
13
+public class CancelRtnOrdDtlRequest {
14
+
15
+
16
+    @NotBlank
17
+    @ApiModelProperty(value = "브랜드아이디")
18
+    private String brandId;
19
+
20
+    @NotBlank
21
+    @ApiModelProperty(value = "반품발주번호")
22
+    private String rtnPodrUnqNo;
23
+
24
+
25
+}

+ 15 - 0
src/main/resources/mybatis/sqlmaps/inoutmng/ColOdr.xml

@@ -0,0 +1,15 @@
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.inoutmng.ColOdrMapper">
5
+    <select id="selectColRtnIngCnt" resultType="int">
6
+        select count(*)  /* ColOdr.selectColRtnIngCnt */
7
+        from  col_odr_base_info base
8
+        ,col_odr_dtl_ptcl  ptcl
9
+        where base.col_cmd_unq_no = ptcl.col_cmd_unq_no
10
+        and   base.brand_id = #{brandId}
11
+        and   base.col_cmd_st_cd in ('COL1','COL2')
12
+        and   ptcl.rtn_podr_unq_no = #{rtnPodrUnqNo}
13
+    </select>
14
+
15
+</mapper>

+ 20 - 0
src/main/resources/mybatis/sqlmaps/rtnmng/RtnOrd.xml

@@ -248,6 +248,26 @@
248 248
                 where rtn_podr_unq_no = #{rtnPodrUnqNo}
249 249
     </select>
250 250
 
251
+    <update id="updateChgRodrStCd">
252
+            UPDATE /* RtnOrd.updateChgRodrStCd */
253
+            rtn_odr_base_info SET
254
+            rtn_odr_st_cd = #{rtnOdrStCd},
255
+            sys_chg_dttm = NOW(),
256
+            sys_chg_id = #{userId}
257
+            WHERE rtn_podr_unq_no = #{rtnPodrUnqNo}
258
+    </update>
259
+
260
+    <update id="updateChangeRodrDtlStCd">
261
+            UPDATE /* RtnOrd.updateChangeRodrDtlStCd */
262
+            rtn_odr_dtl_ptcl SET
263
+            rodr_dtl_st_cd = #{rodrDtlStCd},
264
+            sys_chg_dttm = NOW(),
265
+            sys_chg_id = #{userId}
266
+            WHERE rtn_podr_unq_no = #{rtnPodrUnqNo}
267
+    </update>
268
+
269
+
270
+
251 271
     <!--
252 272
 
253 273