xuhy
4 天以前 433bc1e314ecfd483379ca0e2e74e7c815d3261f
ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -47,10 +47,11 @@
    <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo">
        select t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName,
       select * from (select t2.warehouse_no warehousingNo, t4.goods_name, t4.quasi_number, t1.batch_number, t1.id as
        batchId,t1.expiry_date, t4.id as goodsId,t5.type_name,t6.unit_name packingUnitName,
        case
        when t3.id is null then t1.warehousing_number
        else t1.warehousing_number -t3.outbound_count
        else t1.warehousing_number -coalesce(sum(t3.outbound_count),0)
        end as num
        from t_erp_clinic_warehousing_batch t1
        left join t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id
@@ -59,7 +60,6 @@
        left join t_erp_goods_type t5 on t4.type_id = t5.id
        left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id
        where #{time} > t1.expiry_date
        and (t1.warehousing_number - t3.outbound_count > 0 or t3.id is null)
        <if test="user.roleType !=null and user.roleType ==5">
            and t2.clinic_id =#{supplierClinicId}
        </if>
@@ -75,7 +75,10 @@
        <if test="query.typeId != null and query.typeId != ''">
            and t4.type_id = #{query.typeId}
        </if>
        order by t1.expiry_date
        group by t1.id
        ) as o
        where  o.num >0
        order by o.expiry_date
    </select>
@@ -85,13 +88,17 @@
    <select id="pageList" resultType="com.ruoyi.system.vo.TErpGoodsVO">
        select * from (
        select <include refid="Base_Column_List1"/>
        COALESCE(sum(t2.purchase_count), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum,
        SUM(t2.unit_amount * (t2.purchase_count - COALESCE(t3.outbound_count, 0))) as allTotalPrice,
        COALESCE(sum(t2.warehousing_number), 0) - COALESCE(sum(t3.outbound_count), 0) as allNum,
        SUM(t2.unit_amount * (t2.warehousing_number - COALESCE(t3.outbound_count, 0))) as allTotalPrice,
        t3.outbound_count,
        COALESCE(sum(t3.outbound_count), 0) as outNum,t4.create_time as createTime1
        from t_erp_goods t1  left join  t_erp_clinic_warehousing_batch t2  on t1.id = t2.goods_id
            left join  t_erp_clinic_warehousing t4 on t2.warehousing_id = t4.id
        left join  t_erp_clinic_outbound_goods t3 on t2.id = t3.warehousing_id
        left join  t_erp_clinic_warehousing t4 on t2.warehousing_id = t4.id
        left join (
        select warehousing_batch_id, sum(outbound_count) as outbound_count
        from t_erp_clinic_outbound_goods
        group by warehousing_batch_id
        ) t3 on t2.id = t3.warehousing_batch_id
        where t1.disabled = 0 and t2.id is not null
        <if test="query.goodsName != null and query.goodsName != ''">
            and t1.goods_name like concat('%',#{query.goodsName},'%')