解决修正成本的接口的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,7 +1075,9 @@ public class DepotItemService {
//数量*单价 另外计算新的成本价 //数量*单价 另外计算新的成本价
currentAllPrice = currentAllPrice.add(item.getAllPrice()); currentAllPrice = currentAllPrice.add(item.getAllPrice());
currentNumber = currentNumber.add(item.getBnum()); currentNumber = currentNumber.add(item.getBnum());
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP); if(currentNumber.compareTo(BigDecimal.ZERO)!=0) {
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP);
}
} }
} }
//出库 //出库
@@ -1085,7 +1087,9 @@ public class DepotItemService {
//数量*单价 另外计算新的成本价 //数量*单价 另外计算新的成本价
currentAllPrice = currentAllPrice.add(item.getAllPrice()); currentAllPrice = currentAllPrice.add(item.getAllPrice());
currentNumber = currentNumber.add(item.getBnum()); currentNumber = currentNumber.add(item.getBnum());
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP); if(currentNumber.compareTo(BigDecimal.ZERO)!=0) {
currentUnitPrice = currentAllPrice.divide(currentNumber, 2, BigDecimal.ROUND_HALF_UP);
}
} else { } else {
currentNumber = currentNumber.add(item.getBnum()); currentNumber = currentNumber.add(item.getBnum());
BigDecimal outNum = item.getBnum()!=null?item.getBnum():BigDecimal.ZERO; 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 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, 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, (select dh.number,me.bar_code,m.name material_name,dh.type,dh.sub_type,
case case
when type='入库' then ifnull(di.basic_number,0) when type='入库' then ifnull(di.basic_number,0)