Преглед изворни кода

반품처리 및 정산요청 출력 sql 수정

dwkim пре 2 година
родитељ
комит
1980d8cdc4

+ 11 - 5
src/main/java/com/oqpo/api/service/inoutmng/ColOdrService.java

@@ -59,6 +59,9 @@ public class ColOdrService extends CommonService {
59 59
     @Autowired
60 60
     private RtnOdrService rtnOdrService;
61 61
 
62
+    @Autowired
63
+    private StockMngMapper stockMngMapper;
64
+
62 65
 
63 66
     @Autowired
64 67
     private BrandMapper brandMapper;
@@ -755,10 +758,10 @@ public class ColOdrService extends CommonService {
755 758
                         .rtnPodrDtlNo(m.getPickDtlInfo() == null ? "" : m.getPickDtlInfo().getRtnPodrDtlNo() == null ? "" :m.getPickDtlInfo().getRtnPodrDtlNo() )
756 759
                         .itemId(m.getPickDtlInfo() == null ? "" : m.getPickDtlInfo().getItemId() == null ? "" :m.getPickDtlInfo().getItemId() )
757 760
                         .itemNm(m.getPickDtlInfo() == null ? "" : m.getPickDtlInfo().getItemNm() == null ? "" :m.getPickDtlInfo().getItemNm() )
758
-                        .colQty(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColQty() == null ? 0 :m.getPickDtlInfo().getColQty() )
761
+                        //.colQty(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColQty() == null ? 0 :m.getPickDtlInfo().getColQty() )
759 762
                         .colReqQty(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColReqQty() == null ? 0 :m.getPickDtlInfo().getColReqQty() )
760 763
                         .rodrQty(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getRodrQty() == null ? 0 :m.getPickDtlInfo().getRodrQty() )
761
-                        .colAmt(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColAmt() == null ? 0 :m.getPickDtlInfo().getColAmt() )
764
+                        //.colAmt(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColAmt() == null ? 0 :m.getPickDtlInfo().getColAmt() )
762 765
                         .whsId(m.getWhsId() == null ? "" : m.getWhsId())
763 766
                         .location(m.getLocation() == null ? "" : m.getLocation())
764 767
                         .whsNm(m.getWhsNm() == null ? "" : m.getWhsNm() + " - " + m.getLocationNm())
@@ -770,6 +773,8 @@ public class ColOdrService extends CommonService {
770 773
                         .pickMgrTelNo(m.getPickMgrTelNo() == null ? "" : m.getPickMgrTelNo())
771 774
                         .spplyId(m.getSpplyId() == null ? "" : m.getSpplyId())
772 775
                         .spplyNm(m.getSpplyNm() == null ? "" : m.getSpplyNm())
776
+                        .unitAmt((m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getUnitAmt() == null ? 0 : m.getPickDtlInfo().getUnitAmt()))
777
+                        .colReqAmt(m.getPickDtlInfo() == null ? 0 : m.getPickDtlInfo().getColReqAmt() == null ? 0 : m.getPickDtlInfo().getColReqAmt())
773 778
                         .build())
774 779
                 .collect(Collectors.toList());
775 780
         return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
@@ -779,7 +784,7 @@ public class ColOdrService extends CommonService {
779 784
 
780 785
 
781 786
 
782
-    /* 입고처리 저장 */
787
+    /* 수거 처리 저장 */
783 788
     @Transactional
784 789
     public void saveRtnStockProc(String userId, SaveRtnStockProcRequest saveRtnStockProcRequest) throws Exception {
785 790
         try {
@@ -852,6 +857,7 @@ public class ColOdrService extends CommonService {
852 857
                             rtnProcInfoEntity.setColSchDt(targetData.getColSchDt());
853 858
                             rtnProcInfoEntity.setColCnfmNm(uEntity.getUserNm());
854 859
                             rtnProcInfoEntity.setColMgrTelNo(targetData.getPickMgrTelNo());
860
+                            rtnProcInfoEntity.setColMgrNm(targetData.getPickMgrNm());
855 861
                             rtnProcInfoEntity.setColAmt(requestData.getColQty() * targetData.getPickDtlInfo().getUnitAmt());
856 862
                             rtnProcInfoEntity.setColAgrYn("Y");
857 863
                             // rtnProcInfoEntity.setColCnfmDocFileNo(saveRtnStockProcRequest.); 수거서 파일 첨부 제거
@@ -991,11 +997,11 @@ public class ColOdrService extends CommonService {
991 997
                 }
992 998
 
993 999
                 if (stckMgntBaseInfoList.size() > 0 ) {
994
-                    colOdrMapper.updateChgStckQtyStckMgnt(userId, stckMgntBaseInfoList);
1000
+                    stockMngMapper.insertInOutStckMgntBaseInfo(userId, stckMgntBaseInfoList);
995 1001
                 }
996 1002
 
997 1003
                 if (stckMgntDtlHistList.size() > 0 ) {
998
-                    colOdrMapper.insertChgStckStckMgntDtlHist(userId, stckMgntDtlHistList);
1004
+                    stockMngMapper.insertMultiStckMgntDtlHist(userId, stckMgntDtlHistList);
999 1005
                 }
1000 1006
 
1001 1007
                 if (colOdrDtlPtclList.size() > 0 ) {

+ 2 - 0
src/main/java/com/oqpo/api/web/dto/response/inoutmng/RtnStockTargetResponse.java

@@ -38,5 +38,7 @@ public class RtnStockTargetResponse {
38 38
     @ApiModelProperty(value = "수거담당자연락처") private String pickMgrTelNo;
39 39
     @ApiModelProperty(value = "공급사아이디") private String spplyId;
40 40
     @ApiModelProperty(value = "공급사명") private String spplyNm;
41
+    @ApiModelProperty(value = "단가") private Long unitAmt;
42
+    @ApiModelProperty(value = "수거요청금액") private Long colReqAmt;
41 43
 
42 44
 }

+ 7 - 4
src/main/resources/mybatis/sqlmaps/inoutmng/ColOdr.xml

@@ -551,13 +551,15 @@
551 551
                , dtl.rtn_podr_unq_no as 'pickDtlInfo.rtn_podr_unq_no' , dtl.rtn_podr_dtl_no as 'pickDtlInfo.rtn_podr_dtl_no'
552 552
                ,dtl.item_id as 'pickDtlInfo.item_id', dtl.item_nm as 'pickDtlInfo.item_nm'
553 553
                , dtl.rodr_qty as 'pickDtlInfo.rodr_qty' , dtl.col_req_qty as 'pickDtlInfo.col_req_qty'
554
-               , dtl.col_req_qty as 'pickDtlInfo.col_qty', dtl.col_amt as 'pickDtlInfo.col_amt'
554
+               , dtl.col_req_amt as 'pickDtlInfo.col_req_amt'
555
+               /* , null as 'pickDtlInfo.col_qty', null as 'pickDtlInfo.col_amt' */
555 556
                , date_format(mgnt.col_sch_dt,'%Y.%m.%d') as col_sch_dt, mgnt.pick_mgr_nm, fn_get_telno(mgnt.pick_mgr_tel_no) as pick_mgr_tel_no
556 557
                , mgnt.whs_id as rtn_whs_id , mgnt.location as rtn_location
557 558
                , fn_whs_nm(mgnt.brand_id, mgnt.whs_id) as rtn_whs_nm, fn_whs_location_nm(mgnt.brand_id, mgnt.whs_id, mgnt.location) as rtn_location_nm
558 559
                , base.whs_id, base.location
559 560
                , fn_whs_nm(base.brand_id, base.whs_id) as whs_nm, fn_whs_location_nm(base.brand_id, base.whs_id, base.location) as location_nm
560 561
                , mgnt.spply_id, fn_spply_nm(mgnt.spply_id) as spply_nm
562
+                , dtl.unit_amt as 'pickDtlInfo.unit_amt'
561 563
         from   pick_info_mgnt mgnt
562 564
               ,pick_dtl_ptcl dtl
563 565
               ,rtn_odr_dtl_ptcl ptcl
@@ -655,7 +657,7 @@
655 657
         <foreach collection="gridInsertData" item="item" separator=",">
656 658
             (#{item.rtnMgntUnqNo}, #{item.brandId}, #{item.storeId}, #{item.itemId}, #{item.itemNm}
657 659
             , #{item.whsId}, #{item.location}, #{item.unit}, #{item.unitAmt}, #{item.rtnReqQty}
658
-            , #{item.rtnOdrQty}, #{item.colQty}, #{item.colReqQty}, #{item.colReqDt}, #{item.colSchDt}, #{item.colDt}
660
+            , #{item.rtnOdrQty}, #{item.colQty}, #{item.colReqQty}, #{item.colReqDt}, #{item.colSchDt}, date_format(now(),'%Y%m%d')
659 661
             , #{item.colCnfmNm}, #{item.colMgrNm}, #{item.colMgrTelNo}, #{item.colMgrEmal}, #{item.colMgrMblNo}
660 662
             , #{item.colAmt}, #{item.colAgrYn}, #{item.colCnfmDocFileNo}, #{item.sttlYn}, #{item.spplyId}
661 663
             , #{item.spplyNm}, #{item.colPickUnqNo}, #{item.colPickDtlNo}, #{item.colCmdUnqNo}, #{item.colCmdDtlNo}
@@ -770,8 +772,8 @@
770 772
             , mgnt.whs_id as rtn_whs_id, mgnt.location as rtn_location
771 773
             , fn_whs_nm(base.brand_id, mgnt.whs_id) as rtn_whs_nm, fn_whs_location_nm(base.brand_id, mgnt.whs_id, mgnt.location) as rtn_location_nm
772 774
             , dtl.unit as 'pickDtlInfo.unit' , dtl.unit_amt as 'pickDtlInfo.unit_amt'
773
-            , ptcl.rtn_req_qty as  'pickDtlInfo.rtn_req_qty'   , dtl.rodr_qty as 'pickDtlInfo.rodr_qty'
774
-            , dtl.col_req_qty as 'pickDtlInfo.col_req_qty'
775
+            , nvl(ptcl.rtn_req_qty,0) as  'pickDtlInfo.rtn_req_qty'   , nvl(dtl.rodr_qty,0) as 'pickDtlInfo.rodr_qty'
776
+            , nvl(dtl.col_req_qty,0) as 'pickDtlInfo.col_req_qty'
775 777
             , date_format(mgnt.col_req_dt,'%Y%m%d') as col_req_dt
776 778
             , date_format(mgnt.col_sch_dt,'%Y%m%d') as col_sch_dt
777 779
             , date_format(mgnt.col_cmplt_dt,'%Y%m%d') as col_cmplt_dt
@@ -896,6 +898,7 @@
896 898
             set    sys_chg_id = #{userId}
897 899
                 , sys_chg_dttm = now()
898 900
                 , pick_st_cd = #{item.pickStCd}
901
+                , col_cmplt_dt = case when #{item.pickStCd} in ('PICK1','PICK3') then date_format(now(), '%Y%m%d') else col_cmplt_dt end
899 902
             where col_pick_unq_no = #{item.colPickUnqNo}
900 903
         </foreach>
901 904
     </update>

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

@@ -16,8 +16,8 @@
16 16
         left outer join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
17 17
         where iunit.brand_id = #{sBrandId}
18 18
         <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
19
-        and   iunit.cont_stt_dt <![CDATA[ >= ]]>  #{fromDt}
20
-        and   iunit.cont_end_dt <![CDATA[ <= ]]>  #{toDt}
19
+          and iunit.cont_stt_dt between #{fromDt} and #{toDt}
20
+          and #{toDt}  between iunit.cont_stt_dt and iunit.cont_end_dt
21 21
         </if>
22 22
         <if test="sUnitStCd != null and sUnitStCd != ''">
23 23
         and   iunit.unit_st_cd = #{sUnitStCd}
@@ -69,8 +69,8 @@
69 69
         left outer join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
70 70
         where iunit.brand_id = #{sBrandId}
71 71
         <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
72
-            and   iunit.cont_stt_dt <![CDATA[ >= ]]>  #{fromDt}
73
-            and   iunit.cont_end_dt <![CDATA[ <= ]]>  #{toDt}
72
+            and iunit.cont_stt_dt between #{fromDt} and #{toDt}
73
+            and #{toDt}  between iunit.cont_stt_dt and iunit.cont_end_dt
74 74
         </if>
75 75
         <if test="sUnitStCd != null and sUnitStCd != ''">
76 76
             and   iunit.unit_st_cd = #{sUnitStCd}

+ 6 - 6
src/main/resources/mybatis/sqlmaps/sttlmng/SttlReq.xml

@@ -47,7 +47,7 @@
47 47
             AND wpip.sttl_yn = 'N'
48 48
             AND (smbi.sttl_st_cd IS NULL OR smbi.sttl_st_cd IN ('ST00', 'ST30'))    /* 정산요청 이전, 임시저장, 정산반려 */
49 49
             AND wpip.brand_id = #{sBrandId}
50
-            <if test="sSpplyId == null or sSpplyId == ''">          /* 매장 정산요청 */
50
+            <if test="sStoreId != null and sStoreId != ''">                /* 매장 정산요청 */
51 51
             AND wpip.store_id = #{sStoreId}
52 52
             </if>
53 53
             <if test="sSpplyId != null and sSpplyId != ''">        /* 공급사 정산요청 */
@@ -83,7 +83,7 @@
83 83
             AND rpip.sttl_yn = 'N'
84 84
             AND (smbi.sttl_st_cd IS NULL OR smbi.sttl_st_cd IN ('ST00', 'ST30'))    /* 정산요청 이전, 임시저장, 정산반려 */
85 85
             AND rpip.brand_id = #{sBrandId}
86
-            <if test="sSpplyId == null or sSpplyId == ''">          /* 매장 정산요청 */
86
+            <if test="sStoreId != null and sStoreId != ''">               /* 매장 정산요청 */
87 87
             AND rpip.store_id = #{sStoreId}
88 88
             </if>
89 89
             <if test="sSpplyId != null and sSpplyId != ''">        /* 공급사 정산요청 */
@@ -131,7 +131,7 @@
131 131
             AND wpip.sttl_yn = 'N'
132 132
             AND (smbi.sttl_st_cd IS NULL OR smbi.sttl_st_cd IN ('ST00', 'ST30'))    /* 정산요청 이전, 임시저장, 정산반려 */
133 133
             AND wpip.brand_id = #{sBrandId}
134
-            <if test="sSpplyId == null or sSpplyId == ''">          /* 매장 정산요청 */
134
+            <if test="sStoreId != null and sStoreId != ''">            /* 매장 정산요청 */
135 135
                 AND wpip.store_id = #{sStoreId}
136 136
             </if>
137 137
             <if test="sSpplyId != null and sSpplyId != ''">        /* 공급사 정산요청 */
@@ -155,7 +155,7 @@
155 155
             AND rpip.sttl_yn = 'N'
156 156
             AND (smbi.sttl_st_cd IS NULL OR smbi.sttl_st_cd IN ('ST00', 'ST30'))    /* 정산요청 이전, 임시저장, 정산반려 */
157 157
             AND rpip.brand_id = #{sBrandId}
158
-            <if test="sSpplyId == null or sSpplyId == ''">          /* 매장 정산요청 */
158
+            <if test="sStoreId != null and sStoreId != ''">          /* 매장 정산요청 */
159 159
                 AND rpip.store_id = #{sStoreId}
160 160
             </if>
161 161
             <if test="sSpplyId != null and sSpplyId != ''">        /* 공급사 정산요청 */
@@ -351,10 +351,10 @@
351 351
         WHERE whs_mgnt_unq_no = #{entity.whsMgntUnqNo}
352 352
     </update>
353 353
 
354
-    <select id="selectRtnProcInfoPtcl" resultType="com.oqpo.api.entity.rtnmng.RtnProcInfoPtclEntity">
354
+        <select id="selectRtnProcInfoPtcl" resultType="com.oqpo.api.entity.rtnmng.RtnProcInfoPtclEntity">
355 355
         /* SttlReqMapper.selectRtnProcInfoPtcl */
356 356
         SELECT A.rtn_mgnt_unq_no, A.brand_id, A.store_id, A.item_id, A.item_nm, A.whs_id, A.location, A.unit,
357
-            A.unit_amt, A.rtn_qty, A.rtn_odr_qty, A.col_qty, A.col_req_dt, A.col_sch_dt, A.col_dt, A.col_cnfm_nm,
357
+            A.unit_amt, A.rtn_odr_qty, A.col_qty, A.col_req_dt, A.col_sch_dt, A.col_dt, A.col_cnfm_nm,
358 358
             A.col_mgr_nm, A.col_mgr_tel_no, A.col_mgr_emal, A.col_mgr_mbl_no, A.col_amt, A.col_agr_yn,
359 359
             A.col_cnfm_doc_file_no, A.sttl_yn, A.spply_id, A.spply_nm, A.col_cmd_unq_no, A.col_cmd_dtl_no,
360 360
             A.rtn_podr_unq_no, A.rtn_podr_dtl_no, A.rtn_req_unq_no, A.rtn_req_dtl_no, A.sttl_mgnt_unq_no,