优化商品库存流水接口

This commit is contained in:
季圣华
2021-09-12 23:35:24 +08:00
parent dc29a7279f
commit 9441d7e7e8
3 changed files with 29 additions and 3 deletions

View File

@@ -4,6 +4,8 @@
<resultMap id="DetailByTypeAndMIdResultMap" type="com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId">
<result column="number" jdbcType="VARCHAR" property="number" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="material_name" jdbcType="VARCHAR" property="materialName" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="sub_type" jdbcType="VARCHAR" property="subType" />
<result column="b_num" jdbcType="BIGINT" property="bnum" />
@@ -120,7 +122,7 @@
</select>
<select id="findDetailByTypeAndMaterialIdList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="DetailByTypeAndMIdResultMap">
select dh.number,dh.type,dh.sub_type,
select dh.number,me.bar_code,m.name material_name,dh.type,dh.sub_type,
case
when type='入库' then ifnull(di.basic_number,0)
when type='出库' then 0-di.basic_number
@@ -135,7 +137,9 @@
(select name from jsh_depot d where d.id=di.depot_id and ifnull(d.delete_flag,'0') !='1') as depotName,
date_format(dh.oper_time,'%Y-%m-%d %H:%i:%S') as oTime
from jsh_depot_head dh
INNER JOIN jsh_depot_item di on dh.id=di.header_id and ifnull(di.delete_flag,'0') !='1'
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 di.material_id=m.id and ifnull(m.delete_flag,'0') !='1'
left join jsh_material_extend me on me.id=di.material_extend_id and ifnull(me.delete_Flag,'0') !='1'
where ((dh.type!='其它' and dh.sub_type!='调拨')
or (dh.type='其它' and dh.sub_type='组装单')
or (dh.type='其它' and dh.sub_type='拆卸单')