From a76e1d17d67641993dea6335cb8e1465a94df58d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 21 五月 2026 15:39:05 +0800
Subject: [PATCH] feat(stock): 优化库存管理和成品树结构功能 1- 为ApproveProcessMapper.xml和ProductBomMapper.xml添加排序功能 2- 在ProductionProductMainDto中新增bomInputQty字段用于产品结构投入数量 3- 修改ProductionProductMainServiceImpl中投入数量计算逻辑,使用前端传入的bomInputQty值 4- 在ProductWorkOrderDto中添加bomInputQty字段并在服务实现中计算标准投入数量 5- 更新SalesLedgerMapper.xml查询逻辑,从product_summary获取电压信息 6- 为SalesLedgerProduct添加stockId字段并修改库存扣减逻辑使用具体库存ID 7- 重构StockInventoryController中的成品库存树查询接口和导入导出功能 8- 新增成品和非成品库存导入导出的数据模型和Excel工具类 9- 优化StockInventoryServiceImpl中的库存扣减逻辑,支持按特定库存ID操作 10- 更新库存导入导出功能,区分成品和非成品类型并提供相应模板

---
 src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml |   68 +++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 29 deletions(-)

diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index 78aaaa6..e4200af 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -2,48 +2,58 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper">
 
-    <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerPageDto">
+    <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger">
         SELECT
-        mil.id,
-        mil.user_id,
-        mil.user_name,
-        mil.code,
-        sd.dept_name,
-        mil.installation_location,
-        mil.unit,
-        mil.cycle,
-        mil.name,
-        mil.model,
-        mil.most_date,
-        mil.valid,
-        mil.next_date,
-        mil.record_date,
-        mil.create_user,
-        mil.create_time,
-        mil.update_user,
-        mil.update_time,
-        mil.tenant_id
+        id,
+        user_id,
+        user_name,
+        code,
+        name,
+        model,
+        most_date,
+        valid,
+        next_date,
+        record_date,
+        CASE
+        WHEN most_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
+        ELSE 2
+        END AS status,
+        create_user,
+        create_time,
+        update_user,
+        update_time,
+        tenant_id,
+        unit,
+        dept_id,
+        instation_location,
+        cycle
         FROM
-        measuring_instrument_ledger mil
-        left join sys_dept sd on sd.id = mil.dept_id
+        measuring_instrument_ledger
         <where>
             <!-- 鏌ヨ鏉′欢鍚屼笂 -->
             <if test="req.code != null and req.code != ''">
-                AND mil.code LIKE CONCAT('%', #{req.code}, '%')
+                AND code LIKE CONCAT('%', #{req.code}, '%')
             </if>
             <if test="req.name != null and req.name != ''">
-                AND mil.name LIKE CONCAT('%', #{req.name}, '%')
+                AND name LIKE CONCAT('%', #{req.name}, '%')
             </if>
             <if test="req.status != null">
-                AND mil.status = #{req.status}
+                <choose>
+                    <when test="req.status == 1">
+                        AND most_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d')
+                    </when>
+                    <when test="req.status == 2">
+                        AND most_date &lt;  DATE_FORMAT(now(),'%Y-%m-%d')
+                    </when>
+                </choose>
             </if>
             <if test="req.tenantId != null">
-                AND mil.tenant_id = #{req.tenantId}
+                AND tenant_id = #{req.tenantId}
             </if>
             <if test="req.recordDate != null">
-                AND mil.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
+                AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
             </if>
         </where>
-        ORDER BY mil.update_time DESC
+        ORDER BY update_time DESC
     </select>
-</mapper>
\ No newline at end of file
+</mapper>

--
Gitblit v1.9.3