From cd0984bff3ac9c4480685671d4e033c8b082bfed Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 04 六月 2026 17:04:39 +0800
Subject: [PATCH] 发货去除库存数量限制,产品库存不足也可以发货,库存数量可以展示为负

---
 src/main/resources/mapper/production/ProductionProductMainMapper.xml |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index a122e90..df33e70 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -22,6 +22,7 @@
         pm.model as productModelName,
         ppo.quantity,
         ppo.scrap_qty,
+        ppo.add_qty,
         pm.unit,
         sl.sales_contract_no salesContractNo
         from
@@ -36,8 +37,8 @@
         left join sales_ledger sl on sl.id = po.sales_ledger_id
         left join sys_user u on u.user_id = ppm.user_id
         <where>
-            <if test="c.nickName != null and c.nickName != ''">
-                and u.nick_name like concat('%',#{c.nickName},'%')
+            <if test="c.teamNames != null and c.teamNames != ''">
+                and ppm.team_names like concat('%',#{c.teamNames},'%')
             </if>
             <if test="c.workOrderNo != null and c.workOrderNo != ''">
                 and pwo.work_order_no like concat('%',#{c.workOrderNo},'%')
@@ -48,8 +49,14 @@
             <if test="c.status != null and c.status != ''">
                 and ppm.status = #{c.status}
             </if>
+            <if test="c.auditStatus != null">
+                and ppm.audit_status = #{c.auditStatus}
+            </if>
+            <if test="c.workOrderId != null">
+                and ppm.work_order_id = #{c.workOrderId}
+            </if>
         </where>
-        order by ppm.id
+        order by  ppm.id desc
 
     </select>
     <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder">
@@ -71,7 +78,16 @@
         slpa.process,
         ppo.quantity,
         slpa.work_hours,
-        slpa.work_hours * slpa.finished_num AS wages
+        slpa.work_hours * slpa.finished_num AS wages,
+        dl.device_name,
+        slpa.work_hour as work_minutes,
+        IFNULL(
+        TIMESTAMPDIFF(MINUTE, ppm.start_time, ppm.end_time),
+        0
+        ) AS work_minutes,
+        ppo.add_qty,
+        ppo.scrap_qty,
+        ppo.replenish_qty
         FROM
         production_product_main ppm
         LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id
@@ -82,7 +98,8 @@
         LEFT JOIN product_model pm ON po.product_model_id = pm.id
         LEFT JOIN product p ON p.id = pm.product_id
         LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id
-        <where>
+        left join device_ledger dl ON dl.id = slpa.device_id
+        where ppm.audit_status = 1
             <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''">
                 and slpa.scheduling_user_name = #{ew.schedulingUserName}
             </if>
@@ -94,7 +111,6 @@
                 and slpa.scheduling_date >= #{ew.entryDateStart}
                 and slpa.scheduling_date &lt; date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY)
             </if>
-        </where>
     </select>
     <select id="listMain" resultType="java.lang.Long">
         SELECT ppm.id FROM production_product_main ppm
@@ -118,4 +134,4 @@
             #{id}
         </foreach>
     </delete>
-</mapper>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3