|
@@ -4,6 +4,9 @@ package com.oqpo.api.service.stockmng;
|
4
|
4
|
import com.oqpo.api.entity.stockmng.StckCddMgntDtlEntity;
|
5
|
5
|
import com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity;
|
6
|
6
|
import com.oqpo.api.entity.stockmng.StckMgntBaseInfoEntity;
|
|
7
|
+import com.oqpo.api.entity.stockmng.StckMgntDtlHistEntity;
|
|
8
|
+import com.oqpo.api.enums.ChgDvsn;
|
|
9
|
+import com.oqpo.api.enums.InOutCd;
|
7
|
10
|
import com.oqpo.api.exception.GlobalException;
|
8
|
11
|
import com.oqpo.api.mapper.CommonMapper;
|
9
|
12
|
import com.oqpo.api.mapper.stockmng.StockCddMapper;
|
|
@@ -21,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
21
|
24
|
import org.springframework.stereotype.Service;
|
22
|
25
|
import org.springframework.transaction.annotation.Transactional;
|
23
|
26
|
|
|
27
|
+import java.math.BigDecimal;
|
24
|
28
|
import java.util.List;
|
25
|
29
|
import java.util.stream.Collectors;
|
26
|
30
|
|
|
@@ -107,29 +111,27 @@ public class StockCddService extends CommonService {
|
107
|
111
|
// 재고관리기본정보(stck_mgnt_base_info) 업데이트
|
108
|
112
|
StckMgntBaseInfoEntity stckEntity = new StckMgntBaseInfoEntity();
|
109
|
113
|
stckEntity.setBrandId(saveStockCddRequest.getBrandId());
|
110
|
|
-
|
111
|
|
- /*
|
112
|
|
- @ApiModelProperty(value = "창고아이디")
|
113
|
|
- private String whsId;
|
114
|
|
- @ApiModelProperty(value = "LOCATION")
|
115
|
|
- private String location;
|
116
|
|
- @ApiModelProperty(value = "품목아이디")
|
117
|
|
- private String itemId;
|
118
|
|
- @ApiModelProperty(value = "단위")
|
119
|
|
- private String unit;
|
120
|
|
- @ApiModelProperty(value = "재고수량")
|
121
|
|
- private int stckQty;
|
122
|
|
- @ApiModelProperty(value = "적정재고수량")
|
123
|
|
- private int prpStckQty;
|
124
|
|
- @ApiModelProperty(value = "안전재고비율")
|
125
|
|
- private BigDecimal sftStckRt;
|
126
|
|
- @ApiModelProperty(value = "현재고비율")
|
127
|
|
- private BigDecimal curStckRt;
|
128
|
|
- * */
|
129
|
|
-
|
|
114
|
+ stckEntity.setWhsId(saveStockCddRequest.getWhsId());
|
|
115
|
+ stckEntity.setLocation(saveStockCddRequest.getLocation());
|
|
116
|
+ stckEntity.setItemId(dtlEntity.getItemId());
|
|
117
|
+ stckEntity.setStckQty(dtlEntity.getCddQty()); // 재고수량 : 실사수량
|
|
118
|
+ double curStckRt = Math.round(stckEntity.getStckQty() * 100 / baseInfo.getPrpStckQty() * 100) / 100.0;
|
|
119
|
+ stckEntity.setCurStckRt(BigDecimal.valueOf(curStckRt)); // 현재고비율((재고수량 * 100) / 적정재고)
|
130
|
120
|
stockMngMapper.updateStckMgntBaseInfo4StckProc(userId, stckEntity);
|
131
|
121
|
|
132
|
122
|
// 재고관리상세이력(stck_mgnt_dtl_hist) 등록
|
|
123
|
+ int inoutQty = dtlEntity.getCddQty() - baseInfo.getStckQty(); // 입출고수량
|
|
124
|
+ StckMgntDtlHistEntity sourceHist = new StckMgntDtlHistEntity();
|
|
125
|
+ sourceHist.setStckMgntDtlNo(fnGetDealNo(32, "")); // 재고관리상세번호
|
|
126
|
+ sourceHist.setBrandId(stckEntity.getBrandId());
|
|
127
|
+ sourceHist.setWhsId(stckEntity.getWhsId());
|
|
128
|
+ sourceHist.setLocation(stckEntity.getLocation());
|
|
129
|
+ sourceHist.setItemId(stckEntity.getItemId());
|
|
130
|
+ sourceHist.setItemNm(baseInfo.getItemNm());
|
|
131
|
+ sourceHist.setInoutCd(inoutQty >= 0 ? InOutCd.IN.getCd() : InOutCd.OUT.getCd()); // 입출고구분
|
|
132
|
+ sourceHist.setInoutQty(inoutQty); // 입출고수량
|
|
133
|
+ sourceHist.setChgDvsn(ChgDvsn.STOCK_CDD.getCd()); // 재고실사
|
|
134
|
+ stockMngMapper.insertStckMgntDtlHist(userId, sourceHist);
|
133
|
135
|
|
134
|
136
|
idx++;
|
135
|
137
|
}
|