| | |
| | | <select id="inventoryNotEnoughList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> |
| | | select * from ( |
| | | select <include refid="Base_Column_List1"/> |
| | | COALESCE(sum(t2.goods_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum, |
| | | SUM(t2.unit_amount * (t2.goods_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice, |
| | | COALESCE(sum(t5.purchase_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum, |
| | | SUM(t5.unit_amount * (t5.purchase_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice, |
| | | |
| | | COALESCE(sum(t3.outbound_count), 0) as outNum |
| | | from t_erp_goods t1 left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id |
| | | left join t_erp_supplier_outbound_goods t3 on t2.id = t3.warehousing_id |
| | | left join t_crm_supplier t4 on t1.supplier_clinic_id = t4.id and t1.goods_source =1 and t4.status =1 |
| | | where t1.disabled = 0 and t2.id is not null and t1.goods_source =1 and t1.clinic_purchase_price is not null |
| | | from t_erp_goods t1 |
| | | LEFT JOIN t_erp_clinic_warehousing_batch t5 ON t5.goods_id = t1.id |
| | | LEFT JOIN t_erp_clinic_outbound_goods t3 ON t3.warehousing_batch_id = t5.id |
| | | LEFT JOIN t_crm_clinic t4 ON t4.id = t1.supplier_clinic_id |
| | | where t1.disabled = 0 and t5.id is not null |
| | | and (t1.supplier_clinic_id = #{clinicId} or FIND_IN_SET(#{clinicId},t1.clinic_ids)) |
| | | GROUP BY t1.id |
| | | ) o where 1=1 |
| | | and o.warning_inventory > (o.allNum-o.outNum) |
| | | order by o.create_time desc |
| | | </select> |
| | | <!-- <select id="inventoryNotEnoughList" resultType="com.ruoyi.system.vo.TErpGoodsVO">--> |
| | | <!-- select * from (--> |
| | | <!-- select <include refid="Base_Column_List1"/>--> |
| | | <!-- COALESCE(sum(t2.goods_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum,--> |
| | | <!-- SUM(t2.unit_amount * (t2.goods_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice,--> |
| | | |
| | | <!-- COALESCE(sum(t3.outbound_count), 0) as outNum--> |
| | | <!-- from t_erp_goods t1 left join t_erp_supplier_warehousing t2 on t1.id = t2.goods_id--> |
| | | <!-- left join t_erp_supplier_outbound_goods t3 on t2.id = t3.warehousing_id--> |
| | | <!-- left join t_crm_supplier t4 on t1.supplier_clinic_id = t4.id and t1.goods_source =1 and t4.status =1--> |
| | | <!-- where t1.disabled = 0 and t2.id is not null and t1.goods_source =1 and t1.clinic_purchase_price is not null--> |
| | | <!-- GROUP BY t1.id--> |
| | | <!-- ) o where 1=1--> |
| | | <!-- and o.warning_inventory > (o.allNum-o.outNum)--> |
| | | <!-- order by o.create_time desc--> |
| | | <!-- </select>--> |
| | | <select id="pageListWarehouse" resultType="com.ruoyi.system.vo.TErpProcurementVo"> |
| | | select t1.id, |
| | | t1.procurement_code, |