解决修正成本的接口的bug

This commit is contained in:
jishenghua
2024-05-24 23:55:29 +08:00
parent ed9a99c552
commit 450985af37
2 changed files with 7 additions and 3 deletions

View File

@@ -1075,9 +1075,11 @@ public class DepotItemService {
//数量*单价 另外计算新的成本价
currentAllPrice = currentAllPrice.add(item.getAllPrice());
currentNumber = currentNumber.add(item.getBnum());
if(currentNumber.compareTo(BigDecimal.ZERO)!=0) {
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP);
}
}
}
//出库
if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(item.getType())) {
//采购退货
@@ -1085,7 +1087,9 @@ public class DepotItemService {
//数量*单价 另外计算新的成本价
currentAllPrice = currentAllPrice.add(item.getAllPrice());
currentNumber = currentNumber.add(item.getBnum());
if(currentNumber.compareTo(BigDecimal.ZERO)!=0) {
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP);
}
} else {
currentNumber = currentNumber.add(item.getBnum());
BigDecimal outNum = item.getBnum()!=null?item.getBnum():BigDecimal.ZERO;

View File

@@ -147,7 +147,7 @@
<select id="findDetailByDepotIdsAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
select tb.number, tb.bar_code, tb.material_name, tb.type, tb.sub_type, tb.b_num, tb.unit_price,
tb.b_num*tb.unit_price as all_price, tb.depotName, tb.oTime from
ifnull(tb.b_num*tb.unit_price,0) as all_price, tb.depotName, tb.oTime from
(select dh.number,me.bar_code,m.name material_name,dh.type,dh.sub_type,
case
when type='入库' then ifnull(di.basic_number,0)