解决出入库统计报表计算的bug

This commit is contained in:
jishenghua
2024-04-15 13:52:58 +08:00
parent f2fe0ab84f
commit 1531155c7c
5 changed files with 74 additions and 9 deletions

View File

@@ -417,7 +417,7 @@
</select>
<select id="findInOutDetailStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select sum(di.oper_number) operNumber, sum(di.all_price) allPrice
select ifnull(sum(di.oper_number),0) operNumber, ifnull(sum(di.all_price),0) allPrice
from jsh_depot_head dh
left join jsh_depot_item di on di.header_id=dh.id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
@@ -610,7 +610,7 @@
</select>
<select id="findInOutMaterialCountStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultInOutMaterialCount">
select sum(di.basic_number) numSum, sum(di.all_price) priceSum
select ifnull(sum(di.basic_number),0) numSum, ifnull(sum(di.all_price),0) priceSum
from jsh_depot_head dh
left join jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'
@@ -780,7 +780,7 @@
</select>
<select id="findAllocationStatistic" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultWithInfoExMap">
select sum(di.oper_number) operNumber, sum(di.all_price) allPrice
select ifnull(sum(di.oper_number),0) operNumber, ifnull(sum(di.all_price),0) allPrice
from jsh_depot_head dh
left join jsh_depot_item di on di.header_id=dh.id and ifnull(di.delete_flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_flag,'0') !='1'

View File

@@ -589,6 +589,48 @@
and ifnull(di.delete_flag,'0') !='1'
</select>
<select id="buyOrSalePriceTotal" resultType="java.math.BigDecimal">
select ifnull(sum(di.all_price),0) as AllPrice
from jsh_depot_item di
left join jsh_depot_head dh on dh.id=di.header_id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material m on m.id=di.material_id and ifnull(m.delete_Flag,'0') !='1'
where ifnull(di.delete_flag,'0') !='1'
and dh.type=#{type} and dh.sub_type=#{subType}
and dh.oper_time &gt;= #{beginTime}
and dh.oper_time &lt;= #{endTime}
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="creatorArray != null">
and dh.creator in (
<foreach collection="creatorArray" item="creator" separator=",">
#{creator}
</foreach>
)
</if>
<if test="organId != null">
and dh.organ_id = #{organId}
</if>
<if test="organArray != null and organArray !=''">
and dh.organ_id in (
<foreach collection="organArray" item="organId" separator=",">
#{organId}
</foreach>
)
</if>
<if test="depotList.size()>0">
and di.depot_id in
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="forceFlag">
and (dh.status = '1' or dh.status = '2' or dh.status = '3')
</if>
</select>
<select id="inOrOutPrice" resultType="java.math.BigDecimal">
select ifnull(sum(discount_last_money),0) as allMoney from
(select distinct dh.id, dh.discount_last_money