"admin-console/src/vscode:/vscode.git/clone" did not exist on "44927efb0d5828dec55234cb276d466c33626fc7"
Commit 0e82eac9 authored by 季圣华's avatar 季圣华
Browse files

解决库存计算的bug

parent 37d526b6
...@@ -650,6 +650,8 @@ public class DepotItemService { ...@@ -650,6 +650,8 @@ public class DepotItemService {
BigDecimal assemOutTotal = stockObj.getAssemOutTotal(); BigDecimal assemOutTotal = stockObj.getAssemOutTotal();
BigDecimal disAssemOutTotal = stockObj.getDisAssemOutTotal(); BigDecimal disAssemOutTotal = stockObj.getDisAssemOutTotal();
outSum = outTotal.subtract(transfOutTotal).subtract(assemOutTotal).subtract(disAssemOutTotal); outSum = outTotal.subtract(transfOutTotal).subtract(assemOutTotal).subtract(disAssemOutTotal);
//取绝对值
outSum = outSum.abs();
} }
if(stockCheckSum.compareTo(BigDecimal.ZERO)>0) { if(stockCheckSum.compareTo(BigDecimal.ZERO)>0) {
inSum = inSum.add(stockCheckSum); inSum = inSum.add(stockCheckSum);
......
...@@ -328,11 +328,17 @@ ...@@ -328,11 +328,17 @@
</if> </if>
</sql> </sql>
<sql id="anotherDepotParam">
<if test="depotList.size()>0">
and di.another_depot_id in <foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">#{item}</foreach>
</if>
</sql>
<select id="getStockByParamWithDepotList" resultMap="stockMap"> <select id="getStockByParamWithDepotList" resultMap="stockMap">
select select
sum(case when dh.type='入库' <include refid="depotParam" /> then di.basic_number else 0 end) as inTotal, sum(case when dh.type='入库' <include refid="depotParam" /> then di.basic_number else 0 end) as inTotal,
sum(case when dh.type='出库' and dh.sub_type!='调拨' <include refid="depotParam" /> then di.basic_number else 0 end) as outTotal, sum(case when dh.type='出库' and dh.sub_type!='调拨' <include refid="depotParam" /> then di.basic_number else 0 end) as outTotal,
sum(case when dh.sub_type='调拨' <include refid="depotParam" /> then di.basic_number else 0 end) as transfInTotal, sum(case when dh.sub_type='调拨' <include refid="anotherDepotParam" /> then di.basic_number else 0 end) as transfInTotal,
sum(case when dh.sub_type='调拨' <include refid="depotParam" /> then di.basic_number else 0 end) as transfOutTotal, sum(case when dh.sub_type='调拨' <include refid="depotParam" /> then di.basic_number else 0 end) as transfOutTotal,
sum(case when dh.sub_type='组装单' and di.material_type='组合件' <include refid="depotParam" /> then di.basic_number else 0 end) as assemInTotal, sum(case when dh.sub_type='组装单' and di.material_type='组合件' <include refid="depotParam" /> then di.basic_number else 0 end) as assemInTotal,
sum(case when dh.sub_type='组装单' and di.material_type='普通子件' <include refid="depotParam" /> then di.basic_number else 0 end) as assemOutTotal, sum(case when dh.sub_type='组装单' and di.material_type='普通子件' <include refid="depotParam" /> then di.basic_number else 0 end) as assemOutTotal,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment