xuhy
22 小时以前 206fcf7d6afae27856f63cf0158f53b61fa1b86f
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -123,7 +123,7 @@
        t1.warehousing_number,
        t2.create_time,
        t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num,
        t3.sales_amount,
        t2.unit_amount as sales_amount,
        t1.expiry_date
        from t_erp_supplier_warehousing_batch t1
        LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
@@ -159,6 +159,42 @@
        <if test="query.warehouseNo != null and query.warehouseNo != ''">
            and t2.warehouse_no = #{query.warehouseNo}
        </if>
        GROUP BY t1.id
        ) as o
        where (o.warehousing_number -o.outbound_count) >0
        order by o.create_time desc
    </select>
    <select id="pageInventoryGoodsList" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO">
        select * from (
        SELECT t1.id,t2.warehouse_no,
        t3.goods_name,
        t4.supplier_name,
        t3.type_id,
        t3.packing_unit_id,
        t3.quasi_number,
        t3.goods_id_code,
        t1.batch_number,
        coalesce(sum(t5.outbound_count),0) as outbound_count,
        t1.warehousing_number,
        t2.create_time,
        t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num,
        t2.unit_amount as sales_amount,
        t1.expiry_date
        from t_erp_supplier_warehousing_batch t1
        LEFT JOIN t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
        LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id
        LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id
        LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id
        where t2.disabled = 0 and t2.warehouse_id = #{warehouseId}
        and #{time} > t1.expiry_date
        <if test="user.roleType !=null and user.roleType ==4">
            and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=1
        </if>
        <if test="user.roleType !=null and user.roleType ==5">
            and t3.supplier_clinic_id =#{supplierClinicId} and t3.goods_source=2
        </if>
        GROUP BY t1.id
        ) as o
        where (o.warehousing_number -o.outbound_count) >0
        order by o.create_time desc