liujie
3 天以前 f41b11c958ef7d0416d194278d1fe7cd1a1e8219
ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -76,7 +76,7 @@
            and goods_source =1 and supplier_clinic_id = #{query.supplierClinicId}
        </if>
        <if test="user.roleType != null and user.roleType == 5 ">
            and goods_source =2 and supplier_clinic_id = #{query.supplierClinicId}
            and  ( (goods_source =2 and supplier_clinic_id = #{query.supplierClinicId} ) or FIND_IN_SET(#{query.supplierClinicId},clinic_ids) )
        </if>
        order by create_time desc
    </select>
@@ -164,6 +164,55 @@
        where (o.warehousing_number -o.outbound_count) >0
        order by o.create_time desc
    </select>
    <select id="pageInventoryGoodsPageList1" resultType="com.ruoyi.system.vo.TErpGoodsInventoryVO">
        select * from (
        SELECT t1.id,t2.warehouse_no,
        t3.goods_name,t3.goods_source,
        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_clinic_warehousing_batch t1
        LEFT JOIN t_erp_clinic_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_clinic_outbound_goods t5 on t5.warehousing_batch_id =t1.id
        where t2.disabled = 0 and t2.warehouse_id = #{query.warehouseId}
        <if test="query.type != null and query.type ==1">
            and #{time} > t1.expiry_date
        </if>
        <if test="query.goodsName != null and query.goodsName != ''">
            and t3.goods_name like concat('%',#{query.goodsName},'%')
        </if>
        <if test="query.supplierName != null and query.supplierName != ''">
            and (t4.supplier_name like concat('%',#{query.supplierName},'%') or t3.supplierName like concat('%',#{query.supplierName},'%'))
        </if>
        <if test="query.typeId != null and query.typeId != ''">
            and t3.type_id = #{query.typeId}
        </if>
        <if test="query.quasiNumber != null and query.quasiNumber != ''">
            and t3.quasi_number =#{query.quasiNumber}
        </if>
        <if test="query.batchNumber != null and query.batchNumber != ''">
            and t1.batch_number =#{query.batchNumber}
        </if>
        <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,
@@ -199,5 +248,40 @@
        where (o.warehousing_number -o.outbound_count) >0
        order by o.create_time desc
    </select>
    <select id="pageInventoryGoodsList1" 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_clinic_warehousing_batch t1
        LEFT JOIN t_erp_clinic_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 #{endDate} > 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
    </select>
</mapper>