|
@@ -3,6 +3,7 @@ package com.oqpo.api.service.inoutmng;
|
3
|
3
|
|
4
|
4
|
import com.oqpo.api.entity.inoutmng.*;
|
5
|
5
|
import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
|
|
6
|
+import com.oqpo.api.entity.loanmng.LoanMgntDtlHstEntity;
|
6
|
7
|
import com.oqpo.api.entity.oper.FileEntity;
|
7
|
8
|
import com.oqpo.api.entity.oper.UserMngEntity;
|
8
|
9
|
import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
|
|
@@ -16,13 +17,12 @@ import com.oqpo.api.entity.stinfo.StoreBaseInfoEntity;
|
16
|
17
|
import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
|
17
|
18
|
import com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity;
|
18
|
19
|
import com.oqpo.api.entity.stockmng.WhsProcInfoPtclEntity;
|
19
|
|
-import com.oqpo.api.enums.ChgDvsn;
|
20
|
|
-import com.oqpo.api.enums.InOutCd;
|
21
|
|
-import com.oqpo.api.enums.SystemMessageCode;
|
|
20
|
+import com.oqpo.api.enums.*;
|
22
|
21
|
import com.oqpo.api.exception.GlobalException;
|
23
|
22
|
import com.oqpo.api.mapper.FileMapper;
|
24
|
23
|
import com.oqpo.api.mapper.inoutmng.ColOdrMapper;
|
25
|
24
|
import com.oqpo.api.mapper.inoutmng.ShmtOdrMapper;
|
|
25
|
+import com.oqpo.api.mapper.loanmng.DsptMngMapper;
|
26
|
26
|
import com.oqpo.api.mapper.loanmng.LoanStateMapper;
|
27
|
27
|
import com.oqpo.api.mapper.oper.UserMngMapper;
|
28
|
28
|
import com.oqpo.api.mapper.pomng.PchOrdMapper;
|
|
@@ -34,6 +34,7 @@ import com.oqpo.api.mapper.stockmng.StockMngMapper;
|
34
|
34
|
import com.oqpo.api.service.CommonService;
|
35
|
35
|
import com.oqpo.api.service.pomng.PchOrdService;
|
36
|
36
|
import com.oqpo.api.service.rtnmng.RtnOdrService;
|
|
37
|
+import com.oqpo.api.util.DateUtil;
|
37
|
38
|
import com.oqpo.api.web.dto.request.GridRequest;
|
38
|
39
|
import com.oqpo.api.web.dto.request.inoutmng.*;
|
39
|
40
|
import com.oqpo.api.web.dto.response.GridResponse;
|
|
@@ -78,6 +79,11 @@ public class ColOdrService extends CommonService {
|
78
|
79
|
@Autowired
|
79
|
80
|
private UserMngMapper userMngMapper;
|
80
|
81
|
|
|
82
|
+ @Autowired
|
|
83
|
+ private LoanStateMapper loanStateMapper;
|
|
84
|
+
|
|
85
|
+ @Autowired
|
|
86
|
+ private DsptMngMapper dsptMngMapper;
|
81
|
87
|
|
82
|
88
|
|
83
|
89
|
/*
|
|
@@ -806,6 +812,9 @@ public class ColOdrService extends CommonService {
|
806
|
812
|
StoreBaseInfoEntity whsUseInfo = storeBaseInfoMapper.selectStoreLoanInfo(uEntity.getBrandId(), uEntity.getStoreId());
|
807
|
813
|
storeWhsUseYn = whsUseInfo.getWhsUseYn();
|
808
|
814
|
|
|
815
|
+ // 여신금액 합
|
|
816
|
+ long acctbalAmt = 0 ;
|
|
817
|
+
|
809
|
818
|
List<RtnProcInfoPtclEntity> rtnProcInfoPtclList = new ArrayList<RtnProcInfoPtclEntity>();
|
810
|
819
|
List<StckMgntBaseInfoEntity> stckMgntBaseInfoList = new ArrayList<StckMgntBaseInfoEntity>();
|
811
|
820
|
List<StckMgntDtlHistEntity> stckMgntDtlHistList= new ArrayList<StckMgntDtlHistEntity>();
|
|
@@ -817,6 +826,15 @@ public class ColOdrService extends CommonService {
|
817
|
826
|
// 반품처리를 위한 관련정보를 가져온다
|
818
|
827
|
List<PickInfoMgntEntity> targetList = colOdrMapper.selectColRtnInstProcList(saveRtnStockProcRequest.getBrandId(), saveRtnStockProcRequest.getRtnWhsId(), searchList);
|
819
|
828
|
|
|
829
|
+ //String loanMgntUnqNo = "";
|
|
830
|
+ LoanMgntBaseInfoEntity loanInfo = null ;
|
|
831
|
+ long loanAmt = 0 ; // 여신차감할 금액 (사용금액 - 여신차감금액, 잔액금액 - 여신차감금액)
|
|
832
|
+ if (!"".toString().equals(saveRtnStockProcRequest.getStoreId())) {
|
|
833
|
+ loanInfo = loanStateMapper.selectLoanRtnDataInfo(saveRtnStockProcRequest.getStoreId());
|
|
834
|
+ }
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
820
|
838
|
for (int i = 0; i < gridInsertData.size(); i++) {
|
821
|
839
|
RtnProcInfoPtclEntity requestData = gridInsertData.get(i);
|
822
|
840
|
|
|
@@ -933,6 +951,9 @@ public class ColOdrService extends CommonService {
|
933
|
951
|
stckW1Hist.setRelationNo(rtnMgntUnqNo); //======================================
|
934
|
952
|
stckMgntDtlHistList.add(stckW1Hist);
|
935
|
953
|
|
|
954
|
+ //반품 금액 계산
|
|
955
|
+ acctbalAmt = acctbalAmt + (targetData.getPickDtlInfo().getUnitAmt() * requestData.getColQty()) ;
|
|
956
|
+
|
936
|
957
|
} else if (targetData.getColDvsn().equals("C002") && requestData.getColQty() > 0) {
|
937
|
958
|
// 공급사 수거일경우 - 본사창고 재고 차감 처리
|
938
|
959
|
// 1. 참감처리 , 2. 반품처리테이블 생성, 3. 수거서 업데이타, 4, 반품발주건 업데이트
|
|
@@ -1030,6 +1051,31 @@ public class ColOdrService extends CommonService {
|
1030
|
1051
|
List<PickInfoMgntEntity> pickInfoList = colOdrMapper.selectColPickStList(userId, pickInfoMgntList);
|
1031
|
1052
|
colOdrMapper.updateChgStckPickStCd(userId, pickInfoList);
|
1032
|
1053
|
}
|
|
1054
|
+
|
|
1055
|
+ //수거 반품 금액 매장에 정산처리함 acctbalAmt
|
|
1056
|
+ if (loanInfo != null && !"".toString().equals(saveRtnStockProcRequest.getStoreId())) {
|
|
1057
|
+
|
|
1058
|
+ if ("LD01".equals(loanInfo.getLoanDvsn()) || "LD02".equals(loanInfo.getLoanDvsn())) {
|
|
1059
|
+ LoanMgntBaseInfoEntity loanEntity = new LoanMgntBaseInfoEntity();
|
|
1060
|
+ loanEntity.setLoanMgntUnqNo(loanInfo.getLoanMgntUnqNo());
|
|
1061
|
+ loanEntity.setStoreId(saveRtnStockProcRequest.getStoreId());
|
|
1062
|
+ loanEntity.setAcctBal(acctbalAmt);
|
|
1063
|
+ loanStateMapper.updateloanRtnacctBalAmt(userId, loanEntity);
|
|
1064
|
+
|
|
1065
|
+ LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
|
|
1066
|
+ hstEntity.setLoanMgntUnqNo(loanInfo.getLoanMgntUnqNo());
|
|
1067
|
+ hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
|
|
1068
|
+ hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
|
|
1069
|
+ hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
|
|
1070
|
+ hstEntity.setMediaDvsn(MediaDvsn.RTNC.getCd());
|
|
1071
|
+ hstEntity.setPayType(PayType.RTN_PAYMENT.getCd());
|
|
1072
|
+
|
|
1073
|
+ hstEntity.setTrscAmt(acctbalAmt); // 거래금액
|
|
1074
|
+ hstEntity.setTrscBfBal(loanInfo.getAcctBal());
|
|
1075
|
+ hstEntity.setTrscAfBal(loanInfo.getAcctBal() + acctbalAmt);
|
|
1076
|
+ dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
|
|
1077
|
+ }
|
|
1078
|
+ }
|
1033
|
1079
|
}
|
1034
|
1080
|
|
1035
|
1081
|
} catch (GlobalException e) {
|