From c3013bb5d539cf08e8faad076c8ad323f9b683ae Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 21 十月 2025 11:26:40 +0800
Subject: [PATCH] 修改bug

---
 ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml   |    4 ++--
 ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml               |    6 +++++-
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java |    2 +-
 ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml         |    9 +++++----
 ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml |   17 +++++++++--------
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
index b5250c4..f126d56 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java
@@ -254,7 +254,7 @@
         }
         goods.setCreateId(user.getUserId().toString());
         goods.setGoodsIdCode(dto.getGoodsIdCode());
-        goods.setClinicPurchasePrice(dto.getSalesAmount());
+//        goods.setClinicPurchasePrice(dto.getSalesAmount());
         return R.ok(erpGoodsService.save(goods));
     }
 
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
index a601537..5932af2 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml
@@ -156,8 +156,8 @@
 
     </select>
     <select id="outboundPageList" resultType="com.ruoyi.system.vo.TErpClinicOutboundPageListVO">
-        select t1.id,t1.outbound_number,t1.order_number,t1.total_money allTotalPrice,t1.create_time ,t1.outbound_type,t2.user_name,t1.type_num
-        from t_erp_clinic_outbound t1 left join sys_user t2 on t1.create_by = t2.user_id
+        select t1.id,t1.outbound_number,t1.order_number,t1.total_money allTotalPrice,t1.create_time ,t1.outbound_type,t2.nick_name userName,t1.type_num
+        from t_erp_clinic_outbound t1 left join sys_user t2 on t1.create_id = t2.user_id
         where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId}
         <if test="query.outboundNumber != null and query.outboundNumber != ''">
             and t1.outbound_number like concat('%',#{query.outboundNumber},'%')
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
index ce69819..a7bf9f4 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml
@@ -259,7 +259,11 @@
         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
+        left join (
+        select warehousing_batch_id, sum(outbound_count) as outbound_count
+        from t_erp_supplier_outbound_goods
+        group by warehousing_batch_id
+        ) t5 on t5.warehousing_batch_id =t1.id
         where t2.disabled = 0 and t2.warehouse_id = #{warehouseId}
         and #{endDate} > t1.expiry_date
         <if test="user.roleType !=null and user.roleType ==4">
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
index c3b326c..a85f30e 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
@@ -35,7 +35,7 @@
         sum(t2.total_price) as totalPrice,
         t1.create_time,
         t2.id tErpProcurementGoodsId,
-        t4.user_name,
+        t1.create_by as userName,
         t1.status,
         t1.supplier_money,
         t1.money as platformMoney,
@@ -47,7 +47,7 @@
         left join t_crm_clinic t5 on t1.clinic_id = t5.id
         where t1.disabled = 0 and t1.status !=1
         <if test="user.roleType !=null and user.roleType==4">
-            and t2.supplier_id =#{supplierClinicId}
+            and t2.supplier_id =#{supplierClinicId} and t1.status in(3,4,5)
         </if>
         <if test="query.procurementCode != null and query.procurementCode != ''">
             and t1.procurement_code = #{query.procurementCode}
@@ -56,7 +56,7 @@
             and t3.supplier_name like concat('%',#{query.clinicName},'%')
         </if>
         <if test="query.userName != null and query.userName != ''">
-            and t4.user_name like concat('%',#{query.userName},'%')
+            and t1.create_by like concat('%',#{query.userName},'%')
         </if>
         <if test="query.status != null">
             and t1.status = #{query.status}
@@ -91,7 +91,8 @@
                t1.logistics_number,
                 t1.send_time,
                t1.clinic_id,
-               t1.status
+               t1.status,
+               t1.create_by  userName
                from t_erp_procurement t1
                left JOIN t_crm_clinic t2 on t1.clinic_id = t2.id
         where t1.disabled = 0 and t1.status in(3,4,5) and t1.supplier_id in
diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
index 52570a2..5b9b1a0 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpSupplierWarehousingMapper.xml
@@ -115,13 +115,14 @@
     <select id="validityPeriodWarning" resultType="com.ruoyi.system.vo.ValidityPeriodWarningVo">
         select * from (select t2.warehouse_id,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
-        end as num,t3.id as ogid
+        t1.warehousing_number -t3.outbound_count as num
         from t_erp_supplier_warehousing_batch t1
         left join t_erp_supplier_warehousing t2 on t1.warehousing_id = t2.id
-        LEFT JOIN t_erp_supplier_outbound_goods t3 on t3.warehousing_batch_id = t1.id
+        left join (
+        select warehousing_batch_id,  COALESCE(sum(outbound_count), 0) as outbound_count
+        from t_erp_supplier_outbound_goods
+        group by warehousing_batch_id
+        )  t3 on t3.warehousing_batch_id = t1.id
         LEFT JOIN t_erp_goods t4 on t2.goods_id = t4.id
         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
@@ -141,12 +142,12 @@
             and t4.type_id = #{query.typeId}
         </if>
         group by t1.id
-        ) as o where (o.num > 0 or o.ogid is null)
+        ) as o where (o.num > 0 )
         order by o.expiry_date
 
     </select>
     <select id="pageInventoryList" resultType="com.ruoyi.system.vo.PageInventoryListVo">
-        select t1.id,t1.create_time,t2.user_name createBy,t3.warehouse_name
+        select t1.id,t1.create_time,t1.create_by,t3.warehouse_name
         from t_erp_supplier_inventory t1 left join sys_user t2 on t1.create_id = t2.user_id
         left join t_crm_warehouse t3 on t1.warehouse_id =t3.id
         where t1.disabled = 0
@@ -157,7 +158,7 @@
             and t1.warehouse_id = #{query.warehouseId}
         </if>
         <if test="query.createBy != null and query.createBy != ''">
-            and t2.user_name like concat('%',#{query.createBy},'%')
+            and t1.create_by like concat('%',#{query.createBy},'%')
         </if>
         <if test="sTime != null and eTime !=null ">
             and t1.create_time between #{sTime} and #{eTime}

--
Gitblit v1.7.1