|
|
@@ -534,7 +534,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
|
<select id="getRestStockByManyCabinet" parameterType="com.zd.chemical.domain.vo.ActRestStockManySearch" resultType="com.zd.chemical.domain.vo.ActRestStockManyVo">
|
|
|
- SELECT x1.cabinet_id cabinetId,CONCAT((IFNULL(x1.applyNum,0)-IFNULL(x2.stockNum,0))) restStock FROM (
|
|
|
+ SELECT x1.cabinet_id cabinetId,CASE WHEN CONCAT((IFNULL(x1.applyNum,0)-IFNULL(x2.stockNum,0)))>0
|
|
|
+ THEN CONCAT((IFNULL(x1.applyNum,0)-IFNULL(x2.stockNum,0))) ELSE 0 END restStock FROM (
|
|
|
SELECT hd.`cabinet_id`,IFNULL(SUM(hd.`apply_num`),0) applyNum FROM act_hxpapply ah LEFT JOIN act_hxpapply_detail hd ON ah.`id` = hd.`hxpapply_id`
|
|
|
LEFT JOIN act_applytask ak ON ah.`id` = ak.`task_id`
|
|
|
LEFT JOIN lab_subject st ON ah.sub_id = st.id
|
|
|
@@ -555,11 +556,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
GROUP BY hd.`cabinet_id`
|
|
|
)x1 LEFT JOIN
|
|
|
(
|
|
|
- SELECT cjc.`cabinet_id`,SUM(s.usages-s.tare) stockNum FROM hxp_stock s
|
|
|
- LEFT JOIN hxp_chemical_join_cabinet cjc ON s.`join_id` = cjc.`id`
|
|
|
- LEFT JOIN lab_subject st ON s.sub_id = st.id
|
|
|
+ SELECT cjc.`cabinet_id`,SUM(cjc.chemical_amount-cjc.tare) stockNum FROM
|
|
|
+ hxp_chemical_join_cabinet cjc
|
|
|
<where>
|
|
|
- s.status = 1
|
|
|
+ cjc.`status` IN(0,1)
|
|
|
<if test="chemicalId != null ">
|
|
|
and cjc.`chemical_id` = #{chemicalId}
|
|
|
</if>
|