liujie
11 小时以前 64c137c7d5bcdba2ff6be176f58e40e71d500aa5
ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
@@ -22,6 +22,9 @@
    <sql id="Base_Column_List">
        id, clinic_id, procurement_code, pay_money, pay_number, pay_transaction_id, status, create_time, update_time, create_by, update_by, disabled
    </sql>
    <sql id="Base_Column_List1">
        t1.id, t1.supplier_clinic_id, t1.goods_source, t1.goods_name, t1.goods_id_code, t1.quasi_number, t1.manufacturer, t1.formulation_spec, t1.packing_spec, t1.type_id, t1.goods_yards, t1.maintenance_interval, t1.low_purchase_quantity, t1.low_unit_id, t1.is_prescription_drug, t1.goods_spec, t1.warning_inventory, t1.sales_amount, t1.packing_unit_id, t1.instructions_use, t1.side_effect, t1.clinic_purchase_price, t1.platform_commission_price, t1.create_time, t1.update_time, t1.create_by,t1.`state`, t1.update_by, t1.disabled,
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TErpProcurementVo">
        select t1.id,
@@ -57,7 +60,21 @@
            and t1.create_time between #{sTime} and #{eTime}
        </if>
    </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
        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>
</mapper>