From 455b965c6435b5359bb5c25f2b6810dbc06f5481 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期五, 13 二月 2026 17:56:39 +0800
Subject: [PATCH] Merge branch 'dev_New_kthg' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_kthg
---
src/main/resources/mapper/production/ProductionProductMainMapper.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionProductMainMapper.xml b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
index aeb4230..fee9cdc 100644
--- a/src/main/resources/mapper/production/ProductionProductMainMapper.xml
+++ b/src/main/resources/mapper/production/ProductionProductMainMapper.xml
@@ -63,7 +63,7 @@
sl.sales_contract_no,
sl.customer_name,
p.product_name,
- pm.model,
+ pm.model as product_model_name,
pm.unit,
slpa.process,
ppo.quantity,
@@ -71,7 +71,7 @@
slpa.work_hours * slpa.finished_num AS wages
FROM
production_product_main ppm
- LEFT JOIN sales_ledger_production_accounting slpa ON slpa.sales_ledger_work_id = ppm.id
+ LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id
LEFT JOIN production_product_output ppo ON ppm.id = ppo.product_main_id
LEFT JOIN product_work_order pwo ON pwo.id = ppm.work_order_id
LEFT JOIN product_order po ON po.id = pwo.product_order_id
@@ -83,6 +83,28 @@
<if test="ew.schedulingUserName != null and ew.schedulingUserName !=''">
and slpa.scheduling_user_name = #{ew.schedulingUserName}
</if>
+ <if test="ew.entryDate != null " >
+ and slpa.scheduling_date >= #{ew.entryDate}
+ and slpa.scheduling_date < DATE_ADD(#{ew.entryDate}, INTERVAL 1 DAY)
+ </if>
+ <if test="ew.entryDateStart != null and ew.entryDateEnd != null" >
+ and slpa.scheduling_date >= #{ew.entryDateStart}
+ and slpa.scheduling_date < 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
+ left join product_work_order pwo on pwo.id = ppm.work_order_id
+ left join product_order po on po.id = pwo.product_order_id
+ left join sales_ledger sl on sl.id = po.sales_ledger_id
+ <where>
+ <if test="idList != null and idList.size() > 0">
+ and sl.id in
+ <foreach item="id" collection="idList" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </if>
</where>
</select>
@@ -93,4 +115,30 @@
#{id}
</foreach>
</delete>
+
+ <select id="queryProductInputAndOutput" resultType="Hashmap">
+ select *
+ from (select p.product_name as productName,
+ pm.model as model,
+ pm.unit as unit,
+ temp.inputQuantity as inputQuantity,
+ temp.outputQuantity as outputQuantity
+ from (select product_model_id,
+ coalesce(sum(inputQuantity), 0) as inputQuantity,
+ coalesce(sum(outputQuantity), 0) as outputQuantity
+ from ((select product_model_id, coalesce(sum(quantity), 0) as inputQuantity, 0 as outputQuantity
+ from production_product_input
+ where create_time >= #{ew.startTime}
+ and create_time < #{ew.endTime}
+ group by product_model_id)
+ union all
+ (select product_model_id, 0 as inputQuantity, coalesce(sum(quantity), 0) as outputQuantity
+ from production_product_output
+ where create_time >= #{ew.startTime}
+ and create_time < #{ew.endTime}
+ group by product_model_id)) t
+ group by product_model_id) temp
+ left join product_model pm on temp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id) tmp
+ </select>
</mapper>
--
Gitblit v1.9.3