Browse Source

구매요청건 이미 작업 진행 여부 체크로직 추가

dwkim 2 years ago
parent
commit
5d8afa29d2

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

@@ -72,6 +72,7 @@ public enum SystemMessageCode {
72 72
     ERR_CODE_NM (40038, "정의되지 않은 코드명을 사용하였습니다.", HttpStatus.BAD_REQUEST),
73 73
     ERR_BO_STORE (40039, "매장정보를 찿을 수 없습니다.", HttpStatus.BAD_REQUEST),
74 74
     ERR_PG_FAIL (40040, "PG 결제 처리중 에러가 발생하였습니다.", HttpStatus.BAD_REQUEST),
75
+    ERR_PCH_JOB_FAIL (40041, "임시저장 상태가 아닙니다.", HttpStatus.BAD_REQUEST),
75 76
     ;
76 77
 
77 78
 

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

@@ -82,5 +82,6 @@ public interface PchReqMapper {
82 82
     List<PchReqBaseInfoEntity> selectPchReqPoSteamlineGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt,  @Param("sWhsId") String sWhsId , @Param("sPchReqUnqNo") String sPchReqUnqNo ,  GridRequest gridRequest)throws Exception;
83 83
     int selectPchReqPoSteamlineCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt,  @Param("sWhsId") String sWhsId , @Param("sPchReqUnqNo") String sPchReqUnqNo )throws Exception;
84 84
 
85
+    String selectPchReqStatProcYn(@Param("brandId") String brandId, @Param("pchReqUnqNo") String pchReqUnqNo )throws Exception;
85 86
 
86 87
 }

+ 10 - 0
src/main/java/com/oqpo/api/service/pomng/PchReqService.java

@@ -243,6 +243,16 @@ public class PchReqService extends CommonService {
243 243
                 }
244 244
             }
245 245
 
246
+            // 수정 구매요청 상태 체크 하여 이미 처리건에 대하 알럿을 준다.
247
+            if (!"C".equals(savePchReqlRequest.getViewCd())) {
248
+                String jobProcYn = pchReqMapper.selectPchReqStatProcYn(savePchReqlRequest.getBrandId(), savePchReqlRequest.getPchReqUnqNo());
249
+
250
+                // N일경우 이미 임시저장 상태가 아님을 알림
251
+                if ("N".toString().equals(jobProcYn)) {
252
+                    throw new GlobalException(SystemMessageCode.ERR_PCH_JOB_FAIL);
253
+                }
254
+            }
255
+
246 256
             PchReqBaseInfoEntity entity = new PchReqBaseInfoEntity();
247 257
             entity.setPchReqUnqNo(savePchReqlRequest.getPchReqUnqNo());
248 258
             entity.setBrandId(savePchReqlRequest.getBrandId());

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

@@ -484,4 +484,11 @@
484 484
             and base.pch_req_unq_no = #{sPchReqUnqNo}
485 485
         </if>
486 486
     </select>
487
+
488
+    <select id="selectPchReqStatProcYn" resultType="String">
489
+        select case when pch_req_st_cd = 'PR00' then 'Y' else 'N' end
490
+        from   pch_req_base_info
491
+        where  brand_id = #{brandId}
492
+        and    pch_req_unq_no = #{pchReqUnqNo}
493
+    </select>
487 494
 </mapper>