修改库存统计问题

This commit is contained in:
qiankunpingtai
2019-05-24 09:16:25 +08:00
parent 326ff09733
commit a7c56d6b27

View File

@@ -611,24 +611,24 @@
AND intype.BasicInNumber > 0 AND intype.BasicInNumber > 0
</select> </select>
<select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal"> <select id="getCurrentRepByMaterialIdAndDepotId" resultType="java.math.BigDecimal">
select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal) select ((curep.inTotal+curep.transfInTotal+curep.assemInTotal+curep.disAssemInTotal)
-(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo -(curep.transfOutTotal+curep.outTotal+curep.assemOutTotal+curep.disAssemOutTotal)) as currentRepo
from from
(select sum(dh.type='入库' and di.DepotId=#{depotId}) as inTotal, (select sum(if(dh.type='入库' and di.DepotId=#{depotId},di.BasicNumber,0)) as inTotal,
sum(dh.SubType='调拨' and di.AnotherDepotId=#{depotId}) as transfInTotal, sum(if(dh.SubType='调拨' and di.AnotherDepotId=#{depotId},di.BasicNumber,0)) as transfInTotal,
sum(dh.SubType='调拨' and di.DepotId=#{depotId}) as transfOutTotal, sum(if(dh.SubType='调拨' and di.DepotId=#{depotId},di.BasicNumber,0)) as transfOutTotal,
sum(dh.type='出库' and dh.SubType!='调拨' and di.DepotId=#{depotId}) as outTotal, sum(if(dh.type='出库' and dh.SubType!='调拨' and di.DepotId=#{depotId},di.BasicNumber,0)) as outTotal,
sum(dh.SubType='组装单' and di.MType='组合件' and di.DepotId=#{depotId}) as assemInTotal, sum(if(dh.SubType='组装单' and di.MType='组合件' and di.DepotId=#{depotId},di.BasicNumber,0)) as assemInTotal,
sum(dh.SubType='组装单' and di.MType='普通子件' and di.DepotId=#{depotId}) as assemOutTotal, sum(if(dh.SubType='组装单' and di.MType='普通子件' and di.DepotId=#{depotId},di.BasicNumber,0)) as assemOutTotal,
sum(dh.SubType='拆卸单' and di.MType='普通子件' and di.DepotId=#{depotId}) as disAssemInTotal, sum(if(dh.SubType='拆卸单' and di.MType='普通子件' and di.DepotId=#{depotId},di.BasicNumber,0)) as disAssemInTotal,
sum(dh.SubType='拆卸单' and di.MType='组合件' and di.DepotId=#{depotId}) as disAssemOutTotal sum(if(dh.SubType='拆卸单' and di.MType='组合件' and di.DepotId=#{depotId},di.BasicNumber,0)) as disAssemOutTotal
from from
jsh_depothead dh,jsh_depotitem di jsh_depothead dh,jsh_depotitem di
where 1=1 where 1=1
and dh.id=di.HeaderId and dh.id=di.HeaderId
and di.MaterialId=#{materialId} and di.MaterialId=#{materialId}
and ifnull(dh.delete_Flag,'0') !='1' and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1') curep and ifnull(di.delete_Flag,'0') !='1') curep
</select> </select>
</mapper> </mapper>