优化报表,增加条码查询

This commit is contained in:
季圣华
2021-07-16 00:49:14 +08:00
parent 7e3f70f292
commit ce7a6ff343
6 changed files with 88 additions and 39 deletions

View File

@@ -37,6 +37,7 @@
<resultMap extends="com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap" id="ResultByMaterial" type="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
<result column="MId" jdbcType="VARCHAR" property="MId" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="MName" jdbcType="VARCHAR" property="MName" />
<result column="MMfrs" jdbcType="VARCHAR" property="MMfrs" />
<result column="MModel" jdbcType="VARCHAR" property="MModel" />
@@ -52,6 +53,7 @@
<resultMap id="ResultStockWarningCount" type="com.jsh.erp.datasource.vo.DepotItemStockWarningCount">
<result column="MId" jdbcType="VARCHAR" property="MId" />
<result column="bar_code" jdbcType="VARCHAR" property="barCode" />
<result column="MName" jdbcType="VARCHAR" property="MName" />
<result column="MMfrs" jdbcType="VARCHAR" property="MMfrs" />
<result column="MModel" jdbcType="VARCHAR" property="MModel" />
@@ -168,7 +170,7 @@
</select>
<select id="findByAll" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultByMaterial">
select m.id MId, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,
select m.id MId, me.bar_code, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
m.unit MaterialUnit, m.color MColor, u.name unit_name,
(select purchase_decimal from jsh_material_extend me
@@ -176,12 +178,13 @@
purchase_decimal
from jsh_material m
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.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_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="endTime != null">
and dh.oper_time &lt;= #{endTime}
@@ -198,11 +201,12 @@
select count(1) from (select m.id
from jsh_material m
left join jsh_depot_item di 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'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
where 1=1
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="endTime != null">
and dh.oper_time &lt;= #{endTime}
@@ -373,21 +377,23 @@
</select>
<select id="findStockWarningCount" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="ResultStockWarningCount">
select m.id MId, m.name MName, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
select m.id MId, m.name MName, me.bar_code, m.mfrs MMfrs, m.model MModel, m.standard MStandard,m.color MColor,
m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,
m.unit MaterialUnit, u.name unit_name,mcs.current_number,ifnull(m.safety_stock,0) safetystock,
(ifnull(m.safety_stock,0)-mcs.current_number) linjieNumber
from jsh_material m
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(m.safety_stock,0) > mcs.current_number
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="depotId != null">
and mcs.depot_id= #{depotId}
@@ -403,16 +409,18 @@
select count(1) from
(select m.id
from jsh_material m
left join jsh_material_extend me on me.material_id=m.id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_material_current_stock mcs on mcs.material_id=m.id and ifnull(mcs.delete_Flag,'0') !='1'
left join jsh_depot_item di on di.material_id=m.id and ifnull(di.delete_Flag,'0') !='1'
left join jsh_depot_head dh on di.header_id=dh.id and ifnull(dh.delete_flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where 1=1
and me.default_flag=1
and ifnull(m.delete_flag,'0') !='1'
and ifnull(m.safety_stock,0) > mcs.current_number
<if test="materialParam != null and materialParam !=''">
<bind name="bindKey" value="'%'+materialParam+'%'"/>
and (m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="depotId != null">
and mcs.depot_id= #{depotId}