xuhy
2026-01-23 127a7be36b05ded77e16d6651f55c0d4db848a2c
诊所一键添加库存修改
3个文件已修改
41 ■■■■■ 已修改文件
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpProcurementMapper.java
@@ -32,7 +32,7 @@
    List<TErpProcurementVo> pageList(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") String supplierClinicId);
    List<TErpGoodsVO> inventoryNotEnoughList(@Param("user") SysUser user);
    List<TErpGoodsVO> inventoryNotEnoughList(@Param("user") SysUser user, @Param("clinicId") String clinicId);
    List<TErpProcurementVo> pageListWarehouse(@Param("query") TErpProcurementQuery query, @Param("pageInfo") PageInfo<TErpProcurementVo> pageInfo, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") List<String> supplierClinicId);
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpProcurementServiceImpl.java
@@ -396,7 +396,14 @@
    @Override
    public List<TErpGoodsVO> inventoryNotEnoughList(SysUser user) {
        List<TErpGoodsVO> list = this.baseMapper.inventoryNotEnoughList(user);
        // 查询诊所
        TCrmClinic crmClinic = crmClinicMapper.selectOne(new LambdaQueryWrapper<TCrmClinic>().eq(TCrmClinic::getUserId, user.getUserId())
                .last("limit 1"));
        if (Objects.isNull(crmClinic)) {
            SysUser sysUser = sysUserService.selectUserById(user.getUserId());
            crmClinic = crmClinicMapper.selectById(sysUser.getObjectId());
        }
        List<TErpGoodsVO> list = this.baseMapper.inventoryNotEnoughList(user,crmClinic.getId());
        List<String> typeIds = list.stream().map(TErpGoodsVO::getTypeId).collect(Collectors.toList());
        if (!typeIds.isEmpty()) {
            List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds);
ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
@@ -74,19 +74,37 @@
    <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,